mirror of
https://github.com/meshcore-dev/meshcore_py.git
synced 2026-07-26 18:08:12 +00:00
Why: companion-radio firmware emits RESP_CODE_CHANNEL_DATA_RECV (27) for group-channel binary data (PAYLOAD_TYPE_GRP_DATA), shipped in companion-v1.15.0. The SDK had no PacketType value 27, no EventType, and no reader handler, so these frames hit the unknown-packet-type fallthrough and the payload was silently dropped. This adds PacketType.CHANNEL_DATA_RECV = 27 (the previously-skipped enum slot), EventType.CHANNEL_DATA_RECV, and a reader handler. The fixed 9-byte header (snr, reserved, channel_idx, path_len with the sentinel/hash-mode encoding) reuses CHANNEL_MSG_RECV_V3's framing; the typed tail decodes data_type (uint16 little-endian, widened from uint8 in firmware), data_len, and payload (hex string). An up-front length gate mirrors the defensive-read pattern used by the other handlers. data_type is exposed as an int (matching the txt_type convention) and payload as a hex string (matching RAW_DATA's convention for binary data of unknown encoding); attributes surface channel_idx and data_type so subscribers can filter without unpacking the payload. Tests: tests/unit/test_protocol_surface_gaps.py — 5 new tests (enum slot present, direct-path frame, route-flood path_len bit-split, under-minimum frame dropped, widened data_type round-trip). Full unit suite: 146 passed.