1 #ifndef __GENIE_PROVISION_H__ 2 #define __GENIE_PROVISION_H__ 3 4 #include <stdint.h> 5 #include <genie_storage.h> 6 7 #define GENIE_PROVISON_UUID_LEN (16) 8 9 #define UNPROV_ADV_FEATURE1_UUID_VERSION 0x02 10 #define UNPROV_ADV_FEATURE1_SILENT_ADV 0x01 11 #define UNPROV_ADV_FEATURE1_SILENT_UNMASK 0xFE 12 #define UNPROV_ADV_FEATURE2_GENIE_MESH_STACK_V1 0x10 //bit4-7 13 #define UNPROV_ADV_FEATURE2_GENIE_MESH_STACK_V2 0x20 //bit4-7 14 #define UNPROV_ADV_FEATURE2_GENIE_MESH_STACK_V3 0x30 //bit4-7 15 #define UNPROV_ADV_FEATURE2_ULTRA_PROV_FLAG 0x01 //bit0 16 #define UNPROV_ADV_FEATURE2_AUTH_FLAG 0x02 //bit1 17 18 #define MESH_PROVISIONING_TIMEOUT 60 * 1000 19 20 typedef enum _genie_provision_state_e 21 { 22 GENIE_PROVISION_UNPROV, 23 GENIE_PROVISION_START, 24 GENIE_PROVISION_SUCCESS 25 } genie_provision_state_e; 26 27 typedef struct _genie_provision_s 28 { 29 uint16_t addr; 30 uint32_t seq; 31 uint8_t devkey[16]; 32 mesh_netkey_para_t netkey; 33 mesh_appkey_para_t appkey; 34 } genie_provision_t; 35 36 /** 37 * @brief get the trituple info formatted in uuid 38 * @return the string refering to uuid 39 */ 40 uint8_t *genie_provision_get_uuid(void); 41 42 void genie_provision_clear_silent_flag(void); 43 44 int genie_provision_set_state(genie_provision_state_e state); 45 46 genie_provision_state_e genie_provision_get_state(void); 47 48 int genie_provision_get_saved_data(genie_provision_t *p_genie_provision); 49 50 #ifdef GENIE_ULTRA_PROV 51 #define GENIE_PROV_ADV_TYPE (0xFF) 52 #define GENIE_PROV_FIXED_BYTE (0x0D) 53 54 typedef enum _genie_prov_status_e 55 { 56 GENIE_PROV_STATUS_RECV_RANDOM, 57 GENIE_PROV_STATUS_SEND_CONFIRM_DATA, 58 GENIE_PROV_STATUS_RECV_PROV_DATA, 59 GENIE_PROV_STATUS_SEND_COMPLETED 60 } genie_prov_status_e; 61 62 void genie_provision_ultra_prov_free(void); 63 int genie_provision_ultra_prov_handle(uint8_t frame_type, void *frame_buf); 64 #endif 65 66 /** 67 * @brief 68 */ 69 void genie_provision_pbadv_timer_start(uint32_t prov_timeout); 70 71 /** 72 * @brief 73 */ 74 void genie_provision_pbadv_timer_stop(void); 75 76 /** 77 * @brief 78 */ 79 void genie_provision_prov_timer_start(void); 80 81 /** 82 * @brief 83 */ 84 void genie_provision_prov_timer_stop(void); 85 86 /** 87 * @brief 88 */ 89 void genie_provision_start_slient_pbadv(void); 90 91 #endif 92