[PATCH Bluez v2] tools/mesh-cfgclient: add network transmit get/set commands

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add network-transmit-get and network-transmit-set commands as per
Mesh Profile 4.3.2.69, 4.3.2.70 and 4.3.2.71.
---
 tools/mesh/cfgcli.c | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

Changes v1 -> v2:
 - Fix the cnt/steps fields ordering

diff --git a/tools/mesh/cfgcli.c b/tools/mesh/cfgcli.c
index a4de42943..04edc706c 100644
--- a/tools/mesh/cfgcli.c
+++ b/tools/mesh/cfgcli.c
@@ -621,6 +621,15 @@ static bool msg_recvd(uint16_t src, uint16_t idx, uint8_t *data,
 				src, mesh_status_str(data[0]));
 
 		break;
+
+	/* Per Mesh Profile 4.3.2.71 */
+	case OP_CONFIG_NETWORK_TRANSMIT_STATUS:
+		if (len != 1)
+			return true;
+
+		bt_shell_printf("Node %4.4x: Network transmit cnt %d, steps %d\n",
+				src, data[0] & 7, data[0] >> 3);
+		break;
 	}
 
 	return true;
@@ -1334,6 +1343,33 @@ static void cmd_node_reset(int argc, char *argv[])
 	cmd_default(OP_NODE_RESET);
 }
 
+static void cmd_network_transmit_get(int argc, char *argv[])
+{
+	cmd_default(OP_CONFIG_NETWORK_TRANSMIT_GET);
+}
+
+static void cmd_network_transmit_set(int argc, char *argv[])
+{
+	uint16_t n;
+	uint8_t msg[2 + 1];
+	int parm_cnt;
+
+	n = mesh_opcode_set(OP_CONFIG_NETWORK_TRANSMIT_SET, msg);
+
+	parm_cnt = read_input_parameters(argc, argv);
+	if (parm_cnt != 2) {
+		bt_shell_printf("bad arguments\n");
+		return bt_shell_noninteractive_quit(EXIT_FAILURE);
+	}
+
+	msg[n++] = parms[0] | (parms[1] << 3);
+
+	if (!config_send(msg, n, OP_CONFIG_NETWORK_TRANSMIT_SET))
+		return bt_shell_noninteractive_quit(EXIT_FAILURE);
+
+	return bt_shell_noninteractive_quit(EXIT_SUCCESS);
+}
+
 static bool tx_setup(model_send_msg_func_t send_func, void *user_data)
 {
 	if (!send_func)
@@ -1414,6 +1450,10 @@ static const struct bt_shell_menu cfg_menu = {
 				"Get subscription"},
 	{"node-reset", NULL, cmd_node_reset,
 				"Reset a node and remove it from network"},
+	{"network-transmit-get", NULL, cmd_network_transmit_get,
+				"Get network transmit state"},
+	{"network-transmit-set", "<count> <steps>", cmd_network_transmit_set,
+				"Set network transmit state"},
 	{} },
 };
 
-- 
2.24.0




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux