DeviceImpl

class DeviceImpl(val identifier: Identifier, initialDeviceInfo: DeviceInfoImpl, connectionSettings: ConnectionSettings, connectionManagerBuilder: (ConnectionSettings) -> DeviceConnectionManager, coroutineScope: CoroutineScope, createDeviceStateFlow: (DeviceConnectionManager, CoroutineContext) -> ConnectableDeviceStateFlowRepo = { connectionManager, context -> ConnectableDeviceStateImplRepo(connectionSettings.reconnectionSettings, connectionManager, context) }) : Device, CoroutineScope

Implementation of Device

Parameters

identifier

The Identifier of the device

initialDeviceInfo

the initial DeviceInfoImpl known about the device

connectionSettings

the ConnectionSettings to apply to the DeviceConnectionManager associated with this device

connectionManagerBuilder

creates a DeviceConnectionManager to manage connecting this device

coroutineScope

the CoroutineScope this device is running on]

createDeviceStateFlow

creates a ConnectableDeviceStateFlowRepo to manage the device connection state

Constructors

Link copied to clipboard
constructor(identifier: Identifier, initialDeviceInfo: DeviceInfoImpl, connectionSettings: ConnectionSettings, connectionManagerBuilder: (ConnectionSettings) -> DeviceConnectionManager, coroutineScope: CoroutineScope, createDeviceStateFlow: (DeviceConnectionManager, CoroutineContext) -> ConnectableDeviceStateFlowRepo = { connectionManager, context -> ConnectableDeviceStateImplRepo(connectionSettings.reconnectionSettings, connectionManager, context) })

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
open override val identifier: Identifier
Link copied to clipboard
open override val info: Flow<DeviceInfo>

A Flow of the latest DeviceInfo of the device

Link copied to clipboard
open override val state: Flow<DeviceState>

A Flow of the latest DeviceState of the device

Functions

Link copied to clipboard
open override 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
open override fun handleConnected()

Notifies the device that is has connected

Link copied to clipboard
open override fun handleDisconnected()

Notifies the device that is has disconnected

Link copied to clipboard
open override fun rssiDidUpdate(rssi: RSSI)

Notifies the device that the RSSI has updated