xref: /btstack/src/ble/gatt_client.h (revision 8918bbdafce4a0674ec2b099244a8ddc0e95ba42)
1 /*
2  * Copyright (C) 2014 BlueKitchen GmbH
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  * 3. Neither the name of the copyright holders nor the names of
14  *    contributors may be used to endorse or promote products derived
15  *    from this software without specific prior written permission.
16  * 4. Any redistribution, use, or modification is done solely for
17  *    personal benefit and not for any commercial purpose or for
18  *    monetary gain.
19  *
20  * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
21  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
24  * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
27  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
28  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
30  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31  * SUCH DAMAGE.
32  *
33  * Please inquire about commercial licensing options at
34  * [email protected]
35  *
36  */
37 
38 
39 #ifndef btstack_gatt_client_h
40 #define btstack_gatt_client_h
41 
42 #include "hci.h"
43 
44 #if defined __cplusplus
45 extern "C" {
46 #endif
47 
48 typedef enum {
49     P_READY,
50     P_W2_SEND_SERVICE_QUERY,
51     P_W4_SERVICE_QUERY_RESULT,
52     P_W2_SEND_SERVICE_WITH_UUID_QUERY,
53     P_W4_SERVICE_WITH_UUID_RESULT,
54 
55     P_W2_SEND_ALL_CHARACTERISTICS_OF_SERVICE_QUERY,
56     P_W4_ALL_CHARACTERISTICS_OF_SERVICE_QUERY_RESULT,
57     P_W2_SEND_CHARACTERISTIC_WITH_UUID_QUERY,
58     P_W4_CHARACTERISTIC_WITH_UUID_QUERY_RESULT,
59 
60     P_W2_SEND_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY,
61     P_W4_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY_RESULT,
62 
63     P_W2_SEND_INCLUDED_SERVICE_QUERY,
64     P_W4_INCLUDED_SERVICE_QUERY_RESULT,
65     P_W2_SEND_INCLUDED_SERVICE_WITH_UUID_QUERY,
66     P_W4_INCLUDED_SERVICE_UUID_WITH_QUERY_RESULT,
67 
68     P_W2_SEND_READ_CHARACTERISTIC_VALUE_QUERY,
69     P_W4_READ_CHARACTERISTIC_VALUE_RESULT,
70 
71     P_W2_SEND_READ_BLOB_QUERY,
72     P_W4_READ_BLOB_RESULT,
73 
74     P_W2_SEND_READ_BY_TYPE_REQUEST,
75     P_W4_READ_BY_TYPE_RESPONSE,
76 
77     P_W2_SEND_READ_MULTIPLE_REQUEST,
78     P_W4_READ_MULTIPLE_RESPONSE,
79 
80     P_W2_SEND_WRITE_CHARACTERISTIC_VALUE,
81     P_W4_WRITE_CHARACTERISTIC_VALUE_RESULT,
82 
83     P_W2_PREPARE_WRITE,
84     P_W4_PREPARE_WRITE_RESULT,
85     P_W2_PREPARE_RELIABLE_WRITE,
86     P_W4_PREPARE_RELIABLE_WRITE_RESULT,
87 
88     P_W2_EXECUTE_PREPARED_WRITE,
89     P_W4_EXECUTE_PREPARED_WRITE_RESULT,
90     P_W2_CANCEL_PREPARED_WRITE,
91     P_W4_CANCEL_PREPARED_WRITE_RESULT,
92     P_W2_CANCEL_PREPARED_WRITE_DATA_MISMATCH,
93     P_W4_CANCEL_PREPARED_WRITE_DATA_MISMATCH_RESULT,
94 
95 #ifdef ENABLE_GATT_FIND_INFORMATION_FOR_CCC_DISCOVERY
96     P_W2_SEND_FIND_CLIENT_CHARACTERISTIC_CONFIGURATION_QUERY,
97     P_W4_FIND_CLIENT_CHARACTERISTIC_CONFIGURATION_QUERY_RESULT,
98 #else
99     P_W2_SEND_READ_CLIENT_CHARACTERISTIC_CONFIGURATION_QUERY,
100     P_W4_READ_CLIENT_CHARACTERISTIC_CONFIGURATION_QUERY_RESULT,
101 #endif
102     P_W2_WRITE_CLIENT_CHARACTERISTIC_CONFIGURATION,
103     P_W4_CLIENT_CHARACTERISTIC_CONFIGURATION_RESULT,
104 
105     P_W2_SEND_READ_CHARACTERISTIC_DESCRIPTOR_QUERY,
106     P_W4_READ_CHARACTERISTIC_DESCRIPTOR_RESULT,
107 
108     P_W2_SEND_READ_BLOB_CHARACTERISTIC_DESCRIPTOR_QUERY,
109     P_W4_READ_BLOB_CHARACTERISTIC_DESCRIPTOR_RESULT,
110 
111     P_W2_SEND_WRITE_CHARACTERISTIC_DESCRIPTOR,
112     P_W4_WRITE_CHARACTERISTIC_DESCRIPTOR_RESULT,
113 
114     // all long writes use this
115     P_W2_PREPARE_WRITE_CHARACTERISTIC_DESCRIPTOR,
116     P_W4_PREPARE_WRITE_CHARACTERISTIC_DESCRIPTOR_RESULT,
117     P_W2_EXECUTE_PREPARED_WRITE_CHARACTERISTIC_DESCRIPTOR,
118     P_W4_EXECUTE_PREPARED_WRITE_CHARACTERISTIC_DESCRIPTOR_RESULT,
119 
120     // gatt reliable write API use this (manual version of the above)
121     P_W2_PREPARE_WRITE_SINGLE,
122     P_W4_PREPARE_WRITE_SINGLE_RESULT,
123 
124     P_W4_IDENTITY_RESOLVING,
125     P_W4_CMAC_READY,
126     P_W4_CMAC_RESULT,
127     P_W2_SEND_SIGNED_WRITE,
128     P_W4_SEND_SINGED_WRITE_DONE,
129 } gatt_client_state_t;
130 
131 
132 typedef enum{
133     SEND_MTU_EXCHANGE,
134     SENT_MTU_EXCHANGE,
135     MTU_EXCHANGED,
136     MTU_AUTO_EXCHANGE_DISABLED
137 } gatt_client_mtu_t;
138 
139 typedef struct gatt_client{
140     btstack_linked_item_t    item;
141     // TODO: rename gatt_client_state -> state
142     gatt_client_state_t gatt_client_state;
143 
144     // user callback
145     btstack_packet_handler_t callback;
146 
147     // can write without response callback
148     btstack_packet_handler_t write_without_response_callback;
149 
150     hci_con_handle_t con_handle;
151 
152     uint8_t   address_type;
153     bd_addr_t address;
154 
155     uint16_t          mtu;
156     gatt_client_mtu_t mtu_state;
157 
158     uint16_t uuid16;
159     uint8_t  uuid128[16];
160 
161     uint16_t start_group_handle;
162     uint16_t end_group_handle;
163 
164     uint16_t query_start_handle;
165     uint16_t query_end_handle;
166 
167     uint8_t  characteristic_properties;
168     uint16_t characteristic_start_handle;
169 
170     uint16_t attribute_handle;
171     uint16_t attribute_offset;
172     uint16_t attribute_length;
173     uint8_t* attribute_value;
174 
175     // read multiple characteristic values
176     uint16_t    read_multiple_handle_count;
177     uint16_t  * read_multiple_handles;
178 
179     uint16_t client_characteristic_configuration_handle;
180     uint8_t  client_characteristic_configuration_value[2];
181 
182     uint8_t  filter_with_uuid;
183     uint8_t  send_confirmation;
184 
185     int      le_device_index;
186     uint8_t  cmac[8];
187 
188     btstack_timer_source_t gc_timeout;
189 
190 #ifdef ENABLE_GATT_CLIENT_PAIRING
191     uint8_t  security_counter;
192     uint8_t  wait_for_pairing_complete;
193     uint8_t  pending_error_code;
194 #endif
195 
196 #ifdef ENABLE_LE_PROACTIVE_AUTHENTICATION
197     bool     reencryption_active;
198     uint8_t  reencryption_result;
199 #endif
200 
201 } gatt_client_t;
202 
203 typedef struct gatt_client_notification {
204     btstack_linked_item_t    item;
205     btstack_packet_handler_t callback;
206     hci_con_handle_t con_handle;
207     uint16_t attribute_handle;
208 } gatt_client_notification_t;
209 
210 /* API_START */
211 
212 typedef struct {
213     uint16_t start_group_handle;
214     uint16_t end_group_handle;
215     uint16_t uuid16;
216     uint8_t  uuid128[16];
217 } gatt_client_service_t;
218 
219 typedef struct {
220     uint16_t start_handle;
221     uint16_t value_handle;
222     uint16_t end_handle;
223     uint16_t properties;
224     uint16_t uuid16;
225     uint8_t  uuid128[16];
226 } gatt_client_characteristic_t;
227 
228 typedef struct {
229     uint16_t handle;
230     uint16_t uuid16;
231     uint8_t  uuid128[16];
232 } gatt_client_characteristic_descriptor_t;
233 
234 /**
235  * @brief Set up GATT client.
236  */
237 void gatt_client_init(void);
238 
239 /**
240  * @brief MTU is available after the first query has completed. If status is equal to ERROR_CODE_SUCCESS, it returns the real value, otherwise the default value ATT_DEFAULT_MTU (see bluetooth.h).
241  * @param  con_handle
242  * @param  mtu
243  * @return status BTSTACK_MEMORY_ALLOC_FAILED                               if no GATT client for con_handle is found
244  *                GATT_CLIENT_IN_WRONG_STATE                                if MTU is not exchanged and MTU auto-exchange is disabled
245  *                ERROR_CODE_SUCCESS                                        if query is successfully registered
246  */
247 uint8_t gatt_client_get_mtu(hci_con_handle_t con_handle, uint16_t * mtu);
248 
249 /**
250  * @brief Sets whether a MTU Exchange Request shall be automatically send before the first attribute read request is send. Default is enabled.
251  * @param enabled
252  */
253 void gatt_client_mtu_enable_auto_negotiation(uint8_t enabled);
254 
255 /**
256 * @brief Sends a MTU Exchange Request, this allows for the client to exchange MTU when gatt_client_mtu_enable_auto_negotiation is disabled.
257  * @param  callback
258  * @param  con_handle
259  */
260 void gatt_client_send_mtu_negotiation(btstack_packet_handler_t callback, hci_con_handle_t con_handle);
261 
262 /**
263  * @brief Returns if the GATT client is ready to receive a query. It is used with daemon.
264  * @param  con_handle
265  * @return is_ready_status     0 - if no GATT client for con_handle is found, or is not ready, otherwise 1
266  */
267 int gatt_client_is_ready(hci_con_handle_t con_handle);
268 
269 /**
270  * @brief Discovers all primary services. For each found service, an le_service_event_t with type set to GATT_EVENT_SERVICE_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t, with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of discovery.
271  * @param  callback
272  * @param  con_handle
273  * @return status BTSTACK_MEMORY_ALLOC_FAILED, if no GATT client for con_handle is found
274  *                GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready
275  *                ERROR_CODE_SUCCESS         , if query is successfully registered
276  */
277 uint8_t gatt_client_discover_primary_services(btstack_packet_handler_t callback, hci_con_handle_t con_handle);
278 
279 /**
280  * @brief Discovers a specific primary service given its UUID. This service may exist multiple times. For each found service, an le_service_event_t with type set to GATT_EVENT_SERVICE_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t, with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of discovery.
281  * @param callback
282  * @param con_handle
283  * @param uuid16
284  * @return status BTSTACK_MEMORY_ALLOC_FAILED, if no GATT client for con_handle is found
285  *                GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready
286  *                ERROR_CODE_SUCCESS         , if query is successfully registered
287  */
288 uint8_t gatt_client_discover_primary_services_by_uuid16(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t uuid16);
289 
290 /**
291  * @brief Discovers a specific primary service given its UUID. This service may exist multiple times. For each found service, an le_service_event_t with type set to GATT_EVENT_SERVICE_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t, with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of discovery.
292  * @param  callback
293  * @param  con_handle
294  * @param  uuid128
295  * @return status BTSTACK_MEMORY_ALLOC_FAILED, if no GATT client for con_handle is found
296  *                GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready
297  *                ERROR_CODE_SUCCESS         , if query is successfully registered
298  */
299 uint8_t gatt_client_discover_primary_services_by_uuid128(btstack_packet_handler_t callback, hci_con_handle_t con_handle, const uint8_t  * uuid128);
300 
301 /**
302  * @brief Finds included services within the specified service. For each found included service, an le_service_event_t with type set to GATT_EVENT_INCLUDED_SERVICE_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of discovery. Information about included service type (primary/secondary) can be retrieved either by sending an ATT find information request for the returned start group handle (returning the handle and the UUID for primary or secondary service) or by comparing the service to the list of all primary services.
303  * @param  callback
304  * @param  con_handle
305  * @param  service
306  * @return status BTSTACK_MEMORY_ALLOC_FAILED, if no GATT client for con_handle is found
307  *                GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready
308  *                ERROR_CODE_SUCCESS         , if query is successfully registered
309  */
310 uint8_t gatt_client_find_included_services_for_service(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_service_t  *service);
311 
312 /**
313  * @brief Discovers all characteristics within the specified service. For each found characteristic, an le_characteristics_event_t with type set to GATT_EVENT_CHARACTERISTIC_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of discovery.
314  * @param  callback
315  * @param  con_handle
316  * @param  service
317  * @return status BTSTACK_MEMORY_ALLOC_FAILED, if no GATT client for con_handle is found
318  *                GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready
319  *                ERROR_CODE_SUCCESS         , if query is successfully registered
320  */
321 uint8_t gatt_client_discover_characteristics_for_service(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_service_t  *service);
322 
323 /**
324  * @brief The following four functions are used to discover all characteristics within the specified service or handle range, and return those that match the given UUID. For each found characteristic, an le_characteristic_event_t with type set to GATT_EVENT_CHARACTERISTIC_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of discovery.
325  * @param  callback
326  * @param  con_handle
327  * @param  start_handle
328  * @param  end_handle
329  * @param  uuid16
330  * @return status BTSTACK_MEMORY_ALLOC_FAILED, if no GATT client for con_handle is found
331  *                GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready
332  *                ERROR_CODE_SUCCESS         , if query is successfully registered
333  */
334 uint8_t gatt_client_discover_characteristics_for_handle_range_by_uuid16(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t start_handle, uint16_t end_handle, uint16_t uuid16);
335 
336 /**
337  * @brief The following four functions are used to discover all characteristics within the specified service or handle range, and return those that match the given UUID. For each found characteristic, an le_characteristic_event_t with type set to GATT_EVENT_CHARACTERISTIC_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of discovery.
338  * @param  callback
339  * @param  con_handle
340  * @param  start_handle
341  * @param  end_handle
342  * @param  uuid128
343  * @return status BTSTACK_MEMORY_ALLOC_FAILED, if no GATT client for con_handle is found
344  *                GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready
345  *                ERROR_CODE_SUCCESS         , if query is successfully registered
346  */
347 uint8_t gatt_client_discover_characteristics_for_handle_range_by_uuid128(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t start_handle, uint16_t end_handle, uint8_t  * uuid128);
348 
349 /**
350  * @brief The following four functions are used to discover all characteristics within the specified service or handle range, and return those that match the given UUID. For each found characteristic, an le_characteristic_event_t with type set to GATT_EVENT_CHARACTERISTIC_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of discovery.
351  * @param  callback
352  * @param  con_handle
353  * @param  service
354  * @param  uuid16
355  * @return status BTSTACK_MEMORY_ALLOC_FAILED, if no GATT client for con_handle is found
356  *                GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready
357  *                ERROR_CODE_SUCCESS         , if query is successfully registered
358  */
359 uint8_t gatt_client_discover_characteristics_for_service_by_uuid16(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_service_t  *service, uint16_t  uuid16);
360 
361 /**
362  * @brief The following four functions are used to discover all characteristics within the specified service or handle range, and return those that match the given UUID. For each found characteristic, an le_characteristic_event_t with type set to GATT_EVENT_CHARACTERISTIC_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of discovery.
363  * @param  callback
364  * @param  con_handle
365  * @param  service
366  * @param  uuid128
367  * @return status BTSTACK_MEMORY_ALLOC_FAILED, if no GATT client for con_handle is found
368  *                GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready
369  *                ERROR_CODE_SUCCESS         , if query is successfully registered
370  */
371 uint8_t gatt_client_discover_characteristics_for_service_by_uuid128(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_service_t  *service, uint8_t  * uuid128);
372 
373 /**
374  * @brief Discovers attribute handle and UUID of a characteristic descriptor within the specified characteristic. For each found descriptor, an le_characteristic_descriptor_event_t with type set to GATT_EVENT_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of discovery.
375  * @param  callback
376  * @param  con_handle
377  * @param  characteristic
378  * @return status BTSTACK_MEMORY_ALLOC_FAILED, if no GATT client for con_handle is found
379  *                GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready
380  *                ERROR_CODE_SUCCESS         , if query is successfully registered
381  */
382 uint8_t gatt_client_discover_characteristic_descriptors(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_characteristic_t  *characteristic);
383 
384 /**
385  * @brief Reads the characteristic value using the characteristic's value handle. If the characteristic value is found, an le_characteristic_value_event_t with type set to GATT_EVENT_CHARACTERISTIC_VALUE_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of read.
386  * @param  callback
387  * @param  con_handle
388  * @param  characteristic
389  * @return status BTSTACK_MEMORY_ALLOC_FAILED, if no GATT client for con_handle is found
390  *                GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready
391  *                ERROR_CODE_SUCCESS         , if query is successfully registered
392  */
393 uint8_t gatt_client_read_value_of_characteristic(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_characteristic_t  *characteristic);
394 
395 /**
396  * @brief Reads the characteristic value using the characteristic's value handle. If the characteristic value is found, an le_characteristic_value_event_t with type set to GATT_EVENT_CHARACTERISTIC_VALUE_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of read.
397  * @param  callback
398  * @param  con_handle
399  * @param  characteristic_value_handle
400  * @return status BTSTACK_MEMORY_ALLOC_FAILED, if no GATT client for con_handle is found
401  *                GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready
402  *                ERROR_CODE_SUCCESS         , if query is successfully registered
403  */
404 uint8_t gatt_client_read_value_of_characteristic_using_value_handle(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t characteristic_value_handle);
405 
406 /**
407  * @brief Reads the characteric value of all characteristics with the uuid. For each found, an le_characteristic_value_event_t with type set to GATT_EVENT_CHARACTERISTIC_VALUE_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of read.
408  * @param  callback
409  * @param  con_handle
410  * @param  start_handle
411  * @param  end_handle
412  * @param  uuid16
413  * @return status BTSTACK_MEMORY_ALLOC_FAILED, if no GATT client for con_handle is found
414  *                GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready
415  *                ERROR_CODE_SUCCESS         , if query is successfully registered
416  */
417 uint8_t gatt_client_read_value_of_characteristics_by_uuid16(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t start_handle, uint16_t end_handle, uint16_t uuid16);
418 
419 /**
420  * @brief Reads the characteric value of all characteristics with the uuid. For each found, an le_characteristic_value_event_t with type set to GATT_EVENT_CHARACTERISTIC_VALUE_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of read.
421  * @param  callback
422  * @param  con_handle
423  * @param  start_handle
424  * @param  end_handle
425  * @param  uuid128
426  * @return status BTSTACK_MEMORY_ALLOC_FAILED, if no GATT client for con_handle is found
427  *                GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready
428  *                ERROR_CODE_SUCCESS         , if query is successfully registered
429  */
430 uint8_t gatt_client_read_value_of_characteristics_by_uuid128(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t start_handle, uint16_t end_handle, uint8_t * uuid128);
431 
432 /**
433  * @brief Reads the long characteristic value using the characteristic's value handle. The value will be returned in several blobs. For each blob, an le_characteristic_value_event_t with type set to GATT_EVENT_CHARACTERISTIC_VALUE_QUERY_RESULT and updated value offset will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, mark the end of read.
434  * @param  callback
435  * @param  con_handle
436  * @param  characteristic
437  * @return status BTSTACK_MEMORY_ALLOC_FAILED, if no GATT client for con_handle is found
438  *                GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready
439  *                ERROR_CODE_SUCCESS         , if query is successfully registered
440  */
441 uint8_t gatt_client_read_long_value_of_characteristic(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_characteristic_t  *characteristic);
442 
443 /**
444  * @brief Reads the long characteristic value using the characteristic's value handle. The value will be returned in several blobs. For each blob, an le_characteristic_value_event_t with type set to GATT_EVENT_CHARACTERISTIC_VALUE_QUERY_RESULT and updated value offset will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, mark the end of read.
445  * @param  callback
446  * @param  con_handle
447  * @param  characteristic_value_handle
448  * @return status BTSTACK_MEMORY_ALLOC_FAILED, if no GATT client for con_handle is found
449  *                GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready
450  *                ERROR_CODE_SUCCESS         , if query is successfully registered
451  */
452 uint8_t gatt_client_read_long_value_of_characteristic_using_value_handle(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t characteristic_value_handle);
453 
454 /**
455  * @brief Reads the long characteristic value using the characteristic's value handle. The value will be returned in several blobs. For each blob, an le_characteristic_value_event_t with type set to GATT_EVENT_CHARACTERISTIC_VALUE_QUERY_RESULT and updated value offset will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, mark the end of read.
456  * @param  callback
457  * @param  con_handle
458  * @param  characteristic_value_handle
459  * @param  offset
460  * @return status BTSTACK_MEMORY_ALLOC_FAILED, if no GATT client for con_handle is found
461  *                GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready
462  *                ERROR_CODE_SUCCESS         , if query is successfully registered
463  */
464 uint8_t gatt_client_read_long_value_of_characteristic_using_value_handle_with_offset(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t characteristic_value_handle, uint16_t offset);
465 
466 /*
467  * @brief Read multiple characteristic values
468  * @param  callback
469  * @param  con_handle
470  * @param  num_value_handles
471  * @param  value_handles list of handles
472  */
473 uint8_t gatt_client_read_multiple_characteristic_values(btstack_packet_handler_t callback, hci_con_handle_t con_handle, int num_value_handles, uint16_t * value_handles);
474 
475 /**
476  * @brief Writes the characteristic value using the characteristic's value handle without an acknowledgment that the write was successfully performed.
477  * @param  con_handle
478  * @param  characteristic_value_handle
479  * @param  length of data
480  * @param  data is not copied, make sure memory is accessible until write is done
481  * @return status BTSTACK_MEMORY_ALLOC_FAILED, if no GATT client for con_handle is found
482  *                GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready
483  *                BTSTACK_ACL_BUFFERS_FULL   , if L2CAP cannot send, there are no free ACL slots
484  *                ERROR_CODE_SUCCESS         , if query is successfully registered
485  */
486 uint8_t gatt_client_write_value_of_characteristic_without_response(hci_con_handle_t con_handle, uint16_t characteristic_value_handle, uint16_t length, uint8_t  * data);
487 
488 /**
489  * @brief Writes the authenticated characteristic value using the characteristic's value handle without an acknowledgment that the write was successfully performed.
490  * @note GATT_EVENT_QUERY_COMPLETE is emitted with 0 for success or ATT_ERROR_BONDING_INFORMATION_MISSING if there is no bonding information stored
491  * @param  callback
492  * @param  con_handle
493  * @param  value_handle
494  * @param  message_len
495  * @param  message is not copied, make sure memory is accessible until write is done
496  * @return status BTSTACK_MEMORY_ALLOC_FAILED                               if no GATT client for con_handle is found
497  *                GATT_CLIENT_IN_WRONG_STATE                                if GATT client is not ready
498  *                ERROR_CODE_SUCCESS                                        if query is successfully registered
499  */
500 uint8_t gatt_client_signed_write_without_response(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t value_handle, uint16_t message_len, uint8_t  * message);
501 
502 /**
503  * @brief Writes the characteristic value using the characteristic's value handle. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of write. The write is successfully performed, if the event's att_status field is set to ATT_ERROR_SUCCESS (see bluetooth.h for ATT_ERROR codes).
504  * @param  callback
505  * @param  con_handle
506  * @param  characteristic_value_handle
507  * @param  length of data
508  * @param  data is not copied, make sure memory is accessible until write is done, i.e. GATT_EVENT_QUERY_COMPLETE is received
509  * @return status BTSTACK_MEMORY_ALLOC_FAILED                               if no GATT client for con_handle is found
510  *                GATT_CLIENT_IN_WRONG_STATE                                if GATT client is not ready
511  *                ERROR_CODE_SUCCESS                                        if query is successfully registered
512  */
513 uint8_t gatt_client_write_value_of_characteristic(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t characteristic_value_handle, uint16_t length, uint8_t  * data);
514 
515 /**
516  * @brief Writes the characteristic value using the characteristic's value handle. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of write. The write is successfully performed, if the event's att_status field is set to ATT_ERROR_SUCCESS (see bluetooth.h for ATT_ERROR codes).
517  * @param  callback
518  * @param  con_handle
519  * @param  characteristic_value_handle
520  * @param  length of data
521  * @param  data is not copied, make sure memory is accessible until write is done, i.e. GATT_EVENT_QUERY_COMPLETE is received
522  * @return status BTSTACK_MEMORY_ALLOC_FAILED                               if no GATT client for con_handle is found
523  *                GATT_CLIENT_IN_WRONG_STATE                                if GATT client is not ready
524  *                ERROR_CODE_SUCCESS                                        if query is successfully registered
525  */
526 uint8_t gatt_client_write_long_value_of_characteristic(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t characteristic_value_handle, uint16_t length, uint8_t  * data);
527 
528 /**
529  * @brief Writes the characteristic value using the characteristic's value handle. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of write. The write is successfully performed, if the event's att_status field is set to ATT_ERROR_SUCCESS (see bluetooth.h for ATT_ERROR codes).
530  * @param  callback
531  * @param  con_handle
532  * @param  characteristic_value_handle
533  * @param  offset of value
534  * @param  length of data
535  * @param  data is not copied, make sure memory is accessible until write is done, i.e. GATT_EVENT_QUERY_COMPLETE is received
536  * @return status BTSTACK_MEMORY_ALLOC_FAILED                               if no GATT client for con_handle is found
537  *                GATT_CLIENT_IN_WRONG_STATE                                if GATT client is not ready
538  *                ERROR_CODE_SUCCESS                                        if query is successfully registered
539  */
540 uint8_t gatt_client_write_long_value_of_characteristic_with_offset(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t characteristic_value_handle, uint16_t offset, uint16_t length, uint8_t  * data);
541 
542 /**
543  * @brief Writes of the long characteristic value using the characteristic's value handle. It uses server response to validate that the write was correctly received. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE marks the end of write. The write is successfully performed, if the event's att_status field is set to ATT_ERROR_SUCCESS (see bluetooth.h for ATT_ERROR codes).
544  * @param  callback
545  * @param  con_handle
546  * @param  characteristic_value_handle
547  * @param  length of data
548  * @param  data is not copied, make sure memory is accessible until write is done, i.e. GATT_EVENT_QUERY_COMPLETE is received
549  * @return status BTSTACK_MEMORY_ALLOC_FAILED                               if no GATT client for con_handle is found
550  *                GATT_CLIENT_IN_WRONG_STATE                                if GATT client is not ready
551  *                ERROR_CODE_SUCCESS                                        if query is successfully registered
552  */
553 uint8_t gatt_client_reliable_write_long_value_of_characteristic(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t characteristic_value_handle, uint16_t length, uint8_t  * data);
554 
555 /**
556  * @brief Reads the characteristic descriptor using its handle. If the characteristic descriptor is found, an le_characteristic_descriptor_event_t with type set to GATT_EVENT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of read.
557  * @param  callback
558  * @param  con_handle
559  * @param  descriptor
560  * @return status BTSTACK_MEMORY_ALLOC_FAILED                               if no GATT client for con_handle is found
561  *                GATT_CLIENT_IN_WRONG_STATE                                if GATT client is not ready
562  *                ERROR_CODE_SUCCESS                                        if query is successfully registered
563  */
564 uint8_t gatt_client_read_characteristic_descriptor(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_characteristic_descriptor_t  * descriptor);
565 
566 /**
567  * @brief Reads the characteristic descriptor using its handle. If the characteristic descriptor is found, an le_characteristic_descriptor_event_t with type set to GATT_EVENT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of read.
568  * @param  callback
569  * @param  con_handle
570  * @param  descriptor
571  * @return status BTSTACK_MEMORY_ALLOC_FAILED                               if no GATT client for con_handle is found
572  *                GATT_CLIENT_IN_WRONG_STATE                                if GATT client is not ready
573  *                ERROR_CODE_SUCCESS                                        if query is successfully registered
574  */
575 uint8_t gatt_client_read_characteristic_descriptor_using_descriptor_handle(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t descriptor_handle);
576 
577 /**
578  * @brief Reads the long characteristic descriptor using its handle. It will be returned in several blobs. For each blob, an le_characteristic_descriptor_event_t with type set to GATT_EVENT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of read.
579  * @param  callback
580  * @param  con_handle
581  * @param  descriptor_handle
582  * @return status BTSTACK_MEMORY_ALLOC_FAILED                               if no GATT client for con_handle is found
583  *                GATT_CLIENT_IN_WRONG_STATE                                if GATT client is not ready
584  *                ERROR_CODE_SUCCESS                                        if query is successfully registered
585  */
586 uint8_t gatt_client_read_long_characteristic_descriptor(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_characteristic_descriptor_t  * descriptor);
587 
588 /**
589  * @brief Reads the long characteristic descriptor using its handle. It will be returned in several blobs. For each blob, an le_characteristic_descriptor_event_t with type set to GATT_EVENT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of read.
590  * @param  callback
591  * @param  con_handle
592  * @param  descriptor_handle
593  * @return status BTSTACK_MEMORY_ALLOC_FAILED                               if no GATT client for con_handle is found
594  *                GATT_CLIENT_IN_WRONG_STATE                                if GATT client is not ready
595  *                ERROR_CODE_SUCCESS                                        if query is successfully registered
596  */
597 uint8_t gatt_client_read_long_characteristic_descriptor_using_descriptor_handle(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t descriptor_handle);
598 
599 /**
600  * @brief Reads the long characteristic descriptor using its handle. It will be returned in several blobs. For each blob, an le_characteristic_descriptor_event_t with type set to GATT_EVENT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of read.
601  * @param  callback
602  * @param  con_handle
603  * @param  descriptor_handle
604  * @param  offset
605  * @return status BTSTACK_MEMORY_ALLOC_FAILED                               if no GATT client for con_handle is found
606  *                GATT_CLIENT_IN_WRONG_STATE                                if GATT client is not ready
607  *                ERROR_CODE_SUCCESS                                        if query is successfully registered
608  */
609 uint8_t gatt_client_read_long_characteristic_descriptor_using_descriptor_handle_with_offset(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t descriptor_handle, uint16_t offset);
610 
611 /**
612  * @brief Writes the characteristic descriptor using its handle. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of write. The write is successfully performed, if the event's att_status field is set to ATT_ERROR_SUCCESS (see bluetooth.h for ATT_ERROR codes).
613  * @param  callback
614  * @param  con_handle
615  * @param  descriptor
616  * @param  length of data
617  * @param  data is not copied, make sure memory is accessible until write is done, i.e. GATT_EVENT_QUERY_COMPLETE is received
618  * @return status BTSTACK_MEMORY_ALLOC_FAILED                               if no GATT client for con_handle is found
619  *                GATT_CLIENT_IN_WRONG_STATE                                if GATT client is not ready
620  *                ERROR_CODE_SUCCESS                                        if query is successfully registered
621  */
622 uint8_t gatt_client_write_characteristic_descriptor(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_characteristic_descriptor_t  * descriptor, uint16_t length, uint8_t  * data);
623 
624 /**
625  * @brief Writes the characteristic descriptor using its handle. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of write. The write is successfully performed, if the event's att_status field is set to ATT_ERROR_SUCCESS (see bluetooth.h for ATT_ERROR codes).
626  * @param  callback
627  * @param  con_handle
628  * @param  descriptor_handle
629  * @param  length of data
630  * @param  data is not copied, make sure memory is accessible until write is done, i.e. GATT_EVENT_QUERY_COMPLETE is received
631  * @return status BTSTACK_MEMORY_ALLOC_FAILED                               if no GATT client for con_handle is found
632  *                GATT_CLIENT_IN_WRONG_STATE                                if GATT client is not ready
633  *                ERROR_CODE_SUCCESS                                        if query is successfully registered
634  */
635 uint8_t gatt_client_write_characteristic_descriptor_using_descriptor_handle(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t descriptor_handle, uint16_t length, uint8_t  * data);
636 
637 /**
638  * @brief Writes the characteristic descriptor using its handle. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of write. The write is successfully performed, if the event's att_status field is set to ATT_ERROR_SUCCESS (see bluetooth.h for ATT_ERROR codes).
639  * @param  callback
640  * @param  con_handle
641  * @param  descriptor
642  * @param  length of data
643  * @param  data is not copied, make sure memory is accessible until write is done, i.e. GATT_EVENT_QUERY_COMPLETE is received
644  * @return status BTSTACK_MEMORY_ALLOC_FAILED                               if no GATT client for con_handle is found
645  *                GATT_CLIENT_IN_WRONG_STATE                                if GATT client is not ready
646  *                ERROR_CODE_SUCCESS                                        if query is successfully registered
647  */
648 uint8_t gatt_client_write_long_characteristic_descriptor(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_characteristic_descriptor_t  * descriptor, uint16_t length, uint8_t  * data);
649 
650 /**
651  * @brief Writes the characteristic descriptor using its handle. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of write. The write is successfully performed, if the event's att_status field is set to ATT_ERROR_SUCCESS (see bluetooth.h for ATT_ERROR codes).
652  * @param  callback
653  * @param  con_handle
654  * @param  descriptor_handle
655  * @param  length of data
656  * @param  data is not copied, make sure memory is accessible until write is done, i.e. GATT_EVENT_QUERY_COMPLETE is received
657  * @return status BTSTACK_MEMORY_ALLOC_FAILED                               if no GATT client for con_handle is found
658  *                GATT_CLIENT_IN_WRONG_STATE                                if GATT client is not ready
659  *                ERROR_CODE_SUCCESS                                        if query is successfully registered
660  */
661 uint8_t gatt_client_write_long_characteristic_descriptor_using_descriptor_handle(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t descriptor_handle, uint16_t length, uint8_t  * data);
662 
663 /**
664  * @brief Writes the characteristic descriptor using its handle. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of write. The write is successfully performed, if the event's att_status field is set to ATT_ERROR_SUCCESS (see bluetooth.h for ATT_ERROR codes).
665  * @param  callback
666  * @param  con_handle
667  * @param  descriptor_handle
668  * @param  offset of value
669  * @param  length of data
670  * @param  data is not copied, make sure memory is accessible until write is done, i.e. GATT_EVENT_QUERY_COMPLETE is received
671  * @return status BTSTACK_MEMORY_ALLOC_FAILED                               if no GATT client for con_handle is found
672  *                GATT_CLIENT_IN_WRONG_STATE                                if GATT client is not ready
673  *                ERROR_CODE_SUCCESS                                        if query is successfully registered
674  */
675 uint8_t gatt_client_write_long_characteristic_descriptor_using_descriptor_handle_with_offset(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t descriptor_handle, uint16_t offset, uint16_t length, uint8_t  * data);
676 
677 /**
678  * @brief Writes the client characteristic configuration of the specified characteristic. It is used to subscribe for notifications or indications of the characteristic value.
679  * For notifications or indications specify: GATT_CLIENT_CHARACTERISTICS_CONFIGURATION_NOTIFICATION resp. GATT_CLIENT_CHARACTERISTICS_CONFIGURATION_INDICATION as configuration value.
680  * The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of write. The write is successfully performed, if the event's att_status field is set to ATT_ERROR_SUCCESS
681  * (see bluetooth.h for ATT_ERROR codes).
682  * @param  callback
683  * @param  con_handle
684  * @param  characteristic
685  * @param  configuration                                                    GATT_CLIENT_CHARACTERISTICS_CONFIGURATION_NOTIFICATION, GATT_CLIENT_CHARACTERISTICS_CONFIGURATION_INDICATION
686  * @return status BTSTACK_MEMORY_ALLOC_FAILED                               if no GATT client for con_handle is found
687  *                GATT_CLIENT_IN_WRONG_STATE                                if GATT client is not ready
688  *                GATT_CLIENT_CHARACTERISTIC_NOTIFICATION_NOT_SUPPORTED     if configuring notification, but characteristic has no notification property set
689  *                GATT_CLIENT_CHARACTERISTIC_INDICATION_NOT_SUPPORTED       if configuring indication, but characteristic has no indication property set
690  *                ERROR_CODE_UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE         if configuration is invalid
691  *                ERROR_CODE_SUCCESS                                        if query is successfully registered
692  */
693 uint8_t gatt_client_write_client_characteristic_configuration(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_characteristic_t * characteristic, uint16_t configuration);
694 
695 /**
696  * @brief Register for notifications and indications of a characteristic enabled by gatt_client_write_client_characteristic_configuration
697  * @param notification struct used to store registration
698  * @param callback
699  * @param con_handle or GATT_CLIENT_ANY_CONNECTION to receive updates from all connected devices
700  * @param characteristic or NULL to receive updates for all characteristics
701  */
702 void gatt_client_listen_for_characteristic_value_updates(gatt_client_notification_t * notification, btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_characteristic_t * characteristic);
703 
704 /**
705  * @brief Stop listening to characteristic value updates registered with gatt_client_listen_for_characteristic_value_updates
706  * @param notification struct used in gatt_client_listen_for_characteristic_value_updates
707  */
708 void gatt_client_stop_listening_for_characteristic_value_updates(gatt_client_notification_t * notification);
709 
710 /**
711  * @brief Requests GATT_EVENT_CAN_WRITE_WITHOUT_RESPONSE that guarantees a single successful gatt_client_write_value_of_characteristic_without_response
712  * @param  callback
713  * @param  con_handle
714  * @returns status
715  */
716 uint8_t gatt_client_request_can_write_without_response_event(btstack_packet_handler_t callback, hci_con_handle_t con_handle);
717 
718 /**
719  * @brief Transactional write. It can be called as many times as it is needed to write the characteristics within the same transaction. Call gatt_client_execute_write to commit the transaction.
720  * @param  callback
721  * @param  con_handle
722  * @param  attribute_handle
723  * @param  offset of value
724  * @param  length of data
725  * @param  data is not copied, make sure memory is accessible until write is done, i.e. GATT_EVENT_QUERY_COMPLETE is received
726  */
727 uint8_t gatt_client_prepare_write(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t attribute_handle, uint16_t offset, uint16_t length, uint8_t * data);
728 
729 /**
730  * @brief Commit transactional write. GATT_EVENT_QUERY_COMPLETE is received.
731  * @param  callback
732  * @param  con_handle
733  */
734 uint8_t gatt_client_execute_write(btstack_packet_handler_t callback, hci_con_handle_t con_handle);
735 
736 /**
737  * @brief Abort transactional write. GATT_EVENT_QUERY_COMPLETE is received.
738  * @param  callback
739  * @param  con_handle
740  */
741 uint8_t gatt_client_cancel_write(btstack_packet_handler_t callback, hci_con_handle_t con_handle);
742 
743 /* API_END */
744 
745 // used by generated btstack_event.c
746 
747 void gatt_client_deserialize_service(const uint8_t *packet, int offset, gatt_client_service_t *service);
748 void gatt_client_deserialize_characteristic(const uint8_t * packet, int offset, gatt_client_characteristic_t * characteristic);
749 void gatt_client_deserialize_characteristic_descriptor(const uint8_t * packet, int offset, gatt_client_characteristic_descriptor_t * descriptor);
750 
751 #ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
752 void gatt_client_att_packet_handler_fuzz(uint8_t packet_type, uint16_t handle, uint8_t *packet, uint16_t size);
753 #endif
754 
755 #if defined __cplusplus
756 }
757 #endif
758 
759 #endif
760