PebbleOS
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Enumerations | Functions
hrm_manager.h File Reference
#include <pbl/services/accel_manager_types.h>
#include <process_management/app_install_types.h>
#include <pbl/util/units.h>
#include <stdbool.h>
#include <stdint.h>
#include <kernel/pebble_tasks.h>

Data Structures

struct  HRMAccelData
 Accelerometer samples for the HRM driver's motion compensation. More...
 
struct  HRMData
 Data reported by the HRM driver. More...
 

Macros

#define HRM_MANAGER_ACCEL_RATE_MILLIHZ   (25000)
 Accelerometer sampling rate provided to the HRM driver, in mHz (25 Hz).
 
#define HRM_MANAGER_MAX_ACCEL_SAMPLES   ((2 * HRM_MANAGER_ACCEL_RATE_MILLIHZ) / 1000)
 Accelerometer samples buffered for the driver: 2 s, in case a handshake is missed.
 
#define HRM_MANAGER_APP_EXIT_EXPIRATION_SEC   PBL_SEC_PER_HOUR
 Expiration given to the subscription of an app that exits, in seconds.
 
#define HRM_INVALID_SESSION_REF   0
 Invalid subscription handle.
 
#define HRM_SUBSCRIPTION_EXPIRING_WARNING_SEC   5
 Minimum warning before a subscription expires, in seconds.
 

Typedefs

typedef uint32_t HRMSessionRef
 Subscription handle.
 

Enumerations

enum  HRMQuality {
  HRMQuality_OffWrist = -1 , HRMQuality_Worst = 0 , HRMQuality_Poor , HRMQuality_Acceptable ,
  HRMQuality_Good , HRMQuality_Excellent
}
 Quality of a reading, as graded by the sensor algorithm. More...
 
enum  HRMFeatureShift { HRMFeatureShift_BPM = 0 , HRMFeatureShift_HRV = 1 , HRMFeatureShift_SpO2 = 2 , HRMFeatureShiftMax }
 Bit positions of HRMFeature. More...
 
enum  HRMFeature { HRMFeature_BPM = (1 << HRMFeatureShift_BPM) , HRMFeature_HRV = (1 << HRMFeatureShift_HRV) , HRMFeature_SpO2 = (1 << HRMFeatureShift_SpO2) , HRMFeatureMax }
 Sensor features, combined as a bitmask. More...
 

Functions

HRMAccelData * hrm_manager_get_accel_data (void)
 Get the accelerometer samples collected since the last release.
 
void hrm_manager_release_accel_data (void)
 Empty and unlock the buffer returned by hrm_manager_get_accel_data().
 
void hrm_manager_init (void)
 Initialize the HRM manager.
 
void hrm_manager_handle_prefs_changed (void)
 Re-evaluate the sensor state after the HRM related preferences changed.
 
bool hrm_manager_has_continuous_green_subscriber (void)
 Check whether a live subscriber keeps the green optical path on continuously.
 
HRMSessionRef sys_hrm_manager_app_subscribe (AppInstallId app_id, uint32_t update_interval_s, uint16_t expire_s, HRMFeature features)
 Subscribe an app or worker to sensor updates.
 
HRMSessionRef sys_hrm_manager_get_app_subscription (AppInstallId app_id)
 Get the subscription of an app or worker.
 
bool sys_hrm_manager_unsubscribe (HRMSessionRef session)
 Unsubscribe, turning the sensor off if no longer needed.
 
bool sys_hrm_manager_set_features (HRMSessionRef session, HRMFeature features)
 Change the features of a subscription.
 
bool sys_hrm_manager_set_update_interval (HRMSessionRef session, uint32_t update_interval_s, uint16_t expire_s)
 Change the update interval and expiration of a subscription.
 
bool sys_hrm_manager_get_subscription_info (HRMSessionRef session, AppInstallId *app_id, uint32_t *update_interval_s, uint16_t *expire_s, HRMFeature *features)
 Get information on a subscription.
 
bool sys_hrm_manager_is_hrm_present (void)
 Check whether a heart rate monitor is present and accessible.
 
void hrm_manager_enable (bool on)
 Enable or disable the HRM manager for the current run level.
 
void hrm_manager_new_data_cb (const HRMData *data)
 Report new data from the HRM driver.
 
void hrm_manager_process_cleanup (PebbleTask task, AppInstallId app_id)
 Clean up after an app or worker exited.