Skip to content

Commit

Permalink
Bluetooth: Mesh: Fix add model group address to sub list
Browse files Browse the repository at this point in the history
When low power node reset, should add group address to
friend subscription list.

Fixes: zephyrproject-rtos#24311

Signed-off-by: Lingao Meng <mengabc1086@gmail.com>
  • Loading branch information
LingaoM authored and hakehuang committed Jun 20, 2020
1 parent 9231db3 commit d76cb96
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions subsys/bluetooth/mesh/cfg_srv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1262,6 +1262,9 @@ static size_t mod_sub_list_clear(struct bt_mesh_model *mod)
/* Unref stored labels related to this model */
for (i = 0, clear_count = 0; i < ARRAY_SIZE(mod->groups); i++) {
if (mod->groups[i] != BT_MESH_ADDR_UNASSIGNED) {
if (IS_ENABLED(CONFIG_BT_MESH_LOW_POWER)) {
bt_mesh_lpn_group_del(&mod->groups[i], 1);
}
mod->groups[i] = BT_MESH_ADDR_UNASSIGNED;
clear_count++;
}
Expand Down
11 changes: 11 additions & 0 deletions subsys/bluetooth/mesh/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "foundation.h"
#include "proxy.h"
#include "settings.h"
#include "lpn.h"

/* Tracking of what storage changes are pending for App and Net Keys. We
* track this in a separate array here instead of within the respective
Expand Down Expand Up @@ -1097,6 +1098,16 @@ static void commit_mod(struct bt_mesh_model *mod, struct bt_mesh_elem *elem,
k_delayed_work_submit(&mod->pub->timer, ms);
}
}

if (!IS_ENABLED(CONFIG_BT_MESH_LOW_POWER)) {
return;
}

for (int i = 0; i < ARRAY_SIZE(mod->groups); i++) {
if (mod->groups[i] != BT_MESH_ADDR_UNASSIGNED) {
bt_mesh_lpn_group_add(mod->groups[i]);
}
}
}

static int mesh_commit(void)
Expand Down

0 comments on commit d76cb96

Please sign in to comment.