AndroidBleConnection

class AndroidBleConnection(centralManager: CentralManager, scope: CoroutineScope, tag: String = "BLE") : BleConnection(source)

An Android implementation of BleConnection using Nordic's CentralManager.

Parameters

centralManager

The Nordic CentralManager to use for connection.

scope

The CoroutineScope in which to monitor connection state.

tag

A tag for logging.

Constructors

Link copied to clipboard
constructor(centralManager: CentralManager, scope: CoroutineScope, tag: String = "BLE")

Properties

Link copied to clipboard
open override val connectionState: SharedFlow<BleConnectionState>

A flow of BleConnectionState changes.

Link copied to clipboard
open override val device: BleDevice?

The currently connected BleDevice, or null if not connected.

Link copied to clipboard
open override val deviceFlow: SharedFlow<BleDevice?>

A flow of the current device.

Functions

Link copied to clipboard
open suspend override fun connect(device: BleDevice)

Connects to the given BleDevice.

Link copied to clipboard
open suspend override fun connectAndAwait(device: BleDevice, timeoutMs: Long, onRegister: suspend () -> Unit = {}): BleConnectionState

Connects to the given BleDevice and waits for a terminal state.

Link copied to clipboard
open suspend override fun disconnect()

Disconnects from the current device.

Link copied to clipboard
open override fun maximumWriteValueLength(writeType: BleWriteType): Int?

Returns the maximum write value length for the given write type.

Link copied to clipboard
open suspend override fun <T> profile(serviceUuid: Uuid, timeout: Duration, setup: suspend CoroutineScope.(BleService) -> T): T

abstract suspend fun <T> profile(serviceUuid: ERROR CLASS: Symbol not found for Uuid, timeout: ERROR CLASS: Symbol not found for Duration = 30.seconds, setup: suspend ERROR CLASS: Symbol not found for CoroutineScope.(BleService) -> T): T

Executes a block within a discovered profile.

Link copied to clipboard
suspend fun requestConnectionPriority(priority: ConnectionPriority)

Requests a new connection priority for the current peripheral.