Module mmdvm_session

Module mmdvm_session 

Source
Expand description

MMDVM session management for the TH-D75.

When the radio enters MMDVM mode (via TN 3,x), the serial port switches from ASCII CAT commands to binary MMDVM framing. CAT commands cannot be used until MMDVM mode is exited. The MmdvmSession type enforces this at the type level: creating one consumes the Radio, and exiting returns it.

§Design notes

The session holds an mmdvm::AsyncModem that owns the transport via a MmdvmTransportAdapter. All MMDVM framing, periodic status polling, TX-queue slot gating, and RX frame dispatch happen inside the AsyncModem’s spawned task — the session itself is just a thin lifecycle wrapper that also caches the Radio’s CAT-mode state for restoration on exit.

Higher-level D-STAR operation (slow-data decode, last-heard list, URCALL parsing, echo recording, etc.) lives in crate::mmdvm::DStarGateway, which owns an MmdvmSession and delegates raw frame I/O to it.

§Example

let transport = SerialTransport::open("/dev/cu.usbmodem1234", 115_200)?;
let radio = Radio::connect(transport).await?;

// Enter MMDVM mode (consumes the Radio).
let session = radio.enter_mmdvm(TncBaud::Bps9600).await.map_err(|(_, e)| e)?;

// ... use session.modem_mut() for raw MMDVM operations, or build a
// DStarGateway on top of it ...

// Exit MMDVM mode (returns the Radio).
let radio = session.exit().await?;

Structs§

MmdvmSession
An MMDVM session that owns the radio transport via an mmdvm::AsyncModem.