Bluetooth: Mesh: Add proxy send callback
Zephyr Bluetooth Mesh did not check whether the proxy message was actually sent out, so that the response message could not be received during reset. It did not solve the status callback of the proxy sending message, so a new problem was introduced after PR(#28457) merged. bt_mesh_prov_send(&buf, public_key_sent)) This PR will try to solve the above problem, and will fix the problem due to thread competition, and PR(#26668) will not be necessary. Compared with PR(#30138), it no longer consumes extra RAM space and supports synchronization of group addresses Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
This commit is contained in:
parent
a63f2d8d60
commit
7531d2e3c8
5 changed files with 105 additions and 92 deletions
|
@ -1970,11 +1970,27 @@ send_list:
|
|||
}
|
||||
}
|
||||
|
||||
static void reset_send_start(uint16_t duration, int err, void *cb_data)
|
||||
{
|
||||
if (err) {
|
||||
BT_ERR("Sending Node Reset Status failed (err %d)", err);
|
||||
bt_mesh_reset();
|
||||
}
|
||||
}
|
||||
|
||||
static void reset_send_end(int err, void *cb_data)
|
||||
{
|
||||
bt_mesh_reset();
|
||||
}
|
||||
|
||||
static void node_reset(struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
struct net_buf_simple *buf)
|
||||
{
|
||||
static struct bt_mesh_proxy_idle_cb proxy_idle = {.cb = bt_mesh_reset};
|
||||
static const struct bt_mesh_send_cb reset_cb = {
|
||||
.start = reset_send_start,
|
||||
.end = reset_send_end,
|
||||
};
|
||||
|
||||
BT_MESH_MODEL_BUF_DEFINE(msg, OP_NODE_RESET_STATUS, 0);
|
||||
|
||||
|
@ -1982,25 +1998,11 @@ static void node_reset(struct bt_mesh_model *model,
|
|||
ctx->net_idx, ctx->app_idx, ctx->addr, buf->len,
|
||||
bt_hex(buf->data, buf->len));
|
||||
|
||||
|
||||
bt_mesh_model_msg_init(&msg, OP_NODE_RESET_STATUS);
|
||||
|
||||
/* Send the response first since we wont have any keys left to
|
||||
* send it later.
|
||||
*/
|
||||
if (bt_mesh_model_send(model, ctx, &msg, NULL, NULL)) {
|
||||
if (bt_mesh_model_send(model, ctx, &msg, &reset_cb, NULL)) {
|
||||
BT_ERR("Unable to send Node Reset Status");
|
||||
}
|
||||
|
||||
if (!IS_ENABLED(CONFIG_BT_MESH_GATT_PROXY)) {
|
||||
bt_mesh_reset();
|
||||
return;
|
||||
}
|
||||
|
||||
/* If the response goes to a proxy node, we'll wait for the sending to
|
||||
* complete before moving on.
|
||||
*/
|
||||
bt_mesh_proxy_on_idle(&proxy_idle);
|
||||
}
|
||||
|
||||
static void send_friend_status(struct bt_mesh_model *model,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue