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

System preferences exposed to the phone (BlobDBIdPrefs). More...

Functions

void prefs_db_init (void)
 Initialize the preferences database.
 
status_t prefs_db_insert (const uint8_t *key, int key_len, const uint8_t *val, int val_len)
 Insert or replace a record in the preferences database.
 
int prefs_db_get_len (const uint8_t *key, int key_len)
 Get the length of a record in the preferences database.
 
status_t prefs_db_read (const uint8_t *key, int key_len, uint8_t *val_out, int val_out_len)
 Read a record from the preferences database.
 
status_t prefs_db_delete (const uint8_t *key, int key_len)
 Delete a record from the preferences database.
 
status_t prefs_db_flush (void)
 Delete all records of the preferences database.
 

Detailed Description

System preferences exposed to the phone (BlobDBIdPrefs).

Function Documentation

◆ prefs_db_delete()

status_t prefs_db_delete ( const uint8_t *  key,
int  key_len 
)

Delete a record from the preferences database.

Not supported: always returns E_INVALID_OPERATION.

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

◆ prefs_db_flush()

status_t prefs_db_flush ( void  )

Delete all records of the preferences database.

Not supported: always returns E_INVALID_OPERATION.

Returns
S_SUCCESS on success, an error code otherwise.

◆ prefs_db_get_len()

int prefs_db_get_len ( const uint8_t *  key,
int  key_len 
)

Get the length of a record in the preferences database.

Returns E_INVALID_ARGUMENT for unknown keys.

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.

◆ prefs_db_init()

void prefs_db_init ( void  )

Initialize the preferences database.

◆ prefs_db_insert()

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

Insert or replace a record in the preferences database.

Writes the backing store of the system preferences.

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.

◆ prefs_db_read()

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

Read a record from the preferences database.

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.