PebbleOS
Loading...
Searching...
No Matches
Data Structures | Macros | Functions
Insights settings

Tunable parameters of the activity insights. More...

Data Structures

struct  ActivityRewardSettings
 Reward insight settings. More...
 
struct  ActivitySummarySettings
 Summary pin settings. More...
 
struct  ActivitySessionSettings
 Activity session insight settings. More...
 
struct  ActivityInsightSettings
 Settings of one insight. More...
 
union  ActivityRewardSettings.__unnamed53__
 Insight specific settings. More...
 
struct  ActivityRewardSettings.__unnamed53__.sleep
 Sleep reward settings. More...
 
struct  ActivityRewardSettings.__unnamed53__.activity
 Activity reward settings. More...
 
union  ActivitySummarySettings.__unnamed57__
 Insight specific settings. More...
 
struct  ActivitySummarySettings.__unnamed57__.activity
 Activity summary settings. More...
 
struct  ActivitySummarySettings.__unnamed57__.sleep
 Sleep summary settings. More...
 
union  ActivitySessionSettings.__unnamed61__
 Session type specific settings. More...
 
struct  ActivitySessionSettings.__unnamed61__.activity
 Walk and run settings. More...
 
union  ActivityInsightSettings.__unnamed64__
 Insight specific settings. More...
 

Macros

#define ACTIVITY_INSIGHTS_SETTINGS_SLEEP_REWARD   "sleep_reward"
 Key of the sleep reward settings.
 
#define ACTIVITY_INSIGHTS_SETTINGS_SLEEP_SUMMARY   "sleep_summary"
 Key of the sleep summary settings.
 
#define ACTIVITY_INSIGHTS_SETTINGS_ACTIVITY_REWARD   "activity_reward"
 Key of the activity reward settings.
 
#define ACTIVITY_INSIGHTS_SETTINGS_ACTIVITY_SUMMARY   "activity_summary"
 Key of the activity summary settings.
 
#define ACTIVITY_INSIGHTS_SETTINGS_ACTIVITY_SESSION   "activity_session"
 Key of the activity session settings.
 

Functions

bool activity_insights_settings_read (const char *insight_name, ActivityInsightSettings *settings_out)
 Read the settings of an insight.
 
bool activity_insights_settings_write (const char *insight_name, ActivityInsightSettings *settings)
 Write the settings of an insight (testing).
 
uint16_t activity_insights_settings_get_version (void)
 Get the version of the insights settings file contents.
 
void activity_insights_settings_init (void)
 Initialize the insights settings file.
 
PFSCallbackHandle activity_insights_settings_watch (PFSFileChangedCallback callback)
 Watch the insights settings file.
 
void activity_insights_settings_unwatch (PFSCallbackHandle cb_handle)
 Stop watching the insights settings file.
 

Detailed Description

Tunable parameters of the activity insights.

Settings are stored per insight, keyed by name, in the insights settings file. Built-in defaults are used for insights missing from the file.

settings.enabled) {
uint16_t delay_s = settings.reward.sleep.trigger_after_wakeup_seconds;
}
bool enabled
Insight enabled.
Definition insights_settings.h:143
Settings of one insight.
Definition insights_settings.h:137
bool activity_insights_settings_read(const char *insight_name, ActivityInsightSettings *settings_out)
Read the settings of an insight.
#define ACTIVITY_INSIGHTS_SETTINGS_SLEEP_REWARD
Key of the sleep reward settings.
Definition insights_settings.h:30

Data Structure Documentation

◆ ActivityRewardSettings

struct ActivityRewardSettings

Reward insight settings.

Day counts are in addition to today.

Data Fields
union ActivityRewardSettings.__unnamed53__ __unnamed__ Insight specific settings.
uint8_t continuous_min_days_data Consecutive days of history required.
uint8_t min_days_data Days of history required.
uint32_t notif_min_interval_seconds Minimum interval between two notifications of this insight, in seconds.
uint16_t target_percent_of_median Percentage of the median that qualifying days must reach.
uint8_t target_qualifying_days Days that must be above target, in addition to today.

◆ ActivitySummarySettings

struct ActivitySummarySettings

Summary pin settings.

Thresholds are percentages relative to 100% of the average: 105% is 5, 93% is -7.

Data Fields
union ActivitySummarySettings.__unnamed57__ __unnamed__ Insight specific settings.
int8_t above_avg_threshold Values above this are above average.
int8_t below_avg_threshold Values below this are below average.
int8_t fail_threshold Values below this are a fail.

◆ ActivitySessionSettings

struct ActivitySessionSettings

Activity session insight settings.

Data Fields
union ActivitySessionSettings.__unnamed61__ __unnamed__ Session type specific settings.
bool show_notification Whether to show a notification.

◆ ActivityInsightSettings

struct ActivityInsightSettings

Settings of one insight.

Data Fields
union ActivityInsightSettings.__unnamed64__ __unnamed__ Insight specific settings.
bool enabled Insight enabled.
uint8_t unused Unused.
uint8_t version Struct version, must be first.

Records with another version are ignored.

◆ ActivityRewardSettings.__unnamed53__

union ActivityRewardSettings.__unnamed53__

Insight specific settings.

Data Fields
struct ActivityRewardSettings.__unnamed53__.activity activity Activity reward settings.
struct ActivityRewardSettings.__unnamed53__.sleep sleep Sleep reward settings.

◆ ActivityRewardSettings.__unnamed53__.sleep

struct ActivityRewardSettings.__unnamed53__.sleep

Sleep reward settings.

Data Fields
uint16_t trigger_after_wakeup_seconds Delay after waking up before showing the reward, in seconds.

◆ ActivityRewardSettings.__unnamed53__.activity

struct ActivityRewardSettings.__unnamed53__.activity

Activity reward settings.

Data Fields
uint8_t trigger_active_minutes Minutes the user must currently have been active before showing the reward.
uint8_t trigger_steps_per_minute Steps per minute required for an active minute.

◆ ActivitySummarySettings.__unnamed57__

union ActivitySummarySettings.__unnamed57__

Insight specific settings.

Data Fields
struct ActivitySummarySettings.__unnamed57__.activity activity Activity summary settings.
struct ActivitySummarySettings.__unnamed57__.sleep sleep Sleep summary settings.

◆ ActivitySummarySettings.__unnamed57__.activity

struct ActivitySummarySettings.__unnamed57__.activity

Activity summary settings.

Data Fields
uint16_t max_fail_steps Do not show a negative summary above this many steps.
bool show_notification Whether to show a notification.
uint16_t trigger_minute Minute of the day at which the pin is added.
uint32_t update_max_interval_seconds Maximum time without updating the pin, in seconds.
uint16_t update_threshold_steps Step change that causes the pin to be updated.

◆ ActivitySummarySettings.__unnamed57__.sleep

struct ActivitySummarySettings.__unnamed57__.sleep

Sleep summary settings.

Data Fields
uint16_t max_fail_minutes Do not show a negative summary above this many minutes of sleep.
uint8_t trigger_notif_active_minutes Minimum active minutes to trigger the notification.
uint16_t trigger_notif_activity Minimum steps per minute to trigger the notification.
uint16_t trigger_notif_seconds Delay after waking up before the notification, in seconds.

◆ ActivitySessionSettings.__unnamed61__

union ActivitySessionSettings.__unnamed61__

Session type specific settings.

Data Fields
struct ActivitySessionSettings.__unnamed61__.activity activity Walk and run settings.

◆ ActivitySessionSettings.__unnamed61__.activity

struct ActivitySessionSettings.__unnamed61__.activity

Walk and run settings.

Data Fields
uint16_t trigger_cooldown_minutes Delay after the end of the session before notifying, in minutes.
uint16_t trigger_elapsed_minutes Minimum session length to get an insight, in minutes.

◆ ActivityInsightSettings.__unnamed64__

union ActivityInsightSettings.__unnamed64__

Insight specific settings.

Data Fields
ActivityRewardSettings reward Reward settings.
ActivitySessionSettings session Activity session settings.
ActivitySummarySettings summary Summary pin settings.

Macro Definition Documentation

◆ ACTIVITY_INSIGHTS_SETTINGS_ACTIVITY_REWARD

#define ACTIVITY_INSIGHTS_SETTINGS_ACTIVITY_REWARD   "activity_reward"

Key of the activity reward settings.

◆ ACTIVITY_INSIGHTS_SETTINGS_ACTIVITY_SESSION

#define ACTIVITY_INSIGHTS_SETTINGS_ACTIVITY_SESSION   "activity_session"

Key of the activity session settings.

◆ ACTIVITY_INSIGHTS_SETTINGS_ACTIVITY_SUMMARY

#define ACTIVITY_INSIGHTS_SETTINGS_ACTIVITY_SUMMARY   "activity_summary"

Key of the activity summary settings.

◆ ACTIVITY_INSIGHTS_SETTINGS_SLEEP_REWARD

#define ACTIVITY_INSIGHTS_SETTINGS_SLEEP_REWARD   "sleep_reward"

Key of the sleep reward settings.

◆ ACTIVITY_INSIGHTS_SETTINGS_SLEEP_SUMMARY

#define ACTIVITY_INSIGHTS_SETTINGS_SLEEP_SUMMARY   "sleep_summary"

Key of the sleep summary settings.

Function Documentation

◆ activity_insights_settings_get_version()

uint16_t activity_insights_settings_get_version ( void  )

Get the version of the insights settings file contents.

Separate from ActivityInsightSettings::version.

Returns
Version, 0 by default.

◆ activity_insights_settings_init()

void activity_insights_settings_init ( void  )

Initialize the insights settings file.

◆ activity_insights_settings_read()

bool activity_insights_settings_read ( const char *  insight_name,
ActivityInsightSettings *  settings_out 
)

Read the settings of an insight.

Falls back to the built-in defaults when the file has no valid record for the insight.

Parameters
insight_nameInsight key, e.g. ACTIVITY_INSIGHTS_SETTINGS_SLEEP_REWARD.
[out]settings_outSettings; zeroed on failure.
Returns
true if settings were found, false otherwise.

◆ activity_insights_settings_unwatch()

void activity_insights_settings_unwatch ( PFSCallbackHandle  cb_handle)

Stop watching the insights settings file.

Parameters
cb_handleHandle returned by activity_insights_settings_watch().

◆ activity_insights_settings_watch()

PFSCallbackHandle activity_insights_settings_watch ( PFSFileChangedCallback  callback)

Watch the insights settings file.

Parameters
callbackCalled when the file is closed after modifications, or deleted.
Returns
Handle for activity_insights_settings_unwatch(), 0 if the activity service is not initialized.

◆ activity_insights_settings_write()

bool activity_insights_settings_write ( const char *  insight_name,
ActivityInsightSettings *  settings 
)

Write the settings of an insight (testing).

Parameters
insight_nameInsight key.
settingsSettings.
Returns
true if saved.