|
PebbleOS
|
Manually started and stopped activity sessions. More...
Functions | |
| void | workout_service_init (void) |
| Initialize the workout service. | |
| void | workout_service_frontend_opened (void) |
| Signal that the workout app was opened. | |
| void | workout_service_frontend_closed (void) |
| Signal that the workout app was closed. | |
| void | workout_service_health_event_handler (PebbleHealthEvent *event) |
| Handle a health event (movement and heart rate updates). | |
| void | workout_service_activity_event_handler (PebbleActivityEvent *event) |
| Handle an activity event. | |
| void | workout_service_workout_event_handler (PebbleWorkoutEvent *event) |
| Handle a workout event. | |
| bool | workout_service_is_workout_ongoing (void) |
| Check whether a workout is ongoing. | |
| void | workout_service_set_hrm_paused (bool paused) |
| Pause or resume the workout's heart rate sampling. | |
| bool | workout_service_is_workout_type_supported (ActivitySessionType type) |
| Check whether a session type can be a workout. | |
| bool | workout_service_start_workout (ActivitySessionType type) |
| Start a workout. | |
| bool | workout_service_pause_workout (bool should_be_paused) |
| Pause or resume the current workout. | |
| bool | workout_service_stop_workout (void) |
| Stop the current workout. | |
| bool | workout_service_takeover_activity_session (ActivitySession *session) |
| Turn a detected activity session into a workout. | |
| bool | workout_service_is_paused (void) |
| Check whether the current workout is paused. | |
| bool | workout_service_get_current_workout_type (ActivitySessionType *type_out) |
| Get the type of the current workout. | |
| bool | workout_service_get_current_workout_info (int32_t *steps_out, int32_t *duration_s_out, int32_t *distance_m_out, int32_t *current_bpm_out, HRZone *current_hr_zone_out) |
| Get the current workout metrics. | |
Manually started and stopped activity sessions.
Workouts are like detected activity sessions, but are started and stopped by the user and update more frequently. Only one workout runs at a time, and automatic session detection is disabled while it runs. Workouts of at least a minute are saved as manual ActivitySession entries when stopped.
| void workout_service_activity_event_handler | ( | PebbleActivityEvent * | event | ) |
Handle an activity event.
Pauses the workout when activity tracking stops. Called from the KernelMain event loop.
| event | Event. |
| void workout_service_frontend_closed | ( | void | ) |
Signal that the workout app was closed.
Arms a reminder notification for a workout left running. Must be called from the app task.
| void workout_service_frontend_opened | ( | void | ) |
Signal that the workout app was opened.
Cancels the abandoned workout reminder. Must be called from the app task.
| bool workout_service_get_current_workout_info | ( | int32_t * | steps_out, |
| int32_t * | duration_s_out, | ||
| int32_t * | distance_m_out, | ||
| int32_t * | current_bpm_out, | ||
| HRZone * | current_hr_zone_out | ||
| ) |
Get the current workout metrics.
Each output is optional.
| [out] | steps_out | Steps. |
| [out] | duration_s_out | Duration excluding pauses, in seconds. |
| [out] | distance_m_out | Distance, in meters. |
| [out] | current_bpm_out | Current heart rate, in beats per minute. |
| [out] | current_hr_zone_out | Current heart rate zone. |
| bool workout_service_get_current_workout_type | ( | ActivitySessionType * | type_out | ) |
Get the type of the current workout.
| [out] | type_out | Workout type. |
| void workout_service_health_event_handler | ( | PebbleHealthEvent * | event | ) |
Handle a health event (movement and heart rate updates).
Called from the KernelMain event loop.
| event | Event. |
| void workout_service_init | ( | void | ) |
Initialize the workout service.
| bool workout_service_is_paused | ( | void | ) |
Check whether the current workout is paused.
| bool workout_service_is_workout_ongoing | ( | void | ) |
Check whether a workout is ongoing.
| bool workout_service_is_workout_type_supported | ( | ActivitySessionType | type | ) |
Check whether a session type can be a workout.
| type | Session type. |
| bool workout_service_pause_workout | ( | bool | should_be_paused | ) |
Pause or resume the current workout.
Paused time does not count toward the workout duration.
| should_be_paused | true to pause, false to resume. |
| void workout_service_set_hrm_paused | ( | bool | paused | ) |
Pause or resume the workout's heart rate sampling.
Frees the shared optical path for a SpO2 reading during a workout. No-op without a workout heart rate session.
| paused | true to pause, false to resume. |
| bool workout_service_start_workout | ( | ActivitySessionType | type | ) |
Start a workout.
Ends ongoing detected sessions and disables automatic session detection. Every started workout must eventually be stopped.
| type | Workout type. |
| bool workout_service_stop_workout | ( | void | ) |
Stop the current workout.
Saves it as a session and notifies the user if it lasted at least a minute, and re-enables automatic session detection.
| bool workout_service_takeover_activity_session | ( | ActivitySession * | session | ) |
Turn a detected activity session into a workout.
The session is removed and a workout starts with its start time, duration, steps, distance and calories.
| session | Session to take over. |
| void workout_service_workout_event_handler | ( | PebbleWorkoutEvent * | event | ) |
Handle a workout event.
Called from the KernelMain event loop.
| event | Event. |