Decode CAN messages
Project description
Caneton
=======
Python 2/3 project under BSD license to decode messages (or frames) from a CAN bus.
DBC in JSON
-----------
Before decoding a message, you need to convert the DBC file which describes the format of the data on the bus in JSON. The project [libcanardbc](https://github.com/Polyconseil/libcanardbc) can
convert a CAN DBC file to JSON suitable for caneton project.
Use
---
To decode a CAN message, you must provide the message ID, the message data
(payload) and the DBC file (in JSON).
Caneton can be used as Python module:
```python
import binascii
import json
import caneton
with open('dbc.json') as dbc_file:
dbc_json = json.loads(dbc_file.read())
message_data = binascii.unhexlify('01780178010000')
message = caneton.message_decode(message_id=0x701,
message_length=len(message_data), message_data=message_data,
dbc_json=dbc_json)
print(message)
```
or as CLI tool to decode CAN message:
`$ caneton-decode dbc.json 0x701 0x01780178010000`
Tests
-----
To run the unit tests:
`$ nosetests`
=======
Python 2/3 project under BSD license to decode messages (or frames) from a CAN bus.
DBC in JSON
-----------
Before decoding a message, you need to convert the DBC file which describes the format of the data on the bus in JSON. The project [libcanardbc](https://github.com/Polyconseil/libcanardbc) can
convert a CAN DBC file to JSON suitable for caneton project.
Use
---
To decode a CAN message, you must provide the message ID, the message data
(payload) and the DBC file (in JSON).
Caneton can be used as Python module:
```python
import binascii
import json
import caneton
with open('dbc.json') as dbc_file:
dbc_json = json.loads(dbc_file.read())
message_data = binascii.unhexlify('01780178010000')
message = caneton.message_decode(message_id=0x701,
message_length=len(message_data), message_data=message_data,
dbc_json=dbc_json)
print(message)
```
or as CLI tool to decode CAN message:
`$ caneton-decode dbc.json 0x701 0x01780178010000`
Tests
-----
To run the unit tests:
`$ nosetests`
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
caneton-1.10.2.tar.gz
(7.3 kB
view details)
Built Distribution
File details
Details for the file caneton-1.10.2.tar.gz
.
File metadata
- Download URL: caneton-1.10.2.tar.gz
- Upload date:
- Size: 7.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3706dc8be4de53aabf0d2dd9736d2063befdbe5c993ccfb102d91cd34430e6f4 |
|
MD5 | ab60f6c010898eb3a55b49a110aa2850 |
|
BLAKE2b-256 | 91c9f7575d0b7269ac00ba40bbc92729bc52e7b88999a1d54accc2c5c4ca7687 |
File details
Details for the file caneton-1.10.2-py2.py3-none-any.whl
.
File metadata
- Download URL: caneton-1.10.2-py2.py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca34d4e62874c598dc072e34d1508c567e83dd5071380203b9a8c5145688501a |
|
MD5 | 9854aa7c0f9aec7e75c40263b8ace1a7 |
|
BLAKE2b-256 | daa3ab6d6930eed03fae6023de3552c9b7cd0f1a584ec4a1b3c1b4f598da6543 |