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 /** 403deb3ec6SMatthias Ringwald * Dispatcher for independent implementation of ATT client and server 413deb3ec6SMatthias Ringwald */ 423deb3ec6SMatthias Ringwald 43*80e33422SMatthias Ringwald #ifndef ATT_DISPATCH_H 44*80e33422SMatthias Ringwald #define ATT_DISPATCH_H 453deb3ec6SMatthias Ringwald 46eb886013SMatthias Ringwald #include "btstack_util.h" 473deb3ec6SMatthias Ringwald 483deb3ec6SMatthias Ringwald #if defined __cplusplus 493deb3ec6SMatthias Ringwald extern "C" { 503deb3ec6SMatthias Ringwald #endif 513deb3ec6SMatthias Ringwald 523deb3ec6SMatthias Ringwald /** 533deb3ec6SMatthias Ringwald * @brief reset att dispatchter 543deb3ec6SMatthias Ringwald * @param packet_hander for ATT client packets 553deb3ec6SMatthias Ringwald */ 563deb3ec6SMatthias Ringwald void att_dispatch_register_client(btstack_packet_handler_t packet_handler); 573deb3ec6SMatthias Ringwald 583deb3ec6SMatthias Ringwald /** 593deb3ec6SMatthias Ringwald * @brief reset att dispatchter 603deb3ec6SMatthias Ringwald * @param packet_hander for ATT server packets 613deb3ec6SMatthias Ringwald */ 623deb3ec6SMatthias Ringwald void att_dispatch_register_server(btstack_packet_handler_t packet_handler); 633deb3ec6SMatthias Ringwald 6419448c0bSMatthias Ringwald /** 6519448c0bSMatthias Ringwald * @brief can send packet for client 66fc64f94aSMatthias Ringwald * @param con_handle 6719448c0bSMatthias Ringwald */ 68fc64f94aSMatthias Ringwald int att_dispatch_client_can_send_now(hci_con_handle_t con_handle); 6919448c0bSMatthias Ringwald 7019448c0bSMatthias Ringwald /** 7119448c0bSMatthias Ringwald * @brief can send packet for server 72fc64f94aSMatthias Ringwald * @param con_handle 7319448c0bSMatthias Ringwald */ 74fc64f94aSMatthias Ringwald int att_dispatch_server_can_send_now(hci_con_handle_t con_handle); 7519448c0bSMatthias Ringwald 760b9d7e78SMatthias Ringwald /** 770b9d7e78SMatthias Ringwald * @brief Request emission of L2CAP_EVENT_CAN_SEND_NOW as soon as possible for client 780b9d7e78SMatthias Ringwald * @note L2CAP_EVENT_CAN_SEND_NOW might be emitted during call to this function 790b9d7e78SMatthias Ringwald * so packet handler should be ready to handle it 800b9d7e78SMatthias Ringwald * @param con_handle 810b9d7e78SMatthias Ringwald */ 820b9d7e78SMatthias Ringwald void att_dispatch_client_request_can_send_now_event(hci_con_handle_t con_handle); 830b9d7e78SMatthias Ringwald 840b9d7e78SMatthias Ringwald /** 850b9d7e78SMatthias Ringwald * @brief Request emission of L2CAP_EVENT_CAN_SEND_NOW as soon as possible for server 860b9d7e78SMatthias Ringwald * @note L2CAP_EVENT_CAN_SEND_NOW might be emitted during call to this function 870b9d7e78SMatthias Ringwald * so packet handler should be ready to handle it 880b9d7e78SMatthias Ringwald * @param con_handle 890b9d7e78SMatthias Ringwald */ 900b9d7e78SMatthias Ringwald void att_dispatch_server_request_can_send_now_event(hci_con_handle_t con_handle); 9119448c0bSMatthias Ringwald 92b12646c5SJakob Krantz /** 93b12646c5SJakob Krantz * @brief Used for propogating a updated MTU from att_server to gatt_client 94b12646c5SJakob Krantz * @param con_handle 95b12646c5SJakob Krantz * @param mtu 96b12646c5SJakob Krantz */ 97b12646c5SJakob Krantz void att_dispatch_server_mtu_exchanged(hci_con_handle_t con_handle, uint16_t new_mtu); 98b12646c5SJakob Krantz 99b12646c5SJakob Krantz /** 100b12646c5SJakob Krantz * @brief Used for propogating a updated MTU from gatt_client to att_server 101b12646c5SJakob Krantz * @param con_handle 102b12646c5SJakob Krantz * @param mtu 103b12646c5SJakob Krantz */ 104b12646c5SJakob Krantz void att_dispatch_client_mtu_exchanged(hci_con_handle_t con_handle, uint16_t new_mtu); 105b12646c5SJakob Krantz 1063deb3ec6SMatthias Ringwald #if defined __cplusplus 1073deb3ec6SMatthias Ringwald } 1083deb3ec6SMatthias Ringwald #endif 1093deb3ec6SMatthias Ringwald 110*80e33422SMatthias Ringwald #endif // ATT_DISPATCH_H 111