Heart Rate Profile

[中文]

The Heart Rate Profile is used to enable a data collection device to obtain data from a Heart Rate Sensor that exposes the Heart Rate Service.

Examples

bluetooth/ble_profiles/ble_hrp.

API Reference

Header File

Functions

esp_err_t esp_ble_hrp_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 battery level

esp_err_t esp_ble_hrp_get_ctrl(uint8_t *cmd_id)

Get the control point value of the device.

Parameters

cmd_id[in] The pointer to store the control point value

Returns

  • ESP_OK on successful

  • ESP_ERR_INVALID_ARG on wrong battery level

esp_err_t esp_ble_hrp_set_ctrl(uint8_t cmd_id)

Set the control point value of the device.

Parameters

cmd_id[in] The control point value

Returns

  • ESP_OK on successful

  • ESP_ERR_INVALID_ARG on wrong battery level

esp_err_t esp_ble_hrp_init(void)

Initialization Heart Rate Profile.

Returns

  • ESP_OK on successful

  • ESP_ERR_INVALID_ARG on wrong initialization

  • ESP_FAIL on error

esp_err_t esp_ble_hrp_deinit(void)

Deinitialization Heart Rate Profile.

Returns

  • ESP_OK on successful

  • ESP_ERR_INVALID_ARG on wrong initialization

  • ESP_FAIL on error

Structures

struct esp_ble_hrp_data_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 supported 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_hrp_data_t::[anonymous] flags

Flags of heart rate measurement

uint8_t u8

8 bit resolution

uint16_t u16

16 bit resolution

union esp_ble_hrp_data_t::[anonymous] heartrate

Heart rate measurement value

uint16_t energy_val

Expended energy value

uint16_t interval_buf[BLE_HRP_CHR_MERSUREMENT_RR_INTERVAL_MAX_NUM]

The RR-Interval value represents the time between two R-Wave detections

Macros

BLE_HRP_UUID16
BLE_HRP_CHR_UUID16_MEASUREMENT
BLE_HRP_CHR_UUID16_BODY_SENSOR_LOC
BLE_HRP_CHR_UUID16_HEART_RATE_CNTL_POINT
BLE_HRP_CHR_MERSUREMENT_RR_INTERVAL_MAX_NUM
BLE_HRP_FLAGS_BM_NONE
BLE_HRP_FLAGS_BM_FORMAT
BLE_HRP_FLAGS_BM_SENSOR_CONTACT_DETECTED
BLE_HRP_FLAGS_BM_SENSOR_CONTACT_SUPPOTRED
BLE_HRP_FLAGS_BM_ENERGY
BLE_HRP_FLAGS_BM_RR_INTERVAL
BLE_HRP_FLAGS_BM_RFU
BLE_HRP_CHR_MERSUREMENT_FLAGS_FORMAT_U8
BLE_HRP_CHR_MERSUREMENT_FLAGS_FORMAT_U16
BLE_HRP_CHR_MERSUREMENT_FLAGS_NOT
BLE_HRP_CHR_MERSUREMENT_FLAGS_SET
BLE_HRP_CMD_RFU
BLE_HRP_CMD_RESET_ENERGY_EXPENDED
BLE_HRP_CMD_MAX