1*77ba3d3fSMatthias Ringwald /* 2*77ba3d3fSMatthias Ringwald * Copyright (C) 2017 BlueKitchen GmbH 3*77ba3d3fSMatthias Ringwald * 4*77ba3d3fSMatthias Ringwald * Redistribution and use in source and binary forms, with or without 5*77ba3d3fSMatthias Ringwald * modification, are permitted provided that the following conditions 6*77ba3d3fSMatthias Ringwald * are met: 7*77ba3d3fSMatthias Ringwald * 8*77ba3d3fSMatthias Ringwald * 1. Redistributions of source code must retain the above copyright 9*77ba3d3fSMatthias Ringwald * notice, this list of conditions and the following disclaimer. 10*77ba3d3fSMatthias Ringwald * 2. Redistributions in binary form must reproduce the above copyright 11*77ba3d3fSMatthias Ringwald * notice, this list of conditions and the following disclaimer in the 12*77ba3d3fSMatthias Ringwald * documentation and/or other materials provided with the distribution. 13*77ba3d3fSMatthias Ringwald * 3. Neither the name of the copyright holders nor the names of 14*77ba3d3fSMatthias Ringwald * contributors may be used to endorse or promote products derived 15*77ba3d3fSMatthias Ringwald * from this software without specific prior written permission. 16*77ba3d3fSMatthias Ringwald * 4. Any redistribution, use, or modification is done solely for 17*77ba3d3fSMatthias Ringwald * personal benefit and not for any commercial purpose or for 18*77ba3d3fSMatthias Ringwald * monetary gain. 19*77ba3d3fSMatthias Ringwald * 20*77ba3d3fSMatthias Ringwald * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS 21*77ba3d3fSMatthias Ringwald * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22*77ba3d3fSMatthias Ringwald * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23*77ba3d3fSMatthias Ringwald * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS 24*77ba3d3fSMatthias Ringwald * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25*77ba3d3fSMatthias Ringwald * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 26*77ba3d3fSMatthias Ringwald * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 27*77ba3d3fSMatthias Ringwald * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 28*77ba3d3fSMatthias Ringwald * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 29*77ba3d3fSMatthias Ringwald * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 30*77ba3d3fSMatthias Ringwald * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31*77ba3d3fSMatthias Ringwald * SUCH DAMAGE. 32*77ba3d3fSMatthias Ringwald * 33*77ba3d3fSMatthias Ringwald * Please inquire about commercial licensing options at 34*77ba3d3fSMatthias Ringwald * [email protected] 35*77ba3d3fSMatthias Ringwald * 36*77ba3d3fSMatthias Ringwald */ 37*77ba3d3fSMatthias Ringwald 38*77ba3d3fSMatthias Ringwald 39*77ba3d3fSMatthias Ringwald #ifndef __PB_GATT_H 40*77ba3d3fSMatthias Ringwald #define __PB_GATT_H 41*77ba3d3fSMatthias Ringwald 42*77ba3d3fSMatthias Ringwald #include <stdint.h> 43*77ba3d3fSMatthias Ringwald #include "btstack_defines.h" 44*77ba3d3fSMatthias Ringwald #include "btstack_config.h" 45*77ba3d3fSMatthias Ringwald #include "hci.h" 46*77ba3d3fSMatthias Ringwald 47*77ba3d3fSMatthias Ringwald #if defined __cplusplus 48*77ba3d3fSMatthias Ringwald extern "C" { 49*77ba3d3fSMatthias Ringwald #endif 50*77ba3d3fSMatthias Ringwald 51*77ba3d3fSMatthias Ringwald /** 52*77ba3d3fSMatthias Ringwald * Setup mesh provisioning service 53*77ba3d3fSMatthias Ringwald * @param device_uuid 54*77ba3d3fSMatthias Ringwald */ 55*77ba3d3fSMatthias Ringwald void pb_gatt_init(const uint8_t * device_uuid); 56*77ba3d3fSMatthias Ringwald 57*77ba3d3fSMatthias Ringwald /** 58*77ba3d3fSMatthias Ringwald * Register listener for Provisioning PDUs and events: MESH_PB_TRANSPORT_LINK_OPEN, MESH_PB_TRANSPORT_LINK_CLOSED, MESH_SUBEVENT_CAN_SEND_NOW 59*77ba3d3fSMatthias Ringwald * @param packet_handler 60*77ba3d3fSMatthias Ringwald */ 61*77ba3d3fSMatthias Ringwald void pb_gatt_register_packet_handler(btstack_packet_handler_t packet_handler); 62*77ba3d3fSMatthias Ringwald 63*77ba3d3fSMatthias Ringwald /** 64*77ba3d3fSMatthias Ringwald * Send PDU 65*77ba3d3fSMatthias Ringwald * @param con_handle 66*77ba3d3fSMatthias Ringwald * @param pdu 67*77ba3d3fSMatthias Ringwald * @param pdu_size 68*77ba3d3fSMatthias Ringwald */ 69*77ba3d3fSMatthias Ringwald void pb_gatt_send_pdu(uint16_t con_handle, const uint8_t * pdu, uint16_t pdu_size); 70*77ba3d3fSMatthias Ringwald 71*77ba3d3fSMatthias Ringwald /** 72*77ba3d3fSMatthias Ringwald * Setup Link with unprovisioned device 73*77ba3d3fSMatthias Ringwald * @param device_uuid 74*77ba3d3fSMatthias Ringwald * @return con_handle or HCI_CON_HANDLE_INVALID 75*77ba3d3fSMatthias Ringwald */ 76*77ba3d3fSMatthias Ringwald hci_con_handle_t pb_gatt_create_link(const uint8_t * device_uuid); 77*77ba3d3fSMatthias Ringwald 78*77ba3d3fSMatthias Ringwald /** 79*77ba3d3fSMatthias Ringwald * Close Link 80*77ba3d3fSMatthias Ringwald * @param con_handle 81*77ba3d3fSMatthias Ringwald * @param reason 0 = success, 1 = timeout, 2 = fail 82*77ba3d3fSMatthias Ringwald */ 83*77ba3d3fSMatthias Ringwald void pb_gatt_close_link(hci_con_handle_t con_handle, uint8_t reason); 84*77ba3d3fSMatthias Ringwald 85*77ba3d3fSMatthias Ringwald 86*77ba3d3fSMatthias Ringwald #if defined __cplusplus 87*77ba3d3fSMatthias Ringwald } 88*77ba3d3fSMatthias Ringwald #endif 89*77ba3d3fSMatthias Ringwald 90*77ba3d3fSMatthias Ringwald #endif // __PB_GATT_H 91