Fixed HDLC partitioning

This commit is contained in:
Gunnar Skjold 2024-03-04 09:08:31 +01:00
parent f4de3e6178
commit e3511f0ee2

View File

@ -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);