ble_gatts.h
Go to the documentation of this file.
1 /**
2 ****************************************************************************************
3 *
4 * @file ble_gatts.h
5 *
6 * @brief BLE GATTS API
7 *
8 ****************************************************************************************
9 * @attention
10 #####Copyright (c) 2019 GOODIX
11 All rights reserved.
12
13 Redistribution and use in source and binary forms, with or without
14 modification, are permitted provided that the following conditions are met:
15 * Redistributions of source code must retain the above copyright
16 notice, this list of conditions and the following disclaimer.
17 * Redistributions in binary form must reproduce the above copyright
18 notice, this list of conditions and the following disclaimer in the
19 documentation and/or other materials provided with the distribution.
20 * Neither the name of GOODIX nor the names of its contributors may be used
21 to endorse or promote products derived from this software without
22 specific prior written permission.
23
24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
28 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 POSSIBILITY OF SUCH DAMAGE.
35 *****************************************************************************************
36 */
37
38 /**
39 * @addtogroup BLE
40 * @{
41 */
42
43 /**
44 * @addtogroup BLE_GATT Generic Attribute Profile (GATT)
45 * @{
46 * @brief Definitions and prototypes for the GATT interface.
47 */
48
49 /**
50 @addtogroup BLE_SDK_GATTS Generic Attribute Profile (GATT) Server
51 @{
52 @brief Definitions and prototypes for the GATT server interface.
53 */
54
55
56 #ifndef __BLE_GATTS_H__
57 #define __BLE_GATTS_H__
58
59 #include "ble_error.h"
60 #include "ble_att.h"
61 #include "ble_gatt.h"
62 #include "ble_gapc.h"
63 #include <stdint.h>
64
65 /** @addtogroup BLE_GATTS_DEFINES Defines
66 * @{ */
67
68 /** @defgroup BLE_GATTS_MAX_INC_SRVC_NUM Max Number of Included Services
69 * @{ */
70 #define BLE_GATTS_MAX_INC_SRVC_NUM (5) /**< The max number of Included Services a Primary/Secondary service can have. Used by @ref ble_gatts_create_db_t. */
71 /** @} */
72
73 /** @defgroup BLE_GATTS_ATTR_PERM_BIT Attribute Permission Bit
74 * @{ */
75 #define BLE_GATTS_BROADCAST (0x01) /**< In one byte, bit0 means: Broadcast bit. Used by @ref BLE_GATTS_BROADCAST_ENABLE. */
76 #define BLE_GATTS_READ (0x02) /**< In one byte, bit1 means: Read bit. Used by @ref BLE_GATTS_READ_PERM_UNSEC, @ref BLE_GATTS_READ_PERM */
77 #define BLE_GATTS_WRITE_CMD (0x04) /**< In one byte, bit2 means: Write_cmd bit. Used by @ref BLE_GATTS_WRITE_CMD_PERM_UNSEC, @ref BLE_GATTS_WRITE_CMD_PERM. */
78 #define BLE_GATTS_WRITE_REQ (0x08) /**< In one byte, bit3 means: Write_req bit. Used by @ref BLE_GATTS_WRITE_REQ_PERM_UNSEC, @ref BLE_GATTS_WRITE_REQ_PERM. */
79 #define BLE_GATTS_NOTIFY (0x10) /**< In one byte, bit4 means: Notify bit. Used by @ref BLE_GATTS_NOTIFY_PERM_UNSEC, @ref BLE_GATTS_NOTIFY_PERM. */
80 #define BLE_GATTS_INDICATE (0x20) /**< In one byte, bit5 means: Indicate bit. Used by @ref BLE_GATTS_INDICATE_PERM_UNSEC, @ref BLE_GATTS_INDICATE_PERM */
81 #define BLE_GATTS_WRITE_SIGNED (0x40) /**< In one byte, bit6 means: Write_signed bit. Used by @ref BLE_GATTS_WRITE_SIGNED_PERM_UNSEC, @ref BLE_GATTS_WRITE_SIGNED_PERM. */
82 #define BLE_GATTS_EXT_PROP (0x80) /**< In one byte, bit7 means: Ext_property bit. Used by @ref BLE_GATTS_EXT_PROP_ENABLE. */
83 /** @} */
84
85 /** @defgroup BLE_GATTS_ATTR_PERM_POS Attribute Permission Value Position
86 * @{ */
87 #define BLE_GATTS_READ_POS (0x00) /**< Bit position of read permission. Used by @ref BLE_GATTS_READ_PERM. */
88 #define BLE_GATTS_WRITE_POS (0x02) /**< Bit position of write permission. Used by @ref BLE_GATTS_WRITE_CMD_PERM, @ref BLE_GATTS_WRITE_REQ_PERM, @ref BLE_GATTS_WRITE_SIGNED_PERM. */
89 #define BLE_GATTS_INDICATE_POS (0x04) /**< Bit position of indicate bit. Used by @ref BLE_GATTS_INDICATE_PERM. */
90 #define BLE_GATTS_NOTIFY_POS (0x06) /**< Bit position of notify bit. Used by @ref BLE_GATTS_NOTIFY_PERM. */
91 /** @} */
92
93 /** @defgroup BLE_GATTS_SEC_LEVEL Attribute and Service Access Rights
94 * @{ */
95
96 #define BLE_GATTS_NOAUTH (0x00) /**< LE security mode 1, level 1. Link does not need to be encrypted or authenticated.
97 Parameter of @ref BLE_GATTS_SRVC_PERM, @ref BLE_GATTS_READ_PERM, @ref BLE_GATTS_WRITE_REQ_PERM, @ref BLE_GATTS_WRITE_CMD_PERM, @ref BLE_GATTS_WRITE_SIGNED_PERM, @ref BLE_GATTS_INDICATE_PERM, @ref BLE_GATTS_NOTIFY_PERM. */
98 #define BLE_GATTS_UNAUTH (0x01) /**< LE security mode 1, level 2. Link needs to be encrypted, but not to be authenticated.
99 Parameter of @ref BLE_GATTS_SRVC_PERM, @ref BLE_GATTS_READ_PERM, @ref BLE_GATTS_WRITE_REQ_PERM, @ref BLE_GATTS_WRITE_CMD_PERM, @ref BLE_GATTS_WRITE_SIGNED_PERM, @ref BLE_GATTS_INDICATE_PERM, @ref BLE_GATTS_NOTIFY_PERM. */
100 #define BLE_GATTS_AUTH (0x02) /**< LE security mode 1, level 3. Link needs to be encrypted and authenticated (MITM).
101 Parameter of @ref BLE_GATTS_SRVC_PERM, @ref BLE_GATTS_READ_PERM, @ref BLE_GATTS_WRITE_REQ_PERM, @ref BLE_GATTS_WRITE_CMD_PERM, @ref BLE_GATTS_WRITE_SIGNED_PERM, @ref BLE_GATTS_INDICATE_PERM, @ref BLE_GATTS_NOTIFY_PERM. */
102 #define BLE_GATTS_SEC_CON (0x03) /**< LE security mode 1, level 4. Link needs to be encrypted and authenticateBLE_GATTS_d (secure connections).
103 Parameter of @ref BLE_GATTS_SRVC_PERM, @ref BLE_GATTS_READ_PERM, @ref BLE_GATTS_WRITE_REQ_PERM, @ref BLE_GATTS_WRITE_CMD_PERM, @ref BLE_GATTS_WRITE_SIGNED_PERM, @ref BLE_GATTS_INDICATE_PERM, @ref BLE_GATTS_NOTIFY_PERM. */
104 /** @} */
105
106 /** @defgroup BLE_GATTS_SEC_LEVEL_MASK Attribute and Service Security Level Mask
107 * @{ */
108 #define BLE_GATTS_SEC_LEVEL_MASK (0x03) /**< Security level mask.
109 Used by @ref BLE_GATTS_SRVC_PERM, @ref BLE_GATTS_READ_PERM, @ref BLE_GATTS_WRITE_REQ_PERM, @ref BLE_GATTS_WRITE_CMD_PERM, @ref BLE_GATTS_WRITE_SIGNED_PERM, @ref BLE_GATTS_INDICATE_PERM, @ref BLE_GATTS_NOTIFY_PERM. */
110 /** @} */
111
112 /** @defgroup BLE_GATTS_UUID_TYPE Attribute and Service UUID Type
113 * @{ */
114 #define BLE_GATTS_UUID_TYPE_16 (0x00) /**< 16-bit UUID length. */
115 #define BLE_GATTS_UUID_TYPE_128 (0x02) /**< 128-bit UUID length. */
116 /** @} */
117
118 /**
119 * Service permissions
120 *
121 * | 7 | 6--5 | 4 | 3--2 | 1 | 0 |
122 * |----|--------|----|--------|----|----|
123 * |SEC |UUID_LEN|DIS | AUTH |EKS | MI |
124 *
125 * Bit [0] : Service is multi-instantiated (0 = not support; 1 = support) \n
126 * Bit [1] : Encryption key size must be 16 bytes (0 = not need; 1 = need) \n
127 * Bit [2-3]: Service permission (0 = NOAUTH; 1 = UNAUTH; 2 = AUTH; 3 = SEC_CON) \n
128 * Bit [4] : Disable the service (0 = no; 1 = yes) \n
129 * Bit [5-6]: UUID Length Type (0 = 16 bits; 2 = 128 bits) \n
130 * Bit [7] : Secondary Service (0 = Primary Service; 1 = Secondary Service) \n
131 */
132
133 /** @defgroup BLE_GATTS_SRVC_PERM Service Permission
134 * @{ */
135 #define BLE_GATTS_SRVC_SECONDARY_SET (0x80) /**< Secondary service set. */
136 #define BLE_GATTS_SRVC_UUID_TYPE_SET(uuid_len) ((uuid_len) << 5) /**< Service UUID length set. See @ref BLE_GATTS_UUID_TYPE. */
137 #define BLE_GATTS_SRVC_DISABLE (0x10) /**< Service disable. */
138 #define BLE_GATTS_SRVC_PERM(sec_level) (((sec_level) & BLE_GATTS_SEC_LEVEL_MASK) << 2) /**< Service permission authentication. See @ref BLE_GATTS_SEC_LEVEL. */
139 #define BLE_GATTS_SRVC_ENCRP_KEY_SIZE_16 (0x02) /**< 16 bytes service encryption key size . */
140 #define BLE_GATTS_SRVC_MULTI_ENABLE (0x01) /**< Service is multi-instantiated. */
141 /** @} */
142
143 /**
144 * Attribute permission
145 *
146 * | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7--6 | 5--4 | 3--2 | 1--0 |
147 * |----|----|----|----|----|----|----|----|--------|--------|--------|--------|
148 * |EXT | WS | I | N | WR | WC | RD | B | NP | IP | WP | RP |
149 *
150 * Bit [0-1]: Read permission (0 = NOAUTH; 1 = UNAUTH; 2 = AUTH; 3 = SEC_CON) \n
151 * Bit [2-3]: Write permission (0 = NOAUTH; 1 = UNAUTH; 2 = AUTH; 3 = SEC_CON) \n
152 * Bit [4-5]: Indicate permission (0 = NOAUTH; 1 = UNAUTH; 2 = AUTH; 3 = SEC_CON) \n
153 * Bit [6-7]: Notify permission (0 = NOAUTH; 1 = UNAUTH; 2 = AUTH; 3 = SEC_CON) \n
154 *
155 * Bit [8] : Broadcast permission \n
156 * Bit [9] : Read accepted \n
157 * Bit [10] : Write Command accepted \n
158 * Bit [11] : Write Request accepted \n
159 * Bit [12] : Notify accepted \n
160 * Bit [13] : Indicate accepted \n
161 * Bit [14] : Write Signed accepted \n
162 * Bit [15] : Extended Properties present \n
163 */
164
165 /** @defgroup BLE_GATTS_ATTR_PERM Attribute Permission
166 * @{ */
167 #define BLE_GATTS_READ_PERM_UNSEC (BLE_GATTS_READ << 8) /**< Default Read permission. */
168 #define BLE_GATTS_READ_PERM(sec_level) (BLE_GATTS_READ << 8 | (((sec_level) & BLE_GATTS_SEC_LEVEL_MASK) << BLE_GATTS_READ_POS)) /**< Read permission set. See @ref BLE_GATTS_SEC_LEVEL. */
169 #define BLE_GATTS_WRITE_REQ_PERM_UNSEC (BLE_GATTS_WRITE_REQ << 8) /**< Default Write Permission. */
170 #define BLE_GATTS_WRITE_REQ_PERM(sec_level) (BLE_GATTS_WRITE_REQ << 8 | (((sec_level) & BLE_GATTS_SEC_LEVEL_MASK) << BLE_GATTS_WRITE_POS)) /**< Write permission set. See @ref BLE_GATTS_SEC_LEVEL. */
171 #define BLE_GATTS_WRITE_CMD_PERM_UNSEC (BLE_GATTS_WRITE_CMD << 8) /**< Default Write without Response Permission. */
172 #define BLE_GATTS_WRITE_CMD_PERM(sec_level) (BLE_GATTS_WRITE_CMD << 8 | (((sec_level) & BLE_GATTS_SEC_LEVEL_MASK) << BLE_GATTS_WRITE_POS)) /**< Write without Response permission set. See @ref BLE_GATTS_SEC_LEVEL. */
173 #define BLE_GATTS_WRITE_SIGNED_PERM_UNSEC (BLE_GATTS_WRITE_SIGNED << 8) /**< Default Authenticated Signed Write Permission. */
174 #define BLE_GATTS_WRITE_SIGNED_PERM(sec_level) (BLE_GATTS_WRITE_SIGNED << 8 | (((sec_level) & BLE_GATTS_SEC_LEVEL_MASK) << BLE_GATTS_WRITE_POS)) /**< Authenticated Signed Write permission set. See @ref BLE_GATTS_SEC_LEVEL. */
175 #define BLE_GATTS_INDICATE_PERM_UNSEC (BLE_GATTS_INDICATE << 8) /**< Default Indicate Permission. */
176 #define BLE_GATTS_INDICATE_PERM(sec_level) (BLE_GATTS_INDICATE << 8 | (((sec_level) & BLE_GATTS_SEC_LEVEL_MASK) << BLE_GATTS_INDICATE_POS)) /**< Indicate permission set. See @ref BLE_GATTS_SEC_LEVEL. */
177 #define BLE_GATTS_NOTIFY_PERM_UNSEC (BLE_GATTS_NOTIFY << 8) /**< Default Notify Permission. */
178 #define BLE_GATTS_NOTIFY_PERM(sec_level) (BLE_GATTS_NOTIFY << 8 | (((sec_level) & BLE_GATTS_SEC_LEVEL_MASK) << BLE_GATTS_NOTIFY_POS)) /**< Notify permission set. See @ref BLE_GATTS_SEC_LEVEL. */
179 #define BLE_GATTS_BROADCAST_ENABLE (BLE_GATTS_BROADCAST << 8) /**< Broadcast enable. */
180 #define BLE_GATTS_EXT_PROP_ENABLE (BLE_GATTS_EXT_PROP << 8) /**< Extended Properties enable. */
181 /** @} */
182
183 /**
184 * Attribute extend permission
185 *
186 * | 15 | 14--13 | 12 | 11--0 |
187 * |----|---------|----|-----------------------------------------------------------|
188 * | VL |UUID_LEN |EKS | RESERVED |
189 *
190 * Bit [0-11] : Reserved \n
191 * Bit [12] : Encryption key size must be 16 bytes (0 = not need; 1 = need) \n
192 * Bit [14-13]: UUID length type (0 = 16 bits; 2 = 128 bits) \n
193 * Bit [15] : Value location (0 = value saved in BLE Stack; 1 = value saved in user space) \n
194 */
195
196 /** @defgroup BLE_GATTS_ATTR_EXT_PERM Attribute Extend Permission
197 * @{ */
198 #define BLE_GATTS_ATT_VAL_LOC_USER (1 << 15) /**< Value location which means value saved in user space, the profile's read/write callback will be called. */
199 #define BLE_GATTS_ATT_VAL_LOC_STACK (0 << 15) /**< Value location which means value saved in BLE Stack. */
200 #define BLE_GATTS_ATT_UUID_TYPE_SET(uuid_len) ((uuid_len) << 13) /**< Attribute UUID length set. See @ref BLE_GATTS_UUID_TYPE */
201 #define BLE_GATTS_ATT_ENC_KEY_SIZE_16 (0x1000) /**< 16 bytes attribute encryption key size . */
202 /** @} */
203 /** @} */
204
205 /** @addtogroup BLE_GATTS_ENUMERATIONS Enumerations
206 * @{ */
207
208 /**
209 * @brief Service table type.
210 */
211 typedef enum
212 {
213 BLE_GATTS_SERVICE_TABLE_TYPE_16 = 0x00, /**< 16-bit service table type. */
214 BLE_GATTS_SERVICE_TABLE_TYPE_128, /**< 128-bit service table type. */
215 } ble_gatts_service_type_t;
216 /** @} */
217
218
219 /** @addtogroup BLE_GATTS_STRUCTURES Structures
220 * @{ */
221
222 /**
223 * @brief Service(16-bit UUID) description.
224 */
225 typedef struct
226 {
227 uint16_t uuid; /**< 16-bit LSB-first UUID */
228 uint16_t perm; /**< Attribute permissions, see @ref BLE_GATTS_ATTR_PERM. \n
229 - For Primary/Secondary/Included Services, must be @ref BLE_GATTS_READ_PERM_UNSEC. \n
230 - For Characteristic Declaration, must be @ref BLE_GATTS_READ_PERM_UNSEC. \n
231 - For Characteristic Extended Properties, must be @ref BLE_GATTS_READ_PERM_UNSEC. \n
232 - For Characteristic Presentation Format, must be @ref BLE_GATTS_READ_PERM_UNSEC. \n
233 - For Characteristic Aggregate Format, must be @ref BLE_GATTS_READ_PERM_UNSEC. */
234
235 uint16_t ext_perm; /**< Attribute extended permissions, see @ref BLE_GATTS_ATTR_EXT_PERM. \n
236 - For Primary/Secondary/Included Services, this field is not used and should be set to 0. \n
237 - For Characteristic Declaration, this field is not used and should be set to 0. \n
238 - For Characteristic Extended Properties, this field is not used and should be set to 0. \n
239 - For Client Characteristic Configuration and Server Characteristic Configuration, value must be saved in user space,
240 user needn't to set this value location bit. The UUID length type must be set to 0.*/
241
242 uint16_t max_size; /**< Attribute max size. \n
243 - For Primary/Secondary/Included Services, this field is not used, set to 0. \n
244 - For Characteristic Declaration, this field is not used, set to 0. \n
245 - For Characteristic Extended Properties, this field contains 2-byte value. \n
246 - For Client Characteristic Configuration and Server Characteristic Configuration, this field is not used, set to 0. \n
247 - For others, this field is attribute max size. */
248 } ble_gatts_attm_desc_t;
249
250 /**
251 * @brief Service(128 bits UUID) description.
252 */
253 typedef struct
254 {
255 uint8_t uuid[16]; /**< 128 bits UUID LSB First. */
256 uint16_t perm; /**< Attribute permissions, see @ref BLE_GATTS_ATTR_PERM. \n
257 - For Primary/Secondary/Included Services, must be @ref BLE_GATTS_READ_PERM_UNSEC. \n
258 - For Characteristic Declaration, must be @ref BLE_GATTS_READ_PERM_UNSEC. \n
259 - For Characteristic Extended Properties, must be @ref BLE_GATTS_READ_PERM_UNSEC. \n
260 - For Characteristic Presentation Format, must be @ref BLE_GATTS_READ_PERM_UNSEC. \n
261 - For Characteristic Aggregate Format, must be @ref BLE_GATTS_READ_PERM_UNSEC. */
262
263 uint16_t ext_perm; /**< Attribute extended permissions, see @ref BLE_GATTS_ATTR_EXT_PERM. \n
264 - For Primary/Secondary/Included Services, this field is not used, set to 0. \n
265 - For Characteristic Declaration, this field is not used, set to 0. \n
266 - For Characteristic Extended Properties, this field is not used, set to 0. \n
267 - For Client Characteristic Configuration and Server Characteristic Configuration, value must be saved in user space,
268 user needn't to set this value location bit. The UUID length type must be set to 0.*/
269
270 uint16_t max_size; /**< Attribute max size. \n
271 - For Primary/Secondary/Included Services, this field is not used, set to 0. \n
272 - For Characteristic Declaration, this field is not used, set to 0. \n
273 - For Characteristic Extended Properties, this field contains 2-byte value. \n
274 - For Client Characteristic Configuration and Server Characteristic Configuration, this field is not used, set to 0. \n
275 - For others, this field is attribute max size. */
276 } ble_gatts_attm_desc_128_t;
277
278 /**
279 * @brief Parameter of Added service description.
280 */
281 typedef struct
282 {
283
284 uint16_t *shdl; /**< Service start handle pointer. If *shdl = 0, it returns a handle using the first available handle (*shdl is modified); otherwise it verifies if the given start handle can be used to allocate handle range. */
285 const uint8_t *uuid; /**< Service UUID pointer. The pointer points to the Service UUID LSB. */
286 uint8_t *attr_tab_cfg; /**< Attribute table selector pointer. It can be set to NULL to select all items of attribute table. Each bit matches with an attribute of attribute table. \n EXAMPLE:if attr_tab_cfg points to array {0x3F, 0x03}, it means that the 0.1.2.3.4.5.8.9 items of attribute table will be added to database. */
287 uint8_t max_nb_attr; /**< Number of attributes in attribute table. */
288 union attribute_table /**< Attribute table. */
289 {
290 const ble_gatts_attm_desc_t *attr_tab_16; /**< 16 bits service description. The pointer point to attribute table of 16 bits service. See @ref ble_gatts_attm_desc_t. */
291 const ble_gatts_attm_desc_128_t *attr_tab_128; /**< 128 bits service description. The pointer point to attribute table of 128 bits service. See @ref ble_gatts_attm_desc_128_t. */
292 } attr_tab; /**< Attribute table. */
293 uint16_t *inc_srvc_handle[BLE_GATTS_MAX_INC_SRVC_NUM]; /**< Pointer array of Included Service start handle's address. */
294 uint16_t inc_srvc_num; /**< Included Service number for this service. */
295 uint8_t srvc_perm; /**< Service permission. See @ref BLE_GATTS_SRVC_PERM. */
296 ble_gatts_service_type_t attr_tab_type; /**< Service table type. See @ref ble_gatts_service_type_t. */
297 } ble_gatts_create_db_t;
298
299 /**
300 * @brief GATT read attribute result description.
301 */
302 typedef struct
303 {
304 uint16_t handle; /**< Handle of the read attribute. */
305 uint16_t length; /**< Length of read data. */
306 uint8_t status; /**< Status of read operation by upper layers. See @ref BLE_STACK_ERROR_CODES.*/
307 uint8_t *value; /**< Attribute value pointer. */
308 } ble_gatts_read_cfm_t;
309
310 /**
311 * @brief GATT write attribute result description.
312 */
313 typedef struct
314 {
315 uint16_t handle; /**< Handle of the attribute written. */
316 uint8_t status; /**< Status of write operation by upper layers. See @ref BLE_STACK_ERROR_CODES.*/
317 } ble_gatts_write_cfm_t;
318
319 /**
320 * @brief GATT prepare write result description.
321 */
322 typedef struct
323 {
324 uint16_t handle; /**< Handle of the attribute in prepare write operation. */
325 uint16_t length; /**< Current length of the attribute. */
326 uint8_t status; /**< Status of prepare write operation by upper layers. See @ref BLE_STACK_ERROR_CODES.*/
327 } ble_gatts_prep_write_cfm_t;
328
329
330 /**
331 * @brief GATT sending Notification or Indication event param description.
332 */
333 typedef struct
334 {
335 ble_gatt_evt_type_t type; /**< Request type (Notification/Indication). see @ref ble_gatt_evt_type_t. */
336 uint16_t handle; /**< Characteristic Value handle to be notified or indicated. */
337 uint16_t length; /**< Length of Characteristic Value to be sent. */
338 const uint8_t *value; /**< Characteristic Value pointer. */
339 } ble_gatts_noti_ind_t;
340
341 /**
342 * @brief GATT read request event for @ref BLE_GATTS_EVT_READ_REQUEST.
343 */
344 typedef struct
345 {
346 uint16_t handle; /**< Handle of the attribute to be read. */
347 } ble_gatts_evt_read_t;
348
349 /**
350 * @brief GATT write request event for @ref BLE_GATTS_EVT_WRITE_REQUEST.
351 */
352 typedef struct
353 {
354 uint16_t handle; /**< Handle of the attribute to be written. */
355 uint16_t offset; /**< Offset at which the data has to be written. */
356 uint16_t length; /**< Data length to be written. */
357 uint8_t *value; /**< Data to be written to characteristic value. */
358 } ble_gatts_evt_write_t;
359
360 /**
361 * @brief GATT prepare write request event for @ref BLE_GATTS_EVT_PREP_WRITE_REQUEST.
362 */
363 typedef struct
364 {
365 uint16_t handle; /**< Handle of the attribute for whose value is requested. */
366 } ble_gatts_evt_prep_write_t;
367
368 /**@brief Gatt Notification or indication event for @ref BLE_GATTS_EVT_NTF_IND. */
369 typedef struct
370 {
371 ble_gatt_evt_type_t type; /**< Notification or indication event type. */
372 uint16_t handle; /**< Handle of the write operation, or notification/indication operation. */
373 } ble_gatts_evt_ntf_ind_t;
374
375 /**@brief Gatt cccd recovery event for @ref BLE_GATTS_EVT_CCCD_RECOVERY. */
376 typedef struct
377 {
378 ble_gap_bdaddr_t peer_addr; /**< Pointer to peer address. */
379 uint16_t handle; /**< Handle of attribute. */
380 uint16_t cccd_val; /**< CCCD value. */
381 } ble_gatts_evt_cccd_rec_t;
382
383 /**
384 * @brief GATTS Database Inited Indication event structure.
385 */
386 typedef struct
387 {
388 uint16_t start_hdl;
389 uint16_t end_hdl;
390 } ble_gatts_evt_inited_ind_t;
391
392 /**@brief BLE GATTS event structure. */
393 typedef struct
394 {
395 uint8_t index; /**< Index of connection. */
396 union
397 {
398 ble_gatts_evt_read_t read_req; /**< Read request event. */
399 ble_gatts_evt_write_t write_req; /**< Write request event. */
400 ble_gatts_evt_prep_write_t prep_wr_req; /**< Prepare write request event. */
401 ble_gatts_evt_ntf_ind_t ntf_ind_sended; /**< Notification or indication sened event. */
402 ble_gatts_evt_cccd_rec_t cccd_recovery; /**< Gatt cccd recovery event. */
403 ble_gatts_evt_inited_ind_t inited_ind; /**< Service initialized event. */
404 } params; /**< Event Parameters. */
405 } ble_gatts_evt_t;
406 /** @} */
407
408 /** @addtogroup BLE_GATTS_FUNCTIONS Functions
409 * @{ */
410 /**
411 ****************************************************************************************
412 * @brief Register a service's attribute list.
413 *
414 * @param[in] p_param: Pointer to the parameter used in creating databases. see @ref ble_gatts_create_db_t.
415 *
416 * @retval ::SDK_SUCCESS: Database has been registered successfully.
417 * @retval ::SDK_ERR_POINTER_NULL: Param is NULL or param's members are NULL.
418 * @retval ::SDK_ERR_INVALID_PARAM: The member of param is invalid.
419 * @retval ::SDK_ERR_INVALID_HANDLE: The service handles can not be allocated.
420 * @retval ::SDK_ERR_NO_RESOURCES: There is not enough memory to allocate service buffer.
421 * @retval ::SDK_ERR_INVALID_PERM: Permissions of Client Characteristic Configuration or Server Characteristic Configuration are not set correctly.
422 ****************************************************************************************
423 */
424 uint16_t ble_gatts_srvc_db_create(ble_gatts_create_db_t *p_param);
425
426 /**
427 ****************************************************************************************
428 * @brief Update attribute value only if the attribute value is saved in the BLE Stack space.
429 *
430 * @param[in] handle: Attribute handle.
431 * @param[in] length: Size of the value to set.
432 * @param[in] offset: Data offset of the value in attribute value.
433 * @param[in] p_value: The value to set. If offset = 0, the value is the new attribute value; otherwise, the value is part of the new attribute value.
434 *
435 * @retval ::SDK_SUCCESS: Successfully update the attribute value.
436 * @retval ::SDK_ERR_POINTER_NULL: Value is NULL.
437 * @retval ::SDK_ERR_INVALID_HANDLE: Handle not exist in database.
438 * @retval ::SDK_ERR_REQ_NOT_SUPPORTED: Attribute data is not present in database or cannot be modified.
439 * @retval ::SDK_ERR_INVALID_ATT_VAL_LEN: New value length exceeds maximum attribute value length.
440 * @retval ::SDK_ERR_INVALID_OFFSET: Offset exceeds current attribute value length.
441 ****************************************************************************************
442 */
443 uint16_t ble_gatts_value_set(uint16_t handle, uint16_t length, uint16_t offset, const uint8_t* p_value);
444
445 /**
446 ****************************************************************************************
447 * @brief Retrieve attribute value only if the attribute value is saved in the BLE Stack space.
448 *
449 * @param[in] handle: Attribute handle.
450 * @param[in,out] p_length: Input as buffer size and output as attribute value length.
451 * @param[out] p_value: Buffer to store attribute value when buffer size is enough.
452 *
453 * @retval ::SDK_SUCCESS: Attribute value retrieved successfully.
454 * @retval ::SDK_ERR_POINTER_NULL: The pointer to input buffer size or input buffer is NULL.
455 * @retval ::SDK_ERR_INVALID_HANDLE: Handle not exist in the database.
456 * @retval ::SDK_ERR_REQ_NOT_SUPPORTED: Attribute data is not present in database.
457 * @retval ::SDK_ERR_INVALID_ATT_VAL_LEN: Attribute data value size is bigger than buffer size.
458 * @retval ::SDK_ERR_APP_ERROR: Database is not correctly initialized by application.
459 ****************************************************************************************
460 */
461 uint16_t ble_gatts_value_get(uint16_t handle, uint16_t* p_length, uint8_t* p_value);
462
463 /**
464 ****************************************************************************************
465 * @brief Update attribute permission.
466 * @note The modifications of attribute permission to service/character/include/character_extended_properties_descriptor declaration: not supported. \n
467 * The modifications of attribute permission to others: perm can be updated and EKS of ext_perm can be updated.See @ref BLE_GATTS_ATTR_PERM.
468 *
469 * @param[in] handle: Attribute handle.
470 * @param[in] perm: New attribute permission.
471 * @param[in] ext_perm: New attribute extended permission.
472 *
473 * @retval ::SDK_SUCCESS: Update attribute permission successfully.
474 * @retval ::SDK_ERR_INVALID_HANDLE: Handle not exist in the database.
475 * @retval ::SDK_ERR_REQ_NOT_SUPPORTED: Attribute permission can't be modified.
476 ****************************************************************************************
477 */
478 uint16_t ble_gatts_attr_permission_set(uint16_t handle, uint16_t perm, uint16_t ext_perm);
479
480 /**
481 ****************************************************************************************
482 * @brief Retrieve attribute permission.
483 *
484 * @param[in] handle: Attribute handle.
485 * @param[out] p_perm: Attribute permission value to be returned.
486 * @param[out] p_ext_perm: Attribute extended permission value to be returned.
487 *
488 * @retval ::SDK_SUCCESS: Retrieve attribute permission successfully.
489 * @retval ::SDK_ERR_POINTER_NULL: Perm or ext_perm is NULL.
490 * @retval ::SDK_ERR_INVALID_HANDLE: Handle not exist in the database.
491 ****************************************************************************************
492 */
493 uint16_t ble_gatts_attr_permission_get(uint16_t handle, uint16_t *p_perm, uint16_t *p_ext_perm);
494
495 /**
496 ****************************************************************************************
497 * @brief Respond to an attribute read request..
498 *
499 * @note The status member gatts_read_cfm_t::status should be set to @ref BLE_ATT_ERR_INSUFF_AUTHOR
500 * to control the authorization of particular read operations of a client.
501 *
502 * @param[in] conn_idx: Current connection index.
503 * @param[in] p_param: Pointer to the parameters filled by profile. See @ref ble_gatts_read_cfm_t.
504 *
505 * @retval ::SDK_SUCCESS: Send read confirm value to stack successfully.
506 * @retval ::SDK_ERR_POINTER_NULL: Param is NULL.
507 * @retval ::SDK_ERR_INVALID_CONN_IDX: Conidx is invalid.
508 * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources.
509 ****************************************************************************************
510 */
511 uint16_t ble_gatts_read_cfm(uint8_t conn_idx, const ble_gatts_read_cfm_t *p_param);
512
513 /**
514 ****************************************************************************************
515 * @brief Respond to an attribute write request.
516 *
517 * @note The status member gatts_write_cfm_t::status should be set to @ref BLE_ATT_ERR_INSUFF_AUTHOR
518 * to control the authorization of particular client's write operation.
519 *
520 * @param[in] conn_idx: Current connection index.
521 * @param[in] p_param: Pointer to the parameters filled by profile. see @ref ble_gatts_write_cfm_t.
522 *
523 * @retval ::SDK_SUCCESS: Send write confirm status to stack successfully.
524 * @retval ::SDK_ERR_POINTER_NULL: Param is NULL.
525 * @retval ::SDK_ERR_INVALID_CONN_IDX: Conidx is invalid.
526 * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources.
527 ****************************************************************************************
528 */
529 uint16_t ble_gatts_write_cfm(uint8_t conn_idx, const ble_gatts_write_cfm_t *p_param);
530
531 /**
532 ****************************************************************************************
533 * @brief Respond to an attribute prepare write request.
534 *
535 * @note The status member gatts_prep_write_cfm_t::status should be set to @ref BLE_ATT_ERR_INSUFF_AUTHOR
536 * to control the authorization of particular client's write operation.
537 *
538 * @param[in] conn_idx: Current connection index.
539 * @param[in] p_param: Pointer to the parameters filled by profile. see @ref ble_gatts_prep_write_cfm_t.
540 *
541 * @retval ::SDK_SUCCESS: Send prepare write confirm status to stack successfully.
542 * @retval ::SDK_ERR_POINTER_NULL: Param is NULL.
543 * @retval ::SDK_ERR_INVALID_CONN_IDX: Conidx is invalid.
544 * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources.
545 ****************************************************************************************
546 */
547 uint16_t ble_gatts_prepare_write_cfm(uint8_t conn_idx, const ble_gatts_prep_write_cfm_t *p_param);
548
549 /**
550 ****************************************************************************************
551 * @brief Send out a notification or an indication.
552 *
553 * @note Check whether the relevant Client Characteristic Configuration Descriptor is enabled before using this API.
554 *
555 * @param[in] conn_idx: Current connection index.
556 * @param[in] p_param: Pointer to the parameters filled by profile. see @ref ble_gatts_noti_ind_t.
557 *
558 * @retval ::SDK_SUCCESS: Send Notification or Indication event to stack successfully.
559 * @retval ::SDK_ERR_POINTER_NULL: Param is NULL.
560 * @retval ::SDK_ERR_INVALID_CONN_IDX: Conidx is invalid.
561 * @retval ::SDK_ERR_INVALID_PARAM: Type is invalid.
562 * @retval ::SDK_ERR_INVALID_HANDLE: Handle not exist in the database.
563 * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources.
564 ****************************************************************************************
565 */
566 uint16_t ble_gatts_noti_ind(uint8_t conn_idx, const ble_gatts_noti_ind_t *p_param);
567
568 /**
569 ****************************************************************************************
570 * @brief When service on local device finishes upgrade, call this API to send service upgrade to stack.
571 * If the bonded device connects again, the stack will send service change to the bonded device until the bonded
572 * device has sent back indication confirmation.
573 ****************************************************************************************
574 */
575 void ble_gatts_service_changed(void);
576
577 /**
578 ****************************************************************************************
579 * @brief Set a service discoverable or not.
580 *
581 * @param[in] conn_idx: Current connection index.
582 * @param[in] start_hdl: Start handle of the service.
583 * @param[in] discoverable: Flag for discoverable(true: discoverable, false: hide)
584 *
585 * @retval ::SDK_SUCCESS: Set this service hide or not successfully.
586 * @retval ::SDK_ERR_INVALID_CONN_IDX: Conidx is invalid.
587 ****************************************************************************************
588 */
589 uint16_t ble_gatts_service_discoverable_set(uint8_t conn_idx, uint16_t start_hdl, bool discoverable);
590
591 /**
592 ****************************************************************************************
593 * @brief Set all service discoverable.
594 *
595 * @param[in] conn_idx: Current connection index.
596 *
597 * @retval ::SDK_SUCCESS: Set all service discoverable successfully.
598 * @retval ::SDK_ERR_INVALID_CONN_IDX: Conidx is invalid.
599 ****************************************************************************************
600 */
601 uint16_t ble_gatts_service_discover_all(uint8_t conn_idx);
602
603 /**
604 ****************************************************************************************
605 * @brief Hide all service.
606 *
607 * @param[in] conn_idx: Current connection index.
608 *
609 * @retval ::SDK_SUCCESS: Hide all service successfully.
610 * @retval ::SDK_ERR_INVALID_CONN_IDX: Conidx is invalid.
611 ****************************************************************************************
612 */
613 uint16_t ble_gatts_service_hide_all(uint8_t conn_idx);
614
615 /** @} */
616
617 #endif // BLE_SDK_GATTS_H_
618 /** @} */
619
620 /** @} */
621 /** @} */
622
ble_gatts_create_db_t::attribute_table::attr_tab_128
const ble_gatts_attm_desc_128_t * attr_tab_128
Definition: ble_gatts.h:291
ble_gatts_attm_desc_t::max_size
uint16_t max_size
Definition: ble_gatts.h:242
ble_gatts_create_db_t::srvc_perm
uint8_t srvc_perm
Definition: ble_gatts.h:295
ble_gatts_evt_inited_ind_t::start_hdl
uint16_t start_hdl
Definition: ble_gatts.h:388
ble_gatts_attm_desc_128_t::max_size
uint16_t max_size
Definition: ble_gatts.h:270
ble_gatts_evt_read_t
GATT read request event for BLE_GATTS_EVT_READ_REQUEST.
Definition: ble_gatts.h:345
ble_gap_bdaddr_t
The struct of broadcast address with broadcast type.
Definition: ble_gapc.h:269
ble_gatts_write_cfm_t::status
uint8_t status
Definition: ble_gatts.h:316
ble_gatts_read_cfm_t::handle
uint16_t handle
Definition: ble_gatts.h:304
ble_gatts_evt_write_t::value
uint8_t * value
Definition: ble_gatts.h:357
ble_gatts_write_cfm_t
GATT write attribute result description.
Definition: ble_gatts.h:314
ble_gatts_evt_write_t::offset
uint16_t offset
Definition: ble_gatts.h:355
ble_gatts_create_db_t
Parameter of Added service description.
Definition: ble_gatts.h:282
BLE_GATTS_SERVICE_TABLE_TYPE_16
@ BLE_GATTS_SERVICE_TABLE_TYPE_16
Definition: ble_gatts.h:213
ble_gatts_attm_desc_t
Service(16-bit UUID) description.
Definition: ble_gatts.h:226
ble_gatts_service_hide_all
uint16_t ble_gatts_service_hide_all(uint8_t conn_idx)
Hide all service.
ble_gatts_evt_cccd_rec_t::cccd_val
uint16_t cccd_val
Definition: ble_gatts.h:380
ble_gatts_noti_ind_t
GATT sending Notification or Indication event param description.
Definition: ble_gatts.h:334
ble_gatt.h
BLE GATT.
ble_gatts_evt_ntf_ind_t::type
ble_gatt_evt_type_t type
Definition: ble_gatts.h:371
ble_gatts_evt_cccd_rec_t::peer_addr
ble_gap_bdaddr_t peer_addr
Definition: ble_gatts.h:378
ble_gatts_evt_prep_write_t
GATT prepare write request event for BLE_GATTS_EVT_PREP_WRITE_REQUEST.
Definition: ble_gatts.h:364
BLE_GATTS_SERVICE_TABLE_TYPE_128
@ BLE_GATTS_SERVICE_TABLE_TYPE_128
Definition: ble_gatts.h:214
ble_gatts_attr_permission_set
uint16_t ble_gatts_attr_permission_set(uint16_t handle, uint16_t perm, uint16_t ext_perm)
Update attribute permission.
ble_gatts_evt_t::index
uint8_t index
Definition: ble_gatts.h:395
ble_gatts_attm_desc_t::uuid
uint16_t uuid
Definition: ble_gatts.h:227
ble_gatts_noti_ind_t::type
ble_gatt_evt_type_t type
Definition: ble_gatts.h:335
ble_gatts_evt_t::inited_ind
ble_gatts_evt_inited_ind_t inited_ind
Definition: ble_gatts.h:403
ble_gatts_create_db_t::uuid
const uint8_t * uuid
Definition: ble_gatts.h:285
ble_gatts_service_type_t
ble_gatts_service_type_t
Service table type.
Definition: ble_gatts.h:212
ble_gatts_evt_write_t::handle
uint16_t handle
Definition: ble_gatts.h:354
ble_gatts_value_set
uint16_t ble_gatts_value_set(uint16_t handle, uint16_t length, uint16_t offset, const uint8_t *p_value)
Update attribute value only if the attribute value is saved in the BLE Stack space.
ble_gatts_evt_inited_ind_t::end_hdl
uint16_t end_hdl
Definition: ble_gatts.h:389
ble_error.h
File that contains error codes.
ble_gatts_evt_t::read_req
ble_gatts_evt_read_t read_req
Definition: ble_gatts.h:398
ble_gapc.h
BLE GAPC API.
ble_gatts_evt_t::write_req
ble_gatts_evt_write_t write_req
Definition: ble_gatts.h:399
ble_gatts_create_db_t::attribute_table::attr_tab_16
const ble_gatts_attm_desc_t * attr_tab_16
Definition: ble_gatts.h:290
ble_gatts_create_db_t::attr_tab_type
ble_gatts_service_type_t attr_tab_type
Definition: ble_gatts.h:296
ble_gatts_create_db_t::max_nb_attr
uint8_t max_nb_attr
Definition: ble_gatts.h:287
ble_gatts_noti_ind_t::handle
uint16_t handle
Definition: ble_gatts.h:336
ble_gatts_attm_desc_128_t::perm
uint16_t perm
Definition: ble_gatts.h:256
ble_gatts_evt_cccd_rec_t::handle
uint16_t handle
Definition: ble_gatts.h:379
ble_gatts_write_cfm
uint16_t ble_gatts_write_cfm(uint8_t conn_idx, const ble_gatts_write_cfm_t *p_param)
Respond to an attribute write request.
ble_gatts_noti_ind_t::value
const uint8_t * value
Definition: ble_gatts.h:338
ble_gatts_prep_write_cfm_t::handle
uint16_t handle
Definition: ble_gatts.h:324
ble_gatts_create_db_t::shdl
uint16_t * shdl
Definition: ble_gatts.h:284
ble_gatts_evt_t::cccd_recovery
ble_gatts_evt_cccd_rec_t cccd_recovery
Definition: ble_gatts.h:402
ble_gatts_read_cfm_t::length
uint16_t length
Definition: ble_gatts.h:305
ble_gatts_write_cfm_t::handle
uint16_t handle
Definition: ble_gatts.h:315
ble_gatts_evt_ntf_ind_t::handle
uint16_t handle
Definition: ble_gatts.h:372
ble_gatt_evt_type_t
ble_gatt_evt_type_t
GATT common events.
Definition: ble_gatt.h:67
ble_gatts_srvc_db_create
uint16_t ble_gatts_srvc_db_create(ble_gatts_create_db_t *p_param)
Register a service's attribute list.
ble_gatts_prep_write_cfm_t::status
uint8_t status
Definition: ble_gatts.h:326
ble_gatts_prepare_write_cfm
uint16_t ble_gatts_prepare_write_cfm(uint8_t conn_idx, const ble_gatts_prep_write_cfm_t *p_param)
Respond to an attribute prepare write request.
ble_gatts_attr_permission_get
uint16_t ble_gatts_attr_permission_get(uint16_t handle, uint16_t *p_perm, uint16_t *p_ext_perm)
Retrieve attribute permission.
ble_gatts_read_cfm_t::status
uint8_t status
Definition: ble_gatts.h:306
ble_gatts_evt_t
BLE GATTS event structure.
Definition: ble_gatts.h:394
ble_gatts_evt_write_t
GATT write request event for BLE_GATTS_EVT_WRITE_REQUEST.
Definition: ble_gatts.h:353
ble_gatts_create_db_t::inc_srvc_num
uint16_t inc_srvc_num
Definition: ble_gatts.h:294
ble_gatts_evt_prep_write_t::handle
uint16_t handle
Definition: ble_gatts.h:365
ble_gatts_prep_write_cfm_t::length
uint16_t length
Definition: ble_gatts.h:325
BLE_GATTS_MAX_INC_SRVC_NUM
#define BLE_GATTS_MAX_INC_SRVC_NUM
Definition: ble_gatts.h:70
ble_gatts_service_discoverable_set
uint16_t ble_gatts_service_discoverable_set(uint8_t conn_idx, uint16_t start_hdl, bool discoverable)
Set a service discoverable or not.
ble_gatts_create_db_t::attr_tab_cfg
uint8_t * attr_tab_cfg
Definition: ble_gatts.h:286
ble_gatts_evt_t::ntf_ind_sended
ble_gatts_evt_ntf_ind_t ntf_ind_sended
Definition: ble_gatts.h:401
ble_att.h
Attribute Protocol.
ble_gatts_value_get
uint16_t ble_gatts_value_get(uint16_t handle, uint16_t *p_length, uint8_t *p_value)
Retrieve attribute value only if the attribute value is saved in the BLE Stack space.
ble_gatts_evt_read_t::handle
uint16_t handle
Definition: ble_gatts.h:346
ble_gatts_prep_write_cfm_t
GATT prepare write result description.
Definition: ble_gatts.h:323
ble_gatts_attm_desc_t::perm
uint16_t perm
Definition: ble_gatts.h:228
ble_gatts_noti_ind_t::length
uint16_t length
Definition: ble_gatts.h:337
ble_gatts_service_changed
void ble_gatts_service_changed(void)
When service on local device finishes upgrade, call this API to send service upgrade to stack....
ble_gatts_evt_t::prep_wr_req
ble_gatts_evt_prep_write_t prep_wr_req
Definition: ble_gatts.h:400
ble_gatts_read_cfm_t::value
uint8_t * value
Definition: ble_gatts.h:307
ble_gatts_create_db_t::attribute_table
Definition: ble_gatts.h:289
ble_gatts_evt_inited_ind_t
GATTS Database Inited Indication event structure.
Definition: ble_gatts.h:387
ble_gatts_service_discover_all
uint16_t ble_gatts_service_discover_all(uint8_t conn_idx)
Set all service discoverable.
ble_gatts_evt_write_t::length
uint16_t length
Definition: ble_gatts.h:356
ble_gatts_attm_desc_128_t::ext_perm
uint16_t ext_perm
Definition: ble_gatts.h:263
ble_gatts_read_cfm_t
GATT read attribute result description.
Definition: ble_gatts.h:303
ble_gatts_attm_desc_t::ext_perm
uint16_t ext_perm
Definition: ble_gatts.h:235
ble_gatts_noti_ind
uint16_t ble_gatts_noti_ind(uint8_t conn_idx, const ble_gatts_noti_ind_t *p_param)
Send out a notification or an indication.
ble_gatts_attm_desc_128_t
Service(128 bits UUID) description.
Definition: ble_gatts.h:254
ble_gatts_evt_ntf_ind_t
Gatt Notification or indication event for BLE_GATTS_EVT_NTF_IND.
Definition: ble_gatts.h:370
ble_gatts_read_cfm
uint16_t ble_gatts_read_cfm(uint8_t conn_idx, const ble_gatts_read_cfm_t *p_param)
Respond to an attribute read request..
ble_gatts_evt_cccd_rec_t
Gatt cccd recovery event for BLE_GATTS_EVT_CCCD_RECOVERY.
Definition: ble_gatts.h:377