Virtual CAN
An in-memory CAN bus. Every transport instance naming the same bus exchanges frames with the others directly, with no kernel, no hardware and no driver installation involved.
It is the counterpart to the SocketCAN transport for tests, demonstrations and development: two connections on one bus can talk to each other on a laptop that has no CAN hardware at all.
Transport syntax
{name of the virtual bus}
Instances naming the same bus see each other’s frames. The bus is created on first use, so any name will do as long as both ends agree on it.
canopen:can-virtualcan://test-bus
genericcan:can-virtualcan://test-bus
The bus can also be named with the can-virtualcan.bus-name option instead; the address segment
wins if both name one. Naming neither connects to the bus called default.
Name |
Type |
Default Value |
Required |
Description |
Name |
Virtual CAN |
|||
Code |
|
|||
Maven Dependency |
<dependency> <groupId>org.apache.plc4x</groupId> <artifactId>plc4j-transports-can-virtualcan</artifactId> <version>1.1.0</version> </dependency> |
|||
Config options: |
||||
|
STRING |
default |
Name of the virtual CAN bus. Instances on the same bus exchange frames in-memory. |
|
|
STRING |
Comma-separated list of accepted CAN IDs (decimal or 0x hex). Empty means accept all. |
||
|
INT |
-1 |
Start of accepted CAN ID range (inclusive). -1 means no range filtering. |
|
|
INT |
-1 |
End of accepted CAN ID range (inclusive). -1 means no range filtering. |
|