Expand description
Voice-stream capture state manager.
A D-STAR voice transmission on the wire is a sequence of protocol events:
VoiceStart(header) -> VoiceFrame x N -> VoiceEndEach transmission carries two parallel data streams inside the voice frames:
-
AMBE voice data (9 bytes/frame, 50 frames/sec): the compressed speech audio that will be decoded to PCM and then to MP3.
-
Slow data (3 bytes/frame, 50 frames/sec): a low-bandwidth side channel carrying things like text messages, DPRS position reports, and squelch codes. Each logical slow-data block spans several frames and is reassembled by
SlowDataAssembler. Frame 0 of every 21-frame superframe is a sync frame (slow-data content0x555555), not a data fragment — the assembler handles the descrambling internally.
This module provides two types that encapsulate the per-stream and cross-stream bookkeeping:
-
StreamCapture— one in-progress capture: header metadata, all accumulated AMBE frames, and the slow-data assembler with its recovered text/DPRS fields. -
CaptureManager— maps stream IDs to active captures, so that voice frames from multiple concurrent transmissions (different modules, different reflectors) can be dispatched to the correct capture without cross-contamination.
§Slow-data assembly details
dstar_gateway_core::SlowDataAssembler::push takes one 3-byte fragment
at a time and returns Some(SlowDataBlock) when a block completes. For
SlowDataBlock::Text, the .text field holds the 20-character status
message. For SlowDataBlock::Gps, the payload is a raw NMEA-style
DPRS sentence that we feed into dstar_gateway_core::parse_dprs to
extract latitude and longitude. All other block kinds (header retx,
fast data, squelch, unknown) are ignored for persistence purposes —
they aren’t part of the streams table schema.
Structs§
- Capture
Manager 🔒 - Manages multiple concurrent voice-stream captures.
- Stream
Capture 🔒 - State for one in-progress voice-stream capture.