Ignore Mbus short frames when parsing HDLC transmission#19
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the HDLC decoding path to tolerate valid M-Bus short frames interleaved within an HDLC transmission, moving the “skip M-Bus short frame” logic into the HDLC decoder and adjusting tests accordingly.
Changes:
- Add M-Bus short frame detection/skipping to
decode_hdlc_frames_in_place(). - Update HDLC decoder tests to cover skipping short frames and invalid-checksum behavior.
- Remove the older integration test case that prepended an M-Bus short frame to an Iskra 550 dump, and update parser routing for
0x10.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_meter_dumps.cpp | Removes the integration subcase that included an M-Bus short frame prefix. |
| tests/test_hdlc_decoder.cpp | Adds unit tests asserting M-Bus short frames are skipped (and invalid ones are not). |
| src/dlms_parser/hdlc_decoder.h | Updates public header documentation for HDLC in-place decode behavior. |
| src/dlms_parser/hdlc_decoder.cpp | Implements M-Bus short frame detection and skipping in the HDLC decoder loop. |
| src/dlms_parser/dlms_parser.cpp | Removes parser-level short-frame stripping and routes 0x10 buffers into HDLC decoding. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
PolarGoose
force-pushed
the
ignore_mbus_short_frames_in_hdlc_parser
branch
2 times, most recently
from
July 16, 2026 12:09
58e0d75 to
7708da9
Compare
PolarGoose
force-pushed
the
ignore_mbus_short_frames_in_hdlc_parser
branch
from
July 16, 2026 12:10
7708da9 to
88d93b6
Compare
PolarGoose
force-pushed
the
ignore_mbus_short_frames_in_hdlc_parser
branch
from
July 16, 2026 12:40
88d93b6 to
c7cef02
Compare
PolarGoose
force-pushed
the
ignore_mbus_short_frames_in_hdlc_parser
branch
from
July 16, 2026 12:40
c7cef02 to
3053cbe
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The log provided by @TheNetStriker here shows that the
Landis+Gyr E450smart meter sends Mbus short frames while transmitting HDLC packetsLone Mbus packet without any HDLC packets:
Mbus short packet
107B017C16in between the end of HDLC transmission. It later causes an error because the last HDLC packet comes after more than a second and is treated as a separate transmission (it is another issue that we need to address):This pull request makes the HDLC parser ignore MBus short packets.