Remove dynamic memory allocations. Add support for TF-PSA encryption. Add logging. Add extra sensors.#51
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the DSMR parsing/decryption APIs to remove dynamic allocations, add logging, add TF-PSA AES-128-GCM support, and expand protocol coverage (incl. Israel-specific OBIS fields), with corresponding test and documentation updates.
Changes:
- Refactor parsing/accumulation APIs to work on
std::string_view/std::span<uint8_t>and returnbool/std::optionalwith error details routed through logging. - Introduce a pluggable AES-128-GCM decryptor interface and add a TF-PSA implementation; update DLMS decryptor to return
DsmrUnencryptedTelegram. - Expand unit tests and examples, add a shared test log-capture fixture, and update README to reflect new capabilities/goals.
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_util.h | Adds a logger capture fixture used throughout tests. |
| tests/parser_test.cpp | Updates parser tests to new DsmrParser API, adds Israel OBIS coverage, and asserts on logged errors. |
| tests/parser_include_test.cpp | Updates include/compile smoke test to new parser API. |
| tests/packet_accumulator_test.cpp | Migrates to uint8_t buffers, new return type, and log-based assertions. |
| tests/packet_accumulator_include_test.cpp | Updates include/compile smoke test for new PacketAccumulator ctor signature. |
| tests/packet_accumulator_example_test.cpp | Updates usage example to new accumulator/parser APIs and improves inline guidance. |
| tests/dlms_packet_decryptor_test.cpp | Updates decryptor tests for new interface and adds TF-PSA backend coverage. |
| tests/dlms_packet_decryptor_include_test.cpp | Updates include/compile smoke test for new decryptor construction and key type. |
| tests/dlms_packet_decryptor_example_test.cpp | Updates decryptor example to new API and documents available backends. |
| tests/decryption/aes128gcm_tfpsa_include_test.cpp | Adds include/compile smoke test for the TF-PSA backend header. |
| tests/decryption/aes128gcm_mbedtls_include_test.cpp | Updates include/compile smoke test paths/types for mbedTLS backend. |
| tests/decryption/aes128gcm_bearssl_include_test.cpp | Updates include/compile smoke test paths/types for BearSSL backend. |
| src/dsmr_parser/util.h | Removes ParseResult, adds DsmrUnencryptedTelegram and a global Logger facility. |
| src/dsmr_parser/parser.h | Rewrites parsing to string_view + logging, adds DsmrParser entrypoint. |
| src/dsmr_parser/packet_accumulator.h | Switches to uint8_t buffers and returns std::optional<DsmrUnencryptedTelegram> with logging. |
| src/dsmr_parser/fields.h | Migrates fields to string_view storage and new parsing helpers; adds Israel-specific OBIS fields. |
| src/dsmr_parser/dlms_packet_decryptor.h | Refactors decryptor to use a backend interface and return DsmrUnencryptedTelegram; adds extra validation/logging. |
| src/dsmr_parser/decryption/aes128gcm.h | Introduces new AES-128-GCM key/decryptor interface and hex parsing. |
| src/dsmr_parser/decryption/aes128gcm_mbedtls.h | Updates mbedTLS backend to implement the new decryptor interface. |
| src/dsmr_parser/decryption/aes128gcm_bearssl.h | Updates BearSSL backend to implement the new decryptor interface and improves header detection. |
| src/dsmr_parser/decryption/aes128gcm_tfpsa.h | Adds TF-PSA AES-128-GCM decryptor backend. |
| src/dsmr_parser/aes128gcm.h | Removes old key type/header (replaced by decryption/aes128gcm.h). |
| README.md | Updates stated goals (no dynamic allocations), supported encryption backends, and links/examples. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
d167651 to
3ec48fb
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 23 out of 23 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3ec48fb to
9edb50b
Compare
* Add support for TF-PSA encryption * Improve test coverage * Add logging * Incorporate pull request "add OBIS for israel meters": #50 * Increase the version of the library to "1.3.0"
9edb50b to
d1db480
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.
Uh oh!
There was an error while loading. Please reload this page.