-
Notifications
You must be signed in to change notification settings - Fork 2
DesktopUI
Although the primary development interface for the WIBL logger is typically a UART to USB converter attached to a system running VSCode and PlatformIO, it is often more convenient in practice to use a GUI to talk to the logger. To do so, first ensure that the logger is running the web-server interface:
-
While attached to the logger, use the
configure
command to make sure that the webserver is configured on; you should see a line that sayswebserver on
followed by three numbers. If this is not the case, configure it on withwebserver on 20 5 5
. -
Take note of the SSID and password for the Access Point (AP) WiFi network from the
configure
command output. Set them with commandsssid ap name
andpassword ap name
if they are not set (they will default towibl-config
andwibl-config-password
otherwise). -
Make sure that the WiFi is set to access point mode in the
configure
output. Use thewireless accesspoint
command if this is not the case. -
Reboot the logger with
restart
. -
Connect your development computer to the SSID noted above, with the associated password. If you're monitoring the serial output of the logger, you should see information messages indicating that an IP address has been assigned to your computer. Typically, it's 192.168.4.2.
-
Start the desktop GUI with
python main.py
in theDesktopUI
directory in the distribution, or through VSCode. Note that you may need some requirements beyond those installed for the main WIBL Python package to make this run.
Note that since firmware 1.4.0, the logger has a compiled-in configuration that will turn on web server by default with a well-known SSID and password; see LoggerFirmware/src/boot_config.json
and the LoggerFirmware/src/json2cstring.py
code to convert this into the form required for the LoggerFirmware/src/Configuration.cpp
code.
(Note that since firmware 1.5.0, the logger runs its own internal website which will provide JavaScript to the browser to carry out most of the functionality that the Desktop GUI provides. Since the website is the dominant interface for field use, it tends to be updated first, and the Desktop GUI follows; see here for more details.)
The main window provides overall control for where to find the server (the defaults are the normal configuration for an ESP32 system in AP mode), and to pass commands to the logger, along with some buttons to access specific functionality.
Any text entered into the "Command" widget is passed to the logger as if it had been typed on the serial console connection; any output from the logger is displayed in the "Output" widget. Note that the format of the output might be different from that observed on the serial console connection: the logger keeps track of where its commands came from and alters the formatting as required. Typically, this is to provide information on the WiFi interface that can be translated more easily in software.
The "Status" button executes the status
command, and then parses the output to provide a more compact representation of the information. The "Restart" button executes the restart
command, rebooting the logger. Note that this will cut off the WiFi network that your development computer is attached to, and therefore you may need to rejoin the network once the logger has completed rebooting, depending on the settings of your system.
The remaining buttons bring up separate windows with additional functionality, described below.
The Setup Window provides an interface to the summary configuration information generated by the setup
command, which is managed through JSON files. The default configuration is set by the DesktopUI/assets/default_config.json
file, which can be edited with any appropriate text editor.
For most uses, the primary defaults should be sufficient. However, since each logger needs to have a unique identifier that's maintained throughout its lifetime, the "Generate UUID" button is provided to generate a UUID4 string to use for the logger. By default this is prefixed with "UNHJHC", the CCOM/JHC provider ID for talking with DCDB. You should, of course, set this to your own provider ID.
The check-boxes in the "Options" frame control the features being used by the logger; the NMEA0183, NMEA2000, and IMU controls enable logging of the respective interface's data. The Emergency Power Monitor controls whether the logger attempts to detect loss of main power to trigger a safe shutdown. The SD/MMC Memory Controller should not be used except in very special circumstances (in short, it changes which memory interface is used for the SD card, and will cause chaos if you set it incorrectly). The Webserver option determines whether the webserver starts at boot time or not.
By default, the logger will establish its own WiFi network, acting as an access point (Mode AP). You can, if necessary, have the logger join an established network (Mode Station). If in station mode, the logger will attempt to join the designated network several times (Retry Count), with a delay between each attempt (Retry Delay), assuming that the attempt has failed if it is not given an IP addres within a given time (Join Timeout). After all attempts are exhausted, the code will revert to AP mode and reboot the logger to avoid it becoming uncommunicative permanently. The logger will also attempt to rejoin networks which disappear (e.g., due to a power cycle on the host platform), but will again return to AP mode if it cannot find the network in the given time.
The settings for the SSID and password for the access point (AP) and station modes on the WiFi can be left as default for many cases. If, however, you have multiple loggers in close proximity (e.g., during setup), you will likely have to change these to avoid conflicts.
The speed settings for the two NMEA0183 input channels should be left at 4800 baud, the default for NMEA0183, unless otherwise indicated (e.g., if a particular host platform is running its NMEA0183 networks at some higher speed).
The button rows at the bottom of the screen have the following functions:
-
"Query Logger". Read the current configuration from the logger, and populate into the window.
-
"Set Logger". Write the current configuration on the logger from the values in the window.
-
"Load Config". Load a JSON file with a valid configuration from disc, and populate into the window. This is a good way to set your preferred defaults for a new logger that's being configured.
-
"Save Config". Save a JSON file with the configuration displayed in the window. This is a good means to summarise the actual configuration of a logger for future reference, or as backup for re-configuration in the future.
-
"Get Defaults". Each logger, in addition to having a current configuration, has a "lab default" configuration that can be used to reset to a known-good state if required (with the
lab reset
command). This button will extract the JSON-format string from the logger, unpack it, and populate the values into the window. -
"Set Defaults". This sets the default configuration of the logger using the compact JSON-format string method. Note that it is usually good practice, when bringing up a new logger, to set the current and default configurations to the same values.
-
"Dismiss". Exit from this window.
In addition to basic metadata (a unique identifier and ship name), each WIBL logger can store a JSON-formatted metadata specification which is written into each output file and extracted during processing to augment the GeoJSON file to be sent to DCDB. The metadata button on the main window opens a file dialog to allow the user to select an appropriate JSON file to store on the logger. Note that the logger does not attempt to validate the contents of the file (and neither does the GUI); it is simply stored and reported in the output log files when each file is opened. The state of the currently stored metadata can be determined by the metadata
command.
In order to allow for authentication and/or handshaking with an upload server (e.g., when the logger is attached to an Internet-connected network in Station mode and can auto-upload its files), the logger can store an arbitrary ASCII string in the logger as password, and an ASCII text string representing the PEM-formatted X.509 certificate for the Certificate Authority (CA) that signed the server's certificate.
The "Authorisation" button on the main window opens a dialog box that allows you to enter a password directly, and load a certificate ("Load Cert") from an ASCII-encoded, PEM-formatted, X.509 certificate file, as required. The "Query Logger" button finds the current information from the logger, while "Set Logger" sends the current contents of the dialog box to the logger.
The "Make Password" button will generate a random password of 32 characters/digits, and fill in the password entry widget. Note that you still need to click on the "Set Logger" button to transfer this to the logger.
In order to allow each logger to maintain information on specific processing steps that might be required for its data, each logger can store a list of algorithm names and parameters that should ideally be applied in post-processing. The logger does not check the validity of the algorithms or their parameters, storing only what the user provides. These values are stored in each log file when it is created.
The table widget has a pop-up menu to add/delete rows, and the algorithm names and parameters can be added or removed as required. The button functionality is:
-
"Query Logger". Load the currently specified algorithm list from the logger and populate the window.
-
"Set Logger". Set the logger's algorithm list to those in the window.
-
"Load Config". Load a JSON-format description of the algorithms from disc and populate the window.
-
"Save Config". Save the contents of the window as a JSON-format file.
-
"Dismiss". Exit from this window.
By default, the WIBL logger will store every NMEA0183 sentence provided to it on both channels. On a busy network, however, this can result in a lot of information being saved to the limited resources of the SD card. The logger can, therefore, limit the list of sentences being recorded to those specified by the user. This window provides a table-based interface to this functionality.
As with the algorithm window, the table controls can be used to add and remove rows, and edit the sentence identifiers that are provided. Note that the GUI does not validate that the sentence identifiers are valid, and does not format the values provided: they must, therefore be upper case and three characters long. The button functionality is:
-
"Query Logger". Load the currently specified filter list from the logger and populate the window.
-
"Set Logger". Set the logger's filter list to those in the window.
-
"Load Config". Load a JSON-format description of the sentence IDs from disc and populate the window.
-
"Save Config". Save the contents of the window as a JSON-format file.
-
"Dismiss". Exit from this window.
Data can be accessed from the WIBL logger by extracting the SD card, or over WiFi using the transfer
command. A list of all files available on the logger can be generated by the status
command (this is suppressed in the status summary generated by the main window button), and files are identified only by their sequence number. The transfer window allows the user to specify this number, and then pick an output location. Clicking "Transfer" then extracts the file from the logger and saves it, in WIBL binary format, to disc. Note that this mechanism does not delete the file from the logger's SD card (although this can be done with the erase
command).