ble mesh: stack: return error when scanning failed to be enabled(v5.1)

This commit is contained in:
Wu Meng Shi 2023-08-03 11:15:41 +08:00 committed by Jiang Jiang Jian
parent d83fe16c93
commit d6c18ad4c5

View File

@ -197,6 +197,8 @@ static bool prov_bearers_valid(bt_mesh_prov_bearer_t bearers)
int bt_mesh_prov_enable(bt_mesh_prov_bearer_t bearers)
{
int err = 0;
if (bt_mesh_is_provisioned()) {
BT_WARN("%s, Already", __func__);
return -EALREADY;
@ -232,7 +234,11 @@ int bt_mesh_prov_enable(bt_mesh_prov_bearer_t bearers)
if (IS_ENABLED(CONFIG_BLE_MESH_PB_ADV) &&
(bearers & BLE_MESH_PROV_ADV)) {
/* Make sure we're scanning for provisioning invitations */
bt_mesh_scan_enable();
err = bt_mesh_scan_enable();
if (err) {
return err;
}
/* Enable unprovisioned beacon sending */
bt_mesh_beacon_enable();
}
@ -637,7 +643,10 @@ int bt_mesh_provisioner_enable(bt_mesh_prov_bearer_t bearers)
bt_mesh_beacon_enable();
}
bt_mesh_scan_enable();
err = bt_mesh_scan_enable();
if (err) {
return err;
}
return 0;
}