CentralManagerImpl

abstract class CentralManagerImpl<ID : Any, P : Peripheral<ID, EX>, EX : Peripheral.Executor<ID>, F : CentralManager.ScanFilterScope, SR : ScanResult<*, *>>(scope: CoroutineScope) : CentralManager<ID, P, EX, F, SR>

Base implementation of CentralManager.

Parameters

ID

The type of the peripheral identifier.

P

The type of the peripheral.

EX

The type of the peripheral executor.

F

The type of the scan filter scope.

SR

Scan result type.

Constructors

Link copied to clipboard
constructor(scope: CoroutineScope)

Properties

Link copied to clipboard
abstract val state: StateFlow<Manager.State>

Functions

Link copied to clipboard
open override fun close()

Closes the manager and releases its resources.

Link copied to clipboard
abstract suspend fun connect(peripheral: P)

Connects to the given device.

Link copied to clipboard
open fun getPeripheralById(id: ID): P?

A peripheral that the central manager is able to match to the provided identifier.

Link copied to clipboard
abstract fun getPeripheralsById(ids: List<ID>): List<P>

A list of peripherals that the central manager is able to match to the provided identifiers.

Link copied to clipboard
abstract fun monitor(timeout: Duration = Duration.INFINITE, filter: F.() -> Unit): Flow<MonitoringEvent<P>>

Starts monitoring for Bluetooth LE devices.

Link copied to clipboard
abstract fun range(peripheral: P, timeout: Duration = Duration.INFINITE): Flow<RangeEvent<P>>

Starts ranging for Bluetooth LE devices.

Link copied to clipboard
abstract fun scan(timeout: Duration = Duration.INFINITE, filter: F.() -> Unit = {}): Flow<SR>

Scans for Bluetooth LE devices.