From 89eddb13b025f4ace7e9e0dc7ad39f02b1309963 Mon Sep 17 00:00:00 2001 From: cpfeiffer Date: Thu, 24 Mar 2016 22:10:23 +0100 Subject: [PATCH] Fixed connection issues by reading the date from the band #249 --- .../gadgetbridge/service/devices/miband/MiBandSupport.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband/MiBandSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband/MiBandSupport.java index b789938a..81f44548 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband/MiBandSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband/MiBandSupport.java @@ -98,6 +98,7 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport { builder.add(new SetDeviceStateAction(getDevice(), State.INITIALIZING, getContext())); enableNotifications(builder, true) .setLowLatency(builder) + .readDate(builder) // without reading the data, we get sporadic connection problems, especially directly after turning on BT .pair(builder) .requestDeviceInfo(builder) .sendUserInfo(builder) @@ -112,6 +113,11 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport { return builder; } + private MiBandSupport readDate(TransactionBuilder builder) { + builder.read(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_DATE_TIME)); + return this; + } + public MiBandSupport setLowLatency(TransactionBuilder builder) { builder.write(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_LE_PARAMS), getLowLatency()); return this;