Skip to content

Commit

Permalink
Fix decoding of %c (used in BESTUTM)
Browse files Browse the repository at this point in the history
Was always being decoded as 0.
  • Loading branch information
valgur committed Oct 23, 2024
1 parent 04d7433 commit 596a4e1
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* text=auto

# These are unit test files and should use crlf
regression/targets/* eol=crlf
*.ASC text eol=crlf
*.asc text eol=crlf
*.txt text eol=crlf
Expand Down
Binary file modified regression/targets/BESTUTMBIN.GPS.ABBREV_ASCII
Binary file not shown.
Binary file modified regression/targets/BESTUTMBIN.GPS.ASCII
Binary file not shown.
Binary file modified regression/targets/BESTUTMBIN.GPS.BINARY
Binary file not shown.
Binary file modified regression/targets/BESTUTMBIN.GPS.FLATTENED_BINARY
Binary file not shown.
Binary file modified regression/targets/BESTUTMBIN.GPS.JSON
Binary file not shown.
8 changes: 7 additions & 1 deletion src/decoders/oem/src/message_decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,13 @@ void MessageDecoder::InitOemFieldMaps()
// =========================================================
// ASCII Field Mapping
// =========================================================
asciiFieldMap[CalculateBlockCrc32("c")] = SimpleAsciiMapEntry<uint32_t>();
asciiFieldMap[CalculateBlockCrc32("c")] = [](std::vector<FieldContainer>& vIntermediateFormat_, const BaseField* pstMessageDataType_,
const char** ppcToken_, [[maybe_unused]] const size_t tokenLength_,
[[maybe_unused]] JsonReader* pclMsgDb_) {
// TODO: check that the character is printable
// if (!isprint(**ppcToken_)) { throw ... }
vIntermediateFormat_.emplace_back(static_cast<uint32_t>(**ppcToken_), pstMessageDataType_);
};
asciiFieldMap[CalculateBlockCrc32("k")] = SimpleAsciiMapEntry<float>();
asciiFieldMap[CalculateBlockCrc32("lk")] = SimpleAsciiMapEntry<double>();

Expand Down

0 comments on commit 596a4e1

Please sign in to comment.