https://github.com/commaai/can-message
https://github.com/commaai/can-message
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/commaai/can-message
- Owner: commaai
- Created: 2018-03-18T23:33:47.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2022-03-16T20:42:54.000Z (over 4 years ago)
- Last Synced: 2025-07-03T02:42:30.089Z (12 months ago)
- Language: JavaScript
- Size: 40 KB
- Stars: 5
- Watchers: 15
- Forks: 7
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# can-message
Pack and unpack CAN bus data.
This library is designed for use with the [Panda OBD-II Dongle](https://shop.comma.ai/products/panda-obd-ii-dongle) as part of [pandajs](https://github.com/commaai/pandajs).
## Installation
`npm i --save can-message`
or
`yarn add can-message`
## Usage
```js
import { canToObject, objectToCan } from 'can-message';
// parse raw buffer into can data
var messageArray = canToObject(buffer);
// messageArray is an array of { address, busTime, data, bus }
// create a buffer containing a can message
var buffer = objectToCan(myCanMessage);
```
```js
const CanMessage = require('can-message');
// parse raw buffer into can data
var messageArray = CanMessage.canToObject(buffer);
// messageArray is an array of { address, busTime, data, bus }
// create a buffer containing a can message
var buffer = CanMessage.objectToCan(myCanMessage);
```
## Contributing
`yarn run test`
# License
MIT @ comma.ai
Read more about how to get started hacking your car with Panda [here](https://medium.com/@comma_ai/a-panda-and-a-cabana-how-to-get-started-car-hacking-with-comma-ai-b5e46fae8646).