From e495876db6900a4b64d82825f795454b2b507a5d Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Mon, 5 Feb 2024 13:07:18 +0100 Subject: [PATCH] Bluetooth: Mesh: Reset solicitation settings before calling reset cb Trigger erasing solicitation settings before calling `bt_mesh_settings_store_pending` and `bt_mesh_prov.reset` callback. The `bt_mesh_settings_store_pending` flushes every settings that is pending to be erased. The `bt_mesh_prov.reset` callback must be called as the last step because a user is free to do anything from this callback including rebooting or reprovisioning the device. Signed-off-by: Pavel Vasilyev --- subsys/bluetooth/mesh/main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/subsys/bluetooth/mesh/main.c b/subsys/bluetooth/mesh/main.c index 1b80233cec17..77ca15b2d614 100644 --- a/subsys/bluetooth/mesh/main.c +++ b/subsys/bluetooth/mesh/main.c @@ -401,6 +401,10 @@ void bt_mesh_reset(void) bt_mesh_comp_unprovision(); + if (IS_ENABLED(CONFIG_BT_MESH_PROXY_SOLICITATION)) { + bt_mesh_sol_reset(); + } + if (IS_ENABLED(CONFIG_BT_SETTINGS)) { bt_mesh_settings_store_pending(); } @@ -408,10 +412,6 @@ void bt_mesh_reset(void) if (IS_ENABLED(CONFIG_BT_MESH_PROV)) { bt_mesh_prov_reset(); } - - if (IS_ENABLED(CONFIG_BT_MESH_PROXY_SOLICITATION)) { - bt_mesh_sol_reset(); - } } bool bt_mesh_is_provisioned(void)