BluetoothService

A service for managing Bluetooth Device

Inheritors

Types

Link copied to clipboard

Specifies the behaviour of cleaning up the list of Device discovered by a BluetoothService

Properties

Link copied to clipboard
abstract val isEnabled: Flow<Boolean>

A Flow that indicates whether Bluetooth is currently enabled. When false, Bluetooth might be unavailable or permissions may be missing.

Functions

Link copied to clipboard
abstract fun allDevices(): Flow<List<Device>>

Gets a Flow containing a list of all Device scanned by the service. Requires that startScanning has been called, otherwise no devices will be found

Link copied to clipboard
abstract fun devices(): Flow<List<Device>>

Gets a Flow containing a list of all Device scanned by the service for the last Filter passed to startScanning. Requires that startScanning has been called with filter, otherwise no devices will be found

Link copied to clipboard
abstract suspend fun isScanning(): Flow<Boolean>

Gets a Flow that indicates whether the service is actively scanning for Device

Link copied to clipboard
abstract fun pairedDevices(filter: Filter, removeForAllPairedFilters: Boolean = true, connectionSettings: ConnectionSettings? = null): Flow<List<Device>>

Gets a Flow of the list of Device that have been paired to the system

Link copied to clipboard
abstract fun scannedDevices(filter: Filter = emptySet()): Flow<List<Device>>

Gets a Flow containing a list of all Device scanned by the service for a given Filter. Requires that startScanning has been called with filter, otherwise no devices will be found

Link copied to clipboard
abstract fun startScanning(filter: Filter = emptySet(), cleanMode: BluetoothService.CleanMode = CleanMode.REMOVE_ALL, connectionSettings: ConnectionSettings? = null)

Starts scanning for Device. To receive the devices, use scannedDevices or allDevices

Link copied to clipboard
abstract fun stopScanning(cleanMode: BluetoothService.CleanMode = CleanMode.REMOVE_ALL)

Stops scanning for Device