diff options
author | haohuang <haohuang@codeaurora.org> | 2018-04-16 15:12:49 +0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2018-06-07 21:56:37 -0700 |
commit | 17015dd790b13345c547709ef8b6144a3526d079 (patch) | |
tree | fcda56f7a95c6b66772ec2a5539d6af27f4c7324 | |
parent | 8cc52b448c15ab85a2786d08b6294371ccb96119 (diff) | |
download | gps-17015dd790b13345c547709ef8b6144a3526d079.tar.gz |
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
-rw-r--r-- | gnss/GnssAdapter.cpp | 5 | ||||
-rw-r--r-- | location/LocationDataTypes.h | 9 | ||||
-rw-r--r-- | utils/loc_gps.h | 11 |
3 files changed, 25 insertions, 0 deletions
diff --git a/gnss/GnssAdapter.cpp b/gnss/GnssAdapter.cpp index b566681..4b6fce8 100644 --- a/gnss/GnssAdapter.cpp +++ b/gnss/GnssAdapter.cpp @@ -248,6 +248,11 @@ GnssAdapter::convertLocation(Location& out, const UlpLocation& ulpLocation, if (LOC_POS_TECH_MASK_SENSORS & techMask) { 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 diff --git a/location/LocationDataTypes.h b/location/LocationDataTypes.h index 9809e61..66ed3ad 100644 --- a/location/LocationDataTypes.h +++ b/location/LocationDataTypes.h @@ -70,6 +70,7 @@ typedef enum { 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_BEARING_ACCURACY_BIT = (1<<7), // location has valid bearing accuracy + LOCATION_HAS_SPOOF_MASK = (1<<8), // location has valid spoof mask } LocationFlagsBits; typedef uint16_t LocationTechnologyMask; @@ -80,6 +81,13 @@ typedef enum { LOCATION_TECHNOLOGY_SENSORS_BIT = (1<<3), // location was calculated using Sensors } 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 { LOCATION_RELIABILITY_NOT_SET = 0, LOCATION_RELIABILITY_VERY_LOW, @@ -531,6 +539,7 @@ typedef struct { float speedAccuracy; // in meters/second float bearingAccuracy; // in degrees (0 to 359.999) LocationTechnologyMask techMask; + LocationSpoofMask spoofMask; } Location; struct LocationOptions { diff --git a/utils/loc_gps.h b/utils/loc_gps.h index 5e915a3..aaeea23 100644 --- a/utils/loc_gps.h +++ b/utils/loc_gps.h @@ -100,6 +100,15 @@ typedef uint16_t LocGpsLocationFlags; #define LOC_GPS_LOCATION_HAS_ACCURACY 0x0010 /** LocGpsLocation has valid vertical uncertainity */ #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. */ @@ -533,6 +542,8 @@ typedef struct { size_t size; /** Contains LocGpsLocationFlags bits. */ uint16_t flags; + /** The spoof mask */ + LocGpsSpoofMask spoof_mask; /** Represents latitude in degrees. */ double latitude; /** Represents longitude in degrees. */ |