PebbleOS v4.47.0-512-g5285d4236
Loading...
Searching...
No Matches
Preferences database

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

Functions

void prefs_db_init (void)
 Initialize the preferences database.
 
int 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.
 
int 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.
 
int prefs_db_delete (const uint8_t *key, int key_len)
 Delete a record from the preferences database.
 
int 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()

int prefs_db_delete ( const uint8_t *  key,
int  key_len 
)

Delete a record from the preferences database.

Not supported: always returns -ENOTSUP.

Parameters
keyKey data.
key_lenLength of key in bytes.
Returns
0 on success, a negative errno otherwise.

◆ prefs_db_flush()

int prefs_db_flush ( void  )

Delete all records of the preferences database.

Not supported: always returns -ENOTSUP.

Returns
0 on success, a negative errno 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 -EINVAL 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 errno.

◆ prefs_db_init()

void prefs_db_init ( void  )

Initialize the preferences database.

◆ prefs_db_insert()

int 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
0 on success, a negative errno otherwise.

◆ prefs_db_read()

int 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
0 on success, a negative errno otherwise.