mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2025-01-26 09:37:33 +01:00
Set low latency mode during initialization #249
This appears to fix the initialization getting stuck sometimes, e.g. after turning on bluetooth and then connecting. The band incidentally sends 0x8 when it's stuck (won't accept the UUID_PAIR request).
This commit is contained in:
parent
1348bad4d3
commit
11ac01f0e8
@ -97,6 +97,7 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
|
|||||||
protected TransactionBuilder initializeDevice(TransactionBuilder builder) {
|
protected TransactionBuilder initializeDevice(TransactionBuilder builder) {
|
||||||
builder.add(new SetDeviceStateAction(getDevice(), State.INITIALIZING, getContext()));
|
builder.add(new SetDeviceStateAction(getDevice(), State.INITIALIZING, getContext()));
|
||||||
enableNotifications(builder, true)
|
enableNotifications(builder, true)
|
||||||
|
.setLowLatency(builder)
|
||||||
.pair(builder)
|
.pair(builder)
|
||||||
.requestDeviceInfo(builder)
|
.requestDeviceInfo(builder)
|
||||||
.sendUserInfo(builder)
|
.sendUserInfo(builder)
|
||||||
@ -106,10 +107,21 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
|
|||||||
.enableFurtherNotifications(builder, true)
|
.enableFurtherNotifications(builder, true)
|
||||||
.setCurrentTime(builder)
|
.setCurrentTime(builder)
|
||||||
.requestBatteryInfo(builder)
|
.requestBatteryInfo(builder)
|
||||||
|
.setHighLatency(builder)
|
||||||
.setInitialized(builder);
|
.setInitialized(builder);
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private MiBandSupport setLowLatency(TransactionBuilder builder) {
|
||||||
|
builder.write(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_LE_PARAMS), getLowLatency());
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
private MiBandSupport setHighLatency(TransactionBuilder builder) {
|
||||||
|
builder.write(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_LE_PARAMS), getHighLatency());
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
private MiBandSupport checkAuthenticationNeeded(TransactionBuilder builder, GBDevice device) {
|
private MiBandSupport checkAuthenticationNeeded(TransactionBuilder builder, GBDevice device) {
|
||||||
builder.add(new CheckAuthenticationNeededAction(device));
|
builder.add(new CheckAuthenticationNeededAction(device));
|
||||||
return this;
|
return this;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user