Skip to content

Commit

Permalink
#9 only dumpif ok
Browse files Browse the repository at this point in the history
  • Loading branch information
F4FXL committed Jan 7, 2022
1 parent a9953ae commit bfd95ad
Showing 1 changed file with 6 additions and 28 deletions.
34 changes: 6 additions & 28 deletions RSMS1AMessageCollector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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())
Expand Down

0 comments on commit bfd95ad

Please sign in to comment.