Bluetooth: Mesh: Warn if can't listen to unprov beacons until proved

When calling `mesh prov beacon-listen on` shell command before
provisioning the local device, the stack won't report unprovisioned
beacons. This is because the scanner has not been started yet. This
behavior confuses users. Print a warning that the device needs to be
provisioned first before it can listen to unprovisioned beacons.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
This commit is contained in:
Pavel Vasilyev 2024-03-14 13:55:18 +01:00 committed by Carles Cufí
commit 1861583ce2

View file

@ -726,6 +726,11 @@ static int cmd_beacon_listen(const struct shell *sh, size_t argc,
return err;
}
if (!bt_mesh_is_provisioned()) {
shell_error(sh, "Not yet provisioned");
return -EINVAL;
}
if (val) {
bt_mesh_shell_prov.unprovisioned_beacon = print_unprovisioned_beacon;
#if defined(CONFIG_BT_MESH_PB_GATT_CLIENT)