The active health store: reads the watch's health service and holds the numbers. It owns the service accessors too so it is the single point of truth for health.
More...
|
| bool | health_metric_available (HealthMetric metric, time_t start, time_t end) |
| | Whether the watch actually has a reading for a metric over a time span.
|
| static int | read_hr (void) |
| | Peek the current heart rate.
|
| static int | read_sum_today (HealthMetric metric, int fallback) |
| | Sum a metric over today, or return the fallback when it is unavailable.
|
| HealthMinuteData * | health_scratch_take (int records) |
| | Allocate scratch room for a minute-history read, off the heap for the length of the read rather than sitting in the app's fixed footprint.
|
| time_t | health_hour_start (const struct tm *today, int hour) |
| | When a local hour of today starts.
|
| bool | health_walk_minute_log (const struct tm *local, int first_hour, int end_hour, time_t until, MinuteRecordFn each, void *context) |
| | Walks the watch's minute log over today's hours and hands each good record, with the hour it falls in, to the each callback.
|
| static void | refresh_hr (bool from_event) |
| | Refresh the heart rate and hand it to each part. A heart rate is never really 0, so -1 is kept as "no reading yet".
|
| static void | refresh_activity (bool force) |
| | Refresh the day's activity totals, steps, distance, calories, sleep, and active time, and hand the step count to each part.
|
| static uint32_t | state_sum (void) |
| | The readings and every named part's state summed, so a change anywhere shows.
|
| static void | notify_if_moved (uint32_t before) |
| | Asks the face for a repaint only when a reading really moved.
|
| static void | on_health_event (HealthEventType event, void *context) |
| | Health event handler: refresh only the metrics the event touched, then notify.
|
| static void | cadence_poll (void) |
| | The store's turn on the face's cadence, registered at init so no face wires it by hand.
|
| void | health_store_subscribe (void(*cb)(void)) |
| | Hand it the function to call when the numbers change (the screen redraw).
|
|
void | health_store_redraw (void) |
| | Asks the face to redraw, for a part whose own timer changed what it holds.
|
| void | health_store_deinit (void) |
| | Stops what the store asked of the watch. Call from the face's deinit.
|
| void | health_store_set_hrv_period (uint16_t period_sec) |
| | Changes how often the watch takes a burst of beat gaps, such as when the wearer changes a setting or places a panel. A period of 0 stops the sampling and puts the reading back to none.
|
| void | health_store_set_hrv_rules (uint16_t still_mg, uint16_t walk_steps, uint16_t settle_gaps, HrvCount count, bool keep_all, bool live_redraw) |
| | Changes which HRV bursts count and how they are measured, such as when the wearer changes a setting or places a panel.
|
| void | health_store_init (HealthConfig cfg, const HealthSeed *seed) |
| | Start the store with its rules. Pass seed = NULL for normal use.
|
| bool | health_store_has_hr (void) |
| | Whether this watch can give a heart rate at all, for a face that leaves its heart rate slot out rather than showing dashes forever.
|
|
int | health_store_hr (void) |
| | The heart rate in beats per minute, or -1 if we have not got one yet.
|
|
int | health_store_steps (void) |
| | The steps taken so far today, or -1 if we have not got one yet.
|
|
int | health_store_calories (void) |
| | The active calories so far today, or -1 if we have not got one yet.
|
|
int | health_store_sleep_min (void) |
| | The minutes of sleep, or -1 if we have not got one yet.
|
|
int | health_store_active_min (void) |
| | The active minutes so far today, or -1 if we have not got one yet.
|
|
int | health_store_distance_m (void) |
| | Today's walked distance in meters, or 0 if we cannot read it.
|
| int | health_store_hrv_ms (void) |
| | Heart rate variability as RMSSD in ms, or -1 if we have not got one, it went stale, or the face is built without HEALTH_HRV.
|
| bool | health_store_hrv_sampling (void) |
| | Whether the watch took the last request for beat gaps.
|
| bool | health_store_hrv_measuring (void) |
| | Whether a burst of beat gaps is being measured right now, with the sensor held on.
|
| bool | health_store_hrv_recent (int back, HrvBurst *out) |
| | One of the latest HRV bursts, for a readout that shows each burst, dropped ones included, newest first. Kept in memory only, so a face starts each launch with none.
|
| bool | health_store_hrv_live (int *score, int *steps, int *held_sec) |
| | The HRV burst being held right now, for a panel that shows it as it happens.
|
| uint16_t | health_store_hrv_still_mg (void) |
| | The still limit in use, in milli-g a sample, so a panel shows the same number as the setting.
|
| uint16_t | health_store_hrv_walk_steps (void) |
| | The steps through a burst that make it a walk, so a panel shows the same number as the setting.
|
| uint16_t | health_store_hrv_settle_gaps (void) |
| | The gaps left out at the start of each burst, after the hold to HRV_SETTLE_GAPS_MAX, so a panel shows the count in use rather than the one asked for.
|
| const HrvLog * | health_store_hrv_log (void) |
| | The HRV readings kept for the panels: the latest few with what the wearer was doing, today by the hour, last night's average, and the latest of each kind.
|
The active health store: reads the watch's health service and holds the numbers. It owns the service accessors too so it is the single point of truth for health.