From 13c41211a7bf48ebf29612f24ce71954f59b1f35 Mon Sep 17 00:00:00 2001 From: Kevin Tang Date: Mon, 18 Dec 2017 21:45:42 -0800 Subject: [PATCH] debug nmea should not sent to upper layer Debug nmea is a way HAL gets GNSS engine debug information from modem. It is provided to developers in the for bugreoprt. Those NMEAs should be discarded once information is extracted out. But by mistake, they are sent to GnssLocationProvider. They will be in the unknown format to apps, and they may get truncated too. Dhanged the condition so these debug nmeas get discarded before they can possibly passed on to GnssLocaitonProvider. Change-Id: I1a8400201e734a37e730321f6c6e5707c71bd3f0 CRs-Fixed: 2160866 --- core/SystemStatus.cpp | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/core/SystemStatus.cpp b/core/SystemStatus.cpp index 9e8f1e17..8dd7e615 100644 --- a/core/SystemStatus.cpp +++ b/core/SystemStatus.cpp @@ -1350,11 +1350,10 @@ void SystemStatus::getIteminReport(TYPE_REPORT& reportout, const TYPE_ITEM& c) c @param[In] data pointer to the NMEA string @param[In] len length of the NMEA string -@return true when successfully done +@return true when the NMEA is consumed by the method. ******************************************************************************/ bool SystemStatus::setNmeaString(const char *data, uint32_t len) { - bool ret = false; if (!loc_nmea_is_debug(data, len)) { return false; } @@ -1365,43 +1364,43 @@ bool SystemStatus::setNmeaString(const char *data, uint32_t len) pthread_mutex_lock(&mMutexSystemStatus); // parse the received nmea strings here - if (0 == strncmp(data, "$PQWM1", SystemStatusNmeaBase::NMEA_MINSIZE)) { + if (0 == strncmp(data, "$PQWM1", SystemStatusNmeaBase::NMEA_MINSIZE)) { SystemStatusPQWM1 s = SystemStatusPQWM1parser(buf, len).get(); - ret |= setIteminReport(mCache.mTimeAndClock, SystemStatusTimeAndClock(s)); - ret |= setIteminReport(mCache.mXoState, SystemStatusXoState(s)); - ret |= setIteminReport(mCache.mRfAndParams, SystemStatusRfAndParams(s)); - ret |= setIteminReport(mCache.mErrRecovery, SystemStatusErrRecovery(s)); + setIteminReport(mCache.mTimeAndClock, SystemStatusTimeAndClock(s)); + setIteminReport(mCache.mXoState, SystemStatusXoState(s)); + setIteminReport(mCache.mRfAndParams, SystemStatusRfAndParams(s)); + setIteminReport(mCache.mErrRecovery, SystemStatusErrRecovery(s)); } else if (0 == strncmp(data, "$PQWP1", SystemStatusNmeaBase::NMEA_MINSIZE)) { - ret = setIteminReport(mCache.mInjectedPosition, + setIteminReport(mCache.mInjectedPosition, SystemStatusInjectedPosition(SystemStatusPQWP1parser(buf, len).get())); } else if (0 == strncmp(data, "$PQWP2", SystemStatusNmeaBase::NMEA_MINSIZE)) { - ret = setIteminReport(mCache.mBestPosition, + setIteminReport(mCache.mBestPosition, SystemStatusBestPosition(SystemStatusPQWP2parser(buf, len).get())); } else if (0 == strncmp(data, "$PQWP3", SystemStatusNmeaBase::NMEA_MINSIZE)) { - ret = setIteminReport(mCache.mXtra, + setIteminReport(mCache.mXtra, SystemStatusXtra(SystemStatusPQWP3parser(buf, len).get())); } else if (0 == strncmp(data, "$PQWP4", SystemStatusNmeaBase::NMEA_MINSIZE)) { - ret = setIteminReport(mCache.mEphemeris, + setIteminReport(mCache.mEphemeris, SystemStatusEphemeris(SystemStatusPQWP4parser(buf, len).get())); } else if (0 == strncmp(data, "$PQWP5", SystemStatusNmeaBase::NMEA_MINSIZE)) { - ret = setIteminReport(mCache.mSvHealth, + setIteminReport(mCache.mSvHealth, SystemStatusSvHealth(SystemStatusPQWP5parser(buf, len).get())); } else if (0 == strncmp(data, "$PQWP6", SystemStatusNmeaBase::NMEA_MINSIZE)) { - ret = setIteminReport(mCache.mPdr, + setIteminReport(mCache.mPdr, SystemStatusPdr(SystemStatusPQWP6parser(buf, len).get())); } else if (0 == strncmp(data, "$PQWP7", SystemStatusNmeaBase::NMEA_MINSIZE)) { - ret = setIteminReport(mCache.mNavData, + setIteminReport(mCache.mNavData, SystemStatusNavData(SystemStatusPQWP7parser(buf, len).get())); } else if (0 == strncmp(data, "$PQWS1", SystemStatusNmeaBase::NMEA_MINSIZE)) { - ret = setIteminReport(mCache.mPositionFailure, + setIteminReport(mCache.mPositionFailure, SystemStatusPositionFailure(SystemStatusPQWS1parser(buf, len).get())); } else { @@ -1409,7 +1408,7 @@ bool SystemStatus::setNmeaString(const char *data, uint32_t len) } pthread_mutex_unlock(&mMutexSystemStatus); - return ret; + return true; } /******************************************************************************