mesh: Return change information from bt_mesh_iv_update()

This will soon be useful to the callers of bt_mesh_iv_update(), in
particular Friend support.

X-Original-Commit: 9b4b858eec665aa008c9836106130c21e3800c5a
This commit is contained in:
Michał Narajowski
2017-11-09 11:48:04 +01:00
parent 100e205140
commit eb0eb5978b
2 changed files with 12 additions and 10 deletions
+11 -9
View File
@@ -558,7 +558,7 @@ void bt_mesh_rpl_reset(void)
}
}
void bt_mesh_iv_update(u32_t iv_index, bool iv_update)
bool bt_mesh_iv_update(u32_t iv_index, bool iv_update)
{
int i;
@@ -568,13 +568,13 @@ void bt_mesh_iv_update(u32_t iv_index, bool iv_update)
if (iv_index != bt_mesh.iv_index) {
BT_WARN("IV Index mismatch: 0x%08x != 0x%08x",
iv_index, bt_mesh.iv_index);
return;
return false;
}
if (iv_update) {
/* Nothing to do */
BT_DBG("Already in IV Update in Progress state");
return;
return false;
}
} else {
/* We're currently in Normal mode */
@@ -583,7 +583,7 @@ void bt_mesh_iv_update(u32_t iv_index, bool iv_update)
iv_index > bt_mesh.iv_index + 42) {
BT_ERR("IV Index out of sync: " "0x%08x != 0x%08x",
iv_index, bt_mesh.iv_index);
return;
return false;
}
if (iv_index > bt_mesh.iv_index + 1) {
@@ -597,19 +597,19 @@ void bt_mesh_iv_update(u32_t iv_index, bool iv_update)
if (iv_index == bt_mesh.iv_index + 1 && !iv_update) {
BT_WARN("Ignoring new index in normal mode",
iv_index, bt_mesh.iv_index);
return;
return false;
}
if (!iv_update) {
/* Nothing to do */
BT_DBG("Already in Normal mode");
return;
return false;
}
if (iv_index != bt_mesh.iv_index + 1) {
BT_WARN("Wrong new IV Index: 0x%08x != 0x%08x + 1",
iv_index, bt_mesh.iv_index);
return;
return false;
}
}
@@ -618,7 +618,7 @@ void bt_mesh_iv_update(u32_t iv_index, bool iv_update)
if (delta < K_HOURS(96)) {
BT_WARN("IV Update before minimum duration");
return;
return false;
}
}
@@ -626,7 +626,7 @@ void bt_mesh_iv_update(u32_t iv_index, bool iv_update)
if (!iv_update && bt_mesh_tx_in_progress()) {
BT_WARN("IV Update deferred because of pending transfer");
bt_mesh.pending_update = 1;
return;
return false;
}
do_update:
@@ -655,6 +655,8 @@ do_update:
bt_mesh_net_beacon_update(&bt_mesh.sub[i]);
}
}
return false;
}
int bt_mesh_net_resend(struct bt_mesh_subnet *sub, struct os_mbuf *buf,
+1 -1
View File
@@ -279,7 +279,7 @@ bt_mesh_net_beacon_update(struct bt_mesh_subnet *sub);
void
bt_mesh_rpl_reset(void);
void
bool
bt_mesh_iv_update(u32_t iv_index, bool iv_update);
struct bt_mesh_subnet *