Loading...
Searching...
No Matches
health_store.h
Go to the documentation of this file.
1
9#pragma once
10#include <pebble.h>
11
16
20typedef struct
21{
22 bool live;
25 // the heart rate and steps are read for every face, since the watch keeps both to hand. these
26 // four are not, so each is only read for a face that shows it. the getter for one left off
27 // keeps returning its no reading value, -1 for the first three and 0 for the distance
28 bool sleep;
29 bool active;
30 bool calories;
31 bool distance;
32 uint32_t persist_key;
34
38typedef struct
39{
40 int hr;
41 int steps;
46 const uint8_t *hr_history;
47 const uint16_t *step_hourly;
50
57void health_store_init(HealthConfig cfg, const HealthSeed *seed);
58
60void health_store_subscribe(void (*cb)(void));
61
62// the store takes its own turn on the face's cadence (see store_cadence.h), registered at init,
63// so nothing here needs calling once a minute by hand
64
69uint8_t *health_store_hr_history(void);
70
75const uint16_t *health_store_step_hourly(void);
76
82
84int health_store_hr(void);
85
87int health_store_steps(void);
88
90int health_store_calories(void);
91
94
97
100
int health_store_active_min(void)
The active minutes so far today, or -1 if we have not got one yet.
Definition health_store.c:776
uint8_t * health_store_hr_history(void)
The last hour of heart rate readings, one per minute (a 60 slot buffer). The store fills it on each u...
Definition health_store.c:767
const uint16_t * health_store_step_hourly(void)
Today's steps split into per-hour buckets, one slot per hour from midnight (24 slots)....
Definition health_store.c:769
int health_store_steps(void)
The steps taken so far today, or -1 if we have not got one yet.
Definition health_store.c:773
void health_store_subscribe(void(*cb)(void))
Hand it the function to call when the numbers change (the screen redraw).
Definition health_store.c:654
int health_store_step_hours(void)
How many of the hourly step buckets hold a real value (0 to 24). Steps count 0 as a real reading (a q...
Definition health_store.c:770
int health_store_distance_m(void)
Today's walked distance in meters, or 0 if we cannot read it.
Definition health_store.c:777
int health_store_sleep_min(void)
The minutes of sleep, or -1 if we have not got one yet.
Definition health_store.c:775
int health_store_calories(void)
The active calories so far today, or -1 if we have not got one yet.
Definition health_store.c:774
void health_store_init(HealthConfig cfg, const HealthSeed *seed)
Start the store with its rules. Pass seed = NULL for normal use.
Definition health_store.c:659
int health_store_hr(void)
The heart rate in beats per minute, or -1 if we have not got one yet.
Definition health_store.c:772
The rules a face hands the store.
Definition health_store.h:21
bool live
True subscribes the health service and false just keeps the fake data for screenshots.
Definition health_store.h:22
uint32_t persist_key
Slot for the saved history so the face owns the key instead of the store.
Definition health_store.h:32
bool active
Read the active minutes total.
Definition health_store.h:29
bool step_history
Keep the hour by hour step buckets, for a face that graphs them.
Definition health_store.h:24
bool hr_history
Keep the rolling minute by minute heart rate window, for a face that graphs it.
Definition health_store.h:23
bool sleep
Read the sleep total.
Definition health_store.h:28
bool distance
Read the walked distance, including for a steps readout that can show it instead.
Definition health_store.h:31
bool calories
Read the active calories total.
Definition health_store.h:30
Optional prefill, or pinned readings when live = false.
Definition health_store.h:39
int hr
Heart rate in beats per minute.
Definition health_store.h:40
int steps
Steps so far today.
Definition health_store.h:41
const uint16_t * step_hourly
Optional 24 slot hour by hour step curve, or NULL.
Definition health_store.h:47
int sleep_min
Minutes of sleep.
Definition health_store.h:43
int active_min
Active minutes so far today.
Definition health_store.h:44
int calories
Active calories so far today.
Definition health_store.h:42
int distance_m
Walked distance in meters.
Definition health_store.h:45
int step_hours
How many of those hourly buckets are real (0 to 24).
Definition health_store.h:48
const uint8_t * hr_history
Optional 60 slot minute by minute heart rate curve (0 means no reading), or NULL.
Definition health_store.h:46