Bluetooth: Mesh: Set timer for periodic publish before publishing

Encrypting and sending a message takes a considerable amount of time
which makes the publication period longer than expected.

With this patch it is possible to pass MESH/SR/HM/CFS/BV-02-C test.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2017-09-27 09:57:46 +03:00 committed by Johan Hedberg
parent fc679c50f9
commit ac5140891b

View file

@ -103,15 +103,15 @@ static void mod_publish(struct k_work *work)
BT_DBG("");
if (pub->func) {
pub->func(pub->mod);
}
period_ms = bt_mesh_model_pub_period_get(pub->mod);
BT_DBG("period %u ms", period_ms);
if (period_ms) {
k_delayed_work_submit(&pub->timer, period_ms);
}
if (pub->func) {
pub->func(pub->mod);
}
}
static void mod_init(struct bt_mesh_model *mod, struct bt_mesh_elem *elem,