All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] mesh: meshctl: Add heartbeat get subscribe and publish
@ 2018-02-05 21:28 Steve Brown
  2018-02-05 21:28 ` [PATCH 2/3] mesh: meshctl: Conform command and function names Steve Brown
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Steve Brown @ 2018-02-05 21:28 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Steve Brown

[config: Target = 0100]# hb-pub-get

Set heartbeat for node 0100 status: Success
Destination:	c000
Count:		00
Period:		00
TTL:		ff
Features:	0000
Net_Idx:	0000

[config: Target = 0100]# hb-sub-get

Heartbeat subscription status for node 0100 status: Success
Source:		0100
Destination:	0100
Period:		00
Count:		00
Min Hops:	7f
Max Hops:	00
---
 mesh/config-client.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/mesh/config-client.c b/mesh/config-client.c
index 6c8c7ee87..bf91aa5de 100644
--- a/mesh/config-client.c
+++ b/mesh/config-client.c
@@ -1006,6 +1006,11 @@ static void cmd_hb_pub_set(int argc, char *argv[])
 		bt_shell_printf("Failed to send \"SET HEARTBEAT PUBLISH\"\n");
 }
 
+static void cmd_hb_pub_get(int argc, char *argv[])
+{
+	cmd_default(OP_CONFIG_HEARTBEAT_PUB_GET);
+}
+
 static void cmd_hb_sub_set(int argc, char *argv[])
 {
 	uint16_t n;
@@ -1039,6 +1044,11 @@ static void cmd_hb_sub_set(int argc, char *argv[])
 		bt_shell_printf("Failed to send \"SET HEARTBEAT SUBSCRIBE\"\n");
 }
 
+static void cmd_hb_sub_get(int argc, char *argv[])
+{
+	cmd_default(OP_CONFIG_HEARTBEAT_SUB_GET);
+}
+
 static void cmd_get_ttl(int argc, char *argv[])
 {
 	cmd_default(OP_CONFIG_DEFAULT_TTL_GET);
@@ -1087,8 +1097,12 @@ static const struct bt_shell_menu cfg_menu = {
 						"Get relay"},
 	{"hb-pub-set", "<pub_addr> <count> <period> <features> <net_idx>",
 				cmd_hb_pub_set,     "Set heartbeat publish"},
+	{"hb-pub-get",           NULL,                   cmd_hb_pub_get,
+						"Get heartbeat publish"},
 	{"hb-sub-set", "<src_addr> <dst_addr> <period>",
 				cmd_hb_sub_set,     "Set heartbeat subscribe"},
+	{"hb-sub-get",           NULL,                   cmd_hb_sub_get,
+						"Get heartbeat subscribe"},
 	{"sub-add", "<ele_addr> <sub_addr> <model id>",
 				cmd_sub_add,    "Subscription add"},
 	{"sub-get", "<ele_addr> <model id>",
-- 
2.14.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] mesh: meshctl: Conform command and function names
  2018-02-05 21:28 [PATCH 1/3] mesh: meshctl: Add heartbeat get subscribe and publish Steve Brown
@ 2018-02-05 21:28 ` Steve Brown
  2018-02-05 21:28 ` [PATCH 3/3] mesh: meshctl: Cleanup status messaging Steve Brown
  2018-02-13 12:09 ` [PATCH 1/3] mesh: meshctl: Add heartbeat get subscribe and publish Johan Hedberg
  2 siblings, 0 replies; 4+ messages in thread
From: Steve Brown @ 2018-02-05 21:28 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Steve Brown

Also improve readability of commands descriptions
---
 mesh/config-client.c | 78 ++++++++++++++++++++++++++--------------------------
 1 file changed, 39 insertions(+), 39 deletions(-)

diff --git a/mesh/config-client.c b/mesh/config-client.c
index bf91aa5de..a0c8fa494 100644
--- a/mesh/config-client.c
+++ b/mesh/config-client.c
@@ -371,7 +371,7 @@ static uint32_t read_input_parameters(int argc, char *argv[])
 	return i;
 }
 
-static void cmd_set_node(int argc, char *argv[])
+static void cmd_node_set(int argc, char *argv[])
 {
 	uint32_t dst;
 	char *end;
@@ -425,7 +425,7 @@ static void cmd_default(uint32_t opcode)
 								opcode);
 }
 
-static void cmd_get_composition(int argc, char *argv[])
+static void cmd_composition_get(int argc, char *argv[])
 {
 	uint16_t n;
 	uint8_t msg[32];
@@ -512,12 +512,12 @@ static void cmd_net_key(int argc, char *argv[], uint32_t opcode)
 
 }
 
-static void cmd_add_net_key(int argc, char *argv[])
+static void cmd_netkey_add(int argc, char *argv[])
 {
 	cmd_net_key(argc, argv, OP_NETKEY_ADD);
 }
 
-static void cmd_del_net_key(int argc, char *argv[])
+static void cmd_netkey_del(int argc, char *argv[])
 {
 	cmd_net_key(argc, argv, OP_NETKEY_DELETE);
 }
@@ -589,12 +589,12 @@ static void cmd_app_key(int argc, char *argv[], uint32_t opcode)
 	}
 }
 
-static void cmd_add_app_key(int argc, char *argv[])
+static void cmd_appkey_add(int argc, char *argv[])
 {
 	cmd_app_key(argc, argv, OP_APPKEY_ADD);
 }
 
-static void cmd_del_app_key(int argc, char *argv[])
+static void cmd_appkey_del(int argc, char *argv[])
 {
 	cmd_app_key(argc, argv, OP_APPKEY_DELETE);
 }
@@ -656,7 +656,7 @@ static void cmd_bind(int argc, char *argv[])
 		bt_shell_printf("Failed to send \"MODEL APP BIND\"\n");
 }
 
-static void cmd_set_ident(int argc, char *argv[])
+static void cmd_ident_set(int argc, char *argv[])
 {
 	uint16_t n;
 	uint8_t msg[2 + 3 + 4];
@@ -681,7 +681,7 @@ static void cmd_set_ident(int argc, char *argv[])
 		bt_shell_printf("Failed to send \"SET IDENTITY\"\n");
 }
 
-static void cmd_get_ident(int argc, char *argv[])
+static void cmd_ident_get(int argc, char *argv[])
 {
 	uint16_t n;
 	uint8_t msg[2 + 2 + 4];
@@ -705,7 +705,7 @@ static void cmd_get_ident(int argc, char *argv[])
 		bt_shell_printf("Failed to send \"GET IDENTITY\"\n");
 }
 
-static void cmd_set_proxy(int argc, char *argv[])
+static void cmd_proxy_set(int argc, char *argv[])
 {
 	uint16_t n;
 	uint8_t msg[2 + 1 + 4];
@@ -729,12 +729,12 @@ static void cmd_set_proxy(int argc, char *argv[])
 		bt_shell_printf("Failed to send \"SET PROXY\"\n");
 }
 
-static void cmd_get_proxy(int argc, char *argv[])
+static void cmd_proxy_get(int argc, char *argv[])
 {
 	cmd_default(OP_CONFIG_PROXY_GET);
 }
 
-static void cmd_set_relay(int argc, char *argv[])
+static void cmd_relay_set(int argc, char *argv[])
 {
 	uint16_t n;
 	uint8_t msg[2 + 2 + 4];
@@ -758,12 +758,12 @@ static void cmd_set_relay(int argc, char *argv[])
 		bt_shell_printf("Failed to send \"SET RELAY\"\n");
 }
 
-static void cmd_get_relay(int argc, char *argv[])
+static void cmd_relay_get(int argc, char *argv[])
 {
 	cmd_default(OP_CONFIG_RELAY_GET);
 }
 
-static void cmd_set_ttl(int argc, char *argv[])
+static void cmd_ttl_set(int argc, char *argv[])
 {
 	uint16_t n;
 	uint8_t msg[32];
@@ -789,7 +789,7 @@ static void cmd_set_ttl(int argc, char *argv[])
 		bt_shell_printf("Failed to send \"SET_DEFAULT TTL\"\n");
 }
 
-static void cmd_set_pub(int argc, char *argv[])
+static void cmd_pub_set(int argc, char *argv[])
 {
 	uint16_t n;
 	uint8_t msg[32];
@@ -834,7 +834,7 @@ static void cmd_set_pub(int argc, char *argv[])
 		bt_shell_printf("Failed to send \"SET MODEL PUBLICATION\"\n");
 }
 
-static void cmd_get_pub(int argc, char *argv[])
+static void cmd_pub_get(int argc, char *argv[])
 {
 	uint16_t n;
 	uint8_t msg[32];
@@ -935,7 +935,7 @@ static void cmd_sub_get(int argc, char *argv[])
 		bt_shell_printf("Failed to send \"GET SUB GET\"\n");
 }
 
-static void cmd_get_app(int argc, char *argv[])
+static void cmd_mod_appidx_get(int argc, char *argv[])
 {
 	uint16_t n;
 	uint8_t msg[32];
@@ -1049,7 +1049,7 @@ static void cmd_hb_sub_get(int argc, char *argv[])
 	cmd_default(OP_CONFIG_HEARTBEAT_SUB_GET);
 }
 
-static void cmd_get_ttl(int argc, char *argv[])
+static void cmd_ttl_get(int argc, char *argv[])
 {
 	cmd_default(OP_CONFIG_DEFAULT_TTL_GET);
 }
@@ -1058,42 +1058,44 @@ static const struct bt_shell_menu cfg_menu = {
 	.name = "config",
 	.desc = "Configuration Model Submenu",
 	.entries = {
-	{"target",		"<unicast>",		cmd_set_node,
+	{"target",		"<unicast>",		cmd_node_set,
 						"Set target node to configure"},
-	{"composition-get",	"[page_num]",		cmd_get_composition,
-						"Get Composition Data"},
-	{"netkey-add",		"<net_idx>",		cmd_add_net_key,
+	{"composition-get",	"[page_num]",		cmd_composition_get,
+						"Get composition data"},
+	{"netkey-add",		"<net_idx>",		cmd_netkey_add,
 						"Add network key"},
-	{"netkey-del",		"<net_idx>",		cmd_del_net_key,
+	{"netkey-del",		"<net_idx>",		cmd_netkey_del,
 						"Delete network key"},
-	{"appkey-add",		"<app_idx>",		cmd_add_app_key,
+	{"appkey-add",		"<app_idx>",		cmd_appkey_add,
 						"Add application key"},
-	{"appkey-del",		"<app_idx>",		cmd_del_app_key,
+	{"appkey-del",		"<app_idx>",		cmd_appkey_del,
 						"Delete application key"},
 	{"bind",		"<ele_idx> <app_idx> <mod_id> [cid]",
 				cmd_bind,	"Bind app key to a model"},
-	{"ttl-set",		"<ttl>",		cmd_set_ttl,
+	{"mod-appidx-get", "<ele_addr> <model id>",
+				cmd_mod_appidx_get,    "Get model app_idx"},
+	{"ttl-set",		"<ttl>",		cmd_ttl_set,
 						"Set default TTL"},
-	{"ttl-get",		NULL,			cmd_get_ttl,
+	{"ttl-get",		NULL,			cmd_ttl_get,
 						"Get default TTL"},
 	{"pub-set", "<ele_addr> <pub_addr> <app_idx> "
 			"<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> <model>",               cmd_get_pub,
+			cmd_pub_set,	"\n\t\t\t\t\t\t  Set publication"},
+	{"pub-get", "<ele_addr> <model>",               cmd_pub_get,
 						"Get publication"},
-	{"proxy-set",           "<proxy>",              cmd_set_proxy,
+	{"proxy-set",           "<proxy>",              cmd_proxy_set,
 						"Set proxy state"},
-	{"proxy-get",           NULL,                   cmd_get_proxy,
+	{"proxy-get",           NULL,                   cmd_proxy_get,
 						"Get proxy state"},
-	{"ident-set",           "<net_idx> <state>",    cmd_set_ident,
+	{"ident-set",           "<net_idx> <state>",    cmd_ident_set,
 						"Set node identity state"},
-	{"ident-get",           "<net_idx>",            cmd_get_ident,
+	{"ident-get",           "<net_idx>",            cmd_ident_get,
 						"Get node identity state"},
 	{"relay-set",           "<relay> <rexmt count> <rexmt steps>",
-						cmd_set_relay,
+						cmd_relay_set,
 						"Set relay"},
-	{"relay-get",           NULL,                   cmd_get_relay,
+	{"relay-get",           NULL,                   cmd_relay_get,
 						"Get relay"},
 	{"hb-pub-set", "<pub_addr> <count> <period> <features> <net_idx>",
 				cmd_hb_pub_set,     "Set heartbeat publish"},
@@ -1104,11 +1106,9 @@ static const struct bt_shell_menu cfg_menu = {
 	{"hb-sub-get",           NULL,                   cmd_hb_sub_get,
 						"Get heartbeat subscribe"},
 	{"sub-add", "<ele_addr> <sub_addr> <model id>",
-				cmd_sub_add,    "Subscription add"},
+				cmd_sub_add,    "Add subscription"},
 	{"sub-get", "<ele_addr> <model id>",
-				cmd_sub_get,    "Subscription get"},
-	{"app-get", "<ele_addr> <model id>",
-				cmd_get_app,    "Get App Keys"},
+				cmd_sub_get,    "Get subscription"},
 	{} },
 };
 
@@ -1117,7 +1117,7 @@ void config_client_get_composition(uint32_t dst)
 	uint32_t tmp = target;
 
 	target = dst;
-	cmd_get_composition(0, NULL);
+	cmd_composition_get(0, NULL);
 	target = tmp;
 }
 
-- 
2.14.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] mesh: meshctl: Cleanup status messaging
  2018-02-05 21:28 [PATCH 1/3] mesh: meshctl: Add heartbeat get subscribe and publish Steve Brown
  2018-02-05 21:28 ` [PATCH 2/3] mesh: meshctl: Conform command and function names Steve Brown
@ 2018-02-05 21:28 ` Steve Brown
  2018-02-13 12:09 ` [PATCH 1/3] mesh: meshctl: Add heartbeat get subscribe and publish Johan Hedberg
  2 siblings, 0 replies; 4+ messages in thread
From: Steve Brown @ 2018-02-05 21:28 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Steve Brown

Remove redundant status tests
  mesh_status_str() also decodes MESH_STATUS_SUCCESS
Regularize text in status messages
Add helper function to print model id
---
 mesh/config-client.c | 165 +++++++++++++++++++++++++--------------------------
 1 file changed, 82 insertions(+), 83 deletions(-)

diff --git a/mesh/config-client.c b/mesh/config-client.c
index a0c8fa494..6b2132657 100644
--- a/mesh/config-client.c
+++ b/mesh/config-client.c
@@ -49,6 +49,23 @@
 
 #define MIN_COMPOSITION_LEN 16
 
+static uint32_t print_mod_id(uint8_t *data, bool vid)
+{
+	uint32_t mod_id;
+
+	if (!vid) {
+		mod_id = get_le16(data);
+		bt_shell_printf("Model Id\t%4.4x\n", mod_id);
+		mod_id = 0xffff0000 | mod_id;
+	} else {
+		mod_id = get_le16(data + 2);
+		bt_shell_printf("Model Id\t%4.4x %4.4x\n",
+				get_le16(data), mod_id);
+		mod_id = get_le16(data) << 16 | mod_id;
+	}
+	return mod_id;
+}
+
 static bool client_msg_recvd(uint16_t src, uint8_t *data,
 				uint16_t len, void *user_data)
 {
@@ -101,12 +118,13 @@ static bool client_msg_recvd(uint16_t src, uint8_t *data,
 		if (len != 4)
 			break;
 
-		bt_shell_printf("Node %4.4x AppKey Status %s\n", src,
+		bt_shell_printf("Node %4.4x AppKey status %s\n", src,
 						mesh_status_str(data[0]));
 		net_idx = get_le16(data + 1) & 0xfff;
 		app_idx = get_le16(data + 2) >> 4;
 
-		bt_shell_printf("\tNetKey %3.3x, AppKey %3.3x\n", net_idx, app_idx);
+		bt_shell_printf("NetKey\t%3.3x\n", net_idx);
+		bt_shell_printf("AppKey\t%3.3x\n", app_idx);
 
 		if (data[0] != MESH_STATUS_SUCCESS &&
 				data[0] != MESH_STATUS_IDX_ALREADY_STORED &&
@@ -119,7 +137,7 @@ static bool client_msg_recvd(uint16_t src, uint8_t *data,
 		if (len != 3)
 			break;
 
-		bt_shell_printf("Node %4.4x NetKey Status %s\n", src,
+		bt_shell_printf("Node %4.4x NetKey status %s\n", src,
 						mesh_status_str(data[0]));
 		net_idx = get_le16(data + 1) & 0xfff;
 
@@ -136,23 +154,16 @@ static bool client_msg_recvd(uint16_t src, uint8_t *data,
 		if (len != 7 && len != 9)
 			break;
 
-		bt_shell_printf("Node %4.4x Model App Status %s\n", src,
+		bt_shell_printf("Node %4.4x Model App status %s\n", src,
 						mesh_status_str(data[0]));
 		addr = get_le16(data + 1);
 		app_idx = get_le16(data + 3);
 
-		bt_shell_printf("\tElement %4.4x AppIdx %3.3x\n ", addr, app_idx);
-
-		if (len == 7) {
-			mod_id = get_le16(data + 5);
-			bt_shell_printf("ModelId %4.4x\n", mod_id);
-			mod_id = 0xffff0000 | mod_id;
-		} else {
-			mod_id = get_le16(data + 7);
-			bt_shell_printf("ModelId %4.4x %4.4x\n", get_le16(data + 5),
-									mod_id);
-			mod_id = get_le16(data + 5) << 16 | mod_id;
-		}
+		bt_shell_printf("Element Addr\t%4.4x\n", addr);
+
+		mod_id = print_mod_id(data + 5, (len == 9) ? true : false);
+
+		bt_shell_printf("AppIdx\t\t%3.3x\n ", app_idx);
 
 		if (data[0] == MESH_STATUS_SUCCESS &&
 			node_add_binding(node, addr - src, mod_id, app_idx))
@@ -162,8 +173,8 @@ static bool client_msg_recvd(uint16_t src, uint8_t *data,
 	case OP_NODE_IDENTITY_STATUS:
 		if (len != 4)
 			return true;
-		bt_shell_printf("Network index 0x%04x has "
-				"Node Identity state 0x%02x %s\n",
+		bt_shell_printf("Network index 0x%04x "
+				"Node Identity state 0x%02x status %s\n",
 				get_le16(data + 1), data[3],
 				mesh_status_str(data[0]));
 		break;
@@ -171,15 +182,15 @@ static bool client_msg_recvd(uint16_t src, uint8_t *data,
 	case OP_CONFIG_RELAY_STATUS:
 		if (len != 2)
 			return true;
-		bt_shell_printf("Node %4.4x Relay state: 0x%02x"
-				" count: %d steps: %d\n",
+		bt_shell_printf("Node %4.4x Relay state 0x%02x"
+				" count %d steps %d\n",
 				src, data[0], data[1]>>5, data[1] & 0x1f);
 		break;
 
 	case OP_CONFIG_PROXY_STATUS:
 		if (len != 1)
 			return true;
-		bt_shell_printf("Node %4.4x Proxy state: 0x%02x\n",
+		bt_shell_printf("Node %4.4x Proxy state 0x%02x\n",
 				src, data[0]);
 		break;
 
@@ -195,45 +206,42 @@ static bool client_msg_recvd(uint16_t src, uint8_t *data,
 		if (len != 12 && len != 14)
 			return true;
 
-		bt_shell_printf("\nSet publication for node %4.4x status: %s\n",
-				src, data[0] == MESH_STATUS_SUCCESS ?
-				"Success" : mesh_status_str(data[0]));
+		bt_shell_printf("\nNode %4.4x Publication status %s\n",
+				src, mesh_status_str(data[0]));
 
 		if (data[0] != MESH_STATUS_SUCCESS)
 			return true;
 
 		ele_addr = get_le16(data + 1);
-		mod_id = get_le16(data + 10);
-		if (len == 14)
-			mod_id = (mod_id << 16)  | get_le16(data + 12);
-		else
-			mod_id |= 0xffff0000;
+
+		bt_shell_printf("Element Addr\t%04x\n", ele_addr);
+
+		mod_id = print_mod_id(data + 10, (len == 14) ? true : false);
 
 		pub.u.addr16 = get_le16(data + 3);
 		pub.app_idx = get_le16(data + 5);
 		pub.ttl = data[7];
 		pub.period = data[8];
 		n = (data[8] & 0x3f);
-		bt_shell_printf("Publication address: 0x%04x\n", pub.u.addr16);
+		bt_shell_printf("Pub Addr\t%04x\n", pub.u.addr16);
 		switch (data[8] >> 6) {
 		case 0:
-			bt_shell_printf("Period: %d ms\n", n * 100);
+			bt_shell_printf("Period\t\t%d ms\n", n * 100);
 			break;
 		case 2:
 			n *= 10;
 			/* fall through */
 		case 1:
-			bt_shell_printf("Period: %d sec\n", n);
+			bt_shell_printf("Period\t\t%d sec\n", n);
 			break;
 		case 3:
-			bt_shell_printf("Period: %d min\n", n * 10);
+			bt_shell_printf("Period\t\t%d min\n", n * 10);
 			break;
 		}
 
 		pub.retransmit = data[9];
-		bt_shell_printf("Retransmit count: %d\n", data[9] >> 5);
-		bt_shell_printf("Retransmit Interval Steps: %d\n",
-				data[9] & 0x1f);
+		bt_shell_printf("Rexmit count\t%d\n", data[9] >> 5);
+		bt_shell_printf("Rexmit steps\t%d\n", data[9] & 0x1f);
 
 		ele_idx = ele_addr - node_get_primary(node);
 
@@ -248,17 +256,17 @@ static bool client_msg_recvd(uint16_t src, uint8_t *data,
 
 	/* Per Mesh Profile 4.3.2.19 */
 	case OP_CONFIG_MODEL_SUB_STATUS:
-		bt_shell_printf("\nSubscription changed"
-				" for node %4.4x status: %s\n", src,
-				data[0] == MESH_STATUS_SUCCESS ? "Success" :
-						mesh_status_str(data[0]));
+		bt_shell_printf("\nNode %4.4x Subscription status %s\n",
+				src, mesh_status_str(data[0]));
 
 		if (data[0] != MESH_STATUS_SUCCESS)
 			return true;
 
-		bt_shell_printf("Element Addr:\t%4.4x\n", get_le16(data + 1));
-		bt_shell_printf("Subscr Addr:\t%4.4x\n", get_le16(data + 3));
-		bt_shell_printf("Model ID:\t%4.4x\n", get_le16(data + 5));
+		bt_shell_printf("Element Addr\t%4.4x\n", get_le16(data + 1));
+
+		mod_id = print_mod_id(data + 5, (len == 9) ? true : false);
+
+		bt_shell_printf("Subscr Addr\t%4.4x\n", get_le16(data + 3));
 		break;
 
 		/* TODO */
@@ -267,76 +275,67 @@ static bool client_msg_recvd(uint16_t src, uint8_t *data,
 	/* Per Mesh Profile 4.3.2.27 */
 	case OP_CONFIG_MODEL_SUB_LIST:
 
-		bt_shell_printf("\nSubscription list for node %4.4x "
-				"length: %u status: %s\n", src, len,
-				data[0] == MESH_STATUS_SUCCESS ? "Success" :
-						mesh_status_str(data[0]));
+		bt_shell_printf("\nNode %4.4x Subscription List status %s\n",
+				src, mesh_status_str(data[0]));
 
 		if (data[0] != MESH_STATUS_SUCCESS)
 			return true;
 
-		bt_shell_printf("Element Addr:\t%4.4x\n", get_le16(data + 1));
-		bt_shell_printf("Model ID:\t%4.4x\n", get_le16(data + 3));
+		bt_shell_printf("Element Addr\t%4.4x\n", get_le16(data + 1));
+		bt_shell_printf("Model ID\t%4.4x\n", get_le16(data + 3));
 
 		for (i = 5; i < len; i += 2)
-			bt_shell_printf("Subscr Addr:\t%4.4x\n",
+			bt_shell_printf("Subscr Addr\t%4.4x\n",
 					get_le16(data + i));
 		break;
 
 	/* Per Mesh Profile 4.3.2.50 */
 	case OP_MODEL_APP_LIST:
-		bt_shell_printf("\nModel App Key list for node %4.4x "
-				"length: %u status: %s\n", src, len,
-				data[0] == MESH_STATUS_SUCCESS ? "Success" :
-						mesh_status_str(data[0]));
+		bt_shell_printf("\nNode %4.4x Model AppIdx "
+				"status %s\n", src,
+				mesh_status_str(data[0]));
 
 		if (data[0] != MESH_STATUS_SUCCESS)
 			return true;
 
-		bt_shell_printf("Element Addr:\t%4.4x\n", get_le16(data + 1));
-		bt_shell_printf("Model ID:\t%4.4x\n", get_le16(data + 3));
+		bt_shell_printf("Element Addr\t%4.4x\n", get_le16(data + 1));
+		bt_shell_printf("Model ID\t%4.4x\n", get_le16(data + 3));
 
 		for (i = 5; i < len; i += 2)
-			bt_shell_printf("Model App Key:\t%4.4x\n",
+			bt_shell_printf("Model AppIdx\t%4.4x\n",
 					get_le16(data + i));
 		break;
 
 	/* Per Mesh Profile 4.3.2.63 */
 	case OP_CONFIG_HEARTBEAT_PUB_STATUS:
-		bt_shell_printf("\nHeartbeat publication status for "
-				"node %4.4x status: %s\n",
-				src,
-				data[0] == MESH_STATUS_SUCCESS ? "Success" :
-						mesh_status_str(data[0]));
+		bt_shell_printf("\nNode %4.4x Heartbeat publish status %s\n",
+				src, mesh_status_str(data[0]));
 
 		if (data[0] != MESH_STATUS_SUCCESS)
 			return true;
 
-		bt_shell_printf("Destination:\t%4.4x\n", get_le16(data + 1));
-		bt_shell_printf("Count:\t\t%2.2x\n", data[3]);
-		bt_shell_printf("Period:\t\t%2.2x\n", data[4]);
-		bt_shell_printf("TTL:\t\t%2.2x\n", data[5]);
-		bt_shell_printf("Features:\t%4.4x\n", get_le16(data + 6));
-		bt_shell_printf("Net_Idx:\t%4.4x\n", get_le16(data + 8));
+		bt_shell_printf("Destination\t%4.4x\n", get_le16(data + 1));
+		bt_shell_printf("Count\t\t%2.2x\n", data[3]);
+		bt_shell_printf("Period\t\t%2.2x\n", data[4]);
+		bt_shell_printf("TTL\t\t%2.2x\n", data[5]);
+		bt_shell_printf("Features\t%4.4x\n", get_le16(data + 6));
+		bt_shell_printf("Net_Idx\t%4.4x\n", get_le16(data + 8));
 		break;
 
 	/* Per Mesh Profile 4.3.2.66 */
 	case OP_CONFIG_HEARTBEAT_SUB_STATUS:
-		bt_shell_printf("\nHeartbeat subscription status for "
-				"node %4.4x status: %s\n",
-				src,
-				data[0] == MESH_STATUS_SUCCESS ? "Success" :
-						mesh_status_str(data[0]));
+		bt_shell_printf("\nNode %4.4x Heartbeat subscribe status %s\n",
+				src, mesh_status_str(data[0]));
 
 		if (data[0] != MESH_STATUS_SUCCESS)
 			return true;
 
-		bt_shell_printf("Source:\t\t%4.4x\n", get_le16(data + 1));
-		bt_shell_printf("Destination:\t%4.4x\n", get_le16(data + 3));
-		bt_shell_printf("Period:\t\t%2.2x\n", data[5]);
-		bt_shell_printf("Count:\t\t%2.2x\n", data[6]);
-		bt_shell_printf("Min Hops:\t%2.2x\n", data[7]);
-		bt_shell_printf("Max Hops:\t%2.2x\n", data[8]);
+		bt_shell_printf("Source\t\t%4.4x\n", get_le16(data + 1));
+		bt_shell_printf("Destination\t%4.4x\n", get_le16(data + 3));
+		bt_shell_printf("Period\t\t%2.2x\n", data[5]);
+		bt_shell_printf("Count\t\t%2.2x\n", data[6]);
+		bt_shell_printf("Min Hops\t%2.2x\n", data[7]);
+		bt_shell_printf("Max Hops\t%2.2x\n", data[8]);
 		break;
 	}
 
@@ -482,7 +481,7 @@ static void cmd_net_key(int argc, char *argv[], uint32_t opcode)
 
 		key = keys_net_key_get(net_idx, true);
 		if (!key) {
-			bt_shell_printf("Network key with index %4.4x not found\n",
+			bt_shell_printf("NetKey with index %4.4x not found\n",
 								net_idx);
 			return;
 		}
@@ -552,7 +551,7 @@ static void cmd_app_key(int argc, char *argv[], uint32_t opcode)
 	app_idx = parms[0];
 	net_idx = keys_app_key_get_bound(app_idx);
 	if (net_idx == NET_IDX_INVALID) {
-		bt_shell_printf("App key with index %4.4x not found\n", app_idx);
+		bt_shell_printf("AppKey with index %4.4x not found\n", app_idx);
 		return;
 	}
 
@@ -564,7 +563,7 @@ static void cmd_app_key(int argc, char *argv[], uint32_t opcode)
 	if (opcode != OP_APPKEY_DELETE) {
 		key = keys_app_key_get(app_idx, true);
 		if (!key) {
-			bt_shell_printf("App key %4.4x not found\n", net_idx);
+			bt_shell_printf("AppKey %4.4x not found\n", net_idx);
 			return;
 		}
 
@@ -811,7 +810,7 @@ static void cmd_pub_set(int argc, char *argv[])
 	/* Publish address */
 	put_le16(parms[1], msg + n);
 	n += 2;
-	/* App key index + credential (set to 0) */
+	/* AppKey index + credential (set to 0) */
 	put_le16(parms[2], msg + n);
 	n += 2;
 	/* TTL */
-- 
2.14.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/3] mesh: meshctl: Add heartbeat get subscribe and publish
  2018-02-05 21:28 [PATCH 1/3] mesh: meshctl: Add heartbeat get subscribe and publish Steve Brown
  2018-02-05 21:28 ` [PATCH 2/3] mesh: meshctl: Conform command and function names Steve Brown
  2018-02-05 21:28 ` [PATCH 3/3] mesh: meshctl: Cleanup status messaging Steve Brown
@ 2018-02-13 12:09 ` Johan Hedberg
  2 siblings, 0 replies; 4+ messages in thread
From: Johan Hedberg @ 2018-02-13 12:09 UTC (permalink / raw)
  To: Steve Brown; +Cc: linux-bluetooth

Hi Steve,

On Mon, Feb 05, 2018, Steve Brown wrote:
> [config: Target = 0100]# hb-pub-get
> 
> Set heartbeat for node 0100 status: Success
> Destination:	c000
> Count:		00
> Period:		00
> TTL:		ff
> Features:	0000
> Net_Idx:	0000
> 
> [config: Target = 0100]# hb-sub-get
> 
> Heartbeat subscription status for node 0100 status: Success
> Source:		0100
> Destination:	0100
> Period:		00
> Count:		00
> Min Hops:	7f
> Max Hops:	00
> ---
>  mesh/config-client.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)

All three patches in this set have been applied upstream. Thanks.

Johan

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-02-13 12:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-05 21:28 [PATCH 1/3] mesh: meshctl: Add heartbeat get subscribe and publish Steve Brown
2018-02-05 21:28 ` [PATCH 2/3] mesh: meshctl: Conform command and function names Steve Brown
2018-02-05 21:28 ` [PATCH 3/3] mesh: meshctl: Cleanup status messaging Steve Brown
2018-02-13 12:09 ` [PATCH 1/3] mesh: meshctl: Add heartbeat get subscribe and publish Johan Hedberg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.