|
PebbleOS v4.47.0-512-g5285d4236
|
Quiet Time state, combining manual, scheduled and calendar-aware activation. More...
Data Structures | |
| struct | DoNotDisturbSchedule |
| Daily DND period, in local time. More... | |
| struct | DoNotDisturbScheduleSlot |
| DND schedule slot, as stored and synced with the phone. More... | |
Macros | |
| #define | DND_NUM_SCHEDULE_SLOTS (5) |
| Number of DND schedule slots. | |
Enumerations | |
| enum | DoNotDisturbScheduleKind { DoNotDisturbScheduleKindEveryday , DoNotDisturbScheduleKindWeekdays , DoNotDisturbScheduleKindWeekends , DoNotDisturbScheduleKindCustom , DoNotDisturbScheduleKindCount } |
| Days a DND schedule applies to. More... | |
| enum | ManualDNDFirstUseSource { ManualDNDFirstUseSourceActionMenu = 0 , ManualDNDFirstUseSourceSettingsMenu } |
| Where manual DND was toggled from, matching the FirstUseSource values. More... | |
Functions | |
| bool | do_not_disturb_is_active (void) |
| Check whether DND is in effect. | |
| bool | do_not_disturb_is_manually_enabled (void) |
| Check whether manual DND is on. | |
| void | do_not_disturb_set_manually_enabled (bool enable) |
| Set the manual DND state. | |
| void | do_not_disturb_toggle_manually_enabled (ManualDNDFirstUseSource source) |
| Toggle manual DND, showing the first use dialog the first time. | |
| bool | do_not_disturb_is_smart_dnd_enabled (void) |
| Check whether calendar-aware (smart) DND is enabled. | |
| void | do_not_disturb_toggle_smart_dnd (void) |
| Toggle smart DND, showing the first use dialog the first time. | |
| static uint8_t | do_not_disturb_schedule_slot_get_days (const DoNotDisturbScheduleSlot *slot) |
| Get the days a schedule slot applies to. | |
| static bool | do_not_disturb_schedule_slot_is_valid (const DoNotDisturbScheduleSlot *slot) |
| Check whether a schedule slot holds a valid schedule. | |
| void | do_not_disturb_get_schedule_slot (unsigned int index, DoNotDisturbScheduleSlot *slot) |
| Get a DND schedule slot. | |
| int | do_not_disturb_set_schedule_slot (unsigned int index, const DoNotDisturbScheduleSlot *slot) |
| Store a DND schedule slot and re-evaluate the DND state. | |
| int | do_not_disturb_add_schedule_slot (const DoNotDisturbScheduleSlot *slot) |
| Store a DND schedule in the first unused slot and re-evaluate the DND state. | |
| void | do_not_disturb_delete_schedule_slot (unsigned int index) |
| Clear a DND schedule slot and re-evaluate the DND state. | |
| void | do_not_disturb_init (void) |
| Initialize the DND service and arm the schedule timers. | |
| void | do_not_disturb_handle_clock_change (void) |
| Re-evaluate the schedule after the wall clock or timezone changed. | |
| void | do_not_disturb_handle_pref_synced (void) |
| Handle a DND state preference (manual, smart or schedule) written by phone sync. | |
| void | do_not_disturb_handle_calendar_event (PebbleCalendarEvent *e) |
| Re-evaluate smart DND after a calendar event. | |
| void | do_not_disturb_manual_toggle_with_dialog (void) |
| Push the manual DND toggle prompt, which sets manual DND to the opposite state. | |
Quiet Time state, combining manual, scheduled and calendar-aware activation.
Meant for internal use; clients should ask Alerts whether and how the user can be notified. DND is active when any of these modes is:
Every change of the active state posts a PEBBLE_DO_NOT_DISTURB_EVENT.
| struct DoNotDisturbSchedule |
Daily DND period, in local time.
A period whose end is earlier than its start spans midnight; equal start and end never match.
| Data Fields | ||
|---|---|---|
| uint8_t | from_hour | Start hour, 0 to 23. |
| uint8_t | from_minute | Start minute, 0 to 59. |
| uint8_t | to_hour | End hour (exclusive), 0 to 23. |
| uint8_t | to_minute | End minute (exclusive), 0 to 59. |
| struct DoNotDisturbScheduleSlot |
DND schedule slot, as stored and synced with the phone.
A period spanning midnight belongs to the day it starts on, unless the slot is a legacy one.
| Data Fields | ||
|---|---|---|
| uint8_t | days | Days for DoNotDisturbScheduleKindCustom, a PBL_CRON_WDAY_ mask (Sunday is bit 0). |
| uint8_t | enabled | Non-zero if the schedule is enabled. |
| uint8_t | kind | A DoNotDisturbScheduleKind. |
| uint8_t | legacy |
Non-zero if the slot holds a weekday or weekend schedule from older firmware: every scheduled day is quiet before the period's end and after its start. Cleared when the days change. |
| DoNotDisturbSchedule | schedule | Daily period. |
| uint8_t | used | Non-zero if the slot holds a schedule. |
| #define DND_NUM_SCHEDULE_SLOTS (5) |
Number of DND schedule slots.
Days a DND schedule applies to.
| int do_not_disturb_add_schedule_slot | ( | const DoNotDisturbScheduleSlot * | slot | ) |
Store a DND schedule in the first unused slot and re-evaluate the DND state.
| slot | Schedule, marked used when stored. |
slot is invalid or -ENOSPC if every slot is used. | void do_not_disturb_delete_schedule_slot | ( | unsigned int | index | ) |
Clear a DND schedule slot and re-evaluate the DND state.
| index | Slot index. |
| void do_not_disturb_get_schedule_slot | ( | unsigned int | index, |
| DoNotDisturbScheduleSlot * | slot | ||
| ) |
Get a DND schedule slot.
| index | Slot index, below DND_NUM_SCHEDULE_SLOTS. | |
| [out] | slot | Slot, zeroed if unused. |
| void do_not_disturb_handle_calendar_event | ( | PebbleCalendarEvent * | e | ) |
Re-evaluate smart DND after a calendar event.
| e | Calendar event. |
| void do_not_disturb_handle_clock_change | ( | void | ) |
Re-evaluate the schedule after the wall clock or timezone changed.
| void do_not_disturb_handle_pref_synced | ( | void | ) |
Handle a DND state preference (manual, smart or schedule) written by phone sync.
Re-evaluates the DND state so the change fires the usual event and updates the schedule timers.
| void do_not_disturb_init | ( | void | ) |
Initialize the DND service and arm the schedule timers.
| bool do_not_disturb_is_active | ( | void | ) |
Check whether DND is in effect.
| bool do_not_disturb_is_manually_enabled | ( | void | ) |
Check whether manual DND is on.
| bool do_not_disturb_is_smart_dnd_enabled | ( | void | ) |
Check whether calendar-aware (smart) DND is enabled.
| void do_not_disturb_manual_toggle_with_dialog | ( | void | ) |
Push the manual DND toggle prompt, which sets manual DND to the opposite state.
|
inlinestatic |
Get the days a schedule slot applies to.
| slot | Slot. |
References DoNotDisturbScheduleSlot::days, DoNotDisturbScheduleKindCustom, DoNotDisturbScheduleKindEveryday, DoNotDisturbScheduleKindWeekdays, DoNotDisturbScheduleKindWeekends, DoNotDisturbScheduleSlot::kind, PBL_CRON_WDAY_ANY, PBL_CRON_WDAY_WEEKDAYS, and PBL_CRON_WDAY_WEEKENDS.
|
inlinestatic |
Check whether a schedule slot holds a valid schedule.
| slot | Slot to check. |
References DoNotDisturbScheduleSlot::days, DoNotDisturbScheduleKindCount, DoNotDisturbScheduleKindCustom, DoNotDisturbSchedule::from_hour, DoNotDisturbSchedule::from_minute, DoNotDisturbScheduleSlot::kind, PBL_HOUR_PER_DAY, PBL_MIN_PER_HOUR, DoNotDisturbScheduleSlot::schedule, DoNotDisturbSchedule::to_hour, and DoNotDisturbSchedule::to_minute.
| void do_not_disturb_set_manually_enabled | ( | bool | enable | ) |
Set the manual DND state.
Turning it off while scheduled or smart DND is active overrides the automatic mode.
| enable | true to turn manual DND on. |
| int do_not_disturb_set_schedule_slot | ( | unsigned int | index, |
| const DoNotDisturbScheduleSlot * | slot | ||
| ) |
Store a DND schedule slot and re-evaluate the DND state.
| index | Slot index. |
| slot | Schedule, marked used when stored. |
index or slot is invalid. | void do_not_disturb_toggle_manually_enabled | ( | ManualDNDFirstUseSource | source | ) |
Toggle manual DND, showing the first use dialog the first time.
From the settings menu this flips the manual setting. From a notification action menu it sets manual DND to the opposite of the current DND active state, showing a confirmation.
| source | Where the toggle came from. |
| void do_not_disturb_toggle_smart_dnd | ( | void | ) |
Toggle smart DND, showing the first use dialog the first time.