心率服务

[English]

心率服务公开心率和其他与用于健身应用的心率传感器相关的数据。

示例

bluetooth/ble_services/ble_hrs.

API 参考

Header File

Functions

esp_err_t esp_ble_hrs_get_location(uint8_t *location)

Get the sensor location value of the device.

参数

location[in] The pointer to store the sensor location value

返回

  • 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.

参数

location[in] The sensor location value

返回

  • 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.

参数

hrm[in] The pointer to store the value of the heart rate measurement

返回

  • 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.

参数

hrm[in] The pointer to store the value of the heart rate measurement

返回

  • 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.

返回

  • 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

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