diff --git a/gnss/GnssAdapter.cpp b/gnss/GnssAdapter.cpp index 3f9d3cf8..ef835aee 100644 --- a/gnss/GnssAdapter.cpp +++ b/gnss/GnssAdapter.cpp @@ -320,6 +320,38 @@ GnssAdapter::convertLocationInfo(GnssLocationInfoNotification& out, out.flags |= GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_AZIMUTH_BIT; out.horUncEllipseOrientAzimuth = locationExtended.horUncEllipseOrientAzimuth; } + if (GPS_LOCATION_EXTENDED_HAS_NORTH_STD_DEV & locationExtended.flags) { + out.flags |= GNSS_LOCATION_INFO_NORTH_STD_DEV_BIT; + out.northVelocityStdDeviation = locationExtended.northStdDeviation; + } + if (GPS_LOCATION_EXTENDED_HAS_EAST_STD_DEV & locationExtended.flags) { + out.flags |= GNSS_LOCATION_INFO_EAST_STD_DEV_BIT; + out.eastVelocityStdDeviation = locationExtended.eastStdDeviation; + } + if (GPS_LOCATION_EXTENDED_HAS_NORTH_VEL & locationExtended.flags) { + out.flags |= GNSS_LOCATION_INFO_NORTH_VEL_BIT; + out.northVelocity = locationExtended.northVelocity; + } + if (GPS_LOCATION_EXTENDED_HAS_NORTH_VEL_UNC & locationExtended.flags) { + out.flags |= GNSS_LOCATION_INFO_NORTH_VEL_UNC_BIT; + out.northVelocityStdDeviation = locationExtended.northVelocityStdDeviation; + } + if (GPS_LOCATION_EXTENDED_HAS_EAST_VEL & locationExtended.flags) { + out.flags |= GNSS_LOCATION_INFO_EAST_VEL_BIT; + out.eastVelocity = locationExtended.eastVelocity; + } + if (GPS_LOCATION_EXTENDED_HAS_EAST_VEL_UNC & locationExtended.flags) { + out.flags |= GNSS_LOCATION_INFO_EAST_VEL_UNC_BIT; + out.eastVelocityStdDeviation = locationExtended.eastVelocityStdDeviation; + } + if (GPS_LOCATION_EXTENDED_HAS_UP_VEL & locationExtended.flags) { + out.flags |= GNSS_LOCATION_INFO_UP_VEL_BIT; + out.upVelocity = locationExtended.upVelocity; + } + if (GPS_LOCATION_EXTENDED_HAS_UP_VEL_UNC & locationExtended.flags) { + out.flags |= GNSS_LOCATION_INFO_UP_VEL_UNC_BIT; + out.upVelocityStdDeviation = locationExtended.upVelocityStdDeviation; + } if (GPS_LOCATION_EXTENDED_HAS_GNSS_SV_USED_DATA & locationExtended.flags) { out.flags |= GNSS_LOCATION_INFO_GNSS_SV_USED_DATA_BIT; out.svUsedInPosition.gpsSvUsedIdsMask = @@ -332,6 +364,16 @@ GnssAdapter::convertLocationInfo(GnssLocationInfoNotification& out, locationExtended.gnss_sv_used_ids.bds_sv_used_ids_mask; out.svUsedInPosition.qzssSvUsedIdsMask = locationExtended.gnss_sv_used_ids.qzss_sv_used_ids_mask; + out.numOfMeasReceived = locationExtended.numOfMeasReceived; + + for (int idx =0; idx < locationExtended.numOfMeasReceived; idx++) { + out.measUsageInfo[idx].gnssSignalType = + locationExtended.measUsageInfo[idx].gnssSignalType; + out.measUsageInfo[idx].gnssSvId = + locationExtended.measUsageInfo[idx].gnssSvId; + out.measUsageInfo[idx].gnssConstellation = + locationExtended.measUsageInfo[idx].gnssConstellation; + } } if (GPS_LOCATION_EXTENDED_HAS_NAV_SOLUTION_MASK & locationExtended.flags) { out.flags |= GNSS_LOCATION_INFO_NAV_SOLUTION_MASK_BIT; @@ -367,6 +409,19 @@ GnssAdapter::convertLocationInfo(GnssLocationInfoNotification& out, out.bodyFrameData.yawRate = locationExtended.bodyFrameData.yawRate; out.bodyFrameData.pitch = locationExtended.bodyFrameData.pitch; } + + // Validity of this structure is established from the timeSrc of the GnssSystemTime structure. + out.gnssSystemTime = locationExtended.gnssSystemTime; + + if (GPS_LOCATION_EXTENDED_HAS_LEAP_SECONDS & locationExtended.flags) { + out.flags |= GNSS_LOCATION_INFO_LEAP_SECONDS_BIT; + out.leapSeconds = locationExtended.leapSeconds; + } + + if (GPS_LOCATION_EXTENDED_HAS_TIME_UNC & locationExtended.flags) { + out.flags |= GNSS_LOCATION_INFO_TIME_UNC_BIT; + out.timeUncMs = locationExtended.timeUncMs; + } } inline uint32_t diff --git a/location/LocationDataTypes.h b/location/LocationDataTypes.h index 00cca183..8bb11cc7 100644 --- a/location/LocationDataTypes.h +++ b/location/LocationDataTypes.h @@ -137,8 +137,17 @@ typedef enum { GNSS_LOCATION_INFO_POS_TECH_MASK_BIT = (1<<10),// valid LocPosTechMask GNSS_LOCATION_INFO_SV_SOURCE_INFO_BIT = (1<<11),// valid LocSvInfoSource GNSS_LOCATION_INFO_POS_DYNAMICS_DATA_BIT = (1<<12),// valid position dynamics data - GNSS_LOCATION_INFO_GPS_TIME_BIT = (1<<13),// valid GPS Time - GNSS_LOCATION_INFO_EXT_DOP_BIT = (1<<14) // valid gdop, tdop + GNSS_LOCATION_INFO_EXT_DOP_BIT = (1<<13),// valid gdop, tdop + GNSS_LOCATION_INFO_NORTH_STD_DEV_BIT = (1<<14),// valid North standard deviation + GNSS_LOCATION_INFO_EAST_STD_DEV_BIT = (1<<15),// valid East standard deviation + GNSS_LOCATION_INFO_NORTH_VEL_BIT = (1<<16),// valid North Velocity + GNSS_LOCATION_INFO_EAST_VEL_BIT = (1<<17),// valid East Velocity + GNSS_LOCATION_INFO_UP_VEL_BIT = (1<<18),// valid Up Velocity + GNSS_LOCATION_INFO_NORTH_VEL_UNC_BIT = (1<<19),// valid North Velocity Uncertainty + GNSS_LOCATION_INFO_EAST_VEL_UNC_BIT = (1<<20),// valid East Velocity Uncertainty + GNSS_LOCATION_INFO_UP_VEL_UNC_BIT = (1<<21),// valid Up Velocity Uncertainty + GNSS_LOCATION_INFO_LEAP_SECONDS_BIT = (1<<22),// valid leap seconds + GNSS_LOCATION_INFO_TIME_UNC_BIT = (1<<23) // valid time uncertainty } GnssLocationInfoFlagBits; typedef enum { @@ -452,6 +461,43 @@ typedef enum { GNSS_AIDING_DATA_SV_TYPE_GALILEO_BIT = (1<<4), } GnssAidingDataSvTypeBits; +/** GNSS Signal Type and RF Band */ +typedef uint32_t GnssSignalTypeMask; +typedef enum { + /** GPS L1CA Signal */ + GNSS_SIGNAL_GPS_L1CA = (1<<0), + /** GPS L1C Signal */ + GNSS_SIGNAL_GPS_L1C = (1<<1), + /** GPS L2 RF Band */ + GNSS_SIGNAL_GPS_L2 = (1<<2), + /** GPS L5 RF Band */ + GNSS_SIGNAL_GPS_L5 = (1<<3), + /** GLONASS G1 (L1OF) RF Band */ + GNSS_SIGNAL_GLONASS_G1 = (1<<4), + /** GLONASS G2 (L2OF) RF Band */ + GNSS_SIGNAL_GLONASS_G2 = (1<<5), + /** GALILEO E1 RF Band */ + GNSS_SIGNAL_GALILEO_E1 = (1<<6), + /** GALILEO E5A RF Band */ + GNSS_SIGNAL_GALILEO_E5A = (1<<7), + /** GALILEO E5B RF Band */ + GNSS_SIGNAL_GALILIEO_E5B = (1<<8), + /** BEIDOU B1 RF Band */ + GNSS_SIGNAL_BEIDOU_B1 = (1<<9), + /** BEIDOU B2 RF Band */ + GNSS_SIGNAL_BEIDOU_B2 = (1<<10), + /** QZSS L1CA RF Band */ + GNSS_SIGNAL_QZSS_L1CA = (1<<11), + /** QZSS L1S RF Band */ + GNSS_SIGNAL_QZSS_L1S = (1<<12), + /** QZSS L2 RF Band */ + GNSS_SIGNAL_QZSS_L2 = (1<<13), + /** QZSS L5 RF Band */ + GNSS_SIGNAL_QZSS_L5 = (1<<14), + /** SBAS L1 RF Band */ + GNSS_SIGNAL_SBAS_L1 = (1<<15) +} GnssSignalTypeBits; + typedef enum { GNSS_LOC_SV_SYSTEM_GPS = 1, @@ -587,6 +633,21 @@ typedef struct { uint64_t qzssSvUsedIdsMask; } GnssLocationSvUsedInPosition; +typedef struct { + /** GnssSignalType mask */ + GnssSignalTypeMask gnssSignalType; + /** Specifies GNSS Constellation Type */ + Gnss_LocSvSystemEnumType gnssConstellation; + /** GNSS SV ID. + For GPS: 1 to 32 + For GLONASS: 65 to 96. When slot-number to SV ID mapping is unknown, set as 255. + For SBAS: 120 to 151 + For QZSS-L1CA:193 to 197 + For BDS: 201 to 237 + For GAL: 301 to 336 */ + uint16_t gnssSvId; +} GnssMeasUsageInfo; + /** @struct Body Frame parameters */ @@ -702,9 +763,11 @@ typedef struct { float horUncEllipseSemiMajor; // horizontal elliptical accuracy semi-major axis float horUncEllipseSemiMinor; // horizontal elliptical accuracy semi-minor axis float horUncEllipseOrientAzimuth; // horizontal elliptical accuracy azimuth + float northStdDeviation; // North standard deviation Unit: Meters + float eastStdDeviation; // East standard deviation. Unit: Meters float northVelocity; // North Velocity.Unit: Meters/sec - float eastVelocity; // East Velocity - float upVelocity; + float eastVelocity; // East Velocity Unit Meters/sec + float upVelocity; // Up Velocity. Unit Meters/sec float northVelocityStdDeviation; float eastVelocityStdDeviation; float upVelocityStdDeviation; @@ -714,6 +777,10 @@ typedef struct { GnssLocationPositionDynamics bodyFrameData; // Body Frame Dynamics: 4wayAcceleration and // pitch set with validity GnssSystemTime gnssSystemTime; // GNSS System Time + uint8_t numOfMeasReceived; // Number of measurements received for use in fix. + GnssMeasUsageInfo measUsageInfo[GNSS_SV_MAX]; // GNSS Measurement Usage info + uint8_t leapSeconds; // leap second + float timeUncMs; // Time uncertainty in milliseconds Location location; } GnssLocationInfoNotification; diff --git a/utils/gps_extended_c.h b/utils/gps_extended_c.h index 21eb5d55..ea38eb38 100644 --- a/utils/gps_extended_c.h +++ b/utils/gps_extended_c.h @@ -268,7 +268,7 @@ typedef enum loc_position_mode_type { #define GPS_DEFAULT_FIX_INTERVAL_MS 1000 /** Flags to indicate which values are valid in a GpsLocationExtended. */ -typedef uint32_t GpsLocationExtendedFlags; +typedef uint64_t GpsLocationExtendedFlags; /** GpsLocationExtended has valid pdop, hdop, vdop. */ #define GPS_LOCATION_EXTENDED_HAS_DOP 0x0001 /** GpsLocationExtended has valid altitude mean sea level. */ @@ -323,14 +323,19 @@ typedef uint32_t GpsLocationExtendedFlags; #define GPS_LOCATION_EXTENDED_HAS_EAST_VEL_UNC 0x2000000 /** GpsLocationExtended has up Velocity Uncertainty */ #define GPS_LOCATION_EXTENDED_HAS_UP_VEL_UNC 0x4000000 -/** GpsLocationExtended has up Clock Bias */ +/** GpsLocationExtended has Clock Bias */ #define GPS_LOCATION_EXTENDED_HAS_CLOCK_BIAS 0x8000000 -/** GpsLocationExtended has up Clock Bias std deviation*/ +/** GpsLocationExtended has Clock Bias std deviation*/ #define GPS_LOCATION_EXTENDED_HAS_CLOCK_BIAS_STD_DEV 0x10000000 -/** GpsLocationExtended has up Clock drift*/ +/** GpsLocationExtended has Clock drift*/ #define GPS_LOCATION_EXTENDED_HAS_CLOCK_DRIFT 0x20000000 -/** GpsLocationExtended has up Clock drift std deviation**/ +/** GpsLocationExtended has Clock drift std deviation**/ #define GPS_LOCATION_EXTENDED_HAS_CLOCK_DRIFT_STD_DEV 0x40000000 +/** GpsLocationExtended has leap seconds **/ +#define GPS_LOCATION_EXTENDED_HAS_LEAP_SECONDS 0x80000000 +/** GpsLocationExtended has time uncertainty **/ +#define GPS_LOCATION_EXTENDED_HAS_TIME_UNC 0x100000000 + typedef uint32_t LocNavSolutionMask; /* Bitmask to specify whether SBAS ionospheric correction is used */ @@ -660,6 +665,10 @@ typedef struct { uint8_t numOfMeasReceived; /** Measurement Usage Information */ GpsMeasUsageInfo measUsageInfo[GNSS_SV_MAX]; + /** Leap Seconds */ + uint8_t leapSeconds; + /** Time uncertainty in milliseconds */ + float timeUncMs; } GpsLocationExtended; enum loc_sess_status {