Health typicals and averages synced from the phone (BlobDBIdHealth).
More...
|
| bool | health_db_get_typical_value (ActivityMetric metric, enum pbl_weekday day, int32_t *value_out) |
| | Get the typical value of a metric for a weekday.
|
| |
| bool | health_db_get_monthly_average_value (ActivityMetric metric, int32_t *value_out) |
| | Get the average value of a metric over the last month.
|
| |
| bool | health_db_get_typical_step_averages (enum pbl_weekday day, ActivityMetricAverages *averages) |
| | Get the typical step counts of a weekday, also known as "typical steps".
|
| |
| bool | health_db_set_typical_values (ActivityMetric metric, enum pbl_weekday day, uint16_t *values, int num_values) |
| | Store typical step values for a weekday, for test and debug purposes only.
|
| |
| void | health_db_init (void) |
| | Initialize the health database.
|
| |
| status_t | health_db_insert (const uint8_t *key, int key_len, const uint8_t *val, int val_len) |
| | Insert or replace a record in the health database.
|
| |
| int | health_db_get_len (const uint8_t *key, int key_len) |
| | Get the length of a record in the health database.
|
| |
| status_t | health_db_read (const uint8_t *key, int key_len, uint8_t *val_out, int val_out_len) |
| | Read a record from the health database.
|
| |
| status_t | health_db_delete (const uint8_t *key, int key_len) |
| | Delete a record from the health database.
|
| |
| status_t | health_db_flush (void) |
| | Delete all records of the health database.
|
| |
| status_t | health_db_compact (void) |
| | Compact the settings file backing the health database.
|
| |
Health typicals and averages synced from the phone (BlobDBIdHealth).
◆ health_db_compact()
| status_t health_db_compact |
( |
void |
| ) |
|
Compact the settings file backing the health database.
- Returns
S_SUCCESS on success, an error code otherwise.
◆ health_db_delete()
| status_t health_db_delete |
( |
const uint8_t * |
key, |
|
|
int |
key_len |
|
) |
| |
Delete a record from the health database.
- Parameters
-
| key | Key data. |
| key_len | Length of key in bytes. |
- Returns
S_SUCCESS on success, an error code otherwise.
◆ health_db_flush()
| status_t health_db_flush |
( |
void |
| ) |
|
Delete all records of the health database.
- Returns
S_SUCCESS on success, an error code otherwise.
◆ health_db_get_len()
| int health_db_get_len |
( |
const uint8_t * |
key, |
|
|
int |
key_len |
|
) |
| |
Get the length of a record in the health database.
- Parameters
-
| key | Key data. |
| key_len | Length of key in bytes. |
- Returns
- Length of the value in bytes, 0 if not found, or a negative error code.
◆ health_db_get_monthly_average_value()
| bool health_db_get_monthly_average_value |
( |
ActivityMetric |
metric, |
|
|
int32_t * |
value_out |
|
) |
| |
Get the average value of a metric over the last month.
Only ActivityMetricStepCount and ActivityMetricSleepTotalSeconds are stored.
- Parameters
-
| metric | Metric. |
| [out] | value_out | Average value. |
- Returns
- true on success, false if unknown or unsupported.
◆ health_db_get_typical_step_averages()
Get the typical step counts of a weekday, also known as "typical steps".
- Parameters
-
| day | Weekday. |
| [out] | averages | Step averages; set to unknown when not available. |
- Returns
- true on success.
◆ health_db_get_typical_value()
Get the typical value of a metric for a weekday.
Only sleep metrics have typical values. For typical steps use health_db_get_typical_step_averages().
- Parameters
-
| metric | Metric. |
| day | Weekday. |
| [out] | value_out | Typical value. |
- Returns
- true on success, false if unknown or unsupported.
◆ health_db_init()
| void health_db_init |
( |
void |
| ) |
|
Initialize the health database.
◆ health_db_insert()
| status_t health_db_insert |
( |
const uint8_t * |
key, |
|
|
int |
key_len, |
|
|
const uint8_t * |
val, |
|
|
int |
val_len |
|
) |
| |
Insert or replace a record in the health database.
Keys are strings like monday_sleepData or average_dailySteps and values a multiple of 4 bytes. Movement data is only forwarded to the activity service and not stored; other records are stored and also forwarded.
- Parameters
-
| key | Key data. |
| key_len | Length of key in bytes. |
| val | Value data. |
| val_len | Length of val in bytes. |
- Returns
S_SUCCESS on success, an error code otherwise.
◆ health_db_read()
| status_t health_db_read |
( |
const uint8_t * |
key, |
|
|
int |
key_len, |
|
|
uint8_t * |
val_out, |
|
|
int |
val_out_len |
|
) |
| |
Read a record from the health database.
- Parameters
-
| key | Key data. |
| key_len | Length of key in bytes. |
| [out] | val_out | Buffer for the value. |
| val_out_len | Size of val_out in bytes. |
- Returns
S_SUCCESS on success, an error code otherwise.
◆ health_db_set_typical_values()
Store typical step values for a weekday, for test and debug purposes only.
- Parameters
-
| metric | Ignored, step typicals are always written. |
| day | Weekday. |
| values | Values to store. |
| num_values | Number of entries in values. |
- Returns
- true on success.