BluetoothClient

interface BluetoothClient

A service for managing Bluetooth ConnectableDevice

Inheritors

Types

Link copied to clipboard

Specifies the behaviour of cleaning up the list of ConnectableDevice discovered by a BluetoothClient

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<ConnectableDevice>>

Gets a Flow containing a list of all ConnectableDevice 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<ConnectableDevice>>

Gets a Flow containing a list of all ConnectableDevice 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 ConnectableDevice

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

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

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

Gets a Flow containing a list of all ConnectableDevice 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: BluetoothClient.CleanMode = CleanMode.REMOVE_ALL, connectionSettings: ConnectionSettings? = null)

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

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

Stops scanning for ConnectableDevice