Bluetooth: Mesh: Remove redundant ivu_unknown variable
Instead of having an ivu_unknown variable to track when we can ignore the 96-hour minimum duration requirement, simply set the duration to the minimum (96 hours) in the places where ivu_unknown would have been 1. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
parent
68ef8f06a5
commit
20ea1b86b9
3 changed files with 8 additions and 11 deletions
|
@ -482,11 +482,12 @@ int bt_mesh_net_create(u16_t idx, u8_t flags, const u8_t key[16],
|
|||
|
||||
bt_mesh.iv_index = iv_index;
|
||||
bt_mesh.iv_update = BT_MESH_IV_UPDATE(flags);
|
||||
bt_mesh.ivu_duration = 0;
|
||||
bt_mesh.ivu_unknown = 1;
|
||||
|
||||
/* Set a timer to keep refreshing the stored duration */
|
||||
k_delayed_work_submit(&bt_mesh.ivu_timer, BT_MESH_IVU_TIMEOUT);
|
||||
/* Set minimum required hours, since the 96-hour minimum requirement
|
||||
* doesn't apply straight after provisioning (since we can't know how
|
||||
* long has actually passed since the network changed its state).
|
||||
*/
|
||||
bt_mesh.ivu_duration = BT_MESH_IVU_MIN_HOURS;
|
||||
|
||||
/* Make sure we have valid beacon data to be sent */
|
||||
bt_mesh_net_beacon_update(sub);
|
||||
|
@ -582,8 +583,8 @@ void bt_mesh_rpl_reset(void)
|
|||
void bt_mesh_iv_update_test(bool enable)
|
||||
{
|
||||
bt_mesh.ivu_test = enable;
|
||||
/* Clear the "unknown duration" variable - needed for some PTS tests */
|
||||
bt_mesh.ivu_unknown = 0;
|
||||
/* Reset the duration variable - needed for some PTS tests */
|
||||
bt_mesh.ivu_duration = 0;
|
||||
}
|
||||
|
||||
bool bt_mesh_iv_update(void)
|
||||
|
@ -671,8 +672,7 @@ bool bt_mesh_net_iv_update(u32_t iv_index, bool iv_update)
|
|||
}
|
||||
}
|
||||
|
||||
if (!bt_mesh.ivu_unknown &&
|
||||
!(IS_ENABLED(CONFIG_BT_MESH_IV_UPDATE_TEST) && bt_mesh.ivu_test)) {
|
||||
if (!(IS_ENABLED(CONFIG_BT_MESH_IV_UPDATE_TEST) && bt_mesh.ivu_test)) {
|
||||
if (bt_mesh.ivu_duration < BT_MESH_IVU_MIN_HOURS) {
|
||||
BT_WARN("IV Update before minimum duration");
|
||||
return false;
|
||||
|
@ -689,7 +689,6 @@ bool bt_mesh_net_iv_update(u32_t iv_index, bool iv_update)
|
|||
do_update:
|
||||
bt_mesh.iv_update = iv_update;
|
||||
bt_mesh.ivu_duration = 0;
|
||||
bt_mesh.ivu_unknown = 0;
|
||||
|
||||
if (bt_mesh.iv_update) {
|
||||
bt_mesh.iv_index = iv_index;
|
||||
|
|
|
@ -211,7 +211,6 @@ struct bt_mesh_net {
|
|||
iv_update:1, /* 1 if IV Update in Progress */
|
||||
ivu_initiator:1, /* IV Update initiated by us */
|
||||
ivu_test:1, /* IV Update test mode */
|
||||
ivu_unknown:1, /* Set to 1 right after provisioning */
|
||||
pending_update:1, /* Update blocked by SDU in progress */
|
||||
valid:1; /* 0 if unused */
|
||||
|
||||
|
|
|
@ -186,7 +186,6 @@ static int iv_set(int argc, char **argv, char *val)
|
|||
bt_mesh.iv_index = iv.iv_index;
|
||||
bt_mesh.iv_update = iv.iv_update;
|
||||
bt_mesh.ivu_duration = iv.iv_duration;
|
||||
bt_mesh.ivu_unknown = 0;
|
||||
|
||||
BT_DBG("IV Index 0x%04x (IV Update Flag %u) duration %u hours",
|
||||
bt_mesh.iv_index, bt_mesh.iv_update, bt_mesh.ivu_duration);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue