systemctrl: System Control

This systemctrl application requests additional information from the server of The-Black-Box. It is also possible to restart the server. The gateway is not restarted as a result. A command is specified as a parameter for the application, which then determines the actual function of systemctrl.

Synopsis

Usage: ./systemctrl [options] command
Client app connecting to ‘Black-Box’ device for test purposes.
Options:
-h, --help

Displays help on commandline options.

--help-all

Displays help, including generic Qt options.

-v, --version

Displays version information.

-a, --address <host>

Host address of the gateway [localhost].

-p, --port <port>

Port of the gateway [51955].

-f, --frequency <period>

Frequency (period) of sending in ms [1000]

--debug

Report additional debug info in log.

-s, --severity <level>

Max severity (fatal|error|warning|info|debug|verbose) of log message.

Arguments:

command Command (version|ping|uid|uptime|reboot|status).

Examples

Query Version

This command can be used to query the software version of The-Black-Box server. The version of the message catalog is particularly relevant here in order to avoid errors in communication between the client and server. This command is most suitable for error analysis.

Using ./systemctrl -a blackbox2 -f 0 -s info version outputs the following version info.

2024-05-22 10:52:39.132 NONE  Press Ctrl-C to abort application.
2024-05-22 10:52:39.133 INFO  Try to connect to blackbox2@51955...
2024-05-22 10:52:39.332 INFO  Client is connected...
2024-05-22 10:52:39.333 INFO  Session identifier 1, protocol version 0
2024-05-22 10:52:39.348 INFO  Black-Box version: 1.3.0.
2024-05-22 10:52:39.349 INFO  Build date: 2024-05-20T11:19:49.
2024-05-22 10:52:39.349 INFO  ModelRPC date: 2024-05-06T08:42:01.
2024-05-22 10:52:39.349 INFO  ModelRPC version check ok.

The version contains the version number (e.g. 1.3.0) and the build date of the server application. In addition the ModelRPC communication protocol version is returned. This allows to check if client and server software is compatible.

Ping-Pong Messages

The ping command can be used to measure the runtimes between client and server. The server responds with a pong. This command can be used to analyze any delays in the network between client and server. In the simplest case, the command can be used to check whether the server can be reached in the network at all (for example, to check whether The-Black-Box is switched on).

Note

This ping-pong protocol is implemented at the application layer and does not use the ICMP (e.g. RFC 792) service. Longer runtimes are therefore to be expected in comparison to a ping on the lower IP layer.

This example ./systemctrl -a blackbox2 -f 100 -s info ping ‘pings’ the device with a period of 100 ms.

2024-05-22 10:51:05.712 NONE  Press Ctrl-C to abort application.
2024-05-22 10:51:05.713 INFO  Try to connect to blackbox2@51955...
2024-05-22 10:51:05.733 INFO  Client is connected...
2024-05-22 10:51:05.740 INFO  Session identifier 0, protocol version 0
2024-05-22 10:51:05.744 INFO  Ping was: 3.544 ms.
2024-05-22 10:51:05.842 INFO  Ping was: 2.13 ms.
2024-05-22 10:51:05.943 INFO  Ping was: 2.479 ms.
2024-05-22 10:51:06.050 INFO  Ping was: 9.879 ms.
2024-05-22 10:51:06.142 INFO  Ping was: 2.202 ms.
2024-05-22 10:51:06.242 INFO  Ping was: 2.109 ms.
2024-05-22 10:51:06.342 INFO  Ping was: 2.065 ms.
2024-05-22 10:51:06.442 INFO  Ping was: 2.041 ms.
2024-05-22 10:51:06.542 INFO  Ping was: 2.098 ms.
2024-05-22 10:51:06.642 INFO  Ping was: 2.097 ms.
2024-05-22 10:51:06.742 INFO  Ping was: 2.034 ms.

Query Unique Identifier

Each The-Black-Box has a unique identifier that cannot be changed. This identifier is independent of the hostname, IP or MAC address. Using ./systemctrl -a blackbox2 -f 0 -s info uid returns an unique identifier with a fixed length of 96 bits (12 bytes).

2024-05-22 10:53:48.566 NONE  Press Ctrl-C to abort application.
2024-05-22 10:53:48.567 INFO  Try to connect to blackbox2@51955...
2024-05-22 10:53:48.778 INFO  Client is connected...
2024-05-22 10:53:48.779 INFO  Session identifier 2, protocol version 0
2024-05-22 10:53:48.781 INFO  UID: 320054000150314b43363220 (0032.0054-1-P1K.C62 )

Query Uptime

This command queries the time in milliseconds since the server was last rebooted. The command ./systemctrl -a blackbox2 -f 1000 -s info uptime polls periodically (1s) the internal clock of the server.

2024-05-22 10:55:26.967 NONE  Press Ctrl-C to abort application.
2024-05-22 10:55:26.967 INFO  Try to connect to blackbox2@51955...
2024-05-22 10:55:26.982 INFO  Client is connected...
2024-05-22 10:55:26.983 INFO  Session identifier 4, protocol version 0
2024-05-22 10:55:26.986 INFO  Uptime: 4284229 ms.
2024-05-22 10:55:27.998 INFO  Uptime: 4285229 ms.
2024-05-22 10:55:28.986 INFO  Uptime: 4286228 ms.
2024-05-22 10:55:29.991 INFO  Uptime: 4287228 ms.
2024-05-22 10:55:30.991 INFO  Uptime: 4288227 ms.
2024-05-22 10:55:31.987 INFO  Uptime: 4289227 ms.
2024-05-22 10:55:32.991 INFO  Uptime: 4290226 ms.
2024-05-22 10:55:33.991 INFO  Uptime: 4291225 ms.

Reboot System

This command ./systemctrl -a blackbox2 -f 0 -s info reboot reboots the server. No additional information will be given.

2024-05-22 11:00:23.195 NONE  Press Ctrl-C to abort application.
2024-05-22 11:00:23.195 INFO  Try to connect to blackbox2@51955...
2024-05-22 11:00:23.388 INFO  Client is connected...
2024-05-22 11:00:23.389 INFO  Session identifier 5, protocol version 0

Get System Status

This command /.systemctrl -a blackbox2 -f 0 -s info status can be used to query an extended, internal status of the server.

2024-05-22 11:01:11.474 NONE  Press Ctrl-C to abort application.
2024-05-22 11:01:11.476 INFO  Try to connect to blackbox2@51955...
2024-05-22 11:01:11.562 INFO  Client is connected...
2024-05-22 11:01:11.563 INFO  Session identifier 7, protocol version 0
2024-05-22 11:01:11.566 INFO  System code: 0, Bluetooth code: 0