CentralManager

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

Type 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.

Types

Link copied to clipboard
interface ScanFilterScope

A base interface for scan filter scope.

Properties

Link copied to clipboard
abstract var logger: Log.Sink<Layer>?
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)

Establishes Bluetooth LE connection to the peripheral using default connection options.

Link copied to clipboard
open fun <C : Log.Category> Log.Sink<C>.d(category: C, throwable: Throwable)
open fun <C : Log.Category> Log.Sink<C>.d(category: C, throwable: Throwable?, message: () -> String)
Link copied to clipboard
open fun <C : Log.Category> Log.Sink<C>.debug(category: C, throwable: Throwable)
open fun <C : Log.Category> Log.Sink<C>.debug(category: C, throwable: Throwable?, message: () -> String)
Link copied to clipboard
open fun <C : Log.Category> Log.Sink<C>.e(category: C, throwable: Throwable)
open fun <C : Log.Category> Log.Sink<C>.e(category: C, throwable: Throwable?, message: () -> String)
Link copied to clipboard
open fun <C : Log.Category> Log.Sink<C>.error(category: C, throwable: Throwable)
open fun <C : Log.Category> Log.Sink<C>.error(category: C, throwable: Throwable?, message: () -> String)
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
open fun <C : Log.Category> Log.Sink<C>.i(category: C, throwable: Throwable)
open fun <C : Log.Category> Log.Sink<C>.i(category: C, throwable: Throwable?, message: () -> String)
Link copied to clipboard
open fun <C : Log.Category> Log.Sink<C>.info(category: C, throwable: Throwable)
open fun <C : Log.Category> Log.Sink<C>.info(category: C, throwable: Throwable?, message: () -> String)
Link copied to clipboard
open fun <C : Log.Category> Log.Sink<C>.log(category: C, level: Log.Level, throwable: Throwable)
open fun <C : Log.Category> Log.Sink<C>.log(category: C, level: Log.Level, throwable: Throwable?, message: () -> String)
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
open fun <C : Log.Category> Relay(sink: () -> Log.Sink<C>?): Log.Sink<C>
Link copied to clipboard
abstract fun scan(timeout: Duration = Duration.INFINITE, filter: F.() -> Unit = {}): Flow<SR>

Scans for Bluetooth LE devices.

Link copied to clipboard
open fun <C : Log.Category> Log.Sink<C>.t(category: C, throwable: Throwable)
open fun <C : Log.Category> Log.Sink<C>.t(category: C, throwable: Throwable?, message: () -> String)
Link copied to clipboard
open fun <C : Log.Category> Log.Sink<C>.trace(category: C, throwable: Throwable)
open fun <C : Log.Category> Log.Sink<C>.trace(category: C, throwable: Throwable?, message: () -> String)
Link copied to clipboard
open fun <C : Log.Category> Log.Sink<C>.v(category: C, throwable: Throwable)
open fun <C : Log.Category> Log.Sink<C>.v(category: C, throwable: Throwable?, message: () -> String)
Link copied to clipboard
open fun <C : Log.Category> Log.Sink<C>.verbose(category: C, throwable: Throwable)
open fun <C : Log.Category> Log.Sink<C>.verbose(category: C, throwable: Throwable?, message: () -> String)
Link copied to clipboard
open fun <C : Log.Category> Log.Sink<C>.w(category: C, throwable: Throwable)
open fun <C : Log.Category> Log.Sink<C>.w(category: C, throwable: Throwable?, message: () -> String)
Link copied to clipboard
open fun <C : Log.Category> Log.Sink<C>.warn(category: C, throwable: Throwable)
open fun <C : Log.Category> Log.Sink<C>.warn(category: C, throwable: Throwable?, message: () -> String)