diff --git a/components/bt/esp_ble_mesh/mesh_core/main.c b/components/bt/esp_ble_mesh/mesh_core/main.c index 4aca1bd1d5..56308180ff 100644 --- a/components/bt/esp_ble_mesh/mesh_core/main.c +++ b/components/bt/esp_ble_mesh/mesh_core/main.c @@ -538,18 +538,18 @@ int bt_mesh_provisioner_enable(bt_mesh_prov_bearer_t bearers) return -EALREADY; } - err = bt_mesh_provisioner_set_prov_info(); - if (err) { - BT_ERR("%s, Failed to set provisioning info", __func__); - return err; - } - err = bt_mesh_provisioner_net_create(); if (err) { BT_ERR("%s, Failed to create network", __func__); return err; } + err = bt_mesh_provisioner_init_prov_info(); + if (err) { + BT_ERR("%s, Failed to init provisioning info", __func__); + return err; + } + bt_mesh_atomic_set_bit(bt_mesh.flags, BLE_MESH_PROVISIONER); if (IS_ENABLED(CONFIG_BLE_MESH_SETTINGS)) { diff --git a/components/bt/esp_ble_mesh/mesh_core/provisioner_prov.c b/components/bt/esp_ble_mesh/mesh_core/provisioner_prov.c index 1fda15a526..8f47be0051 100644 --- a/components/bt/esp_ble_mesh/mesh_core/provisioner_prov.c +++ b/components/bt/esp_ble_mesh/mesh_core/provisioner_prov.c @@ -236,7 +236,7 @@ struct bt_mesh_prov_ctx { u16_t curr_net_idx; /* Current flags going to be used in provisioning data */ - u16_t curr_flags; + u8_t curr_flags; /* Current iv_index going to be used in provisioning data */ u16_t curr_iv_index; @@ -1128,7 +1128,7 @@ int bt_mesh_provisioner_set_prov_data_info(struct bt_mesh_prov_data_info *info) return 0; } -int bt_mesh_provisioner_set_prov_info(void) +int bt_mesh_provisioner_init_prov_info(void) { const struct bt_mesh_comp *comp = NULL; @@ -1168,8 +1168,9 @@ int bt_mesh_provisioner_set_prov_info(void) } } prov_ctx.curr_net_idx = BLE_MESH_KEY_PRIMARY; - prov_ctx.curr_flags = prov->flags; - prov_ctx.curr_iv_index = prov->iv_index; + struct bt_mesh_subnet *sub = bt_mesh_provisioner_subnet_get(BLE_MESH_KEY_PRIMARY); + prov_ctx.curr_flags = bt_mesh_net_flags(sub); + prov_ctx.curr_iv_index = bt_mesh.iv_index; return 0; } diff --git a/components/bt/esp_ble_mesh/mesh_core/provisioner_prov.h b/components/bt/esp_ble_mesh/mesh_core/provisioner_prov.h index 7642e2c8ef..2a55de3525 100644 --- a/components/bt/esp_ble_mesh/mesh_core/provisioner_prov.h +++ b/components/bt/esp_ble_mesh/mesh_core/provisioner_prov.h @@ -286,7 +286,7 @@ int bt_mesh_provisioner_set_prov_data_info(struct bt_mesh_prov_data_info *info); * * @return Zero - success, otherwise - fail */ -int bt_mesh_provisioner_set_prov_info(void); +int bt_mesh_provisioner_init_prov_info(void); /** * @brief This function sets the provisioning bearer type used by Provisioner.