A simple server to send some CAN frame data to a RealDash application via TCP/IP.
Uses Qt QtNetwork API (QTcpServer, QTcpSocket) to accept socket connections from and send CAN frames to RealDash clients using the custom RealDash CAN protocol.
Exposes an interface over DBus to allow updating of metrics from a remote process.
Currently the server supports four basic metrics corresponding to the following CAN target identifiers
Metric | Category | CAN target ID | D-Bus method name |
---|---|---|---|
RPM | ENGINE/ECU | 37 | setRevs |
Speed | TRANSMISSION | 136 | setSpeed |
Fuel Level % | BODY ELECTRONICS | 170 | setFuelLevel |
Selected Gear | TRANSMISSION | 140 | setGear |
These are delivered in a single CAN frame of 8 bytes, according to the RealDash CAN configuration described in the realdash_can.xml
file in the config
directory.
This can easily be modified and/or expanded to additional metrics and CAN frames. See the RealDash docs and feel free to send pull requests ;)
This has been developed on macOS for a target of Raspberry Pi OS (formerly Raspbian Linux)
The build system is CMake which supports building via generators (e.g. Xcode, Unix Makefiles etc) and installation onto Debian linux using systemd D-Bus activation.
It's hoped that the use of CMake will facilitate expansion of compatibility to other platforms where the pre-requisite D-Bus and Qt libraries are available. Again, please feel free to send pull requests ;)
Install the following via your preferred method and/or package manager:
- C++ development environment.
- CMake
- D-Bus (including development files)
- Qt5 core, networking and d-bus (including development files)
e.g. on debian based systems:
sudo apt install build-essential cmake libdbus-1-dev qtbase5-dev
From the root directory, create a build dir and use cmake to create the makefiles and make to build the project:
mkdir build
cd build
cmake -G "Unix Makefiles" ..
make
From the root directory, create a build dir and use cmake to create your Xcode project file and open with Xcode
mkdir build
cd build
cmake -G "Xcode" ..
open RealDashCanServerQt.xcodeproj
Build & Run in the usual way from Xcode
Installation on Linux is currently supported by creating a systemd service using D-Bus activation. This means the service is started automatically when clients start to communicate with the server via D-Bus.
After building, simply use make to install from the build dir:
make install
The server receives data via D-Bus, so you can use any language that has D-Bus binding library support.
The service
, interface
and object path
names are currently defined by constants within the code:
#define CAN_SERVER_SERVICE_NAME "nd.realdash.canserver"
#define CAN_SERVER_INTERFACE "nd.realdash.canserver.DashBoard"
#define CAN_SERVER_OBJECT_PATH "/nd/realdash/canserver"
An example in C++ of usage can be found in the dashboard implementation of my fork of the cannonball engine.
Did I mention pull requests are welcomed? ;)