Node CAN
A Node.js CAN library supporting multiple transports & protocols, heavily inspired by python-can.
This is an early alpha version, do not use in production.
Installation
npm install node-can
Usage
const can = require('node-can');
const bus = new can.Bus('protocolName', 'transportName', options);
Exemple usage :
const can = ;const bus = 'raw' 'USBCanAnalyserV7' port: '/dev/tty.wchusbserial14110'; // Initialize bus communicationbus;
Transports
USBCanAnalyserV7
This transport implement support for the USBCanAnalyserV7 serial to can adapter.
OS support
Serial communication are done with node-serialport. So it support MacOS, Linux and Windows. See node-serialport supported environments for more informations.
Initialization sequence
node-can
take care to send initialization parameters to the serial adapater, and configure it to transfert frames in normal mode (Extended frame will be supported soon).
Usage
const can = ;const bus = 'raw' 'USBCanAnalyserV7' port: '/some/serial/port' // String, required;
SocketCAN
OS support
SocketCan is available only on linux. The transport should working on all linux distributions built with socketCAN support.
Usage
const can = ;const bus = 'raw' 'socketCan' interface: 'can0' // String, required;
Protocols
RAW
Usage
const can = ;const bus = 'raw' 'USBCanAnalyserV7' interface: 'can0'; // Listen for messagesbusprotocol; // Write messagebustransport;
CanOPEN
CanOPEN is not fully implemented !
Usage
const can = ;const bus = 'canopen' 'USBCanAnalyserV7' port: '/some/serial/port'; bus;
TODO
- Write tests
- Write real documentation
- More comments in code
Prepbuild library with babel at installation, instead of using@babel/register
- Ability to configure extended frame mode using
USBCanAnalyserV7
transport - Create an interface to allow developers to extending protocols & transports
- Implement .kcd parser for
raw
protocol Implementsocket can
support (need a native interface)CanOPEN
protocol- Ability to auto download object dictionary from a slave node
- Implement LSS
PDO write- Implement SYNC
- Implement TIME PRODUCER
- Implement
xml
dictionary parser - Implement segment download
- Implement block uploads / downloads