File: j1939_test.py

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 (11 lines) | stat: -rw-r--r-- 453 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
import canmatrix.formats

my_matrix = canmatrix.formats.loadp_flat(r"C:\Users\edu\Downloads\obd2-test\CSS-Electronics-OBD2-incl-extended-v2.0.dbc")

for num, frame in enumerate(my_matrix.frames):
    print(f"Frame {num}: {frame}")
    print(f" is j1939: {frame.is_j1939}")
    print(f" id:  {frame.arbitration_id}")
    print(f' Format: {frame.attributes["VFrameFormat"]}')
    if frame.is_j1939:
        print(f" pgn: {hex(frame.arbitration_id.pgn)}")