Bluetooth LE Profile API document
Bluetooth LE Profile API document Rev.1.00 [May 22, 2020]
Heart Rate Service Client

This is the client for the Heart Rate Service. More...

Detailed Description

This is the client for the Heart Rate Service.

Data Structures

struct  st_ble_hrc_meas_flags_t
 Heart Rate Measurement Flags value structure. More...
 
struct  st_ble_hrc_meas_t
 Heart Rate Measurement value structure. More...
 
struct  st_ble_hrc_meas_attr_hdl_t
 Heart Rate Measurement attribute handle value. More...
 
struct  st_ble_hrc_body_sensor_location_attr_hdl_t
 Body Sensor Location attribute handle value. More...
 
struct  st_ble_hrc_heart_rate_cp_attr_hdl_t
 Heart Rate Control Point attribute handle value. More...
 
struct  st_ble_hrc_evt_data_t
 Heart Rate client event data. More...
 

Macros

#define BLE_HRC_MEAS_UUID   (0x2A37)
 
#define BLE_HRC_MEAS_LEN   (20)
 
#define BLE_HRC_MEAS_CLI_CNFG_UUID   (0x2902)
 
#define BLE_HRC_MEAS_CLI_CNFG_LEN   (2)
 
#define BLE_HRC_BODY_SENSOR_LOCATION_UUID   (0x2A38)
 
#define BLE_HRC_BODY_SENSOR_LOCATION_LEN   (1)
 
#define BLE_HRC_HEART_RATE_CP_UUID   (0x2A39)
 
#define BLE_HRC_HEART_RATE_CP_LEN   (1)
 
#define BLE_HRC_HEART_RATE_CONTROL_POINT_NOT_SUPPORTED_ERROR   (BLE_ERR_GROUP_GATT | 0x80)
 Heart Rate Control Point Not Supported. More...
 

Enumerations

enum  e_ble_hrc_body_sensor_location_body_sensor_location_t {
  BLE_HRC_BODY_SENSOR_LOCATION_BODY_SENSOR_LOCATION_OTHER = 0,
  BLE_HRC_BODY_SENSOR_LOCATION_BODY_SENSOR_LOCATION_CHEST = 1,
  BLE_HRC_BODY_SENSOR_LOCATION_BODY_SENSOR_LOCATION_WRIST = 2,
  BLE_HRC_BODY_SENSOR_LOCATION_BODY_SENSOR_LOCATION_FINGER = 3,
  BLE_HRC_BODY_SENSOR_LOCATION_BODY_SENSOR_LOCATION_HAND = 4,
  BLE_HRC_BODY_SENSOR_LOCATION_BODY_SENSOR_LOCATION_EAR_LOBE = 5,
  BLE_HRC_BODY_SENSOR_LOCATION_BODY_SENSOR_LOCATION_FOOT = 6
}
 Body Sensor Location Body Sensor Location enumeration. More...
 
enum  e_ble_hrc_heart_rate_cp_heart_rate_control_point_t { BLE_HRC_HEART_RATE_CP_HEART_RATE_CONTROL_POINT_RESET_ENERGY_EXPENDED = 1 }
 Heart Rate Control Point Heart Rate Control Point enumeration. More...
 
enum  e_ble_hrc_char_idx_t {
  BLE_HRC_MEAS_IDX,
  BLE_HRC_MEAS_CLI_CNFG_IDX,
  BLE_HRC_BODY_SENSOR_LOCATION_IDX,
  BLE_HRC_HEART_RATE_CP_IDX
}
 Heart Rate characteristic ID. More...
 
enum  e_ble_hrc_event_t {
  BLE_HRC_EVENT_MEAS_HDL_VAL_NTF = BLE_SERVC_ATTR_EVENT(BLE_HRC_MEAS_IDX, BLE_SERVC_HDL_VAL_NTF),
  BLE_HRC_EVENT_MEAS_CLI_CNFG_READ_RSP = BLE_SERVC_ATTR_EVENT(BLE_HRC_MEAS_CLI_CNFG_IDX, BLE_SERVC_READ_RSP),
  BLE_HRC_EVENT_MEAS_CLI_CNFG_WRITE_RSP = BLE_SERVC_ATTR_EVENT(BLE_HRC_MEAS_CLI_CNFG_IDX, BLE_SERVC_WRITE_RSP),
  BLE_HRC_EVENT_BODY_SENSOR_LOCATION_READ_RSP = BLE_SERVC_ATTR_EVENT(BLE_HRC_BODY_SENSOR_LOCATION_IDX, BLE_SERVC_READ_RSP),
  BLE_HRC_EVENT_HEART_RATE_CP_WRITE_RSP = BLE_SERVC_ATTR_EVENT(BLE_HRC_HEART_RATE_CP_IDX, BLE_SERVC_WRITE_RSP)
}
 Heart Rate client event type. More...
 

Functions

ble_status_t R_BLE_HRC_ReadMeasCliCnfg (uint16_t conn_hdl)
 Read Heart Rate Measurement characteristic Client Characteristic Configuration descriptor value from the remote GATT database. More...
 
ble_status_t R_BLE_HRC_WriteMeasCliCnfg (uint16_t conn_hdl, const uint16_t *p_value)
 Write Heart Rate Measurement characteristic Client Characteristic Configuration descriptor value to remote GATT database. More...
 
void R_BLE_HRC_GetMeasAttrHdl (const st_ble_dev_addr_t *p_addr, st_ble_hrc_meas_attr_hdl_t *p_hdl)
 Get Heart Rate Measurement attribute handles. More...
 
ble_status_t R_BLE_HRC_ReadBodySensorLocation (uint16_t conn_hdl)
 Read Body Sensor Location characteristic value from the remote GATT database. More...
 
void R_BLE_HRC_GetBodySensorLocationAttrHdl (const st_ble_dev_addr_t *p_addr, st_ble_hrc_body_sensor_location_attr_hdl_t *p_hdl)
 Get Body Sensor Location attribute handles. More...
 
ble_status_t R_BLE_HRC_WriteHeartRateCp (uint16_t conn_hdl, const uint8_t *p_value)
 Write Heart Rate Control Point characteristic value to remote GATT database. More...
 
void R_BLE_HRC_GetHeartRateCpAttrHdl (const st_ble_dev_addr_t *p_addr, st_ble_hrc_heart_rate_cp_attr_hdl_t *p_hdl)
 Get Heart Rate Control Point attribute handles. More...
 
ble_status_t R_BLE_HRC_Init (ble_servc_app_cb_t cb)
 Initialize Heart Rate client. More...
 
void R_BLE_HRC_ServDiscCb (uint16_t conn_hdl, uint8_t serv_idx, uint16_t type, void *p_param)
 Heart Rate client discovery callback. More...
 
void R_BLE_HRC_GetServAttrHdl (const st_ble_dev_addr_t *p_addr, st_ble_gatt_hdl_range_t *p_hdl)
 Get Heart Rate client attribute handle. More...
 

Macro Definition Documentation

◆ BLE_HRC_HEART_RATE_CONTROL_POINT_NOT_SUPPORTED_ERROR

#define BLE_HRC_HEART_RATE_CONTROL_POINT_NOT_SUPPORTED_ERROR   (BLE_ERR_GROUP_GATT | 0x80)

Heart Rate Control Point Not Supported.

Enumeration Type Documentation

◆ e_ble_hrc_body_sensor_location_body_sensor_location_t

Body Sensor Location Body Sensor Location enumeration.

Enumerator
BLE_HRC_BODY_SENSOR_LOCATION_BODY_SENSOR_LOCATION_OTHER 

Other

BLE_HRC_BODY_SENSOR_LOCATION_BODY_SENSOR_LOCATION_CHEST 

Chest

BLE_HRC_BODY_SENSOR_LOCATION_BODY_SENSOR_LOCATION_WRIST 

Wrist

BLE_HRC_BODY_SENSOR_LOCATION_BODY_SENSOR_LOCATION_FINGER 

Finger

BLE_HRC_BODY_SENSOR_LOCATION_BODY_SENSOR_LOCATION_HAND 

Hand

BLE_HRC_BODY_SENSOR_LOCATION_BODY_SENSOR_LOCATION_EAR_LOBE 

Ear Lobe

BLE_HRC_BODY_SENSOR_LOCATION_BODY_SENSOR_LOCATION_FOOT 

Foot

◆ e_ble_hrc_heart_rate_cp_heart_rate_control_point_t

Heart Rate Control Point Heart Rate Control Point enumeration.

Enumerator
BLE_HRC_HEART_RATE_CP_HEART_RATE_CONTROL_POINT_RESET_ENERGY_EXPENDED 

Reset Energy Expended: resets the value of the Energy Expended field in the Heart Rate Measurement characteristic to 0

◆ e_ble_hrc_char_idx_t

Heart Rate characteristic ID.

◆ e_ble_hrc_event_t

Heart Rate client event type.

Function Documentation

◆ R_BLE_HRC_ReadMeasCliCnfg()

ble_status_t R_BLE_HRC_ReadMeasCliCnfg ( uint16_t  conn_hdl)

Read Heart Rate Measurement characteristic Client Characteristic Configuration descriptor value from the remote GATT database.

Parameters
[in]conn_hdlConnection handle.
Returns
ble_status_t

◆ R_BLE_HRC_WriteMeasCliCnfg()

ble_status_t R_BLE_HRC_WriteMeasCliCnfg ( uint16_t  conn_hdl,
const uint16_t *  p_value 
)

Write Heart Rate Measurement characteristic Client Characteristic Configuration descriptor value to remote GATT database.

Parameters
[in]conn_hdlConnection handle.
[in]p_valueHeart Rate Measurement characteristic Client Characteristic Configuration descriptor value to write.
Returns
ble_status_t

◆ R_BLE_HRC_GetMeasAttrHdl()

void R_BLE_HRC_GetMeasAttrHdl ( const st_ble_dev_addr_t p_addr,
st_ble_hrc_meas_attr_hdl_t p_hdl 
)

Get Heart Rate Measurement attribute handles.

Parameters
[in]p_addrBluetooth device address for the attribute handles.
[out]p_hdlThe pointer to store the retrieved attribute handles.
Returns
ble_status_t

◆ R_BLE_HRC_ReadBodySensorLocation()

ble_status_t R_BLE_HRC_ReadBodySensorLocation ( uint16_t  conn_hdl)

Read Body Sensor Location characteristic value from the remote GATT database.

Parameters
[in]conn_hdlConnection handle.
Returns
ble_status_t

◆ R_BLE_HRC_GetBodySensorLocationAttrHdl()

void R_BLE_HRC_GetBodySensorLocationAttrHdl ( const st_ble_dev_addr_t p_addr,
st_ble_hrc_body_sensor_location_attr_hdl_t p_hdl 
)

Get Body Sensor Location attribute handles.

Parameters
[in]p_addrBluetooth device address for the attribute handles.
[out]p_hdlThe pointer to store the retrieved attribute handles.
Returns
ble_status_t

◆ R_BLE_HRC_WriteHeartRateCp()

ble_status_t R_BLE_HRC_WriteHeartRateCp ( uint16_t  conn_hdl,
const uint8_t *  p_value 
)

Write Heart Rate Control Point characteristic value to remote GATT database.

Parameters
[in]conn_hdlConnection handle.
[in]p_valueHeart Rate Control Point characteristic value to write.
Returns
ble_status_t

◆ R_BLE_HRC_GetHeartRateCpAttrHdl()

void R_BLE_HRC_GetHeartRateCpAttrHdl ( const st_ble_dev_addr_t p_addr,
st_ble_hrc_heart_rate_cp_attr_hdl_t p_hdl 
)

Get Heart Rate Control Point attribute handles.

Parameters
[in]p_addrBluetooth device address for the attribute handles.
[out]p_hdlThe pointer to store the retrieved attribute handles.
Returns
ble_status_t

◆ R_BLE_HRC_Init()

ble_status_t R_BLE_HRC_Init ( ble_servc_app_cb_t  cb)

Initialize Heart Rate client.

Parameters
[in]cbClient callback.
Returns
ble_status_t

◆ R_BLE_HRC_ServDiscCb()

void R_BLE_HRC_ServDiscCb ( uint16_t  conn_hdl,
uint8_t  serv_idx,
uint16_t  type,
void *  p_param 
)

Heart Rate client discovery callback.

Parameters
[in]conn_hdlConnection handle
[in]serv_idxService instance index.
[in]typeService discovery event type.
[in]p_paramService discovery event parameter.
Returns
ble_status_t

◆ R_BLE_HRC_GetServAttrHdl()

void R_BLE_HRC_GetServAttrHdl ( const st_ble_dev_addr_t p_addr,
st_ble_gatt_hdl_range_t p_hdl 
)

Get Heart Rate client attribute handle.

Parameters
[in]p_addrBluetooth device address for the attribute handles.
[out]p_hdlThe pointer to store the retrieved attribute handles.