File: formats.rst

package info (click to toggle)
python-canmatrix 1.2~github-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 11,012 kB
  • sloc: xml: 30,201; python: 14,631; makefile: 31; sh: 7
file content (125 lines) | stat: -rw-r--r-- 7,207 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
Supported File Fomats
=====================


There are several importers (read) and exporters (write) for this object.

* supported file formats for import:

    * .dbc candb / [Vector](http://vector.com)
    * .dbf [Busmaster](https://rbei-etas.github.io/busmaster/) (open source!)
    * .kcd [kayak](http://kayak.2codeornot2code.org/) (open source!)
    * .arxml [autosar](http://autosar.org) system description
    * .yaml dump of the python object
    * .xls(x) excel xls-import, works with .xls-file generated by this lib
    * .sym [peak](http://www.peak-system.com) pcan can description

* supported file formats for export:
    * .dbc
    * .dbf
    * .kcd
    * .xls(x)
    * .json [Canard](https://github.com/ericevenchick/CANard) (open source!)
    * .arxml (very basic implementation)
    * .yaml (dump of the python object)
    * .sym
    * .xml fibex
    * .py [scapy] (https://scapy.net/) scapy can message decoder
    * .lua [wireshark] wireshark can subdissector


Export
______

+------+----+-----+-------------+---------+---------+---------+--------+---------+-------+-------+----------+------------+-------------+
|Format|ECUs|Mux  |S/R of Signal|Cycletype|Cycletime|Baudrate |Extended|Byteorder|scaling|min/max|attributes|value tables|signal groups|
+======+====+=====+=============+=========+=========+=========+========+=========+=======+=======+==========+============+=============+
|arxml |    |+    |             |         |         |+        |+       |+        |       |       |          |            |             |
+------+----+-----+-------------+---------+---------+---------+--------+---------+-------+-------+----------+------------+-------------+
|dbc   |+   |+    |+            |+        |+        |         |+       |+        |+      |+      |+         |+           |+            |
+------+----+-----+-------------+---------+---------+---------+--------+---------+-------+-------+----------+------------+-------------+
|dbf   |+   |+    |+            |+        |+        |         |+       |+        |+      |+      |+         |+           |             |
+------+----+-----+-------------+---------+---------+---------+--------+---------+-------+-------+----------+------------+-------------+
|json  |    |     |             |         |         |         |        |         |+      |       |          |            |             |
+------+----+-----+-------------+---------+---------+---------+--------+---------+-------+-------+----------+------------+-------------+
|kcd   |+   |+    |             |+        |+        |+        |        |         |       |       |          |+           |             |
+------+----+-----+-------------+---------+---------+---------+--------+---------+-------+-------+----------+------------+-------------+
|sym   |    |+    |             |         |         |         |+       |+        |+      |+      |          |+           |             |
+------+----+-----+-------------+---------+---------+---------+--------+---------+-------+-------+----------+------------+-------------+
|xls(x)|+   |+    |+            |+        |+        |         |        |+        |+      |+      |          |+           |             |
+------+----+-----+-------------+---------+---------+---------+--------+---------+-------+-------+----------+------------+-------------+
|csv   |+   |+    |+            |+        |+        |         |        |+        |+      |+      |*         |+           |             |
+------+----+-----+-------------+---------+---------+---------+--------+---------+-------+-------+----------+------------+-------------+
|xml   |+   |     |+            |         |         |         |        |+        |+      |+      |          |            |             |
+------+----+-----+-------------+---------+---------+---------+--------+---------+-------+-------+----------+------------+-------------+



Import
______

+------+----+-----+-------------+---------+---------+---------+--------+---------+-------+-------+----------+------------+-------------+
|Format|ECUs|Mux  |S/R of Signal|Cycletype|Cycletime|Baudrate |Extended|Byteorder|scaling|min/max|attributes|value tables|signal groups|
+======+====+=====+=============+=========+=========+=========+========+=========+=======+=======+==========+============+=============+
|arxml |+   |+    |+            |+        |+        |+        |+       |+        |+      |+      |          |+           |+            |
+------+----+-----+-------------+---------+---------+---------+--------+---------+-------+-------+----------+------------+-------------+
|dbc   |+   |+    |+            |+        |+        |         |+       |+        |+      |+      |+         |+           |+            |
+------+----+-----+-------------+---------+---------+---------+--------+---------+-------+-------+----------+------------+-------------+
|dbf   |+   |+    |+            |+        |+        |         |+       |+        |+      |+      |+         |+           |             |
+------+----+-----+-------------+---------+---------+---------+--------+---------+-------+-------+----------+------------+-------------+
|kcd   |+   |+    |             |+        |+        |         |        |         |       |       |          |+           |             |
+------+----+-----+-------------+---------+---------+---------+--------+---------+-------+-------+----------+------------+-------------+
|sym   |    |+    |             |         |         |         |+       |+        |+      |+      |          |+           |             |
+------+----+-----+-------------+---------+---------+---------+--------+---------+-------+-------+----------+------------+-------------+
|xls(x)|+   |+    |+            |+        |+        |         |        |+        |p      |p      |          |p           |             |
+------+----+-----+-------------+---------+---------+---------+--------+---------+-------+-------+----------+------------+-------------+


Scapy Export
____________

Create can frame decoder for some can definition

Example:

    $ canconvert source.dbc target.py

in scapy use like this:

.. code-block:: python

    load_contrib("target")
    sock = CANSocket("can0", basecls=DBC)
    pkt = sock.recv()


Wireshark Dissector
___________________

    $ canconvert source.dbc target.py

Example:

    $ canconvert source.sdbc target.lua

in wireshark use like this:

    $ wireshark -X lua_script:target.lua

    Linux socketcan can directly traced with wireshark. In wireshark select some can frame.
    Right-click and select *decode as* and select *SIGNALDECODE* as subdissector

    *dissect_canneloni.lua* in the canmatrix example folder shows an example for decoding can
    frames which are packet in UDP frames by cannelone (https://github.com/mguentner/cannelloni, https://github.com/PhilippFux/cannelloni)

    you could use it like:

    .. code-block:: bash

        $ chdir canmatrix/examples
        $ canconvert some.dbc can_database.lua
        $ wireshark wireshark -X lua_script:dissect_cannelloni.lua

    note: default cannelloni is mapped to UDP port 3333, you have to change it

    note: *can_database* is hard coded in *dissect_cannelloni.lua*, you can customize it there