SerialRadioTransport

class SerialRadioTransport(callback: RadioTransportCallback, scope: CoroutineScope, serialDevices: StateFlow<Map<String, UsbSerialDriver>>, createSerialConnection: (UsbSerialDriver, SerialConnectionListener) -> SerialConnection, address: String) : StreamTransport(source)

An Android USB/serial RadioTransport implementation.

Constructors

Link copied to clipboard
constructor(callback: RadioTransportCallback, scope: CoroutineScope, serialDevices: StateFlow<Map<String, UsbSerialDriver>>, createSerialConnection: (UsbSerialDriver, SerialConnectionListener) -> SerialConnection, address: String)

Functions

Link copied to clipboard
open suspend override fun close()

Closes admission and lets already-admitted frames finish before cancelling the worker as a bounded fallback.

Link copied to clipboard
open fun flushBytes()

Flushes buffered bytes to the underlying stream. No-op by default.

Link copied to clipboard
open override fun handleSendToRadio(p: ByteArray): Boolean
Link copied to clipboard
open override fun keepAlive()
Link copied to clipboard
open override fun sendBytes(p: ByteArray)

Writes raw bytes to the underlying stream (serial port, TCP socket, etc.). Implementations may block until the driver accepts the bytes, so direct callers must already be running on an I/O dispatcher. Framed packet sends use queueFramedSend, whose writer controls dispatcher confinement. Subclasses that rely on queueFramedSend's default writer must therefore supply an I/O-confined scope.

Link copied to clipboard
open override fun start()