PebbleOS
Loading...
Searching...
No Matches
Data Structures | Typedefs | Functions
App database

Installed apps (BlobDBIdApps). More...

Data Structures

struct  AppDBEntry
 App database record, as sent by the phone. More...
 

Typedefs

typedef void(* AppDBEnumerateCb) (AppInstallId install_id, AppDBEntry *entry, void *data)
 Callback of app_db_enumerate_entries().
 

Functions

AppInstallId app_db_get_install_id_for_uuid (const Uuid *uuid)
 Find the install id of an app.
 
status_t app_db_get_app_entry_for_uuid (const Uuid *uuid, AppDBEntry *entry)
 Read the record of an app by UUID.
 
status_t app_db_get_app_entry_for_install_id (AppInstallId app_id, AppDBEntry *entry)
 Read the record of an app by install id.
 
void app_db_enumerate_entries (AppDBEnumerateCb cb, void *data)
 Call a function for every app in the database.
 
bool app_db_exists_install_id (AppInstallId app_id)
 Check whether an install id is in the database.
 
void app_db_init (void)
 Initialize the app database.
 
status_t app_db_insert (const uint8_t *key, int key_len, const uint8_t *val, int val_len)
 Insert or replace a record in the app database.
 
int app_db_get_len (const uint8_t *key, int key_len)
 Get the length of a record in the app database.
 
status_t app_db_read (const uint8_t *key, int key_len, uint8_t *val_out, int val_out_len)
 Read a record from the app database.
 
status_t app_db_delete (const uint8_t *key, int key_len)
 Delete a record from the app database.
 
status_t app_db_flush (void)
 Delete all records of the app database.
 
status_t app_db_compact (void)
 Compact the settings file backing the app database.
 
AppInstallId app_db_check_next_unique_id (void)
 Get the next install id to be assigned, for tests.
 

Detailed Description

Installed apps (BlobDBIdApps).

Records are keyed by app UUID on the wire and stored keyed by AppInstallId.


Data Structure Documentation

◆ AppDBEntry

struct AppDBEntry

App database record, as sent by the phone.

Data Fields
GColor8 app_face_bg_color Background color of the app face.
Version app_version App version.
uint32_t icon_resource_id Resource id of the app icon.
uint32_t info_flags Process info flags (visibility, process type, worker), as in the app binary.
char name[APP_NAME_SIZE_BYTES] App name.
Version sdk_version SDK version the app was built with.
uint8_t template_id Template id, unused by the firmware.
Uuid uuid App UUID.

Typedef Documentation

◆ AppDBEnumerateCb

typedef void(* AppDBEnumerateCb) (AppInstallId install_id, AppDBEntry *entry, void *data)

Callback of app_db_enumerate_entries().

Parameters
install_idInstall id of the app.
entryRecord; only valid during the call.
dataUser data.

Function Documentation

◆ app_db_check_next_unique_id()

AppInstallId app_db_check_next_unique_id ( void  )

Get the next install id to be assigned, for tests.

Returns
Install id.

◆ app_db_compact()

status_t app_db_compact ( void  )

Compact the settings file backing the app database.

Returns
S_SUCCESS on success, an error code otherwise.

◆ app_db_delete()

status_t app_db_delete ( const uint8_t *  key,
int  key_len 
)

Delete a record from the app database.

The key is the app UUID. Notifies the app install manager.

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

◆ app_db_enumerate_entries()

void app_db_enumerate_entries ( AppDBEnumerateCb  cb,
void *  data 
)

Call a function for every app in the database.

The database is locked during the iteration.

Parameters
cbCallback.
dataUser data passed to cb.

◆ app_db_exists_install_id()

bool app_db_exists_install_id ( AppInstallId  app_id)

Check whether an install id is in the database.

Parameters
app_idInstall id.
Returns
true if it exists.

◆ app_db_flush()

status_t app_db_flush ( void  )

Delete all records of the app database.

Also cancels any app fetch and clears the app install manager state.

Returns
S_SUCCESS on success, an error code otherwise.

◆ app_db_get_app_entry_for_install_id()

status_t app_db_get_app_entry_for_install_id ( AppInstallId  app_id,
AppDBEntry *  entry 
)

Read the record of an app by install id.

Parameters
app_idInstall id.
[out]entryRecord.
Returns
S_SUCCESS on success, an error code otherwise.

◆ app_db_get_app_entry_for_uuid()

status_t app_db_get_app_entry_for_uuid ( const Uuid *  uuid,
AppDBEntry *  entry 
)

Read the record of an app by UUID.

Parameters
uuidApp UUID.
[out]entryRecord.
Returns
S_SUCCESS on success, an error code otherwise.

◆ app_db_get_install_id_for_uuid()

AppInstallId app_db_get_install_id_for_uuid ( const Uuid *  uuid)

Find the install id of an app.

Parameters
uuidApp UUID.
Returns
Install id, INSTALL_ID_INVALID if the app is not in the database, or a negative error code if the database could not be opened.

◆ app_db_get_len()

int app_db_get_len ( const uint8_t *  key,
int  key_len 
)

Get the length of a record in the app database.

The key is the app 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.

◆ app_db_init()

void app_db_init ( void  )

Initialize the app database.

Scans the database to pick the next unused install id.

◆ app_db_insert()

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

Insert or replace a record in the app database.

The key is the app UUID and the value an AppDBEntry. A new app gets the next unused install id; an existing one keeps its id, and an in-progress fetch of it is cancelled. Notifies the app install manager.

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.

◆ app_db_read()

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

Read a record from the app database.

The key is the app 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.