RadioTransport

Interface that transports (BLE, TCP, serial, etc.) must implement.

Transports are responsible for physical framing, buffering, and connection lifecycle. The SDK codec handles higher-level protocol framing (sync bytes, length, CRC).

Single collector rule: frames returns a cold flow that the SDK collects exactly once. Transports must not support multiple concurrent collectors (by design; the SDK owns the reader).

Thread safety: the SDK's engine actor calls connect, disconnect, send, and collects frames/state from a single coroutine context at a time. Transport implementations therefore do not need internal locking against the engine, but they must tolerate disconnect() being invoked at any point — including while a connect(), send(), or frame collection is in flight on another coroutine — and clean up promptly.

Since

0.1.0

Properties

Link copied to clipboard

The deterministic identity of this transport configuration.

Link copied to clipboard
abstract val state: StateFlow<TransportState>

Observe transport connection state.

Functions

Link copied to clipboard
abstract suspend fun connect()

Initiate connection. May throw MeshtasticException.Transport on fatal errors.

Link copied to clipboard
abstract suspend fun disconnect()

Disconnect gracefully.

Link copied to clipboard
abstract fun frames(): Flow<Frame>

Observe inbound framed packets.

Link copied to clipboard
abstract suspend fun send(frame: Frame)

Send a framed packet synchronously to the device.