Ersa Wearable Platform
Embedded smartwatch firmware and application framework
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ersa::app::Application Class Referenceabstract

#include <application.h>

Inheritance diagram for ersa::app::Application:
Inheritance graph
[legend]
Collaboration diagram for ersa::app::Application:
Collaboration graph
[legend]

Public Member Functions

virtual ~Application ()=default
 
virtual const char * getId () const =0
 
virtual const char * getTitle () const =0
 
virtual void onCreate ()
 
virtual void onStart ()
 
virtual void onResume ()
 
virtual void onPause ()
 
virtual void onStop ()
 
virtual void onDestroy ()
 
virtual void onEnter ()
 
virtual void onExit ()
 
void onEvent (const events::Event &event) override
 
virtual void render (hal::IDisplay &display, bool fullRefresh)
 
virtual void render (ui::Canvas &canvas)
 
virtual Rect getPartialBounds () const
 
virtual void tick ()
 
- Public Member Functions inherited from ersa::events::IEventListener
virtual ~IEventListener ()=default
 

Detailed Description

Base contract for a screen or watchface that can be selected by the UI.

The manager owns navigation, lifecycle dispatch, refresh scheduling, and event delivery; an application owns only its screen state and behavior. Implementations are statically linked into the firmware, so IDs are stable navigation keys rather than runtime package names. Keep callbacks bounded: long radio or storage operations belong in a service/task, not the UI loop.

Constructor & Destructor Documentation

◆ ~Application()

virtual ersa::app::Application::~Application ( )
virtualdefault

Destroy through the base interface when application ownership ends.

Member Function Documentation

◆ getId()

virtual const char * ersa::app::Application::getId ( ) const
pure virtual

Return a stable, unique, null-terminated navigation key.

Implemented in ersa::app::Watchface, ersa::watchface::AppWatchface, TestAppA, and TestAppB.

◆ getPartialBounds()

virtual Rect ersa::app::Application::getPartialBounds ( ) const
inlinevirtual

Return the smallest display rectangle that may have changed. The UI uses this to limit partial e-paper refreshes and reduce visible flashing; return the whole panel when the changed region cannot be bounded. The default describes the 200 by 200 reference canvas and is conservative for the current product; other geometries should provide their own.

Reimplemented in ersa::watchface::AppWatchface.

◆ getTitle()

virtual const char * ersa::app::Application::getTitle ( ) const
pure virtual

Return the user-facing name shown by the app drawer.

Implemented in ersa::app::Watchface, ersa::watchface::AppWatchface, TestAppA, and TestAppB.

◆ onCreate()

virtual void ersa::app::Application::onCreate ( )
inlinevirtual

Called once before this app is first shown.

Establish durable model state here. Do not assume the display is active or block the UI task; the base implementation is empty so simple apps have no setup boilerplate.

Reimplemented in TestAppA, and TestAppB.

◆ onDestroy()

virtual void ersa::app::Application::onDestroy ( )
inlinevirtual

Called when the manager permanently removes this app. Free app-owned resources and unregister any remaining listeners. Static firmware apps normally live for an entire boot, so this callback is uncommon.

◆ onEnter()

virtual void ersa::app::Application::onEnter ( )
inlinevirtual

Compatibility hook for adapters using the earlier enter/exit lifecycle. New app code should use onStart() and onResume(); this no-op remains so existing adapters continue to compile.

Reimplemented in ersa::watchface::AppWatchface.

◆ onEvent()

void ersa::app::Application::onEvent ( const events::Event &  event)
inlineoverridevirtual

Receive a normalized system or input event while this app is active. Override this to translate button, clock, battery, and companion events into app state changes. Payloads are copied values, so app logic does not need to depend on the device driver that produced the event. The base implementation intentionally ignores events for static screens.

Implements ersa::events::IEventListener.

Reimplemented in ersa::watchface::AppWatchface, and TestAppA.

◆ onExit()

virtual void ersa::app::Application::onExit ( )
inlinevirtual

Compatibility counterpart of onEnter(); prefer onPause() or onStop().

Reimplemented in ersa::watchface::AppWatchface.

◆ onPause()

virtual void ersa::app::Application::onPause ( )
inlinevirtual

Called before another screen temporarily covers this app. Stop animations and polling, and release temporary wake/performance leases. The manager retains the app instance, so this is not destruction.

Reimplemented in TestAppA.

◆ onResume()

virtual void ersa::app::Application::onResume ( )
inlinevirtual

Called after onPause() when this app is foregrounded again. Revalidate transient state and resume paused work; durable model state normally remains intact across this temporary transition.

Reimplemented in TestAppA, and TestAppB.

◆ onStart()

virtual void ersa::app::Application::onStart ( )
inlinevirtual

Called when the manager selects this app as the foreground screen. Start foreground-only work, such as app-specific event subscriptions or refresh requests. Pair subscriptions with pause/stop cleanup so hidden screens do not process events unnecessarily.

Reimplemented in TestAppA, and TestAppB.

◆ onStop()

virtual void ersa::app::Application::onStop ( )
inlinevirtual

Called when navigation leaves this app. Release foreground-only resources and callbacks. Use onPause() for a temporary cover and onDestroy() only when the manager permanently removes the object.

Reimplemented in TestAppA.

◆ render() [1/2]

virtual void ersa::app::Application::render ( hal::IDisplay &  display,
bool  fullRefresh 
)
inlinevirtual

Render through the display HAL. fullRefresh requests a panel-wide update when the hardware supports a distinct full-refresh waveform. The UI calls this only when content is dirty. Draw into the framebuffer; the display manager owns physical refresh timing and panel power so app code stays independent of e-paper driver APIs.

Reimplemented in TestAppA, and ersa::watchface::AppWatchface.

◆ render() [2/2]

virtual void ersa::app::Application::render ( ui::Canvas &  canvas)
inlinevirtual

Render through the lightweight canvas contract used by watchfaces. This overload supports canvas-oriented apps; override the overload used by the registry adapter for the app being implemented.

Reimplemented in ersa::app::Watchface.

◆ tick()

virtual void ersa::app::Application::tick ( )
inlinevirtual

Perform short periodic work while this application is active. The manager invokes this from the UI task, so return promptly. Use a service or worker for network, filesystem, or radio operations and let tick() consume their completed results instead of waiting for I/O.


The documentation for this class was generated from the following file: