This library contains many utilities allowing to use the UAVCAN protocol directly in javascript.
An example of implementation is available in the project: https://github.com/octanis-instruments/slcan
Here are the various utilities that are available:
- Data:
Data
: a class that allows to deal with UAVCAN data object. It will convert a javascript object to a byte array and the opposite based on the dataTypeID and isService / isRequest flagsDataTypesManager
: helper to convert dataTypeID to fullDataTypeID and retrieve information about a specific dataTypeFullIDdataTypes
: a json containing the description of all the data types
- Transport:
getFrames
: Convert a byte array in frames that can be send with the adapterparseFrame
: Parse the received frameNode
: a class that corresponds to a Node on the can bus that will receive and send frames. It belongs to a specific Adapter that connects the CAN bus to the computerDefaultAdapter
: A basic implementation of an adapter that should be extended in order to implement a connection between the computer and the CAN bus. This adapter implementsEventEmitter
and will generate events forframe
(RX and TX) as well asdata
when the frames are assemble and a new valid data is received.
- Utilities
- bytesToHex: converts an array of bytes to an hexadecimal string
- hexToBytes: converts an hexadecimal string to an array of bytes
$ npm install uavcan