PebbleOS
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Enumerations | Functions
item.h File Reference
#include "attribute.h"
#include "layout_layer.h"
#include <pbl/kernel/compiler.h>
#include <pbl/util/uuid.h>
#include <time.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>

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