FakeRadioInterfaceService

class FakeRadioInterfaceService(val serviceScope: CoroutineScope = MainScope()) : RadioInterfaceService(source)

A test double for RadioInterfaceService that provides an in-memory implementation.

The connectionState here mirrors the transport-level semantics of the real implementation. In production, only MeshConnectionManager observes this flow; tests should verify that bridging behavior rather than consuming it directly from UI/feature test code (use FakeServiceRepository.connectionState instead). Address selection remains separate from transport admission: connect and an in-flight restartTransport publish a fresh monotonically increasing session generation.

Constructors

Link copied to clipboard
constructor(serviceScope: CoroutineScope = MainScope())

Properties

Link copied to clipboard
open override val activeSession: StateFlow<RadioSessionContext?>
Link copied to clipboard
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

No capture asset in tests; flip per-test when exercising replay-gated behaviour.

Link copied to clipboard
open override val meshActivity: Flow<MeshActivity>
Link copied to clipboard
open override val mockTransportEnabled: MutableStateFlow<Boolean>
Link copied to clipboard
open override val receivedData: Flow<ReceivedRadioFrame>
Link copied to clipboard

Set to true to simulate an admitted transport rejecting the byte handoff.

Link copied to clipboard
Link copied to clipboard

Thread-safe lifetime history of writes accepted across all admitted fake transport sessions.

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
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
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
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

Records bytes only while a transport session is admitted. Tests must select a non-null device address and call connect before sending; attempts outside that lifecycle return false and leave sentToRadio unchanged.