mesh: Add Option config unprov beacon interval

1 Add Option to specifies the second interval when device
send Unprovisioned Beacon.

2 Move BT_MESH_LPN_SUB_ALL_NODES_ADDR to LPN subgroup.

this is port of 81fc15c4d64aab5f73f8d6ab755fa9688dd67734,
c86966719fef7564e7350cae5f0f2ab843f70eaa and
72315cf01e69ec2df802c6417f100a3777cd0345
This commit is contained in:
Krzysztof Kopyściński
2021-01-12 14:05:19 +01:00
committed by Łukasz Rymanowski
parent eaa36c971e
commit bfe7f21053
3 changed files with 32 additions and 13 deletions
+12 -7
View File
@@ -23,7 +23,6 @@
#include "foundation.h"
#include "atomic.h"
#define UNPROVISIONED_INTERVAL (K_SECONDS(5))
#define PROVISIONED_INTERVAL (K_SECONDS(10))
#define BEACON_TYPE_UNPROVISIONED 0x00
@@ -203,7 +202,6 @@ static int unprovisioned_beacon_send(void)
static void unprovisioned_beacon_recv(struct os_mbuf *buf)
{
#if MYNEWT_VAL(BLE_MESH_PB_ADV)
const struct bt_mesh_prov *prov;
u8_t *uuid;
u16_t oob_info;
@@ -232,7 +230,6 @@ static void unprovisioned_beacon_recv(struct os_mbuf *buf)
(bt_mesh_prov_oob_info_t)oob_info,
uri_hash);
}
#endif
}
static void update_beacon_observation(void)
@@ -265,7 +262,8 @@ static void beacon_send(struct ble_npl_event *work)
{
/* Don't send anything if we have an active provisioning link */
if ((MYNEWT_VAL(BLE_MESH_PROV)) && bt_prov_active()) {
k_delayed_work_submit(&beacon_timer, UNPROVISIONED_INTERVAL);
k_delayed_work_submit(&beacon_timer,
K_SECONDS(MYNEWT_VAL(BLE_MESH_UNPROV_BEACON_INT)));
return;
}
@@ -281,9 +279,14 @@ static void beacon_send(struct ble_npl_event *work)
k_delayed_work_submit(&beacon_timer,
PROVISIONED_INTERVAL);
}
} else if (IS_ENABLED(CONFIG_BT_MESH_PB_ADV)) {
return;
}
if (IS_ENABLED(BLE_MESH_PB_ADV)) {
unprovisioned_beacon_send();
k_delayed_work_submit(&beacon_timer, UNPROVISIONED_INTERVAL);
k_delayed_work_submit(&beacon_timer,
K_SECONDS(MYNEWT_VAL(BLE_MESH_UNPROV_BEACON_INT)));
}
}
@@ -381,7 +384,9 @@ void bt_mesh_beacon_recv(struct os_mbuf *buf)
type = net_buf_simple_pull_u8(buf);
switch (type) {
case BEACON_TYPE_UNPROVISIONED:
unprovisioned_beacon_recv(buf);
if (IS_ENABLED(BLE_MESH_PB_ADV)) {
unprovisioned_beacon_recv(buf);
}
break;
case BEACON_TYPE_SECURE:
secure_beacon_recv(buf);
+12 -6
View File
@@ -29,6 +29,12 @@ syscfg.defs:
the advertising bearer.
value: 1
BLE_MESH_UNPROV_BEACON_INT:
description: >
This option specifies the interval (in seconds) at which the
device sends unprovisioned beacon.
value: 5
BLE_MESH_PROVISIONER:
description: >
Enable this option to have support for provisioning remote devices.
@@ -356,6 +362,12 @@ syscfg.defs:
Maximum number of groups that the LPN can subscribe to.
value: 10
BLE_MESH_LPN_SUB_ALL_NODES_ADDR:
description: >
Automatically subscribe all nodes address when friendship
established.
value: 1
BLE_MESH_FRIEND:
description: >
Enable this option to be able to act as a Friend Node.
@@ -378,12 +390,6 @@ syscfg.defs:
Friend node for a Low Power node.
value: 3
BLE_MESH_LPN_SUB_ALL_NODES_ADDR:
description: >
Automatically subscribe all nodes address when friendship
established.
value: 0
BLE_MESH_FRIEND_LPN_COUNT:
description: >
Number of Low Power Nodes the Friend can have a Friendship
@@ -912,6 +912,10 @@
#define MYNEWT_VAL_BLE_MESH_LPN_GROUPS (10)
#endif
#ifndef MYNEWT_VAL_BLE_MESH_LPN_SUB_ALL_NODES_ADDR
#define MYNEWT_VAL_BLE_MESH_LPN_SUB_ALL_NODES_ADDR (1)
#endif
#ifndef MYNEWT_VAL_BLE_MESH_LPN_INIT_POLL_TIMEOUT
#define MYNEWT_VAL_BLE_MESH_LPN_INIT_POLL_TIMEOUT (MYNEWT_VAL_BLE_MESH_LPN_POLL_TIMEOUT)
#endif
@@ -1151,6 +1155,10 @@
#define MYNEWT_VAL_BLE_MESH_RX_SEG_MSG_COUNT (3)
#endif
#ifndef MYNEWT_VAL_BLE_MESH_UNPROV_BEACON_INT
#define MYNEWT_VAL_BLE_MESH_UNPROV_BEACON_INT (5)
#endif
#ifndef MYNEWT_VAL_BLE_MESH_TX_SEG_MSG_COUNT
#define MYNEWT_VAL_BLE_MESH_TX_SEG_MSG_COUNT (4)
#endif