Skip to main content

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`

Project details


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.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

caneton-1.10-py2.py3-none-any.whl (10.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file caneton-1.10.tar.gz.

File metadata

  • Download URL: caneton-1.10.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for caneton-1.10.tar.gz
Algorithm Hash digest
SHA256 9e49f2b061a8795cf0d1df362868193a5858cf007215b1d22012e27f7c47727b
MD5 042f389d849bcbd6cedc594aadc44b6a
BLAKE2b-256 8f7515185fc50b4aa5541d9168d6f4670bd8df822508721422bb8b91a446e7b7

See more details on using hashes here.

File details

Details for the file caneton-1.10-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for caneton-1.10-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 735ab9396ebc48f2d81beaab253286baae929a29af04f8de7a2ca234cd86da04
MD5 42de69b549737c4746cf7608183a1134
BLAKE2b-256 45969c9d46e62e26ec4c34cabdb81702737a47d84a26a08a4500628ba463d439

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page