The Listener class is an "abstract" base class for any objects which wish to register to receive notifications of new messages on the bus. A Listener can be used in two ways; the default is to call the Listener with a new message, or by calling the method on_message_received.
Listeners are registered with notifier
object(s) which ensure they are notified whenever a new message is received.
Subclasses of Listener that do not override on_message_received will cause NotImplementedError to be thrown when a message is received on the CAN bus.
can.Listener
can.BufferedReader
The can.Logger
uses the following can.Listener
types to create .asc, .csv and .db files with the messages received.
can.Logger
can.Printer
can.CSVWriter
can.SqliteWriter
The messages are written to the table messages
in the sqlite database. The table is created if it does not already exist.
The entries are as follows:
Name | Data type | Note |
---|---|---|
ts | REAL | The timestamp of the message |
arbitration_id | INTEGER | The arbitration id, might use the extended format |
extended | INTEGER | 1 if the arbitration id uses the extended format, else 0 |
remote | INTEGER | 1 if the message is a remote frame, else 0 |
error | INTEGER | 1 if the message is an error frame, else 0 |
dlc | INTEGER | The data length code (DLC) |
data | BLOB | The content of the message |
ASCWriter logs CAN data to an ASCII log file compatible with other CAN tools such as Vector CANalyzer/CANoe and other. Since no official specification exists for the format, it has been reverse-engineered from existing log files. One description of the format can be found here.
Note
Channels will be converted to integers.
can.ASCWriter
ASCReader reads CAN data from ASCII log files .asc as further references can-utils can be used: asc2log, log2asc.
can.ASCReader
CanutilsLogWriter logs CAN data to an ASCII log file compatible with can-utils <https://github.com/linux-can/can-utils> As specification following references can-utils can be used: asc2log, log2asc.
can.io.CanutilsLogWriter
CanutilsLogReader reads CAN data from ASCII log files .log
can.io.CanutilsLogReader
Implements support for BLF (Binary Logging Format) which is a proprietary CAN log format from Vector Informatik GmbH.
The data is stored in a compressed format which makes it very compact.
Note
Channels will be converted to integers.
can.BLFWriter
can.BLFReader