Loading...
Searching...
No Matches
system_store.h File Reference

Active system store: the watch's own battery, bluetooth and next-alarm state. It subscribes to the battery and connection services itself and buzzes on a bluetooth change through a policy the face installs (so the store never has to know about settings or buzzing). More...

#include <pebble.h>

Go to the source code of this file.

Data Structures

struct  SystemConfig
 The rules a face hands the store. More...
struct  SystemSeed
 Optional prefill, or pinned state when live = false. More...

Typedefs

typedef void(*) BtVibePolicy(bool connected)
 Called on a real bluetooth transition (a change, not the first reading), so the face can buzz however its own settings say. NULL for a silent link change.

Functions

void system_store_init (SystemConfig cfg, const SystemSeed *seed)
 Start the store with its rules. Pass seed = NULL for normal use.
void system_store_deinit (void)
 Stop tracking the battery + connection services.
void system_store_subscribe (void(*cb)(void))
 Hand it the function to call when something changes (the screen redraw).
void system_store_on_reconnect (void(*cb)(void))
 Hand it the function to call when the phone app link comes back after a drop.
int system_store_battery (void)
 How full the battery is from 0 to 100.
bool system_store_charging (void)
 True while the watch is plugged in.
bool system_store_bluetooth (void)
 True when the phone link is up.
bool system_store_next_alarm (time_t *out)
 When the wearer's next enabled alarm fires.

Detailed Description

Active system store: the watch's own battery, bluetooth and next-alarm state. It subscribes to the battery and connection services itself and buzzes on a bluetooth change through a policy the face installs (so the store never has to know about settings or buzzing).

The alarm has no service to subscribe to, so it is read straight through on each call rather than mirrored here.