1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-09 03:37:03 +01:00

Xiaomi Protobuf: Fix logging of found service

getSupportedServices is actually set by us, so it will include all known
services, not the ones that the device supports.
This commit is contained in:
José Rebelo 2024-07-27 15:12:26 +01:00
parent 16b293fdb1
commit 9d3632d505

View File

@ -77,37 +77,34 @@ public class XiaomiBleSupport extends XiaomiConnectionSupport {
// Attempt to find a known xiaomi service
for (Map.Entry<UUID, XiaomiUuids.XiaomiBleUuidSet> xiaomiUuid : XiaomiUuids.BLE_UUIDS.entrySet()) {
if (getSupportedServices().contains(xiaomiUuid.getKey())) {
LOG.debug("Found Xiaomi service: {}", xiaomiUuid.getKey());
uuidSet = xiaomiUuid.getValue();
UUID currentChar;
final XiaomiUuids.XiaomiBleUuidSet currentUuidSet = xiaomiUuid.getValue();
UUID currentChar;
if ((currentChar = uuidSet.getCharacteristicCommandRead()) == null ||
(btCharacteristicCommandRead = getCharacteristic(currentChar)) == null) {
LOG.warn("btCharacteristicCommandRead characteristicc is null");
continue;
}
if ((currentChar = uuidSet.getCharacteristicCommandWrite()) == null ||
(btCharacteristicCommandWrite = getCharacteristic(currentChar)) == null) {
LOG.warn("btCharacteristicCommandWrite characteristicc is null");
continue;
}
if ((currentChar = uuidSet.getCharacteristicActivityData()) == null ||
(btCharacteristicActivityData= getCharacteristic(currentChar)) == null) {
LOG.warn("btCharacteristicActivityData characteristicc is null");
continue;
}
if ((currentChar = uuidSet.getCharacteristicDataUpload()) == null ||
(btCharacteristicDataUpload= getCharacteristic(currentChar)) == null) {
LOG.warn("btCharacteristicDataUpload characteristicc is null");
// this characteristic may not be supported by all models
}
break;
if ((currentChar = currentUuidSet.getCharacteristicCommandRead()) == null ||
(btCharacteristicCommandRead = getCharacteristic(currentChar)) == null) {
continue;
}
if ((currentChar = currentUuidSet.getCharacteristicCommandWrite()) == null ||
(btCharacteristicCommandWrite = getCharacteristic(currentChar)) == null) {
continue;
}
if ((currentChar = currentUuidSet.getCharacteristicActivityData()) == null ||
(btCharacteristicActivityData = getCharacteristic(currentChar)) == null) {
continue;
}
if ((currentChar = currentUuidSet.getCharacteristicDataUpload()) == null ||
(btCharacteristicDataUpload= getCharacteristic(currentChar)) == null) {
LOG.warn("btCharacteristicDataUpload characteristic is null");
// this characteristic may not be supported by all models
}
LOG.debug("Found Xiaomi service: {}", xiaomiUuid.getKey());
uuidSet = xiaomiUuid.getValue();
break;
}
if (uuidSet == null) {