Bluetooth: Mesh: enable access responses randomization
Enable by default the access layer responses random delays. Commit also adapts all mesh models, samples and babblesim tests to use random delay functionality correctly. Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
This commit is contained in:
parent
0a2876de26
commit
4e7d64b1b4
7 changed files with 31 additions and 25 deletions
|
@ -639,6 +639,7 @@ config BT_MESH_LABEL_NO_RECOVER
|
|||
|
||||
menuconfig BT_MESH_ACCESS_DELAYABLE_MSG
|
||||
bool "Access layer tx delayable message"
|
||||
default y
|
||||
help
|
||||
Enable following of the message transmitting recommendations, the Access layer
|
||||
specification. The recommendations are optional.
|
||||
|
@ -647,6 +648,16 @@ menuconfig BT_MESH_ACCESS_DELAYABLE_MSG
|
|||
|
||||
if BT_MESH_ACCESS_DELAYABLE_MSG
|
||||
|
||||
config BT_MESH_ACCESS_DELAYABLE_MSG_CTX_ENABLED
|
||||
bool "The delayable message in the notification message context"
|
||||
default y
|
||||
help
|
||||
Controls whether the delayable message feature is enabled by default in
|
||||
the message context of the opcode notifications. This allows the server part of any
|
||||
model to not bother about additional context configuration to enable the delayable message.
|
||||
Note that if this is disabled then all foundation models stop using the delayable message
|
||||
functionality.
|
||||
|
||||
config BT_MESH_ACCESS_DELAYABLE_MSG_COUNT
|
||||
int "Number of simultaneously delayed messages"
|
||||
default 4
|
||||
|
@ -657,14 +668,14 @@ config BT_MESH_ACCESS_DELAYABLE_MSG_COUNT
|
|||
|
||||
config BT_MESH_ACCESS_DELAYABLE_MSG_CHUNK_SIZE
|
||||
int "Maximum delayable message storage chunk"
|
||||
default 20
|
||||
default 10
|
||||
help
|
||||
Size of memory that Access layer uses to split model message to. It allocates
|
||||
a sufficient number of these chunks from the pool to store the full model payload.
|
||||
|
||||
config BT_MESH_ACCESS_DELAYABLE_MSG_CHUNK_COUNT
|
||||
int "Maximum number of available chunks"
|
||||
default 20
|
||||
default 40
|
||||
help
|
||||
The maximum number of available chunks the Access layer allocates to store model payload.
|
||||
It is recommended to keep chunk size equal to the reasonable small value to prevent
|
||||
|
|
|
@ -922,7 +922,7 @@ static void mod_publish(struct k_work *work)
|
|||
return;
|
||||
}
|
||||
|
||||
LOG_DBG("%u", k_uptime_get_32());
|
||||
LOG_DBG("timestamp: %u", k_uptime_get_32());
|
||||
|
||||
if (pub->count) {
|
||||
pub->count--;
|
||||
|
@ -1504,6 +1504,10 @@ static int element_model_recv(struct bt_mesh_msg_ctx *ctx, struct net_buf_simple
|
|||
return ACCESS_STATUS_MESSAGE_NOT_UNDERSTOOD;
|
||||
}
|
||||
|
||||
if (IS_ENABLED(CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG_CTX_ENABLED)) {
|
||||
ctx->rnd_delay = true;
|
||||
}
|
||||
|
||||
net_buf_simple_save(buf, &state);
|
||||
err = op->func(model, ctx, buf);
|
||||
net_buf_simple_restore(buf, &state);
|
||||
|
@ -1578,7 +1582,9 @@ int bt_mesh_model_send(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx
|
|||
}
|
||||
|
||||
#if defined CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG
|
||||
if (ctx->rnd_delay) {
|
||||
/* No sense to use delayable message for unicast loopback. */
|
||||
if (ctx->rnd_delay &&
|
||||
!(bt_mesh_has_addr(ctx->addr) && BT_MESH_ADDR_IS_UNICAST(ctx->addr))) {
|
||||
return bt_mesh_delayable_msg_manage(ctx, msg, bt_mesh_model_elem(model)->rt->addr,
|
||||
cb, cb_data);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue