mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-10 17:11:56 +01:00
Xiaomi: Fix reconnect if characteristics are null
If a service was found, but characteristics are null, maybe we're just connecting too early - set the device to reconnect.
This commit is contained in:
parent
4de7cb3591
commit
7f7834c620
@ -118,13 +118,17 @@ public class XiaomiSupport extends AbstractBTLEDeviceSupport {
|
||||
BluetoothGattCharacteristic btCharacteristicCommandWrite = null;
|
||||
BluetoothGattCharacteristic btCharacteristicActivityData = null;
|
||||
BluetoothGattCharacteristic btCharacteristicDataUpload = null;
|
||||
|
||||
// Attempt to find a known xiaomi service
|
||||
for (Map.Entry<UUID, XiaomiBleUuids.XiaomiBleUuidSet> xiaomiUuid : XiaomiBleUuids.UUIDS.entrySet()) {
|
||||
if (getSupportedServices().contains(xiaomiUuid.getKey())) {
|
||||
LOG.debug("Found Xiaomi service: {}", xiaomiUuid.getKey());
|
||||
btCharacteristicCommandRead = getCharacteristic(xiaomiUuid.getValue().getCharacteristicCommandRead());
|
||||
btCharacteristicCommandWrite = getCharacteristic(xiaomiUuid.getValue().getCharacteristicCommandWrite());
|
||||
btCharacteristicActivityData = getCharacteristic(xiaomiUuid.getValue().getCharacteristicActivityData());
|
||||
btCharacteristicDataUpload = getCharacteristic(xiaomiUuid.getValue().getCharacteristicDataUpload());
|
||||
uuidSet = xiaomiUuid.getValue();
|
||||
|
||||
btCharacteristicCommandRead = getCharacteristic(uuidSet.getCharacteristicCommandRead());
|
||||
btCharacteristicCommandWrite = getCharacteristic(uuidSet.getCharacteristicCommandWrite());
|
||||
btCharacteristicActivityData = getCharacteristic(uuidSet.getCharacteristicActivityData());
|
||||
btCharacteristicDataUpload = getCharacteristic(uuidSet.getCharacteristicDataUpload());
|
||||
if (btCharacteristicCommandRead == null) {
|
||||
LOG.warn("btCharacteristicCommandRead characteristicc is null");
|
||||
continue;
|
||||
@ -139,7 +143,6 @@ public class XiaomiSupport extends AbstractBTLEDeviceSupport {
|
||||
continue;
|
||||
}
|
||||
|
||||
uuidSet = xiaomiUuid.getValue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user