https://github.com/polyconseil/libcanardbc
Library to read DBC files of CAN bus networks
https://github.com/polyconseil/libcanardbc
Last synced: 8 months ago
JSON representation
Library to read DBC files of CAN bus networks
- Host: GitHub
- URL: https://github.com/polyconseil/libcanardbc
- Owner: Polyconseil
- License: gpl-3.0
- Created: 2015-06-15T09:16:39.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2019-10-15T11:03:49.000Z (over 6 years ago)
- Last Synced: 2025-07-10T19:26:46.014Z (11 months ago)
- Language: Yacc
- Size: 75.2 KB
- Stars: 76
- Watchers: 47
- Forks: 20
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: NEWS
- License: COPYING
- Authors: AUTHORS
Awesome Lists containing this project
README
libcanardbc
===========
Overview
--------
libcanardbc is a partial fork of cantools.sourceforge.net from rev47 (SVN).
This fork has been made to remove dependencies on hdf5 and matio, and to
fix compilation issues on Mac OS X in libdbc.
Only the DBC parser/lexer and associated library has been kept from the
original project.
The original cantools project is licensed under GPLv3, this means you can't link
the libraries of this project with a proprietary tool. This choice has been made
on purpose by Andreas Heitmann and so this fork inherits of the license.
Installation
------------
You will only need to install:
- automake
- autoconf
- libtool
- flex
- bison
- json-glib-1.0 (on Debian/Ubuntu: libjson-glib-dev; on other OSes probably a
similar name)
and a C compiler (gcc or clang) to compile the library.
To install, just run the usual dance, `./configure && make install`. Run
`./autogen.sh` first to generate the `configure` script if required.
Tools
-----
The directory `tools` contains several tools related to libcanardbc:
- **dbc2json** converts a DBC file to a JSON file. It's up to you to adapt it to
your needs. This program is linked to libcanardbc so it is licensed under
GPLv3.
- **json2dbc.py** converts a JSON file to a DBC file. It is usually easier to
write a JSON file by hand than a DBC one.
- **json2html** renders a JSON file (DBC) to an HTML page. This program is
distributed under BSD 3-Clause license.
Another project named [caneton](https://github.com/Polyconseil/caneton) uses
the generated JSON file of DBC to decode CAN messages.
DBC format
----------
The syntax of signals in DBC file is:
```
: |@ (,) ""
```
JSON format
-----------
You can see an example of a valid JSON file [here](https://github.com/Polyconseil/caneton/blob/master/tests/dbc.json). Below is the description of the schema it uses:
```
{
"filename": ".dbc (optional)",
"version": " (optional)",
"attribute_definitions": {
"": {
"0": "",
"": ">"
}
}
"messages": {
"": {
"name": "",
"sender": "",
"length": ,
"has_multiplexor (optional) ": ,
"attributes": {
"": "",
">": ">"
}
"signals": {
"signal_1": {
"bit_start": ,
"length": ,
"little_endian": <0|1>,
"signed": <0|1>,
"value_type": "",
"factor": ,
"offset": ,
"min": ,
"max": ,
"unit": "",
"multiplexor (optional)": ,
"multiplexing (optional)": ,
"enums (optional)" : {
"": "",
"_value>": "_name>"
}
},
"
}
}
}
}
```