Enable low latency during activity sync
This commit is contained in:
parent
0e435d6d94
commit
e5b0afb916
|
@ -112,12 +112,12 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
private MiBandSupport setLowLatency(TransactionBuilder builder) {
|
public MiBandSupport setLowLatency(TransactionBuilder builder) {
|
||||||
builder.write(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_LE_PARAMS), getLowLatency());
|
builder.write(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_LE_PARAMS), getLowLatency());
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private MiBandSupport setHighLatency(TransactionBuilder builder) {
|
public MiBandSupport setHighLatency(TransactionBuilder builder) {
|
||||||
builder.write(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_LE_PARAMS), getHighLatency());
|
builder.write(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_LE_PARAMS), getHighLatency());
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,7 +147,7 @@ public class FetchActivityOperation extends AbstractMiBandOperation {
|
||||||
// scheduleTaskExecutor = Executors.newScheduledThreadPool(1);
|
// scheduleTaskExecutor = Executors.newScheduledThreadPool(1);
|
||||||
|
|
||||||
TransactionBuilder builder = performInitialized("fetch activity data");
|
TransactionBuilder builder = performInitialized("fetch activity data");
|
||||||
// builder.write(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_LE_PARAMS), getLowLatency());
|
getSupport().setLowLatency(builder);
|
||||||
builder.add(new SetDeviceBusyAction(getDevice(), getContext().getString(R.string.busy_task_fetch_activity_data), getContext()));
|
builder.add(new SetDeviceBusyAction(getDevice(), getContext().getString(R.string.busy_task_fetch_activity_data), getContext()));
|
||||||
builder.write(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_CONTROL_POINT), fetch);
|
builder.write(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_CONTROL_POINT), fetch);
|
||||||
builder.queue(getQueue());
|
builder.queue(getQueue());
|
||||||
|
@ -403,6 +403,7 @@ public class FetchActivityOperation extends AbstractMiBandOperation {
|
||||||
if (prefs.getBoolean(MiBandConst.PREF_MIBAND_DONT_ACK_TRANSFER, false)) {
|
if (prefs.getBoolean(MiBandConst.PREF_MIBAND_DONT_ACK_TRANSFER, false)) {
|
||||||
builder = performInitialized("send acknowledge");
|
builder = performInitialized("send acknowledge");
|
||||||
builder.write(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_CONTROL_POINT), new byte[]{MiBandService.COMMAND_STOP_SYNC_DATA});
|
builder.write(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_CONTROL_POINT), new byte[]{MiBandService.COMMAND_STOP_SYNC_DATA});
|
||||||
|
getSupport().setHighLatency(builder);
|
||||||
builder.queue(getQueue());
|
builder.queue(getQueue());
|
||||||
}
|
}
|
||||||
handleActivityFetchFinish();
|
handleActivityFetchFinish();
|
||||||
|
|
Loading…
Reference in New Issue