You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by na...@apache.org on 2021/05/27 08:19:41 UTC

[mynewt-nimble] 03/31: mesh: Add net transmit status rx in config client

This is an automated email from the ASF dual-hosted git repository.

naraj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git

commit 15d9fd610b046f9c72e6766326d9536cdc3d155c
Author: Krzysztof Kopyściński <kr...@codecoup.pl>
AuthorDate: Mon Mar 29 12:04:32 2021 +0200

    mesh: Add net transmit status rx in config client
    
    Adds an opcode handler for the network transmit status opcode.
    
    this is port of 66699b81708a257f41a3a4572cd67b904b511d01
---
 nimble/host/mesh/src/cfg_cli.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/nimble/host/mesh/src/cfg_cli.c b/nimble/host/mesh/src/cfg_cli.c
index a87cd7b..104d4e6 100644
--- a/nimble/host/mesh/src/cfg_cli.c
+++ b/nimble/host/mesh/src/cfg_cli.c
@@ -136,6 +136,27 @@ static void relay_status(struct bt_mesh_model *model,
 	k_sem_give(&cli->op_sync);
 }
 
+static void net_transmit_status(struct bt_mesh_model *model,
+				struct bt_mesh_msg_ctx *ctx,
+				struct os_mbuf *buf)
+{
+	uint8_t *status;
+
+	BT_DBG("net_idx 0x%04x app_idx 0x%04x src 0x%04x len %u: %s",
+	       ctx->net_idx, ctx->app_idx, ctx->addr, buf->om_len,
+	       bt_hex(buf->om_data, buf->om_len));
+
+	if (cli->op_pending != OP_NET_TRANSMIT_STATUS) {
+		BT_WARN("Unexpected Net Transmit Status message");
+		return;
+	}
+
+	status = cli->op_param;
+	*status = net_buf_simple_pull_u8(buf);
+
+	k_sem_give(&cli->op_sync);
+}
+
 struct net_key_param {
 	uint8_t *status;
 	uint16_t net_idx;
@@ -693,6 +714,7 @@ const struct bt_mesh_model_op bt_mesh_cfg_cli_op[] = {
 	{ OP_FRIEND_STATUS,          1,   friend_status },
 	{ OP_GATT_PROXY_STATUS,      1,   gatt_proxy_status },
 	{ OP_RELAY_STATUS,           2,   relay_status },
+	{ OP_NET_TRANSMIT_STATUS,    1,   net_transmit_status },
 	{ OP_NET_KEY_STATUS,         3,   net_key_status },
 	{ OP_NET_KEY_LIST,           0,   net_key_list },
 	{ OP_APP_KEY_STATUS,         4,   app_key_status },