Skip to main content

Module packet_bytes

Module packet_bytes 

Source
Expand description

PacketBytesMessage — variable-length byte-payload message codec.

Worked example of a byte-oriented MessageCodec. Unlike the WSJT-style codecs (crate::msg::Wsjt77Message, crate::msg::Wspr50Message, crate::msg::Jt72Codec) which pack callsign / grid / report fields into a fixed-width payload, this codec carries an arbitrary byte slice of length 1..=10 in 91 information bits — the K of crate::fec::Ldpc174_91.

No protocol in mfsk-core 0.3.0 uses this codec directly; it remains as a reference implementation demonstrating that the MessageCodec trait surface accommodates byte-oriented protocols, alongside the WSJT-77 callsign-packing flavour. Future binary-payload protocols (planned for 0.4.0+) can use it directly when the LDPC174_91 K=91 payload size is a fit, or build analogous codecs for other LDPC sizes.

§Bit layout (91 bits)

bits  0 ..  4 : length code (4 bits) = (actual_length - 1)
bits  4 .. 84 : 10 bytes × 8 = 80 bits, MSB-first per byte
bits 84 .. 91 : CRC-7 over bits 0..84 (poly x^7 + x^3 + 1, 0x09)

Length codes 0..=9 encode payload byte counts 1..=10. Codes 10..=15 are reserved and cause MessageCodec::unpack to return None. The CRC-7 occupies the trailing 7 bits and is verified both on MessageCodec::unpack and as the in-FEC verify_info integrity check (BP rejects mid-iteration on CRC-7 fail). Polynomial x^7 + x^3 + 1 (0x09) — the SD-card standard CRC-7. Hamming distance ≥ 3 over the 84-bit input; combined with LDPC’s already-low post-FEC BER this drops false-decode rate by ~2 orders of magnitude versus the naive “always accept” verifier.

[MessageCodec::Unpacked = Vec<u8>] — the codec’s unpack returns the payload bytes only (length and CRC fields stripped).

Structs§

PacketBytesMessage
Variable-length byte-payload codec. See module docs for the bit layout.

Constants§

MAX_PAYLOAD_BYTES
Maximum payload length in bytes per frame.