1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2025-12-13 05:53:06 +01:00

NMEA0183 AIS to N2K, corrected some encodings

This commit is contained in:
andreas
2021-11-02 19:29:40 +01:00
parent 3b437c8476
commit b84e47d16a
5 changed files with 73 additions and 33 deletions

View File

@@ -842,11 +842,18 @@ bool AisDecoder::checkTalkerId(const StringRef &_strTalkerId)
Decode next sentence (starts reading from input buffer with the specified offset; returns the number of bytes processed, or 0 when no more messages can be decoded).
Has to be called until it returns 0, to ensure that any buffered multi-line strings are backed up properly.
*/
size_t AisDecoder::decodeMsg(const char *_pNmeaBuffer, size_t _uBufferSize, size_t _uOffset, const SentenceParser &_parser)
size_t AisDecoder::decodeMsg(const char *_pNmeaBuffer, size_t _uBufferSize, size_t _uOffset,
const SentenceParser &_parser, bool treatAsComplete)
{
// process and decode AIS strings
StringRef strLine;
size_t n = getLine(strLine, _pNmeaBuffer, _uBufferSize, _uOffset);
size_t n = 0;
if (treatAsComplete){
strLine=StringRef(_pNmeaBuffer+_uOffset,_uBufferSize);
}
else{
n=getLine(strLine, _pNmeaBuffer, _uBufferSize, _uOffset);
}
if (strLine.size() > 2) // ignore empty lines
{
// clear user data

View File

@@ -234,7 +234,8 @@ namespace AIS
Decode next sentence (starts reading from input buffer with the specified offset; returns the number of bytes processed, or 0 when no more messages can be decoded).
Has to be called until it returns 0, to ensure that any buffered multi-line strings are backed up properly.
*/
size_t decodeMsg(const char *_pNmeaBuffer, size_t _uBufferSize, size_t _uOffset, const SentenceParser &_parser);
size_t decodeMsg(const char *_pNmeaBuffer, size_t _uBufferSize, size_t _uOffset,
const SentenceParser &_parser, bool treatAsComplete=false);
/// returns the total number of messages processed
uint64_t getTotalMessageCount() const {return m_uTotalMessages;}