Merge "GPS: add numSVUsedInFix in location api"
This commit is contained in:
commit
9391fe52a4
3 changed files with 47 additions and 3 deletions
|
@ -229,6 +229,31 @@ GnssAdapter::convertLocation(Location& out, const UlpLocation& ulpLocation,
|
|||
}
|
||||
}
|
||||
|
||||
/* This is utility routine that computes number of SV used
|
||||
in the fix from the svUsedIdsMask.
|
||||
*/
|
||||
#define MAX_SV_CNT_SUPPORTED_IN_ONE_CONSTELLATION 64
|
||||
uint16_t GnssAdapter::getNumSvUsed(uint64_t svUsedIdsMask,
|
||||
int totalSvCntInThisConstellation)
|
||||
{
|
||||
if (totalSvCntInThisConstellation > MAX_SV_CNT_SUPPORTED_IN_ONE_CONSTELLATION) {
|
||||
LOC_LOGe ("error: total SV count in this constellation %d exceeded limit of %d",
|
||||
totalSvCntInThisConstellation, MAX_SV_CNT_SUPPORTED_IN_ONE_CONSTELLATION);
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint16_t numSvUsed = 0;
|
||||
uint64_t mask = 0x1;
|
||||
for (int i = 0; i < totalSvCntInThisConstellation; i++) {
|
||||
if (svUsedIdsMask & mask) {
|
||||
numSvUsed++;
|
||||
}
|
||||
mask <<= 1;
|
||||
}
|
||||
|
||||
return numSvUsed;
|
||||
}
|
||||
|
||||
void
|
||||
GnssAdapter::convertLocationInfo(GnssLocationInfoNotification& out,
|
||||
const GpsLocationExtended& locationExtended)
|
||||
|
@ -349,8 +374,20 @@ 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;
|
||||
|
||||
out.flags |= GNSS_LOCATION_INFO_NUM_SV_USED_IN_POSITION_BIT;
|
||||
out.numSvUsedInPosition = getNumSvUsed(out.svUsedInPosition.gpsSvUsedIdsMask,
|
||||
GPS_SV_PRN_MAX - GPS_SV_PRN_MIN + 1);
|
||||
out.numSvUsedInPosition += getNumSvUsed(out.svUsedInPosition.gloSvUsedIdsMask,
|
||||
GLO_SV_PRN_MAX - GLO_SV_PRN_MIN + 1);
|
||||
out.numSvUsedInPosition += getNumSvUsed(out.svUsedInPosition.qzssSvUsedIdsMask,
|
||||
QZSS_SV_PRN_MAX - QZSS_SV_PRN_MIN + 1);
|
||||
out.numSvUsedInPosition += getNumSvUsed(out.svUsedInPosition.bdsSvUsedIdsMask,
|
||||
BDS_SV_PRN_MAX - BDS_SV_PRN_MIN + 1);
|
||||
out.numSvUsedInPosition += getNumSvUsed(out.svUsedInPosition.galSvUsedIdsMask,
|
||||
GAL_SV_PRN_MAX - GAL_SV_PRN_MIN + 1);
|
||||
|
||||
out.numOfMeasReceived = locationExtended.numOfMeasReceived;
|
||||
for (int idx =0; idx < locationExtended.numOfMeasReceived; idx++) {
|
||||
out.measUsageInfo[idx].gnssSignalType =
|
||||
locationExtended.measUsageInfo[idx].gnssSignalType;
|
||||
|
|
|
@ -205,6 +205,8 @@ class GnssAdapter : public LocAdapterBase {
|
|||
const LocPosTechMask techMask);
|
||||
static void convertLocationInfo(GnssLocationInfoNotification& out,
|
||||
const GpsLocationExtended& locationExtended);
|
||||
static uint16_t getNumSvUsed(uint64_t svUsedIdsMask,
|
||||
int totalSvCntInThisConstellation);
|
||||
|
||||
/* ======== UTILITIES ================================================================== */
|
||||
inline void initOdcpi(const OdcpiRequestCallback& callback);
|
||||
|
|
|
@ -153,7 +153,9 @@ typedef enum {
|
|||
GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_SEMI_MAJOR_BIT = (1<<5), // valid elipsode semi major
|
||||
GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_SEMI_MINOR_BIT = (1<<6), // valid elipsode semi minor
|
||||
GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_AZIMUTH_BIT = (1<<7), // valid accuracy elipsode azimuth
|
||||
GNSS_LOCATION_INFO_GNSS_SV_USED_DATA_BIT = (1<<8), // valid gnss sv used in pos data
|
||||
GNSS_LOCATION_INFO_GNSS_SV_USED_DATA_BIT = (1<<8), // valid svUsedInPosition,
|
||||
// numOfMeasReceived
|
||||
// and measUsageInfo
|
||||
GNSS_LOCATION_INFO_NAV_SOLUTION_MASK_BIT = (1<<9), // valid navSolutionMask
|
||||
GNSS_LOCATION_INFO_POS_TECH_MASK_BIT = (1<<10),// valid LocPosTechMask
|
||||
GNSS_LOCATION_INFO_SV_SOURCE_INFO_BIT = (1<<11),// valid LocSvInfoSource
|
||||
|
@ -168,7 +170,9 @@ typedef enum {
|
|||
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
|
||||
GNSS_LOCATION_INFO_TIME_UNC_BIT = (1<<23),// valid time uncertainty
|
||||
GNSS_LOCATION_INFO_NUM_SV_USED_IN_POSITION_BIT = (1<<24) // number of SV used in position
|
||||
|
||||
} GnssLocationInfoFlagBits;
|
||||
|
||||
typedef enum {
|
||||
|
@ -940,6 +944,7 @@ typedef struct {
|
|||
float northVelocityStdDeviation;
|
||||
float eastVelocityStdDeviation;
|
||||
float upVelocityStdDeviation;
|
||||
uint16_t numSvUsedInPosition;
|
||||
GnssLocationSvUsedInPosition svUsedInPosition;// Gnss sv used in position data
|
||||
GnssLocationNavSolutionMask navSolutionMask; // Nav solution mask to indicate sbas corrections
|
||||
GnssLocationPosTechMask posTechMask; // Position technology used in computing this fix
|
||||
|
|
Loading…
Reference in a new issue