Bluetooth: Mesh: Skip publish if update fails

Allow models to skip a periodic publish interval by returning an error
from the publish update callback.

Previously, an error return from publish update would cancel periodic
publishing. This can't be recovered from, and as such, no valid model
implementation could return an error from this callback, and there was
no way to skip a periodic publish.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
This commit is contained in:
Trond Einar Snekvik 2020-01-15 16:45:11 +01:00 committed by Johan Hedberg
commit 19718fd6da
2 changed files with 16 additions and 5 deletions

View file

@ -424,6 +424,9 @@ struct bt_mesh_model_pub {
* @ref bt_mesh_model_pub.msg with a valid publication
* message.
*
* If the callback returns non-zero, the publication is skipped
* and will resume on the next periodic publishing interval.
*
* @param mod The Model the Publication Context belogs to.
*
* @return Zero on success or (negative) error code otherwise.