From 078314504dc235e5f63e1fcf241f47a849f82799 Mon Sep 17 00:00:00 2001 From: Dante Russo Date: Mon, 3 Aug 2015 18:50:42 -0700 Subject: [PATCH] NMEA generation change to prevent 2Hz reporting GPGGA/GPRMC/GPGSA can be reported two times per second in some cases where we lose all satellite signals. We should report these NMEA sentences only from position report to prevent this. CRs-fixed: 884484 Change-Id: I123d9f074ca725703c6e90397160b701033e22f0 --- loc_api/libloc_api_50001/loc_eng.cpp | 6 +-- loc_api/libloc_api_50001/loc_eng_nmea.cpp | 54 +++++++---------------- 2 files changed, 16 insertions(+), 44 deletions(-) diff --git a/loc_api/libloc_api_50001/loc_eng.cpp b/loc_api/libloc_api_50001/loc_eng.cpp index 3bb4168f..0fee9d60 100644 --- a/loc_api/libloc_api_50001/loc_eng.cpp +++ b/loc_api/libloc_api_50001/loc_eng.cpp @@ -798,11 +798,7 @@ void LocEngReportPosition::proc() const { locEng->engine_status, locEng->adapter->isInSession()); if (locEng->generateNmea && - mLocation.position_source == ULP_LOCATION_IS_FROM_GNSS && - locEng->adapter->isInSession() && - mTechMask & (LOC_POS_TECH_MASK_SATELLITE | - LOC_POS_TECH_MASK_SENSORS | - LOC_POS_TECH_MASK_HYBRID)) + locEng->adapter->isInSession()) { unsigned char generate_nmea = reported && (mStatus != LOC_SESS_FAILURE); diff --git a/loc_api/libloc_api_50001/loc_eng_nmea.cpp b/loc_api/libloc_api_50001/loc_eng_nmea.cpp index 7bc58bd0..126a97f0 100644 --- a/loc_api/libloc_api_50001/loc_eng_nmea.cpp +++ b/loc_api/libloc_api_50001/loc_eng_nmea.cpp @@ -790,48 +790,24 @@ void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p, }//if - if (svStatus.gps_used_in_fix_mask == 0 && - svStatus.glo_used_in_fix_mask == 0 && - svStatus.bds_used_in_fix_mask == 0) - { // No sv used, so there will be no position report, so send - // blank NMEA sentences - strlcpy(sentence, "$GPGSA,A,1,,,,,,,,,,,,,,,", sizeof(sentence)); - length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence)); - loc_eng_nmea_send(sentence, length, loc_eng_data_p); + // cache the used in fix mask, as it will be needed to send $GPGSA + // during the position report + loc_eng_data_p->sv_used_mask = svStatus.gps_used_in_fix_mask; - strlcpy(sentence, "$GPVTG,,T,,M,,N,,K,N", sizeof(sentence)); - length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence)); - loc_eng_nmea_send(sentence, length, loc_eng_data_p); - - strlcpy(sentence, "$GPRMC,,V,,,,,,,,,,N", sizeof(sentence)); - length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence)); - loc_eng_nmea_send(sentence, length, loc_eng_data_p); - - strlcpy(sentence, "$GPGGA,,,,,,0,,,,,,,,", sizeof(sentence)); - length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence)); - loc_eng_nmea_send(sentence, length, loc_eng_data_p); + // For RPC, the DOP are sent during sv report, so cache them + // now to be sent during position report. + // For QMI, the DOP will be in position report. + if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DOP) + { + loc_eng_data_p->pdop = locationExtended.pdop; + loc_eng_data_p->hdop = locationExtended.hdop; + loc_eng_data_p->vdop = locationExtended.vdop; } else - { // cache the used in fix mask, as it will be needed to send $GPGSA - // during the position report - loc_eng_data_p->sv_used_mask = svStatus.gps_used_in_fix_mask; - - // For RPC, the DOP are sent during sv report, so cache them - // now to be sent during position report. - // For QMI, the DOP will be in position report. - if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DOP) - { - loc_eng_data_p->pdop = locationExtended.pdop; - loc_eng_data_p->hdop = locationExtended.hdop; - loc_eng_data_p->vdop = locationExtended.vdop; - } - else - { - loc_eng_data_p->pdop = 0; - loc_eng_data_p->hdop = 0; - loc_eng_data_p->vdop = 0; - } - + { + loc_eng_data_p->pdop = 0; + loc_eng_data_p->hdop = 0; + loc_eng_data_p->vdop = 0; } EXIT_LOG(%d, 0);