83typedef enum : int16_t {
115typedef enum : uint8_t {
ra8_err_t ra8_app_nav_init(ra8_app_nav_t *nav, ra8_app_registry_t *reg, uint16_t *storage, uint16_t cap)
Bind a navigation back-stack to a registry + caller-owned storage.
ra8_err_t ra8_app_launch(ra8_app_registry_t *reg, uint16_t id)
Launch (focus) the app with id, running the focus lifecycle.
ra8_err_t ra8_app_tick(ra8_app_registry_t *reg)
Run the focused app's per-frame tick (no-op if none / NULL).
ra8_err_t ra8_app_nav_back(ra8_app_nav_t *nav, bool *out_popped)
Return to the most recently pushed app (pop the back-stack).
ra8_err_t ra8_app_register(ra8_app_registry_t *reg, ra8_app_t *app)
Register an app (calls its init once) and add it to the registry.
ra8_err_t ra8_app_nav_go_index(ra8_app_nav_t *nav, uint16_t idx)
Focus the app at registry index idx (launcher select-by-position).
ra8_err_t ra8_app_nav_go(ra8_app_nav_t *nav, uint16_t id)
Focus app id, pushing the outgoing app onto the back-stack.
ra8_err_t ra8_app_count(const ra8_app_registry_t *reg, uint16_t *out_count)
Number of registered apps (for the launcher to list).
ra8_app_const_t
Sentinels for the app registry.
@ k_ra8_app_none
No active app / not found.
ra8_err_t ra8_app_state(const ra8_app_registry_t *reg, uint16_t id, ra8_app_state_t *out_state)
Report an app's lifecycle state, derived from the registry.
ra8_err_t ra8_app_find(const ra8_app_registry_t *reg, uint16_t id, int16_t *out_idx)
Find a registered app's index by id.
ra8_err_t ra8_app_at(const ra8_app_registry_t *reg, uint16_t idx, ra8_app_t **out_app)
Get the app at registry index idx (launcher enumeration).
ra8_err_t ra8_app_uninstall(ra8_app_registry_t *reg, uint16_t id)
Uninstall (unmount) a removable, non-focused app from the registry.
ra8_err_t ra8_app_route_input(ra8_app_registry_t *reg, const ra8_widget_event_t *ev, bool *out_handled)
Route an input event to the focused app.
ra8_err_t ra8_app_nav_depth(const ra8_app_nav_t *nav, uint16_t *out_depth)
Current back-stack depth (apps the user can still go back through).
ra8_err_t ra8_app_active(const ra8_app_registry_t *reg, ra8_app_t **out_app)
Get the currently focused app.
ra8_err_t ra8_app_render(ra8_app_registry_t *reg)
Run the focused app's render (on-target; no-op if none / NULL).
ra8_app_state_t
Lifecycle state of one app within the framework's state machine.
@ k_ra8_app_state_background
Mounted (init ran), not focused.
@ k_ra8_app_state_foreground
Mounted and focused (the active app).
@ k_ra8_app_state_unmounted
Not registered (initial / after uninstall).
ra8_err_t ra8_app_registry_init(ra8_app_registry_t *reg, ra8_app_t **storage, uint16_t cap)
Bind a registry to caller-owned pointer storage (empty, no focus).
Error Code Definitions for ra8-firmware.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
A bounded back-stack of app ids layered over a registry (zero-heap).
uint16_t cap
Capacity of stack.
ra8_app_registry_t * reg
Registry the navigation drives (non-NULL).
uint16_t * stack
Caller storage: back-stack of app ids.
uint16_t depth
Number of ids currently on the back-stack.
Fixed table of registered apps + the focused index.
ra8_app_t ** apps
Caller storage (array of app pointers).
int16_t active
Focused app index, or k_ra8_app_none.
uint16_t count
Registered app count.
uint16_t cap
Capacity of apps.
One app instance + its metadata (caller-owned, static).
App lifecycle callbacks (shared by all instances of one app).
void(* deinit)(struct ra8_app *a)
Teardown.
void(* on_enter)(struct ra8_app *a)
Gained focus / foreground.
void(* render)(const struct ra8_app *a)
Draw (on-target, foreground).
void(* tick)(struct ra8_app *a)
Per-frame update (foreground).
void(* on_leave)(struct ra8_app *a)
Lost focus / background.
ra8_err_t(* init)(struct ra8_app *a)
One-time setup (at register).
bool(* on_input)(struct ra8_app *a, const ra8_widget_event_t *ev)
Handle.
void * ctx
App-specific state.
const char * name
Display name for the launcher.
uint16_t id
Unique app id (launch key).
bool removable
Optional/uninstallable core?
bool initialized
Set true once init succeeded.
const ra8_app_vtable_t * vt
Lifecycle table (non-NULL).