Diff between 8087cd3db69f96824d6b5c925d39e6aa1b7097d5 and 1a53ed0ca462b02b6fc9117542c455fa626e579d

Changed Files

File Additions Deletions Status
mesh/config-client.c +38 -0 modified

Full Patch

diff --git a/mesh/config-client.c b/mesh/config-client.c
index 80c7fd8..92fca5a 100644
--- a/mesh/config-client.c
+++ b/mesh/config-client.c
@@ -683,6 +683,42 @@ 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[])
+{
+	uint16_t n;
+	uint8_t msg[32];
+	int parm_cnt;
+
+	if (IS_UNASSIGNED(target)) {
+		bt_shell_printf("Destination not set\n");
+		return;
+	}
+
+	n = mesh_opcode_set(OP_CONFIG_MODEL_PUB_GET, msg);
+
+	parm_cnt = read_input_parameters(argc, argv);
+	if (parm_cnt != 2) {
+		bt_shell_printf("Bad arguments: %s\n", argv[1]);
+		return;
+	}
+
+	/* Element Address */
+	put_le16(parms[0], msg + n);
+	n += 2;
+	/* Model Id */
+	if (parms[1] > 0xffff) {
+		put_le16(parms[1] >> 16, msg + n);
+		put_le16(parms[1], msg + n + 2);
+		n += 4;
+	} else {
+		put_le16(parms[1], msg + n);
+		n += 2;
+	}
+
+	if (!config_send(msg, n))
+		bt_shell_printf("Failed to send \"GET MODEL PUBLICATION\"\n");
+}
+
 static void cmd_sub_add(int argc, char *argv[])
 {
 	uint16_t n;
@@ -849,6 +885,8 @@ static const struct bt_shell_menu cfg_menu = {
 	{"pub-set", "<ele_addr> <pub_addr> <app_idx> "
 			"<period (step|res)> <re-xmt (count|per)> <model>",
 				cmd_set_pub,	"Set publication"},
+	{"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>",