scan

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

Scans for Bluetooth LE devices.

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

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.

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.