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) & 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 uint8_t *value; /**< Characteristic Value pointer. */
339 } ble_gatts_noti_ind_t;
340
341 /**
342 * @brief GATTS sending Multiple Notification event param description.
343 */
344 typedef struct
345 {
346 uint16_t handle; /**< Characteristic Value handle to be notified. */
347 uint16_t length; /**< Length of Characteristic Value to be sent. */
348 uint8_t *value; /**< Characteristic Value pointer. */
349 } noti_multiple_t;
350
351 /**@brief GATTCS Multiple Notification. */
352 typedef struct
353 {
354 uint16_t handle_count; /**< Handle count of the multiple attributes to be notified. */
355 noti_multiple_t *p_noti_multiple; /**< Pointer to the multiple attributes to be notified. */
356 } ble_gatts_noti_multiple_t;
357
358 /**
359 * @brief GATT read request event for @ref BLE_GATTS_EVT_READ_REQUEST.
360 */
361 typedef struct
362 {
363 uint16_t handle; /**< Handle of the attribute to be read. */
364 } ble_gatts_evt_read_t;
365
366 /**
367 * @brief GATT write request event for @ref BLE_GATTS_EVT_WRITE_REQUEST.
368 */
369 typedef struct
370 {
371 uint16_t handle; /**< Handle of the attribute to be written. */
372 uint16_t offset; /**< Offset at which the data has to be written. */
373 uint16_t length; /**< Data length to be written. */
374 uint8_t *value; /**< Data to be written to characteristic value. */
375 } ble_gatts_evt_write_t;
376
377 /**
378 * @brief GATT prepare write request event for @ref BLE_GATTS_EVT_PREP_WRITE_REQUEST.
379 */
380 typedef struct
381 {
382 uint16_t handle; /**< Handle of the attribute for whose value is requested. */
383 } ble_gatts_evt_prep_write_t;
384
385 /**@brief Gatt Notification or indication event for @ref BLE_GATTS_EVT_NTF_IND. */
386 typedef struct
387 {
388 ble_gatt_evt_type_t type; /**< Notification or indication event type. */
389 uint16_t handle; /**< Handle of the write operation, or notification/indication operation. */
390 } ble_gatts_evt_ntf_ind_t;
391
392 /**@brief Gatt cccd recovery event for @ref BLE_GATTS_EVT_CCCD_RECOVERY. */
393 typedef struct
394 {
395 ble_gap_bdaddr_t peer_addr; /**< Pointer to peer address. */
396 uint16_t handle; /**< Handle of attribute. */
397 uint16_t cccd_val; /**< CCCD value. */
398 } ble_gatts_evt_cccd_rec_t;
399
400 /**
401 * @brief GATTS Multiple Variable Length Notification Operation Complete event structure.
402 */
403 typedef struct
404 {
405 uint16_t handle_count; /**< The count of handle to be notificated. */
406 } ble_gatts_evt_multi_ntf_t;
407
408 /**
409 * @brief GATTS Database Inited Indication event structure.
410 */
411 typedef struct
412 {
413 uint16_t start_hdl;
414 uint16_t end_hdl;
415 } ble_gatts_evt_inited_ind_t;
416
417 /**@brief BLE GATTS event structure. */
418 typedef struct
419 {
420 uint8_t index; /**< Index of connection. */
421 union
422 {
423 ble_gatts_evt_read_t read_req; /**< Read request event. */
424 ble_gatts_evt_write_t write_req; /**< Write request event. */
425 ble_gatts_evt_prep_write_t prep_wr_req; /**< Prepare write request event. */
426 ble_gatts_evt_ntf_ind_t ntf_ind_sended; /**< Notification or indication sened event. */
427 ble_gatts_evt_cccd_rec_t cccd_recovery; /**< Gatt cccd recovery event . */
428 ble_gatts_evt_multi_ntf_t multi_ntf;
429 ble_gatts_evt_inited_ind_t inited_ind;
430 } params; /**< Event Parameters. */
431 } ble_gatts_evt_t;
432 /** @} */
433
434 /** @addtogroup BLE_GATTS_FUNCTIONS Functions
435 * @{ */
436 /**
437 ****************************************************************************************
438 * @brief Register a service's attribute list.
439 *
440 * @param[in] p_param: Pointer to the parameter used in creating databases. see @ref ble_gatts_create_db_t.
441 *
442 * @retval ::SDK_SUCCESS: Database has been registered successfully.
443 * @retval ::SDK_ERR_POINTER_NULL: Param is NULL or param's members are NULL.
444 * @retval ::SDK_ERR_INVALID_PARAM: The member of param is invalid.
445 * @retval ::SDK_ERR_INVALID_HANDLE: The service handles can not be allocated.
446 * @retval ::SDK_ERR_NO_RESOURCES: There is not enough memory to allocate service buffer.
447 * @retval ::SDK_ERR_INVALID_PERM: Permissions of Client Characteristic Configuration or Server Characteristic Configuration are not set correctly.
448 ****************************************************************************************
449 */
450 uint16_t ble_gatts_srvc_db_create(ble_gatts_create_db_t *p_param);
451
452 /**
453 ****************************************************************************************
454 * @brief Update attribute value only if the attribute value is saved in the BLE Stack space.
455 *
456 * @param[in] handle: Attribute handle.
457 * @param[in] length: Size of the value to set.
458 * @param[in] offset: Data offset of the value in attribute value.
459 * @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.
460 *
461 * @retval ::SDK_SUCCESS: Successfully update the attribute value.
462 * @retval ::SDK_ERR_POINTER_NULL: Value is NULL.
463 * @retval ::SDK_ERR_INVALID_HANDLE: Handle not exist in database.
464 * @retval ::SDK_ERR_REQ_NOT_SUPPORTED: Attribute data is not present in database or cannot be modified.
465 * @retval ::SDK_ERR_INVALID_ATT_VAL_LEN: New value length exceeds maximum attribute value length.
466 * @retval ::SDK_ERR_INVALID_OFFSET: Offset exceeds current attribute value length.
467 ****************************************************************************************
468 */
469 uint16_t ble_gatts_value_set(uint16_t handle, uint16_t length, uint16_t offset, const uint8_t* p_value);
470
471 /**
472 ****************************************************************************************
473 * @brief Retrieve attribute value only if the attribute value is saved in the BLE Stack space.
474 *
475 * @param[in] handle: Attribute handle.
476 * @param[in,out] p_length: Input as buffer size and output as attribute value length.
477 * @param[out] p_value: Buffer to store attribute value when buffer size is enough.
478 *
479 * @retval ::SDK_SUCCESS: Attribute value retrieved successfully.
480 * @retval ::SDK_ERR_POINTER_NULL: The pointer to input buffer size or input buffer is NULL.
481 * @retval ::SDK_ERR_INVALID_HANDLE: Handle not exist in the database.
482 * @retval ::SDK_ERR_REQ_NOT_SUPPORTED: Attribute data is not present in database.
483 * @retval ::SDK_ERR_INVALID_ATT_VAL_LEN: Attribute data value size is bigger than buffer size.
484 * @retval ::SDK_ERR_APP_ERROR: Database is not correctly initialized by application.
485 ****************************************************************************************
486 */
487 uint16_t ble_gatts_value_get(uint16_t handle, uint16_t* p_length, uint8_t* p_value);
488
489 /**
490 ****************************************************************************************
491 * @brief Update attribute permission.
492 * @note The modifications of attribute permission to service/character/include/character_extended_properties_descriptor declaration: not supported. \n
493 * 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.
494 *
495 * @param[in] handle: Attribute handle.
496 * @param[in] perm: New attribute permission.
497 * @param[in] ext_perm: New attribute extended permission.
498 *
499 * @retval ::SDK_SUCCESS: Update attribute permission successfully.
500 * @retval ::SDK_ERR_INVALID_HANDLE: Handle not exist in the database.
501 * @retval ::SDK_ERR_REQ_NOT_SUPPORTED: Attribute permission can't be modified.
502 ****************************************************************************************
503 */
504 uint16_t ble_gatts_attr_permission_set(uint16_t handle, uint16_t perm, uint16_t ext_perm);
505
506 /**
507 ****************************************************************************************
508 * @brief Retrieve attribute permission.
509 *
510 * @param[in] handle: Attribute handle.
511 * @param[out] p_perm: Attribute permission value to be returned.
512 * @param[out] p_ext_perm: Attribute extended permission value to be returned.
513 *
514 * @retval ::SDK_SUCCESS: Retrieve attribute permission successfully.
515 * @retval ::SDK_ERR_POINTER_NULL: Perm or ext_perm is NULL.
516 * @retval ::SDK_ERR_INVALID_HANDLE: Handle not exist in the database.
517 ****************************************************************************************
518 */
519 uint16_t ble_gatts_attr_permission_get(uint16_t handle, uint16_t *p_perm, uint16_t *p_ext_perm);
520
521 /**
522 ****************************************************************************************
523 * @brief Respond to an attribute read request..
524 *
525 * @note The status member gatts_read_cfm_t::status should be set to @ref BLE_ATT_ERR_INSUFF_AUTHOR
526 * to control the authorization of particular read operations of a client.
527 *
528 * @param[in] conn_idx: Current connection index.
529 * @param[in] p_param: Pointer to the parameters filled by profile. See @ref ble_gatts_read_cfm_t.
530 *
531 * @retval ::SDK_SUCCESS: Send read confirm value to stack successfully.
532 * @retval ::SDK_ERR_POINTER_NULL: Param is NULL.
533 * @retval ::SDK_ERR_INVALID_CONN_IDX: Conidx is invalid.
534 * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources.
535 ****************************************************************************************
536 */
537 uint16_t ble_gatts_read_cfm(uint8_t conn_idx, const ble_gatts_read_cfm_t *p_param);
538
539 /**
540 ****************************************************************************************
541 * @brief Respond to an attribute write request.
542 *
543 * @note The status member gatts_write_cfm_t::status should be set to @ref BLE_ATT_ERR_INSUFF_AUTHOR
544 * to control the authorization of particular client's write operation.
545 *
546 * @param[in] conn_idx: Current connection index.
547 * @param[in] p_param: Pointer to the parameters filled by profile. see @ref ble_gatts_write_cfm_t.
548 *
549 * @retval ::SDK_SUCCESS: Send write confirm status to stack successfully.
550 * @retval ::SDK_ERR_POINTER_NULL: Param is NULL.
551 * @retval ::SDK_ERR_INVALID_CONN_IDX: Conidx is invalid.
552 * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources.
553 ****************************************************************************************
554 */
555 uint16_t ble_gatts_write_cfm(uint8_t conn_idx, const ble_gatts_write_cfm_t *p_param);
556
557 /**
558 ****************************************************************************************
559 * @brief Respond to an attribute prepare write request.
560 *
561 * @note The status member gatts_prep_write_cfm_t::status should be set to @ref BLE_ATT_ERR_INSUFF_AUTHOR
562 * to control the authorization of particular client's write operation.
563 *
564 * @param[in] conn_idx: Current connection index.
565 * @param[in] p_param: Pointer to the parameters filled by profile. see @ref ble_gatts_prep_write_cfm_t.
566 *
567 * @retval ::SDK_SUCCESS: Send prepare write confirm status to stack successfully.
568 * @retval ::SDK_ERR_POINTER_NULL: Param is NULL.
569 * @retval ::SDK_ERR_INVALID_CONN_IDX: Conidx is invalid.
570 * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources.
571 ****************************************************************************************
572 */
573 uint16_t ble_gatts_prepare_write_cfm(uint8_t conn_idx, const ble_gatts_prep_write_cfm_t *p_param);
574
575 /**
576 ****************************************************************************************
577 * @brief Send out a notification or an indication.
578 *
579 * @note Check whether the relevant Client Characteristic Configuration Descriptor is enabled before using this API.
580 *
581 * @param[in] conn_idx: Current connection index.
582 * @param[in] p_param: Pointer to the parameters filled by profile. see @ref ble_gatts_noti_ind_t.
583 *
584 * @retval ::SDK_SUCCESS: Send Notification or Indication event to stack successfully.
585 * @retval ::SDK_ERR_POINTER_NULL: Param is NULL.
586 * @retval ::SDK_ERR_INVALID_CONN_IDX: Conidx is invalid.
587 * @retval ::SDK_ERR_INVALID_PARAM: Type is invalid.
588 * @retval ::SDK_ERR_INVALID_HANDLE: Handle not exist in the database.
589 * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources.
590 ****************************************************************************************
591 */
592 uint16_t ble_gatts_noti_ind(uint8_t conn_idx, const ble_gatts_noti_ind_t *p_param);
593
594 /**
595 ****************************************************************************************
596 * @brief When service on local device finishes upgrade, call this API to send service upgrade to stack.
597 * If the bonded device connects again, the stack will send service change to the bonded device until the bonded
598 * device has sent back indication confirmation.
599 ****************************************************************************************
600 */
601 void ble_gatts_service_changed(void);
602
603 /**
604 ****************************************************************************************
605 * @brief Send out Multiple Variable Length Notifications. The execution status of sending notification or
606 * indication will be retrieved in the gatts event handler @ref BLE_GATTS_EVT_MULT_NTF.
607 *
608 * @note Check whether the relevant Client Characteristic Configuration Descriptor is enabled before using this API.
609 *
610 * @param[in] conn_idx: Current connection index.
611 * @param[in] p_param: Pointer to the parameters filled by profile. see @ref ble_gatts_noti_multiple_t.
612 *
613 * @retval ::SDK_SUCCESS: Send Notification or Indication event to stack successfully.
614 * @retval ::SDK_ERR_POINTER_NULL: Param is NULL.
615 * @retval ::SDK_ERR_INVALID_CONN_IDX: Conidx is invalid.
616 * @retval ::SDK_ERR_INVALID_PARAM: Type is invalid.
617 * @retval ::SDK_ERR_INVALID_HANDLE: Handle not exist in the database.
618 * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources.
619 ****************************************************************************************
620 */
621 uint16_t ble_gatts_mult_noti(uint8_t conn_idx, const ble_gatts_noti_multiple_t *p_param);
622
623 /**
624 ****************************************************************************************
625 * @brief Set a service discoverable or not.
626 *
627 * @param[in] conn_idx: Current connection index.
628 * @param[in] start_hdl: Start handle of the service.
629 * @param[in] discoverable: Flag for discoverable(true: discoverable, false: hide)
630 *
631 * @retval ::SDK_SUCCESS: Set this service hide or not successfully.
632 * @retval ::SDK_ERR_INVALID_CONN_IDX: Conidx is invalid.
633 ****************************************************************************************
634 */
635 uint16_t ble_gatts_service_discoverable_set(uint8_t conn_idx, uint16_t start_hdl, bool discoverable);
636
637 /**
638 ****************************************************************************************
639 * @brief Set all service discoverable.
640 *
641 * @param[in] conn_idx: Current connection index.
642 *
643 * @retval ::SDK_SUCCESS: Set all service discoverable successfully.
644 * @retval ::SDK_ERR_INVALID_CONN_IDX: Conidx is invalid.
645 ****************************************************************************************
646 */
647 uint16_t ble_gatts_service_discover_all(uint8_t conn_idx);
648
649 /**
650 ****************************************************************************************
651 * @brief Hide all service.
652 *
653 * @param[in] conn_idx: Current connection index.
654 *
655 * @retval ::SDK_SUCCESS: Hide all service successfully.
656 * @retval ::SDK_ERR_INVALID_CONN_IDX: Conidx is invalid.
657 ****************************************************************************************
658 */
659 uint16_t ble_gatts_service_hide_all(uint8_t conn_idx);
660
661 /** @} */
662
663 #endif // BLE_SDK_GATTS_H_
664 /** @} */
665
666 /** @} */
667 /** @} */
668
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
noti_multiple_t::length
uint16_t length
Definition: ble_gatts.h:347
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:413
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:362
ble_gatts_evt_multi_ntf_t::handle_count
uint16_t handle_count
Definition: ble_gatts.h:405
ble_gap_bdaddr_t
The struct of broadcast address with broadcast type.
Definition: ble_gapc.h:304
ble_gatts_write_cfm_t::status
uint8_t status
Definition: ble_gatts.h:316
ble_gatts_noti_multiple_t::p_noti_multiple
noti_multiple_t * p_noti_multiple
Definition: ble_gatts.h:355
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:374
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:372
ble_gatts_create_db_t
Parameter of Added service description.
Definition: ble_gatts.h:282
noti_multiple_t
GATTS sending Multiple Notification event param description.
Definition: ble_gatts.h:345
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
noti_multiple_t::handle
uint16_t handle
Definition: ble_gatts.h:346
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:397
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:388
ble_gatts_evt_cccd_rec_t::peer_addr
ble_gap_bdaddr_t peer_addr
Definition: ble_gatts.h:395
ble_gatts_evt_prep_write_t
GATT prepare write request event for BLE_GATTS_EVT_PREP_WRITE_REQUEST.
Definition: ble_gatts.h:381
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_noti_ind_t::value
uint8_t * value
Definition: ble_gatts.h:338
ble_gatts_evt_t::index
uint8_t index
Definition: ble_gatts.h:420
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:429
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:371
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:414
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:423
ble_gapc.h
BLE GAPC API.
ble_gatts_evt_t::multi_ntf
ble_gatts_evt_multi_ntf_t multi_ntf
Definition: ble_gatts.h:428
ble_gatts_evt_t::write_req
ble_gatts_evt_write_t write_req
Definition: ble_gatts.h:424
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:396
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
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:427
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:389
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:419
ble_gatts_evt_write_t
GATT write request event for BLE_GATTS_EVT_WRITE_REQUEST.
Definition: ble_gatts.h:370
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:382
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
noti_multiple_t::value
uint8_t * value
Definition: ble_gatts.h:348
ble_gatts_evt_multi_ntf_t
GATTS Multiple Variable Length Notification Operation Complete event structure.
Definition: ble_gatts.h:404
ble_gatts_evt_t::ntf_ind_sended
ble_gatts_evt_ntf_ind_t ntf_ind_sended
Definition: ble_gatts.h:426
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:363
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_multiple_t
GATTCS Multiple Notification.
Definition: ble_gatts.h:353
ble_gatts_noti_ind_t::length
uint16_t length
Definition: ble_gatts.h:337
ble_gatts_noti_multiple_t::handle_count
uint16_t handle_count
Definition: ble_gatts.h:354
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:425
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:412
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:373
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_mult_noti
uint16_t ble_gatts_mult_noti(uint8_t conn_idx, const ble_gatts_noti_multiple_t *p_param)
Send out Multiple Variable Length Notifications. The execution status of sending notification or indi...
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:387
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:394