summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorWei Chen <weic@codeaurora.org>2019-09-30 11:46:56 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2019-10-22 11:55:12 -0700
commit3a84bfac176e1e52ddb010ab61f67d70b67f9fd5 (patch)
tree41d10dcf0f6158d493fb32d6d1d2a8ef302ade1a /utils
parent87923e48c1b0ad158c0ca92bd049524d7ff672fd (diff)
downloadgps-3a84bfac176e1e52ddb010ab61f67d70b67f9fd5.tar.gz
GPS NMEA: enhance gga fix qualtiy for sensor contributed fix
This enhancement will be enabled if CUSTOM_NMEA_GGA_FIX_QUALITY_ENABLED is set to 1 in gps.conf. PPP fix w/o sensor: fix quality will now be 59 PPP fix w sensor: fix quality will now be 69 RTK fixed fix w/ sensor: fix quality will now be 64 RTK float fix w/ sensor: 65 DGNSS and/or SBAS correction fix and w/ sensor: 62 GPS fix without correction but and w/ sensor: 61 Change-Id: I7bc1bb5504e023de40f271d97d31c602f27bd94e CRs-fixed: 2537211
Diffstat (limited to 'utils')
-rw-r--r--utils/loc_nmea.cpp95
-rw-r--r--utils/loc_nmea.h1
2 files changed, 77 insertions, 19 deletions
diff --git a/utils/loc_nmea.cpp b/utils/loc_nmea.cpp
index d5e4b57..24197ff 100644
--- a/utils/loc_nmea.cpp
+++ b/utils/loc_nmea.cpp
@@ -1033,47 +1033,56 @@ SIDE EFFECTS
===========================================================================*/
static void loc_nmea_get_fix_quality(const UlpLocation & location,
const GpsLocationExtended & locationExtended,
- char & ggaGpsQuality,
+ bool custom_gga_fix_quality,
+ char ggaGpsQuality[3],
char & rmcModeIndicator,
char & vtgModeIndicator) {
- ggaGpsQuality = '0';
- rmcModeIndicator = 'N';
- vtgModeIndicator = 'N';
+ ggaGpsQuality[0] = '0'; // 0 means no fix
+ rmcModeIndicator = 'N'; // N means no fix
+ vtgModeIndicator = 'N'; // N means no fix
do {
+ // GGA fix quality is defined in NMEA spec as below:
+ // https://www.trimble.com/OEM_ReceiverHelp/V4.44/en/NMEA-0183messages_GGA.html
+ // Fix quality: 0 = invalid
+ // 1 = GPS fix (SPS)
+ // 2 = DGPS fix
+ // 3 = PPS fix
+ // 4 = Real Time Kinematic
+ // 5 = Float RTK
+ // 6 = estimated (dead reckoning) (2.3 feature)
+ // 7 = Manual input mode
+ // 8 = Simulation mode
if (!(location.gpsLocation.flags & LOC_GPS_LOCATION_HAS_LAT_LONG)){
- ggaGpsQuality = '0'; // 0 means no fix
- rmcModeIndicator = 'N';
- vtgModeIndicator = 'N';
break;
}
// NOTE: Order of the check is important
if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_NAV_SOLUTION_MASK) {
if (LOC_NAV_MASK_PPP_CORRECTION & locationExtended.navSolutionMask) {
- ggaGpsQuality = '2'; // 2 means DGPS fix
+ ggaGpsQuality[0] = '2'; // 2 means DGPS fix
rmcModeIndicator = 'P'; // P means precise
vtgModeIndicator = 'P'; // P means precise
break;
} else if (LOC_NAV_MASK_RTK_FIXED_CORRECTION & locationExtended.navSolutionMask){
- ggaGpsQuality = '4'; // 4 means RTK Fixed fix
+ ggaGpsQuality[0] = '4'; // 4 means RTK Fixed fix
rmcModeIndicator = 'R'; // use R (RTK fixed)
vtgModeIndicator = 'D'; // use D (differential) as
// no RTK fixed defined for VTG in NMEA 183 spec
break;
} else if (LOC_NAV_MASK_RTK_CORRECTION & locationExtended.navSolutionMask){
- ggaGpsQuality = '5'; // 5 means RTK float fix
+ ggaGpsQuality[0] = '5'; // 5 means RTK float fix
rmcModeIndicator = 'F'; // F means RTK float fix
vtgModeIndicator = 'D'; // use D (differential) as
// no RTK float defined for VTG in NMEA 183 spec
break;
} else if (LOC_NAV_MASK_DGNSS_CORRECTION & locationExtended.navSolutionMask){
- ggaGpsQuality = '2'; // 2 means DGPS fix
+ ggaGpsQuality[0] = '2'; // 2 means DGPS fix
rmcModeIndicator = 'D'; // D means differential
vtgModeIndicator = 'D'; // D means differential
break;
} else if (LOC_NAV_MASK_SBAS_CORRECTION_IONO & locationExtended.navSolutionMask){
- ggaGpsQuality = '2'; // 2 means DGPS fix
+ ggaGpsQuality[0] = '2'; // 2 means DGPS fix
rmcModeIndicator = 'D'; // D means differential
vtgModeIndicator = 'D'; // D means differential
break;
@@ -1082,12 +1091,12 @@ static void loc_nmea_get_fix_quality(const UlpLocation & location,
// NOTE: Order of the check is important
if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_POS_TECH_MASK) {
if (LOC_POS_TECH_MASK_SATELLITE & locationExtended.tech_mask){
- ggaGpsQuality = '1'; // 1 means GPS
+ ggaGpsQuality[0] = '1'; // 1 means GPS
rmcModeIndicator = 'A'; // A means autonomous
vtgModeIndicator = 'A'; // A means autonomous
break;
} else if (LOC_POS_TECH_MASK_SENSORS & locationExtended.tech_mask){
- ggaGpsQuality = '6'; // 6 means estimated (dead reckoning)
+ ggaGpsQuality[0] = '6'; // 6 means estimated (dead reckoning)
rmcModeIndicator = 'E'; // E means estimated (dead reckoning)
vtgModeIndicator = 'E'; // E means estimated (dead reckoning)
break;
@@ -1095,7 +1104,54 @@ static void loc_nmea_get_fix_quality(const UlpLocation & location,
}
} while (0);
- LOC_LOGv("gps quality: %c, rmc mode indicator: %c, vtg mode indicator: %c",
+ do {
+ // check for customized nmea enabled or not
+ // with customized GGA quality enabled
+ // PPP fix w/o sensor: 59, PPP fix w/ sensor: 69
+ // DGNSS/SBAS correction fix w/o sensor: 2, w/ sensor: 62
+ // RTK fixed fix w/o sensor: 4, w/ sensor: 64
+ // RTK float fix w/o sensor: 5, w/ sensor: 65
+ // SPE fix w/o sensor: 1, and w/ sensor: 61
+ // Sensor dead reckoning fix: 6
+ if (true == custom_gga_fix_quality) {
+ if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_NAV_SOLUTION_MASK) {
+ // PPP fix w/o sensor: fix quality will now be 59
+ // PPP fix w sensor: fix quality will now be 69
+ if (LOC_NAV_MASK_PPP_CORRECTION & locationExtended.navSolutionMask) {
+ if ((locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_POS_TECH_MASK) &&
+ (LOC_POS_TECH_MASK_SENSORS & locationExtended.tech_mask)) {
+ ggaGpsQuality[0] = '6';
+ ggaGpsQuality[1] = '9';
+ } else {
+ ggaGpsQuality[0] = '5';
+ ggaGpsQuality[1] = '9';
+ }
+ break;
+ }
+ }
+
+ if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_POS_TECH_MASK) {
+ if (LOC_POS_TECH_MASK_SENSORS & locationExtended.tech_mask){
+ char ggaQuality_copy = ggaGpsQuality[0];
+ ggaGpsQuality[0] = '6'; // 6 sensor assisted
+ // RTK fixed fix w/ sensor: fix quality will now be 64
+ // RTK float fix w/ sensor: 65
+ // DGNSS and/or SBAS correction fix and w/ sensor: 62
+ // GPS fix without correction and w/ sensor: 61
+ if ((LOC_NAV_MASK_RTK_FIXED_CORRECTION & locationExtended.navSolutionMask)||
+ (LOC_NAV_MASK_RTK_CORRECTION & locationExtended.navSolutionMask)||
+ (LOC_NAV_MASK_DGNSS_CORRECTION & locationExtended.navSolutionMask)||
+ (LOC_NAV_MASK_SBAS_CORRECTION_IONO & locationExtended.navSolutionMask)||
+ (LOC_POS_TECH_MASK_SATELLITE & locationExtended.tech_mask)) {
+ ggaGpsQuality[1] = ggaQuality_copy;
+ break;
+ }
+ }
+ }
+ }
+ } while (0);
+
+ LOC_LOGv("gps quality: %s, rmc mode indicator: %c, vtg mode indicator: %c",
ggaGpsQuality, rmcModeIndicator, vtgModeIndicator);
}
@@ -1127,6 +1183,7 @@ void loc_nmea_generate_pos(const UlpLocation &location,
const GpsLocationExtended &locationExtended,
const LocationSystemInfo &systemInfo,
unsigned char generate_nmea,
+ bool custom_gga_fix_quality,
std::vector<std::string> &nmeaArraystr)
{
ENTRY_LOG();
@@ -1270,10 +1327,10 @@ void loc_nmea_generate_pos(const UlpLocation &location,
talker[1] = sv_meta.talker[1];
}
- char ggaGpsQuality = '0';
+ char ggaGpsQuality[3] = {'0', '\0', '\0'};
char rmcModeIndicator = 'N';
char vtgModeIndicator = 'N';
- loc_nmea_get_fix_quality(location, locationExtended,
+ loc_nmea_get_fix_quality(location, locationExtended, custom_gga_fix_quality,
ggaGpsQuality, rmcModeIndicator, vtgModeIndicator);
// -------------------
@@ -1772,12 +1829,12 @@ void loc_nmea_generate_pos(const UlpLocation &location,
svUsedCount = MAX_SATELLITES_IN_USE;
if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DOP)
{
- length = snprintf(pMarker, lengthRemaining, "%c,%02d,%.1f,",
+ length = snprintf(pMarker, lengthRemaining, "%s,%02d,%.1f,",
ggaGpsQuality, svUsedCount, locationExtended.hdop);
}
else
{ // no hdop
- length = snprintf(pMarker, lengthRemaining, "%c,%02d,,",
+ length = snprintf(pMarker, lengthRemaining, "%s,%02d,,",
ggaGpsQuality, svUsedCount);
}
diff --git a/utils/loc_nmea.h b/utils/loc_nmea.h
index c6c83db..a9cafb7 100644
--- a/utils/loc_nmea.h
+++ b/utils/loc_nmea.h
@@ -79,6 +79,7 @@ void loc_nmea_generate_pos(const UlpLocation &location,
const GpsLocationExtended &locationExtended,
const LocationSystemInfo &systemInfo,
unsigned char generate_nmea,
+ bool custom_gga_fix_quality,
std::vector<std::string> &nmeaArraystr);
#define DEBUG_NMEA_MINSIZE 6