docs/adr/ADR-264-rtl8720f-radar-wire-protocol.md
ADR-263 adopts RTL8720F radar behind an anti-corruption boundary. The Realtek presentation names CFR, near Range-FFT, far Range-FFT, and interference reports, but does not specify their binary ABI. RuView needs a stable, testable contract that can be implemented before the vendor SDK arrives and that will not expose vendor structs, pointer layouts, padding, or callback lifetime rules over the network.
ADR-018 already defines ESP32 CSI framing. Reusing its magic or pretending that Realtek radar is an ESP32 packet would make source detection ambiguous and erase radar-specific calibration metadata.
Define a new little-endian RtlRadarFrameV1 envelope with its own magic and explicit payload type.
This is a RuView protocol, not a claim about Realtek's native memory layout.
All integer fields are little-endian. Floating-point payloads use IEEE-754 binary32. No C struct is
sent by memcpy; firmware serializes each field explicitly.
| Offset | Size | Field | Meaning |
|---|---|---|---|
| 0 | 4 | magic | ASCII RTR1 (0x31525452) |
| 4 | 1 | version | 1 |
| 5 | 1 | report_type | 1 CFR, 2 range-near, 3 range-far, 4 interference, 5 capabilities |
| 6 | 2 | header_len | complete header size, initially 56 |
| 8 | 4 | frame_len | header + payload + CRC |
| 12 | 4 | sequence | wraps modulo 2^32 |
| 16 | 8 | timestamp_us | monotonic device time at acquisition |
| 24 | 8 | device_id | stable pseudonymous identifier, not a MAC address |
| 32 | 4 | center_freq_khz | RF centre frequency |
| 36 | 2 | bandwidth_mhz | 20, 40, or 70 |
| 38 | 2 | flags | calibration/interference/saturation/time-sync flags |
| 40 | 2 | element_count | complex samples or range bins |
| 42 | 1 | element_format | 0 bytes/TLV, 1 complex-i16, 2 complex-f32, 3 power-u16, 4 power-f32 |
| 43 | 1 | antenna_count | expected to be 1 for the deck's 1T1R configuration |
| 44 | 4 | scale | quantized-to-physical multiplier; 1.0 for float payloads |
| 48 | 4 | bin_spacing | Hz for CFR, metres for Range-FFT |
| 52 | 4 | calibration_id | device calibration revision/hash prefix |
| 56 | variable | payload | determined by type, count, and format |
| final-4 | 4 | crc32 | IEEE CRC-32 over header and payload |
If vendor evidence shows that 56 bytes is too costly, a later protocol version may introduce a compact header. V1 favors auditable provenance over premature byte savings.
The identical envelope is supported over:
One envelope must fit one UDP datagram. Fragmentation is not part of V1; firmware rejects a profile whose maximum report exceeds the configured MTU and reports the required size through capabilities.
The host parser:
No vendor-provided presence probability bypasses RuView privacy, provenance, or quality gates.
rtl8720f types/parser module to wifi-densepose-hardware behind no vendor dependency.Host-side steps 1–3 are implemented in wifi-densepose-hardware::rtl8720f: typed report and
element enums, semantic type/format validation, bounded length arithmetic, CRC verification,
finite-float checks, encode/decode round trips, corruption/truncation tests, and deterministic
arbitrary-input panic checks. Cross-language vectors remain blocked on the vendor SDK callback ABI.
Bit 15 of flags is reserved by RuView as SYNTHETIC; the Rust simulator always sets it and real
firmware must never set it. The simulator is deterministic by seed and exercises the production
encoder/parser rather than a parallel mock representation.
RTL8720F-2.4G-Radar-Advantages_EN.pptx, slides 11–19, supplied
2026-07-18.