mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-09 03:37:03 +01:00
Huawei: Event alarms fix
Should fix event alarms for the Huawei MagicWatch 2 (#3877).
This commit is contained in:
parent
0946fc408b
commit
d7490639af
@ -29,18 +29,25 @@ public class Alarms {
|
|||||||
|
|
||||||
public static class EventAlarm {
|
public static class EventAlarm {
|
||||||
public byte index;
|
public byte index;
|
||||||
public boolean status;
|
public boolean status = false;
|
||||||
public byte startHour;
|
public byte startHour = -1;
|
||||||
public byte startMinute;
|
public byte startMinute = -1;
|
||||||
public byte repeat;
|
public byte repeat = 0;
|
||||||
public String name;
|
public String name = "Alarm";
|
||||||
|
|
||||||
public EventAlarm(HuaweiTLV tlv) throws ParseException {
|
public EventAlarm(HuaweiTLV tlv) throws ParseException {
|
||||||
this.index = tlv.getByte(0x03);
|
this.index = tlv.getByte(0x03);
|
||||||
|
if (tlv.contains(0x04))
|
||||||
this.status = tlv.getBoolean(0x04);
|
this.status = tlv.getBoolean(0x04);
|
||||||
|
if (this.status || tlv.contains(0x05)) {
|
||||||
|
// I think we should refuse to set the alarm to a default time if it's enabled.
|
||||||
|
// If it is enabled, it should have the time set.
|
||||||
this.startHour = (byte) ((tlv.getShort(0x05) >> 8) & 0xFF);
|
this.startHour = (byte) ((tlv.getShort(0x05) >> 8) & 0xFF);
|
||||||
this.startMinute = (byte) (tlv.getShort(0x05) & 0xFF);
|
this.startMinute = (byte) (tlv.getShort(0x05) & 0xFF);
|
||||||
|
}
|
||||||
|
if (tlv.contains(0x06))
|
||||||
this.repeat = tlv.getByte(0x06);
|
this.repeat = tlv.getByte(0x06);
|
||||||
|
if (tlv.contains(0x07))
|
||||||
this.name = tlv.getString(0x07);
|
this.name = tlv.getString(0x07);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user