ConnectableDevice

A Device that can be connected to

Inheritors

Properties

Link copied to clipboard
abstract val identifier: Identifier
Link copied to clipboard
abstract val info: StateFlow<DeviceInfo>

A StateFlow of the latest DeviceInfo of the device

Link copied to clipboard
abstract val state: Flow<DeviceState>

A Flow of the latest DeviceState of the device

Functions

Link copied to clipboard
abstract fun advertisementDataDidUpdate(advertisementData: BaseAdvertisementData)

Notifies the device that the BaseAdvertisementData has updated

Link copied to clipboard
open suspend fun connect(reconnectionSettings: ConnectionSettings.ReconnectionSettings? = null): Boolean

Attempts to connect to the device

Link copied to clipboard
open suspend fun disconnect()

Attempts to disconnect from the device

Link copied to clipboard

Gets a (Flow of) the list of Service associated with the ConnectableDevice This will automatically discover services if the device is in a ConnectableDeviceState.Connected.NoServices state. This differs from services in that the resulting flow will only emit once services are discovered.

Link copied to clipboard
fun ConnectableDevice.distance(environmentalFactor: Double = 2.0, averageOver: Int = 5): Flow<Double>

Gets the (Flow of) the distance in meters between the scanner and a ConnectableDevice. To get a more stable result, this method will average the distance over the last averageOver results.

Link copied to clipboard
Link copied to clipboard
abstract fun handleConnected()

Notifies the device that is has connected

Link copied to clipboard
abstract fun handleDisconnected()

Notifies the device that is has disconnected

Link copied to clipboard
fun ConnectableDevice.mtu(): Flow<Int?>

Gets the (Flow of) the MTU from a ConnectableDevice

Link copied to clipboard

Attempts to request a MTU size for the ConnectableDevice from a ConnectableDevice

Link copied to clipboard
abstract fun rssiDidUpdate(rssi: RSSI)

Notifies the device that the RSSI has updated

Link copied to clipboard

Gets a (Flow of) the list of Service associated with the ConnectableDevice This will automatically discover services if the device is in a ConnectableDeviceState.Connected.NoServices state.

Link copied to clipboard

Attempts to request an update to the RSSI of the ConnectableDevice from a ConnectableDevice When this method completes, the devices should have had ConnectableDeviceState.Connected.readRssi called