PebbleOS
Loading...
Searching...
No Matches
Data Structures | Macros | Functions
activity_algorithm.h File Reference
#include <stdbool.h>
#include <stdint.h>
#include <pbl/services/activity/activity.h>
#include <pbl/kernel/compiler.h>

Data Structures

struct  AlgMinuteFileSampleV5
 Minute file sample, version 5 fields. More...
 
struct  AlgMinuteFileSample
 Minute file sample. More...
 
struct  AlgMinuteDLSSample
 Data logging minute sample. More...
 
struct  AlgMinuteRecord
 Minute record in the circular buffer. More...
 
struct  AlgMinuteRecordHdr
 Header of minute file and data logging minute records. More...
 
struct  AlgMinuteDLSRecord
 Data logging minute record. More...
 
struct  AlgMinuteFileRecord
 Minute file record. More...
 
union  AlgMinuteFileSampleV5.__unnamed47__
 Minute flags. More...
 
struct  AlgMinuteFileSampleV5.__unnamed47__.__unnamed49__
 Individual flags. More...
 

Macros

#define ALG_MINUTE_FILE_RECORD_VERSION   6
 Version of the minute file records.
 
#define ALG_DLS_MINUTES_RECORD_VERSION   14
 Version of the data logging minute records.
 
#define ALG_MINUTES_PER_DLS_RECORD   15
 Number of minutes in a data logging minute record.
 
#define ALG_MINUTES_PER_FILE_RECORD   15
 Number of minutes in a minute file record.
 
#define ALG_MINUTE_DATA_FILE_LEN   0x20000
 Size quota of the minute file, in bytes.
 
#define ALG_MINUTE_FILE_MAX_ENTRIES   (ALG_MINUTE_DATA_FILE_LEN / sizeof(AlgMinuteFileRecord))
 Upper bound of the number of records in the minute file.
 

Functions

bool activity_algorithm_init (AccelSamplingRate *sampling_rate)
 Initialize the algorithm.
 
void activity_algorithm_early_deinit (void)
 Start tearing down: end all ongoing sessions.
 
bool activity_algorithm_deinit (void)
 Deinitialize the algorithm.
 
bool activity_algorithm_set_user (uint32_t height_mm, uint32_t weight_g, ActivityGender gender, uint32_t age_years)
 Set the user metrics used for the calorie computations.
 
void activity_algorithm_handle_accel (AccelRawData *data, uint32_t num_samples, uint64_t timestamp_ms)
 Process accelerometer samples.
 
void activity_algorithm_minute_handler (time_t utc_sec, AlgMinuteRecord *record_out)
 Collect and log the stats of the last minute.
 
bool activity_algorithm_get_steps (uint32_t *steps)
 Get the number of steps counted today.
 
void activity_algorithm_enable_activity_tracking (bool enable)
 Enable or disable automatic activity session detection.
 
bool activity_algorithm_activity_hrm_is_active (void)
 Check whether a continuous heart rate session is active for a detected activity.
 
void activity_algorithm_activity_hrm_set_paused (bool paused)
 Pause or resume the heart rate session of a detected activity.
 
bool activity_algorithm_get_step_rate (uint16_t *steps, uint32_t *elapsed_ms, time_t *end_sec)
 Get the most recent stepping rate.
 
bool activity_algorithm_metrics_changed_notification (void)
 Notify the algorithm that the metrics changed.
 
time_t activity_algorithm_get_last_sleep_utc (void)
 Get the last minute processed by the sleep detector.
 
void activity_algorithm_send_minutes (void)
 Send the buffered minute data to data logging now.
 
void activity_algorithm_post_process_sleep_sessions (uint16_t num_sessions, ActivitySession *sessions)
 Relabel sleep sessions that should be naps.
 
bool activity_algorithm_get_minute_history (HealthMinuteData *minute_data, uint32_t *num_records, time_t *utc_start)
 Get historical minute data.
 
bool activity_algorithm_dump_minute_data_to_log (void)
 Dump the minute file base64-encoded with PBL_LOG.
 
bool activity_algorithm_minute_file_info (bool compact_first, uint32_t *num_records, uint32_t *data_bytes, uint32_t *minutes)
 Get information on the minute file.
 
bool activity_algorithm_test_fill_minute_file (void)
 Fill the minute file (test apps).
 
bool activity_algorithm_test_send_fake_minute_data_dls_record (void)
 Send a fake minute record to data logging (mobile app testing).