WireCodec

Pure codec for wire framing and protobuf serialization.

Handles framing per protocol.md §2 (TCP/Serial stream framing with resync) and encodes/decodes protobuf envelopes. No I/O, no state machines — just encode/decode.

Framing format (TCP & Serial transports):

+------+------+----------+----------+==================+
| 0x94 | 0xC3 | LEN_HI | LEN_LO | protobuf bytes |
+------+------+----------+----------+==================+
  • Sync bytes: 0x94 0xC3

  • Length: big-endian uint16 (payload only, excludes 4-byte header)

  • Max payload: 512 bytes

Since

0.1.0

Types

Link copied to clipboard

Streaming decoder state machine for TCP/Serial transports.

Functions

Link copied to clipboard
fun decodeFromRadio(payload: ByteArray): FromRadio

Decode a framed protobuf into a FromRadio message.

Link copied to clipboard
fun encodeToRadio(message: ToRadio): ByteArray

Encode a ToRadio into a framed byte array ready for transmission.