C
Message Proxy: Testing Qt Safe Renderer Messaging Interface
Message Proxy provides a python script for sending messages to your device. On the target device, use Message Proxy with the Telltales or Monitor examples.
The Qt Safe Renderer installation contains a test application called Message Proxy that you can use for testing the Qt Safe Renderer messaging interface. Message Proxy provides:
- A test.py python script for sending messages from the host platform to your target device. You need to modify the port and host information on the script.
- The Message Proxy application that listens messages via network socket on your target device. You can build Messageproxy for QNX, INTEGRITY, and Embedded Linux.
In addition, you need to verify with the Telltales example that the sent messages work as expected on your target device.
You find the test.py script and the Message Proxy application under <Qt installation directory>/Examples/QtSafeRenderer-<version>/saferenderer/messageproxy. You must have Python 3 installed before you can use the script.
Note: A similar approach as used in Message Proxy can be used for developing a CAN (Controller Area Network) bus event listener. The CAN bus process can listen to system events and pass the events to the Qt Safe Renderer process via IPC messaging plugin. The Qt Safe Renderer installation does not provide the reference implementation of the CAN bus solution.
When you want to test your messaging interface with Message Proxy, do as follows:
- Modify the test.py script on your host platform. The script needs to have correct host and port information.
- Compile Messageproxy and Telltales for your target device (QNX, INTEGRITY, Embedded linux).
- Deploy Messageproxy and Telltales to your target device.
- Send messages via the script and verify output via Telltales.
Modifying test.py File
Message Proxy has the python script test.py where you need to set your host and port. Open the test.py under <Qt installation directory>/Examples/QtSafeRenderer-<version>/saferenderer/messageproxy and edit the host and port information on basis of your test environment. On the host platform, Message Proxy listens the port 32112:
host = '127.0.0.1' port = 32112
You can also set the host and the port number via the QT_SAFERENDER_HOST
and QT_SAFERENDER_PORT
environment variables.
Compiling Message Proxy and Telltales for Target Device
Testing the Qt Safe Renderer messaging interface in the target device requires the Messageproxy application that listens to events from a network socket. It passes the events to the Qt Safe Renderer process via IPC (Inter-Process Communication).
Also, you need the Telltales example to verify that your messages are sent to the device and they work properly.
To build Message Proxy and Telltales for your target device, you need a Qt compiled for your target. Use the following build instructions for building Qt, Message Proxy, and Telltales:
- Building for QNX
- Building for INTEGRITY
- How to Create Boot to Qt Image (Embedded Linux)
Deploying Message Proxy and Telltales to Target Device
After you have compiled Message Proxy and Telltales for your target device, you need to deploy them to the device via Qt Creator.
By default, when you select Build > Run in Qt Creator for your project, Qt Creator builds the project, deploys it to the device defined in the kit, and runs it there. However, if you have not made any changes to the project since you last built and deployed it, Qt Creator simply runs it again.
For more information, see the Building and Running topic in Qt Creator Manual.
Sending Messages
In test.py, you can send events to Telltales as follows:
v = createVisibilityEvent("iconCoolant", Value.ON) sendMessage(v)
"iconCoolant"
refers to the value of objectName
property in the .ui.qml file. You can also send move events via test.py.
Verify via the Telltales that the UI is updated as expected. For example, the telltales visibility is changed on and off by the sent messages.
Files:
Available under certain Qt licenses.
Find out more.