mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-29 05:16:51 +01:00
Mi Band 8: Save number of pending alarm acks (wip)
This commit is contained in:
parent
29fe3bc6ae
commit
18fc29fae7
@ -75,6 +75,8 @@ public class XiaomiScheduleService extends AbstractXiaomiService {
|
||||
// Map of alarm position to Alarm, as returned by the band
|
||||
private final Map<Integer, Alarm> watchAlarms = new HashMap<>();
|
||||
|
||||
private int pendingAlarmAcks = 0;
|
||||
|
||||
public XiaomiScheduleService(final XiaomiSupport support) {
|
||||
super(support);
|
||||
}
|
||||
@ -85,6 +87,14 @@ public class XiaomiScheduleService extends AbstractXiaomiService {
|
||||
case CMD_ALARMS_GET:
|
||||
handleAlarms(cmd.getSchedule().getAlarms());
|
||||
break;
|
||||
case CMD_ALARMS_CREATE:
|
||||
pendingAlarmAcks--;
|
||||
if (pendingAlarmAcks <= 0) {
|
||||
final TransactionBuilder builder = getSupport().createTransactionBuilder("request alarms after all acks");
|
||||
requestAlarms(builder);
|
||||
builder.queue(getSupport().getQueue());
|
||||
}
|
||||
break;
|
||||
case CMD_WORLD_CLOCKS_GET:
|
||||
handleWorldClocks(cmd.getSchedule().getWorldClocks());
|
||||
break;
|
||||
@ -208,6 +218,7 @@ public class XiaomiScheduleService extends AbstractXiaomiService {
|
||||
.build()
|
||||
);
|
||||
} else {
|
||||
pendingAlarmAcks++;
|
||||
schedule.setCreateAlarm(alarmDetails);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user