PebbleOS v4.47.0-512-g5285d4236
Loading...
Searching...
No Matches
Alert preferences (internal)

Preferences backing the alerts, Do Not Disturb and notification UI services. More...

Macros

#define NOTIF_WINDOW_TIMEOUT_INFINITE   ((uint32_t)~0)
 Notification window timeout meaning "never time out".
 
#define NOTIF_WINDOW_TIMEOUT_DEFAULT   (3 * PBL_MSEC_PER_MIN)
 Default notification window timeout, in milliseconds.
 
#define NOTIF_WINDOW_TIMEOUT_MIN   (15 * PBL_MSEC_PER_SEC)
 Shortest notification window timeout, in milliseconds.
 
#define NotificationContentSizeSystem   ((PreferredContentSize)NumPreferredContentSizes)
 Notification content size value meaning "follow the system content size".
 
#define DND_SCHEDULE_SLOT_KEYS    "qtSchedule0", "qtSchedule1", "qtSchedule2", "qtSchedule3", "qtSchedule4"
 Settings keys of the DND schedule slots, in slot order.
 

Enumerations

enum  NotificationGroupingRange {
  NotificationGroupingRange_Never = 0 , NotificationGroupingRange_OneDay , NotificationGroupingRange_OneWeek , NotificationGroupingRange_All ,
  NotificationGroupingRangeCount
}
 Age range within which notifications from the same sender are grouped. More...
 
enum  NotificationStatusBarStyle { NotificationStatusBarStyle_Default = 0 , NotificationStatusBarStyle_Bold = 1 , NotificationStatusBarStyle_LargeBold = 2 , NotificationStatusBarStyleCount }
 Style of the clock in the notification window status bar. More...
 

Functions

void alerts_preferences_init (void)
 Load all preferences from the settings file, migrating legacy keys.
 
AlertMask alerts_preferences_get_alert_mask (void)
 Get the alert mask.
 
void alerts_preferences_set_alert_mask (AlertMask mask)
 Set the alert mask.
 
AlertMask alerts_preferences_dnd_get_mask (void)
 Get the Do Not Disturb mask.
 
void alerts_preferences_dnd_set_mask (AlertMask mask)
 Set the Do Not Disturb mask.
 
uint32_t alerts_preferences_get_notification_window_timeout_ms (void)
 Get the notification window timeout.
 
void alerts_preferences_set_notification_window_timeout_ms (uint32_t timeout_ms)
 Set the notification window timeout.
 
bool alerts_preferences_get_notification_alternative_design (void)
 Get whether notifications use the alternative design.
 
void alerts_preferences_set_notification_alternative_design (bool alternative)
 Set whether notifications use the alternative design.
 
bool alerts_preferences_get_notification_vibe_delay (void)
 Get whether the notification vibration is delayed.
 
void alerts_preferences_set_notification_vibe_delay (bool delay)
 Set whether the notification vibration is delayed.
 
bool alerts_preferences_get_notification_backlight (void)
 Get whether notifications turn on the backlight.
 
void alerts_preferences_set_notification_backlight (bool enable)
 Set whether notifications turn on the backlight.
 
bool alerts_preferences_get_notification_respect_phone_silence (void)
 Get whether notifications silenced on the phone are delivered quietly.
 
void alerts_preferences_set_notification_respect_phone_silence (bool enable)
 Set whether notifications silenced on the phone are delivered quietly.
 
bool alerts_preferences_get_notification_dismissal_sync (void)
 Get whether acted-on and dismissed notifications are hidden from history.
 
void alerts_preferences_set_notification_dismissal_sync (bool enable)
 Set whether acted-on and dismissed notifications are hidden from history.
 
NotificationGroupingRange alerts_preferences_get_notification_grouping_range (void)
 Get the notification grouping range.
 
void alerts_preferences_set_notification_grouping_range (NotificationGroupingRange range)
 Set the notification grouping range.
 
NotificationStatusBarStyle alerts_preferences_get_notification_status_bar_style (void)
 Get the notification status bar style.
 
void alerts_preferences_set_notification_status_bar_style (NotificationStatusBarStyle style)
 Set the notification status bar style.
 
PreferredContentSize alerts_preferences_get_notification_content_size (void)
 Get the notification content size.
 
void alerts_preferences_set_notification_content_size (PreferredContentSize size)
 Set the notification content size.
 
bool alerts_preferences_get_vibrate (void)
 Get whether notifications vibrate.
 
void alerts_preferences_set_vibrate (bool enable)
 Set whether notifications vibrate.
 
VibeIntensity alerts_preferences_get_vibe_intensity (void)
 Get the legacy vibration intensity.
 
void alerts_preferences_set_vibe_intensity (VibeIntensity intensity)
 Set the legacy vibration intensity.
 
VibeScoreId alerts_preferences_get_vibe_score_for_client (VibeClient client)
 Get the vibration pattern used for a vibe client.
 
void alerts_preferences_set_vibe_score_for_client (VibeClient client, VibeScoreId id)
 Set the vibration pattern used for a vibe client.
 
bool alerts_preferences_dnd_is_manually_enabled (void)
 Get the stored manual DND state.
 
void alerts_preferences_dnd_set_manually_enabled (bool enable)
 Store the manual DND state.
 
void alerts_preferences_dnd_get_schedule_slot (unsigned int index, DoNotDisturbScheduleSlot *slot)
 Get a stored DND schedule slot.
 
void alerts_preferences_dnd_set_schedule_slot (unsigned int index, const DoNotDisturbScheduleSlot *slot)
 Store a DND schedule slot.
 
bool alerts_preferences_dnd_is_smart_enabled (void)
 Get whether calendar-aware (smart) DND is enabled.
 
void alerts_preferences_dnd_set_smart_enabled (bool enable)
 Store whether calendar-aware (smart) DND is enabled.
 
void alerts_preferences_lock (void)
 Lock the alerts preferences mutex.
 
void alerts_preferences_unlock (void)
 Unlock the alerts preferences mutex.
 
void alerts_preferences_handle_blob_db_event (PebbleBlobDBEvent *event)
 Process a BlobDB event for notification preferences.
 

Detailed Description

Preferences backing the alerts, Do Not Disturb and notification UI services.

Setters update the cached value and persist it in the notifpref settings file. Values written by the phone through BlobDB are reloaded by alerts_preferences_handle_blob_db_event().

Macro Definition Documentation

◆ DND_SCHEDULE_SLOT_KEYS

#define DND_SCHEDULE_SLOT_KEYS    "qtSchedule0", "qtSchedule1", "qtSchedule2", "qtSchedule3", "qtSchedule4"

Settings keys of the DND schedule slots, in slot order.

◆ NOTIF_WINDOW_TIMEOUT_DEFAULT

#define NOTIF_WINDOW_TIMEOUT_DEFAULT   (3 * PBL_MSEC_PER_MIN)

Default notification window timeout, in milliseconds.

◆ NOTIF_WINDOW_TIMEOUT_INFINITE

#define NOTIF_WINDOW_TIMEOUT_INFINITE   ((uint32_t)~0)

Notification window timeout meaning "never time out".

◆ NOTIF_WINDOW_TIMEOUT_MIN

#define NOTIF_WINDOW_TIMEOUT_MIN   (15 * PBL_MSEC_PER_SEC)

Shortest notification window timeout, in milliseconds.

◆ NotificationContentSizeSystem

#define NotificationContentSizeSystem   ((PreferredContentSize)NumPreferredContentSizes)

Notification content size value meaning "follow the system content size".

Enumeration Type Documentation

◆ NotificationGroupingRange

Age range within which notifications from the same sender are grouped.

Enumerator
NotificationGroupingRange_Never 

Grouping disabled (default).

NotificationGroupingRange_OneDay 

Group notifications received within the last day.

NotificationGroupingRange_OneWeek 

Group notifications received within the last week.

NotificationGroupingRange_All 

Group all notifications.

NotificationGroupingRangeCount 

Number of ranges.

◆ NotificationStatusBarStyle

Style of the clock in the notification window status bar.

Enumerator
NotificationStatusBarStyle_Default 

Regular clock (default).

NotificationStatusBarStyle_Bold 

Bold clock.

NotificationStatusBarStyle_LargeBold 

Large bold clock.

NotificationStatusBarStyleCount 

Number of styles.

Function Documentation

◆ alerts_preferences_dnd_get_mask()

AlertMask alerts_preferences_dnd_get_mask ( void  )

Get the Do Not Disturb mask.

Returns
Alert types that may still vibrate or light the backlight while DND is active. Defaults to AlertMaskAllOff.

◆ alerts_preferences_dnd_get_schedule_slot()

void alerts_preferences_dnd_get_schedule_slot ( unsigned int  index,
DoNotDisturbScheduleSlot *  slot 
)

Get a stored DND schedule slot.

Parameters
indexSlot index, below DND_NUM_SCHEDULE_SLOTS.
[out]slotSlot.

◆ alerts_preferences_dnd_is_manually_enabled()

bool alerts_preferences_dnd_is_manually_enabled ( void  )

Get the stored manual DND state.

Returns
true if manual DND is on.

◆ alerts_preferences_dnd_is_smart_enabled()

bool alerts_preferences_dnd_is_smart_enabled ( void  )

Get whether calendar-aware (smart) DND is enabled.

Returns
true if enabled.

◆ alerts_preferences_dnd_set_manually_enabled()

void alerts_preferences_dnd_set_manually_enabled ( bool  enable)

Store the manual DND state.

Use do_not_disturb_set_manually_enabled() to also update the DND state.

Parameters
enabletrue to turn manual DND on.

◆ alerts_preferences_dnd_set_mask()

void alerts_preferences_dnd_set_mask ( AlertMask  mask)

Set the Do Not Disturb mask.

Parameters
maskAlert types that may still vibrate or light the backlight while DND is active.

◆ alerts_preferences_dnd_set_schedule_slot()

void alerts_preferences_dnd_set_schedule_slot ( unsigned int  index,
const DoNotDisturbScheduleSlot *  slot 
)

Store a DND schedule slot.

Use do_not_disturb_set_schedule_slot() to also update the DND state.

Parameters
indexSlot index, below DND_NUM_SCHEDULE_SLOTS.
slotSlot.

◆ alerts_preferences_dnd_set_smart_enabled()

void alerts_preferences_dnd_set_smart_enabled ( bool  enable)

Store whether calendar-aware (smart) DND is enabled.

Parameters
enabletrue to enable.

◆ alerts_preferences_get_alert_mask()

AlertMask alerts_preferences_get_alert_mask ( void  )

Get the alert mask.

A legacy "all on" mask is migrated to AlertMaskAllOn.

Returns
Alert types that may alert the user. Defaults to AlertMaskAllOn.

◆ alerts_preferences_get_notification_alternative_design()

bool alerts_preferences_get_notification_alternative_design ( void  )

Get whether notifications use the alternative design.

Returns
true for the alternative (black banner) design, false for the standard one (default).

◆ alerts_preferences_get_notification_backlight()

bool alerts_preferences_get_notification_backlight ( void  )

Get whether notifications turn on the backlight.

Returns
true if enabled (default).

◆ alerts_preferences_get_notification_content_size()

PreferredContentSize alerts_preferences_get_notification_content_size ( void  )

Get the notification content size.

Returns
Content size, or NotificationContentSizeSystem when notifications follow the system content size.

◆ alerts_preferences_get_notification_dismissal_sync()

bool alerts_preferences_get_notification_dismissal_sync ( void  )

Get whether acted-on and dismissed notifications are hidden from history.

Returns
true if enabled, false if they stay in history (default).

◆ alerts_preferences_get_notification_grouping_range()

NotificationGroupingRange alerts_preferences_get_notification_grouping_range ( void  )

Get the notification grouping range.

Returns
Grouping range; NotificationGroupingRange_Never if the stored value is invalid.

◆ alerts_preferences_get_notification_respect_phone_silence()

bool alerts_preferences_get_notification_respect_phone_silence ( void  )

Get whether notifications silenced on the phone are delivered quietly.

Returns
true if enabled, false if they alert as usual (default).

◆ alerts_preferences_get_notification_status_bar_style()

NotificationStatusBarStyle alerts_preferences_get_notification_status_bar_style ( void  )

Get the notification status bar style.

Returns
Status bar style.

◆ alerts_preferences_get_notification_vibe_delay()

bool alerts_preferences_get_notification_vibe_delay ( void  )

Get whether the notification vibration is delayed.

Returns
true to vibrate at the end of the notification animation (default), false to vibrate immediately.

◆ alerts_preferences_get_notification_window_timeout_ms()

uint32_t alerts_preferences_get_notification_window_timeout_ms ( void  )

Get the notification window timeout.

Returns
Timeout in milliseconds, never less than NOTIF_WINDOW_TIMEOUT_MIN.

◆ alerts_preferences_get_vibe_intensity()

VibeIntensity alerts_preferences_get_vibe_intensity ( void  )

Get the legacy vibration intensity.

Returns
Vibration intensity.

◆ alerts_preferences_get_vibe_score_for_client()

VibeScoreId alerts_preferences_get_vibe_score_for_client ( VibeClient  client)

Get the vibration pattern used for a vibe client.

Parameters
clientVibe client.
Returns
Vibe score of client.

◆ alerts_preferences_get_vibrate()

bool alerts_preferences_get_vibrate ( void  )

Get whether notifications vibrate.

Returns
true if enabled (default).

◆ alerts_preferences_handle_blob_db_event()

void alerts_preferences_handle_blob_db_event ( PebbleBlobDBEvent *  event)

Process a BlobDB event for notification preferences.

For BlobDBEventTypeInsert events, reloads the cached copy of the preference whose key was written. A change to a DND state preference also re-evaluates the DND state.

Parameters
eventBlobDB event.

◆ alerts_preferences_init()

void alerts_preferences_init ( void  )

Load all preferences from the settings file, migrating legacy keys.

◆ alerts_preferences_lock()

void alerts_preferences_lock ( void  )

Lock the alerts preferences mutex.

Must be paired with alerts_preferences_unlock().

◆ alerts_preferences_set_alert_mask()

void alerts_preferences_set_alert_mask ( AlertMask  mask)

Set the alert mask.

Parameters
maskAlert types that may alert the user.

◆ alerts_preferences_set_notification_alternative_design()

void alerts_preferences_set_notification_alternative_design ( bool  alternative)

Set whether notifications use the alternative design.

Parameters
alternativetrue for the alternative (black banner) design.

◆ alerts_preferences_set_notification_backlight()

void alerts_preferences_set_notification_backlight ( bool  enable)

Set whether notifications turn on the backlight.

Parameters
enabletrue to enable.

◆ alerts_preferences_set_notification_content_size()

void alerts_preferences_set_notification_content_size ( PreferredContentSize  size)

Set the notification content size.

Parameters
sizeContent size or NotificationContentSizeSystem; larger values are ignored.

◆ alerts_preferences_set_notification_dismissal_sync()

void alerts_preferences_set_notification_dismissal_sync ( bool  enable)

Set whether acted-on and dismissed notifications are hidden from history.

Parameters
enabletrue to enable.

◆ alerts_preferences_set_notification_grouping_range()

void alerts_preferences_set_notification_grouping_range ( NotificationGroupingRange  range)

Set the notification grouping range.

Parameters
rangeGrouping range.

◆ alerts_preferences_set_notification_respect_phone_silence()

void alerts_preferences_set_notification_respect_phone_silence ( bool  enable)

Set whether notifications silenced on the phone are delivered quietly.

Parameters
enabletrue to enable.

◆ alerts_preferences_set_notification_status_bar_style()

void alerts_preferences_set_notification_status_bar_style ( NotificationStatusBarStyle  style)

Set the notification status bar style.

Parameters
styleStatus bar style.

◆ alerts_preferences_set_notification_vibe_delay()

void alerts_preferences_set_notification_vibe_delay ( bool  delay)

Set whether the notification vibration is delayed.

Parameters
delaytrue to vibrate at the end of the notification animation.

◆ alerts_preferences_set_notification_window_timeout_ms()

void alerts_preferences_set_notification_window_timeout_ms ( uint32_t  timeout_ms)

Set the notification window timeout.

Parameters
timeout_msTimeout in milliseconds, or NOTIF_WINDOW_TIMEOUT_INFINITE.

◆ alerts_preferences_set_vibe_intensity()

void alerts_preferences_set_vibe_intensity ( VibeIntensity  intensity)

Set the legacy vibration intensity.

Parameters
intensityVibration intensity.

◆ alerts_preferences_set_vibe_score_for_client()

void alerts_preferences_set_vibe_score_for_client ( VibeClient  client,
VibeScoreId  id 
)

Set the vibration pattern used for a vibe client.

Parameters
clientVibe client.
idVibe score to use.

◆ alerts_preferences_set_vibrate()

void alerts_preferences_set_vibrate ( bool  enable)

Set whether notifications vibrate.

Parameters
enabletrue to vibrate.

◆ alerts_preferences_unlock()

void alerts_preferences_unlock ( void  )

Unlock the alerts preferences mutex.

Must be paired with alerts_preferences_lock().