|
PebbleOS
|
Contacts (BlobDBIdContacts), keyed by contact UUID. More...
Data Structures | |
| struct | SerializedContact |
| Serialized contact, the value of a contacts database record. More... | |
Functions | |
| int | contacts_db_get_serialized_contact (const Uuid *uuid, SerializedContact **contact_out) |
| Read the serialized record of a contact. | |
| void | contacts_db_free_serialized_contact (SerializedContact *contact) |
| Free a record returned by contacts_db_get_serialized_contact(). | |
| void | contacts_db_init (void) |
| Initialize the contacts database. | |
| status_t | contacts_db_insert (const uint8_t *key, int key_len, const uint8_t *val, int val_len) |
| Insert or replace a record in the contacts database. | |
| int | contacts_db_get_len (const uint8_t *key, int key_len) |
| Get the length of a record in the contacts database. | |
| status_t | contacts_db_read (const uint8_t *key, int key_len, uint8_t *val_out, int val_out_len) |
| Read a record from the contacts database. | |
| status_t | contacts_db_delete (const uint8_t *key, int key_len) |
| Delete a record from the contacts database. | |
| status_t | contacts_db_flush (void) |
| Delete all records of the contacts database. | |
| status_t | contacts_db_compact (void) |
| Compact the settings file backing the contacts database. | |
Contacts (BlobDBIdContacts), keyed by contact UUID.
| struct SerializedContact |
Serialized contact, the value of a contacts database record.
| Data Fields | ||
|---|---|---|
| uint8_t | data[] | Serialized attributes followed by serialized addresses. |
| uint32_t | flags | Contact flags. |
| uint8_t | num_addresses | Number of serialized addresses in data. |
| uint8_t | num_attributes | Number of serialized attributes in data. |
| Uuid | uuid | Contact UUID. |
| status_t contacts_db_compact | ( | void | ) |
Compact the settings file backing the contacts database.
S_SUCCESS on success, an error code otherwise. | status_t contacts_db_delete | ( | const uint8_t * | key, |
| int | key_len | ||
| ) |
Delete a record from the contacts database.
The key is the contact UUID.
| key | Key data. |
| key_len | Length of key in bytes. |
S_SUCCESS on success, an error code otherwise. | status_t contacts_db_flush | ( | void | ) |
Delete all records of the contacts database.
S_SUCCESS on success, an error code otherwise. | void contacts_db_free_serialized_contact | ( | SerializedContact * | contact | ) |
Free a record returned by contacts_db_get_serialized_contact().
| contact | Record to free. |
| int contacts_db_get_len | ( | const uint8_t * | key, |
| int | key_len | ||
| ) |
Get the length of a record in the contacts database.
The key is the contact UUID.
| key | Key data. |
| key_len | Length of key in bytes. |
| int contacts_db_get_serialized_contact | ( | const Uuid * | uuid, |
| SerializedContact ** | contact_out | ||
| ) |
Read the serialized record of a contact.
Meant for the contacts service; other callers likely want contacts_get_contact_by_uuid().
| uuid | Contact UUID. | |
| [out] | contact_out | Task heap allocated record, NULL if not found. Free it with contacts_db_free_serialized_contact(). |
| void contacts_db_init | ( | void | ) |
Initialize the contacts database.
| status_t contacts_db_insert | ( | const uint8_t * | key, |
| int | key_len, | ||
| const uint8_t * | val, | ||
| int | val_len | ||
| ) |
Insert or replace a record in the contacts database.
The key is the contact UUID and the value a SerializedContact.
| key | Key data. |
| key_len | Length of key in bytes. |
| val | Value data. |
| val_len | Length of val in bytes. |
S_SUCCESS on success, an error code otherwise. | status_t contacts_db_read | ( | const uint8_t * | key, |
| int | key_len, | ||
| uint8_t * | val_out, | ||
| int | val_out_len | ||
| ) |
Read a record from the contacts database.
The key is the contact UUID.
| key | Key data. | |
| key_len | Length of key in bytes. | |
| [out] | val_out | Buffer for the value. |
| val_out_len | Size of val_out in bytes. |
S_SUCCESS on success, an error code otherwise.