Quiet Time state, combining manual, scheduled and calendar-aware activation.
More...
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:
- Manual: an on/off switch. Turning it off while an automatic mode is active overrides that mode until the next schedule boundary or settings change. It turns itself off when a scheduled period ends.
- Scheduled: a daily period, with separate schedules for weekdays and weekends.
- Smart (calendar aware): active while a calendar event is ongoing.
Every change of the active state posts a PEBBLE_DO_NOT_DISTURB_EVENT.
◆ DoNotDisturbSchedule
| 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. |
◆ DoNotDisturbScheduleType
Schedule selector.
| Enumerator |
|---|
| WeekdaySchedule | Schedule used Monday to Friday.
|
| WeekendSchedule | Schedule used on Saturday and Sunday.
|
| NumDNDSchedules | Number of schedules.
|
◆ ManualDNDFirstUseSource
Where manual DND was toggled from, matching the FirstUseSource values.
| Enumerator |
|---|
| ManualDNDFirstUseSourceActionMenu | Notification action menu.
|
| ManualDNDFirstUseSourceSettingsMenu | Settings menu.
|
◆ do_not_disturb_get_schedule()
Get a DND schedule.
- Parameters
-
| type | Schedule to get. |
| [out] | schedule_out | Schedule. |
◆ do_not_disturb_handle_calendar_event()
| void do_not_disturb_handle_calendar_event |
( |
PebbleCalendarEvent * |
e | ) |
|
Re-evaluate smart DND after a calendar event.
- Parameters
-
◆ do_not_disturb_handle_clock_change()
| void do_not_disturb_handle_clock_change |
( |
void |
| ) |
|
Re-evaluate the schedule after the wall clock or timezone changed.
◆ do_not_disturb_handle_pref_synced()
| 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.
◆ do_not_disturb_init()
| void do_not_disturb_init |
( |
void |
| ) |
|
Initialize the DND service and arm the schedule timers.
◆ do_not_disturb_is_active()
| bool do_not_disturb_is_active |
( |
void |
| ) |
|
Check whether DND is in effect.
- Returns
- true if manual, scheduled or smart DND is active.
◆ do_not_disturb_is_manually_enabled()
| bool do_not_disturb_is_manually_enabled |
( |
void |
| ) |
|
Check whether manual DND is on.
- Returns
- true if DND has been manually enabled.
◆ do_not_disturb_is_schedule_enabled()
Check whether a DND schedule is enabled.
- Parameters
-
- Returns
- true if enabled.
◆ do_not_disturb_is_smart_dnd_enabled()
| bool do_not_disturb_is_smart_dnd_enabled |
( |
void |
| ) |
|
Check whether calendar-aware (smart) DND is enabled.
- Returns
- true if enabled.
◆ do_not_disturb_manual_toggle_with_dialog()
| void do_not_disturb_manual_toggle_with_dialog |
( |
void |
| ) |
|
Push the manual DND toggle prompt, which sets manual DND to the opposite state.
◆ do_not_disturb_set_manually_enabled()
| 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.
- Parameters
-
| enable | true to turn manual DND on. |
◆ do_not_disturb_set_schedule()
Set a DND schedule and re-evaluate the DND state.
- Parameters
-
| type | Schedule to set. |
| schedule | New schedule. |
◆ do_not_disturb_set_schedule_enabled()
Enable or disable a DND schedule and re-evaluate the DND state.
- Parameters
-
| type | Schedule to change. |
| scheduled | true to enable. |
◆ do_not_disturb_toggle_manually_enabled()
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.
- Parameters
-
| source | Where the toggle came from. |
◆ do_not_disturb_toggle_scheduled()
Toggle a DND schedule and re-evaluate the DND state.
- Parameters
-
◆ do_not_disturb_toggle_smart_dnd()
| void do_not_disturb_toggle_smart_dnd |
( |
void |
| ) |
|
Toggle smart DND, showing the first use dialog the first time.