|
PebbleOS
|
Pins, notifications and reminders. More...
Data Structures | |
| struct | TimelineItemAction |
| Action of a timeline item. More... | |
| struct | TimelineItemActionGroup |
| Actions of a timeline item. More... | |
| struct | CommonTimelineItemHeader |
| Header common to all timeline items, as stored. More... | |
| struct | TimelineItem |
| A reminder, notification or pin. More... | |
| struct | SerializedTimelineItemHeader |
| Header of a serialized item, followed by payload_length bytes of payload. More... | |
| union | CommonTimelineItemHeader.__unnamed87__ |
| Parent or ANCS reference. More... | |
| union | CommonTimelineItemHeader.__unnamed89__ |
| One-way flags set by the data source or mobile application describing how the item interacts with the user. More... | |
| struct | CommonTimelineItemHeader.__unnamed89__.__unnamed93__ |
| Individual flags. More... | |
| union | CommonTimelineItemHeader.__unnamed91__ |
| One-way status bits. More... | |
| struct | CommonTimelineItemHeader.__unnamed91__.__unnamed95__ |
| Individual status bits. More... | |
Macros | |
| #define | MAX_PIN_TITLE_LENGTH (50) |
| Maximum length of a pin title, in bytes. | |
| #define | TIMELINE_INVALID_ACTION_ID (0xFF) |
| Action id meaning "no action". | |
Typedefs | |
| typedef Uuid | TimelineItemId |
| Id of a timeline item. | |
Functions | |
| TimelineItem * | timeline_item_create_with_attributes (time_t timestamp, uint16_t duration, TimelineItemType type, LayoutId layout, AttributeList *attr_list, TimelineItemActionGroup *action_group) |
| Create an item from an attribute list and action group. | |
| TimelineItem * | timeline_item_create (int num_attributes, int num_actions, uint8_t attributes_per_action[], size_t required_size_for_strings, uint8_t **string_buffer) |
| Create an empty item with room for attributes, actions and strings. | |
| bool | timeline_item_create_from_serial_data (TimelineItem *item, uint8_t num_attributes, uint8_t num_actions, const uint8_t *data, size_t size, size_t *string_alloc_size, uint8_t **string_buffer) |
| Allocate an item's buffer to deserialize a payload into. | |
| TimelineItem * | timeline_item_copy (TimelineItem *src) |
| Deep copy an item. | |
| bool | timeline_item_deserialize_item (TimelineItem *item_out, const SerializedTimelineItemHeader *header, const uint8_t *payload) |
| Deserialize an item. | |
| void | timeline_item_serialize_header (TimelineItem *item, SerializedTimelineItemHeader *header) |
| Fill a serialized header from an item. | |
| void | timeline_item_deserialize_header (TimelineItem *item, const SerializedTimelineItemHeader *header) |
| Fill an item's header and counts from a serialized header. | |
| time_t | timeline_item_get_tz_timestamp (CommonTimelineItemHeader *hdr) |
| Get the UTC timestamp of a serialized header. | |
| size_t | timeline_item_serialize_payload (TimelineItem *item, uint8_t *buffer, size_t buffer_size) |
| Serialize the attributes and actions of an item. | |
| size_t | timeline_item_get_serialized_payload_size (TimelineItem *item) |
| Get the serialized size of an item's attributes and actions. | |
| bool | timeline_item_deserialize_payload (TimelineItem *item, char *string_buffer, size_t string_buffer_size, const uint8_t *payload, size_t payload_size) |
| Deserialize attributes and actions into an item laid out for them. | |
| void | timeline_item_destroy (TimelineItem *item) |
| Free an item allocated by the functions in this group, and its buffer. | |
| void | timeline_item_free_allocated_buffer (TimelineItem *item) |
| Free an item's buffer and set it to NULL. | |
| bool | timeline_item_verify_layout_serialized (const uint8_t *val, int val_len) |
| Check that a serialized item is well formed and has the attributes its layout requires. | |
| const TimelineItemAction * | timeline_item_find_action_with_id (const TimelineItem *item, uint8_t action_id) |
| Find an action by id. | |
| TimelineItemAction * | timeline_item_find_action_by_type (const TimelineItem *item, TimelineItemActionType type) |
| Find the first action of a type. | |
| bool | timeline_item_action_is_dismiss (const TimelineItemAction *action) |
| Check whether an action dismisses its item. | |
| bool | timeline_item_action_is_ancs (const TimelineItemAction *action) |
| Check whether an action is performed through ANCS. | |
| TimelineItemAction * | timeline_item_find_dismiss_action (const TimelineItem *item) |
| Find the first dismiss action of an item. | |
| TimelineItemAction * | timeline_item_find_reply_action (const TimelineItem *item) |
| Find the reply action of an item. | |
| TimelineItemAction * | timeline_item_action_group_find_reply_action (const TimelineItemActionGroup *action_group) |
| Find the reply action of an action group. | |
| bool | timeline_item_is_ancs_notif (const TimelineItem *item) |
| Check whether an item was received through ANCS (iOS). | |
Pins, notifications and reminders.
A TimelineItem is a CommonTimelineItemHeader plus an attribute list and an action group. Items built by the functions here keep all attributes, actions and strings in one buffer, TimelineItem::allocated_buffer, allocated on the calling task's heap together with the item.
Serialized (BlobDB, notification storage) an item is a SerializedTimelineItemHeader followed by the payload described in Attributes and actions.
Building a pin with an action that opens its app:
| struct TimelineItemAction |
Action of a timeline item.
| Data Fields | ||
|---|---|---|
| AttributeList | attr_list |
Attributes of the action, e.g. its title. |
| uint8_t | id | Action id, unique within the item, sent to the phone when invoked. |
| TimelineItemActionType | type | Action type. |
| struct TimelineItemActionGroup |
Actions of a timeline item.
| Data Fields | ||
|---|---|---|
| TimelineItemAction * | actions | Actions. |
| uint8_t | num_actions | Number of actions. |
| struct CommonTimelineItemHeader |
Header common to all timeline items, as stored.
| Data Fields | ||
|---|---|---|
| union CommonTimelineItemHeader.__unnamed87__ | __unnamed__ | Parent or ANCS reference. |
| union CommonTimelineItemHeader.__unnamed89__ | __unnamed__ |
One-way flags set by the data source or mobile application describing how the item interacts with the user. Once written to flash, the item has to be rewritten entirely to revert them. |
| union CommonTimelineItemHeader.__unnamed91__ | __unnamed__ |
One-way status bits. Once written to flash, the item has to be rewritten entirely to revert them. |
| uint16_t | duration |
Duration in minutes. A pin stays in the NOW section of the timeline until timestamp plus duration. |
| TimelineItemId | id |
Unique identifier of the item. Controlled by the watch; needed to answer the phone for actions actuated on the watch. |
| LayoutId | layout: 8 | Layout used to render the item, which determines how the attributes are shown. |
| int32_t | timestamp |
Time at which the item occurs, in seconds since the epoch. UTC, except for all-day and floating items in serialized headers, which use local time. |
| TimelineItemType | type: 8 | Item type. |
| struct TimelineItem |
A reminder, notification or pin.
The type in the header decides whether the item appears in the timeline or in the notifications app.
| Data Fields | ||
|---|---|---|
| TimelineItemActionGroup | action_group | Actions of the item. |
| uint8_t * | allocated_buffer | Buffer holding the attributes, actions and strings, or NULL. |
| AttributeList | attr_list | Attributes describing the item. |
| CommonTimelineItemHeader | header | Common header. |
| struct SerializedTimelineItemHeader |
Header of a serialized item, followed by payload_length bytes of payload.
| Data Fields | ||
|---|---|---|
| CommonTimelineItemHeader | common | Common header. |
| uint8_t | num_actions | Number of actions, offered when the item is rendered. |
| uint8_t | num_attributes | Number of attributes, which determine how the item looks when rendered. |
| uint16_t | payload_length | Length of the payload in bytes. |
| union CommonTimelineItemHeader.__unnamed87__ |
Parent or ANCS reference.
| Data Fields | ||
|---|---|---|
| uint32_t | ancs_uid | ANCS UID of the item, if it was received from an iOS device but not through the Pebble iOS application. |
| TimelineItemId | parent_id | Identifier of the parent of this item: an app or data source, or the pin of a reminder. |
| union CommonTimelineItemHeader.__unnamed89__ |
One-way flags set by the data source or mobile application describing how the item interacts with the user.
Once written to flash, the item has to be rewritten entirely to revert them.
| Data Fields | ||
|---|---|---|
| struct CommonTimelineItemHeader.__unnamed89__.__unnamed93__ | __unnamed__ | Individual flags. |
| uint8_t | flags | All flags, see TimelineItemFlag. |
| struct CommonTimelineItemHeader.__unnamed89__.__unnamed93__ |
Individual flags.
| union CommonTimelineItemHeader.__unnamed91__ |
One-way status bits.
Once written to flash, the item has to be rewritten entirely to revert them.
| Data Fields | ||
|---|---|---|
| struct CommonTimelineItemHeader.__unnamed91__.__unnamed95__ | __unnamed__ | Individual status bits. |
| uint8_t | status | All status bits, see TimelineItemStatus. |
| struct CommonTimelineItemHeader.__unnamed91__.__unnamed95__ |
Individual status bits.
| #define MAX_PIN_TITLE_LENGTH (50) |
Maximum length of a pin title, in bytes.
| #define TIMELINE_INVALID_ACTION_ID (0xFF) |
Action id meaning "no action".
| typedef Uuid TimelineItemId |
Id of a timeline item.
Types of actions, as used on the wire.
| enum TimelineItemFlag |
Bits of CommonTimelineItemHeader::flags.
| enum TimelineItemIconId |
| enum TimelineItemStatus |
Bits of CommonTimelineItemHeader::status.
| enum TimelineItemType |
| TimelineItemAction * timeline_item_action_group_find_reply_action | ( | const TimelineItemActionGroup * | action_group | ) |
Find the reply action of an action group.
| action_group | Actions to search. |
| bool timeline_item_action_is_ancs | ( | const TimelineItemAction * | action | ) |
Check whether an action is performed through ANCS.
| action | Action. |
| bool timeline_item_action_is_dismiss | ( | const TimelineItemAction * | action | ) |
Check whether an action dismisses its item.
| action | Action. |
| TimelineItem * timeline_item_copy | ( | TimelineItem * | src | ) |
Deep copy an item.
| src | Item to copy, may be NULL. |
| TimelineItem * timeline_item_create | ( | int | num_attributes, |
| int | num_actions, | ||
| uint8_t | attributes_per_action[], | ||
| size_t | required_size_for_strings, | ||
| uint8_t ** | string_buffer | ||
| ) |
Create an empty item with room for attributes, actions and strings.
The header is zeroed. Fill the attributes and actions in place and append their strings at string_buffer.
| num_attributes | Number of non-action attributes. | |
| num_actions | Number of actions. | |
| attributes_per_action | Attribute count of each action, in action order. | |
| required_size_for_strings | Total size of all attribute strings. | |
| [out] | string_buffer | Start of the string space, if not NULL. |
| bool timeline_item_create_from_serial_data | ( | TimelineItem * | item, |
| uint8_t | num_attributes, | ||
| uint8_t | num_actions, | ||
| const uint8_t * | data, | ||
| size_t | size, | ||
| size_t * | string_alloc_size, | ||
| uint8_t ** | string_buffer | ||
| ) |
Allocate an item's buffer to deserialize a payload into.
| [out] | item | Item whose attribute list, action group and buffer are set up. |
| num_attributes | Number of attributes. | |
| num_actions | Number of actions. | |
| data | Serialized payload. | |
| size | Size of data in bytes. | |
| [out] | string_alloc_size | Size of the string space. |
| [out] | string_buffer | Start of the string space. |
| TimelineItem * timeline_item_create_with_attributes | ( | time_t | timestamp, |
| uint16_t | duration, | ||
| TimelineItemType | type, | ||
| LayoutId | layout, | ||
| AttributeList * | attr_list, | ||
| TimelineItemActionGroup * | action_group | ||
| ) |
Create an item from an attribute list and action group.
The item gets a new random id. The attributes, actions and strings are deep copied into the item's buffer, so the sources may be freed afterwards.
| timestamp | Time of the item. |
| duration | Duration in minutes. |
| type | Item type. |
| layout | Layout of the item. |
| attr_list | Attributes to copy. |
| action_group | Actions to copy, may be NULL. |
| void timeline_item_deserialize_header | ( | TimelineItem * | item, |
| const SerializedTimelineItemHeader * | header | ||
| ) |
Fill an item's header and counts from a serialized header.
The timestamp of all-day and floating items is converted from local time to UTC.
| [out] | item | Item. |
| header | Serialized header. |
| bool timeline_item_deserialize_item | ( | TimelineItem * | item_out, |
| const SerializedTimelineItemHeader * | header, | ||
| const uint8_t * | payload | ||
| ) |
Deserialize an item.
| [out] | item_out | Item; its buffer is allocated on the calling task's heap. |
| header | Serialized header. | |
| payload | Serialized payload of header->payload_length bytes. |
| bool timeline_item_deserialize_payload | ( | TimelineItem * | item, |
| char * | string_buffer, | ||
| size_t | string_buffer_size, | ||
| const uint8_t * | payload, | ||
| size_t | payload_size | ||
| ) |
Deserialize attributes and actions into an item laid out for them.
| [in,out] | item | Item set up with timeline_item_create_from_serial_data(). |
| string_buffer | String space. | |
| string_buffer_size | Size of string_buffer in bytes. | |
| payload | Serialized payload. | |
| payload_size | Size of payload in bytes. |
| void timeline_item_destroy | ( | TimelineItem * | item | ) |
Free an item allocated by the functions in this group, and its buffer.
| item | Item, may be NULL. |
| TimelineItemAction * timeline_item_find_action_by_type | ( | const TimelineItem * | item, |
| TimelineItemActionType | type | ||
| ) |
Find the first action of a type.
| item | Item. |
| type | Action type. |
| const TimelineItemAction * timeline_item_find_action_with_id | ( | const TimelineItem * | item, |
| uint8_t | action_id | ||
| ) |
Find an action by id.
| item | Item. |
| action_id | Action id. |
| TimelineItemAction * timeline_item_find_dismiss_action | ( | const TimelineItem * | item | ) |
Find the first dismiss action of an item.
| item | Item. |
| TimelineItemAction * timeline_item_find_reply_action | ( | const TimelineItem * | item | ) |
Find the reply action of an item.
| item | Item. |
| void timeline_item_free_allocated_buffer | ( | TimelineItem * | item | ) |
Free an item's buffer and set it to NULL.
Pointers to attributes and actions become invalid. Suitable for items that are not themselves dynamically allocated.
| item | Item. |
| size_t timeline_item_get_serialized_payload_size | ( | TimelineItem * | item | ) |
Get the serialized size of an item's attributes and actions.
| item | Item. |
| time_t timeline_item_get_tz_timestamp | ( | CommonTimelineItemHeader * | hdr | ) |
Get the UTC timestamp of a serialized header.
All-day and floating items store local time, which is converted to UTC; other timestamps are returned unchanged.
| hdr | Header. |
| bool timeline_item_is_ancs_notif | ( | const TimelineItem * | item | ) |
Check whether an item was received through ANCS (iOS).
| item | Item. |
| void timeline_item_serialize_header | ( | TimelineItem * | item, |
| SerializedTimelineItemHeader * | header | ||
| ) |
Fill a serialized header from an item.
| item | Item. | |
| [out] | header | Serialized header, including the payload length. |
| size_t timeline_item_serialize_payload | ( | TimelineItem * | item, |
| uint8_t * | buffer, | ||
| size_t | buffer_size | ||
| ) |
Serialize the attributes and actions of an item.
| item | Item. | |
| [out] | buffer | Output buffer. |
| buffer_size | Size of buffer in bytes. |
| bool timeline_item_verify_layout_serialized | ( | const uint8_t * | val, |
| int | val_len | ||
| ) |
Check that a serialized item is well formed and has the attributes its layout requires.
| val | Serialized header and payload. |
| val_len | Length of val in bytes. |