From e3511f0ee244434bc471240c3f8605ba6092017b Mon Sep 17 00:00:00 2001 From: Gunnar Skjold Date: Mon, 4 Mar 2024 09:08:31 +0100 Subject: [PATCH] Fixed HDLC partitioning --- lib/AmsDecoder/src/HdlcParser.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/AmsDecoder/src/HdlcParser.cpp b/lib/AmsDecoder/src/HdlcParser.cpp index 9ea0092c..3606e3cc 100644 --- a/lib/AmsDecoder/src/HdlcParser.cpp +++ b/lib/AmsDecoder/src/HdlcParser.cpp @@ -69,8 +69,7 @@ int8_t HDLCParser::parse(uint8_t *d, DataParserContext &ctx) { if(buf == NULL) return DATA_PARSE_FAIL; - uint8_t* ptr = (uint8_t*) &h[1]; - memcpy(buf + pos, ptr, ctx.length); + memcpy(buf + pos, ptr+3, ctx.length); // +3 to skip LLC pos += ctx.length; lastSequenceNumber++; @@ -79,8 +78,7 @@ int8_t HDLCParser::parse(uint8_t *d, DataParserContext &ctx) { lastSequenceNumber = 0; if(buf == NULL) return DATA_PARSE_FAIL; - uint8_t* ptr = (uint8_t*) &h[1]; - memcpy(buf + pos, ptr, ctx.length); + memcpy(buf + pos, ptr+3, ctx.length); // +3 to skip LLC pos += ctx.length; memcpy((uint8_t *) d, buf, pos);