|
Ersa Wearable Platform
Embedded smartwatch firmware and application framework
|
#include <application_manager.h>

Public Member Functions | |
| ApplicationManager () | |
| bool | registerApp (Application *app) |
| bool | switchTo (const char *appId) |
| bool | switchTo (size_t index) |
| Application * | getActiveApp () const |
| size_t | getAppCount () const |
| Application * | getApp (size_t index) const |
| bool | handleEvent (const events::Event &event) |
| void | markDirty (bool fullRefresh=false) |
| void | clearDirty () |
| bool | isDirty () const |
| bool | isFullRefreshNeeded () const |
| bool | isAppSwitched () const |
| void | clearAppSwitched () |
| void | render (hal::IDisplay &display) |
| void | tick () |
Static Public Member Functions | |
| static ApplicationManager & | instance () |
Static Public Attributes | |
| static constexpr size_t | MAX_APPS = 16 |
Private Attributes | |
| Application * | apps_ [MAX_APPS] |
| size_t | appCount_ {0} |
| Application * | activeApp_ {nullptr} |
| bool | dirty_ {true} |
| bool | fullRefreshNeeded_ {true} |
| bool | appSwitched_ {true} |
| uint32_t | lastRenderTime_ {0} |
Owns the fixed-capacity registry and foreground state for firmware apps.
Apps are registered as static C++ objects at startup. The manager does not load binaries or allocate app packages at runtime; a bounded registry keeps memory use predictable on the microcontroller. It centralizes lifecycle and dirty-screen state so individual apps do not manage panel refresh policy.
| ersa::app::ApplicationManager::ApplicationManager | ( | ) |
Construct an empty registry with no active application.
| void ersa::app::ApplicationManager::clearAppSwitched | ( | ) |
Clear the app-switch notification after navigation effects are handled.
| void ersa::app::ApplicationManager::clearDirty | ( | ) |
Clear pending render flags after the display has been updated.
| Application * ersa::app::ApplicationManager::getActiveApp | ( | ) | const |
Return the foreground app, or null before an app has been selected.
| Application * ersa::app::ApplicationManager::getApp | ( | size_t | index | ) | const |
Return a non-owning app pointer, or null when the index is out of range.
| size_t ersa::app::ApplicationManager::getAppCount | ( | ) | const |
Return the number of successfully registered apps.
| bool ersa::app::ApplicationManager::handleEvent | ( | const events::Event & | event | ) |
Deliver one event to the foreground app. Inactive screens are excluded so they cannot act on foreground buttons; app adapters request redraws separately through markDirty().
|
static |
Return the firmware's process-wide application registry.
| bool ersa::app::ApplicationManager::isAppSwitched | ( | ) | const |
Report whether navigation changed the foreground app since last clear.
| bool ersa::app::ApplicationManager::isDirty | ( | ) | const |
Report whether a render is pending.
| bool ersa::app::ApplicationManager::isFullRefreshNeeded | ( | ) | const |
Report whether the next render must refresh the whole panel.
| void ersa::app::ApplicationManager::markDirty | ( | bool | fullRefresh = false | ) |
Schedule a render; fullRefresh also requests a full panel update.
| bool ersa::app::ApplicationManager::registerApp | ( | Application * | app | ) |
Add an application to the registry without taking ownership. Static registration avoids heap use and makes the maximum application count a fixed memory budget on the wearable target.
| app | Non-owning pointer to a long-lived application instance. |
| void ersa::app::ApplicationManager::render | ( | hal::IDisplay & | display | ) |
Render the active app when dirty and clear the handled refresh state. The manager passes full-refresh intent and app bounds to the display contract. DisplayManager still owns physical refresh cadence and panel power policy, which keeps application code independent from panel limits.
| bool ersa::app::ApplicationManager::switchTo | ( | const char * | appId | ) |
Navigate by stable app ID. The old and new apps receive lifecycle callbacks, and a full redraw is scheduled because the screen contents have changed completely.
| bool ersa::app::ApplicationManager::switchTo | ( | size_t | index | ) |
Navigate by registry/drawer index; invalid indices leave state unchanged. Selecting the already active index succeeds without another transition.
| void ersa::app::ApplicationManager::tick | ( | ) |
Run the foreground app's bounded periodic callback.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
staticconstexpr |
Maximum number of statically registered apps supported by this build.