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

Number of times invalidateServiceCache has been invoked.

Link copied to clipboard

Result returned by invalidateServiceCache; defaults to false to match the BleConnection default.

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
var onDisconnect: () -> Unit?

Optional callback invoked at the end of disconnect (e.g. seed freshly-discovered services on reconnect).

Link copied to clipboard

Number of times profile has been invoked.

Link copied to clipboard
var profileServiceProvider: (profileCall: Int) -> BleService

Selects the service exposed to each profile call. The argument is the 1-based profile call ordinal (the first call receives 1). Defaults to the shared service.

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 invalidateServiceCache(): Boolean
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.