PebbleOS v4.47.0-512-g5285d4236
Loading...
Searching...
No Matches
do_not_disturb.h File Reference
#include <pbl/cron/cron.h>
#include <pbl/kernel/compiler.h>
#include <pbl/services/notifications/alerts_preferences.h>
#include <pbl/util/units.h>
#include <kernel/events.h>

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.