PebbleOS v4.47.0-512-g5285d4236
Loading...
Searching...
No Matches

App identification and timestamp parsing for ANCS notifications. More...

Data Structures

Macros

#define IOS_PHONE_APP_ID   "com.apple.mobilephone"
 Bundle identifier of the iOS Phone app.
 
#define IOS_CALENDAR_APP_ID   "com.apple.mobilecal"
 Bundle identifier of the iOS Calendar app.
 
#define IOS_REMINDERS_APP_ID   "com.apple.reminders"
 Bundle identifier of the iOS Reminders app.
 
#define IOS_MAIL_APP_ID   "com.apple.mobilemail"
 Bundle identifier of the iOS Mail app.
 
#define IOS_SMS_APP_ID   "com.apple.MobileSMS"
 Bundle identifier of the iOS Messages app.
 
#define IOS_FACETIME_APP_ID   "com.apple.facetime"
 Bundle identifier of the iOS FaceTime app.
 

Functions

static void ancs_attr_to_cstring (const struct pbl_bt_ancs_attr *attr, char *str)
 Copy the value of an attribute as a string.
 
static bool ancs_attr_equal_cstring (const struct pbl_bt_ancs_attr *attr, const char *str)
 Whether the value of an attribute is a string; false if either is NULL.
 
static bool ancs_attr_equal (const struct pbl_bt_ancs_attr *a, const struct pbl_bt_ancs_attr *b)
 Whether two attributes have the same value; false if either is NULL.
 
const ANCSAppMetadata * ancs_notifications_util_get_app_metadata (const struct pbl_bt_ancs_attr *app_id)
 Look up the presentation of an app.
 
time_t ancs_notifications_util_parse_timestamp (const struct pbl_bt_ancs_attr *timestamp_attr)
 Parse an ANCS date attribute.
 
bool ancs_notifications_util_is_phone (const struct pbl_bt_ancs_attr *app_id)
 Check whether an app identifier is the iOS Phone app.
 
bool ancs_notifications_util_is_sms (const struct pbl_bt_ancs_attr *app_id)
 Check whether an app identifier is the iOS Messages app.
 
bool ancs_notifications_util_is_group_sms (const struct pbl_bt_ancs_attr *app_id, const struct pbl_bt_ancs_attr *subtitle)
 Check whether a notification is a group message.
 

Detailed Description

App identification and timestamp parsing for ANCS notifications.


Data Structure Documentation

◆ ANCSAppMetadata

struct ANCSAppMetadata

Presentation of a known iOS app.

Data Fields
const char * app_id Bundle identifier, NULL for the generic entry used for unknown apps.
uint32_t icon_id Timeline resource id of the app icon.
bool is_blocked: 1 Whether the app's notifications should always be ignored.
bool is_unblockable: 1 Whether the app's notifications should never be ignored.

Macro Definition Documentation

◆ IOS_CALENDAR_APP_ID

#define IOS_CALENDAR_APP_ID   "com.apple.mobilecal"

Bundle identifier of the iOS Calendar app.

◆ IOS_FACETIME_APP_ID

#define IOS_FACETIME_APP_ID   "com.apple.facetime"

Bundle identifier of the iOS FaceTime app.

◆ IOS_MAIL_APP_ID

#define IOS_MAIL_APP_ID   "com.apple.mobilemail"

Bundle identifier of the iOS Mail app.

◆ IOS_PHONE_APP_ID

#define IOS_PHONE_APP_ID   "com.apple.mobilephone"

Bundle identifier of the iOS Phone app.

◆ IOS_REMINDERS_APP_ID

#define IOS_REMINDERS_APP_ID   "com.apple.reminders"

Bundle identifier of the iOS Reminders app.

◆ IOS_SMS_APP_ID

#define IOS_SMS_APP_ID   "com.apple.MobileSMS"

Bundle identifier of the iOS Messages app.

Function Documentation

◆ ancs_attr_equal()

static bool ancs_attr_equal ( const struct pbl_bt_ancs_attr *  a,
const struct pbl_bt_ancs_attr *  b 
)
inlinestatic

Whether two attributes have the same value; false if either is NULL.

References pbl_bt_ancs_attr::len, and pbl_bt_ancs_attr::value.

◆ ancs_attr_equal_cstring()

static bool ancs_attr_equal_cstring ( const struct pbl_bt_ancs_attr *  attr,
const char *  str 
)
inlinestatic

Whether the value of an attribute is a string; false if either is NULL.

References pbl_bt_ancs_attr::len, and pbl_bt_ancs_attr::value.

◆ ancs_attr_to_cstring()

static void ancs_attr_to_cstring ( const struct pbl_bt_ancs_attr *  attr,
char *  str 
)
inlinestatic

Copy the value of an attribute as a string.

Parameters
attrAttribute.
[out]strThe string, with room for the value and its terminator.

References pbl_bt_ancs_attr::len, and pbl_bt_ancs_attr::value.

◆ ancs_notifications_util_get_app_metadata()

const ANCSAppMetadata * ancs_notifications_util_get_app_metadata ( const struct pbl_bt_ancs_attr *  app_id)

Look up the presentation of an app.

Parameters
app_idApp identifier attribute.
Returns
Metadata of a known app, or a generic entry (NULL app_id, generic icon) otherwise.

◆ ancs_notifications_util_is_group_sms()

bool ancs_notifications_util_is_group_sms ( const struct pbl_bt_ancs_attr *  app_id,
const struct pbl_bt_ancs_attr *  subtitle 
)

Check whether a notification is a group message.

Parameters
app_idApp identifier attribute.
subtitleSubtitle attribute; group messages from the Messages app have one.
Returns
true for a Messages notification with a non-empty subtitle.

◆ ancs_notifications_util_is_phone()

bool ancs_notifications_util_is_phone ( const struct pbl_bt_ancs_attr *  app_id)

Check whether an app identifier is the iOS Phone app.

Parameters
app_idApp identifier attribute, may be NULL.
Returns
true if it is the Phone app.

◆ ancs_notifications_util_is_sms()

bool ancs_notifications_util_is_sms ( const struct pbl_bt_ancs_attr *  app_id)

Check whether an app identifier is the iOS Messages app.

Parameters
app_idApp identifier attribute, may be NULL.
Returns
true if it is the Messages app.

◆ ancs_notifications_util_parse_timestamp()

time_t ancs_notifications_util_parse_timestamp ( const struct pbl_bt_ancs_attr *  timestamp_attr)

Parse an ANCS date attribute.

The date is yyyyMMdd'T'HHmmSS in the phone's local time, which is assumed to match the watch's timezone.

Parameters
timestamp_attrDate attribute.
Returns
UTC timestamp, or 0 if the attribute is malformed.