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 btCharacteristicCommandWrite = null;
|
||||||
BluetoothGattCharacteristic btCharacteristicActivityData = null;
|
BluetoothGattCharacteristic btCharacteristicActivityData = null;
|
||||||
BluetoothGattCharacteristic btCharacteristicDataUpload = null;
|
BluetoothGattCharacteristic btCharacteristicDataUpload = null;
|
||||||
|
|
||||||
|
// Attempt to find a known xiaomi service
|
||||||
for (Map.Entry<UUID, XiaomiBleUuids.XiaomiBleUuidSet> xiaomiUuid : XiaomiBleUuids.UUIDS.entrySet()) {
|
for (Map.Entry<UUID, XiaomiBleUuids.XiaomiBleUuidSet> xiaomiUuid : XiaomiBleUuids.UUIDS.entrySet()) {
|
||||||
if (getSupportedServices().contains(xiaomiUuid.getKey())) {
|
if (getSupportedServices().contains(xiaomiUuid.getKey())) {
|
||||||
LOG.debug("Found Xiaomi service: {}", xiaomiUuid.getKey());
|
LOG.debug("Found Xiaomi service: {}", xiaomiUuid.getKey());
|
||||||
btCharacteristicCommandRead = getCharacteristic(xiaomiUuid.getValue().getCharacteristicCommandRead());
|
uuidSet = xiaomiUuid.getValue();
|
||||||
btCharacteristicCommandWrite = getCharacteristic(xiaomiUuid.getValue().getCharacteristicCommandWrite());
|
|
||||||
btCharacteristicActivityData = getCharacteristic(xiaomiUuid.getValue().getCharacteristicActivityData());
|
btCharacteristicCommandRead = getCharacteristic(uuidSet.getCharacteristicCommandRead());
|
||||||
btCharacteristicDataUpload = getCharacteristic(xiaomiUuid.getValue().getCharacteristicDataUpload());
|
btCharacteristicCommandWrite = getCharacteristic(uuidSet.getCharacteristicCommandWrite());
|
||||||
|
btCharacteristicActivityData = getCharacteristic(uuidSet.getCharacteristicActivityData());
|
||||||
|
btCharacteristicDataUpload = getCharacteristic(uuidSet.getCharacteristicDataUpload());
|
||||||
if (btCharacteristicCommandRead == null) {
|
if (btCharacteristicCommandRead == null) {
|
||||||
LOG.warn("btCharacteristicCommandRead characteristicc is null");
|
LOG.warn("btCharacteristicCommandRead characteristicc is null");
|
||||||
continue;
|
continue;
|
||||||
@ -139,7 +143,6 @@ public class XiaomiSupport extends AbstractBTLEDeviceSupport {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
uuidSet = xiaomiUuid.getValue();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user