Skip to content

Application

Igor Usenko edited this page May 25, 2022 · 30 revisions

Watch API and System API

Provides access to watch functions.

Watch supervisor

Controls the power life cycle of the watch.

Application supervisor

Controls which application is active at the moment. Manages switches between applications by calling activate or deactivate functions of applications.

Tiler

Controls which tile is active at the moment.
Calls the Application manager if a change application is needed.

  • setActiveTile - sets tile as active and renders it in the force mode.
  • render - renders changed or everything in case force mode.
  • findComponent - finds component which contains specific coordinates.

Tile order

Up <-> Down - switch application.
Left <-> Right - switch application's tile.

Touchscreen listener

Controls touchscreen events.

  1. Detects touchscreen event.
  2. Asks the tile manager to find a target component and calls its event handler. If no target component, then tile is target.
  3. Component calls event handler.
  4. Component event handler return tile event handler result.
  5. If the component event handler return render as the result - then call Tiler render.

Application

  1. Application state
  2. Tiles
  3. Background task (optional)

High-level interface

  • activate() - makes application active. Set default tile as active. Resumes the background task if needed. Only one application can be active.
  • deactivate() - makes application inactive. Pauses the background task if needed.
  • getActiveTile() - returns active tile of the application.
  • getNextWakeUpPeriod() - returns period after which clock should be active so application can run its logic.

Modes

  • active - receives touch-screen and button events. Draws its own UI.
  • inactive - does nothing

Application state

Set of internal application data. Can be updated only by event handlers.

Tile

Application state + Tile state + Tile event handlers Event handler can return following

  • noop - no operation needed.
  • update - need to call render.

Group

Set of components

Component

  • State - set of variables describing the state of the component.
  • Render - function which renders component on the screen.
  • Provider - function which provides the state.

Background task

FreeRTOS task for serving background activities of the application. Calls dedicated application`s function(s).