hrs.h
Go to the documentation of this file.
1
68 #ifndef __HRS_H__
69 #define __HRS_H__
70
71 #include "gr55xx_sys.h"
72 #include "custom_config.h"
73 #include <stdint.h>
74 #include <stdbool.h>
75
81 #define HRS_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ?\
82 10 : CFG_MAX_CONNECTIONS)
83 #define HRS_MEAS_MAX_LEN 20
84 #define HRS_MAX_BUFFERED_RR_INTERVALS 9
92 #define HRS_CHAR_MANDATORY 0x0F
93 #define HRS_CHAR_BODY_SENSOR_LOC_SUP 0x30
94 #define HRS_CHAR_ENGY_EXP_SUP 0xC0
103 typedef enum
104 {
105 HRS_SENS_LOC_OTHER,
106 HRS_SENS_LOC_CHEST,
107 HRS_SENS_LOC_WRIST,
108 HRS_SENS_LOC_FINGER,
109 HRS_SENS_LOC_HAND,
110 HRS_SENS_LOC_EARLOBE,
111 HRS_SENS_LOC_FOOT,
112 } hrs_sensor_loc_t;
113
115 typedef enum
116 {
117 HRS_EVT_NOTIFICATION_ENABLED,
118 HRS_EVT_NOTIFICATION_DISABLED,
119 HRS_EVT_RESET_ENERGY_EXPENDED,
120 HRS_EVT_READ_BODY_SEN_LOCATION,
121 } hrs_evt_type_t;
129 typedef struct
130 {
131 uint8_t conn_idx;
132 hrs_evt_type_t evt_type;
133 } hrs_evt_t;
141 typedef void (*hrs_evt_handler_t)(hrs_evt_t *p_evt);
149 typedef struct
150 {
151 hrs_evt_handler_t evt_handler;
152 bool is_sensor_contact_supported;
153 uint8_t char_mask;
154 hrs_sensor_loc_t sensor_loc;
155 } hrs_init_t;
169 void hrs_sensor_contact_detected_update(bool is_sensor_contact_detected);
170
178 void hrs_sensor_contact_supported_set(bool is_sensor_contact_supported);
179
190 void hrs_sensor_location_set(hrs_sensor_loc_t hrs_sensor_loc);
191
199 void hrs_energy_update(uint16_t energy);
200
212 sdk_err_t hrs_heart_rate_measurement_send(uint8_t conn_idx, uint16_t heart_rate, bool is_energy_updated);
213
227 void hrs_rr_interval_add(uint16_t rr_interval);
228
238 sdk_err_t hrs_service_init(hrs_init_t *p_hrs_init);
241 #endif
242
HRS_SENS_LOC_EARLOBE
@ HRS_SENS_LOC_EARLOBE
Definition: hrs.h:110
hrs_init_t::evt_handler
hrs_evt_handler_t evt_handler
Definition: hrs.h:151
hrs_evt_t::conn_idx
uint8_t conn_idx
Definition: hrs.h:131
hrs_init_t::sensor_loc
hrs_sensor_loc_t sensor_loc
Definition: hrs.h:154
HRS_EVT_NOTIFICATION_ENABLED
@ HRS_EVT_NOTIFICATION_ENABLED
Definition: hrs.h:117
hrs_evt_t
Heart Rate Service event.
Definition: hrs.h:130
hrs_init_t::char_mask
uint8_t char_mask
Definition: hrs.h:153
hrs_sensor_contact_detected_update
void hrs_sensor_contact_detected_update(bool is_sensor_contact_detected)
Set the state of the Sensor Contact Detected bit.
hrs_service_init
sdk_err_t hrs_service_init(hrs_init_t *p_hrs_init)
Init a Heart Rate Service instance and add in the DB.
hrs_rr_interval_add
void hrs_rr_interval_add(uint16_t rr_interval)
Add an RR Interval measurement to the RR Interval buffer.
hrs_sensor_location_set
void hrs_sensor_location_set(hrs_sensor_loc_t hrs_sensor_loc)
Set the Body Sensor Location.
HRS_SENS_LOC_WRIST
@ HRS_SENS_LOC_WRIST
Definition: hrs.h:107
gr55xx_sys.h
GR55XX System API.
HRS_SENS_LOC_FOOT
@ HRS_SENS_LOC_FOOT
Definition: hrs.h:111
hrs_evt_type_t
hrs_evt_type_t
Heart Rate Service event types.
Definition: hrs.h:116
hrs_heart_rate_measurement_send
sdk_err_t hrs_heart_rate_measurement_send(uint8_t conn_idx, uint16_t heart_rate, bool is_energy_updated)
Send Heart Rate measurement if Notify has been enabled.
hrs_sensor_loc_t
hrs_sensor_loc_t
Values for sensor location.
Definition: hrs.h:104
sdk_err_t
uint16_t sdk_err_t
SDK API result type.
Definition: ble_error.h:243
HRS_SENS_LOC_FINGER
@ HRS_SENS_LOC_FINGER
Definition: hrs.h:108
HRS_EVT_READ_BODY_SEN_LOCATION
@ HRS_EVT_READ_BODY_SEN_LOCATION
Definition: hrs.h:120
hrs_evt_t::evt_type
hrs_evt_type_t evt_type
Definition: hrs.h:132
hrs_init_t
Heart Rate Service Init variable.
Definition: hrs.h:150
HRS_EVT_NOTIFICATION_DISABLED
@ HRS_EVT_NOTIFICATION_DISABLED
Definition: hrs.h:118
HRS_EVT_RESET_ENERGY_EXPENDED
@ HRS_EVT_RESET_ENERGY_EXPENDED
Definition: hrs.h:119
hrs_energy_update
void hrs_energy_update(uint16_t energy)
Update Energy measurement if Energy Expended is supported.
HRS_SENS_LOC_CHEST
@ HRS_SENS_LOC_CHEST
Definition: hrs.h:106
HRS_SENS_LOC_HAND
@ HRS_SENS_LOC_HAND
Definition: hrs.h:109
hrs_evt_handler_t
void(* hrs_evt_handler_t)(hrs_evt_t *p_evt)
Heart Rate Service event handler type.
Definition: hrs.h:141
HRS_SENS_LOC_OTHER
@ HRS_SENS_LOC_OTHER
Definition: hrs.h:105
hrs_sensor_contact_supported_set
void hrs_sensor_contact_supported_set(bool is_sensor_contact_supported)
Set the state of the Sensor Contact Supported bit.
hrs_init_t::is_sensor_contact_supported
bool is_sensor_contact_supported
Definition: hrs.h:152