Skip to main content

Decode CAN messages

Project description

Caneton
=======

Python 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:

`$ python3 -m unittest`

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

Uploaded Source

Built Distribution

caneton-1.0.6-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for caneton-1.0.6.tar.gz
Algorithm Hash digest
SHA256 6e370db94b630af709083769d194ece796419ebb51a37a1ed4a1e2a1ddf3192f
MD5 3e3a4bf93d25a85fb8ca7f5ff87d91c5
BLAKE2b-256 b0d3ab571a35073911a8f63308eb341edf92c19efb5791da645aad565bf21761

See more details on using hashes here.

File details

Details for the file caneton-1.0.6-py3-none-any.whl.

File metadata

File hashes

Hashes for caneton-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 26f5c545397d23f24157a078a268afddf07d083ad97769c8e5e272558cd8e06b
MD5 134c730986db6c2df4c073abd336dd47
BLAKE2b-256 14f175c62f38fc35631af618e52b8a9faf8e1c1243878bb35a424a31934e607b

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