From bfd95ad426902e714ccc1180d47c85a4b3607907 Mon Sep 17 00:00:00 2001 From: Geoffrey Merck Date: Fri, 7 Jan 2022 13:21:40 +0100 Subject: [PATCH] #9 only dumpif ok --- RSMS1AMessageCollector.cpp | 34 ++++++---------------------------- 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/RSMS1AMessageCollector.cpp b/RSMS1AMessageCollector.cpp index bb30923..d0a2ade 100644 --- a/RSMS1AMessageCollector.cpp +++ b/RSMS1AMessageCollector.cpp @@ -58,8 +58,12 @@ bool CRSMS1AMessageCollector::isValidMsg(const std::string& msg) && !splits[1].empty() && !splits[2].empty(); - CUtils::dump("RS-MS1A:", (unsigned char *)msg.c_str(), msg.length() + 1U); - CLog::logDebug("RS-MS1A: %s", msg.c_str()); + if(ret) { + CUtils::dump("RS-MS1A:", (unsigned char *)msg.c_str(), msg.length() + 1U); + CLog::logDebug("RS-MS1A: %s", msg.c_str()); + + + } return ret; @@ -78,32 +82,6 @@ bool CRSMS1AMessageCollector::isValidMsg(const std::string& msg) // return res; } -unsigned int CRSMS1AMessageCollector::calcCRC(const std::string& gpsa, unsigned int start, unsigned int length) -{ - unsigned int icomcrc = 0xFFFFU; - auto end = start + length; - if(end > gpsa.length()) { - end = gpsa.length(); - } - - for (unsigned int j = start; j < end; j++) { - unsigned char ch = (unsigned char)gpsa[j]; - - for (unsigned int i = 0U; i < 8U; i++) { - bool xorflag = (((icomcrc ^ ch) & 0x01U) == 0x01U); - - icomcrc >>= 1; - - if (xorflag) - icomcrc ^= 0x8408U; - - ch >>= 1; - } - } - - return ~icomcrc & 0xFFFFU; -} - unsigned int CRSMS1AMessageCollector::getDataInt(unsigned char * data, unsigned int length) { if(data == nullptr || length == 0U || getSentence().empty())