ConnectedMockClient
A mock Bluetooth device that has been connected and had its services discovered, ready to route reads and writes.
Obtain one with connectedMockClient. The device is exposed through client so the generated SharedDeviceClient.bluetooth(client, identifier) factory can look it up by identifier.
The device stays connected for the lifetime of this object: its connection state repo and a background collection of its discoveredServices() run on a dedicated child scope that keeps the device connected so reads and writes route. Call close (e.g. in a finally) when done; otherwise structured concurrency will wait forever on those background coroutines.
Properties
The MockBluetoothClient exposing the connected device.
The MockDeviceConnectionManager driving the connected device. Use it (or pump) to complete queued actions.
The Identifier of the connected device.
The discovered RemoteServices of the connected device.
Functions
Returns the MockCharacteristicWrapper for the characteristic with the given characteristic uuid on the service with the given service uuid. Use it to set the value a read will return or to inspect what a write recorded.
Pumps the currently queued com.splendo.kaluga.bluetooth.device.DeviceAction so the enqueued read/write completes. Equivalent to connectionManager.handleCurrentAction().