All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] meshctl: Subscription Delete message added to configuration client
@ 2019-05-16 14:35 Daniele Biagetti
  2019-05-20  4:15 ` Stotland, Inga
  0 siblings, 1 reply; 2+ messages in thread
From: Daniele Biagetti @ 2019-05-16 14:35 UTC (permalink / raw)
  To: linux-bluetooth

Subscription delete command/message added to the 
configuration client model.

Signed-off-by: Daniele Biagetti <daniele.biagetti@cblelectronics.com>

---
 tools/mesh/config-client.c | 40 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/tools/mesh/config-client.c b/tools/mesh/config-client.c
index df2643622..bff38e7a3 100644
--- a/tools/mesh/config-client.c
+++ b/tools/mesh/config-client.c
@@ -1042,6 +1042,44 @@ static void cmd_sub_get(int argc, char *argv[])
 	return bt_shell_noninteractive_quit(EXIT_SUCCESS);
 }
 
+static void cmd_sub_del(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 bt_shell_noninteractive_quit(EXIT_FAILURE);
+        }
+
+        n = mesh_opcode_set(OP_CONFIG_MODEL_SUB_DELETE, msg);
+
+        parm_cnt = read_input_parameters(argc, argv);
+        if (parm_cnt != 3) {
+                bt_shell_printf("Bad arguments: %s\n", argv[1]);
+                return bt_shell_noninteractive_quit(EXIT_FAILURE);
+        }
+
+        /* Per Mesh Profile 4.3.2.19 */
+        /* Element Address */
+        put_le16(parms[0], msg + n);
+        n += 2;
+        /* Subscription Address */
+        put_le16(parms[1], msg + n);
+        n += 2;
+        /* SIG Model ID */
+        put_le16(parms[2], msg + n);
+        n += 2;
+
+        if (!config_send(msg, n)) {
+                bt_shell_printf("Failed to send \"ADD SUBSCRIPTION\"\n");
+                return bt_shell_noninteractive_quit(EXIT_FAILURE);
+        }
+
+        return bt_shell_noninteractive_quit(EXIT_SUCCESS);
+}
+
 static void cmd_mod_appidx_get(int argc, char *argv[])
 {
 	uint16_t n;
@@ -1237,6 +1275,8 @@ static const struct bt_shell_menu cfg_menu = {
 				cmd_sub_add,    "Add subscription"},
 	{"sub-get", "<ele_addr> <model id>",
 				cmd_sub_get,    "Get subscription"},
+	{"sub-del", "<ele_addr> <sub_addr> <model id>",
+				cmd_sub_del,    "Delete subscription"},
 	{"node-reset",		NULL,                    cmd_node_reset,
 				"Reset a node and remove it from network"},
 	{} },
-- 
2.19.2.windows.1



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

end of thread, other threads:[~2019-05-20  4:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-16 14:35 [PATCH 1/4] meshctl: Subscription Delete message added to configuration client Daniele Biagetti
2019-05-20  4:15 ` Stotland, Inga

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.