Do not send debug NMEA to ulp
Checking in GnssAdapter::reportNmeaEvent to see if the incoming nmea is debug, in which case we do not route that to ULP. Debug NMEA is only for SystemStatus consumption. Change-Id: Ifb60b9a643ad6aeb732fcaf5a68f868cb55cd88a CRs-Fixed: 2027134
This commit is contained in:
parent
905d69ef10
commit
8b98a565a5
3 changed files with 17 additions and 10 deletions
|
@ -34,6 +34,7 @@
|
|||
#include <sys/time.h>
|
||||
#include <pthread.h>
|
||||
#include <platform_lib_log_util.h>
|
||||
#include <loc_nmea.h>
|
||||
#include <SystemStatus.h>
|
||||
|
||||
namespace loc_core
|
||||
|
@ -48,14 +49,10 @@ protected:
|
|||
std::vector<std::string> mField;
|
||||
timespec setUtcTime(std::string sutctime);
|
||||
|
||||
public:
|
||||
static const uint32_t NMEA_MINSIZE = 6;
|
||||
static const uint32_t NMEA_MAXSIZE = 256;
|
||||
|
||||
SystemStatusNmeaBase(const char *str_in, uint32_t len_in)
|
||||
{
|
||||
// check size and talker
|
||||
if (len_in > NMEA_MAXSIZE || len_in < NMEA_MINSIZE || (str_in[0] != '$')) {
|
||||
if (!loc_nmea_is_debug(str_in, len_in)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -83,6 +80,10 @@ public:
|
|||
}
|
||||
|
||||
virtual ~SystemStatusNmeaBase() { }
|
||||
|
||||
public:
|
||||
static const uint32_t NMEA_MINSIZE = DEBUG_NMEA_MINSIZE;
|
||||
static const uint32_t NMEA_MAXSIZE = DEBUG_NMEA_MAXSIZE;
|
||||
};
|
||||
|
||||
timespec SystemStatusNmeaBase::setUtcTime(std::string sutctime)
|
||||
|
@ -1316,9 +1317,7 @@ static uint32_t cnt_s1 = 0;
|
|||
bool SystemStatus::setNmeaString(const char *data, uint32_t len)
|
||||
{
|
||||
bool ret = false;
|
||||
if (NULL == data
|
||||
|| (len < SystemStatusNmeaBase::NMEA_MINSIZE)
|
||||
|| (len > SystemStatusNmeaBase::NMEA_MAXSIZE)) {
|
||||
if (!loc_nmea_is_debug(data, len)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include <GnssAdapter.h>
|
||||
#include <string>
|
||||
#include <loc_log.h>
|
||||
#include <loc_nmea.h>
|
||||
#include <Agps.h>
|
||||
#include <SystemStatus.h>
|
||||
|
||||
|
@ -1987,9 +1988,8 @@ GnssAdapter::reportSv(GnssSvNotification& svNotify)
|
|||
void
|
||||
GnssAdapter::reportNmeaEvent(const char* nmea, size_t length, bool fromUlp)
|
||||
{
|
||||
|
||||
// if this event is not called from ULP, then try to call into ULP and return if successfull
|
||||
if (!fromUlp) {
|
||||
if (!fromUlp && !loc_nmea_is_debug(nmea, length)) {
|
||||
if (mUlpProxy->reportNmea(nmea, length)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -43,4 +43,12 @@ void loc_nmea_generate_pos(const UlpLocation &location,
|
|||
unsigned char generate_nmea,
|
||||
std::vector<std::string> &nmeaArraystr);
|
||||
|
||||
#define DEBUG_NMEA_MINSIZE 6
|
||||
#define DEBUG_NMEA_MAXSIZE 256
|
||||
inline bool loc_nmea_is_debug(const char* nmea, int length) {
|
||||
return ((nullptr != nmea) &&
|
||||
(length >= DEBUG_NMEA_MINSIZE) && (length <= DEBUG_NMEA_MAXSIZE) &&
|
||||
(nmea[0] == '$') && (nmea[1] == 'P') && (nmea[2] == 'Q') && (nmea[3] == 'W'));
|
||||
}
|
||||
|
||||
#endif // LOC_ENG_NMEA_H
|
||||
|
|
Loading…
Reference in a new issue