Heart Rate Service
The heart rate service exposes heart rate and other data related to a heart rate sensor intended for fitness applications.
Examples
API Reference
Header File
Functions
- 
esp_err_t esp_ble_hrs_get_location(uint8_t *location)
- Get the sensor location value of the device. - Parameters
- location – [in] The pointer to store the sensor location value 
- Returns
- ESP_OK on successful 
- ESP_ERR_INVALID_ARG on wrong location 
 
 
- 
esp_err_t esp_ble_hrs_set_location(uint8_t location)
- Set the sensor location value of the device. - Parameters
- location – [in] The sensor location value 
- Returns
- ESP_OK on successful 
- ESP_ERR_INVALID_ARG on wrong location 
 
 
- 
esp_err_t esp_ble_hrs_get_hrm(esp_ble_hrs_hrm_t *hrm)
- Get the value of the heart rate measurement of the device. - Parameters
- hrm – [in] The pointer to store the value of the heart rate measurement 
- Returns
- ESP_OK on successful 
- ESP_ERR_INVALID_ARG on wrong heart rate measurement 
 
 
- 
esp_err_t esp_ble_hrs_set_hrm(esp_ble_hrs_hrm_t *hrm)
- Set the value of the heart rate measurement of the device. - Parameters
- hrm – [in] The pointer to store the value of the heart rate measurement 
- Returns
- ESP_OK on successful 
- ESP_ERR_INVALID_ARG on wrong heart rate measurement 
 
 
- 
esp_err_t esp_ble_hrs_init(void)
- Initialization Heart Rate Service. - Returns
- ESP_OK on successful 
- ESP_ERR_INVALID_ARG on wrong initialization 
- ESP_FAIL on error 
 
 
Structures
- 
struct esp_ble_hrs_hrm_t
- Heart Rate Measurement Characteristic. - Public Members - 
uint8_t format
- Heart rate value format flag 
 - 
uint8_t detected
- Sensor contact detected flag 
 - 
uint8_t supported
- Sensor contact cupported flag 
 - 
uint8_t energy
- Energy expended present flag 
 - 
uint8_t interval
- RR-Interval present flag 
 - 
uint8_t reserved
- Reserved for future use flag 
 - 
struct esp_ble_hrs_hrm_t::[anonymous] flags
- Flags of heart rate measurement 
 - 
uint8_t u8
- 8 bit resolution 
 - 
uint16_t u16
- 16 bit resolution 
 - 
union esp_ble_hrs_hrm_t::[anonymous] heartrate
- Heart rate measurement value 
 - 
uint16_t energy_val
- Expended energy value 
 - 
uint16_t interval_buf[BLE_HRS_CHR_MERSUREMENT_RR_INTERVAL_MAX_NUM]
- The RR-Interval value represents the time between two R-Wave detections 
 
- 
uint8_t format
Macros
- 
BLE_HRS_UUID16
- 
BLE_HRS_CHR_UUID16_MEASUREMENT
- 
BLE_HRS_CHR_UUID16_BODY_SENSOR_LOC
- 
BLE_HRS_CHR_UUID16_HEART_RATE_CNTL_POINT
- 
BLE_HRS_CHR_MERSUREMENT_RR_INTERVAL_MAX_NUM
- 
BLE_HRS_CHR_BODY_SENSOR_LOC_OTHER
- 
BLE_HRS_CHR_BODY_SENSOR_LOC_CHEST
- 
BLE_HRS_CHR_BODY_SENSOR_LOC_WRIST
- 
BLE_HRS_CHR_BODY_SENSOR_LOC_FINGER
- 
BLE_HRS_CHR_BODY_SENSOR_LOC_HAND
- 
BLE_HRS_CHR_BODY_SENSOR_LOC_EAR_LOBE
- 
BLE_HRS_CHR_BODY_SENSOR_LOC_FOOT
- 
BLE_HRS_CHR_BODY_SENSOR_LOC_RFU
- 
BLE_HRS_CHR_BODY_SENSOR_LOC_MAX