BaseDeviceConnectionManager

abstract class BaseDeviceConnectionManager(deviceWrapper: DeviceWrapper, settings: ConnectionSettings, coroutineScope: CoroutineScope) : DeviceConnectionManager, CoroutineScope

A DeviceConnectionManager using a DeviceWrapper

Parameters

deviceWrapper

the DeviceWrapper wrapping the Device

settings

the ConnectionSettings to apply for connecting

coroutineScope

the CoroutineScope on which the device should be managed

Constructors

Link copied to clipboard
constructor(deviceWrapper: DeviceWrapper, settings: ConnectionSettings, coroutineScope: CoroutineScope)

Properties

Link copied to clipboard
Link copied to clipboard
open override val events: Flow<DeviceConnectionManager.Event>

A Flow of all the Event detected by the connection manager

Link copied to clipboard
open override val rssi: SharedFlow<RSSI>

A Flow of the RSSI value of the device

Functions

Link copied to clipboard
override fun cancelConnecting()

Fires an Event.CancelledConnecting

Link copied to clipboard
abstract fun connect()

Starts connecting to the device

Link copied to clipboard
abstract fun disconnect()

Starts disconnecting from the device

Link copied to clipboard
abstract suspend fun discoverServices()

Starts discovering Service for the device

Link copied to clipboard

Gets the current State of the device

Link copied to clipboard
override fun handleConnect()

Fires an Event.Connected

Link copied to clipboard
override fun handleDisconnect(onDisconnect: suspend () -> Unit?)

Fires an Event.Disconnected

Link copied to clipboard
suspend override fun pair()

Pairs the device

Link copied to clipboard
suspend override fun performAction(action: DeviceAction)

Starts performing a DeviceAction

Link copied to clipboard
open suspend override fun readRssi()

Starts reading the latest RSSI value of the device

Link copied to clipboard
abstract suspend fun requestMtu(mtu: MTU): Boolean

Requests an update to the MTU size of the device

Link copied to clipboard
open suspend override fun reset()

Resets all actions and disconnects the device

Link copied to clipboard
override fun startConnecting(reconnectionSettings: ConnectionSettings.ReconnectionSettings?)

Fires an Event.Connecting

Link copied to clipboard
override fun startDisconnecting()

Fires an Event.Disconnecting

Link copied to clipboard
override fun startDiscovering()

Fires an Event.Discovering

Link copied to clipboard
suspend override fun unpair()

Unpairs from the device