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
62
68 uint16_t hr_value;
72 uint16_t rr_intervals[CONFIG_BLE_HRS_CLIENT_RR_INTERVALS_MAX_COUNT];
73};
74
82 uint16_t hrm_handle;
83};
84
92 uint16_t conn_handle;
93 union {
95 struct {
102 struct {
104 uint32_t reason;
106 };
107};
108
110struct ble_hrs_client;
111
118typedef void (*ble_hrs_client_evt_handler_t)(struct ble_hrs_client *hrs_client,
119 const struct ble_hrs_client_evt *evt);
120
136
150
168uint32_t ble_hrs_client_init(struct ble_hrs_client *hrs_client,
169 const struct ble_hrs_client_config *hrs_client_config);
170
184void ble_hrs_client_on_ble_evt(const ble_evt_t *ble_evt, void *ble_hrs_client);
185
203
221
238 const struct ble_db_discovery_evt *evt);
239
261uint32_t ble_hrs_client_handles_assign(struct ble_hrs_client *hrs_client, uint16_t conn_handle,
262 const struct ble_hrs_handles *peer_hrs_handles);
263
264#ifdef __cplusplus
265}
266#endif
267
268#endif /* BLE_HRS_CLIENT_H__ */
269
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:118
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:60
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:144
const struct ble_gq * gatt_queue
Definition ble_hrs_client.h:146
struct ble_db_discovery * db_discovery
Definition ble_hrs_client.h:148
Heart Rate Client configuration structure.
Definition ble_hrs_client.h:140
struct ble_hrs_client_evt::@98::@100 discovery_complete
uint32_t reason
Definition ble_hrs_client.h:104
enum ble_hrs_client_evt_type evt_type
Definition ble_hrs_client.h:90
struct ble_hrs_client_evt::@98::@101 error
struct ble_hrs_measurement hrm_notification
Definition ble_hrs_client.h:100
uint16_t conn_handle
Definition ble_hrs_client.h:92
struct ble_hrs_handles handles
Definition ble_hrs_client.h:97
Heart Rate Event.
Definition ble_hrs_client.h:88
uint16_t conn_handle
Definition ble_hrs_client.h:126
struct ble_hrs_handles handles
Definition ble_hrs_client.h:128
const struct ble_gq * gatt_queue
Definition ble_hrs_client.h:134
ble_hrs_client_evt_handler_t evt_handler
Definition ble_hrs_client.h:132
Heart Rate Client.
Definition ble_hrs_client.h:124
uint16_t hrm_handle
Definition ble_hrs_client.h:82
uint16_t hrm_cccd_handle
Definition ble_hrs_client.h:80
Database for handles related to the Heart Rate Service found on the peer.
Definition ble_hrs_client.h:78
uint8_t rr_intervals_cnt
Definition ble_hrs_client.h:70
uint16_t rr_intervals[CONFIG_BLE_HRS_CLIENT_RR_INTERVALS_MAX_COUNT]
Definition ble_hrs_client.h:72
uint16_t hr_value
Definition ble_hrs_client.h:68
Heart Rate Measurement received from the peer.
Definition ble_hrs_client.h:66