The .can-messages/build.rs will use dbc-codegen to generate Rust code
from a given DBC file in ./dbc-examples (example.dbc when no file is given).
|
Important
|
The rust-integration crate uses the generated code!
|
This small tool can be used to create test data for CAN messages. Since we have successfully used NodeJS with socketcan to connect CAN devices, we chose this known-working solution to compare our Rust tooling against.
|
Note
|
This is only known to work on Linux. |
-
Run
sudo ./setup_virtual_can.sh -
Launch
candump vcan0 -Lin a seperate terminal window -
In
node-socketcan, editmain.jsto your liking and runnode main.js --def=../dbc-examples/example.kcd
candump will output lines like (1603881557.238509) vcan0 200#0594000000000000.
These can be used as test cases in the rust-itegration crate.
cantools are used for comparing results of packing and unpacking.
- Install cantools
- Run ./cantools-messages/generate_example_code in order to regenerate the c source code which is based on the dbc example.
- Run cargo test in cantools-messages