scan

open override fun scan(timeout: Duration, filter: ConjunctionFilterScope.() -> Unit): Flow<ScanResult>

Scans for Bluetooth LE devices using default scan options.

The scan will be stopped after the given period of time or when the flow is canceled.

Parameters

timeout

The scan duration. By default, the scan will run until the flow is closed.

filter

The filter to apply. By default, no filter is applied.

See also

Throws

If the central manager has been closed.

If Bluetooth is disabled or not available.

If the permission to scan is denied.

If an error occurred while starting the scan.


abstract fun scan(timeout: Duration = Duration.INFINITE, options: CentralManager.ScanOptions, filter: ConjunctionFilterScope.() -> Unit = {}): Flow<ScanResult>

Scans for Bluetooth LE devices.

The scan will be stopped after the given period of time or when the flow is canceled.

Parameters

timeout

The scan duration. By default, the scan will run until the flow is closed.

options

Scan options, e.g. the scan mode.

filter

The filter to apply. By default, no filter is applied.

Throws

If the central manager has been closed.

If Bluetooth is disabled or not available.

If the permission to scan is denied.

If an error occurred while starting the scan.