Commit Graph

8 Commits

Author SHA1 Message Date
881b83c597 fix alloc 2026-01-18 19:20:13 +01:00
ad9ca06bda fix(transmission): avoid lifetime in FromBytesError by owning data
Changed FromBytesError::InvalidBytes to take ownership of the byte slice by converting it to Vec<u8>. This removes the lifetime parameter from the enum, simplifying the API and preventing potential lifetime-related issues. The change ensures that error instances can be freely moved and stored without borrowing constraints.
2026-01-18 19:19:06 +01:00
9072ae01ad feat(transmission): improve error handling for invalid byte sequences
Refactored Protocol300Transmission parsing to provide more detailed error information when encountering invalid byte sequences. Changed the error variant from `InvalidByte` to `InvalidBytes` which now includes the problematic byte slice, enabling better debugging. Updated the match arm to capture the byte slice as `b` instead of using a wildcard, and modified the error logging to reflect these changes. The lifetime parameter was added to the `FromBytesError` enum to support the byte slice reference.
2026-01-18 19:16:03 +01:00
7e3d16ad6a feat(transmission): add length_in_bytes method to Protocol300Transmission
Add a new method to calculate the byte length of Protocol300Transmission
variants without converting to bytes. The method returns:
- 1 byte for control characters (Ack, Enq, Eot, Nack)
- 3 bytes for Init
- telegram_length + 3 bytes for Message

Include comprehensive unit tests for all transmission variants to ensure
correct length calculation.
2026-01-17 18:47:25 +01:00
6ca19f88fa Added defmt logging 2026-01-16 22:33:53 +01:00
d30a261e74 Add better error logging 2026-01-16 22:17:13 +01:00
40fa67ecea fix no-std compatiblity 2026-01-10 17:39:04 +01:00
ffc7ed4a0e Added Protocol300Transmission to also decode control codes 2026-01-10 17:33:48 +01:00