PebbleOS
Loading...
Searching...
No Matches
Data Structures | Functions
Heart Rate Service

GATT Heart Rate Service, sharing the watch's heart rate with connected devices. More...

Data Structures

struct  pbl_bt_hrm_service_measurement
 A heart rate measurement. More...
 

Functions

void pbl_bt_hrm_service_enable (bool enable)
 Add or remove the Heart Rate Service from the GATT database.
 
void pbl_bt_hrm_service_handle_measurement (const struct pbl_bt_hrm_service_measurement *measurement, const struct pbl_bt_device_internal *permitted_devices, size_t num_permitted_devices)
 Send a heart rate measurement to the subscribed devices.
 
void pbl_bt_cb_hrm_service_update_subscription (const struct pbl_bt_device_internal *device, bool is_subscribed)
 Called when a connected device (un)subscribes to the Heart Rate Measurement characteristic.
 

Detailed Description

GATT Heart Rate Service, sharing the watch's heart rate with connected devices.

Implemented by backends that select CONFIG_BT_HRM_SERVICE. The NimBLE backend does not.


Data Structure Documentation

◆ pbl_bt_hrm_service_measurement

struct pbl_bt_hrm_service_measurement

A heart rate measurement.

Data Fields
uint16_t bpm Heart rate in beats per minute.
bool is_on_wrist True if the watch is worn.

Function Documentation

◆ pbl_bt_cb_hrm_service_update_subscription()

void pbl_bt_cb_hrm_service_update_subscription ( const struct pbl_bt_device_internal *  device,
bool  is_subscribed 
)
extern

Called when a connected device (un)subscribes to the Heart Rate Measurement characteristic.

Parameters
deviceThe device.
is_subscribedtrue if the device is now subscribed.

◆ pbl_bt_hrm_service_enable()

void pbl_bt_hrm_service_enable ( bool  enable)

Add or remove the Heart Rate Service from the GATT database.

Connected devices are sent a Service Changed indication for the affected handle range.

Parameters
enabletrue to add the service, false to remove it.

◆ pbl_bt_hrm_service_handle_measurement()

void pbl_bt_hrm_service_handle_measurement ( const struct pbl_bt_hrm_service_measurement *  measurement,
const struct pbl_bt_device_internal *  permitted_devices,
size_t  num_permitted_devices 
)

Send a heart rate measurement to the subscribed devices.

Parameters
measurementThe measurement.
permitted_devicesDevices allowed to receive it.
num_permitted_devicesNumber of entries in permitted_devices.