1 /* 2 * Copyright (C) 2017 BlueKitchen GmbH 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 3. Neither the name of the copyright holders nor the names of 14 * contributors may be used to endorse or promote products derived 15 * from this software without specific prior written permission. 16 * 4. Any redistribution, use, or modification is done solely for 17 * personal benefit and not for any commercial purpose or for 18 * monetary gain. 19 * 20 * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS 21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BLUEKITCHEN 24 * GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 26 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 27 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 28 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 29 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 30 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * Please inquire about commercial licensing options at 34 * [email protected] 35 * 36 */ 37 38 /* 39 * provisioning_device.h 40 */ 41 42 #ifndef __PROVISIONING_PROVISIONER_H 43 #define __PROVISIONING_PROVISIONER_H 44 45 #include <stdint.h> 46 47 #include "btstack_defines.h" 48 49 #ifdef __cplusplus 50 extern "C" 51 { 52 #endif 53 54 /** 55 * @brief Init Provisioning in Provisioner Role 56 */ 57 void provisioning_provisioner_init(void); 58 59 /** 60 * @brief Register packet handler 61 * @param packet_handler 62 */ 63 void provisioning_provisioner_register_packet_handler(btstack_packet_handler_t packet_handler); 64 65 /** 66 * @brief Start Provisioning device with provided device_uuid 67 * @param device_uuid 68 * @return pb_adv_cid or 0 69 */ 70 uint16_t provisioning_provisioner_start_provisioning(const uint8_t * device_uuid); 71 72 /** 73 * @brief Select Authentication Method 74 * @param pv_adv_cid 75 * @param algorithm 76 * @param public_key_used 77 * @param authentication_method 78 * @param authentication_action 79 * @param authentication_size 80 */ 81 uint8_t provisioning_provisioner_select_authentication_method(uint16_t pb_adv_cid, uint8_t algorithm, uint8_t public_key_used, uint8_t authentication_method, uint8_t authentication_action, uint8_t authentication_size); 82 83 /** 84 * @brief Public Key OOB Available 85 * @param pv_adv_cid 86 * @param public_key (64 bytes) 87 * @note Requires ability to transmit public key out-of-band 88 */ 89 uint8_t provisioning_provisioner_public_key_oob_received(uint16_t pb_adv_cid, const uint8_t * public_key); 90 91 /** 92 * @brief Set data for Static OOB Authentication 93 * @param pv_adv_cid 94 * @param static_oob_len 95 * @param static_oob_data 96 */ 97 void provisioning_provisioner_set_static_oob(uint16_t pb_adv_cid, uint16_t static_oob_len, const uint8_t * static_oob_data); 98 99 /** 100 * @brief Input OOB Complete Numeric 101 * @param pv_adv_cid 102 * @Param input_oob number 103 */ 104 void provisioning_provisioner_input_oob_complete_numeric(uint16_t pb_adv_cid, uint32_t input_oob); 105 106 /** 107 * @brief Input OOB Complete Alphanumeric 108 * @param pv_adv_cid 109 * @Param input_oob_data string 110 * @Param input_oob_len 111 */ 112 void provisioning_provisioner_input_oob_complete_alphanumeric(uint16_t pb_adv_cid, const uint8_t * input_oob_data, uint16_t input_oob_len); 113 114 115 #ifdef __cplusplus 116 } /* end of extern "C" */ 117 #endif 118 119 #endif 120