Add spoof report mask in location object

Add the spoof mask report in location object
in position report and ZPP position report in
LocApiV02. Propagate this mask to the location
object in Location API module.

Change-Id: I5df87d389d5315c55ed2afce1f440a0486e4bebd
CRs-fixed: 2236154
This commit is contained in:
haohuang 2018-04-16 15:12:49 +08:00 committed by Gerrit - the friendly Code Review server
parent 8cc52b448c
commit 17015dd790
3 changed files with 25 additions and 0 deletions

View file

@ -248,6 +248,11 @@ GnssAdapter::convertLocation(Location& out, const UlpLocation& ulpLocation,
if (LOC_POS_TECH_MASK_SENSORS & techMask) { if (LOC_POS_TECH_MASK_SENSORS & techMask) {
out.techMask |= LOCATION_TECHNOLOGY_SENSORS_BIT; out.techMask |= LOCATION_TECHNOLOGY_SENSORS_BIT;
} }
if (LOC_GPS_LOCATION_HAS_SPOOF_MASK & ulpLocation.gpsLocation.flags) {
out.flags |= LOCATION_HAS_SPOOF_MASK;
out.spoofMask = ulpLocation.gpsLocation.spoof_mask;
}
} }
void void

View file

@ -70,6 +70,7 @@ typedef enum {
LOCATION_HAS_VERTICAL_ACCURACY_BIT = (1<<5), // location has valid vertical accuracy LOCATION_HAS_VERTICAL_ACCURACY_BIT = (1<<5), // location has valid vertical accuracy
LOCATION_HAS_SPEED_ACCURACY_BIT = (1<<6), // location has valid speed accuracy LOCATION_HAS_SPEED_ACCURACY_BIT = (1<<6), // location has valid speed accuracy
LOCATION_HAS_BEARING_ACCURACY_BIT = (1<<7), // location has valid bearing accuracy LOCATION_HAS_BEARING_ACCURACY_BIT = (1<<7), // location has valid bearing accuracy
LOCATION_HAS_SPOOF_MASK = (1<<8), // location has valid spoof mask
} LocationFlagsBits; } LocationFlagsBits;
typedef uint16_t LocationTechnologyMask; typedef uint16_t LocationTechnologyMask;
@ -80,6 +81,13 @@ typedef enum {
LOCATION_TECHNOLOGY_SENSORS_BIT = (1<<3), // location was calculated using Sensors LOCATION_TECHNOLOGY_SENSORS_BIT = (1<<3), // location was calculated using Sensors
} LocationTechnologyBits; } LocationTechnologyBits;
typedef uint32_t LocationSpoofMask;
typedef enum {
LOCATION_POSTION_SPOOFED = (1<<0), // location position spoofed
LOCATION_TIME_SPOOFED = (1<<1), // location time spoofed
LOCATION_NAVIGATION_DATA_SPOOFED = (1<<2), // location navigation data spoofed
} LocationSpoofBits;
typedef enum { typedef enum {
LOCATION_RELIABILITY_NOT_SET = 0, LOCATION_RELIABILITY_NOT_SET = 0,
LOCATION_RELIABILITY_VERY_LOW, LOCATION_RELIABILITY_VERY_LOW,
@ -531,6 +539,7 @@ typedef struct {
float speedAccuracy; // in meters/second float speedAccuracy; // in meters/second
float bearingAccuracy; // in degrees (0 to 359.999) float bearingAccuracy; // in degrees (0 to 359.999)
LocationTechnologyMask techMask; LocationTechnologyMask techMask;
LocationSpoofMask spoofMask;
} Location; } Location;
struct LocationOptions { struct LocationOptions {

View file

@ -100,6 +100,15 @@ typedef uint16_t LocGpsLocationFlags;
#define LOC_GPS_LOCATION_HAS_ACCURACY 0x0010 #define LOC_GPS_LOCATION_HAS_ACCURACY 0x0010
/** LocGpsLocation has valid vertical uncertainity */ /** LocGpsLocation has valid vertical uncertainity */
#define LOC_GPS_LOCATION_HAS_VERT_UNCERTAINITY 0x0040 #define LOC_GPS_LOCATION_HAS_VERT_UNCERTAINITY 0x0040
/** LocGpsLocation has valid spoof mask */
#define LOC_GPS_LOCATION_HAS_SPOOF_MASK 0x0080
/** Spoof mask in LocGpsLocation */
typedef uint32_t LocGpsSpoofMask;
#define LOC_GPS_LOCATION_NONE_SPOOFED 0x0000
#define LOC_GPS_LOCATION_POSITION_SPOOFED 0x0001
#define LOC_GPS_LOCATION_TIME_SPOOFED 0x0002
#define LOC_GPS_LOCATION_NAVIGATION_DATA_SPOOFED 0x0004
/** Flags for the loc_gps_set_capabilities callback. */ /** Flags for the loc_gps_set_capabilities callback. */
@ -533,6 +542,8 @@ typedef struct {
size_t size; size_t size;
/** Contains LocGpsLocationFlags bits. */ /** Contains LocGpsLocationFlags bits. */
uint16_t flags; uint16_t flags;
/** The spoof mask */
LocGpsSpoofMask spoof_mask;
/** Represents latitude in degrees. */ /** Represents latitude in degrees. */
double latitude; double latitude;
/** Represents longitude in degrees. */ /** Represents longitude in degrees. */