PebbleOS
Loading...
Searching...
No Matches
Data Structures | Typedefs | Enumerations | Functions
api.h File Reference
#include "api_types.h"
#include <stdint.h>
#include <stdbool.h>
#include <system/status_codes.h>
#include <pbl/kernel/compiler.h>
#include <pbl/util/list.h>
#include <time.h>

Data Structures

struct  BlobDBDirtyItem
 Node of a list of records that have not been synced to the phone yet. More...
 

Typedefs

typedef void(* BlobDBInitImpl) (void)
 Initialize a database.
 
typedef status_t(* BlobDBInsertImpl) (const uint8_t *key, int key_len, const uint8_t *val, int val_len)
 Insert or replace a record.
 
typedef int(* BlobDBGetLenImpl) (const uint8_t *key, int key_len)
 Get the length of a record's value.
 
typedef status_t(* BlobDBReadImpl) (const uint8_t *key, int key_len, uint8_t *val_out, int val_len)
 Read a record's value.
 
typedef status_t(* BlobDBDeleteImpl) (const uint8_t *key, int key_len)
 Delete a record.
 
typedef status_t(* BlobDBFlushImpl) (void)
 Delete all records.
 
typedef status_t(* BlobDBIsDirtyImpl) (bool *is_dirty_out)
 Check whether the database holds records not yet synced to the phone.
 
typedef BlobDBDirtyItem *(* BlobDBGetDirtyListImpl) (void)
 Build the list of records not yet synced to the phone.
 
typedef status_t(* BlobDBMarkSyncedImpl) (const uint8_t *key, int key_len)
 Mark a record as synced.
 
typedef status_t(* BlobDBCompactImpl) (void)
 Reclaim unused space in the backing settings file.
 

Enumerations

enum  BlobDBId {
  BlobDBIdTest = 0x00 , BlobDBIdPins = 0x01 , BlobDBIdApps = 0x02 , BlobDBIdReminders = 0x03 ,
  BlobDBIdNotifs = 0x04 , BlobDBIdWeather = 0x05 , BlobDBIdiOSNotifPref = 0x06 , BlobDBIdPrefs = 0x07 ,
  BlobDBIdContacts = 0x08 , BlobDBIdWatchAppPrefs = 0x09 , BlobDBIdHealth = 0x0A , BlobDBIdAppGlance = 0x0B ,
  BlobDBIdSettings = 0x0C , NumBlobDBs
}
 Database identifiers, as sent on the wire. More...
 

Functions

void blob_db_event_put (BlobDBEventType type, BlobDBId db_id, const uint8_t *key, int key_len)
 Emit a PEBBLE_BLOBDB_EVENT.
 
void blob_db_init_dbs (void)
 Call the init callback of every database.
 
void blob_db_compact_growable_dbs (void)
 Compact every database that implements BlobDBCompactImpl.
 
void blob_db_get_dirty_dbs (uint8_t *ids, uint8_t *num_ids)
 List the databases that hold records not yet synced to the phone.
 
status_t blob_db_insert (BlobDBId db_id, const uint8_t *key, int key_len, const uint8_t *val, int val_len)
 Insert or replace a record in a database.
 
int blob_db_get_len (BlobDBId db_id, const uint8_t *key, int key_len)
 Get the length of a record's value.
 
status_t blob_db_read (BlobDBId db_id, const uint8_t *key, int key_len, uint8_t *val_out, int val_len)
 Read a record's value.
 
status_t blob_db_delete (BlobDBId db_id, const uint8_t *key, int key_len)
 Delete a record.
 
status_t blob_db_flush (BlobDBId db_id)
 Delete all records of a database.
 
BlobDBDirtyItem * blob_db_get_dirty_list (BlobDBId db_id)
 Get the records of a database that have not been synced to the phone.
 
status_t blob_db_mark_synced (BlobDBId db_id, uint8_t *key, int key_len)
 Mark a record as synced.