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:
parent
cb4c09d702
commit
2e4eab5ebc
2 changed files with 17 additions and 0 deletions
|
@ -445,6 +445,12 @@ config BT_MESH_FRIEND_SUB_LIST_SIZE
|
||||||
Size of the Subscription List that can be supported by a
|
Size of the Subscription List that can be supported by a
|
||||||
Friend node for a Low Power node.
|
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
|
config BT_MESH_FRIEND_LPN_COUNT
|
||||||
int "Number of supported LPN nodes"
|
int "Number of supported LPN nodes"
|
||||||
range 1 1000
|
range 1 1000
|
||||||
|
|
|
@ -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);
|
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)) {
|
if (IS_ENABLED(CONFIG_BT_SETTINGS)) {
|
||||||
BT_DBG("Storing network information persistently");
|
BT_DBG("Storing network information persistently");
|
||||||
bt_mesh_store_net();
|
bt_mesh_store_net();
|
||||||
|
@ -174,6 +179,12 @@ void bt_mesh_reset(void)
|
||||||
bt_mesh_tx_reset();
|
bt_mesh_tx_reset();
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_BT_MESH_LOW_POWER)) {
|
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);
|
bt_mesh_lpn_disable(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue