ECUManager

class ecu.ECUManager(scan_usb=True, custom_hardware=[])

Scan for ECUs connected with USB or I2C.

If not disabled all USB ports will be check for connected ECUs when an instance is created. Scanning for I2C connections must be manually triggered.

Parameters:
  • scan_usb (bool) – scan for USB connected ECUs

  • custom_hardware (list of dicts) – definitions of additional custom hardware variants

Methods:

scan_usb()

Scan for ECUs connected with USB.

scan_i2c(i2c_interfaces)

Scan for ECUs connected with I2C.

get_all()

All ECUs connected with USB and I2C.

get_by_uuid(uuid)

Get a connected ECU by it's UUID.

Attributes:

ecus

All ECUs connected with USB and I2C.

uuids

UUIDs of all connected ECUs.

scan_usb()

Scan for ECUs connected with USB. This will remove disconnected units from the list of available ECUs.

Returns:

None

scan_i2c(i2c_interfaces)

Scan for ECUs connected with I2C. This will remove disconnected units from the list of available ECUs. A list of I2C interfaces is given that will be scanned for available ECUs.

These interfaces must have the following callable methods accepting the same parameters as the smbus2 library: * write_quick() * write_byte() * write_i2c_block_data() * read_byte() * read_i2c_block_data()

Parameters:

i2c_interfaces (list) – I2C interfaces to scan

Returns:

None

Raises:

TypeError – if I2C interface does not implement all required methods

property ecus

All ECUs connected with USB and I2C.

Type:

list

get_all()

All ECUs connected with USB and I2C.

Returns:

connected ECUs

Return type:

list

property uuids

UUIDs of all connected ECUs.

Type:

list

get_by_uuid(uuid)

Get a connected ECU by it’s UUID.

Parameters:

uuid (str) – UUID of ECU to get

Returns:

ECU

Return type:

ECU

Raises:

ValueError – if ECU with UUID is not connected.