nRF Connect SDK Bare Metal API 2.0.99
Loading...
Searching...
No Matches
ble_hrs_client.h
1/*
2 * Copyright (c) 2012 - 2026 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
26#ifndef BLE_HRS_CLIENT_H__
27#define BLE_HRS_CLIENT_H__
28
29#include <stdint.h>
30#include <ble.h>
31#include <bm/bluetooth/ble_db_discovery.h>
32#include <bm/bluetooth/ble_gq.h>
33#include <bm/softdevice_handler/nrf_sdh_ble.h>
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
45#define BLE_HRS_CLIENT_DEF(_name) \
46 static struct ble_hrs_client _name; \
47 NRF_SDH_BLE_OBSERVER(_name##_obs, ble_hrs_client_on_ble_evt, &_name, HIGH)
48
66
72 uint16_t hr_value;
76 uint16_t rr_intervals[CONFIG_BLE_HRS_CLIENT_RR_INTERVALS_MAX_COUNT];
77};
78
86 uint16_t hrm_handle;
88 uint16_t bsl_handle;
89};
90
98 uint16_t conn_handle;
99 union {
101 struct {
108 struct {
112 struct {
114 uint32_t reason;
116 };
117};
118
120struct ble_hrs_client;
121
128typedef void (*ble_hrs_client_evt_handler_t)(struct ble_hrs_client *hrs_client,
129 const struct ble_hrs_client_evt *evt);
130
146
160
178uint32_t ble_hrs_client_init(struct ble_hrs_client *hrs_client,
179 const struct ble_hrs_client_config *hrs_client_config);
180
194void ble_hrs_client_on_ble_evt(const ble_evt_t *ble_evt, void *ble_hrs_client);
195
213
231
248 const struct ble_db_discovery_evt *evt);
249
271uint32_t ble_hrs_client_handles_assign(struct ble_hrs_client *hrs_client, uint16_t conn_handle,
272 const struct ble_hrs_handles *peer_hrs_handles);
273
274#ifdef __cplusplus
275}
276#endif
277
278#endif /* BLE_HRS_CLIENT_H__ */
279
uint32_t ble_hrs_client_hrm_notif_disable(struct ble_hrs_client *hrs_client)
Request the peer to stop sending notification of Heart Rate Measurement.
void ble_hrs_on_db_disc_evt(struct ble_hrs_client *hrs_client, const struct ble_db_discovery_evt *evt)
Handle events from the Database Discovery module.
uint32_t ble_hrs_client_init(struct ble_hrs_client *hrs_client, const struct ble_hrs_client_config *hrs_client_config)
Initialize the Heart Rate Client module.
void(* ble_hrs_client_evt_handler_t)(struct ble_hrs_client *hrs_client, const struct ble_hrs_client_evt *evt)
Event handler type.
Definition ble_hrs_client.h:128
void ble_hrs_client_on_ble_evt(const ble_evt_t *ble_evt, void *ble_hrs_client)
Bluetooth LE event handler for the Heart Rate Service Client.
uint32_t ble_hrs_client_handles_assign(struct ble_hrs_client *hrs_client, uint16_t conn_handle, const struct ble_hrs_handles *peer_hrs_handles)
Assign handles to an instance of hrs_c.
uint32_t ble_hrs_client_hrm_notif_enable(struct ble_hrs_client *hrs_client)
Request the peer to start sending notification of Heart Rate Measurement.
ble_hrs_client_evt_type
HRS Client event type.
Definition ble_hrs_client.h:52
@ BLE_HRS_CLIENT_EVT_DISCOVERY_COMPLETE
Definition ble_hrs_client.h:54
@ BLE_HRS_CLIENT_EVT_HRM_NOTIFICATION
Definition ble_hrs_client.h:58
@ BLE_HRS_CLIENT_EVT_ERROR
Definition ble_hrs_client.h:64
@ BLE_HRS_CLIENT_EVT_BSL_UPDATE
Definition ble_hrs_client.h:62
Bluetooth LE database discovery event.
Definition ble_db_discovery.h:61
uint16_t conn_handle
Connection handle on which the discovery is started.
Definition ble_db_discovery.h:172
Bluetooth LE database discovery.
Definition ble_db_discovery.h:122
Bluetooth LE GATT Queue.
Definition ble_gq.h:238
ble_hrs_client_evt_handler_t evt_handler
Definition ble_hrs_client.h:154
const struct ble_gq * gatt_queue
Definition ble_hrs_client.h:156
struct ble_db_discovery * db_discovery
Definition ble_hrs_client.h:158
Heart Rate Client configuration structure.
Definition ble_hrs_client.h:150
struct ble_hrs_client_evt::@98::@100 discovery_complete
uint32_t reason
Definition ble_hrs_client.h:114
enum ble_hrs_client_evt_type evt_type
Definition ble_hrs_client.h:96
uint8_t body_sensor_location
Definition ble_hrs_client.h:109
struct ble_hrs_measurement hrm_notification
Definition ble_hrs_client.h:106
uint16_t conn_handle
Definition ble_hrs_client.h:98
struct ble_hrs_handles handles
Definition ble_hrs_client.h:103
struct ble_hrs_client_evt::@98::@102 error
struct ble_hrs_client_evt::@98::@101 bsl_update
Heart Rate Event.
Definition ble_hrs_client.h:94
uint16_t conn_handle
Definition ble_hrs_client.h:136
struct ble_hrs_handles handles
Definition ble_hrs_client.h:138
const struct ble_gq * gatt_queue
Definition ble_hrs_client.h:144
ble_hrs_client_evt_handler_t evt_handler
Definition ble_hrs_client.h:142
Heart Rate Client.
Definition ble_hrs_client.h:134
uint16_t hrm_handle
Definition ble_hrs_client.h:86
uint16_t bsl_handle
Definition ble_hrs_client.h:88
uint16_t hrm_cccd_handle
Definition ble_hrs_client.h:84
Database for handles related to the Heart Rate Service found on the peer.
Definition ble_hrs_client.h:82
uint8_t rr_intervals_cnt
Definition ble_hrs_client.h:74
uint16_t rr_intervals[CONFIG_BLE_HRS_CLIENT_RR_INTERVALS_MAX_COUNT]
Definition ble_hrs_client.h:76
uint16_t hr_value
Definition ble_hrs_client.h:72
Heart Rate Measurement received from the peer.
Definition ble_hrs_client.h:70