stucancommon.driver module¶
-
PythonCanDriver.__init__(bitrate, bustype='kvaser')[source]¶ Initialize PythonCanDriver.can_bus with the specified bitrate for a Kvaser interface if running on Windows, otherwise you must specify your bustype interface such as SocketCAN (not tested yet)
Parameters: bitrate – CAN bus speed
-
class
stucancommon.driver.PythonCanDriver(bitrate, bustype='kvaser')[source]¶ Bases:
objectThis class act as a CAN bus interface in order to communicate with the Xcom-CAN, it is NOT intended to access it directly.
-
can_bus¶ low-level device specific CAN interface
Type: can.interface.Bus
-
receive(timeout=100)[source]¶ Read a message on the CAN bus, waiting block
Parameters: timeout (float) – milli seconds to wait for a message (default 100ms) Returns: identifier, data, dlc, flag, timestamp Return type: tuple
-
send(identifier, data, is_extended_id=False)[source]¶ Send a message on the CAN bus
Parameters: - identifier (int) – The frame identifier used for arbritration on the bus
- data (bytearray) – The data parameter of a CAN message, length from 0 to 8 bytes
- is_extended_id (bool) – Set usage of CAN2.0A (Standard, 11 bits identifier) of CAN2.0B (extended, 29 bits identifier)
-