Bluetooth: Mesh: Move IV Update defines to net.h
These will soon be needed from other places, e.g. the persistent storage support. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
parent
c913c6710d
commit
10fabcd04f
2 changed files with 18 additions and 18 deletions
|
@ -34,11 +34,6 @@
|
|||
#include "foundation.h"
|
||||
#include "beacon.h"
|
||||
|
||||
/* Special time-stamp to indicate that we don't know when the last IV
|
||||
* Update happened.
|
||||
*/
|
||||
#define IV_UPDATE_UNKNOWN -1
|
||||
|
||||
/* Minimum valid Mesh Network PDU length. The Network headers
|
||||
* themselves take up 9 bytes. After that there is a minumum of 1 byte
|
||||
* payload for both CTL=1 and CTL=0 PDUs (smallest OpCode is 1 byte). CTL=1
|
||||
|
@ -50,14 +45,6 @@
|
|||
/* Seq limit after IV Update is triggered */
|
||||
#define IV_UPDATE_SEQ_LIMIT 8000000
|
||||
|
||||
#if defined(CONFIG_BT_MESH_IV_UPDATE_TEST)
|
||||
/* Small test timeout for IV Update Procedure testing */
|
||||
#define IV_UPDATE_TIMEOUT K_SECONDS(120)
|
||||
#else
|
||||
/* Maximum time to stay in IV Update mode (96 < time < 144) */
|
||||
#define IV_UPDATE_TIMEOUT K_HOURS(120)
|
||||
#endif /* CONFIG_BT_MESH_IV_UPDATE_TEST */
|
||||
|
||||
#define IVI(pdu) ((pdu)[0] >> 7)
|
||||
#define NID(pdu) ((pdu)[0] & 0x7f)
|
||||
#define CTL(pdu) ((pdu)[1] >> 7)
|
||||
|
@ -495,12 +482,12 @@ int bt_mesh_net_create(u16_t idx, u8_t flags, const u8_t key[16],
|
|||
bt_mesh.iv_update = BT_MESH_IV_UPDATE(flags);
|
||||
|
||||
/* Set initial IV Update procedure state time-stamp */
|
||||
bt_mesh.last_update = IV_UPDATE_UNKNOWN;
|
||||
bt_mesh.last_update = BT_MESH_NET_IVU_UNKNOWN;
|
||||
|
||||
/* Set a timer to transition back to normal mode */
|
||||
if (bt_mesh.iv_update) {
|
||||
k_delayed_work_submit(&bt_mesh.ivu_complete,
|
||||
IV_UPDATE_TIMEOUT);
|
||||
BT_MESH_NET_IVU_TIMEOUT);
|
||||
}
|
||||
|
||||
/* Make sure we have valid beacon data to be sent */
|
||||
|
@ -633,7 +620,7 @@ void bt_mesh_net_sec_update(struct bt_mesh_subnet *sub)
|
|||
|
||||
static void update_ivu_timestamp(void)
|
||||
{
|
||||
if (bt_mesh.last_update == IV_UPDATE_UNKNOWN) {
|
||||
if (bt_mesh.last_update == BT_MESH_NET_IVU_UNKNOWN) {
|
||||
bt_mesh.last_update = k_uptime_get();
|
||||
}
|
||||
}
|
||||
|
@ -694,7 +681,7 @@ bool bt_mesh_net_iv_update(u32_t iv_index, bool iv_update)
|
|||
}
|
||||
}
|
||||
|
||||
if (bt_mesh.last_update != IV_UPDATE_UNKNOWN &&
|
||||
if (bt_mesh.last_update != BT_MESH_NET_IVU_UNKNOWN &&
|
||||
!(IS_ENABLED(CONFIG_BT_MESH_IV_UPDATE_TEST) && bt_mesh.ivu_test)) {
|
||||
s64_t delta = k_uptime_get() - bt_mesh.last_update;
|
||||
|
||||
|
@ -722,7 +709,7 @@ do_update:
|
|||
bt_mesh_rpl_reset();
|
||||
|
||||
k_delayed_work_submit(&bt_mesh.ivu_complete,
|
||||
IV_UPDATE_TIMEOUT);
|
||||
BT_MESH_NET_IVU_TIMEOUT);
|
||||
} else {
|
||||
BT_DBG("Normal mode entered");
|
||||
bt_mesh.seq = 0;
|
||||
|
|
|
@ -17,6 +17,19 @@
|
|||
#define BT_MESH_IV_UPDATE(flags) ((flags >> 1) & 0x01)
|
||||
#define BT_MESH_KEY_REFRESH(flags) (flags & 0x01)
|
||||
|
||||
/* Special time-stamp to indicate that we don't know when the last IV
|
||||
* Update happened.
|
||||
*/
|
||||
#define BT_MESH_NET_IVU_UNKNOWN -1
|
||||
|
||||
#if defined(CONFIG_BT_MESH_IV_UPDATE_TEST)
|
||||
/* Small test timeout for IV Update Procedure testing */
|
||||
#define BT_MESH_NET_IVU_TIMEOUT K_SECONDS(120)
|
||||
#else
|
||||
/* Maximum time to stay in IV Update mode (96 < time < 144) */
|
||||
#define BT_MESH_NET_IVU_TIMEOUT K_HOURS(120)
|
||||
#endif /* CONFIG_BT_MESH_IV_UPDATE_TEST */
|
||||
|
||||
struct bt_mesh_app_key {
|
||||
u16_t net_idx;
|
||||
u16_t app_idx;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue