From 31ee91a4d73b940fee7c1e1ee1779f7dcaceb87f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20Storr=C3=B8?= Date: Thu, 22 Sep 2022 15:16:18 +0200 Subject: [PATCH 1/2] Bluetooth: Mesh: Shell: Del CDB node on node reset MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds feature that deletes the shell CDB node after perfoming a config client reset of another node. Signed-off-by: Anders Storrø --- subsys/bluetooth/mesh/shell/cfg_cli.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/subsys/bluetooth/mesh/shell/cfg_cli.c b/subsys/bluetooth/mesh/shell/cfg_cli.c index 1ae527868669c..951cffd7f29d0 100644 --- a/subsys/bluetooth/mesh/shell/cfg_cli.c +++ b/subsys/bluetooth/mesh/shell/cfg_cli.c @@ -33,6 +33,14 @@ static int cmd_reset(const struct shell *sh, size_t argc, char *argv[]) return 0; } + if (IS_ENABLED(CONFIG_BT_MESH_CDB)) { + struct bt_mesh_cdb_node *node = bt_mesh_cdb_node_get(bt_mesh_shell_target_ctx.dst); + + if (node) { + bt_mesh_cdb_node_del(node, true); + } + } + shell_print(sh, "Remote node reset complete"); return 0; From 8af0dec04204c5e9236f1a9ffff894e6db0eb30c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20Storr=C3=B8?= Date: Mon, 26 Sep 2022 09:44:02 +0200 Subject: [PATCH 2/2] Bluetooth: Mesh: Shell: Clear CDB on local reset MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds feature that clears the CDB entry on local reset. Signed-off-by: Anders Storrø --- doc/connectivity/bluetooth/api/mesh/shell.rst | 2 +- subsys/bluetooth/mesh/shell/shell.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/connectivity/bluetooth/api/mesh/shell.rst b/doc/connectivity/bluetooth/api/mesh/shell.rst index 5d134f2c8f260..bb3dd1dbd22ac 100644 --- a/doc/connectivity/bluetooth/api/mesh/shell.rst +++ b/doc/connectivity/bluetooth/api/mesh/shell.rst @@ -132,7 +132,7 @@ General configuration ``mesh reset-local`` -------------------- - Reset the local mesh node to its initial unprovisioned state. + Reset the local mesh node to its initial unprovisioned state. This command will also clear the Configuration Database (CDB) if present. Target ====== diff --git a/subsys/bluetooth/mesh/shell/shell.c b/subsys/bluetooth/mesh/shell/shell.c index 4dfe59e43a606..dceacd28ac4f3 100644 --- a/subsys/bluetooth/mesh/shell/shell.c +++ b/subsys/bluetooth/mesh/shell/shell.c @@ -424,6 +424,9 @@ static int cmd_init(const struct shell *sh, size_t argc, char *argv[]) static int cmd_reset(const struct shell *sh, size_t argc, char *argv[]) { +#if defined(CONFIG_BT_MESH_CDB) + bt_mesh_cdb_clear(); +# endif bt_mesh_reset(); shell_print(sh, "Local node reset complete");