Bluetooth: Mesh: Add option for lpn auto sub all-nodes

Add option for low power node automatically subscribe
all-nodes-address to friend sub list.

Fixes: #24009

Signed-off-by: Lingao Meng <mengabc1086@gmail.com>
This commit is contained in:
Lingao Meng 2020-04-18 00:15:19 -07:00 committed by Johan Hedberg
commit 2e4eab5ebc
2 changed files with 17 additions and 0 deletions

View file

@ -445,6 +445,12 @@ config BT_MESH_FRIEND_SUB_LIST_SIZE
Size of the Subscription List that can be supported by a
Friend node for a Low Power node.
config BT_MESH_LPN_SUB_ALL_NODES_ADDR
bool "Automatically subscribe all nodes address"
help
Automatically subscribe all nodes address when friendship
established.
config BT_MESH_FRIEND_LPN_COUNT
int "Number of supported LPN nodes"
range 1 1000

View file

@ -123,6 +123,11 @@ int bt_mesh_provision(const u8_t net_key[16], u16_t net_idx,
memcpy(bt_mesh.dev_key, dev_key, 16);
if (IS_ENABLED(CONFIG_BT_MESH_LOW_POWER) &&
IS_ENABLED(CONFIG_BT_MESH_LPN_SUB_ALL_NODES_ADDR)) {
bt_mesh_lpn_group_add(BT_MESH_ADDR_ALL_NODES);
}
if (IS_ENABLED(CONFIG_BT_SETTINGS)) {
BT_DBG("Storing network information persistently");
bt_mesh_store_net();
@ -174,6 +179,12 @@ void bt_mesh_reset(void)
bt_mesh_tx_reset();
if (IS_ENABLED(CONFIG_BT_MESH_LOW_POWER)) {
if (IS_ENABLED(CONFIG_BT_MESH_LPN_SUB_ALL_NODES_ADDR)) {
u16_t group = BT_MESH_ADDR_ALL_NODES;
bt_mesh_lpn_group_del(&group, 1);
}
bt_mesh_lpn_disable(true);
}