37#if defined(PBL_HEALTH) && (defined(PBL_PLATFORM_EMERY) || defined(PBL_PLATFORM_DIORITE))
38#define HEALTH_HR_SENSOR 1
40#define HEALTH_HR_SENSOR 0
66 uint32_t (*
sum)(void);
73#define HEALTH_HR_HISTORY (&health_part_hr_history)
74#define HEALTH_STEP_HISTORY (&health_part_step_history)
75#define HEALTH_HR_DAY (&health_part_hr_day)
174 bool keep_all,
bool live_redraw);
HrvCount
Which bursts count for the main reading. The first is the one a face gets when it sets none.
Definition hrv_log.h:45
void health_store_deinit(void)
Stops what the store asked of the watch. Call from the face's deinit.
Definition health_store.c:471
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:602
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.
Definition health_store.c:655
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,...
Definition health_store.c:673
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_step_history.c:222
int health_store_steps(void)
The steps taken so far today, or -1 if we have not got one yet.
Definition health_store.c:599
void health_store_subscribe(void(*cb)(void))
Hand it the function to call when the numbers change (the screen redraw).
Definition health_store.c:458
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.
Definition health_store.c:664
const HealthPart health_part_hr_day
Today's heart rate by the hour. Name it as HEALTH_HR_DAY.
Definition health_hr_day.c:193
int health_store_hrv_ms(void)
Heart rate variability as RMSSD in ms, or -1 if we have not got one, it went stale,...
Definition health_store.c:605
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,...
Definition health_store.c:632
const HrvLog * health_store_hrv_log(void)
The HRV readings kept for the panels: the latest few with what the wearer was doing,...
Definition health_store.c:682
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 o...
Definition health_store.c:487
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 rathe...
Definition health_store.c:593
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.
Definition health_store.c:643
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_step_history.c:223
const HealthPart health_part_step_history
Today's steps by the hour. Name it as HEALTH_STEP_HISTORY.
Definition health_step_history.c:216
int health_store_distance_m(void)
Today's walked distance in meters, or 0 if we cannot read it.
Definition health_store.c:603
bool health_store_hrv_measuring(void)
Whether a burst of beat gaps is being measured right now, with the sensor held on.
Definition health_store.c:623
const HrDay * health_store_hr_day(void)
Today's heart rate by the hour, for a face that named HEALTH_HR_DAY. Read each hour and the day's low...
Definition health_hr_day.c:200
int health_store_sleep_min(void)
The minutes of sleep, or -1 if we have not got one yet.
Definition health_store.c:601
const HealthPart health_part_hr_history
The last hour of heart rate. Name it as HEALTH_HR_HISTORY.
Definition health_hr_history.c:281
const uint8_t * health_store_hr_history(void)
The last hour of heart rate readings, one per minute (a 60 slot buffer), for a face that named HEALTH...
Definition health_hr_history.c:287
bool health_store_hrv_sampling(void)
Whether the watch took the last request for beat gaps.
Definition health_store.c:614
int health_store_calories(void)
The active calories so far today, or -1 if we have not got one yet.
Definition health_store.c:600
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 ...
Definition health_store.c:478
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:502
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:598
Today's heart rate by the hour, for a panel that charts the day with its low, average,...
The heart rate variability readings kept for a face's panels: the last few with what the wearer was d...
Tells how much the wearer's wrist moved while a burst of beat gaps was measured.
The rules a face hands the store.
Definition health_store.h:81
bool hrv_live_redraw
Redraw once a second while a burst is held, for a panel that shows the burst as it happens.
Definition health_store.h:103
uint16_t hrv_settle_gaps
Gaps left out at the start of each burst while the sensor settles, or 0 for HRV_SETTLE_GAPS....
Definition health_store.h:100
bool live
True subscribes the health service and false just keeps the fake data for screenshots.
Definition health_store.h:82
uint32_t persist_key
Slot for the saved heart rate graph, so the face owns the key instead of the store.
Definition health_store.h:105
const HealthPart * step_history
HEALTH_STEP_HISTORY for a face that graphs today's steps by the hour, or NULL.
Definition health_store.h:86
uint16_t hrv_walk_steps
The steps through a burst that make it a walk, or 0 for HRV_WALK_STEPS_DEFAULT.
Definition health_store.h:99
bool active
Read the active minutes total.
Definition health_store.h:92
uint16_t hrv_period_sec
How often the watch takes a burst of beat gaps, in seconds, or 0 for no HRV.
Definition health_store.h:97
const HealthPart * hr_history
HEALTH_HR_HISTORY for a face that graphs the last hour of heart rate, or NULL.
Definition health_store.h:85
uint32_t hrv_persist_key
Slot for the saved HRV readings, or 0 to keep them in memory only.
Definition health_store.h:104
bool sleep
Read the sleep total.
Definition health_store.h:91
const HealthPart * hr_day
HEALTH_HR_DAY for a face that charts today's heart rate by the hour, or NULL.
Definition health_store.h:87
uint16_t hrv_still_mg
The most the wrist may move for a burst to be still, in milli-g a sample, or 0 for HRV_MOTION_STILL_D...
Definition health_store.h:98
HrvCount hrv_count
Which bursts count for the main reading. The default leaves out walking ones.
Definition health_store.h:101
bool hrv_keep_all
Measure a burst that cannot count rather than drop it, for a panel that shows walking readings.
Definition health_store.h:102
bool distance
Read the walked distance, including for a steps readout that can show it instead.
Definition health_store.h:94
bool calories
Read the active calories total.
Definition health_store.h:93
An optional part of the store, such as the heart rate graph.
Definition health_store.h:56
void(*) start(const struct HealthConfig *cfg, const struct HealthSeed *seed)
Definition health_store.h:58
uint32_t(*) sum(void)
Definition health_store.h:66
void(*) heart_rate(int hr, bool from_event)
Definition health_store.h:60
void(*) steps(int steps)
Definition health_store.h:62
void(*) poll(void)
Definition health_store.h:64
Optional prefill, or pinned readings when live = false. A part's seed is only taken when the face nam...
Definition health_store.h:113
int hr
Heart rate in beats per minute.
Definition health_store.h:114
int steps
Steps so far today.
Definition health_store.h:115
const uint16_t * step_hourly
Optional 24 slot hour by hour step curve, or NULL.
Definition health_store.h:121
int sleep_min
Minutes of sleep.
Definition health_store.h:117
int active_min
Active minutes so far today.
Definition health_store.h:118
const HrvLog * hrv_log
Optional HRV readings for the panels that show the log, or NULL.
Definition health_store.h:124
int calories
Active calories so far today.
Definition health_store.h:116
int distance_m
Walked distance in meters.
Definition health_store.h:119
int hrv_ms
Heart rate variability as RMSSD in ms, or 0 for none.
Definition health_store.h:123
int step_hours
How many of those hourly buckets are real (0 to 24).
Definition health_store.h:122
const HrDay * hr_day
Optional heart rate by the hour for today, or NULL.
Definition health_store.h:125
const uint8_t * hr_history
Optional 60 slot minute by minute heart rate curve (0 means no reading), or NULL.
Definition health_store.h:120
Today's heart rate, one entry an hour from midnight.
Definition hr_day.h:34
One burst, for a readout that shows each burst: what the wearer did and what came of it.
Definition hrv_log.h:59
The readings kept, in the shape that goes to flash. Start it with hrv_log_reset.
Definition hrv_log.h:77