class DevicePairingManager
This class handles all known devices and the pairing with the app. It provides methods to pair and unpair. For concurrent actions it will do last action wins, but will sort out duplicates. It will also store devices that are currently paired throughout relaunch of the application to disconnect died devices.
pairAsync() pairAsync() unpairAsync() pairAsync() will pair once, unpair once and pair again. After all the device is paired.
PairableDevice |
Represents one device with its state. inner class PairableDevice |
<init> |
This class handles all known devices and the pairing with the app. It provides methods to pair and unpair. For concurrent actions it will do last action wins, but will sort out duplicates. It will also store devices that are currently paired throughout relaunch of the application to disconnect died devices. DevicePairingManager(context: Context) |
protocolLog |
val protocolLog: String |
getPairedAddresses |
Returns currently paired device addresses. fun getPairedAddresses(): List<BluetoothDeviceMacAddress> |
pairAsync |
Pairs the bluetooth device with the given address asynchronously. Will unpair first if previous pair was not successful. Will remember that the device was paired by this application. fun pairAsync(: BluetoothDeviceMacAddress, : ((Unit) -> Unit)? = null): Task<Unit> |
unpairAsync |
Unpairs the bluetooth device with the given address asynchronously. Will remove the device from devices known to this application. fun unpairAsync(: BluetoothDeviceMacAddress): Task<Unit> |
AFTER_OPERATION_DELAY |
val AFTER_OPERATION_DELAY: TimeSpan |
CHECK_PAIRED_DELAY |
val CHECK_PAIRED_DELAY: TimeSpan |
MAX_LOGS_TO_STORE |
const val MAX_LOGS_TO_STORE: Int |
PAIRED_DEVICES_KEY |
const val PAIRED_DEVICES_KEY: String |
PAIRING_TIMEOUT |
val PAIRING_TIMEOUT: TimeSpan |
TAG |
val TAG: String |