FakeBleConnection

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard

Number of times connectAndAwait has been invoked (including failures).

Link copied to clipboard

When non-null, connectAndAwait throws this exception instead of connecting.

Link copied to clipboard
open override val connectionState: StateFlow<BleConnectionState>
Link copied to clipboard
open override val device: BleDevice?
Link copied to clipboard
open override val deviceFlow: StateFlow<BleDevice?>
Link copied to clipboard

Number of times disconnect has been invoked.

Link copied to clipboard
Link copied to clipboard

Negotiated write length exposed to callers; null means unknown / not negotiated.

Link copied to clipboard

Service UUIDs that should appear missing — profile() throws NoSuchElementException for these.

Link copied to clipboard

Functions

Link copied to clipboard
open suspend override fun connect(device: BleDevice)
Link copied to clipboard
open suspend override fun connectAndAwait(device: BleDevice, timeout: Duration): BleConnectionState
Link copied to clipboard
open suspend override fun disconnect()
Link copied to clipboard
open override fun maximumWriteValueLength(writeType: BleWriteType): Int?
Link copied to clipboard
open suspend override fun <T> profile(serviceUuid: Uuid, timeout: Duration, setup: suspend CoroutineScope.(BleService) -> T): T
Link copied to clipboard
open fun reset()

Resets all registered state flows and custom actions to their initial state.

Link copied to clipboard
fun simulateRemoteDisconnect(reason: DisconnectReason = DisconnectReason.Timeout)

Externally simulate a remote disconnect (e.g. node power-cycle) for tests that exercise reconnect.