1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-11 12:39:26 +01:00

Xiaomi: Fix sleep schedule preference

This commit is contained in:
José Rebelo 2023-12-08 18:53:11 +00:00
parent 6984572d33
commit 961e9f1bf9

View File

@ -105,7 +105,7 @@ public class XiaomiScheduleService extends AbstractXiaomiService {
switch (cmd.getSubtype()) { switch (cmd.getSubtype()) {
case CMD_ALARMS_GET: case CMD_ALARMS_GET:
handleAlarms(cmd.getSchedule().getAlarms()); handleAlarms(cmd.getSchedule().getAlarms());
break; return;
case CMD_ALARMS_CREATE: case CMD_ALARMS_CREATE:
pendingAlarmAcks--; pendingAlarmAcks--;
LOG.debug("Got alarms create ack, remaining {}", pendingAlarmAcks); LOG.debug("Got alarms create ack, remaining {}", pendingAlarmAcks);
@ -113,16 +113,19 @@ public class XiaomiScheduleService extends AbstractXiaomiService {
LOG.debug("Requesting alarms after all acks"); LOG.debug("Requesting alarms after all acks");
requestAlarms(); requestAlarms();
} }
break; return;
case CMD_SLEEP_MODE_SET:
LOG.debug("Got sleep mode set ack, status={}", cmd.getStatus());
return;
case CMD_WORLD_CLOCKS_GET: case CMD_WORLD_CLOCKS_GET:
handleWorldClocks(cmd.getSchedule().getWorldClocks()); handleWorldClocks(cmd.getSchedule().getWorldClocks());
break; return;
case CMD_SLEEP_MODE_GET: case CMD_SLEEP_MODE_GET:
handleSleepModeConfig(cmd.getSchedule().getSleepMode()); handleSleepModeConfig(cmd.getSchedule().getSleepMode());
break; return;
case CMD_REMINDERS_GET: case CMD_REMINDERS_GET:
handleReminders(cmd.getSchedule().getReminders()); handleReminders(cmd.getSchedule().getReminders());
break; return;
case CMD_REMINDERS_CREATE: case CMD_REMINDERS_CREATE:
pendingReminderAcks--; pendingReminderAcks--;
LOG.debug("Got alarms create ack, remaining {}", pendingReminderAcks); LOG.debug("Got alarms create ack, remaining {}", pendingReminderAcks);
@ -130,7 +133,7 @@ public class XiaomiScheduleService extends AbstractXiaomiService {
LOG.debug("Requesting reminders after all acks"); LOG.debug("Requesting reminders after all acks");
requestReminders(); requestReminders();
} }
break; return;
} }
LOG.warn("Unknown schedule command {}", cmd.getSubtype()); LOG.warn("Unknown schedule command {}", cmd.getSubtype());
@ -147,9 +150,9 @@ public class XiaomiScheduleService extends AbstractXiaomiService {
@Override @Override
public boolean onSendConfiguration(final String config, final Prefs prefs) { public boolean onSendConfiguration(final String config, final Prefs prefs) {
switch (config) { switch (config) {
case DeviceSettingsPreferenceConst.PREF_SLEEP_TIME: case DeviceSettingsPreferenceConst.PREF_SLEEP_MODE_SCHEDULE_ENABLED:
case DeviceSettingsPreferenceConst.PREF_SLEEP_TIME_START: case DeviceSettingsPreferenceConst.PREF_SLEEP_MODE_SCHEDULE_START:
case DeviceSettingsPreferenceConst.PREF_SLEEP_TIME_END: case DeviceSettingsPreferenceConst.PREF_SLEEP_MODE_SCHEDULE_END:
setSleepModeConfig(); setSleepModeConfig();
return true; return true;
} }