Loading...
Searching...
No Matches
Dev Harness

Fixed fixtures and a theme walk for repeatable screenshots. More...

Files

file  src/plugins/dev/c/dev/dev_config.c
 The part of the dev harness the unit's paf.dev.config.json lays out: the settings applied at launch, the clock, date, and readings each screen shows in place of the fixture, and the walks the config lists. It reads them out of the header paf build –dev writes, so with dev mode off it compiles to nothing.
file  src/plugins/dev/c/dev/dev_config.h
 What a dev build takes from the unit's paf.dev.config.json beyond the walk: the clock and date each screen pins, the settings it applies at launch, the readings it seeds in place of the fixture, and the steps of a walk the file lays out as a list.
file  src/plugins/dev/c/dev/dev_hooks.h
 The calls a face makes to run the dev harness, and the switches they read. The build sets the switches from paf build <face> --dev and the unit's paf.dev.config.json, beside its paf.config.json, so a face writes none of them and main.c calls the hooks without any #if of its own.
file  src/plugins/dev/c/dev/dev_walk.c
 The shared dev harness. It seeds the stores from a fixed fixture, or from the unit's paf.dev.config.json for a store the config seeds, and drives the theme walk or a walk the config lays out. Compiled for any face that lists the dev plugin, and the linker drops it from any face that never calls it, which is every release build.
file  src/plugins/dev/c/dev/dev_walk.h
 Shared dev harness for screenshots. It seeds the clock, weather, health, system, and location stores with a fixed fixture, and the stock and calendar stores empty, using the store seed mechanism so no live source overwrites it. A store the unit's paf.dev.config.json gives readings for takes those instead.

Data Structures

struct  DevSetting
 One setting the config applies, by its message key. More...
struct  DevStep
 One screen of a walk the config lays out as steps. More...
struct  DevReadings
 The clock, date, and seeds one screen shows. The launch's comes first in the table. More...
struct  DevDate
 A pinned date, counted the way a struct tm counts it. More...
struct  DevRun
 A run of rows in a table, such as one agenda's events. More...
struct  DevPanel
 One screen of a panel walk. More...
struct  DevHourReading
 One heart rate reading for the day's chart. More...
struct  DevHrvReading
 One HRV reading for the log, placed by its minute of the day. More...
struct  DevEvent
 One agenda event, placed against the watch's clock when the stores are seeded. More...
struct  DevHealth
 One health seed, with the day's heart rate and the HRV log the store builds from it. More...
struct  DevSystem
 One system seed, with its next alarm counted from when the stores are seeded. More...
struct  [struct].s_fixed

Macros

#define DEV_NONE   0xFF
 The mark for no pick in a set of readings: a store left to the fixture, or a date left to the watch.

Enumerations

enum  DevValueType { DEV_VALUE_NUMBER , DEV_VALUE_TEXT }
 How a setting's value travels, the way the settings page sends it. More...
enum  DevStore {
  DEV_STORE_WEATHER , DEV_STORE_HEALTH , DEV_STORE_SYSTEM , DEV_STORE_PHONE ,
  DEV_STORE_MUSIC , DEV_STORE_STOCKS , DEV_STORE_CALENDAR , DEV_STORE_LOCATION ,
  DEV_STORE_COUNT
}
 The stores a dev build seeds, for asking whether the config seeds one. More...
enum  DevWalkMode { DEV_WALK_NONE , DEV_WALK_THEMES , DEV_WALK_CONFIG }
 Which walk a tap advances. dev_start picks it from the walk the dev switches name. More...

Functions

void dev_show_panel (int panel, int size)
 Shows one panel on its own at one size, for a walk that lists panels. The face defines it, and the dev plugin calls it on each step of the walk, then runs the face's theme hook and rebuilds.
void dev_show_layout (const char *layout)
 Shows one whole layout, for a walk with a step that has one. The face defines it, and the dev plugin calls it on each step that has a layout, after the step's settings, then seeds the stores, runs the face's theme hook, and rebuilds. A face whose walks have no layouts leaves it out.
static void dev_config_apply_settings (void)
 Does nothing with dev mode off.
static uint8_t dev_config_pick (DevStore store)
 Has no seeds with dev mode off.
static void dev_config_pin (struct tm *when)
 Leaves the time alone with dev mode off.
static bool dev_config_seed (DevStore store)
 Seeds nothing with dev mode off.
static uint16_t dev_config_walk_count (void)
 Has no walk with dev mode off.
static void dev_config_walk_show (uint16_t step)
 Does nothing with dev mode off.
static bool dev_seed_stores (void)
 Applies the config's settings, then seeds the stores on the pinned clock, when dev mode is on. A store the config seeds takes the config's readings, and the rest take the dev fixture. Call it after settings_init and in place of the live store inits, and skip them when it returns true.
static void dev_start (void(*apply_theme)(void))
 Starts the walk when dev mode is on. With the theme walk picked it forces the first theme and steps to the next on each tap. With a walk the config lays out it shows the first step and steps to the next on each tap. Any other walk, or none, just paints the fixture once and leaves the taps to the face. Call after engine_init.
static void dev_stop (void)
 Drops the walk's tap subscription when dev mode is on. Call from deinit.
static void dev_force_time (struct tm *when)
 Sets a time to the pinned clock when dev mode is on, and to the pinned date when the config has one. Both follow the screen on show, so a step of a walk with a clock of its own moves them. A panel that builds its own time, such as a second time zone, calls it so a screenshot shows the same time and day in every panel.
void dev_walk_seed_stores (int hour, int min)
 Inits the clock, weather, health, system, and location stores from the default fixture, with live set to false and a pinned clock, so the face shows fixed data that no live reading can stomp. Weather and location are only filled for a face that declares their keys, and left empty otherwise. The stock and calendar stores start empty with live false for a face that declares STOCK_STRIP or CALENDAR_STRIP, so a settings save cannot start them fetching. The phone battery and now playing stores start empty with live false for a face that declares their keys, since the seeded system store tells them nothing about the link. Call it after settings_init, so the weather seed takes the wearer's temperature unit, in place of those stores' live inits, and before any store init of the face's own, then seed the face's own data after it.
void dev_walk_init (DevWalkMode mode, void(*apply_theme)(void))
 Starts the walk. A theme walk forces the first theme and subscribes the accelerometer tap, and a walk the config lays out shows its first screen and subscribes it. Every mode then paints. Call after engine_init.
void dev_walk_deinit (void)
 Drop the tap subscription. Call from deinit.

Detailed Description

Fixed fixtures and a theme walk for repeatable screenshots.

It comes with the dev plugin, in src/plugins/dev/c/dev, apart from the runtime. The frame faces share it. It fills the stores with fixed fixtures and steps through the themes on a tap, so a face's screenshots come out the same every time. The weather and location stores are filled only for a face that declares their message keys, and left empty otherwise.

Enumeration Type Documentation

◆ DevStore

enum DevStore

The stores a dev build seeds, for asking whether the config seeds one.

Enumerator
DEV_STORE_COUNT 

How many stores there are, not a store of its own.

◆ DevValueType

How a setting's value travels, the way the settings page sends it.

Enumerator
DEV_VALUE_NUMBER 

A whole number, a toggle as 0 or 1, or a colour as 0xRRGGBB.

DEV_VALUE_TEXT 

Text.

◆ DevWalkMode

Which walk a tap advances. dev_start picks it from the walk the dev switches name.

Enumerator
DEV_WALK_NONE 

Just pin the fixture, no tap handler.

DEV_WALK_THEMES 

A tap steps to the next theme.

DEV_WALK_CONFIG 

A tap steps to the next step of the walk the unit's paf.dev.config.json lays out.

Function Documentation

◆ dev_config_pick()

uint8_t dev_config_pick ( DevStore store)
inlinestatic

Has no seeds with dev mode off.

Parameters
storeUnused.
Returns
DEV_NONE.

◆ dev_config_pin()

void dev_config_pin ( struct tm * when)
inlinestatic

Leaves the time alone with dev mode off.

Parameters
whenUnused.

◆ dev_config_seed()

bool dev_config_seed ( DevStore store)
inlinestatic

Seeds nothing with dev mode off.

Parameters
storeUnused.
Returns
False.

◆ dev_config_walk_count()

uint16_t dev_config_walk_count ( void )
inlinestatic

Has no walk with dev mode off.

Returns
0.

◆ dev_config_walk_show()

void dev_config_walk_show ( uint16_t step)
inlinestatic

Does nothing with dev mode off.

Parameters
stepUnused.

◆ dev_force_time()

void dev_force_time ( struct tm * when)
inlinestatic

Sets a time to the pinned clock when dev mode is on, and to the pinned date when the config has one. Both follow the screen on show, so a step of a walk with a clock of its own moves them. A panel that builds its own time, such as a second time zone, calls it so a screenshot shows the same time and day in every panel.

Parameters
whenThe time to set, changed in place. Left alone with dev mode off.

◆ dev_seed_stores()

bool dev_seed_stores ( void )
inlinestatic

Applies the config's settings, then seeds the stores on the pinned clock, when dev mode is on. A store the config seeds takes the config's readings, and the rest take the dev fixture. Call it after settings_init and in place of the live store inits, and skip them when it returns true.

Returns
True when it seeded the stores, so the face skips its live inits. False with dev mode off.

◆ dev_show_layout()

void dev_show_layout ( const char * layout)

Shows one whole layout, for a walk with a step that has one. The face defines it, and the dev plugin calls it on each step that has a layout, after the step's settings, then seeds the stores, runs the face's theme hook, and rebuilds. A face whose walks have no layouts leaves it out.

Parameters
layoutThe step's layout, as the config writes it. Its shape is the face's own.

◆ dev_show_panel()

void dev_show_panel ( int panel,
int size )

Shows one panel on its own at one size, for a walk that lists panels. The face defines it, and the dev plugin calls it on each step of the walk, then runs the face's theme hook and rebuilds.

Parameters
panelThe panel, as the config's panels block names it to the C.
sizeIts size, the same way.

◆ dev_start()

void dev_start ( void(* apply_theme )(void))
inlinestatic

Starts the walk when dev mode is on. With the theme walk picked it forces the first theme and steps to the next on each tap. With a walk the config lays out it shows the first step and steps to the next on each tap. Any other walk, or none, just paints the fixture once and leaves the taps to the face. Call after engine_init.

Parameters
apply_themeThe face's own hook for a settings change, run after each step and before the engine rebuilds, or NULL for none.

◆ dev_walk_init()

void dev_walk_init ( DevWalkMode mode,
void(* apply_theme )(void) )

Starts the walk. A theme walk forces the first theme and subscribes the accelerometer tap, and a walk the config lays out shows its first screen and subscribes it. Every mode then paints. Call after engine_init.

Parameters
modeWhich walk to run.
apply_themeThe face's own theme-apply hook. It re-colours the zones and swaps the frame, and runs before the engine rebuilds so a theme change lands.

◆ dev_walk_seed_stores()

void dev_walk_seed_stores ( int hour,
int min )

Inits the clock, weather, health, system, and location stores from the default fixture, with live set to false and a pinned clock, so the face shows fixed data that no live reading can stomp. Weather and location are only filled for a face that declares their keys, and left empty otherwise. The stock and calendar stores start empty with live false for a face that declares STOCK_STRIP or CALENDAR_STRIP, so a settings save cannot start them fetching. The phone battery and now playing stores start empty with live false for a face that declares their keys, since the seeded system store tells them nothing about the link. Call it after settings_init, so the weather seed takes the wearer's temperature unit, in place of those stores' live inits, and before any store init of the face's own, then seed the face's own data after it.

Parameters
hourThe pinned clock hour (0-23).
minThe pinned clock minute.