mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-29 13:26:50 +01:00
Add setting alarms. Choose the type of the signaling in the preferences.
This commit is contained in:
parent
ba0fdb8c96
commit
ecfd83ae65
@ -77,6 +77,7 @@ public class ZeTimeConstants {
|
|||||||
public static final byte CMD_PUSH_EX_MSG = (byte) 0x76;
|
public static final byte CMD_PUSH_EX_MSG = (byte) 0x76;
|
||||||
public static final byte CMD_PUSH_WEATHER_DATA = (byte) 0x77;
|
public static final byte CMD_PUSH_WEATHER_DATA = (byte) 0x77;
|
||||||
public static final byte CMD_SWITCH_SETTINGS = (byte) 0x90;
|
public static final byte CMD_SWITCH_SETTINGS = (byte) 0x90;
|
||||||
|
public static final byte CMD_REMINDERS = (byte) 0x97;
|
||||||
public static final byte CMD_PUSH_CALENDAR_DAY = (byte) 0x99;
|
public static final byte CMD_PUSH_CALENDAR_DAY = (byte) 0x99;
|
||||||
public static final byte CMD_MUSIC_CONTROL = (byte) 0xD0;
|
public static final byte CMD_MUSIC_CONTROL = (byte) 0xD0;
|
||||||
// here are the action commands
|
// here are the action commands
|
||||||
@ -109,6 +110,8 @@ public class ZeTimeConstants {
|
|||||||
public static final byte NOTIFICATION_UBER = (byte) 0x13;
|
public static final byte NOTIFICATION_UBER = (byte) 0x13;
|
||||||
public static final byte NOTIFICATION_LINE = (byte) 0x14;
|
public static final byte NOTIFICATION_LINE = (byte) 0x14;
|
||||||
public static final byte NOTIFICATION_SKYPE = (byte) 0x15;
|
public static final byte NOTIFICATION_SKYPE = (byte) 0x15;
|
||||||
|
// reminders types
|
||||||
|
public static final byte REMINDER_ALARM = (byte) 0x04;
|
||||||
// watch settings
|
// watch settings
|
||||||
public static final String PREF_WRIST = "zetime_wrist";
|
public static final String PREF_WRIST = "zetime_wrist";
|
||||||
public static final byte WEAR_ON_LEFT_WRIST = (byte) 0x00;
|
public static final byte WEAR_ON_LEFT_WRIST = (byte) 0x00;
|
||||||
@ -147,4 +150,6 @@ public class ZeTimeConstants {
|
|||||||
public static final String PREF_CALORIES_TYPE = "zetime_calories_type";
|
public static final String PREF_CALORIES_TYPE = "zetime_calories_type";
|
||||||
public static final String PREF_TIME_FORMAT = "zetime_time_format";
|
public static final String PREF_TIME_FORMAT = "zetime_time_format";
|
||||||
public static final String PREF_DATE_FORMAT = "zetime_date_format";
|
public static final String PREF_DATE_FORMAT = "zetime_date_format";
|
||||||
|
|
||||||
|
public static final String PREF_ALARM_SIGNALING = "zetime_alarm_signaling";
|
||||||
}
|
}
|
||||||
|
@ -229,7 +229,38 @@ public class ZeTimeDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSetAlarms(ArrayList<? extends Alarm> alarms) {
|
public void onSetAlarms(ArrayList<? extends Alarm> alarms) {
|
||||||
|
byte[] alarmMessage = null;
|
||||||
|
try {
|
||||||
|
TransactionBuilder builder = performInitialized("setAlarms");
|
||||||
|
|
||||||
|
Prefs prefs = GBApplication.getPrefs();
|
||||||
|
|
||||||
|
for (Alarm alarm : alarms) {
|
||||||
|
alarmMessage = new byte[]{
|
||||||
|
ZeTimeConstants.CMD_PREAMBLE,
|
||||||
|
ZeTimeConstants.CMD_REMINDERS,
|
||||||
|
ZeTimeConstants.CMD_SEND,
|
||||||
|
(byte) 0xb,
|
||||||
|
(byte) 0x0,
|
||||||
|
(byte) alarm.getIndex(), // index
|
||||||
|
ZeTimeConstants.REMINDER_ALARM,
|
||||||
|
(byte) 0x0, // year low byte
|
||||||
|
(byte) 0x0, // year high byte
|
||||||
|
(byte) 0x0, // month
|
||||||
|
(byte) 0x0, // day
|
||||||
|
(byte) alarm.getAlarmCal().get(Calendar.HOUR_OF_DAY),
|
||||||
|
(byte) alarm.getAlarmCal().get(Calendar.MINUTE),
|
||||||
|
(byte) alarm.getRepetitionMask(),
|
||||||
|
(byte) (alarm.isEnabled() ? 1 : 0),
|
||||||
|
(byte) prefs.getInt(ZeTimeConstants.PREF_ALARM_SIGNALING, 11), // reminder signaling
|
||||||
|
ZeTimeConstants.CMD_END
|
||||||
|
};
|
||||||
|
sendMsgToWatch(builder, alarmMessage);
|
||||||
|
}
|
||||||
|
builder.queue(getQueue());
|
||||||
|
} catch (IOException e) {
|
||||||
|
GB.toast(getContext(), "Error set alarms: " + e.getLocalizedMessage(), Toast.LENGTH_LONG, GB.ERROR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -490,5 +490,15 @@
|
|||||||
<item>2</item>
|
<item>2</item>
|
||||||
<item>3</item>
|
<item>3</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
<string-array name="zetime_signaling_types">
|
||||||
|
<item name="7">@string/zetime_signaling_vibrate</item>
|
||||||
|
<item name="11">@string/zetime_signaling_buzzer</item>
|
||||||
|
<item name="13">@string/zetime_signaling_vibrate_buzzer</item>
|
||||||
|
</string-array>
|
||||||
|
<string-array name="zetime_signaling_types_values">
|
||||||
|
<item>7</item>
|
||||||
|
<item>11</item>
|
||||||
|
<item>13</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -239,6 +239,10 @@
|
|||||||
<string name="zetime_prefs_inactivity_fr">Friday</string>
|
<string name="zetime_prefs_inactivity_fr">Friday</string>
|
||||||
<string name="zetime_prefs_inactivity_sa">Saturday</string>
|
<string name="zetime_prefs_inactivity_sa">Saturday</string>
|
||||||
<string name="zetime_prefs_inactivity_su">Sunday</string>
|
<string name="zetime_prefs_inactivity_su">Sunday</string>
|
||||||
|
<string name="zetime_title_alarm_signaling">Set type of signaling for the alarm</string>
|
||||||
|
<string name="zetime_signaling_vibrate">Vibrate</string>
|
||||||
|
<string name="zetime_signaling_buzzer">Buzzer</string>
|
||||||
|
<string name="zetime_signaling_vibrate_buzzer">Vibrate and Buzzer</string>
|
||||||
|
|
||||||
<!-- Auto export preferences -->
|
<!-- Auto export preferences -->
|
||||||
<string name="pref_header_auto_export">Auto export</string>
|
<string name="pref_header_auto_export">Auto export</string>
|
||||||
|
@ -18,6 +18,14 @@
|
|||||||
android:key="zetime_screentime"
|
android:key="zetime_screentime"
|
||||||
android:title="@string/zetime_title_screentime"/>
|
android:title="@string/zetime_title_screentime"/>
|
||||||
|
|
||||||
|
<ListPreference
|
||||||
|
android:defaultValue="11"
|
||||||
|
android:entries="@array/zetime_signaling_types"
|
||||||
|
android:entryValues="@array/zetime_signaling_types_values"
|
||||||
|
android:key="zetime_alarm_signaling"
|
||||||
|
android:title="@string/zetime_title_alarm_signaling"
|
||||||
|
android:summary="%s" />
|
||||||
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="zetime_activity_tracking"
|
android:key="zetime_activity_tracking"
|
||||||
|
Loading…
Reference in New Issue
Block a user