S115 SoftDevice for nRF54L15/nRF54L10/nRF54L05 API documentation 10.0.0
Loading...
Searching...
No Matches
ble_gattc.h
1/*
2 * Copyright (c) Nordic Semiconductor ASA
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without modification,
6 * are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice, this
9 * list of conditions and the following disclaimer.
10 *
11 * 2. Redistributions in binary form, except as embedded into a Nordic
12 * Semiconductor ASA integrated circuit in a product or a software update for
13 * such product, must reproduce the above copyright notice, this list of
14 * conditions and the following disclaimer in the documentation and/or other
15 * materials provided with the distribution.
16 *
17 * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
18 * contributors may be used to endorse or promote products derived from this
19 * software without specific prior written permission.
20 *
21 * 4. This software, with or without modification, must only be used with a
22 * Nordic Semiconductor ASA integrated circuit.
23 *
24 * 5. Any software provided in binary form under this license must not be reverse
25 * engineered, decompiled, modified and/or disassembled.
26 *
27 * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
28 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
29 * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
30 * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
31 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
33 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
36 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 */
38
45#ifndef BLE_GATTC_H__
46#define BLE_GATTC_H__
47
48#include <stdint.h>
49#include "nrf_svc.h"
50#include "nrf_error.h"
51#include "ble_ranges.h"
52#include "ble_types.h"
53#include "ble_err.h"
54#include "ble_gatt.h"
55
56#ifdef __cplusplus
57extern "C" {
58#endif
59
78
98
106
114#define BLE_ERROR_GATTC_PROC_NOT_PERMITTED (NRF_GATTC_ERR_BASE + 0x000)
119#define BLE_GATTC_ATTR_INFO_FORMAT_16BIT 1
120#define BLE_GATTC_ATTR_INFO_FORMAT_128BIT 2
125#define BLE_GATTC_WRITE_CMD_TX_QUEUE_SIZE_DEFAULT 1
136typedef struct
137{
141
143typedef struct
144{
145 uint16_t start_handle;
146 uint16_t end_handle;
148
149
156
157
164
165
175
176
178typedef struct
179{
180 uint16_t handle;
183
184
186typedef struct
187{
188 uint8_t write_op;
189 uint8_t flags;
190 uint16_t handle;
191 uint16_t offset;
192 uint16_t len;
193 uint8_t const *p_value;
195
197typedef struct
198{
199 uint16_t handle;
202
204typedef struct
205{
206 uint16_t handle;
209
211typedef struct
212{
213 uint16_t count;
217
219typedef struct
220{
221 uint16_t count;
225
227typedef struct
228{
229 uint16_t count;
233
235typedef struct
236{
237 uint16_t count;
241
243typedef struct
244{
245 uint16_t count;
246 uint8_t format;
247 union
248 {
249 ble_gattc_attr_info16_t attr_info16[1];
252 ble_gattc_attr_info128_t attr_info128[1];
255 } info;
257
259typedef struct
260{
261 uint16_t handle;
262 uint8_t *p_value;
264
266typedef struct
267{
268 uint16_t count;
269 uint16_t value_len;
270 uint8_t handle_value[1];
274
276typedef struct
277{
278 uint16_t handle;
279 uint16_t offset;
280 uint16_t len;
281 uint8_t data[1];
284
286typedef struct
287{
288 uint16_t len;
289 uint8_t values[1];
292
294typedef struct
295{
296 uint16_t handle;
297 uint8_t write_op;
298 uint16_t offset;
299 uint16_t len;
300 uint8_t data[1];
303
321typedef struct
322{
323 uint16_t handle;
324 uint8_t type;
325 uint16_t len;
326 uint8_t data[1];
329
331typedef struct
332{
333 uint16_t server_rx_mtu;
335
337typedef struct
338{
339 uint8_t src;
341
343typedef struct
344{
345 uint8_t count;
347
371
394typedef struct
395{
396 uint8_t auto_add_vs_enable : 1;
398
404
435SVCALL(SD_BLE_GATTC_PRIMARY_SERVICES_DISCOVER, uint32_t, sd_ble_gattc_primary_services_discover(uint16_t conn_handle, uint16_t start_handle, ble_uuid_t const *p_srvc_uuid));
436
437
463SVCALL(SD_BLE_GATTC_RELATIONSHIPS_DISCOVER, uint32_t, sd_ble_gattc_relationships_discover(uint16_t conn_handle, ble_gattc_handle_range_t const *p_handle_range));
464
465
491
492
517SVCALL(SD_BLE_GATTC_DESCRIPTORS_DISCOVER, uint32_t, sd_ble_gattc_descriptors_discover(uint16_t conn_handle, ble_gattc_handle_range_t const *p_handle_range));
518
519
544SVCALL(SD_BLE_GATTC_CHAR_VALUE_BY_UUID_READ, uint32_t, sd_ble_gattc_char_value_by_uuid_read(uint16_t conn_handle, ble_uuid_t const *p_uuid, ble_gattc_handle_range_t const *p_handle_range));
545
546
571SVCALL(SD_BLE_GATTC_READ, uint32_t, sd_ble_gattc_read(uint16_t conn_handle, uint16_t handle, uint16_t offset));
572
573
597SVCALL(SD_BLE_GATTC_CHAR_VALUES_READ, uint32_t, sd_ble_gattc_char_values_read(uint16_t conn_handle, uint16_t const *p_handles, uint16_t handle_count));
598
599
644SVCALL(SD_BLE_GATTC_WRITE, uint32_t, sd_ble_gattc_write(uint16_t conn_handle, ble_gattc_write_params_t const *p_write_params));
645
646
662SVCALL(SD_BLE_GATTC_HV_CONFIRM, uint32_t, sd_ble_gattc_hv_confirm(uint16_t conn_handle, uint16_t handle));
663
680SVCALL(SD_BLE_GATTC_ATTR_INFO_DISCOVER, uint32_t, sd_ble_gattc_attr_info_discover(uint16_t conn_handle, ble_gattc_handle_range_t const * p_handle_range));
681
713SVCALL(SD_BLE_GATTC_EXCHANGE_MTU_REQUEST, uint32_t, sd_ble_gattc_exchange_mtu_request(uint16_t conn_handle, uint16_t client_rx_mtu));
714
738#ifndef SUPPRESS_INLINE_IMPLEMENTATION
740{
741 uint32_t value_len = p_gattc_evt->params.char_val_by_uuid_read_rsp.value_len;
742 uint8_t *p_first = p_gattc_evt->params.char_val_by_uuid_read_rsp.handle_value;
743 uint8_t *p_next = p_iter->p_value ? p_iter->p_value + value_len : p_first;
744
745 if ((p_next - p_first) / (sizeof(uint16_t) + value_len) < p_gattc_evt->params.char_val_by_uuid_read_rsp.count)
746 {
747 p_iter->handle = (uint16_t)((uint16_t)p_next[1] << 8U | p_next[0]);
748 p_iter->p_value = p_next + sizeof(uint16_t);
749 return NRF_SUCCESS;
750 }
751 else
752 {
753 return NRF_ERROR_NOT_FOUND;
754 }
755}
756#else
758#endif /* SUPPRESS_INLINE_IMPLEMENTATION */
759
762#ifdef __cplusplus
763}
764#endif
765#endif /* BLE_GATTC_H__ */
766
BLE_GATTC_SVCS
GATTC API SVC numbers.
Definition ble_gattc.h:65
@ SD_BLE_GATTC_HV_CONFIRM
Definition ble_gattc.h:75
@ SD_BLE_GATTC_EXCHANGE_MTU_REQUEST
Definition ble_gattc.h:76
@ SD_BLE_GATTC_PRIMARY_SERVICES_DISCOVER
Definition ble_gattc.h:66
@ SD_BLE_GATTC_RELATIONSHIPS_DISCOVER
Definition ble_gattc.h:67
@ SD_BLE_GATTC_READ
Definition ble_gattc.h:72
@ SD_BLE_GATTC_CHARACTERISTICS_DISCOVER
Definition ble_gattc.h:68
@ SD_BLE_GATTC_ATTR_INFO_DISCOVER
Definition ble_gattc.h:70
@ SD_BLE_GATTC_CHAR_VALUE_BY_UUID_READ
Definition ble_gattc.h:71
@ SD_BLE_GATTC_DESCRIPTORS_DISCOVER
Definition ble_gattc.h:69
@ SD_BLE_GATTC_WRITE
Definition ble_gattc.h:74
@ SD_BLE_GATTC_CHAR_VALUES_READ
Definition ble_gattc.h:73
BLE_GATTC_OPTS
GATTC Option IDs. IDs that uniquely identify a GATTC option.
Definition ble_gattc.h:103
@ BLE_GATTC_OPT_UUID_DISC
Definition ble_gattc.h:104
BLE_GATTC_EVTS
GATT Client Event IDs.
Definition ble_gattc.h:83
@ BLE_GATTC_EVT_HVX
Definition ble_gattc.h:93
@ BLE_GATTC_EVT_READ_RSP
Definition ble_gattc.h:90
@ BLE_GATTC_EVT_ATTR_INFO_DISC_RSP
Definition ble_gattc.h:88
@ BLE_GATTC_EVT_WRITE_CMD_TX_COMPLETE
Definition ble_gattc.h:96
@ BLE_GATTC_EVT_WRITE_RSP
Definition ble_gattc.h:92
@ BLE_GATTC_EVT_EXCHANGE_MTU_RSP
Definition ble_gattc.h:94
@ BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP
Definition ble_gattc.h:89
@ BLE_GATTC_EVT_DESC_DISC_RSP
Definition ble_gattc.h:87
@ BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP
Definition ble_gattc.h:84
@ BLE_GATTC_EVT_CHAR_VALS_READ_RSP
Definition ble_gattc.h:91
@ BLE_GATTC_EVT_CHAR_DISC_RSP
Definition ble_gattc.h:86
@ BLE_GATTC_EVT_REL_DISC_RSP
Definition ble_gattc.h:85
@ BLE_GATTC_EVT_TIMEOUT
Definition ble_gattc.h:95
uint32_t sd_ble_gattc_hv_confirm(uint16_t conn_handle, uint16_t handle)
Send a Handle Value Confirmation to the GATT Server.
uint32_t sd_ble_gattc_char_value_by_uuid_read(uint16_t conn_handle, ble_uuid_t const *p_uuid, ble_gattc_handle_range_t const *p_handle_range)
Initiate or continue a GATT Read using Characteristic UUID procedure.
uint32_t sd_ble_gattc_exchange_mtu_request(uint16_t conn_handle, uint16_t client_rx_mtu)
Start an ATT_MTU exchange by sending an Exchange MTU Request to the server.
uint32_t sd_ble_gattc_relationships_discover(uint16_t conn_handle, ble_gattc_handle_range_t const *p_handle_range)
Initiate or continue a GATT Relationship Discovery procedure.
uint32_t sd_ble_gattc_read(uint16_t conn_handle, uint16_t handle, uint16_t offset)
Initiate or continue a GATT Read (Long) Characteristic or Descriptor procedure.
uint32_t sd_ble_gattc_attr_info_discover(uint16_t conn_handle, ble_gattc_handle_range_t const *p_handle_range)
Discovers information about a range of attributes on a GATT server.
uint32_t sd_ble_gattc_write(uint16_t conn_handle, ble_gattc_write_params_t const *p_write_params)
Perform a Write (Characteristic Value or Descriptor, with or without response, long or reliable) proc...
uint32_t sd_ble_gattc_evt_char_val_by_uuid_read_rsp_iter(ble_gattc_evt_t *p_gattc_evt, ble_gattc_handle_value_t *p_iter)
Iterate through Handle-Value(s) list in BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP event.
uint32_t sd_ble_gattc_primary_services_discover(uint16_t conn_handle, uint16_t start_handle, ble_uuid_t const *p_srvc_uuid)
Initiate or continue a GATT Primary Service Discovery procedure.
uint32_t sd_ble_gattc_char_values_read(uint16_t conn_handle, uint16_t const *p_handles, uint16_t handle_count)
Initiate a GATT Read Multiple Characteristic Values procedure.
uint32_t sd_ble_gattc_characteristics_discover(uint16_t conn_handle, ble_gattc_handle_range_t const *p_handle_range)
Initiate or continue a GATT Characteristic Discovery procedure.
uint32_t sd_ble_gattc_descriptors_discover(uint16_t conn_handle, ble_gattc_handle_range_t const *p_handle_range)
Initiate or continue a GATT Characteristic Descriptor Discovery procedure.
#define BLE_GATTC_OPT_BASE
Definition ble_ranges.h:107
#define BLE_GATTC_EVT_BASE
Definition ble_ranges.h:88
#define BLE_GATTC_SVC_BASE
Definition ble_ranges.h:72
#define NRF_ERROR_NOT_FOUND
Not found.
Definition nrf_error.h:67
#define NRF_SUCCESS
Successful command.
Definition nrf_error.h:62
GATT Characteristic Properties.
Definition ble_gatt.h:202
uint16_t handle
Definition ble_gattc.h:206
ble_uuid128_t uuid
Definition ble_gattc.h:207
Attribute Information for 128-bit Attribute UUID.
Definition ble_gattc.h:205
uint16_t handle
Definition ble_gattc.h:199
ble_uuid_t uuid
Definition ble_gattc.h:200
Attribute Information for 16-bit Attribute UUID.
Definition ble_gattc.h:198
uint8_t char_ext_props
Definition ble_gattc.h:171
uint16_t handle_decl
Definition ble_gattc.h:172
ble_uuid_t uuid
Definition ble_gattc.h:169
ble_gatt_char_props_t char_props
Definition ble_gattc.h:170
uint16_t handle_value
Definition ble_gattc.h:173
GATT characteristic.
Definition ble_gattc.h:168
uint8_t write_cmd_tx_queue_size
Definition ble_gattc.h:138
BLE GATTC connection configuration parameters, set with sd_ble_cfg_set.
Definition ble_gattc.h:137
ble_uuid_t uuid
Definition ble_gattc.h:181
uint16_t handle
Definition ble_gattc.h:180
GATT descriptor.
Definition ble_gattc.h:179
uint8_t format
Definition ble_gattc.h:246
uint16_t count
Definition ble_gattc.h:245
Event structure for BLE_GATTC_EVT_ATTR_INFO_DISC_RSP.
Definition ble_gattc.h:244
uint16_t count
Definition ble_gattc.h:229
Event structure for BLE_GATTC_EVT_CHAR_DISC_RSP.
Definition ble_gattc.h:228
uint16_t count
Definition ble_gattc.h:268
uint16_t value_len
Definition ble_gattc.h:269
uint8_t handle_value[1]
Definition ble_gattc.h:270
Event structure for BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP.
Definition ble_gattc.h:267
uint16_t len
Definition ble_gattc.h:288
Event structure for BLE_GATTC_EVT_CHAR_VALS_READ_RSP.
Definition ble_gattc.h:287
uint16_t count
Definition ble_gattc.h:237
Event structure for BLE_GATTC_EVT_DESC_DISC_RSP.
Definition ble_gattc.h:236
uint16_t server_rx_mtu
Definition ble_gattc.h:333
Event structure for BLE_GATTC_EVT_EXCHANGE_MTU_RSP.
Definition ble_gattc.h:332
uint16_t len
Definition ble_gattc.h:325
uint16_t handle
Definition ble_gattc.h:323
uint8_t type
Definition ble_gattc.h:324
Event structure for BLE_GATTC_EVT_HVX.
Definition ble_gattc.h:322
uint16_t count
Definition ble_gattc.h:213
Event structure for BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP.
Definition ble_gattc.h:212
uint16_t offset
Definition ble_gattc.h:279
uint16_t len
Definition ble_gattc.h:280
uint16_t handle
Definition ble_gattc.h:278
Event structure for BLE_GATTC_EVT_READ_RSP.
Definition ble_gattc.h:277
uint16_t count
Definition ble_gattc.h:221
Event structure for BLE_GATTC_EVT_REL_DISC_RSP.
Definition ble_gattc.h:220
ble_gattc_evt_prim_srvc_disc_rsp_t prim_srvc_disc_rsp
Definition ble_gattc.h:356
ble_gattc_evt_desc_disc_rsp_t desc_disc_rsp
Definition ble_gattc.h:359
uint16_t conn_handle
Definition ble_gattc.h:351
ble_gattc_evt_char_disc_rsp_t char_disc_rsp
Definition ble_gattc.h:358
uint16_t error_handle
Definition ble_gattc.h:353
ble_gattc_evt_attr_info_disc_rsp_t attr_info_disc_rsp
Definition ble_gattc.h:367
ble_gattc_evt_hvx_t hvx
Definition ble_gattc.h:364
ble_gattc_evt_write_cmd_tx_complete_t write_cmd_tx_complete
Definition ble_gattc.h:368
uint16_t gatt_status
Definition ble_gattc.h:352
ble_gattc_evt_char_vals_read_rsp_t char_vals_read_rsp
Definition ble_gattc.h:362
union ble_gattc_evt_t::@5 params
ble_gattc_evt_timeout_t timeout
Definition ble_gattc.h:366
ble_gattc_evt_exchange_mtu_rsp_t exchange_mtu_rsp
Definition ble_gattc.h:365
ble_gattc_evt_write_rsp_t write_rsp
Definition ble_gattc.h:363
ble_gattc_evt_char_val_by_uuid_read_rsp_t char_val_by_uuid_read_rsp
Definition ble_gattc.h:360
ble_gattc_evt_rel_disc_rsp_t rel_disc_rsp
Definition ble_gattc.h:357
ble_gattc_evt_read_rsp_t read_rsp
Definition ble_gattc.h:361
GATTC event structure.
Definition ble_gattc.h:350
uint8_t src
Definition ble_gattc.h:339
Event structure for BLE_GATTC_EVT_TIMEOUT.
Definition ble_gattc.h:338
uint8_t count
Definition ble_gattc.h:345
Event structure for BLE_GATTC_EVT_WRITE_CMD_TX_COMPLETE.
Definition ble_gattc.h:344
uint16_t offset
Definition ble_gattc.h:298
uint16_t len
Definition ble_gattc.h:299
uint8_t write_op
Definition ble_gattc.h:297
uint16_t handle
Definition ble_gattc.h:296
Event structure for BLE_GATTC_EVT_WRITE_RSP.
Definition ble_gattc.h:295
uint16_t start_handle
Definition ble_gattc.h:145
uint16_t end_handle
Definition ble_gattc.h:146
Operation Handle Range.
Definition ble_gattc.h:144
uint8_t * p_value
Definition ble_gattc.h:262
uint16_t handle
Definition ble_gattc.h:261
GATT read by UUID handle value pair.
Definition ble_gattc.h:260
ble_gattc_service_t included_srvc
Definition ble_gattc.h:162
uint16_t handle
Definition ble_gattc.h:161
GATT include.
Definition ble_gattc.h:160
uint8_t auto_add_vs_enable
Definition ble_gattc.h:396
UUID discovery option.
Definition ble_gattc.h:395
ble_uuid_t uuid
Definition ble_gattc.h:153
ble_gattc_handle_range_t handle_range
Definition ble_gattc.h:154
GATT service.
Definition ble_gattc.h:152
uint16_t len
Definition ble_gattc.h:192
uint8_t write_op
Definition ble_gattc.h:188
uint16_t handle
Definition ble_gattc.h:190
uint16_t offset
Definition ble_gattc.h:191
uint8_t const * p_value
Definition ble_gattc.h:193
uint8_t flags
Definition ble_gattc.h:189
Write Parameters.
Definition ble_gattc.h:187
128 bit UUID values.
Definition ble_types.h:187
Bluetooth Low Energy UUID type, encapsulates both 16-bit and 128-bit UUIDs.
Definition ble_types.h:193
ble_gattc_opt_uuid_disc_t uuid_disc
Definition ble_gattc.h:402
Option structure for GATTC options.
Definition ble_gattc.h:401