13deb3ec6SMatthias Ringwald /* 23deb3ec6SMatthias Ringwald * Copyright (C) 2014 BlueKitchen GmbH 33deb3ec6SMatthias Ringwald * 43deb3ec6SMatthias Ringwald * Redistribution and use in source and binary forms, with or without 53deb3ec6SMatthias Ringwald * modification, are permitted provided that the following conditions 63deb3ec6SMatthias Ringwald * are met: 73deb3ec6SMatthias Ringwald * 83deb3ec6SMatthias Ringwald * 1. Redistributions of source code must retain the above copyright 93deb3ec6SMatthias Ringwald * notice, this list of conditions and the following disclaimer. 103deb3ec6SMatthias Ringwald * 2. Redistributions in binary form must reproduce the above copyright 113deb3ec6SMatthias Ringwald * notice, this list of conditions and the following disclaimer in the 123deb3ec6SMatthias Ringwald * documentation and/or other materials provided with the distribution. 133deb3ec6SMatthias Ringwald * 3. Neither the name of the copyright holders nor the names of 143deb3ec6SMatthias Ringwald * contributors may be used to endorse or promote products derived 153deb3ec6SMatthias Ringwald * from this software without specific prior written permission. 163deb3ec6SMatthias Ringwald * 4. Any redistribution, use, or modification is done solely for 173deb3ec6SMatthias Ringwald * personal benefit and not for any commercial purpose or for 183deb3ec6SMatthias Ringwald * monetary gain. 193deb3ec6SMatthias Ringwald * 203deb3ec6SMatthias Ringwald * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS 213deb3ec6SMatthias Ringwald * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 223deb3ec6SMatthias Ringwald * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 233deb3ec6SMatthias Ringwald * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS 243deb3ec6SMatthias Ringwald * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 253deb3ec6SMatthias Ringwald * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 263deb3ec6SMatthias Ringwald * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 273deb3ec6SMatthias Ringwald * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 283deb3ec6SMatthias Ringwald * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 293deb3ec6SMatthias Ringwald * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 303deb3ec6SMatthias Ringwald * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 313deb3ec6SMatthias Ringwald * SUCH DAMAGE. 323deb3ec6SMatthias Ringwald * 333deb3ec6SMatthias Ringwald * Please inquire about commercial licensing options at 343deb3ec6SMatthias Ringwald * [email protected] 353deb3ec6SMatthias Ringwald * 363deb3ec6SMatthias Ringwald */ 373deb3ec6SMatthias Ringwald 383deb3ec6SMatthias Ringwald 393deb3ec6SMatthias Ringwald #ifndef btstack_gatt_client_h 403deb3ec6SMatthias Ringwald #define btstack_gatt_client_h 413deb3ec6SMatthias Ringwald 423deb3ec6SMatthias Ringwald #include "hci.h" 433deb3ec6SMatthias Ringwald 443deb3ec6SMatthias Ringwald #if defined __cplusplus 453deb3ec6SMatthias Ringwald extern "C" { 463deb3ec6SMatthias Ringwald #endif 473deb3ec6SMatthias Ringwald 483deb3ec6SMatthias Ringwald typedef enum { 493deb3ec6SMatthias Ringwald P_READY, 503deb3ec6SMatthias Ringwald P_W2_SEND_SERVICE_QUERY, 513deb3ec6SMatthias Ringwald P_W4_SERVICE_QUERY_RESULT, 523deb3ec6SMatthias Ringwald P_W2_SEND_SERVICE_WITH_UUID_QUERY, 533deb3ec6SMatthias Ringwald P_W4_SERVICE_WITH_UUID_RESULT, 543deb3ec6SMatthias Ringwald 553deb3ec6SMatthias Ringwald P_W2_SEND_ALL_CHARACTERISTICS_OF_SERVICE_QUERY, 563deb3ec6SMatthias Ringwald P_W4_ALL_CHARACTERISTICS_OF_SERVICE_QUERY_RESULT, 573deb3ec6SMatthias Ringwald P_W2_SEND_CHARACTERISTIC_WITH_UUID_QUERY, 583deb3ec6SMatthias Ringwald P_W4_CHARACTERISTIC_WITH_UUID_QUERY_RESULT, 593deb3ec6SMatthias Ringwald 603deb3ec6SMatthias Ringwald P_W2_SEND_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY, 613deb3ec6SMatthias Ringwald P_W4_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY_RESULT, 623deb3ec6SMatthias Ringwald 633deb3ec6SMatthias Ringwald P_W2_SEND_INCLUDED_SERVICE_QUERY, 643deb3ec6SMatthias Ringwald P_W4_INCLUDED_SERVICE_QUERY_RESULT, 653deb3ec6SMatthias Ringwald P_W2_SEND_INCLUDED_SERVICE_WITH_UUID_QUERY, 663deb3ec6SMatthias Ringwald P_W4_INCLUDED_SERVICE_UUID_WITH_QUERY_RESULT, 673deb3ec6SMatthias Ringwald 683deb3ec6SMatthias Ringwald P_W2_SEND_READ_CHARACTERISTIC_VALUE_QUERY, 693deb3ec6SMatthias Ringwald P_W4_READ_CHARACTERISTIC_VALUE_RESULT, 703deb3ec6SMatthias Ringwald 713deb3ec6SMatthias Ringwald P_W2_SEND_READ_BLOB_QUERY, 723deb3ec6SMatthias Ringwald P_W4_READ_BLOB_RESULT, 733deb3ec6SMatthias Ringwald 743deb3ec6SMatthias Ringwald P_W2_SEND_READ_BY_TYPE_REQUEST, 753deb3ec6SMatthias Ringwald P_W4_READ_BY_TYPE_RESPONSE, 763deb3ec6SMatthias Ringwald 773deb3ec6SMatthias Ringwald P_W2_SEND_READ_MULTIPLE_REQUEST, 783deb3ec6SMatthias Ringwald P_W4_READ_MULTIPLE_RESPONSE, 793deb3ec6SMatthias Ringwald 803deb3ec6SMatthias Ringwald P_W2_SEND_WRITE_CHARACTERISTIC_VALUE, 813deb3ec6SMatthias Ringwald P_W4_WRITE_CHARACTERISTIC_VALUE_RESULT, 823deb3ec6SMatthias Ringwald 833deb3ec6SMatthias Ringwald P_W2_PREPARE_WRITE, 843deb3ec6SMatthias Ringwald P_W4_PREPARE_WRITE_RESULT, 853deb3ec6SMatthias Ringwald P_W2_PREPARE_RELIABLE_WRITE, 863deb3ec6SMatthias Ringwald P_W4_PREPARE_RELIABLE_WRITE_RESULT, 873deb3ec6SMatthias Ringwald 883deb3ec6SMatthias Ringwald P_W2_EXECUTE_PREPARED_WRITE, 893deb3ec6SMatthias Ringwald P_W4_EXECUTE_PREPARED_WRITE_RESULT, 903deb3ec6SMatthias Ringwald P_W2_CANCEL_PREPARED_WRITE, 913deb3ec6SMatthias Ringwald P_W4_CANCEL_PREPARED_WRITE_RESULT, 923deb3ec6SMatthias Ringwald P_W2_CANCEL_PREPARED_WRITE_DATA_MISMATCH, 933deb3ec6SMatthias Ringwald P_W4_CANCEL_PREPARED_WRITE_DATA_MISMATCH_RESULT, 943deb3ec6SMatthias Ringwald 95abdc9fb5SMatthias Ringwald #ifdef ENABLE_GATT_FIND_INFORMATION_FOR_CCC_DISCOVERY 96abdc9fb5SMatthias Ringwald P_W2_SEND_FIND_CLIENT_CHARACTERISTIC_CONFIGURATION_QUERY, 97abdc9fb5SMatthias Ringwald P_W4_FIND_CLIENT_CHARACTERISTIC_CONFIGURATION_QUERY_RESULT, 98abdc9fb5SMatthias Ringwald #else 993deb3ec6SMatthias Ringwald P_W2_SEND_READ_CLIENT_CHARACTERISTIC_CONFIGURATION_QUERY, 1003deb3ec6SMatthias Ringwald P_W4_READ_CLIENT_CHARACTERISTIC_CONFIGURATION_QUERY_RESULT, 101abdc9fb5SMatthias Ringwald #endif 1023deb3ec6SMatthias Ringwald P_W2_WRITE_CLIENT_CHARACTERISTIC_CONFIGURATION, 1033deb3ec6SMatthias Ringwald P_W4_CLIENT_CHARACTERISTIC_CONFIGURATION_RESULT, 1043deb3ec6SMatthias Ringwald 1053deb3ec6SMatthias Ringwald P_W2_SEND_READ_CHARACTERISTIC_DESCRIPTOR_QUERY, 1063deb3ec6SMatthias Ringwald P_W4_READ_CHARACTERISTIC_DESCRIPTOR_RESULT, 1073deb3ec6SMatthias Ringwald 1083deb3ec6SMatthias Ringwald P_W2_SEND_READ_BLOB_CHARACTERISTIC_DESCRIPTOR_QUERY, 1093deb3ec6SMatthias Ringwald P_W4_READ_BLOB_CHARACTERISTIC_DESCRIPTOR_RESULT, 1103deb3ec6SMatthias Ringwald 1113deb3ec6SMatthias Ringwald P_W2_SEND_WRITE_CHARACTERISTIC_DESCRIPTOR, 1123deb3ec6SMatthias Ringwald P_W4_WRITE_CHARACTERISTIC_DESCRIPTOR_RESULT, 1133deb3ec6SMatthias Ringwald 1143deb3ec6SMatthias Ringwald // all long writes use this 1153deb3ec6SMatthias Ringwald P_W2_PREPARE_WRITE_CHARACTERISTIC_DESCRIPTOR, 1163deb3ec6SMatthias Ringwald P_W4_PREPARE_WRITE_CHARACTERISTIC_DESCRIPTOR_RESULT, 1173deb3ec6SMatthias Ringwald P_W2_EXECUTE_PREPARED_WRITE_CHARACTERISTIC_DESCRIPTOR, 1183deb3ec6SMatthias Ringwald P_W4_EXECUTE_PREPARED_WRITE_CHARACTERISTIC_DESCRIPTOR_RESULT, 1193deb3ec6SMatthias Ringwald 1203deb3ec6SMatthias Ringwald // gatt reliable write API use this (manual version of the above) 1213deb3ec6SMatthias Ringwald P_W2_PREPARE_WRITE_SINGLE, 1223deb3ec6SMatthias Ringwald P_W4_PREPARE_WRITE_SINGLE_RESULT, 1233deb3ec6SMatthias Ringwald 124793cf6ceSMatthias Ringwald P_W4_IDENTITY_RESOLVING, 1253deb3ec6SMatthias Ringwald P_W4_CMAC_READY, 1263deb3ec6SMatthias Ringwald P_W4_CMAC_RESULT, 1273deb3ec6SMatthias Ringwald P_W2_SEND_SIGNED_WRITE, 1283deb3ec6SMatthias Ringwald P_W4_SEND_SINGED_WRITE_DONE, 1293deb3ec6SMatthias Ringwald } gatt_client_state_t; 1303deb3ec6SMatthias Ringwald 1313deb3ec6SMatthias Ringwald 1323deb3ec6SMatthias Ringwald typedef enum{ 1333deb3ec6SMatthias Ringwald SEND_MTU_EXCHANGE, 1343deb3ec6SMatthias Ringwald SENT_MTU_EXCHANGE, 1355cf6c434SJakob Krantz MTU_EXCHANGED, 1365cf6c434SJakob Krantz MTU_AUTO_EXCHANGE_DISABLED 1373deb3ec6SMatthias Ringwald } gatt_client_mtu_t; 1383deb3ec6SMatthias Ringwald 1393deb3ec6SMatthias Ringwald typedef struct gatt_client{ 140665d90f2SMatthias Ringwald btstack_linked_item_t item; 1413deb3ec6SMatthias Ringwald // TODO: rename gatt_client_state -> state 1423deb3ec6SMatthias Ringwald gatt_client_state_t gatt_client_state; 1433deb3ec6SMatthias Ringwald 1449c662c9bSMatthias Ringwald // user callback 1459c662c9bSMatthias Ringwald btstack_packet_handler_t callback; 1463deb3ec6SMatthias Ringwald 14747181045SMatthias Ringwald // can write without response callback 14847181045SMatthias Ringwald btstack_packet_handler_t write_without_response_callback; 14947181045SMatthias Ringwald 150fc64f94aSMatthias Ringwald hci_con_handle_t con_handle; 1513deb3ec6SMatthias Ringwald 1523deb3ec6SMatthias Ringwald uint8_t address_type; 1533deb3ec6SMatthias Ringwald bd_addr_t address; 154f4b33574SMatthias Ringwald 1553deb3ec6SMatthias Ringwald uint16_t mtu; 1563deb3ec6SMatthias Ringwald gatt_client_mtu_t mtu_state; 1573deb3ec6SMatthias Ringwald 1583deb3ec6SMatthias Ringwald uint16_t uuid16; 1593deb3ec6SMatthias Ringwald uint8_t uuid128[16]; 1603deb3ec6SMatthias Ringwald 1613deb3ec6SMatthias Ringwald uint16_t start_group_handle; 1623deb3ec6SMatthias Ringwald uint16_t end_group_handle; 1633deb3ec6SMatthias Ringwald 1643deb3ec6SMatthias Ringwald uint16_t query_start_handle; 1653deb3ec6SMatthias Ringwald uint16_t query_end_handle; 1663deb3ec6SMatthias Ringwald 1673deb3ec6SMatthias Ringwald uint8_t characteristic_properties; 1683deb3ec6SMatthias Ringwald uint16_t characteristic_start_handle; 1693deb3ec6SMatthias Ringwald 1703deb3ec6SMatthias Ringwald uint16_t attribute_handle; 1713deb3ec6SMatthias Ringwald uint16_t attribute_offset; 1723deb3ec6SMatthias Ringwald uint16_t attribute_length; 1733deb3ec6SMatthias Ringwald uint8_t* attribute_value; 1743deb3ec6SMatthias Ringwald 1753deb3ec6SMatthias Ringwald // read multiple characteristic values 1763deb3ec6SMatthias Ringwald uint16_t read_multiple_handle_count; 1773deb3ec6SMatthias Ringwald uint16_t * read_multiple_handles; 1783deb3ec6SMatthias Ringwald 1793deb3ec6SMatthias Ringwald uint16_t client_characteristic_configuration_handle; 1803deb3ec6SMatthias Ringwald uint8_t client_characteristic_configuration_value[2]; 1813deb3ec6SMatthias Ringwald 1823deb3ec6SMatthias Ringwald uint8_t filter_with_uuid; 1833deb3ec6SMatthias Ringwald uint8_t send_confirmation; 1843deb3ec6SMatthias Ringwald 1853deb3ec6SMatthias Ringwald int le_device_index; 1863deb3ec6SMatthias Ringwald uint8_t cmac[8]; 1873deb3ec6SMatthias Ringwald 188ec820d77SMatthias Ringwald btstack_timer_source_t gc_timeout; 189f4b33574SMatthias Ringwald 190f4b33574SMatthias Ringwald #ifdef ENABLE_GATT_CLIENT_PAIRING 191f4b33574SMatthias Ringwald uint8_t security_counter; 192f4b33574SMatthias Ringwald uint8_t wait_for_pairing_complete; 193f4b33574SMatthias Ringwald uint8_t pending_error_code; 194f4b33574SMatthias Ringwald #endif 195f4b33574SMatthias Ringwald 196*8918bbdaSMatthias Ringwald #ifdef ENABLE_LE_PROACTIVE_AUTHENTICATION 197*8918bbdaSMatthias Ringwald bool reencryption_active; 198*8918bbdaSMatthias Ringwald uint8_t reencryption_result; 199*8918bbdaSMatthias Ringwald #endif 200*8918bbdaSMatthias Ringwald 2013deb3ec6SMatthias Ringwald } gatt_client_t; 2023deb3ec6SMatthias Ringwald 2039c662c9bSMatthias Ringwald typedef struct gatt_client_notification { 204665d90f2SMatthias Ringwald btstack_linked_item_t item; 205b6e96f14SMatthias Ringwald btstack_packet_handler_t callback; 206711e6c80SMatthias Ringwald hci_con_handle_t con_handle; 2079c662c9bSMatthias Ringwald uint16_t attribute_handle; 2089c662c9bSMatthias Ringwald } gatt_client_notification_t; 2093deb3ec6SMatthias Ringwald 2103deb3ec6SMatthias Ringwald /* API_START */ 2113deb3ec6SMatthias Ringwald 212d25c33e5SMatthias Ringwald typedef struct { 2133deb3ec6SMatthias Ringwald uint16_t start_group_handle; 2143deb3ec6SMatthias Ringwald uint16_t end_group_handle; 2153deb3ec6SMatthias Ringwald uint16_t uuid16; 2163deb3ec6SMatthias Ringwald uint8_t uuid128[16]; 217d25c33e5SMatthias Ringwald } gatt_client_service_t; 2183deb3ec6SMatthias Ringwald 219d25c33e5SMatthias Ringwald typedef struct { 2203deb3ec6SMatthias Ringwald uint16_t start_handle; 2213deb3ec6SMatthias Ringwald uint16_t value_handle; 2223deb3ec6SMatthias Ringwald uint16_t end_handle; 2233deb3ec6SMatthias Ringwald uint16_t properties; 2243deb3ec6SMatthias Ringwald uint16_t uuid16; 2253deb3ec6SMatthias Ringwald uint8_t uuid128[16]; 226d25c33e5SMatthias Ringwald } gatt_client_characteristic_t; 2273deb3ec6SMatthias Ringwald 228d25c33e5SMatthias Ringwald typedef struct { 2293deb3ec6SMatthias Ringwald uint16_t handle; 2303deb3ec6SMatthias Ringwald uint16_t uuid16; 2313deb3ec6SMatthias Ringwald uint8_t uuid128[16]; 232d25c33e5SMatthias Ringwald } gatt_client_characteristic_descriptor_t; 2333deb3ec6SMatthias Ringwald 2343deb3ec6SMatthias Ringwald /** 2353deb3ec6SMatthias Ringwald * @brief Set up GATT client. 2363deb3ec6SMatthias Ringwald */ 2373deb3ec6SMatthias Ringwald void gatt_client_init(void); 2383deb3ec6SMatthias Ringwald 2393deb3ec6SMatthias Ringwald /** 240692bf1adSMilanka Ringwald * @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). 2416da84376SMilanka Ringwald * @param con_handle 2426da84376SMilanka Ringwald * @param mtu 243692bf1adSMilanka Ringwald * @return status BTSTACK_MEMORY_ALLOC_FAILED if no GATT client for con_handle is found 244692bf1adSMilanka Ringwald * GATT_CLIENT_IN_WRONG_STATE if MTU is not exchanged and MTU auto-exchange is disabled 245692bf1adSMilanka Ringwald * ERROR_CODE_SUCCESS if query is successfully registered 2463deb3ec6SMatthias Ringwald */ 247fc64f94aSMatthias Ringwald uint8_t gatt_client_get_mtu(hci_con_handle_t con_handle, uint16_t * mtu); 2483deb3ec6SMatthias Ringwald 2493deb3ec6SMatthias Ringwald /** 2506da84376SMilanka Ringwald * @brief Sets whether a MTU Exchange Request shall be automatically send before the first attribute read request is send. Default is enabled. 2516da84376SMilanka Ringwald * @param enabled 2525cf6c434SJakob Krantz */ 2535cf6c434SJakob Krantz void gatt_client_mtu_enable_auto_negotiation(uint8_t enabled); 2545cf6c434SJakob Krantz 2555cf6c434SJakob Krantz /** 2565cf6c434SJakob Krantz * @brief Sends a MTU Exchange Request, this allows for the client to exchange MTU when gatt_client_mtu_enable_auto_negotiation is disabled. 2576da84376SMilanka Ringwald * @param callback 2586da84376SMilanka Ringwald * @param con_handle 2595cf6c434SJakob Krantz */ 2605cf6c434SJakob Krantz void gatt_client_send_mtu_negotiation(btstack_packet_handler_t callback, hci_con_handle_t con_handle); 2615cf6c434SJakob Krantz 2625cf6c434SJakob Krantz /** 2633deb3ec6SMatthias Ringwald * @brief Returns if the GATT client is ready to receive a query. It is used with daemon. 2646da84376SMilanka Ringwald * @param con_handle 265692bf1adSMilanka Ringwald * @return is_ready_status 0 - if no GATT client for con_handle is found, or is not ready, otherwise 1 2663deb3ec6SMatthias Ringwald */ 267fc64f94aSMatthias Ringwald int gatt_client_is_ready(hci_con_handle_t con_handle); 2683deb3ec6SMatthias Ringwald 2693deb3ec6SMatthias Ringwald /** 2705611a760SMatthias Ringwald * @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. 2716da84376SMilanka Ringwald * @param callback 2726da84376SMilanka Ringwald * @param con_handle 273692bf1adSMilanka Ringwald * @return status BTSTACK_MEMORY_ALLOC_FAILED, if no GATT client for con_handle is found 274692bf1adSMilanka Ringwald * GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready 275692bf1adSMilanka Ringwald * ERROR_CODE_SUCCESS , if query is successfully registered 2763deb3ec6SMatthias Ringwald */ 277711e6c80SMatthias Ringwald uint8_t gatt_client_discover_primary_services(btstack_packet_handler_t callback, hci_con_handle_t con_handle); 2783deb3ec6SMatthias Ringwald 2793deb3ec6SMatthias Ringwald /** 2805611a760SMatthias Ringwald * @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. 2816da84376SMilanka Ringwald * @param callback 2826da84376SMilanka Ringwald * @param con_handle 2836da84376SMilanka Ringwald * @param uuid16 284692bf1adSMilanka Ringwald * @return status BTSTACK_MEMORY_ALLOC_FAILED, if no GATT client for con_handle is found 285692bf1adSMilanka Ringwald * GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready 286692bf1adSMilanka Ringwald * ERROR_CODE_SUCCESS , if query is successfully registered 2873deb3ec6SMatthias Ringwald */ 288711e6c80SMatthias Ringwald uint8_t gatt_client_discover_primary_services_by_uuid16(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t uuid16); 2896da84376SMilanka Ringwald 2906da84376SMilanka Ringwald /** 2916da84376SMilanka Ringwald * @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. 2926da84376SMilanka Ringwald * @param callback 2936da84376SMilanka Ringwald * @param con_handle 2946da84376SMilanka Ringwald * @param uuid128 295692bf1adSMilanka Ringwald * @return status BTSTACK_MEMORY_ALLOC_FAILED, if no GATT client for con_handle is found 296692bf1adSMilanka Ringwald * GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready 297692bf1adSMilanka Ringwald * ERROR_CODE_SUCCESS , if query is successfully registered 2986da84376SMilanka Ringwald */ 2996da84376SMilanka Ringwald uint8_t gatt_client_discover_primary_services_by_uuid128(btstack_packet_handler_t callback, hci_con_handle_t con_handle, const uint8_t * uuid128); 3003deb3ec6SMatthias Ringwald 3013deb3ec6SMatthias Ringwald /** 3025611a760SMatthias Ringwald * @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. 3036da84376SMilanka Ringwald * @param callback 3046da84376SMilanka Ringwald * @param con_handle 3056da84376SMilanka Ringwald * @param service 306692bf1adSMilanka Ringwald * @return status BTSTACK_MEMORY_ALLOC_FAILED, if no GATT client for con_handle is found 307692bf1adSMilanka Ringwald * GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready 308692bf1adSMilanka Ringwald * ERROR_CODE_SUCCESS , if query is successfully registered 3093deb3ec6SMatthias Ringwald */ 310711e6c80SMatthias Ringwald 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); 3113deb3ec6SMatthias Ringwald 3123deb3ec6SMatthias Ringwald /** 3135611a760SMatthias Ringwald * @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. 3146da84376SMilanka Ringwald * @param callback 3156da84376SMilanka Ringwald * @param con_handle 3166da84376SMilanka Ringwald * @param service 317692bf1adSMilanka Ringwald * @return status BTSTACK_MEMORY_ALLOC_FAILED, if no GATT client for con_handle is found 318692bf1adSMilanka Ringwald * GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready 319692bf1adSMilanka Ringwald * ERROR_CODE_SUCCESS , if query is successfully registered 3203deb3ec6SMatthias Ringwald */ 321711e6c80SMatthias Ringwald uint8_t gatt_client_discover_characteristics_for_service(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_service_t *service); 3223deb3ec6SMatthias Ringwald 3233deb3ec6SMatthias Ringwald /** 3245611a760SMatthias Ringwald * @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. 3256da84376SMilanka Ringwald * @param callback 3266da84376SMilanka Ringwald * @param con_handle 3276da84376SMilanka Ringwald * @param start_handle 3286da84376SMilanka Ringwald * @param end_handle 3296da84376SMilanka Ringwald * @param uuid16 330692bf1adSMilanka Ringwald * @return status BTSTACK_MEMORY_ALLOC_FAILED, if no GATT client for con_handle is found 331692bf1adSMilanka Ringwald * GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready 332692bf1adSMilanka Ringwald * ERROR_CODE_SUCCESS , if query is successfully registered 3333deb3ec6SMatthias Ringwald */ 334711e6c80SMatthias Ringwald 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); 3356da84376SMilanka Ringwald 3366da84376SMilanka Ringwald /** 3376da84376SMilanka Ringwald * @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. 3386da84376SMilanka Ringwald * @param callback 3396da84376SMilanka Ringwald * @param con_handle 3406da84376SMilanka Ringwald * @param start_handle 3416da84376SMilanka Ringwald * @param end_handle 3426da84376SMilanka Ringwald * @param uuid128 343692bf1adSMilanka Ringwald * @return status BTSTACK_MEMORY_ALLOC_FAILED, if no GATT client for con_handle is found 344692bf1adSMilanka Ringwald * GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready 345692bf1adSMilanka Ringwald * ERROR_CODE_SUCCESS , if query is successfully registered 3466da84376SMilanka Ringwald */ 3476da84376SMilanka Ringwald 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); 3486da84376SMilanka Ringwald 3496da84376SMilanka Ringwald /** 3506da84376SMilanka Ringwald * @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. 3516da84376SMilanka Ringwald * @param callback 3526da84376SMilanka Ringwald * @param con_handle 3536da84376SMilanka Ringwald * @param service 3546da84376SMilanka Ringwald * @param uuid16 355692bf1adSMilanka Ringwald * @return status BTSTACK_MEMORY_ALLOC_FAILED, if no GATT client for con_handle is found 356692bf1adSMilanka Ringwald * GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready 357692bf1adSMilanka Ringwald * ERROR_CODE_SUCCESS , if query is successfully registered 3586da84376SMilanka Ringwald */ 359711e6c80SMatthias Ringwald 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); 3606da84376SMilanka Ringwald 3616da84376SMilanka Ringwald /** 3626da84376SMilanka Ringwald * @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. 3636da84376SMilanka Ringwald * @param callback 3646da84376SMilanka Ringwald * @param con_handle 3656da84376SMilanka Ringwald * @param service 3666da84376SMilanka Ringwald * @param uuid128 367692bf1adSMilanka Ringwald * @return status BTSTACK_MEMORY_ALLOC_FAILED, if no GATT client for con_handle is found 368692bf1adSMilanka Ringwald * GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready 369692bf1adSMilanka Ringwald * ERROR_CODE_SUCCESS , if query is successfully registered 3706da84376SMilanka Ringwald */ 371711e6c80SMatthias Ringwald 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); 3723deb3ec6SMatthias Ringwald 3733deb3ec6SMatthias Ringwald /** 3745611a760SMatthias Ringwald * @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. 3756da84376SMilanka Ringwald * @param callback 3766da84376SMilanka Ringwald * @param con_handle 3776da84376SMilanka Ringwald * @param characteristic 378692bf1adSMilanka Ringwald * @return status BTSTACK_MEMORY_ALLOC_FAILED, if no GATT client for con_handle is found 379692bf1adSMilanka Ringwald * GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready 380692bf1adSMilanka Ringwald * ERROR_CODE_SUCCESS , if query is successfully registered 3813deb3ec6SMatthias Ringwald */ 382711e6c80SMatthias Ringwald uint8_t gatt_client_discover_characteristic_descriptors(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_characteristic_t *characteristic); 3833deb3ec6SMatthias Ringwald 3843deb3ec6SMatthias Ringwald /** 3855611a760SMatthias Ringwald * @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. 3866da84376SMilanka Ringwald * @param callback 3876da84376SMilanka Ringwald * @param con_handle 3886da84376SMilanka Ringwald * @param characteristic 389692bf1adSMilanka Ringwald * @return status BTSTACK_MEMORY_ALLOC_FAILED, if no GATT client for con_handle is found 390692bf1adSMilanka Ringwald * GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready 391692bf1adSMilanka Ringwald * ERROR_CODE_SUCCESS , if query is successfully registered 3923deb3ec6SMatthias Ringwald */ 393711e6c80SMatthias Ringwald uint8_t gatt_client_read_value_of_characteristic(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_characteristic_t *characteristic); 3946da84376SMilanka Ringwald 3956da84376SMilanka Ringwald /** 3966da84376SMilanka Ringwald * @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. 3976da84376SMilanka Ringwald * @param callback 3986da84376SMilanka Ringwald * @param con_handle 3996da84376SMilanka Ringwald * @param characteristic_value_handle 400692bf1adSMilanka Ringwald * @return status BTSTACK_MEMORY_ALLOC_FAILED, if no GATT client for con_handle is found 401692bf1adSMilanka Ringwald * GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready 402692bf1adSMilanka Ringwald * ERROR_CODE_SUCCESS , if query is successfully registered 4036da84376SMilanka Ringwald */ 404711e6c80SMatthias Ringwald 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); 4053deb3ec6SMatthias Ringwald 4063deb3ec6SMatthias Ringwald /** 4075611a760SMatthias Ringwald * @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. 4086da84376SMilanka Ringwald * @param callback 4096da84376SMilanka Ringwald * @param con_handle 4106da84376SMilanka Ringwald * @param start_handle 4116da84376SMilanka Ringwald * @param end_handle 4126da84376SMilanka Ringwald * @param uuid16 413692bf1adSMilanka Ringwald * @return status BTSTACK_MEMORY_ALLOC_FAILED, if no GATT client for con_handle is found 414692bf1adSMilanka Ringwald * GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready 415692bf1adSMilanka Ringwald * ERROR_CODE_SUCCESS , if query is successfully registered 4163deb3ec6SMatthias Ringwald */ 417711e6c80SMatthias Ringwald 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); 4186da84376SMilanka Ringwald 4196da84376SMilanka Ringwald /** 4206da84376SMilanka Ringwald * @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. 4216da84376SMilanka Ringwald * @param callback 4226da84376SMilanka Ringwald * @param con_handle 4236da84376SMilanka Ringwald * @param start_handle 4246da84376SMilanka Ringwald * @param end_handle 4256da84376SMilanka Ringwald * @param uuid128 426692bf1adSMilanka Ringwald * @return status BTSTACK_MEMORY_ALLOC_FAILED, if no GATT client for con_handle is found 427692bf1adSMilanka Ringwald * GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready 428692bf1adSMilanka Ringwald * ERROR_CODE_SUCCESS , if query is successfully registered 4296da84376SMilanka Ringwald */ 430711e6c80SMatthias Ringwald 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); 4313deb3ec6SMatthias Ringwald 4323deb3ec6SMatthias Ringwald /** 4335611a760SMatthias Ringwald * @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. 4346da84376SMilanka Ringwald * @param callback 4356da84376SMilanka Ringwald * @param con_handle 4366da84376SMilanka Ringwald * @param characteristic 437692bf1adSMilanka Ringwald * @return status BTSTACK_MEMORY_ALLOC_FAILED, if no GATT client for con_handle is found 438692bf1adSMilanka Ringwald * GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready 439692bf1adSMilanka Ringwald * ERROR_CODE_SUCCESS , if query is successfully registered 4403deb3ec6SMatthias Ringwald */ 441711e6c80SMatthias Ringwald 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); 4426da84376SMilanka Ringwald 4436da84376SMilanka Ringwald /** 4446da84376SMilanka Ringwald * @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. 4456da84376SMilanka Ringwald * @param callback 4466da84376SMilanka Ringwald * @param con_handle 4476da84376SMilanka Ringwald * @param characteristic_value_handle 448692bf1adSMilanka Ringwald * @return status BTSTACK_MEMORY_ALLOC_FAILED, if no GATT client for con_handle is found 449692bf1adSMilanka Ringwald * GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready 450692bf1adSMilanka Ringwald * ERROR_CODE_SUCCESS , if query is successfully registered 4516da84376SMilanka Ringwald */ 452711e6c80SMatthias Ringwald 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); 4536da84376SMilanka Ringwald 4546da84376SMilanka Ringwald /** 4556da84376SMilanka Ringwald * @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. 4566da84376SMilanka Ringwald * @param callback 4576da84376SMilanka Ringwald * @param con_handle 4586da84376SMilanka Ringwald * @param characteristic_value_handle 4596da84376SMilanka Ringwald * @param offset 460692bf1adSMilanka Ringwald * @return status BTSTACK_MEMORY_ALLOC_FAILED, if no GATT client for con_handle is found 461692bf1adSMilanka Ringwald * GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready 462692bf1adSMilanka Ringwald * ERROR_CODE_SUCCESS , if query is successfully registered 4636da84376SMilanka Ringwald */ 464711e6c80SMatthias Ringwald 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); 4653deb3ec6SMatthias Ringwald 4663deb3ec6SMatthias Ringwald /* 4673deb3ec6SMatthias Ringwald * @brief Read multiple characteristic values 4686da84376SMilanka Ringwald * @param callback 4696da84376SMilanka Ringwald * @param con_handle 4706da84376SMilanka Ringwald * @param num_value_handles 4716da84376SMilanka Ringwald * @param value_handles list of handles 4723deb3ec6SMatthias Ringwald */ 473711e6c80SMatthias Ringwald 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); 4743deb3ec6SMatthias Ringwald 4753deb3ec6SMatthias Ringwald /** 4763deb3ec6SMatthias Ringwald * @brief Writes the characteristic value using the characteristic's value handle without an acknowledgment that the write was successfully performed. 4776da84376SMilanka Ringwald * @param con_handle 4786da84376SMilanka Ringwald * @param characteristic_value_handle 4796da84376SMilanka Ringwald * @param length of data 4806da84376SMilanka Ringwald * @param data is not copied, make sure memory is accessible until write is done 481692bf1adSMilanka Ringwald * @return status BTSTACK_MEMORY_ALLOC_FAILED, if no GATT client for con_handle is found 482692bf1adSMilanka Ringwald * GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready 483692bf1adSMilanka Ringwald * BTSTACK_ACL_BUFFERS_FULL , if L2CAP cannot send, there are no free ACL slots 484692bf1adSMilanka Ringwald * ERROR_CODE_SUCCESS , if query is successfully registered 4853deb3ec6SMatthias Ringwald */ 486830ec672SMatthias Ringwald 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); 4873deb3ec6SMatthias Ringwald 4883deb3ec6SMatthias Ringwald /** 4893deb3ec6SMatthias Ringwald * @brief Writes the authenticated characteristic value using the characteristic's value handle without an acknowledgment that the write was successfully performed. 4907e656a40SMatthias Ringwald * @note GATT_EVENT_QUERY_COMPLETE is emitted with 0 for success or ATT_ERROR_BONDING_INFORMATION_MISSING if there is no bonding information stored 4916da84376SMilanka Ringwald * @param callback 4926da84376SMilanka Ringwald * @param con_handle 4936da84376SMilanka Ringwald * @param value_handle 4946da84376SMilanka Ringwald * @param message_len 4956da84376SMilanka Ringwald * @param message is not copied, make sure memory is accessible until write is done 496692bf1adSMilanka Ringwald * @return status BTSTACK_MEMORY_ALLOC_FAILED if no GATT client for con_handle is found 497692bf1adSMilanka Ringwald * GATT_CLIENT_IN_WRONG_STATE if GATT client is not ready 498692bf1adSMilanka Ringwald * ERROR_CODE_SUCCESS if query is successfully registered 4993deb3ec6SMatthias Ringwald */ 5006da84376SMilanka Ringwald 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); 5013deb3ec6SMatthias Ringwald 5023deb3ec6SMatthias Ringwald /** 503b7e5512fSMilanka Ringwald * @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). 5046da84376SMilanka Ringwald * @param callback 5056da84376SMilanka Ringwald * @param con_handle 5066da84376SMilanka Ringwald * @param characteristic_value_handle 5076da84376SMilanka Ringwald * @param length of data 5086da84376SMilanka Ringwald * @param data is not copied, make sure memory is accessible until write is done, i.e. GATT_EVENT_QUERY_COMPLETE is received 509692bf1adSMilanka Ringwald * @return status BTSTACK_MEMORY_ALLOC_FAILED if no GATT client for con_handle is found 510692bf1adSMilanka Ringwald * GATT_CLIENT_IN_WRONG_STATE if GATT client is not ready 511692bf1adSMilanka Ringwald * ERROR_CODE_SUCCESS if query is successfully registered 5123deb3ec6SMatthias Ringwald */ 513711e6c80SMatthias Ringwald 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); 5146da84376SMilanka Ringwald 5156da84376SMilanka Ringwald /** 516b7e5512fSMilanka Ringwald * @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). 5176da84376SMilanka Ringwald * @param callback 5186da84376SMilanka Ringwald * @param con_handle 5196da84376SMilanka Ringwald * @param characteristic_value_handle 5206da84376SMilanka Ringwald * @param length of data 5216da84376SMilanka Ringwald * @param data is not copied, make sure memory is accessible until write is done, i.e. GATT_EVENT_QUERY_COMPLETE is received 522692bf1adSMilanka Ringwald * @return status BTSTACK_MEMORY_ALLOC_FAILED if no GATT client for con_handle is found 523692bf1adSMilanka Ringwald * GATT_CLIENT_IN_WRONG_STATE if GATT client is not ready 524692bf1adSMilanka Ringwald * ERROR_CODE_SUCCESS if query is successfully registered 5256da84376SMilanka Ringwald */ 526711e6c80SMatthias Ringwald 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); 5276da84376SMilanka Ringwald 5286da84376SMilanka Ringwald /** 529b7e5512fSMilanka Ringwald * @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). 5306da84376SMilanka Ringwald * @param callback 5316da84376SMilanka Ringwald * @param con_handle 5326da84376SMilanka Ringwald * @param characteristic_value_handle 5336da84376SMilanka Ringwald * @param offset of value 5346da84376SMilanka Ringwald * @param length of data 5356da84376SMilanka Ringwald * @param data is not copied, make sure memory is accessible until write is done, i.e. GATT_EVENT_QUERY_COMPLETE is received 536692bf1adSMilanka Ringwald * @return status BTSTACK_MEMORY_ALLOC_FAILED if no GATT client for con_handle is found 537692bf1adSMilanka Ringwald * GATT_CLIENT_IN_WRONG_STATE if GATT client is not ready 538692bf1adSMilanka Ringwald * ERROR_CODE_SUCCESS if query is successfully registered 5396da84376SMilanka Ringwald */ 540711e6c80SMatthias Ringwald 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); 5413deb3ec6SMatthias Ringwald 5423deb3ec6SMatthias Ringwald /** 543b7e5512fSMilanka Ringwald * @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). 5446da84376SMilanka Ringwald * @param callback 5456da84376SMilanka Ringwald * @param con_handle 5466da84376SMilanka Ringwald * @param characteristic_value_handle 5476da84376SMilanka Ringwald * @param length of data 5486da84376SMilanka Ringwald * @param data is not copied, make sure memory is accessible until write is done, i.e. GATT_EVENT_QUERY_COMPLETE is received 549692bf1adSMilanka Ringwald * @return status BTSTACK_MEMORY_ALLOC_FAILED if no GATT client for con_handle is found 550692bf1adSMilanka Ringwald * GATT_CLIENT_IN_WRONG_STATE if GATT client is not ready 551692bf1adSMilanka Ringwald * ERROR_CODE_SUCCESS if query is successfully registered 5523deb3ec6SMatthias Ringwald */ 553711e6c80SMatthias Ringwald 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); 5543deb3ec6SMatthias Ringwald 5553deb3ec6SMatthias Ringwald /** 5565611a760SMatthias Ringwald * @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. 5576da84376SMilanka Ringwald * @param callback 5586da84376SMilanka Ringwald * @param con_handle 5596da84376SMilanka Ringwald * @param descriptor 560692bf1adSMilanka Ringwald * @return status BTSTACK_MEMORY_ALLOC_FAILED if no GATT client for con_handle is found 561692bf1adSMilanka Ringwald * GATT_CLIENT_IN_WRONG_STATE if GATT client is not ready 562692bf1adSMilanka Ringwald * ERROR_CODE_SUCCESS if query is successfully registered 5633deb3ec6SMatthias Ringwald */ 564711e6c80SMatthias Ringwald uint8_t gatt_client_read_characteristic_descriptor(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_characteristic_descriptor_t * descriptor); 5656da84376SMilanka Ringwald 5666da84376SMilanka Ringwald /** 5676da84376SMilanka Ringwald * @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. 5686da84376SMilanka Ringwald * @param callback 5696da84376SMilanka Ringwald * @param con_handle 5706da84376SMilanka Ringwald * @param descriptor 571692bf1adSMilanka Ringwald * @return status BTSTACK_MEMORY_ALLOC_FAILED if no GATT client for con_handle is found 572692bf1adSMilanka Ringwald * GATT_CLIENT_IN_WRONG_STATE if GATT client is not ready 573692bf1adSMilanka Ringwald * ERROR_CODE_SUCCESS if query is successfully registered 5746da84376SMilanka Ringwald */ 575711e6c80SMatthias Ringwald 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); 5763deb3ec6SMatthias Ringwald 5773deb3ec6SMatthias Ringwald /** 5785611a760SMatthias Ringwald * @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. 5796da84376SMilanka Ringwald * @param callback 5806da84376SMilanka Ringwald * @param con_handle 5816da84376SMilanka Ringwald * @param descriptor_handle 582692bf1adSMilanka Ringwald * @return status BTSTACK_MEMORY_ALLOC_FAILED if no GATT client for con_handle is found 583692bf1adSMilanka Ringwald * GATT_CLIENT_IN_WRONG_STATE if GATT client is not ready 584692bf1adSMilanka Ringwald * ERROR_CODE_SUCCESS if query is successfully registered 5853deb3ec6SMatthias Ringwald */ 586711e6c80SMatthias Ringwald 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); 5876da84376SMilanka Ringwald 5886da84376SMilanka Ringwald /** 5896da84376SMilanka Ringwald * @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. 5906da84376SMilanka Ringwald * @param callback 5916da84376SMilanka Ringwald * @param con_handle 5926da84376SMilanka Ringwald * @param descriptor_handle 593692bf1adSMilanka Ringwald * @return status BTSTACK_MEMORY_ALLOC_FAILED if no GATT client for con_handle is found 594692bf1adSMilanka Ringwald * GATT_CLIENT_IN_WRONG_STATE if GATT client is not ready 595692bf1adSMilanka Ringwald * ERROR_CODE_SUCCESS if query is successfully registered 5966da84376SMilanka Ringwald */ 597711e6c80SMatthias Ringwald 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); 5986da84376SMilanka Ringwald 5996da84376SMilanka Ringwald /** 6006da84376SMilanka Ringwald * @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. 6016da84376SMilanka Ringwald * @param callback 6026da84376SMilanka Ringwald * @param con_handle 6036da84376SMilanka Ringwald * @param descriptor_handle 6046da84376SMilanka Ringwald * @param offset 605692bf1adSMilanka Ringwald * @return status BTSTACK_MEMORY_ALLOC_FAILED if no GATT client for con_handle is found 606692bf1adSMilanka Ringwald * GATT_CLIENT_IN_WRONG_STATE if GATT client is not ready 607692bf1adSMilanka Ringwald * ERROR_CODE_SUCCESS if query is successfully registered 6086da84376SMilanka Ringwald */ 609711e6c80SMatthias Ringwald 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); 6103deb3ec6SMatthias Ringwald 6113deb3ec6SMatthias Ringwald /** 612b7e5512fSMilanka Ringwald * @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). 6136da84376SMilanka Ringwald * @param callback 6146da84376SMilanka Ringwald * @param con_handle 6156da84376SMilanka Ringwald * @param descriptor 6166da84376SMilanka Ringwald * @param length of data 6176da84376SMilanka Ringwald * @param data is not copied, make sure memory is accessible until write is done, i.e. GATT_EVENT_QUERY_COMPLETE is received 618692bf1adSMilanka Ringwald * @return status BTSTACK_MEMORY_ALLOC_FAILED if no GATT client for con_handle is found 619692bf1adSMilanka Ringwald * GATT_CLIENT_IN_WRONG_STATE if GATT client is not ready 620692bf1adSMilanka Ringwald * ERROR_CODE_SUCCESS if query is successfully registered 6213deb3ec6SMatthias Ringwald */ 622711e6c80SMatthias Ringwald 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); 6236da84376SMilanka Ringwald 6246da84376SMilanka Ringwald /** 625b7e5512fSMilanka Ringwald * @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). 6266da84376SMilanka Ringwald * @param callback 6276da84376SMilanka Ringwald * @param con_handle 6286da84376SMilanka Ringwald * @param descriptor_handle 6296da84376SMilanka Ringwald * @param length of data 6306da84376SMilanka Ringwald * @param data is not copied, make sure memory is accessible until write is done, i.e. GATT_EVENT_QUERY_COMPLETE is received 631692bf1adSMilanka Ringwald * @return status BTSTACK_MEMORY_ALLOC_FAILED if no GATT client for con_handle is found 632692bf1adSMilanka Ringwald * GATT_CLIENT_IN_WRONG_STATE if GATT client is not ready 633692bf1adSMilanka Ringwald * ERROR_CODE_SUCCESS if query is successfully registered 6346da84376SMilanka Ringwald */ 635711e6c80SMatthias Ringwald 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); 6366da84376SMilanka Ringwald 6376da84376SMilanka Ringwald /** 638b7e5512fSMilanka Ringwald * @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). 6396da84376SMilanka Ringwald * @param callback 6406da84376SMilanka Ringwald * @param con_handle 6416da84376SMilanka Ringwald * @param descriptor 6426da84376SMilanka Ringwald * @param length of data 6436da84376SMilanka Ringwald * @param data is not copied, make sure memory is accessible until write is done, i.e. GATT_EVENT_QUERY_COMPLETE is received 644692bf1adSMilanka Ringwald * @return status BTSTACK_MEMORY_ALLOC_FAILED if no GATT client for con_handle is found 645692bf1adSMilanka Ringwald * GATT_CLIENT_IN_WRONG_STATE if GATT client is not ready 646692bf1adSMilanka Ringwald * ERROR_CODE_SUCCESS if query is successfully registered 6476da84376SMilanka Ringwald */ 648711e6c80SMatthias Ringwald 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); 6496da84376SMilanka Ringwald 6506da84376SMilanka Ringwald /** 651b7e5512fSMilanka Ringwald * @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). 6526da84376SMilanka Ringwald * @param callback 6536da84376SMilanka Ringwald * @param con_handle 6546da84376SMilanka Ringwald * @param descriptor_handle 6556da84376SMilanka Ringwald * @param length of data 6566da84376SMilanka Ringwald * @param data is not copied, make sure memory is accessible until write is done, i.e. GATT_EVENT_QUERY_COMPLETE is received 657692bf1adSMilanka Ringwald * @return status BTSTACK_MEMORY_ALLOC_FAILED if no GATT client for con_handle is found 658692bf1adSMilanka Ringwald * GATT_CLIENT_IN_WRONG_STATE if GATT client is not ready 659692bf1adSMilanka Ringwald * ERROR_CODE_SUCCESS if query is successfully registered 6606da84376SMilanka Ringwald */ 661711e6c80SMatthias Ringwald 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); 6626da84376SMilanka Ringwald 6636da84376SMilanka Ringwald /** 664b7e5512fSMilanka Ringwald * @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). 6656da84376SMilanka Ringwald * @param callback 6666da84376SMilanka Ringwald * @param con_handle 6676da84376SMilanka Ringwald * @param descriptor_handle 6686da84376SMilanka Ringwald * @param offset of value 6696da84376SMilanka Ringwald * @param length of data 6706da84376SMilanka Ringwald * @param data is not copied, make sure memory is accessible until write is done, i.e. GATT_EVENT_QUERY_COMPLETE is received 671692bf1adSMilanka Ringwald * @return status BTSTACK_MEMORY_ALLOC_FAILED if no GATT client for con_handle is found 672692bf1adSMilanka Ringwald * GATT_CLIENT_IN_WRONG_STATE if GATT client is not ready 673692bf1adSMilanka Ringwald * ERROR_CODE_SUCCESS if query is successfully registered 6746da84376SMilanka Ringwald */ 675711e6c80SMatthias Ringwald 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); 6763deb3ec6SMatthias Ringwald 6773deb3ec6SMatthias Ringwald /** 678b7e5512fSMilanka Ringwald * @brief Writes the client characteristic configuration of the specified characteristic. It is used to subscribe for notifications or indications of the characteristic value. 679b7e5512fSMilanka Ringwald * For notifications or indications specify: GATT_CLIENT_CHARACTERISTICS_CONFIGURATION_NOTIFICATION resp. GATT_CLIENT_CHARACTERISTICS_CONFIGURATION_INDICATION as configuration value. 680b7e5512fSMilanka Ringwald * 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 681b7e5512fSMilanka Ringwald * (see bluetooth.h for ATT_ERROR codes). 6826da84376SMilanka Ringwald * @param callback 6836da84376SMilanka Ringwald * @param con_handle 6846da84376SMilanka Ringwald * @param characteristic 685b7e5512fSMilanka Ringwald * @param configuration GATT_CLIENT_CHARACTERISTICS_CONFIGURATION_NOTIFICATION, GATT_CLIENT_CHARACTERISTICS_CONFIGURATION_INDICATION 686b7e5512fSMilanka Ringwald * @return status BTSTACK_MEMORY_ALLOC_FAILED if no GATT client for con_handle is found 687692bf1adSMilanka Ringwald * GATT_CLIENT_IN_WRONG_STATE if GATT client is not ready 688b7e5512fSMilanka Ringwald * GATT_CLIENT_CHARACTERISTIC_NOTIFICATION_NOT_SUPPORTED if configuring notification, but characteristic has no notification property set 689b7e5512fSMilanka Ringwald * GATT_CLIENT_CHARACTERISTIC_INDICATION_NOT_SUPPORTED if configuring indication, but characteristic has no indication property set 6906b04f675SMilanka Ringwald * ERROR_CODE_UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE if configuration is invalid 691b7e5512fSMilanka Ringwald * ERROR_CODE_SUCCESS if query is successfully registered 6923deb3ec6SMatthias Ringwald */ 693711e6c80SMatthias Ringwald 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); 6949c662c9bSMatthias Ringwald 6959c662c9bSMatthias Ringwald /** 6969c662c9bSMatthias Ringwald * @brief Register for notifications and indications of a characteristic enabled by gatt_client_write_client_characteristic_configuration 6979c662c9bSMatthias Ringwald * @param notification struct used to store registration 6986da84376SMilanka Ringwald * @param callback 699b3f03c84SMatthias Ringwald * @param con_handle or GATT_CLIENT_ANY_CONNECTION to receive updates from all connected devices 700b3f03c84SMatthias Ringwald * @param characteristic or NULL to receive updates for all characteristics 7019c662c9bSMatthias Ringwald */ 7026da84376SMilanka Ringwald 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); 7033deb3ec6SMatthias Ringwald 7043deb3ec6SMatthias Ringwald /** 7051f734b5fSMatthias Ringwald * @brief Stop listening to characteristic value updates registered with gatt_client_listen_for_characteristic_value_updates 7061f734b5fSMatthias Ringwald * @param notification struct used in gatt_client_listen_for_characteristic_value_updates 7071f734b5fSMatthias Ringwald */ 7081f734b5fSMatthias Ringwald void gatt_client_stop_listening_for_characteristic_value_updates(gatt_client_notification_t * notification); 7091f734b5fSMatthias Ringwald 7101f734b5fSMatthias Ringwald /** 71147181045SMatthias Ringwald * @brief Requests GATT_EVENT_CAN_WRITE_WITHOUT_RESPONSE that guarantees a single successful gatt_client_write_value_of_characteristic_without_response 7126da84376SMilanka Ringwald * @param callback 71347181045SMatthias Ringwald * @param con_handle 71447181045SMatthias Ringwald * @returns status 71547181045SMatthias Ringwald */ 71647181045SMatthias Ringwald uint8_t gatt_client_request_can_write_without_response_event(btstack_packet_handler_t callback, hci_con_handle_t con_handle); 71747181045SMatthias Ringwald 71847181045SMatthias Ringwald /** 7196da84376SMilanka Ringwald * @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. 7206da84376SMilanka Ringwald * @param callback 7216da84376SMilanka Ringwald * @param con_handle 7226da84376SMilanka Ringwald * @param attribute_handle 7236da84376SMilanka Ringwald * @param offset of value 7246da84376SMilanka Ringwald * @param length of data 7256da84376SMilanka Ringwald * @param data is not copied, make sure memory is accessible until write is done, i.e. GATT_EVENT_QUERY_COMPLETE is received 7263deb3ec6SMatthias Ringwald */ 727711e6c80SMatthias Ringwald 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); 7283deb3ec6SMatthias Ringwald 7293deb3ec6SMatthias Ringwald /** 7306da84376SMilanka Ringwald * @brief Commit transactional write. GATT_EVENT_QUERY_COMPLETE is received. 7316da84376SMilanka Ringwald * @param callback 7326da84376SMilanka Ringwald * @param con_handle 7333deb3ec6SMatthias Ringwald */ 734711e6c80SMatthias Ringwald uint8_t gatt_client_execute_write(btstack_packet_handler_t callback, hci_con_handle_t con_handle); 7353deb3ec6SMatthias Ringwald 7363deb3ec6SMatthias Ringwald /** 7376da84376SMilanka Ringwald * @brief Abort transactional write. GATT_EVENT_QUERY_COMPLETE is received. 7386da84376SMilanka Ringwald * @param callback 7396da84376SMilanka Ringwald * @param con_handle 7403deb3ec6SMatthias Ringwald */ 741711e6c80SMatthias Ringwald uint8_t gatt_client_cancel_write(btstack_packet_handler_t callback, hci_con_handle_t con_handle); 7423deb3ec6SMatthias Ringwald 7433deb3ec6SMatthias Ringwald /* API_END */ 7443deb3ec6SMatthias Ringwald 7456ba2ad22SMatthias Ringwald // used by generated btstack_event.c 7466ba2ad22SMatthias Ringwald 747313e337bSMatthias Ringwald void gatt_client_deserialize_service(const uint8_t *packet, int offset, gatt_client_service_t *service); 748313e337bSMatthias Ringwald void gatt_client_deserialize_characteristic(const uint8_t * packet, int offset, gatt_client_characteristic_t * characteristic); 749313e337bSMatthias Ringwald void gatt_client_deserialize_characteristic_descriptor(const uint8_t * packet, int offset, gatt_client_characteristic_descriptor_t * descriptor); 7506ba2ad22SMatthias Ringwald 751a6121b51SMilanka Ringwald #ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION 752a6121b51SMilanka Ringwald void gatt_client_att_packet_handler_fuzz(uint8_t packet_type, uint16_t handle, uint8_t *packet, uint16_t size); 753a6121b51SMilanka Ringwald #endif 754a6121b51SMilanka Ringwald 7553deb3ec6SMatthias Ringwald #if defined __cplusplus 7563deb3ec6SMatthias Ringwald } 7573deb3ec6SMatthias Ringwald #endif 7583deb3ec6SMatthias Ringwald 7593deb3ec6SMatthias Ringwald #endif 760