Mesh: Add Config Beacon to Configuration Model
This patch adds two commands (set and get) to menu config and handles the
incomming status message.
diff --git a/mesh/config-client.c b/mesh/config-client.c
index edb164b..b6b02ef 100644
--- a/mesh/config-client.c
+++ b/mesh/config-client.c
@@ -179,6 +179,13 @@
mesh_status_str(data[0]));
break;
+ case OP_CONFIG_BEACON_STATUS:
+ if (len != 1)
+ return true;
+ bt_shell_printf("Node %4.4x Config Beacon Status 0x%02x\n",
+ src, data[0]);
+ break;
+
case OP_CONFIG_RELAY_STATUS:
if (len != 2)
return true;
@@ -689,6 +696,38 @@
return bt_shell_noninteractive_quit(EXIT_SUCCESS);
}
+static void cmd_beacon_set(int argc, char *argv[])
+{
+ uint16_t n;
+ uint8_t msg[2 + 1];
+ int parm_cnt;
+
+ if (!verify_config_target(target))
+ return bt_shell_noninteractive_quit(EXIT_FAILURE);
+
+ n = mesh_opcode_set(OP_CONFIG_BEACON_SET, msg);
+
+ parm_cnt = read_input_parameters(argc, argv);
+ if (parm_cnt != 1) {
+ bt_shell_printf("bad arguments\n");
+ return bt_shell_noninteractive_quit(EXIT_FAILURE);
+ }
+
+ msg[n++] = parms[0];
+
+ if (!config_send(msg, n)) {
+ bt_shell_printf("Failed to send \"SET BEACON\"\n");
+ return;
+ }
+
+ return bt_shell_noninteractive_quit(EXIT_SUCCESS);
+}
+
+static void cmd_beacon_get(int argc, char *argv[])
+{
+ cmd_default(OP_CONFIG_BEACON_GET);
+}
+
static void cmd_ident_set(int argc, char *argv[])
{
uint16_t n;
@@ -1177,6 +1216,10 @@
"Set node identity state"},
{"ident-get", "<net_idx>", cmd_ident_get,
"Get node identity state"},
+ {"beacon-set", "<state>", cmd_beacon_set,
+ "Set node identity state"},
+ {"beacon-get", NULL, cmd_beacon_get,
+ "Get node beacon state"},
{"relay-set", "<relay> <rexmt count> <rexmt steps>",
cmd_relay_set,
"Set relay"},