Mi2: Fix for alarm enablement. Was too late, apparently.
This commit is contained in:
parent
192b8e52ed
commit
3a12ffd42d
|
@ -16,8 +16,8 @@ public class MiBand2Service {
|
|||
public static final UUID UUID_UNKNOWN_CHARACTERISTIC0 = UUID.fromString("00000000-0000-3512-2118-0009af100700");
|
||||
public static final UUID UUID_UNKNOWN_CHARACTERISTIC1 = UUID.fromString("00000001-0000-3512-2118-0009af100700");
|
||||
public static final UUID UUID_UNKNOWN_CHARACTERISTIC2 = UUID.fromString("00000002-0000-3512-2118-0009af100700");
|
||||
public static final UUID UUID_UNKNOWN_CHARACTERISTIC3 = UUID.fromString("00000003-0000-3512-2118-0009af100700");
|
||||
public static final UUID UUID_UNKNOWN_CHARACTERISTIC4 = UUID.fromString("00000004-0000-3512-2118-0009af100700"); // Alarm related
|
||||
public static final UUID UUID_UNKNOWN_CHARACTERISTIC3 = UUID.fromString("00000003-0000-3512-2118-0009af100700"); // Alarm related
|
||||
public static final UUID UUID_UNKNOWN_CHARACTERISTIC4 = UUID.fromString("00000004-0000-3512-2118-0009af100700");
|
||||
public static final UUID UUID_UNKNOWN_CHARACTERISTIC5 = UUID.fromString("00000005-0000-3512-2118-0009af100700");
|
||||
public static final UUID UUID_UNKNOWN_CHARACTERISTIC6 = UUID.fromString("00000006-0000-3512-2118-0009af100700");
|
||||
public static final UUID UUID_UNKNOWN_CHARACTERISTIC7 = UUID.fromString("00000007-0000-3512-2118-0009af100700");
|
||||
|
|
|
@ -1056,33 +1056,15 @@ public class MiBand2Support extends AbstractBTLEDeviceSupport {
|
|||
Calendar calendar = alarm.getAlarmCal();
|
||||
int daysMask = 0;
|
||||
|
||||
if (alarm.getIndex() != 0 && alarm.isEnabled()) {
|
||||
GB.toast(getContext(), "Only the first alarm is currently supported.", Toast.LENGTH_LONG, GB.WARN);
|
||||
if (alarm.getIndex() != 0) {
|
||||
if (alarm.isEnabled()) {
|
||||
GB.toast(getContext(), "Only the first alarm is currently supported.", Toast.LENGTH_LONG, GB.WARN);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (alarm.isEnabled()) {
|
||||
if (alarm.getRepetition(Alarm.ALARM_MON)) {
|
||||
daysMask |= 1;
|
||||
}
|
||||
if (alarm.getRepetition(Alarm.ALARM_TUE)) {
|
||||
daysMask |= 2;
|
||||
}
|
||||
if (alarm.getRepetition(Alarm.ALARM_WED)) {
|
||||
daysMask |= 4;
|
||||
}
|
||||
if (alarm.getRepetition(Alarm.ALARM_THU)) {
|
||||
daysMask |= 8;
|
||||
}
|
||||
if (alarm.getRepetition(Alarm.ALARM_FRI)) {
|
||||
daysMask |= 16;
|
||||
}
|
||||
if (alarm.getRepetition(Alarm.ALARM_SAT)) {
|
||||
daysMask |= 32;
|
||||
}
|
||||
if (alarm.getRepetition(Alarm.ALARM_SUN)) {
|
||||
daysMask |= 64;
|
||||
}
|
||||
daysMask = alarm.getRepetitionMask();
|
||||
}
|
||||
|
||||
byte[] alarmMessage = new byte[] {
|
||||
|
@ -1093,6 +1075,7 @@ public class MiBand2Support extends AbstractBTLEDeviceSupport {
|
|||
(byte) daysMask,
|
||||
};
|
||||
builder.write(characteristic, alarmMessage);
|
||||
// TODO: react on 0x10, 0x02, 0x01 on notification (success)
|
||||
}
|
||||
|
||||
private void handleControlPointResult(byte[] value, int status) {
|
||||
|
|
Loading…
Reference in New Issue