|
PebbleOS
|
Sleep and activity rewards, summary pins and session notifications. More...
Data Structures | |
| struct | ActivityInsightMetricHistoryStats |
| Statistics of a metric's history, used to decide whether an insight can trigger. More... | |
Functions | |
| void | activity_insights_recalculate_stats (void) |
| Recalculate the metric history statistics. | |
| void | activity_insights_init (time_t now_utc) |
| Initialize activity insights. | |
| void | activity_insights_process_sleep_data (time_t now_utc) |
| Process updated sleep metrics. | |
| void | activity_insights_process_minute_data (time_t now_utc) |
| Check the step insights. | |
| void | activity_insights_push_activity_session_notification (time_t notif_time, ActivitySession *session, int32_t avg_hr, int32_t *hr_zone_time_s) |
| Push the notification summarizing a walk, run or open workout session. | |
| void | activity_insights_test_push_summary_pins (void) |
| Push the 3 variants of each summary pin, with a notification for the last one (test apps). | |
| void | activity_insights_test_push_rewards (void) |
| Push the sleep and activity rewards (test apps). | |
| void | activity_insights_test_push_walk_run_sessions (void) |
| Push a run and a walk notification (test apps). | |
| void | activity_insights_test_push_nap_session (void) |
| Push a nap pin and notification (test apps). | |
Sleep and activity rewards, summary pins and session notifications.
Insights compare today's sleep and steps against the user's history and push timeline pins and notifications. Their parameters come from the insights settings (see Insights settings).
| struct ActivityInsightMetricHistoryStats |
Statistics of a metric's history, used to decide whether an insight can trigger.
Computed over past days only, ignoring days with no data.
| Data Fields | ||
|---|---|---|
| uint8_t | consecutive_days | Consecutive days with data, starting yesterday. |
| ActivityScalarStore | mean | Mean value. |
| ActivityScalarStore | median | Median value. |
| ActivityMetric | metric | Metric. |
| uint8_t | total_days | Days with data. |
Insights sent a number of days after activation.
Used as bit positions in a prefs bitfield: new values go at the end.
| Enumerator | |
|---|---|
| ActivationDelayInsightType_Day1 | Day 1. |
| ActivationDelayInsightType_Day4 | Day 4. |
| ActivationDelayInsightType_Day10 | Day 10. |
| ActivationDelayInsightTypeCount | Number of activation delay insights. |
User responses to an insight, reported to analytics.
| enum ActivityInsightType |
Insight types, reported to analytics.
| enum PercentTier |
How a value compares to the user's average.
| void activity_insights_init | ( | time_t | now_utc | ) |
Initialize activity insights.
Not thread safe: only called from activity_init(), during boot.
| now_utc | Current UTC time. |
| void activity_insights_process_minute_data | ( | time_t | now_utc | ) |
Check the step insights.
Called once per minute by the minute handler. Not thread safe: the caller must hold the activity state mutex.
| now_utc | Current UTC time. |
| void activity_insights_process_sleep_data | ( | time_t | now_utc | ) |
Process updated sleep metrics.
Called by the minute handler when it updates the sleep metrics. Not thread safe: the caller must hold the activity state mutex.
| now_utc | Current UTC time. |
| void activity_insights_push_activity_session_notification | ( | time_t | notif_time, |
| ActivitySession * | session, | ||
| int32_t | avg_hr, | ||
| int32_t * | hr_zone_time_s | ||
| ) |
Push the notification summarizing a walk, run or open workout session.
Does nothing for sessions shorter than a minute.
| notif_time | Notification time, UTC. |
| session | Session. |
| avg_hr | Average heart rate, in beats per minute, 0 if unknown. |
| hr_zone_time_s | Seconds spent in each HRZone (HRZoneCount entries), or NULL. |
| void activity_insights_recalculate_stats | ( | void | ) |
Recalculate the metric history statistics.
Called at midnight rollover. Not thread safe: the caller must hold the activity state mutex.
| void activity_insights_test_push_nap_session | ( | void | ) |
Push a nap pin and notification (test apps).
| void activity_insights_test_push_rewards | ( | void | ) |
Push the sleep and activity rewards (test apps).
| void activity_insights_test_push_summary_pins | ( | void | ) |
Push the 3 variants of each summary pin, with a notification for the last one (test apps).
| void activity_insights_test_push_walk_run_sessions | ( | void | ) |
Push a run and a walk notification (test apps).