CentralManager

A central manager is responsible for scanning, monitoring and connecting to Bluetooth LE devices.

Parameters

ID

The type of the peripheral identifier.

P

The type of the peripheral.

F

The type of the scan filter scope.

SR

Scan result type.

Inheritors

Types

Link copied to clipboard
interface ScanFilterScope

A base interface for scan filter scope.

Properties

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

Functions

Link copied to clipboard
abstract 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.