177ba3d3fSMatthias Ringwald /* 277ba3d3fSMatthias Ringwald * Copyright (C) 2017 BlueKitchen GmbH 377ba3d3fSMatthias Ringwald * 477ba3d3fSMatthias Ringwald * Redistribution and use in source and binary forms, with or without 577ba3d3fSMatthias Ringwald * modification, are permitted provided that the following conditions 677ba3d3fSMatthias Ringwald * are met: 777ba3d3fSMatthias Ringwald * 877ba3d3fSMatthias Ringwald * 1. Redistributions of source code must retain the above copyright 977ba3d3fSMatthias Ringwald * notice, this list of conditions and the following disclaimer. 1077ba3d3fSMatthias Ringwald * 2. Redistributions in binary form must reproduce the above copyright 1177ba3d3fSMatthias Ringwald * notice, this list of conditions and the following disclaimer in the 1277ba3d3fSMatthias Ringwald * documentation and/or other materials provided with the distribution. 1377ba3d3fSMatthias Ringwald * 3. Neither the name of the copyright holders nor the names of 1477ba3d3fSMatthias Ringwald * contributors may be used to endorse or promote products derived 1577ba3d3fSMatthias Ringwald * from this software without specific prior written permission. 1677ba3d3fSMatthias Ringwald * 4. Any redistribution, use, or modification is done solely for 1777ba3d3fSMatthias Ringwald * personal benefit and not for any commercial purpose or for 1877ba3d3fSMatthias Ringwald * monetary gain. 1977ba3d3fSMatthias Ringwald * 2077ba3d3fSMatthias Ringwald * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS 2177ba3d3fSMatthias Ringwald * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 2277ba3d3fSMatthias Ringwald * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23*2fca4dadSMilanka Ringwald * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BLUEKITCHEN 24*2fca4dadSMilanka Ringwald * GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 2577ba3d3fSMatthias Ringwald * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 2677ba3d3fSMatthias Ringwald * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 2777ba3d3fSMatthias Ringwald * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 2877ba3d3fSMatthias Ringwald * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 2977ba3d3fSMatthias Ringwald * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 3077ba3d3fSMatthias Ringwald * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3177ba3d3fSMatthias Ringwald * SUCH DAMAGE. 3277ba3d3fSMatthias Ringwald * 3377ba3d3fSMatthias Ringwald * Please inquire about commercial licensing options at 3477ba3d3fSMatthias Ringwald * [email protected] 3577ba3d3fSMatthias Ringwald * 3677ba3d3fSMatthias Ringwald */ 3777ba3d3fSMatthias Ringwald 3877ba3d3fSMatthias Ringwald 3977ba3d3fSMatthias Ringwald #ifndef __PB_ADV_H 4077ba3d3fSMatthias Ringwald #define __PB_ADV_H 4177ba3d3fSMatthias Ringwald 4277ba3d3fSMatthias Ringwald #include <stdint.h> 43f4854a5eSMatthias Ringwald 4477ba3d3fSMatthias Ringwald #include "btstack_defines.h" 4577ba3d3fSMatthias Ringwald #include "btstack_config.h" 4677ba3d3fSMatthias Ringwald 4777ba3d3fSMatthias Ringwald #if defined __cplusplus 4877ba3d3fSMatthias Ringwald extern "C" { 4977ba3d3fSMatthias Ringwald #endif 5077ba3d3fSMatthias Ringwald 5177ba3d3fSMatthias Ringwald /** 5277ba3d3fSMatthias Ringwald * Initialize Provisioning Bearer using Advertisement Bearer 5377ba3d3fSMatthias Ringwald */ 548936a143SMatthias Ringwald void pb_adv_init(void); 5577ba3d3fSMatthias Ringwald 5677ba3d3fSMatthias Ringwald /** 5794d617e4SMatthias Ringwald * Register provisioning device listener for Provisioning PDUs and MESH_PBV_ADV_SEND_COMPLETE 5877ba3d3fSMatthias Ringwald */ 5994d617e4SMatthias Ringwald void pb_adv_register_device_packet_handler(btstack_packet_handler_t packet_handler); 6094d617e4SMatthias Ringwald 6194d617e4SMatthias Ringwald /** 6294d617e4SMatthias Ringwald * Register provisioning provisioner listener for Provisioning PDUs and MESH_PBV_ADV_SEND_COMPLETE 6394d617e4SMatthias Ringwald */ 6494d617e4SMatthias Ringwald void pb_adv_register_provisioner_packet_handler(btstack_packet_handler_t packet_handler); 6577ba3d3fSMatthias Ringwald 6677ba3d3fSMatthias Ringwald /** 6777ba3d3fSMatthias Ringwald * Send Provisioning PDU 6877ba3d3fSMatthias Ringwald * @param pb_adv_cid 6977ba3d3fSMatthias Ringwald * @param pdu 7077ba3d3fSMatthias Ringwald * @param pb_adv_cid 7177ba3d3fSMatthias Ringwald */ 7277ba3d3fSMatthias Ringwald void pb_adv_send_pdu(uint16_t pb_adv_cid, const uint8_t * pdu, uint16_t pdu_size); 7377ba3d3fSMatthias Ringwald 7477ba3d3fSMatthias Ringwald /** 7577ba3d3fSMatthias Ringwald * Close Link 7677ba3d3fSMatthias Ringwald * @param pb_adv_cid 7777ba3d3fSMatthias Ringwald * @param reason 0 = success, 1 = timeout, 2 = fail 7877ba3d3fSMatthias Ringwald */ 7977ba3d3fSMatthias Ringwald void pb_adv_close_link(uint16_t pb_adv_cid, uint8_t reason); 8077ba3d3fSMatthias Ringwald 8177ba3d3fSMatthias Ringwald #ifdef ENABLE_MESH_PROVISIONER 8277ba3d3fSMatthias Ringwald /** 8377ba3d3fSMatthias Ringwald * Setup Link with unprovisioned device 84e6542936SMatthias Ringwald * @param DeviceUUID - data not copied 856b65794dSMilanka Ringwald * @return pb_adv_cid or 0 8677ba3d3fSMatthias Ringwald */ 8777ba3d3fSMatthias Ringwald uint16_t pb_adv_create_link(const uint8_t * device_uuid); 8877ba3d3fSMatthias Ringwald #endif 8977ba3d3fSMatthias Ringwald 9077ba3d3fSMatthias Ringwald #if defined __cplusplus 9177ba3d3fSMatthias Ringwald } 9277ba3d3fSMatthias Ringwald #endif 9377ba3d3fSMatthias Ringwald 9477ba3d3fSMatthias Ringwald #endif // __PB_ADV_H 95