Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
CANboat as published can be used to:
- Read and write output from the CAN bus via an Actisense NGT-1 -- see actisense-serial.
- Translate the output to 'human readable' form or JSON and a little NMEA-0183 -- see analyzer.
- Provide this output to multiple clients using a TCP/IP server -- see n2kd.
- Write PGNs to the CAN bus when nothing else is reading from the bus -- see below.
- Write PGNs to the CAN bus when the TCP/IP server is reading from the bus -- see below.
Writing to the CAN bus (exclusively)
If there is no actisense-serial program using the serial device emulated by the NGT-1, you can send output in the normal ASCII format to the standard input of actisense-serial to write to the bus.
echo 2012-06-17-15:02:11.000,6,59904,0,255,3,14,f0,01 | actisense-serial /dev/ttyUSB0
Note that the actisense-serial program does not program the NGT-1 to tell it which PGNs to pass through to the bus, so whether the PGN is actually sent is up to the NGT-1. You can use the Actisense NMEA reader to set what it passes on.
Writing to the CAN bus (shared)
If you are already using a copy of actisense-serial to read from the bus you can use one of the following strategies.
Create a UNIX fifo and write to it when you want to write a command:
mknod /tmp/canbus-write p actisense-serial /dev/ttyUSB0 < /tmp/canbus-write | analyzer | ... ... echo 2012-06-17-15:02:11.000,6,59904,0,255,3,14,f0,01 > /tmp/canbus-write
Create a TCP or UDP listener with nc or netcat:
nc -lk localhost 5000 | actisense-serial /dev/ttyUSB0 < /tmp/canbus-write | analyzer | ... ... echo 2012-06-17-15:02:11.000,6,59904,0,255,3,14,f0,01 | nc localhost 5000