update ble scan GUI if bond state changes

This commit is contained in:
geeksville 2020-03-30 16:45:09 -07:00
parent 81a1283148
commit f1681582ed

View file

@ -89,11 +89,13 @@ fun BTScanScreen() {
val addr = result.device.address
// prevent logspam because weill get get lots of redundant scan results
if (!ScanUIState.devices.contains(addr)) {
val isBonded = result.device.bondState == BluetoothDevice.BOND_BONDED
val oldEntry = ScanUIState.devices[addr]
if (oldEntry == null || oldEntry.bonded != isBonded) {
val entry = BTScanEntry(
result.device.name,
addr,
result.device.bondState == BluetoothDevice.BOND_BONDED
isBonded
)
ScanState.debug("onScanResult ${entry}")
ScanUIState.devices[addr] = entry