PebbleOS
Loading...
Searching...
No Matches
Functions
Reminder database

Timeline reminders (BlobDBIdReminders), keyed by reminder UUID. More...

Functions

status_t reminder_db_read_item (TimelineItem *item_out, TimelineItemId *id)
 Read and deserialize a reminder.
 
status_t reminder_db_next_item_header (TimelineItem *next_item_out)
 Read the header of the earliest reminder that has not fired yet.
 
status_t reminder_db_insert_item (TimelineItem *item)
 Serialize and insert a reminder created on the watch.
 
status_t reminder_db_delete_item (const TimelineItemId *id, bool send_event)
 Delete a reminder.
 
status_t reminder_db_delete_with_parent (const TimelineItemId *parent_id)
 Delete the reminders of a parent pin.
 
bool reminder_db_is_empty (void)
 Check whether the reminder database is empty.
 
status_t reminder_db_set_status_bits (const TimelineItemId *id, uint8_t status)
 Overwrite the status bits of a reminder.
 
bool reminder_db_find_by_timestamp_title (time_t timestamp, const char *title, TimelineItemStorageFilterCallback filter, TimelineItem *reminder_out)
 Find a reminder with a given time and title.
 
void reminder_db_init (void)
 Initialize the reminder database.
 
void reminder_db_deinit (void)
 Close the settings file backing the reminder database.
 
status_t reminder_db_insert (const uint8_t *key, int key_len, const uint8_t *val, int val_len)
 Insert or replace a record in the reminder database.
 
int reminder_db_get_len (const uint8_t *key, int key_len)
 Get the length of a record in the reminder database.
 
status_t reminder_db_read (const uint8_t *key, int key_len, uint8_t *val_out, int val_out_len)
 Read a record from the reminder database.
 
status_t reminder_db_delete (const uint8_t *key, int key_len)
 Delete a record from the reminder database.
 
status_t reminder_db_flush (void)
 Delete all records of the reminder database.
 
status_t reminder_db_compact (void)
 Compact the settings file backing the reminder database.
 
status_t reminder_db_is_dirty (bool *is_dirty_out)
 Check whether the reminder database holds records not yet synced to the phone.
 
BlobDBDirtyItem * reminder_db_get_dirty_list (void)
 Build the list of records of the reminder database not yet synced to the phone.
 
status_t reminder_db_mark_synced (const uint8_t *key, int key_len)
 Mark a record of the reminder database as synced.
 

Detailed Description

Timeline reminders (BlobDBIdReminders), keyed by reminder UUID.

Backed by Timeline item storage. Reminders more than 15 minutes in the past are rejected.

Function Documentation

◆ reminder_db_compact()

status_t reminder_db_compact ( void  )

Compact the settings file backing the reminder database.

Returns
S_SUCCESS on success, an error code otherwise.

◆ reminder_db_deinit()

void reminder_db_deinit ( void  )

Close the settings file backing the reminder database.

◆ reminder_db_delete()

status_t reminder_db_delete ( const uint8_t *  key,
int  key_len 
)

Delete a record from the reminder database.

The key is the reminder UUID. Notifies the reminders service.

Parameters
keyKey data.
key_lenLength of key in bytes.
Returns
S_SUCCESS on success, an error code otherwise.

◆ reminder_db_delete_item()

status_t reminder_db_delete_item ( const TimelineItemId *  id,
bool  send_event 
)

Delete a reminder.

Parameters
idReminder UUID.
send_eventIf true, also notify the reminders service as reminder_db_delete() does.
Returns
S_SUCCESS on success, an error code otherwise.

◆ reminder_db_delete_with_parent()

status_t reminder_db_delete_with_parent ( const TimelineItemId *  parent_id)

Delete the reminders of a parent pin.

Parameters
parent_idParent pin UUID.
Returns
S_SUCCESS if all reminders were deleted, an error code otherwise.

◆ reminder_db_find_by_timestamp_title()

bool reminder_db_find_by_timestamp_title ( time_t  timestamp,
const char *  title,
TimelineItemStorageFilterCallback  filter,
TimelineItem *  reminder_out 
)

Find a reminder with a given time and title.

Parameters
timestampTime to match.
titleTitle to match.
filterOptional additional filter, returns false to reject a candidate.
[out]reminder_outMatching reminder, valid only when true is returned; free its buffer with timeline_item_free_allocated_buffer(). Must not be NULL.
Returns
true if a matching reminder was found.

◆ reminder_db_flush()

status_t reminder_db_flush ( void  )

Delete all records of the reminder database.

Reminders created on the watch are kept.

Returns
S_SUCCESS on success, an error code otherwise.

◆ reminder_db_get_dirty_list()

BlobDBDirtyItem * reminder_db_get_dirty_list ( void  )

Build the list of records of the reminder database not yet synced to the phone.

Returns
Heap-allocated list (free with blob_db_util_free_dirty_list()), NULL if none.

◆ reminder_db_get_len()

int reminder_db_get_len ( const uint8_t *  key,
int  key_len 
)

Get the length of a record in the reminder database.

The key is the reminder UUID.

Parameters
keyKey data.
key_lenLength of key in bytes.
Returns
Length of the value in bytes, 0 if not found, or a negative error code.

◆ reminder_db_init()

void reminder_db_init ( void  )

Initialize the reminder database.

Also initializes the reminders service.

◆ reminder_db_insert()

status_t reminder_db_insert ( const uint8_t *  key,
int  key_len,
const uint8_t *  val,
int  val_len 
)

Insert or replace a record in the reminder database.

The key is the reminder UUID and the value a serialized timeline item. Records from the phone are stored as synced. Updates the reminder timer.

Parameters
keyKey data.
key_lenLength of key in bytes.
valValue data.
val_lenLength of val in bytes.
Returns
S_SUCCESS on success, an error code otherwise.

◆ reminder_db_insert_item()

status_t reminder_db_insert_item ( TimelineItem *  item)

Serialize and insert a reminder created on the watch.

The record is marked dirty and synced to the phone.

Parameters
itemReminder, of type TimelineItemTypeReminder.
Returns
S_SUCCESS on success, an error code otherwise.

◆ reminder_db_is_dirty()

status_t reminder_db_is_dirty ( bool *  is_dirty_out)

Check whether the reminder database holds records not yet synced to the phone.

Parameters
[out]is_dirty_outSet to true if at least one record is dirty.
Returns
S_SUCCESS on success, an error code otherwise.

◆ reminder_db_is_empty()

bool reminder_db_is_empty ( void  )

Check whether the reminder database is empty.

Returns
true if there are no reminders.

◆ reminder_db_mark_synced()

status_t reminder_db_mark_synced ( const uint8_t *  key,
int  key_len 
)

Mark a record of the reminder database as synced.

The key is the reminder UUID.

Parameters
keyKey data.
key_lenLength of key in bytes.
Returns
S_SUCCESS on success, an error code otherwise.

◆ reminder_db_next_item_header()

status_t reminder_db_next_item_header ( TimelineItem *  next_item_out)

Read the header of the earliest reminder that has not fired yet.

Parameters
[out]next_item_outItem with only the header filled in.
Return values
S_SUCCESSFound.
S_NO_MORE_ITEMSNo pending reminder.
Returns
Other error codes on failure.

◆ reminder_db_read()

status_t reminder_db_read ( const uint8_t *  key,
int  key_len,
uint8_t *  val_out,
int  val_out_len 
)

Read a record from the reminder database.

The key is the reminder UUID.

Parameters
keyKey data.
key_lenLength of key in bytes.
[out]val_outBuffer for the value.
val_out_lenSize of val_out in bytes.
Returns
S_SUCCESS on success, an error code otherwise.

◆ reminder_db_read_item()

status_t reminder_db_read_item ( TimelineItem *  item_out,
TimelineItemId *  id 
)

Read and deserialize a reminder.

Parameters
[out]item_outReminder; free its buffer with timeline_item_free_allocated_buffer().
idReminder UUID.
Return values
S_SUCCESSRead.
E_DOES_NOT_EXISTNo such reminder.
Returns
Other error codes on failure.

◆ reminder_db_set_status_bits()

status_t reminder_db_set_status_bits ( const TimelineItemId *  id,
uint8_t  status 
)

Overwrite the status bits of a reminder.

Parameters
idReminder UUID.
statusNew status bits.
Returns
S_SUCCESS on success, an error code otherwise.