ble_mesh: Support reliable sending when publishing [Zephyr]

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.
This commit is contained in:
lly 2020-03-25 00:15:27 +08:00
parent c2e24e306f
commit 2b84b673bf
3 changed files with 7 additions and 3 deletions

View File

@ -369,7 +369,8 @@ typedef struct {
uint16_t publish_addr; /*!< Publish Address. */
uint16_t app_idx:12, /*!< Publish AppKey Index. */
cred:1; /*!< Friendship Credentials Flag. */
cred:1, /*!< Friendship Credentials Flag. */
send_rel:1; /*!< Force reliable sending (segment acks) */
uint8_t ttl; /*!< Publish Time to Live. */
uint8_t retransmit; /*!< Retransmit Count & Interval Steps. */

View File

@ -1024,7 +1024,9 @@ int bt_mesh_model_publish(struct bt_mesh_model *model)
struct bt_mesh_model_pub *pub = model->pub;
struct bt_mesh_app_key *key = NULL;
struct net_buf_simple *sdu = NULL;
struct bt_mesh_msg_ctx ctx = {0};
struct bt_mesh_msg_ctx ctx = {
.send_rel = pub->send_rel,
};
struct bt_mesh_net_tx tx = {
.sub = NULL,
.ctx = &ctx,

View File

@ -339,7 +339,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. */