mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-27 20:36:51 +01:00
fixed alarm repetition
This commit is contained in:
parent
81aa66c2d4
commit
0a7639877b
@ -156,14 +156,21 @@ public final class MakibesHR3Constants {
|
||||
|
||||
|
||||
public static final byte ARG_SET_ALARM_REMINDER_REPEAT_WEEKDAY = (byte) 0x1F;
|
||||
public static final byte ARG_SET_ALARM_REMINDER_REPEAT_CUSTOM = (byte) 0x40;
|
||||
public static final byte ARG_SET_ALARM_REMINDER_REPEAT_EVERY_DAY = (byte) 0x7F;
|
||||
public static final byte ARG_SET_ALARM_REMINDER_REPEAT_ONE_TIME = (byte) 0x80;
|
||||
public static final byte ARG_SET_ALARM_REMINDER_REPEAT_MONDAY = (byte) 0x01;
|
||||
public static final byte ARG_SET_ALARM_REMINDER_REPEAT_TUESDAY = (byte) 0x02;
|
||||
public static final byte ARG_SET_ALARM_REMINDER_REPEAT_WEDNESDAY = (byte) 0x04;
|
||||
public static final byte ARG_SET_ALARM_REMINDER_REPEAT_THURSDAY = (byte) 0x08;
|
||||
public static final byte ARG_SET_ALARM_REMINDER_REPEAT_FRIDAY = (byte) 0x10;
|
||||
public static final byte ARG_SET_ALARM_REMINDER_REPEAT_SATURDAY = (byte) 0x20;
|
||||
public static final byte ARG_SET_ALARM_REMINDER_REPEAT_SUNDAY = (byte) 0x40;
|
||||
|
||||
// reminder id starting at 0
|
||||
// enable (00/01)
|
||||
// hour
|
||||
// minute
|
||||
// ARG_SET_ALARM_REMINDER_REPEAT_*
|
||||
// bit field of ARG_SET_ALARM_REMINDER_REPEAT_*
|
||||
public static final byte CMD_SET_ALARM_REMINDER = (byte) 0x73;
|
||||
|
||||
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
// TODO: Battery level
|
||||
|
||||
// TODO: ALARM REMINDER REPETITION
|
||||
|
||||
// TODO: It'd be cool if we could change the language. There's no official way to do so, but the
|
||||
// TODO: watch is sold as chinese/english.
|
||||
|
||||
@ -161,6 +159,34 @@ public class MakibesHR3DeviceSupport extends AbstractBTLEDeviceSupport implement
|
||||
for (int i = 0; i < alarms.size(); ++i) {
|
||||
Alarm alarm = alarms.get(i);
|
||||
|
||||
byte repetition = 0x00;
|
||||
|
||||
switch (alarm.getRepetition()) {
|
||||
case Alarm.ALARM_ONCE:
|
||||
repetition = MakibesHR3Constants.ARG_SET_ALARM_REMINDER_REPEAT_ONE_TIME;
|
||||
break;
|
||||
|
||||
case Alarm.ALARM_MON:
|
||||
repetition |= MakibesHR3Constants.ARG_SET_ALARM_REMINDER_REPEAT_MONDAY;
|
||||
case Alarm.ALARM_TUE:
|
||||
repetition |= MakibesHR3Constants.ARG_SET_ALARM_REMINDER_REPEAT_TUESDAY;
|
||||
case Alarm.ALARM_WED:
|
||||
repetition |= MakibesHR3Constants.ARG_SET_ALARM_REMINDER_REPEAT_WEDNESDAY;
|
||||
case Alarm.ALARM_THU:
|
||||
repetition |= MakibesHR3Constants.ARG_SET_ALARM_REMINDER_REPEAT_THURSDAY;
|
||||
case Alarm.ALARM_FRI:
|
||||
repetition |= MakibesHR3Constants.ARG_SET_ALARM_REMINDER_REPEAT_FRIDAY;
|
||||
case Alarm.ALARM_SAT:
|
||||
repetition |= MakibesHR3Constants.ARG_SET_ALARM_REMINDER_REPEAT_SATURDAY;
|
||||
case Alarm.ALARM_SUN:
|
||||
repetition |= MakibesHR3Constants.ARG_SET_ALARM_REMINDER_REPEAT_SUNDAY;
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG.warn("invalid alarm repetition " + alarm.getRepetition());
|
||||
break;
|
||||
}
|
||||
|
||||
// Should we use @alarm.getPosition() rather than @i?
|
||||
this.setAlarmReminder(
|
||||
transactionBuilder,
|
||||
@ -168,7 +194,7 @@ public class MakibesHR3DeviceSupport extends AbstractBTLEDeviceSupport implement
|
||||
alarm.getEnabled(),
|
||||
alarm.getHour(),
|
||||
alarm.getMinute(),
|
||||
MakibesHR3Constants.ARG_SET_ALARM_REMINDER_REPEAT_CUSTOM);
|
||||
repetition);
|
||||
}
|
||||
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user