ble_mesh: stack: split primary addr & prov info init

This commit is contained in:
lly 2020-08-17 21:04:34 +08:00 committed by maojianxin
parent 0f0e48facb
commit c440c26449
3 changed files with 15 additions and 1 deletions

View File

@ -538,6 +538,12 @@ int bt_mesh_provisioner_enable(bt_mesh_prov_bearer_t bearers)
return -EALREADY;
}
err = bt_mesh_provisioner_init_primary_addr();
if (err) {
BT_ERR("%s, Failed to init primary addr", __func__);
return err;
}
err = bt_mesh_provisioner_net_create();
if (err) {
BT_ERR("%s, Failed to create network", __func__);

View File

@ -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_init_prov_info(void)
int bt_mesh_provisioner_init_primary_addr(void)
{
const struct bt_mesh_comp *comp = NULL;
@ -1167,6 +1167,12 @@ int bt_mesh_provisioner_init_prov_info(void)
bt_mesh_store_prov_info(prov_ctx.primary_addr, prov_ctx.curr_alloc_addr);
}
}
return 0;
}
int bt_mesh_provisioner_init_prov_info(void)
{
prov_ctx.curr_net_idx = BLE_MESH_KEY_PRIMARY;
struct bt_mesh_subnet *sub = bt_mesh_provisioner_subnet_get(BLE_MESH_KEY_PRIMARY);
prov_ctx.curr_flags = bt_mesh_net_flags(sub);

View File

@ -280,6 +280,8 @@ int bt_mesh_provisioner_adv_pkt_cb_register(unprov_adv_pkt_cb_t cb);
*/
int bt_mesh_provisioner_set_prov_data_info(struct bt_mesh_prov_data_info *info);
int bt_mesh_provisioner_init_primary_addr(void);
/**
* @brief This function sets the provisioning information needed by Provisioner,
* including unicast address, IV Index, etc.