PebbleOS
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Enumerations | Functions
Timeline items

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.
 

Enumerations

enum  TimelineItemStatus {
  TimelineItemStatusRead = 1 << 0 , TimelineItemStatusDeleted = 1 << 1 , TimelineItemStatusActioned = 1 << 2 , TimelineItemStatusReminded = 1 << 3 ,
  TimelineItemStatusDismissed = 1 << 4 , TimelineItemStatusUnused = ~((1 << 5) - 1)
}
 Bits of CommonTimelineItemHeader::status. More...
 
enum  TimelineItemFlag {
  TimelineItemFlagVisible = 1 << 0 , TimelineItemFlagFloating = 1 << 1 , TimelineItemFlagAllDay = 1 << 2 , TimelineItemFlagFromWatch = 1 << 3 ,
  TimelineItemFlagFromANCS = 1 << 4 , TimelineItemFlagPersistent = 1 << 5 , TimelineItemFlagUnused = ~((1 << 6) - 1)
}
 Bits of CommonTimelineItemHeader::flags. More...
 
enum  TimelineItemActionType {
  TimelineItemActionTypeUnknown = 0x00 , TimelineItemActionTypeAncsNegative = 0x01 , TimelineItemActionTypeGeneric = 0x02 , TimelineItemActionTypeResponse = 0x03 ,
  TimelineItemActionTypeDismiss = 0x04 , TimelineItemActionTypeHttp = 0x05 , TimelineItemActionTypeSnooze = 0x06 , TimelineItemActionTypeOpenWatchApp = 0x07 ,
  TimelineItemActionTypeEmpty = 0x08 , TimelineItemActionTypeRemove = 0x09 , TimelineItemActionTypeOpenPin = 0x0A , TimelineItemActionTypeAncsPositive = 0x0B ,
  TimelineItemActionTypeAncsDial = 0x0C , TimelineItemActionTypeAncsResponse = 0x0D , TimelineItemActionTypeInsightResponse = 0x0E , TimelineItemActionTypeAncsDelete = 0x0F ,
  TimelineItemActionTypeComplete = 0x10 , TimelineItemActionTypePostpone = 0x11 , TimelineItemActionTypeRemoteRemove = 0x12 , TimelineItemActionTypeAncsGeneric = 0x13 ,
  TimelineItemActionTypeBLEHRMStopSharing = 0x14
}
 Types of actions, as used on the wire. More...
 
enum  TimelineItemIconId {
  TimelineItemIconIdCrossmark = 1 , TimelineItemIconIdCheckmark , TimelineItemIconIdSentMail , TimelineItemIconIdSentMessage ,
  TimelineItemIconIdPhoneCheckmark
}
 Identifiers of icons in the resource pack. More...
 
enum  TimelineItemType {
  TimelineItemTypeUnknown = 0 , TimelineItemTypeNotification , TimelineItemTypePin , TimelineItemTypeReminder ,
  TimelineItemTypeOutOfRange
}
 Types of timeline items. More...
 

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).
 

Detailed Description

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:

AttributeList attr_list = {0};
attribute_list_add_cstring(&attr_list, AttributeIdBody, "45 min run");
TIMELINE_RESOURCE_TIMELINE_SPORTS);
AttributeList open_attrs = {0};
TimelineItemActionGroup action_group = {
.actions = (TimelineItemAction[]){
{.id = 0, .type = TimelineItemActionTypeOpenWatchApp, .attr_list = open_attrs},
},
};
start, 45, TimelineItemTypePin, LayoutIdGeneric, &attr_list, &action_group);
if (pin) {
pin->header.parent_id = app_uuid;
pin->header.from_watch = true;
}
List of attributes.
Definition attribute.h:234
void attribute_list_add_cstring(AttributeList *list, AttributeId id, const char *cstring)
Add a string attribute, or replace the value of an existing one.
void attribute_list_add_uint32(AttributeList *list, AttributeId id, uint32_t uint32)
Add a uint32 attribute, or replace the value of an existing one.
void attribute_list_add_resource_id(AttributeList *list, AttributeId id, uint32_t resource_id)
Add a resource id attribute, or replace the value of an existing one.
void attribute_list_destroy_list(AttributeList *list)
Free the attributes array of a list.
@ AttributeIdLaunchCode
(uint32) Launch code passed to the app by an open watch app action.
Definition attribute.h:106
@ AttributeIdTitle
(string) Title shown in a detailed view, at most 64 bytes.
Definition attribute.h:82
@ AttributeIdBody
(string) Body text of the view, at most 512 bytes.
Definition attribute.h:86
@ AttributeIdIconPin
(resource id) Icon shown for the pin in the timeline.
Definition attribute.h:100
CommonTimelineItemHeader header
Common header.
Definition item.h:282
uint8_t num_actions
Number of actions.
Definition item.h:192
Action of a timeline item.
Definition item.h:180
Actions of a timeline item.
Definition item.h:190
A reminder, notification or pin.
Definition item.h:280
void timeline_item_destroy(TimelineItem *item)
Free an item allocated by the functions in this group, and its buffer.
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.
@ TimelineItemTypePin
Timeline pin.
Definition item.h:172
@ TimelineItemActionTypeOpenWatchApp
Open the parent watch app with the AttributeIdLaunchCode launch code.
Definition item.h:122
@ LayoutIdGeneric
Generic pin; requires a title.
Definition layout_layer.h:62
bool timeline_add(TimelineItem *item)
Add a pin created on the watch to the Pins database.

Data Structure Documentation

◆ TimelineItemAction

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.

◆ TimelineItemActionGroup

struct TimelineItemActionGroup

Actions of a timeline item.

Data Fields
TimelineItemAction * actions Actions.
uint8_t num_actions Number of actions.

◆ CommonTimelineItemHeader

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.

◆ TimelineItem

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.

◆ SerializedTimelineItemHeader

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.

◆ CommonTimelineItemHeader.__unnamed87__

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.

◆ CommonTimelineItemHeader.__unnamed89__

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.

◆ CommonTimelineItemHeader.__unnamed89__.__unnamed93__

struct CommonTimelineItemHeader.__unnamed89__.__unnamed93__

Individual flags.

Data Fields
uint8_t all_day: 1 The item is an all-day event; its timestamp should be at midnight.
uint8_t ancs_notif: 1 The notification was received through ANCS (iOS).
uint8_t from_watch: 1 The item was added by the watch and should not be flushed.
uint8_t is_floating: 1 The item is in floating time (local wall-clock time).
uint8_t visible: 1 The item is visible.

◆ CommonTimelineItemHeader.__unnamed91__

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.

◆ CommonTimelineItemHeader.__unnamed91__.__unnamed95__

struct CommonTimelineItemHeader.__unnamed91__.__unnamed95__

Individual status bits.

Data Fields
uint8_t actioned: 1 The item has been actioned on.
uint8_t deleted: 1 The item has been deleted.
uint8_t dismissed: 1 The item has been dismissed.
uint8_t persistent: 1 The item stays in Timeline Peek for its whole duration.
uint8_t read: 1 The item has been read (notifications only).
uint8_t reminded: 1 The reminder has been shown.

Macro Definition Documentation

◆ MAX_PIN_TITLE_LENGTH

#define MAX_PIN_TITLE_LENGTH   (50)

Maximum length of a pin title, in bytes.

◆ TIMELINE_INVALID_ACTION_ID

#define TIMELINE_INVALID_ACTION_ID   (0xFF)

Action id meaning "no action".

Typedef Documentation

◆ TimelineItemId

Id of a timeline item.

Enumeration Type Documentation

◆ TimelineItemActionType

Types of actions, as used on the wire.

Enumerator
TimelineItemActionTypeUnknown 

Unknown action.

TimelineItemActionTypeAncsNegative 

ANCS negative action, formerly ANCS dismiss.

TimelineItemActionTypeGeneric 

Generic action executed by the phone.

TimelineItemActionTypeResponse 

Reply with canned responses, voice or emoji, sent by the phone.

TimelineItemActionTypeDismiss 

Dismiss; handled locally for items that the phone does not track.

TimelineItemActionTypeHttp 

HTTP request made by the phone.

TimelineItemActionTypeSnooze 

Snooze a reminder.

TimelineItemActionTypeOpenWatchApp 

Open the parent watch app with the AttributeIdLaunchCode launch code.

TimelineItemActionTypeEmpty 

Placeholder with no effect.

TimelineItemActionTypeRemove 

Remove the pin; done locally for pins added by the watch.

TimelineItemActionTypeOpenPin 

Open the parent pin.

TimelineItemActionTypeAncsPositive 

ANCS positive action.

TimelineItemActionTypeAncsDial 

Call back the caller of an ANCS notification.

TimelineItemActionTypeAncsResponse 

Reply to an ANCS notification through the phone app.

TimelineItemActionTypeInsightResponse 

Response to a health insight.

TimelineItemActionTypeAncsDelete 

ANCS delete action.

TimelineItemActionTypeComplete 

Mark the item as completed, executed by the phone.

TimelineItemActionTypePostpone 

Postpone the item, executed by the phone.

TimelineItemActionTypeRemoteRemove 

Remove the item, executed by the phone.

TimelineItemActionTypeAncsGeneric 

Generic ANCS action executed by the phone app.

TimelineItemActionTypeBLEHRMStopSharing 

Stop sharing heart rate with BLE HRM clients.

◆ TimelineItemFlag

Bits of CommonTimelineItemHeader::flags.

Enumerator
TimelineItemFlagVisible 

The item is visible.

TimelineItemFlagFloating 

The item is in floating time (local wall-clock time).

TimelineItemFlagAllDay 

The item is an all-day event.

TimelineItemFlagFromWatch 

The item was added by the watch.

TimelineItemFlagFromANCS 

The notification came from ANCS.

TimelineItemFlagPersistent 

The item stays in Timeline Peek for its whole duration.

TimelineItemFlagUnused 

Mask of the bits not covered above.

◆ TimelineItemIconId

Identifiers of icons in the resource pack.

Enumerator
TimelineItemIconIdCrossmark 

Cross mark.

TimelineItemIconIdCheckmark 

Check mark.

TimelineItemIconIdSentMail 

Sent mail.

TimelineItemIconIdSentMessage 

Sent message.

TimelineItemIconIdPhoneCheckmark 

Phone with a check mark.

◆ TimelineItemStatus

Bits of CommonTimelineItemHeader::status.

Enumerator
TimelineItemStatusRead 

The item has been read.

TimelineItemStatusDeleted 

The item has been deleted.

TimelineItemStatusActioned 

The item has been actioned on.

TimelineItemStatusReminded 

The reminder has been shown.

TimelineItemStatusDismissed 

The item has been dismissed.

TimelineItemStatusUnused 

Mask of the bits not covered above; set bits mark a corrupt stored header.

◆ TimelineItemType

Types of timeline items.

Enumerator
TimelineItemTypeUnknown 

Unknown type.

TimelineItemTypeNotification 

Notification.

TimelineItemTypePin 

Timeline pin.

TimelineItemTypeReminder 

Reminder; its parent is a pin.

TimelineItemTypeOutOfRange 

First invalid value.

Function Documentation

◆ timeline_item_action_group_find_reply_action()

TimelineItemAction * timeline_item_action_group_find_reply_action ( const TimelineItemActionGroup *  action_group)

Find the reply action of an action group.

Parameters
action_groupActions to search.
Returns
Response or ANCS response action, or NULL if not found.

◆ timeline_item_action_is_ancs()

bool timeline_item_action_is_ancs ( const TimelineItemAction *  action)

Check whether an action is performed through ANCS.

Parameters
actionAction.
Returns
true for ANCS negative, positive, delete and dial actions.

◆ timeline_item_action_is_dismiss()

bool timeline_item_action_is_dismiss ( const TimelineItemAction *  action)

Check whether an action dismisses its item.

Parameters
actionAction.
Returns
true for dismiss and ANCS negative actions.

◆ timeline_item_copy()

TimelineItem * timeline_item_copy ( TimelineItem *  src)

Deep copy an item.

Parameters
srcItem to copy, may be NULL.
Returns
Copy allocated on the calling task's heap, or NULL.

◆ timeline_item_create()

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.

Parameters
num_attributesNumber of non-action attributes.
num_actionsNumber of actions.
attributes_per_actionAttribute count of each action, in action order.
required_size_for_stringsTotal size of all attribute strings.
[out]string_bufferStart of the string space, if not NULL.
Returns
Item allocated on the calling task's heap, or NULL if out of memory.

◆ timeline_item_create_from_serial_data()

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.

Parameters
[out]itemItem whose attribute list, action group and buffer are set up.
num_attributesNumber of attributes.
num_actionsNumber of actions.
dataSerialized payload.
sizeSize of data in bytes.
[out]string_alloc_sizeSize of the string space.
[out]string_bufferStart of the string space.
Returns
false on a parse error or if out of memory.

◆ timeline_item_create_with_attributes()

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.

Parameters
timestampTime of the item.
durationDuration in minutes.
typeItem type.
layoutLayout of the item.
attr_listAttributes to copy.
action_groupActions to copy, may be NULL.
Returns
Item allocated on the calling task's heap, or NULL if the copy failed. Free it with timeline_item_destroy().

◆ timeline_item_deserialize_header()

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.

Parameters
[out]itemItem.
headerSerialized header.

◆ timeline_item_deserialize_item()

bool timeline_item_deserialize_item ( TimelineItem *  item_out,
const SerializedTimelineItemHeader *  header,
const uint8_t *  payload 
)

Deserialize an item.

Parameters
[out]item_outItem; its buffer is allocated on the calling task's heap.
headerSerialized header.
payloadSerialized payload of header->payload_length bytes.
Returns
true on success.

◆ timeline_item_deserialize_payload()

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.

Parameters
[in,out]itemItem set up with timeline_item_create_from_serial_data().
string_bufferString space.
string_buffer_sizeSize of string_buffer in bytes.
payloadSerialized payload.
payload_sizeSize of payload in bytes.
Returns
true on success.

◆ timeline_item_destroy()

void timeline_item_destroy ( TimelineItem *  item)

Free an item allocated by the functions in this group, and its buffer.

Parameters
itemItem, may be NULL.

◆ timeline_item_find_action_by_type()

TimelineItemAction * timeline_item_find_action_by_type ( const TimelineItem *  item,
TimelineItemActionType  type 
)

Find the first action of a type.

Parameters
itemItem.
typeAction type.
Returns
Action, or NULL if not found or the item id is invalid.

◆ timeline_item_find_action_with_id()

const TimelineItemAction * timeline_item_find_action_with_id ( const TimelineItem *  item,
uint8_t  action_id 
)

Find an action by id.

Parameters
itemItem.
action_idAction id.
Returns
Action, or NULL if not found or the item id is invalid.

◆ timeline_item_find_dismiss_action()

TimelineItemAction * timeline_item_find_dismiss_action ( const TimelineItem *  item)

Find the first dismiss action of an item.

Parameters
itemItem.
Returns
Dismiss or ANCS negative action, or NULL if not found or the item id is invalid.

◆ timeline_item_find_reply_action()

TimelineItemAction * timeline_item_find_reply_action ( const TimelineItem *  item)

Find the reply action of an item.

Parameters
itemItem.
Returns
Response or ANCS response action, or NULL if not found or the item id is invalid.

◆ timeline_item_free_allocated_buffer()

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.

Parameters
itemItem.

◆ timeline_item_get_serialized_payload_size()

size_t timeline_item_get_serialized_payload_size ( TimelineItem *  item)

Get the serialized size of an item's attributes and actions.

Parameters
itemItem.
Returns
Size in bytes.

◆ timeline_item_get_tz_timestamp()

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.

Parameters
hdrHeader.
Returns
UTC timestamp.

◆ timeline_item_is_ancs_notif()

bool timeline_item_is_ancs_notif ( const TimelineItem *  item)

Check whether an item was received through ANCS (iOS).

Parameters
itemItem.
Returns
true if it came from ANCS.

◆ timeline_item_serialize_header()

void timeline_item_serialize_header ( TimelineItem *  item,
SerializedTimelineItemHeader *  header 
)

Fill a serialized header from an item.

Parameters
itemItem.
[out]headerSerialized header, including the payload length.

◆ timeline_item_serialize_payload()

size_t timeline_item_serialize_payload ( TimelineItem *  item,
uint8_t *  buffer,
size_t  buffer_size 
)

Serialize the attributes and actions of an item.

Parameters
itemItem.
[out]bufferOutput buffer.
buffer_sizeSize of buffer in bytes.
Returns
Number of bytes written.

◆ timeline_item_verify_layout_serialized()

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.

Parameters
valSerialized header and payload.
val_lenLength of val in bytes.
Returns
true if valid.