Zephyr API Documentation  3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Heart Rate Service (HRS)

Heart Rate Service (HRS) More...

Data Structures

struct  bt_hrs_cb
 Heart rate service callback structure. More...
 

Functions

int bt_hrs_cb_register (struct bt_hrs_cb *cb)
 Heart rate service callback register.
 
int bt_hrs_cb_unregister (struct bt_hrs_cb *cb)
 Heart rate service callback unregister.
 
int bt_hrs_notify (uint16_t heartrate)
 Notify heart rate measurement.
 

Detailed Description

Heart Rate Service (HRS)

[Experimental] Users should note that the APIs can change as a part of ongoing development.

Function Documentation

◆ bt_hrs_cb_register()

int bt_hrs_cb_register ( struct bt_hrs_cb cb)

#include <zephyr/bluetooth/services/hrs.h>

Heart rate service callback register.

This function will register callbacks that will be called in certain events related to Heart rate service.

Parameters
cbPointer to callbacks structure. Must point to memory that remains valid until unregistered.
Returns
0 on success
-EINVAL in case cb is NULL

◆ bt_hrs_cb_unregister()

int bt_hrs_cb_unregister ( struct bt_hrs_cb cb)

#include <zephyr/bluetooth/services/hrs.h>

Heart rate service callback unregister.

This function will unregister callback from Heart rate service.

Parameters
cbPointer to callbacks structure
Returns
0 on success
-EINVAL in case cb is NULL
-ENOENT in case the cb was not found in registered callbacks

◆ bt_hrs_notify()

int bt_hrs_notify ( uint16_t  heartrate)

#include <zephyr/bluetooth/services/hrs.h>

Notify heart rate measurement.

This will send a GATT notification to all current subscribers.

Parameters
heartrateThe heartrate measurement in beats per minute.
Returns
Zero in case of success and error code in case of error.