Skip to main content

Module codec

Module codec 

Source
Expand description

ECR17 packet framing: encode/decode STX payload ETX LRC application frames, SOH message EOT progress updates (no LRC), and ACK/NAK control frames.

PacketCodec::decode treats the input buffer as exactly one frame. Frame shapes differ: an application frame ends with its LRC byte, a progress frame ends with EOT (no LRC), and a control frame is recognized by its lead byte. Splitting a coalesced byte stream into individual frames is the transport/session layer’s responsibility, not the codec’s.

Port of the reference C++ PacketCodec.

Structs§

DecodedPacket
A decoded frame. For PacketType::Application, valid_lrc reports whether the received LRC matched the recomputed one.
PacketCodec
Frames and parses ECR17 packets for a given LrcMode.

Enums§

PacketType
The kind of frame PacketCodec::decode recognized.

Constants§

ACK
Positive acknowledgement control byte.
EOT
End of a progress-update frame (its final byte; no LRC).
ETX
End of the application payload (precedes the LRC).
NAK
Negative acknowledgement control byte.
SOH
Start of a progress-update frame.
STX
Start of an application frame.