python-can tools

Note

python-can-csscan-mf4 supports file extensions *.MF4, *.MFC, *.MFE and *.MFM.

python-can comes with a range of useful command-line tools (similar to Linux can-utils). For more information see https://python-can.readthedocs.io/en/stable/scripts.html.

This page includes examples on how to use python-can tools relevant to the python-can-csscan-mf4 package.

Note

The examples on this page assume that the python-can-csscan-mf4 package has been installed and the Python environment is active.


can-player

Warning

can-player selects parser based on file extension. If multiple *.MF4 parsers are installed, it may not correctly select the parser from the python-can-csscan-mf4 package.

The can-player tool (similar to can-utils canplayer) can be used to replay log-files to any interface supported by python-can (e.g. csscan_serial).

For more information see https://python-can.readthedocs.io/en/stable/scripts.html#can-player

can-player, replay file 00000001.MF4 to screen using original timestamp spacing
$ can_player --interface virtual -v 00000001.MF4

Can LogReader (Started on 2024-01-01 12:00:00.000000)
Timestamp: 1707825204.228200  ID:  002  S Rx  DL:  8  10 32 f0 37 40 32 30 38  Channel: CAN 1
Timestamp: 1707825204.228650  ID:  003  S Rx  DL:  8  10 32 00 38 30 32 10 38  Channel: CAN 1
Timestamp: 1707825204.238200  ID:  002  S Rx  DL:  8  30 32 d0 37 70 32 10 38  Channel: CAN 1
Timestamp: 1707825204.238700  ID:  003  S Rx  DL:  8  40 32 e0 37 50 32 00 38  Channel: CAN 1
can-player, replay file 00000001.MF4 to interface using original timestamp spacing
$ can_player --interface csscan_serial --channel COM1 -v 00000001.MF4

Can LogReader (Started on 2024-01-01 12:00:00.000000)
Timestamp: 1707825204.228200  ID:  002  S Rx  DL:  8  10 32 f0 37 40 32 30 38  Channel: CAN 1
Timestamp: 1707825204.228650  ID:  003  S Rx  DL:  8  10 32 00 38 30 32 10 38  Channel: CAN 1
Timestamp: 1707825204.238200  ID:  002  S Rx  DL:  8  30 32 d0 37 70 32 10 38  Channel: CAN 1
Timestamp: 1707825204.238700  ID:  003  S Rx  DL:  8  40 32 e0 37 50 32 00 38  Channel: CAN 1
...

To manually control replay scheduling, use the --ignore-timestamps and -g arguments.

can-player, replay file 00000001.MF4 using fixed time spacing (1 second)
$ can_player --interface csscan_serial --channel COM1 -v --ignore-timestamps -g 1 00000001.MF4