tools/mesh-gatt: Add onoff set unack message to onoff client model
PATCH 1/6 tools/mesh-gatt: Add onoff set unack message to onoff client model
--- tools/mesh-gatt/onoff-model.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-)
tools/mesh-gatt/onoff-model.c +16 -5
@@ -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 - 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"},
{} },
};
Signature · 1 line
2.25.1
Hi Daniel,
Please add the commit message for each patches.
And the CI bot was not able to apply the patch. Please resubmit after rebasing to the tip.
Regards,
Tedd
Quoted 57 lines · On Fri, 2021-12-03 at 17:02 +0100, [email protected] wrote:
---
tools/mesh-gatt/onoff-model.c | 23 +++++++++++++++++------1 file changed, 17 insertions(+), 6 deletions(-)tools/mesh-gatt/onoff-model.c +2
-0@@ -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");tools/mesh-gatt/onoff-model.c +0
-0@@ -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");
- returnbt_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"); + returnbt_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++;tools/mesh-gatt/onoff-model.c +1
-1@@ -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"},
{} },
};