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