<< to CrossControl homepage

Support & Service Center

QML with SocketCAN

Printer-friendly versionPrinter-friendly versionPDF versionPDF version

There are many ways to work with CAN messages within the LinX software suite. Most customers using Qt will likely want a full J1939 CAN stack with all of the lower level protocols the J1939 stack includes. In this case you will want to check out the FieldBus Access tool developed for the LinX software suite. In some cases though a full J1939 CAN stack is not needed and you may only want to receive a few CAN messages or custom CAN messages that don't adhere to the J1939 stack protocol. In this case you may choose to use the lower level socketCAN interface in the Linux displays to receive raw CAN messages. This demo shows how socketCAN can be used with Qt QML code.

The demo simply takes in raw CAN data from socketCAN, sends to a custom class to be decoded and once decoded is displayed on QML UI. It provides the correct classes to receive and send CAN messages with socketCAN as well as shows how a custom class can be created and interfaced to QML so you can decode the raw CAN data into useful messages and display them on your UI. The code is commented to attempt to explain what each piece is accomplishing.

To use, download the attached file and extract in the LinX Virtual Machine. Open the '.pro' file with Qt and deploy to the display. You will need the updated LinX RT for this to work (it has been tested on ARM based displays although it should work with x86 displays if you add the appropriate kit). The message that is being displayed on the QML UI by default is the 'Engine Speed' message from PGN '61444' in the standard J1939 message list.



Binary Data SocketCAN shown with QML789.88 KB