[PATCH V3 9/9] mesh: meshctl: Add Company ID parameter to pub-set and pub-get

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

 



From: Steve Brown <sbrown@xxxxxxxxxxxx>

Add a CID parameter to both commands similar to bind.
Correct the prior assumption that a model id > 0xffff
was a vendor model.

pub-set 0100 c000 1 0 0 1000
03 0001 00c0 01 00 ff 00 00 0010

pub-set 0100 c000 1 0 0 1000 1
03 0001 00c0 01 00 ff 00 00 0100 0010
---
 mesh/config-client.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/mesh/config-client.c b/mesh/config-client.c
index 0118b1853..0f197e322 100644
--- a/mesh/config-client.c
+++ b/mesh/config-client.c
@@ -780,7 +780,7 @@ static void cmd_set_pub(int argc, char *argv[])
 	n = mesh_opcode_set(OP_CONFIG_MODEL_PUB_SET, msg);
 
 	parm_cnt = read_input_parameters(argc, argv);
-	if (parm_cnt != 6) {
+	if (parm_cnt != 6 && parm_cnt != 7) {
 		bt_shell_printf("Bad arguments\n");
 		return;
 	}
@@ -800,8 +800,8 @@ static void cmd_set_pub(int argc, char *argv[])
 	/* Publish retransmit count & interval steps */
 	msg[n++] = parms[4];
 	/* Model Id */
-	if (parms[5] > 0xffff) {
-		put_le16(parms[5] >> 16, msg + n);
+	if (parm_cnt == 7) {
+		put_le16(parms[6], msg + n);
 		put_le16(parms[5], msg + n + 2);
 		n += 4;
 	} else {
@@ -827,7 +827,7 @@ static void cmd_get_pub(int argc, char *argv[])
 	n = mesh_opcode_set(OP_CONFIG_MODEL_PUB_GET, msg);
 
 	parm_cnt = read_input_parameters(argc, argv);
-	if (parm_cnt != 2) {
+	if (parm_cnt != 2 && parm_cnt != 3) {
 		bt_shell_printf("Bad arguments: %s\n", argv[1]);
 		return;
 	}
@@ -836,8 +836,8 @@ static void cmd_get_pub(int argc, char *argv[])
 	put_le16(parms[0], msg + n);
 	n += 2;
 	/* Model Id */
-	if (parms[1] > 0xffff) {
-		put_le16(parms[1] >> 16, msg + n);
+	if (parm_cnt == 3) {
+		put_le16(parms[2], msg + n);
 		put_le16(parms[1], msg + n + 2);
 		n += 4;
 	} else {
@@ -1012,8 +1012,11 @@ static const struct bt_shell_menu cfg_menu = {
 	{"ttl-get",		NULL,			cmd_get_ttl,
 						"Get default TTL"},
 	{"pub-set", "<ele_addr> <pub_addr> <app_idx> "
-			"<period (step|res)> <re-xmt (count|per)> <model>",
-				cmd_set_pub,	"Set publication"},
+			"<per (step|res)> <re-xmt (cnt|per)> <mod id> "
+			"[cid]",
+			cmd_set_pub,	"\n\t\t\t\t\t\t  Set publication"},
+	{"pub-get", "<ele_addr> <mod id> [cid]",		cmd_get_pub,
+						"Get publication"},
 	{"proxy-set",		"<proxy>",		cmd_set_proxy,
 						"Set proxy state"},
 	{"proxy-get",		NULL,			cmd_get_proxy,
@@ -1027,8 +1030,6 @@ static const struct bt_shell_menu cfg_menu = {
 						"Set relay"},
 	{"relay-get",		NULL,			cmd_get_relay,
 						"Get relay"},
-	{"pub-get", "<ele_addr> <model>",		cmd_get_pub,
-						"Get publication"},
 	{"hb-pub-set", "<pub_addr> <count> <period> <features> <net_idx>",
 				cmd_set_hb,     "Set heartbeati publish"},
 	{"sub-add", "<ele_addr> <sub_addr> <model id>",
-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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