search

@CheckReturnValue
abstract fun search(): Observable<List<SOCommDeviceSearcher.FoundDevice>>

Starts the search for SOComm devices, which is performed using a bluetooth low energy scan.

The scan will be started when subscribing the returned Observable, and will stop when the returned Observable is disposed.

As BLE scans are battery draining, the returned Observable should only be kept active as short as possible, until i.e. the user has selected one of the returned devices.

If the bluetooth scan emitted an error, a ScanFailedException will be emitted.

A set of (runtime) permissions is needed to be granted before calling this method (otherwise a PermissionNotGrantedException will be emitted) depending on the Android SDK level the application is running on:

Furthermore, bluetooth must be activated beforehand. Otherwise, a BluetoothNotEnabledException or BluetoothNotAvailableException will be emitted.

Return

An Observable which will emit live updates of the devices found via BLE. The emitted list will always contain all already found devices (not just newly found ones), and may alter already found devices in the list (especially their rssi and lastScanned values).