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> | 2020-11-09 03:48:35 -0800 |
commit | 4be73bfe82f0ce2aa053d74ba1e6c2738f4376c2 (patch) | |
tree | 09e21da867424c066d9f7ae0ccde6f9b83802078 | |
parent | 31bed120f103c8a099f8b14799a6ac634f5c6537 (diff) |
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 8ca24ef..3102085 100644 --- a/utils/loc_nmea.cpp +++ b/utils/loc_nmea.cpp @@ -1544,8 +1544,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) { @@ -1686,8 +1697,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)); |