diff options
author | Madhanraj Chelladurai <mchellad@codeaurora.org> | 2019-09-30 17:27:36 +0530 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2019-10-28 23:26:36 -0700 |
commit | f195c219e601fd1c99e65353371a571e77043622 (patch) | |
tree | 09a1b0649f71976acad202b2da007062ca063ad4 | |
parent | 5c568ca1bdd64c4de4a29695457db6bd81d0f5d8 (diff) | |
download | gps-f195c219e601fd1c99e65353371a571e77043622.tar.gz |
nmea: fix status and mode indicator fields of RMC
Fix status and mode indicator fields to proper
values as per NMEA standard for GPRMC string.
Change-Id: I7fe0e292079c0f71bb37f6a1462f669e14f54b81
CRs-Fixed: 2537924
-rw-r--r-- | utils/loc_nmea.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/utils/loc_nmea.cpp b/utils/loc_nmea.cpp index 24197ff..61db2be 100644 --- a/utils/loc_nmea.cpp +++ b/utils/loc_nmea.cpp @@ -1439,8 +1439,19 @@ void loc_nmea_generate_pos(const UlpLocation &location, pMarker = sentence_RMC; lengthRemaining = sizeof(sentence_RMC); - length = snprintf(pMarker, lengthRemaining, "$%sRMC,%02d%02d%02d.%02d,A," , - talker, utcHours, utcMinutes, utcSeconds,utcMSeconds/10); + bool validFix = ((0 != sv_cache_info.gps_used_mask) || + (0 != sv_cache_info.glo_used_mask) || + (0 != sv_cache_info.gal_used_mask) || + (0 != sv_cache_info.qzss_used_mask) || + (0 != sv_cache_info.bds_used_mask)); + + if (validFix) { + length = snprintf(pMarker, lengthRemaining, "$%sRMC,%02d%02d%02d.%02d,A,", + talker, utcHours, utcMinutes, utcSeconds, utcMSeconds/10); + } else { + length = snprintf(pMarker, lengthRemaining, "$%sRMC,%02d%02d%02d.%02d,V,", + talker, utcHours, utcMinutes, utcSeconds, utcMSeconds/10); + } if (length < 0 || length >= lengthRemaining) { @@ -1581,8 +1592,6 @@ void loc_nmea_generate_pos(const UlpLocation &location, // hardcode Navigation Status field to 'V' length = snprintf(pMarker, lengthRemaining, ",%c", 'V'); - pMarker += length; - lengthRemaining -= length; length = loc_nmea_put_checksum(sentence_RMC, sizeof(sentence_RMC)); |