Virtual CAN bus. Send CAN messages over a virtual can bus.
A virtual can bus can be useful during development of a CAN based system.
To start the virtual CAN server, use the rust implementation:
$ cd rust/server
$ cargo run --release -- --port 18881
To use this from python, install the python-can package, and next the virtualcan module:
$ pip install python-can
$ cd python
$ pip install .
Now, from python, use the virtualcan interface as follows:
import can
bus = can.Bus(interface='virtualcan', channel='localhost:18881')
bus.send(can.Message(arbitration_id=13, data=[1, 2, 3, 4, 5]))
Refer to the C++ demo.
To build the C++ demo, use cmake:
$ cd cpp
$ mkdir build
$ cd build
$ cmake ..
$ make
$ cd demo
$ virtualcan_demo.exe
- C++ implementation of TCP client
- Rust implementation of TCP client/server
- C# implementation of TCP client