Testing newly developed hardware can sometimes be quite time-consuming and nerve-wracking. When multiple components of a unit are being developed simultaneously, isolated tests are required to independently verify all functions. In our case, it's the power controller of a defibrillator. This will later communicate with the rest of the device. Until this is developed, however, test software should simulate this interface. After tool validation, all software and integration tests can be performed. By using a GUI (Graphical User Interface) is also intended to simplify usability. Who likes sending and reading hexadecimal packets?

Creating a GUI. How exactly?
To program a GUI There are many possibilities. Due to its popularity, extensibility and license freedom, python in combination with PyQt The good documentation and variety of discussions about python on the Internet speak for the use of the programming language. PyQt is a binding between python and the one in C++ wrote QT-Library and is also enjoying widespread popularity. In addition to the availability of all classic controls (checkboxes, buttons, combo boxes, etc.), it is also easy to integrate more complex graphical components such as graphs.
The designer tool QTDesigner offers the possibility to design the graphical interface quickly and relatively intuitively without writing a single line of code. Thanks QT The elements used are native on all platforms. Layouts in the designer allow for neat and appealing navigation.

The resulting designs can be translated into a Python script with just one command on the command line. Since the rest of the application is written in other files, parallel work can be done on the user interface in QTDesigner and work on the software's logic. The signal/slot editor (bottom right in the screenshot) allows for the direct implementation of simple functions that are intended to handle graphical elements in the program. It's all very practical and, after a short training period, truly simple.
Once the GUI is finished, certain tools (e.g. pyinstaller .exe files for Windows) to create a standalone executable app, ideal for distribution to the testing department or customer.
Inside
The two major tasks of the software are communication with the hardware and providing the graphical interface. To ensure smooth operation, Multithreading used, i.e. the parallel processing of tasks. The application itself manages the GUI while a Thread are responsible for sending, receiving, and interpreting data packets from and for the hardware. QTs signals and slots. This allows the hardwareThread calling functions of the GUI initiate and vice versa.
In our case, the messages between the power controller and the host are organized in packets. Each packet consists of a start and stop character, a key to identify the command, a Payload, which contains the associated information and a checksum. The latter serves to guarantee the complete and correct transmission of the packet. Upon receipt of the data, it is converted into a Buffer which passes it as a packet to the next buffer as soon as a stop character is reached. After validation using a checksum, the corresponding function in the GUI called.
Continuously available data is also displayed continuously, both numerically and graphically in the form of plots. Upon request, this data can be saved as logs in .csv files for later processing. This also enables longer-term hardware analyses.
The two main components of the software functions such as updates, defining a new serial number of the device or triggering a reset are also possible.

Conclusion
Through its prevalence, functionality, and compatibility, Python offers everything that is advantageous for quickly and effectively writing such an integration testing tool. GUI It was written quickly and communicates seamlessly with the hardware via a serial interface. The new convenience and time savings were very welcome to the developer. Even during the software development process, several previously unnoticed errors were discovered due to the isolated and intensive work with the various functions.
Please note the small but important license differences: PyQt is licensed under the GNU General Public License (GPL) or as a commercial version. Alternatives such as wxpython, kivy or beeware there is under the even freer GNU Lesser General Pulic License (LGPL).
