public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: <daniele.biagetti@cblelectronics.com>
To: <linux-bluetooth@vger.kernel.org>
Subject: [PATCH 1/6] tools/mesh-gatt: Add onoff set unack message to onoff client model
Date: Fri, 3 Dec 2021 17:02:10 +0100	[thread overview]
Message-ID: <000501d7e85f$2105e2d0$6311a870$@cblelectronics.com> (raw)

---
 tools/mesh-gatt/onoff-model.c | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/tools/mesh-gatt/onoff-model.c b/tools/mesh-gatt/onoff-model.c
index 9dfedd85a..13ff4bbe3 100644
--- a/tools/mesh-gatt/onoff-model.c
+++ b/tools/mesh-gatt/onoff-model.c
@@ -226,6 +226,8 @@ static void cmd_set(int argc, char *argv[])
 	uint16_t n;
 	uint8_t msg[32];
 	struct mesh_node *node;
+	int np;
+	uint32_t opcode;
 
 	if (IS_UNASSIGNED(target)) {
 		bt_shell_printf("Destination not set\n");
@@ -237,13 +239,22 @@ static void cmd_set(int argc, char *argv[])
 	if (!node)
 		return;
 
-	if ((read_input_parameters(argc, argv) != 1) &&
-					parms[0] != 0 && parms[0] != 1) {
-		bt_shell_printf("Bad arguments: Expecting \"0\" or
\"1\"\n");
-		return bt_shell_noninteractive_quit(EXIT_FAILURE);
+	np = read_input_parameters(argc, argv);
+	if ((np != 1) && (np != 2) &&
+		parms[0] != 0 && parms[0] != 1 &&
+		parms[1] != 0 && parms[1] != 1) {
+	bt_shell_printf("Bad arguments: Expecting \"0\" or \"1\" "
+		"and an optional \"0\" or \"1\" as unack\n");
+	return bt_shell_noninteractive_quit(EXIT_FAILURE);
+	}
+
+	if( (np==2) && parms[1] ){
+		opcode = OP_GENERIC_ONOFF_SET_UNACK;
+	}else{
+		opcode = OP_GENERIC_ONOFF_SET;
 	}
 
-	n = mesh_opcode_set(OP_GENERIC_ONOFF_SET, msg);
+	n = mesh_opcode_set(opcode, msg);
 	msg[n++] = parms[0];
 	msg[n++] = trans_id++;
 
@@ -263,7 +274,7 @@ static const struct bt_shell_menu onoff_menu = {
 						"Set node to configure"},
 	{"get",			NULL,
cmd_get_status,
 						"Get ON/OFF status"},
-	{"onoff",		"<0/1>",			cmd_set,
+	{"onoff",		"<0/1> [unack]",		cmd_set,
 						"Send \"SET ON/OFF\"
command"},
 	{} },
 };
-- 
2.25.1



             reply	other threads:[~2021-12-03 16:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-03 16:02 daniele.biagetti [this message]
2021-12-07  2:34 ` [PATCH 1/6] tools/mesh-gatt: Add onoff set unack message to onoff client model Tedd Ho-Jeong An

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='000501d7e85f$2105e2d0$6311a870$@cblelectronics.com' \
    --to=daniele.biagetti@cblelectronics.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox