1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-23 18:36:50 +01:00

Fixed connection issues by reading the date from the band #249

This commit is contained in:
cpfeiffer 2016-03-24 22:10:23 +01:00
parent e5b0afb916
commit 89eddb13b0

View File

@ -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;