From 578dbe1c0a1595c0eadc3c66a0d4fd793b0c858e Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Fri, 7 Feb 2020 10:34:42 +0200 Subject: [PATCH] Bluetooth: Mesh: Support reliable sending when publishing Until now the choice of reliable sending (segmented messages with acks) was implicitly dependent on the size of the payload. Add a new member to the bt_mesh_model_pub to force using segment acks even when the payload would fit a single unsegmented message. Signed-off-by: Johan Hedberg --- include/bluetooth/mesh/access.h | 3 ++- subsys/bluetooth/mesh/access.c | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/bluetooth/mesh/access.h b/include/bluetooth/mesh/access.h index 8c8d23cdbc7..412c3d1640d 100644 --- a/include/bluetooth/mesh/access.h +++ b/include/bluetooth/mesh/access.h @@ -396,7 +396,8 @@ struct bt_mesh_model_pub { u16_t addr; /**< Publish Address. */ u16_t key:12, /**< Publish AppKey Index. */ - cred:1; /**< Friendship Credentials Flag. */ + cred:1, /**< Friendship Credentials Flag. */ + send_rel:1; /**< Force reliable sending (segment acks) */ u8_t ttl; /**< Publish Time to Live. */ u8_t retransmit; /**< Retransmit Count & Interval Steps. */ diff --git a/subsys/bluetooth/mesh/access.c b/subsys/bluetooth/mesh/access.c index 099abd31c86..62fe9c85ac2 100644 --- a/subsys/bluetooth/mesh/access.c +++ b/subsys/bluetooth/mesh/access.c @@ -705,6 +705,7 @@ int bt_mesh_model_publish(struct bt_mesh_model *model) struct bt_mesh_model_pub *pub = model->pub; struct bt_mesh_app_key *key; struct bt_mesh_msg_ctx ctx = { + .send_rel = pub->send_rel, }; struct bt_mesh_net_tx tx = { .ctx = &ctx,