ble_mesh: stack: Using the latest iv_index for provisioning

This commit is contained in:
lly
2020-08-17 20:11:17 +08:00
committed by maojianxin
parent 4c383886dd
commit 0f0e48facb
3 changed files with 12 additions and 11 deletions

View File

@@ -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)) {

View File

@@ -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;
}

View File

@@ -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.