CANBus Communications tools and libraries for diagnosis and visualization
A WIP collection of libraries and materials to aid when working with CAN communications
Rust library usable via FFI
Provides an interface with functions that aid in setup and use of a can interface or dump! Features include:
- Loading a dump file and reading canframes!
- Connecting to a local CAN interface
Communication is async to a dart client
Communicates with the ffi interface using Ports
NB: Ensure Submodules are initialized before building and apply any relevant patches i.e
git submodule update --init
cd ./nix && git apply ../nix_patch.diff
cd ./socketcan-rs && git apply ../socketcan-libc.diff
To build the project you would require (Tested on Linux - x64):
- A valid Dart SDK(> version 2.7.0)
- Cargo - to compile rust sources
- Can-utils package and access to VCAN interface for testing
- To build the shared library
cd ./picana_native
BINDGEN_DART_SDK_PATH=... cargo build --release
cd ..
- To test the shared library - copy it out to the picana dart directory
- Get latest dependencies
cp ./picana_native/target/release/libpicana.so ./picana_dart/
cd ./picana_dart
pub upgrade
- Start the CAN interface
sudo modprobe vcan
sudo ip link add vcan0 type vcan
sudo ip link add vcan1 type vcan
sudo ip link set vcan0 up
sudo ip link set vcan1 up
- Run the main example to test
pub run bin/main.dart
Open a new shell and you can send can messages via cansend to the virtual can interface and a handler should handle the messages e.g
cansend vcan0 6b1#ffff0000
cansend vcan1 6b1#ffff0000
You should see the messages been printed out to original console running the program!
##TODO:
-> Use as a library in other packages!!