xref: /btstack/src/ble/gatt_client.h (revision 1882d12dc36ae7b48f7f4ed3fd8d029fba3b08b1)
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     P_W2_SEND_READ_CLIENT_CHARACTERISTIC_CONFIGURATION_QUERY,
96     P_W4_READ_CLIENT_CHARACTERISTIC_CONFIGURATION_QUERY_RESULT,
97     P_W2_WRITE_CLIENT_CHARACTERISTIC_CONFIGURATION,
98     P_W4_CLIENT_CHARACTERISTIC_CONFIGURATION_RESULT,
99 
100     P_W2_SEND_READ_CHARACTERISTIC_DESCRIPTOR_QUERY,
101     P_W4_READ_CHARACTERISTIC_DESCRIPTOR_RESULT,
102 
103     P_W2_SEND_READ_BLOB_CHARACTERISTIC_DESCRIPTOR_QUERY,
104     P_W4_READ_BLOB_CHARACTERISTIC_DESCRIPTOR_RESULT,
105 
106     P_W2_SEND_WRITE_CHARACTERISTIC_DESCRIPTOR,
107     P_W4_WRITE_CHARACTERISTIC_DESCRIPTOR_RESULT,
108 
109     // all long writes use this
110     P_W2_PREPARE_WRITE_CHARACTERISTIC_DESCRIPTOR,
111     P_W4_PREPARE_WRITE_CHARACTERISTIC_DESCRIPTOR_RESULT,
112     P_W2_EXECUTE_PREPARED_WRITE_CHARACTERISTIC_DESCRIPTOR,
113     P_W4_EXECUTE_PREPARED_WRITE_CHARACTERISTIC_DESCRIPTOR_RESULT,
114 
115     // gatt reliable write API use this (manual version of the above)
116     P_W2_PREPARE_WRITE_SINGLE,
117     P_W4_PREPARE_WRITE_SINGLE_RESULT,
118 
119     P_W4_CMAC_READY,
120     P_W4_CMAC_RESULT,
121     P_W2_SEND_SIGNED_WRITE,
122     P_W4_SEND_SINGED_WRITE_DONE,
123 } gatt_client_state_t;
124 
125 
126 typedef enum{
127     SEND_MTU_EXCHANGE,
128     SENT_MTU_EXCHANGE,
129     MTU_EXCHANGED,
130     MTU_AUTO_EXCHANGE_DISABLED
131 } gatt_client_mtu_t;
132 
133 typedef struct gatt_client{
134     btstack_linked_item_t    item;
135     // TODO: rename gatt_client_state -> state
136     gatt_client_state_t gatt_client_state;
137 
138     // user callback
139     btstack_packet_handler_t callback;
140 
141     // can write without response callback
142     btstack_packet_handler_t write_without_response_callback;
143 
144     hci_con_handle_t con_handle;
145 
146     uint8_t   address_type;
147     bd_addr_t address;
148     uint16_t mtu;
149     gatt_client_mtu_t mtu_state;
150 
151     uint16_t uuid16;
152     uint8_t  uuid128[16];
153 
154     uint16_t start_group_handle;
155     uint16_t end_group_handle;
156 
157     uint16_t query_start_handle;
158     uint16_t query_end_handle;
159 
160     uint8_t  characteristic_properties;
161     uint16_t characteristic_start_handle;
162 
163     uint16_t attribute_handle;
164     uint16_t attribute_offset;
165     uint16_t attribute_length;
166     uint8_t* attribute_value;
167 
168     // read multiple characteristic values
169     uint16_t    read_multiple_handle_count;
170     uint16_t  * read_multiple_handles;
171 
172     uint16_t client_characteristic_configuration_handle;
173     uint8_t  client_characteristic_configuration_value[2];
174 
175     uint8_t  filter_with_uuid;
176     uint8_t  send_confirmation;
177 
178     int      le_device_index;
179     uint8_t  cmac[8];
180 
181     btstack_timer_source_t gc_timeout;
182 } gatt_client_t;
183 
184 typedef struct gatt_client_notification {
185     btstack_linked_item_t    item;
186     btstack_packet_handler_t callback;
187     hci_con_handle_t con_handle;
188     uint16_t attribute_handle;
189 } gatt_client_notification_t;
190 
191 /* API_START */
192 
193 typedef struct {
194     uint16_t start_group_handle;
195     uint16_t end_group_handle;
196     uint16_t uuid16;
197     uint8_t  uuid128[16];
198 } gatt_client_service_t;
199 
200 typedef struct {
201     uint16_t start_handle;
202     uint16_t value_handle;
203     uint16_t end_handle;
204     uint16_t properties;
205     uint16_t uuid16;
206     uint8_t  uuid128[16];
207 } gatt_client_characteristic_t;
208 
209 typedef struct {
210     uint16_t handle;
211     uint16_t uuid16;
212     uint8_t  uuid128[16];
213 } gatt_client_characteristic_descriptor_t;
214 
215 /**
216  * @brief Set up GATT client.
217  */
218 void gatt_client_init(void);
219 
220 /**
221  * @brief MTU is available after the first query has completed. If status is equal to 0, it returns the real value, otherwise the default value of 23.
222  */
223 uint8_t gatt_client_get_mtu(hci_con_handle_t con_handle, uint16_t * mtu);
224 
225 /**
226 * @brief Sets whether a MTU Exchange Request shall be automatically send before the first attribute read request is send. Default is enable.d
227 */
228 void gatt_client_mtu_enable_auto_negotiation(uint8_t enabled);
229 
230 /**
231 * @brief Sends a MTU Exchange Request, this allows for the client to exchange MTU when gatt_client_mtu_enable_auto_negotiation is disabled.
232 */
233 void gatt_client_send_mtu_negotiation(btstack_packet_handler_t callback, hci_con_handle_t con_handle);
234 
235 /**
236  * @brief Returns if the GATT client is ready to receive a query. It is used with daemon.
237  */
238 int gatt_client_is_ready(hci_con_handle_t con_handle);
239 
240 /**
241  * @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.
242  */
243 uint8_t gatt_client_discover_primary_services(btstack_packet_handler_t callback, hci_con_handle_t con_handle);
244 
245 /**
246  * @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.
247  */
248 uint8_t gatt_client_discover_primary_services_by_uuid16(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t uuid16);
249 uint8_t gatt_client_discover_primary_services_by_uuid128(btstack_packet_handler_t callback, hci_con_handle_t con_handle, const uint8_t  * uuid);
250 
251 /**
252  * @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.
253  */
254 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);
255 
256 /**
257  * @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.
258  */
259 uint8_t gatt_client_discover_characteristics_for_service(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_service_t  *service);
260 
261 /**
262  * @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.
263  */
264 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);
265 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  * uuid);
266 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);
267 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);
268 
269 /**
270  * @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.
271  */
272 uint8_t gatt_client_discover_characteristic_descriptors(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_characteristic_t  *characteristic);
273 
274 /**
275  * @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.
276  */
277 uint8_t gatt_client_read_value_of_characteristic(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_characteristic_t  *characteristic);
278 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);
279 
280 /**
281  * @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.
282  */
283 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);
284 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);
285 
286 /**
287  * @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.
288  */
289 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);
290 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);
291 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);
292 
293 /*
294  * @brief Read multiple characteristic values
295  * @param number handles
296  * @param list_of_handles list of handles
297  */
298 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);
299 
300 /**
301  * @brief Writes the characteristic value using the characteristic's value handle without an acknowledgment that the write was successfully performed.
302  */
303 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);
304 
305 /**
306  * @brief Writes the authenticated characteristic value using the characteristic's value handle without an acknowledgment that the write was successfully performed.
307  */
308 uint8_t gatt_client_signed_write_without_response(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t handle, uint16_t message_len, uint8_t  * message);
309 
310 /**
311  * @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 status field is set to 0.
312  */
313 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);
314 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);
315 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);
316 
317 /**
318  * @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 status field is set to 0.
319  */
320 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);
321 
322 /**
323  * @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.
324  */
325 uint8_t gatt_client_read_characteristic_descriptor(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_characteristic_descriptor_t  * descriptor);
326 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);
327 
328 /**
329  * @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.
330  */
331 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);
332 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);
333 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);
334 
335 /**
336  * @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 status field is set to 0.
337  */
338 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);
339 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);
340 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);
341 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);
342 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);
343 
344 /**
345  * @brief Writes the client characteristic configuration of the specified characteristic. It is used to subscribe for notifications or indications of the characteristic value. For notifications or indications specify: GATT_CLIENT_CHARACTERISTICS_CONFIGURATION_NOTIFICATION resp. GATT_CLIENT_CHARACTERISTICS_CONFIGURATION_INDICATION as configuration value.
346  */
347 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);
348 
349 /**
350  * @brief Register for notifications and indications of a characteristic enabled by gatt_client_write_client_characteristic_configuration
351  * @param notification struct used to store registration
352  * @param packet_handler
353  * @param con_handle
354  * @param characteristic
355  */
356 void gatt_client_listen_for_characteristic_value_updates(gatt_client_notification_t * notification, btstack_packet_handler_t packet_handler, hci_con_handle_t con_handle, gatt_client_characteristic_t * characteristic);
357 
358 /**
359  * @brief Stop listening to characteristic value updates registered with gatt_client_listen_for_characteristic_value_updates
360  * @param notification struct used in gatt_client_listen_for_characteristic_value_updates
361  */
362 void gatt_client_stop_listening_for_characteristic_value_updates(gatt_client_notification_t * notification);
363 
364 /**
365  * @brief Requests GATT_EVENT_CAN_WRITE_WITHOUT_RESPONSE that guarantees a single successful gatt_client_write_value_of_characteristic_without_response
366  * @param packet_handler
367  * @param con_handle
368  * @returns status
369  */
370 uint8_t gatt_client_request_can_write_without_response_event(btstack_packet_handler_t callback, hci_con_handle_t con_handle);
371 
372 /**
373  * @brief -> gatt complete event
374  */
375 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);
376 
377 /**
378  * @brief -> gatt complete event
379  */
380 uint8_t gatt_client_execute_write(btstack_packet_handler_t callback, hci_con_handle_t con_handle);
381 
382 /**
383  * @brief -> gatt complete event
384  */
385 uint8_t gatt_client_cancel_write(btstack_packet_handler_t callback, hci_con_handle_t con_handle);
386 
387 /* API_END */
388 
389 // used by generated btstack_event.c
390 
391 void gatt_client_deserialize_service(const uint8_t *packet, int offset, gatt_client_service_t *service);
392 void gatt_client_deserialize_characteristic(const uint8_t * packet, int offset, gatt_client_characteristic_t * characteristic);
393 void gatt_client_deserialize_characteristic_descriptor(const uint8_t * packet, int offset, gatt_client_characteristic_descriptor_t * descriptor);
394 
395 #if defined __cplusplus
396 }
397 #endif
398 
399 #endif
400