SharedRadioInterfaceService

class SharedRadioInterfaceService(dispatchers: CoroutineDispatchers, bluetoothRepository: BluetoothRepository, networkRepository: NetworkRepository, serialDevicePresence: SerialDevicePresence, processLifecycle: Lifecycle, radioPrefs: RadioPrefs, transportFactory: RadioTransportFactory, analytics: PlatformAnalytics, firmwareMaintenanceLock: FirmwareMaintenanceLock) : RadioInterfaceService(source)

Shared multiplatform connection orchestrator for Meshtastic radios.

Manages the connection lifecycle (connect, active, disconnect, reconnect loop), device address state flows, and hardware state observability (BLE/Network toggles). Delegates the actual raw byte transport mapping to a platform-specific RadioTransportFactory.

Constructors

Link copied to clipboard
constructor(dispatchers: CoroutineDispatchers, bluetoothRepository: BluetoothRepository, networkRepository: NetworkRepository, serialDevicePresence: SerialDevicePresence, processLifecycle: Lifecycle, radioPrefs: RadioPrefs, transportFactory: RadioTransportFactory, analytics: PlatformAnalytics, firmwareMaintenanceLock: FirmwareMaintenanceLock)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override val activeSession: StateFlow<RadioSessionContext?>
Link copied to clipboard
open override val connectionError: Flow<String>
Link copied to clipboard
open override val connectionState: StateFlow<ConnectionState>
Link copied to clipboard
open override val currentDeviceAddressFlow: StateFlow<String?>
Link copied to clipboard
Link copied to clipboard
open override val meshActivity: Flow<MeshActivity>
Link copied to clipboard
open override val mockTransportEnabled: StateFlow<Boolean>
Link copied to clipboard
open override val receivedData: Flow<ReceivedRadioFrame>
Link copied to clipboard
open override val serviceScope: CoroutineScope
Link copied to clipboard
open override val sessionGeneration: StateFlow<Long>
Link copied to clipboard

Functions

Link copied to clipboard
open override fun connect()
Link copied to clipboard
open suspend override fun disconnect()
Link copied to clipboard
open override fun getDeviceAddress(): String?
Link copied to clipboard
open override fun handleFromRadio(bytes: ByteArray)
Link copied to clipboard
open override fun isSessionActive(session: RadioSessionContext): Boolean
Link copied to clipboard
fun keepAlive(now: Long = now())
Link copied to clipboard
open override fun onConnect()
Link copied to clipboard
open override fun onDisconnect(isPermanent: Boolean, errorMessage: String?, reason: TransportDisconnectReason?)
Link copied to clipboard
open override fun resetReceivedBuffer()
Link copied to clipboard
open suspend override fun restartTransport()
Link copied to clipboard
open override fun runIfSessionActive(session: RadioSessionContext, block: () -> Unit): Boolean
Link copied to clipboard
open suspend override fun runWhileSessionActive(session: RadioSessionContext, block: suspend () -> Unit): Boolean
Link copied to clipboard
open suspend override fun runWithSessionLease(session: RadioSessionContext, block: suspend (RadioSessionLease) -> Unit): Boolean
Link copied to clipboard
open fun sendToRadio(bytes: ByteArray)
Link copied to clipboard
open override fun setDeviceAddress(deviceAddr: String?): Boolean
Link copied to clipboard
open override fun toInterfaceAddress(interfaceId: InterfaceId, rest: String): String
Link copied to clipboard
open override fun trySendToRadio(bytes: ByteArray): Boolean