File: fr_dump.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 (14 lines) | stat: -rw-r--r-- 617 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/env python3
import canmatrix.formats
import sys
cluster = canmatrix.formats.loadp(sys.argv[1], decode_flexray = True)

for cm in cluster:
    for frame in cluster[cm]:
        frame_info = "{}-{}-{}".format(frame.slot_id, frame.base_cycle, frame.repitition_cycle)
        for pdu in frame.pdus:
            for signal in pdu.signals:
                sig_group = pdu.get_signal_group_for_signal(signal)
                sig_group = "None" if sig_group is None else sig_group.name
                print("{}: {}, {}, {}, {}, {}".format(frame_info, frame.size, pdu.pdu_type, pdu.name, sig_group, signal.name))