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_DEVICE_H 43 #define __PROVISIONING_DEVICE_H 44 45 #include <stdint.h> 46 47 #include "btstack_defines.h" 48 49 #include "mesh/mesh_keys.h" 50 51 #ifdef __cplusplus 52 extern "C" 53 { 54 #endif 55 56 /** 57 * @brief Init Provisioning in Device Role with device UUID 58 */ 59 void provisioning_device_init(void); 60 61 62 /** 63 * @brief Register packet handler 64 * @param packet_handler 65 */ 66 void provisioning_device_register_packet_handler(btstack_packet_handler_t packet_handler); 67 68 /** 69 * @brief Public Key OOB Available 70 * @param public_key (64 bytes), need to stay valid forever 71 * @param private_key (32 bytes), need to stay valid forever 72 * @note Requires ability to transmit public key out-of-band. Memory needs to stay available. Only works with Software ECC. 73 */ 74 void provisioning_device_set_public_key_oob(const uint8_t * public_key, const uint8_t * private_key); 75 76 /** 77 * @brief Static OOB Available 78 * @param static_oob_len in bytes 79 * @param static_oob_data 80 */ 81 void provisioning_device_set_static_oob(uint16_t static_oob_len, const uint8_t * static_oob_data); 82 83 /** 84 * @brief Configure Output OOB Options 85 * @param supported_output_oob_action_types bitfield 86 * @param max_oob_output_size in bytes 87 */ 88 void provisioning_device_set_output_oob_actions(uint16_t supported_output_oob_action_types, uint8_t max_oob_output_size); 89 90 /** 91 * @brief Configure Input OOB Options 92 * @param supported_input_oob_action_types bitfield 93 * @param max_oob_input_size in bytes 94 */ 95 void provisioning_device_set_input_oob_actions(uint16_t supported_input_oob_action_types, uint8_t max_oob_input_size); 96 97 /** 98 * @brief Input OOB Complete Numeric 99 * @param pv_adv_cid 100 * @Param input_oob number 101 */ 102 void provisioning_device_input_oob_complete_numeric(uint16_t pb_adv_cid, uint32_t input_oob); 103 104 /** 105 * @brief Input OOB Complete Alphanumeric 106 * @param pv_adv_cid 107 * @Param input_oob_data string 108 * @Param input_oob_len 109 */ 110 void provisioning_device_input_oob_complete_alphanumeric(uint16_t pb_adv_cid, const uint8_t * input_oob_data, uint16_t input_oob_len); 111 112 /** 113 * @brief Get provisioning data after provisioning completed 114 * @param provisioning_data 115 */ 116 void provisioning_device_data_get(mesh_provisioning_data_t * provisioning_data); 117 118 #ifdef __cplusplus 119 } /* end of extern "C" */ 120 #endif 121 122 #endif 123