Bluetooth: Mesh: Fix add model group address to sub list

When low power node reset, should add group address to
friend subscription list.

Fixes: #24311

Signed-off-by: Lingao Meng <mengabc1086@gmail.com>
This commit is contained in:
Lingao Meng 2020-04-18 00:20:30 -07:00 committed by Johan Hedberg
commit 49e4f754b4
2 changed files with 14 additions and 0 deletions

View file

@ -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++;
}

View file

@ -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
@ -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)