The active weather store: holds the readings, owns the appmessage weather channels, and asks the phone for more whenever its turn on the face's cadence finds a poll due.
More...
|
|
static void | reset_state (void) |
| | Clear the reading back to no-data for every field.
|
| static void | mark_dirty (void) |
| | Mark the reading as needing a save.
|
| static void | persist_flush (void) |
| | The coalesced write, run once per inbox via the transport's inbox-complete hook.
|
| static void | inbox_done (void) |
| | Runs once a whole inbound message is handled: one repaint for everything it brought, then the save.
|
| static void | apply_seed (const WeatherSeed *seed) |
| | Prefill the whole store from a seed, for dev builds and screenshots.
|
| static void | on_weather (const WeatherMessage *msg) |
| | The weather channel. The message holds every group the phone sent, and weather_reading_apply keeps what it can. A failed fetch keeps the last good reading rather than blanking, and it refreshes on the next poll that lands.
|
| static void | on_unit_changed (bool fahrenheit) |
| | The wearer switched the temperature unit. The reading in hand converts to it so the face never shows a Celsius number with an F beside it while the new fetch is on its way.
|
| static void | boot_fire (void *data) |
| | The short boot re-ask, and only that.
|
|
static void | cadence_poll (void) |
| | The store's turn on the face's cadence: poll when the deadline has come round.
|
|
void | weather_store_subscribe (void(*cb)(void)) |
| | Hand it the function to call when the weather changes (the screen redraw).
|
| void | weather_store_init (WeatherConfig cfg, const WeatherSeed *seed) |
| | Start the store with its rules. Pass seed = NULL for normal use.
|
| void | weather_store_reconfigure (WeatherConfig cfg) |
| | Re-apply the rules (e.g. the poll interval changed). Moves the next poll to the new interval, and switching the store off here stops it asking the phone.
|
|
int | weather_store_temp (void) |
| | The temperature reading in the user's unit, or WEATHER_NO_TEMP if we have not got one yet.
|
| static bool | forecast_today (void) |
| | Whether the high, low, UV, and rain chance are today's.
|
|
const char * | weather_store_cond (void) |
| | The short word for the sky, or empty if we have not got one yet.
|
| const char * | weather_store_cond_label (void) |
| | The sky in words, such as "Partly Cloudy", for a face that declares WEATHER_CONDITION_LABEL.
|
|
int | weather_store_humidity (void) |
| | The humidity in percent, or -1 if we have not got one yet.
|
|
int | weather_store_wind_kmh (void) |
| | The wind speed in km/h, or -1 if we have not got one yet.
|
|
const char * | weather_store_wind_dir (void) |
| | The wind direction like "NW", or empty if we have not got one yet.
|
|
int | weather_store_sunrise (void) |
| | Sunrise as minutes past midnight, or -1 if we have not got one yet.
|
|
int | weather_store_sunset (void) |
| | Sunset as minutes past midnight, or -1 if we have not got one yet.
|
|
int | weather_store_uv (void) |
| | Today's UV index, or -1 if we have not got one yet or the day it came is over.
|
|
int | weather_store_temp_max (void) |
| | Today's high, or WEATHER_NO_TEMP if we have not got one yet or the day it came is over.
|
|
int | weather_store_temp_min (void) |
| | Today's low, or WEATHER_NO_TEMP if we have not got one yet or the day it came is over.
|
|
int | weather_store_precip_chance (void) |
| | Today's chance of rain in percent, or -1 if we have not got one yet or the day it came is over.
|
|
int | weather_store_feels_like (void) |
| | How warm it feels, or WEATHER_NO_TEMP if we have not got one yet.
|
|
int | weather_store_pressure (void) |
| | The sea level pressure in hPa, or -1 if we have not got one yet.
|
|
int | weather_store_dew_point (void) |
| | The dew point temperature, or WEATHER_NO_TEMP if we have not got one yet.
|
| const WeatherHourly * | weather_store_forecast_hourly (void) |
| | The hourly forecast strip, starting at the hour now.
|
| const WeatherDaily * | weather_store_forecast_daily (void) |
| | The daily forecast strip, starting today.
|
|
int | weather_store_age_s (void) |
| | How many seconds since the last reading turned up, or -1 if we have none.
|
|
|
static WeatherState | s_state |
| | Every reading the store holds, laid out as the blob that gets persisted.
|
|
static void(*) | s_cb (void) |
| | Called whenever a reading changes, so the face can redraw.
|
|
static int | s_boot_retries |
| | Short cold-boot re-asks used so far, until the first reading lands.
|
|
static StoreFetch | s_fetch |
| | The interval, the boot re-ask timer, and when the next poll is due. Live gates the cache too.
|
|
static uint32_t | s_persist_key |
| | The persist slot the face handed us for the saved reading.
|
|
static bool | s_dirty |
| | A channel touched the state this inbox, so persist_flush writes it once.
|
|
static bool | s_changed |
| | A channel touched the state this inbox, so the face repaints once at the end.
|
|
static bool | s_heard |
| | The phone answered a weather request this launch, a failed fetch included.
|
|
static uint32_t | s_saved_sum |
| | Sum of the reading last written, so a reply that changes nothing is not written again.
|
The active weather store: holds the readings, owns the appmessage weather channels, and asks the phone for more whenever its turn on the face's cadence finds a poll due.