From cb3be26349d3452c9f72b7c49174bed55b80c7ae Mon Sep 17 00:00:00 2001 From: Daniele Gobbetti Date: Tue, 16 Jun 2015 17:03:35 +0200 Subject: [PATCH] Do something when we receive a CharacteristicChanged message on the UUID_CHARACTERISTIC_BATTERY characteristic. This is a first try at addressing #71 Please note that this will probably not work at this point, but it's worth a try. To make it work probably we have to tell the device to send updates, and we don't know how to do it. --- .../freeyourgadget/gadgetbridge/miband/MiBandSupport.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/miband/MiBandSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/miband/MiBandSupport.java index 979caa045..89a6c7e62 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/miband/MiBandSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/miband/MiBandSupport.java @@ -415,7 +415,9 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport { UUID characteristicUUID = characteristic.getUuid(); if (MiBandService.UUID_CHARACTERISTIC_ACTIVITY_DATA.equals(characteristicUUID)) { handleActivityNotif(characteristic.getValue()); - } + } else if (MiBandService.UUID_CHARACTERISTIC_BATTERY.equals(characteristicUUID)) { + handleBatteryInfo(characteristic.getValue(), BluetoothGatt.GATT_SUCCESS); + } } @Override @@ -641,4 +643,4 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport { protected TransactionBuilder createTransactionBuilder(String taskName) { return new MiBandTransactionBuilder(taskName); } -} \ No newline at end of file +}