GATT Heart Rate Service (HRS) Client
The GATT Heart Rate Service Client is used to retrieve information about heart rate measurements.
Overview
The GATT HRS Client can retrieve information such as the sensor location from a device that provides the Heart Rate Service. It can also configure the Heart Rate Service on a remote device by writing specific values to the Heart Rate Control Point characteristic.
Configuration
Applications use the Bluetooth LE scanning for detecting advertising devices that support the Heart Rate Service. If an advertising device is detected, the application connects to it automatically and starts receiving HRS data.
Once a connection with a remote device providing a Heart Rate Service is established, the client needs service discovery to discover Heart Rate Service handles.
If this succeeds, the handles of the Heart Rate Service must be assigned to a HRS client instance using the bt_hrs_client_handles_assign()
function.
Now, the application is ready to operate with the remote Heart Rate Service.
Usage
Retrieve data from the Heart Rate Service or configure its behavior using the following functions:
bt_hrs_client_measurement_subscribe()
- Enable notifications for the Heart Rate Measurement characteristic.The notifications are passed to the provided callback function. You will receive the current heart rate measurement data.
bt_hrs_client_sensor_location_read()
- Read a heart rate sensor location.Check the possible locations in
bt_hrs_client_sensor_location
.bt_hrs_client_control_point_write()
- Configure a remote Heart Rate Service.Check the possible values for a Heart Rate Control Point characteristic in
bt_hrs_client_cp_value
.
Samples using the library
The following nRF Connect SDK samples use this library:
Additional information
Do not use any of the values in the bt_hrs_client
object structure directly.
All values that should be accessed have accessory functions.
The structure is fully defined because the application must be able to allocate memory for it.
Dependencies
API:
include/bluetooth/gatt.h
include/bluetooth/conn.h
API documentation
include/bluetooth/services/hrs_client.h
subsys/bluetooth/services/hrs_client.c