Bluetooth: Mesh: Remove redundant 'provisioned' variable
This variable is both redundant as well as problematic when it comes
to adding persistent-storage-based provisioning information, which
will not come through main.c or the bt_mesh_provision() API. Just
remove it and use bt_mesh.valid which serves the same purpose in
practice.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
diff --git a/subsys/bluetooth/host/mesh/main.c b/subsys/bluetooth/host/mesh/main.c
index 101a046..7e0bd54 100644
--- a/subsys/bluetooth/host/mesh/main.c
+++ b/subsys/bluetooth/host/mesh/main.c
@@ -32,8 +32,6 @@
#include "settings.h"
#include "mesh.h"
-static bool provisioned;
-
int bt_mesh_provision(const u8_t net_key[16], u16_t net_idx,
u8_t flags, u32_t iv_index, u32_t seq,
u16_t addr, const u8_t dev_key[16])
@@ -63,8 +61,6 @@
memcpy(bt_mesh.dev_key, dev_key, 16);
- provisioned = true;
-
if (IS_ENABLED(CONFIG_BT_SETTINGS)) {
BT_DBG("Storing network information persistently");
bt_mesh_store_net(addr, dev_key);
@@ -103,7 +99,7 @@
void bt_mesh_reset(void)
{
- if (!provisioned) {
+ if (!bt_mesh.valid) {
return;
}
@@ -140,8 +136,6 @@
memset(bt_mesh.rpl, 0, sizeof(bt_mesh.rpl));
- provisioned = false;
-
bt_mesh_scan_disable();
bt_mesh_beacon_disable();
@@ -152,7 +146,7 @@
bool bt_mesh_is_provisioned(void)
{
- return provisioned;
+ return bt_mesh.valid;
}
int bt_mesh_prov_enable(bt_mesh_prov_bearer_t bearers)