1f1b34e8dSMatthias Ringwald /* 2f1b34e8dSMatthias Ringwald * Copyright (C) 2014 BlueKitchen GmbH 3f1b34e8dSMatthias Ringwald * 4f1b34e8dSMatthias Ringwald * Redistribution and use in source and binary forms, with or without 5f1b34e8dSMatthias Ringwald * modification, are permitted provided that the following conditions 6f1b34e8dSMatthias Ringwald * are met: 7f1b34e8dSMatthias Ringwald * 8f1b34e8dSMatthias Ringwald * 1. Redistributions of source code must retain the above copyright 9f1b34e8dSMatthias Ringwald * notice, this list of conditions and the following disclaimer. 10f1b34e8dSMatthias Ringwald * 2. Redistributions in binary form must reproduce the above copyright 11f1b34e8dSMatthias Ringwald * notice, this list of conditions and the following disclaimer in the 12f1b34e8dSMatthias Ringwald * documentation and/or other materials provided with the distribution. 13f1b34e8dSMatthias Ringwald * 3. Neither the name of the copyright holders nor the names of 14f1b34e8dSMatthias Ringwald * contributors may be used to endorse or promote products derived 15f1b34e8dSMatthias Ringwald * from this software without specific prior written permission. 16f1b34e8dSMatthias Ringwald * 4. Any redistribution, use, or modification is done solely for 17f1b34e8dSMatthias Ringwald * personal benefit and not for any commercial purpose or for 18f1b34e8dSMatthias Ringwald * monetary gain. 19f1b34e8dSMatthias Ringwald * 20f1b34e8dSMatthias Ringwald * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS 21f1b34e8dSMatthias Ringwald * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22f1b34e8dSMatthias Ringwald * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 232fca4dadSMilanka Ringwald * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BLUEKITCHEN 242fca4dadSMilanka Ringwald * GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25f1b34e8dSMatthias Ringwald * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 26f1b34e8dSMatthias Ringwald * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 27f1b34e8dSMatthias Ringwald * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 28f1b34e8dSMatthias Ringwald * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 29f1b34e8dSMatthias Ringwald * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 30f1b34e8dSMatthias Ringwald * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31f1b34e8dSMatthias Ringwald * SUCH DAMAGE. 32f1b34e8dSMatthias Ringwald * 33f1b34e8dSMatthias Ringwald * Please inquire about commercial licensing options at 34f1b34e8dSMatthias Ringwald * [email protected] 35f1b34e8dSMatthias Ringwald * 36f1b34e8dSMatthias Ringwald */ 37f1b34e8dSMatthias Ringwald 38fe5a6c4eSMilanka Ringwald /** 39fe5a6c4eSMilanka Ringwald * @title GOEP Client 40fe5a6c4eSMilanka Ringwald * 41fe5a6c4eSMilanka Ringwald * Communicate with remote OBEX server - General Object Exchange 42fe5a6c4eSMilanka Ringwald * 43fe5a6c4eSMilanka Ringwald */ 44fe5a6c4eSMilanka Ringwald 4580e33422SMatthias Ringwald #ifndef GOEP_CLIENT_H 4680e33422SMatthias Ringwald #define GOEP_CLIENT_H 47f1b34e8dSMatthias Ringwald 48f1b34e8dSMatthias Ringwald #if defined __cplusplus 49f1b34e8dSMatthias Ringwald extern "C" { 50f1b34e8dSMatthias Ringwald #endif 51f1b34e8dSMatthias Ringwald 52f1b34e8dSMatthias Ringwald #include <stdlib.h> 53f1b34e8dSMatthias Ringwald #include <string.h> 54f1b34e8dSMatthias Ringwald 55f1b34e8dSMatthias Ringwald #include "btstack_defines.h" 5675b57e54SMatthias Ringwald #include "l2cap.h" 57f1b34e8dSMatthias Ringwald 58bc209ef1SMatthias Ringwald typedef enum { 59bc209ef1SMatthias Ringwald GOEP_CLIENT_INIT, 60bc209ef1SMatthias Ringwald GOEP_CLIENT_W4_SDP, 61bc209ef1SMatthias Ringwald GOEP_CLIENT_CONNECTED, 62bc209ef1SMatthias Ringwald } goep_client_state_t; 63bc209ef1SMatthias Ringwald 64f1b34e8dSMatthias Ringwald /* API_START */ 65f1b34e8dSMatthias Ringwald 66bc209ef1SMatthias Ringwald typedef struct { 67bc209ef1SMatthias Ringwald btstack_linked_item_t item; 68bc209ef1SMatthias Ringwald 69bc209ef1SMatthias Ringwald uint16_t cid; 70bc209ef1SMatthias Ringwald 71bc209ef1SMatthias Ringwald goep_client_state_t state; 72bc209ef1SMatthias Ringwald bd_addr_t bd_addr; 73bc209ef1SMatthias Ringwald uint16_t uuid; 74bc209ef1SMatthias Ringwald hci_con_handle_t con_handle; 75bc209ef1SMatthias Ringwald uint8_t incoming; 76bc209ef1SMatthias Ringwald 77bc209ef1SMatthias Ringwald btstack_packet_handler_t client_handler; 78bc209ef1SMatthias Ringwald btstack_context_callback_registration_t sdp_query_request; 79bc209ef1SMatthias Ringwald 80bc209ef1SMatthias Ringwald uint8_t rfcomm_port; 81bf300db8SMatthias Ringwald uint16_t l2cap_psm; 82bc209ef1SMatthias Ringwald uint16_t bearer_cid; 83bc209ef1SMatthias Ringwald uint16_t bearer_mtu; 84bc209ef1SMatthias Ringwald 85bc209ef1SMatthias Ringwald uint16_t record_index; 86bc209ef1SMatthias Ringwald 87bc209ef1SMatthias Ringwald // cached higher layer information PBAP + MAP 88bc209ef1SMatthias Ringwald uint32_t profile_supported_features; 89bc209ef1SMatthias Ringwald uint8_t map_mas_instance_id; 90bc209ef1SMatthias Ringwald uint8_t map_supported_message_types; 91650271beSMatthias Ringwald uint16_t map_version; 92bc209ef1SMatthias Ringwald 93bc209ef1SMatthias Ringwald // needed to select one of multiple MAS Instances 94bc209ef1SMatthias Ringwald struct { 95bc209ef1SMatthias Ringwald uint32_t supported_features; 96bc209ef1SMatthias Ringwald uint8_t instance_id; 97bc209ef1SMatthias Ringwald uint8_t supported_message_types; 98bc209ef1SMatthias Ringwald uint8_t rfcomm_port; 99650271beSMatthias Ringwald uint16_t version; 10075b57e54SMatthias Ringwald #ifdef ENABLE_GOEP_L2CAP 10175b57e54SMatthias Ringwald uint16_t l2cap_psm; 10275b57e54SMatthias Ringwald #endif 103bc209ef1SMatthias Ringwald } mas_info; 104bc209ef1SMatthias Ringwald 105bc209ef1SMatthias Ringwald uint8_t obex_opcode; 106bc209ef1SMatthias Ringwald uint32_t obex_connection_id; 107bc209ef1SMatthias Ringwald int obex_connection_id_set; 108bc209ef1SMatthias Ringwald 10975b57e54SMatthias Ringwald #ifdef ENABLE_GOEP_L2CAP 11075b57e54SMatthias Ringwald l2cap_ertm_config_t ertm_config; 11175b57e54SMatthias Ringwald uint16_t ertm_buffer_size; 11275b57e54SMatthias Ringwald uint8_t * ertm_buffer; 11375b57e54SMatthias Ringwald #endif 114bc209ef1SMatthias Ringwald } goep_client_t; 115bc209ef1SMatthias Ringwald 116bc209ef1SMatthias Ringwald 1176092cabeSMatthias Ringwald // remote does not expose PBAP features in SDP record 1186092cabeSMatthias Ringwald #define PBAP_FEATURES_NOT_PRESENT ((uint32_t) -1) 1196b795deeSMatthias Ringwald #define MAP_FEATURES_NOT_PRESENT ((uint32_t) -1) 1206b795deeSMatthias Ringwald #define PROFILE_FEATURES_NOT_PRESENT ((uint32_t) -1) 1216092cabeSMatthias Ringwald 122f1b34e8dSMatthias Ringwald /** 123f1b34e8dSMatthias Ringwald * Setup GOEP Client 124f1b34e8dSMatthias Ringwald */ 125f1b34e8dSMatthias Ringwald void goep_client_init(void); 126f1b34e8dSMatthias Ringwald 12775b57e54SMatthias Ringwald /** 12875b57e54SMatthias Ringwald * @brief Connect to a GEOP server with specified UUID on a remote device. 12975b57e54SMatthias Ringwald * @param goep_client 13075b57e54SMatthias Ringwald * @param l2cap_ertm_config 13175b57e54SMatthias Ringwald * @param l2cap_ertm_buffer_size 13275b57e54SMatthias Ringwald * @param l2cap_ertm_buffer 13356210688SMatthias Ringwald * @param handler 13456210688SMatthias Ringwald * @param addr 13556210688SMatthias Ringwald * @param uuid 13656210688SMatthias Ringwald * @param instance_id e.g. used to connect to different MAP Access Servers, default: 0 13775b57e54SMatthias Ringwald * @param out_cid 13875b57e54SMatthias Ringwald * @return 13975b57e54SMatthias Ringwald */ 14056210688SMatthias Ringwald uint8_t 14156210688SMatthias Ringwald goep_client_connect(goep_client_t *goep_client, l2cap_ertm_config_t *l2cap_ertm_config, uint8_t *l2cap_ertm_buffer, 14256210688SMatthias Ringwald uint16_t l2cap_ertm_buffer_size, btstack_packet_handler_t handler, bd_addr_t addr, uint16_t uuid, 14356210688SMatthias Ringwald uint8_t instance_id, uint16_t *out_cid); 14475b57e54SMatthias Ringwald 145ec9ab951SMatthias Ringwald /** 146ec9ab951SMatthias Ringwald * @brief Connect to a GEOP server over L2CAP with specified PSM on a remote device. 147ec9ab951SMatthias Ringwald * @note In contrast to goep_client_connect which searches for a OBEX service with a given UUID, this 148ec9ab951SMatthias Ringwald * function only supports GOEP v2.0 (L2CAP) to a specified L2CAP PSM 149ec9ab951SMatthias Ringwald * @param goep_client 150ec9ab951SMatthias Ringwald * @param l2cap_ertm_config 151ec9ab951SMatthias Ringwald * @param l2cap_ertm_buffer_size 152ec9ab951SMatthias Ringwald * @param l2cap_ertm_buffer 153ec9ab951SMatthias Ringwald * @param handler 154ec9ab951SMatthias Ringwald * @param addr 155ec9ab951SMatthias Ringwald * @param l2cap_psm 156ec9ab951SMatthias Ringwald * @param out_cid 157ec9ab951SMatthias Ringwald * @return 158ec9ab951SMatthias Ringwald */ 159ec9ab951SMatthias Ringwald uint8_t 160ec9ab951SMatthias Ringwald goep_client_connect_l2cap(goep_client_t *goep_client, l2cap_ertm_config_t *l2cap_ertm_config, uint8_t *l2cap_ertm_buffer, 161ec9ab951SMatthias Ringwald uint16_t l2cap_ertm_buffer_size, btstack_packet_handler_t handler, bd_addr_t addr, uint16_t l2cap_psm, 162ec9ab951SMatthias Ringwald uint16_t *out_cid); 163ec9ab951SMatthias Ringwald 164f1b34e8dSMatthias Ringwald /** 165f1b34e8dSMatthias Ringwald * @brief Disconnects GOEP connection with given identifier. 166c4e8cd11SMilanka Ringwald * @param goep_cid 167f1b34e8dSMatthias Ringwald * @return status 168f1b34e8dSMatthias Ringwald */ 169f1b34e8dSMatthias Ringwald uint8_t goep_client_disconnect(uint16_t goep_cid); 170f1b34e8dSMatthias Ringwald 171f1b34e8dSMatthias Ringwald /** 172f1b34e8dSMatthias Ringwald * @brief Request emission of GOEP_SUBEVENT_CAN_SEND_NOW as soon as possible 173f1b34e8dSMatthias Ringwald * @note GOEP_SUBEVENT_CAN_SEND_NOW might be emitted during call to this function 174f1b34e8dSMatthias Ringwald * so packet handler should be ready to handle it 175f1b34e8dSMatthias Ringwald * @param goep_cid 176f1b34e8dSMatthias Ringwald */ 177f1b34e8dSMatthias Ringwald void goep_client_request_can_send_now(uint16_t goep_cid); 178f1b34e8dSMatthias Ringwald 179f1b34e8dSMatthias Ringwald /** 180f1b34e8dSMatthias Ringwald * @brief Get Opcode from last created request, needed for parsing of OBEX response packet 181c4e8cd11SMilanka Ringwald * @param goep_cid 182f1b34e8dSMatthias Ringwald * @return opcode 183f1b34e8dSMatthias Ringwald */ 184f1b34e8dSMatthias Ringwald uint8_t goep_client_get_request_opcode(uint16_t goep_cid); 185f1b34e8dSMatthias Ringwald 186f1b34e8dSMatthias Ringwald /** 1873ffc2a09SMatthias Ringwald * @brief Get PBAP Supported Features found in SDP record during connect 188bca6857aSMatthias Ringwald */ 189bca6857aSMatthias Ringwald uint32_t goep_client_get_pbap_supported_features(uint16_t goep_cid); 1907e760b74SMatthias Ringwald 1917e760b74SMatthias Ringwald /** 1927e760b74SMatthias Ringwald * @brief Get MAP Supported Features found in SDP record during connect 1937e760b74SMatthias Ringwald */ 1947e760b74SMatthias Ringwald uint32_t goep_client_get_map_supported_features(uint16_t goep_cid); 1957e760b74SMatthias Ringwald 1967e760b74SMatthias Ringwald /** 1977e760b74SMatthias Ringwald * @brief Get MAP MAS Instance ID found in SDP record during connect 1987e760b74SMatthias Ringwald */ 1997e760b74SMatthias Ringwald uint8_t goep_client_get_map_mas_instance_id(uint16_t goep_cid); 2007e760b74SMatthias Ringwald 2017e760b74SMatthias Ringwald /** 2027e760b74SMatthias Ringwald * @brief Get MAP MAS Supported Message Types found in SDP record during connect 2037e760b74SMatthias Ringwald */ 204242117a4SMatthias Ringwald uint8_t goep_client_get_map_supported_message_types(uint16_t goep_cid); 205bca6857aSMatthias Ringwald 206bca6857aSMatthias Ringwald /** 2073ffc2a09SMatthias Ringwald * @brief Check if GOEP 2.0 or higher features can be used 2083ffc2a09SMatthias Ringwald * @return true if GOEP Version 2.0 or higher 2093ffc2a09SMatthias Ringwald */ 2103ffc2a09SMatthias Ringwald bool goep_client_version_20_or_higher(uint16_t goep_cid); 2113ffc2a09SMatthias Ringwald 2123ffc2a09SMatthias Ringwald /** 213f1b34e8dSMatthias Ringwald * @brief Set Connection ID used for newly created requests 214c4e8cd11SMilanka Ringwald * @param goep_cid 215f1b34e8dSMatthias Ringwald */ 216f1b34e8dSMatthias Ringwald void goep_client_set_connection_id(uint16_t goep_cid, uint32_t connection_id); 217f1b34e8dSMatthias Ringwald 218f1b34e8dSMatthias Ringwald /** 219f1b34e8dSMatthias Ringwald * @brief Start Connect request 220c4e8cd11SMilanka Ringwald * @param goep_cid 221f1b34e8dSMatthias Ringwald * @param obex_version_number 222f1b34e8dSMatthias Ringwald * @param flags 223f1b34e8dSMatthias Ringwald * @param maximum_obex_packet_length 224f1b34e8dSMatthias Ringwald */ 225c4e8cd11SMilanka Ringwald void goep_client_request_create_connect(uint16_t goep_cid, uint8_t obex_version_number, uint8_t flags, uint16_t maximum_obex_packet_length); 226f1b34e8dSMatthias Ringwald 227f1b34e8dSMatthias Ringwald /** 2280729a915SMatthias Ringwald * @brief Start Disconnect request 229c4e8cd11SMilanka Ringwald * @param goep_cid 2300729a915SMatthias Ringwald */ 231c4e8cd11SMilanka Ringwald void goep_client_request_create_disconnect(uint16_t goep_cid); 2320729a915SMatthias Ringwald 2330729a915SMatthias Ringwald /** 23478280edeSMatthias Ringwald * @brief Create Get request 235c4e8cd11SMilanka Ringwald * @param goep_cid 236f1b34e8dSMatthias Ringwald */ 237c4e8cd11SMilanka Ringwald void goep_client_request_create_get(uint16_t goep_cid); 238f1b34e8dSMatthias Ringwald 239f1b34e8dSMatthias Ringwald /** 240f68f8528SMatthias Ringwald * @brief Create Abort request 241c4e8cd11SMilanka Ringwald * @param goep_cid 242f68f8528SMatthias Ringwald */ 243c4e8cd11SMilanka Ringwald void goep_client_request_create_abort(uint16_t goep_cid); 244f68f8528SMatthias Ringwald 245f68f8528SMatthias Ringwald /** 246f1b34e8dSMatthias Ringwald * @brief Start Set Path request 247c4e8cd11SMilanka Ringwald * @param goep_cid 248f1b34e8dSMatthias Ringwald */ 249c4e8cd11SMilanka Ringwald void goep_client_request_create_set_path(uint16_t goep_cid, uint8_t flags); 250f1b34e8dSMatthias Ringwald 25141807e91SMilanka Ringwald /** 25241807e91SMilanka Ringwald * @brief Create Put request 253c4e8cd11SMilanka Ringwald * @param goep_cid 25441807e91SMilanka Ringwald */ 255c4e8cd11SMilanka Ringwald void goep_client_request_create_put(uint16_t goep_cid); 25641807e91SMilanka Ringwald 25741807e91SMilanka Ringwald /** 258e23a8476SMatthias Ringwald * @brief Get max size of body data that can be added to current response with goep_client_body_add_static 259e23a8476SMatthias Ringwald * @param goep_cid 260e23a8476SMatthias Ringwald * @param data 261e23a8476SMatthias Ringwald * @param length 262e23a8476SMatthias Ringwald * @return size in bytes or 0 263e23a8476SMatthias Ringwald */ 264e23a8476SMatthias Ringwald uint16_t goep_client_request_get_max_body_size(uint16_t goep_cid); 265e23a8476SMatthias Ringwald 266e23a8476SMatthias Ringwald /** 26741807e91SMilanka Ringwald * @brief Add SRM Enable 268c4e8cd11SMilanka Ringwald * @param goep_cid 26941807e91SMilanka Ringwald */ 270c4e8cd11SMilanka Ringwald void goep_client_header_add_srm_enable(uint16_t goep_cid); 271f1b34e8dSMatthias Ringwald 272f1b34e8dSMatthias Ringwald /** 273*51c39f3dSMatthias Ringwald * @brief Add SRMP Waiting 274*51c39f3dSMatthias Ringwald * @param goep_cid 275*51c39f3dSMatthias Ringwald */ 276*51c39f3dSMatthias Ringwald void goep_client_header_add_srmp_waiting(uint16_t goep_cid); 277*51c39f3dSMatthias Ringwald 278*51c39f3dSMatthias Ringwald /** 279c49af926SMatthias Ringwald * @brief Add header with single byte value (8 bit) 280c4e8cd11SMilanka Ringwald * @param goep_cid 281c49af926SMatthias Ringwald * @param header_type 282c49af926SMatthias Ringwald * @param value 283c49af926SMatthias Ringwald */ 284c4e8cd11SMilanka Ringwald void goep_client_header_add_byte(uint16_t goep_cid, uint8_t header_type, uint8_t value); 285c49af926SMatthias Ringwald 286c49af926SMatthias Ringwald /** 287c49af926SMatthias Ringwald * @brief Add header with word value (32 bit) 288c4e8cd11SMilanka Ringwald * @param goep_cid 289c49af926SMatthias Ringwald * @param header_type 290c49af926SMatthias Ringwald * @param value 291c49af926SMatthias Ringwald */ 292c4e8cd11SMilanka Ringwald void goep_client_header_add_word(uint16_t goep_cid, uint8_t header_type, uint32_t value); 293c49af926SMatthias Ringwald 294c49af926SMatthias Ringwald /** 295c49af926SMatthias Ringwald * @brief Add header with variable size 296c4e8cd11SMilanka Ringwald * @param goep_cid 297c49af926SMatthias Ringwald * @param header_type 298c4e8cd11SMilanka Ringwald * @param header_data 299c4e8cd11SMilanka Ringwald * @param header_data_length 300c49af926SMatthias Ringwald */ 301c4e8cd11SMilanka Ringwald void goep_client_header_add_variable(uint16_t goep_cid, uint8_t header_type, const uint8_t * header_data, uint16_t header_data_length); 302c49af926SMatthias Ringwald 303c49af926SMatthias Ringwald /** 304f1b34e8dSMatthias Ringwald * @brief Add name header to current request 305f1b34e8dSMatthias Ringwald * @param goep_cid 306f1b34e8dSMatthias Ringwald * @param name 307f1b34e8dSMatthias Ringwald */ 308c4e8cd11SMilanka Ringwald void goep_client_header_add_name(uint16_t goep_cid, const char * name); 309f1b34e8dSMatthias Ringwald 310f1b34e8dSMatthias Ringwald /** 3115eb33985SMatthias Ringwald * @brief Add name header to current request 3125eb33985SMatthias Ringwald * @param goep_cid 3135eb33985SMatthias Ringwald * @param name 3145eb33985SMatthias Ringwald * @param name_len 3155eb33985SMatthias Ringwald */ 3165eb33985SMatthias Ringwald void goep_client_header_add_name_prefix(uint16_t goep_cid, const char * name, uint16_t name_len); 3175eb33985SMatthias Ringwald 3185eb33985SMatthias Ringwald /** 319fb8282d6SMatthias Ringwald * @brief Add string encoded as unicode to current request 320fb8282d6SMatthias Ringwald * @param goep_cid 321fb8282d6SMatthias Ringwald * @param name 322fb8282d6SMatthias Ringwald * @param name_len 323fb8282d6SMatthias Ringwald */ 324fb8282d6SMatthias Ringwald void goep_client_header_add_unicode_prefix(uint16_t goep_cid, uint8_t header_id, const char * name, uint16_t name_len); 325fb8282d6SMatthias Ringwald 326fb8282d6SMatthias Ringwald /** 327f1b34e8dSMatthias Ringwald * @brief Add target header to current request 328f1b34e8dSMatthias Ringwald * @param goep_cid 329f1b34e8dSMatthias Ringwald * @param target 330c4e8cd11SMilanka Ringwald * @param length of target 331f1b34e8dSMatthias Ringwald */ 332c4e8cd11SMilanka Ringwald void goep_client_header_add_target(uint16_t goep_cid, const uint8_t * target, uint16_t length); 333f1b34e8dSMatthias Ringwald 334f1b34e8dSMatthias Ringwald /** 335f1b34e8dSMatthias Ringwald * @brief Add type header to current request 336f1b34e8dSMatthias Ringwald * @param goep_cid 337f1b34e8dSMatthias Ringwald * @param type 338f1b34e8dSMatthias Ringwald */ 339c4e8cd11SMilanka Ringwald void goep_client_header_add_type(uint16_t goep_cid, const char * type); 340f1b34e8dSMatthias Ringwald 341f1b34e8dSMatthias Ringwald /** 342f1b34e8dSMatthias Ringwald * @brief Add count header to current request 343f1b34e8dSMatthias Ringwald * @param goep_cid 344f1b34e8dSMatthias Ringwald * @param count 345f1b34e8dSMatthias Ringwald */ 346c4e8cd11SMilanka Ringwald void goep_client_header_add_count(uint16_t goep_cid, uint32_t count); 347f1b34e8dSMatthias Ringwald 348f1b34e8dSMatthias Ringwald /** 34949df53afSSimon Budig * @brief Add length header to current request 35049df53afSSimon Budig * @param goep_cid 35149df53afSSimon Budig * @param length 35249df53afSSimon Budig */ 35349df53afSSimon Budig void goep_client_header_add_length(uint16_t goep_cid, uint32_t length); 35449df53afSSimon Budig 35549df53afSSimon Budig /** 356f1b34e8dSMatthias Ringwald * @brief Add application parameters header to current request 357f1b34e8dSMatthias Ringwald * @param goep_cid 358c4e8cd11SMilanka Ringwald * @param data 359f1b34e8dSMatthias Ringwald * @param lenght of application parameters 360f1b34e8dSMatthias Ringwald */ 361c4e8cd11SMilanka Ringwald void goep_client_header_add_application_parameters(uint16_t goep_cid, const uint8_t * data, uint16_t length); 362f1b34e8dSMatthias Ringwald 363c08e2397SMatthias Ringwald /** 364c08e2397SMatthias Ringwald * @brief Add application parameters header to current request 365c08e2397SMatthias Ringwald * @param goep_cid 366c08e2397SMatthias Ringwald * @param data 367c4e8cd11SMilanka Ringwald * @param lenght of challenge response 368c08e2397SMatthias Ringwald */ 369c4e8cd11SMilanka Ringwald void goep_client_header_add_challenge_response(uint16_t goep_cid, const uint8_t * data, uint16_t length); 370c08e2397SMatthias Ringwald 37141807e91SMilanka Ringwald /** 37241807e91SMilanka Ringwald * @brief Add body 37341807e91SMilanka Ringwald * @param goep_cid 37441807e91SMilanka Ringwald * @param data 375c4e8cd11SMilanka Ringwald * @param lenght 37641807e91SMilanka Ringwald */ 377c4e8cd11SMilanka Ringwald void goep_client_body_add_static(uint16_t goep_cid, const uint8_t * data, uint32_t length); 378f1b34e8dSMatthias Ringwald 379f1b34e8dSMatthias Ringwald /** 3808441d53dSMatthias Ringwald * @brief Query remaining buffer size 3818441d53dSMatthias Ringwald * @param goep_cid 3828441d53dSMatthias Ringwald * @return size 3838441d53dSMatthias Ringwald */ 3848441d53dSMatthias Ringwald uint16_t goep_client_body_get_outgoing_buffer_len(uint16_t goep_cid); 3858441d53dSMatthias Ringwald 3868441d53dSMatthias Ringwald /** 38749df53afSSimon Budig * @brief Add body 38849df53afSSimon Budig * @param goep_cid 38949df53afSSimon Budig * @param data 39049df53afSSimon Budig * @param length 39149df53afSSimon Budig * @param ret_length 39249df53afSSimon Budig */ 39349df53afSSimon Budig void goep_client_body_fillup_static(uint16_t goep_cid, const uint8_t * data, uint32_t length, uint32_t * ret_length); 39449df53afSSimon Budig 39549df53afSSimon Budig /** 396f1b34e8dSMatthias Ringwald * @brief Execute prepared request 397f1b34e8dSMatthias Ringwald * @param goep_cid 398f1b34e8dSMatthias Ringwald * @param daa 399f1b34e8dSMatthias Ringwald */ 400f1b34e8dSMatthias Ringwald int goep_client_execute(uint16_t goep_cid); 401f1b34e8dSMatthias Ringwald 402d76b1119SMatthias Ringwald /** 4032c3397f6SSimon Budig * @brief Execute prepared request with final bit 4042c3397f6SSimon Budig * @param goep_cid 4052c3397f6SSimon Budig * @param final 4062c3397f6SSimon Budig */ 4072c3397f6SSimon Budig int goep_client_execute_with_final_bit(uint16_t goep_cid, bool final); 4082c3397f6SSimon Budig 4092c3397f6SSimon Budig /** 410d76b1119SMatthias Ringwald * @brief De-Init GOEP Client 411d76b1119SMatthias Ringwald */ 412d76b1119SMatthias Ringwald void goep_client_deinit(void); 413d76b1119SMatthias Ringwald 414f1b34e8dSMatthias Ringwald /* API_END */ 415f1b34e8dSMatthias Ringwald 416c4e8cd11SMilanka Ringwald // int goep_client_body_add_dynamic(uint16_t goep_cid, uint32_t length, void (*data_callback)(uint32_t offset, uint8_t * buffer, uint32_t len)); 417c4e8cd11SMilanka Ringwald 418f1b34e8dSMatthias Ringwald #if defined __cplusplus 419f1b34e8dSMatthias Ringwald } 420f1b34e8dSMatthias Ringwald #endif 421f1b34e8dSMatthias Ringwald #endif 4226138850cSMatthias Ringwald 423