mtf_xcp

class mtf.libs.mtf_pybinder.mtf_xcp

Interface for read and write access to the memory of an ECU using the XCP protocol (Universal Measurement and Calibration Protocol)

__init__(self: mtf.libs.mtf_pybinder.mtf_xcp) None
__new__(**kwargs)
configure(self: mtf.libs.mtf_pybinder.mtf_xcp, ecu_name: str, channel_name: str, option: mtf.libs.mtf_pybinder.XcpConfigOption, value: int) bool

Set a configuration option for the given ECU

ecu_name: ECU name like it’s defined in the A2L file channel_name: Channel used for the communication with the ECU (e.g. CAN_1) option: the option to configure value: signed integer option value

connect(*args, **kwargs)

Overloaded function.

  1. connect(self: mtf.libs.mtf_pybinder.mtf_xcp, ecu_name: str, channel_name: str, protocol: int, dst_host: str, dst_port: int, src_host: str, src_port: int, callback: Callable[[str, bool], None]) -> bool

Establish connection to the ECU over Ethernet (XCP on TCP or XCP on UDP)

ecu_name: ECU name like it’s defined in the A2L file channel_name: Channel used for the communication with the ECU (e.g. CAN_1) protocol: XCP on TCP (1) or XCP on UDP (2) dst_host: IP Address of the ECU dst_port: Port number dedicated to the XCP communication on the ECU src_host: Local interface address to be used for the connection src_port: Local port number to be used for the connection callback: Function to be called every time the connection state change (true -> connected, false -> disconnected)

  1. connect(self: mtf.libs.mtf_pybinder.mtf_xcp, ecu_name: str, channel_name: str, protocol: int, callback: Callable[[str, bool], None]) -> bool

Establish connection to the ECU over Ethernet (XCP on TCP or XCP on UDP),

ecu_name: ECU name like it’s defined in the A2L file using the Ethernet settings from the A2L file channel_name: Channel used for the communication with the ECU (e.g. CAN_1) protocol: XCP on TCP (1) or XCP on UDP (2) callback: Function to be called every time the connection state change (true -> connected, false -> disconnected)

connect_can(*args, **kwargs)

Overloaded function.

  1. connect_can(self: mtf.libs.mtf_pybinder.mtf_xcp, ecu_name: str, channel_name: str, master_id: int, slave_id: int, can_fd: bool, max_dlc_required: bool, callback: Callable[[str, bool], None]) -> bool

Establish connection to the ECU over CAN

ecu_name: ECU name like it’s defined in the A2L file channel_name : Channel used for the communication with the ECU(e.g.CAN_1) master_id: Local CAN ID slave_id : ECU CAN ID can_fd : Use CANFD max_dlc_required: Always pad CAN frame to max DLC callback : Function to be called every time the connection state change(true->connected, false->disconnected)

  1. connect_can(self: mtf.libs.mtf_pybinder.mtf_xcp, ecu_name: str, channel_name: str, callback: Callable[[str, bool], None]) -> bool

Establish connection to the ECU over CAN using the CAN settings from the A2L file

ecu_name: ECU name like it’s defined in the A2L file channel_name : Channel used for the communication with the ECU(e.g.CAN_1) callback : Function to be called every time the connection state change(true->connected, false->disconnected)

connect_npdu(self: mtf.libs.mtf_pybinder.mtf_xcp, ecu_name: str, channel_name: str, tunnel_name: str, master_pdu_id: int, slave_pdu_id: int, payload_length_required: int, callback: Callable[[str, bool], None]) bool

Establish connection to the ECU over Ethernet NPDU

ecu_name: ECU name like it’s defined in the A2L file channel_name : Channel used for the communication with the ECU tunnel_name: nPdu tunnel name like it’s defined in the config master_pdu_id : Master ECU pdu id slave_pdu_id : Slave ECU pdu id payload_length_required: Always pad frame to payload_length_required callback : Function to be called every time the connection state change(true->connected, false->disconnected)

daq_configure(self: mtf.libs.mtf_pybinder.mtf_xcp, ecu_name: str, channel_name: str, configuration: dict[int, tuple[int, list[list[str]]]]) bool

Set DAQ configuration

ecu_name: ECU name like it’s defined in the A2L file channel_name: Channel used for the communication with the ECU (e.g. CAN_1) configuration: Configuration to use

daq_decode_payload(self: mtf.libs.mtf_pybinder.mtf_xcp, ecu_name: str, channel_name: str, payload: list[int]) list[mtf.libs.mtf_pybinder.xcp_daq_sample]

Decode a DAQ event payload

ecu_name: ECU name like it’s defined in the A2L file channel_name: Channel used for the communication with the ECU (e.g. CAN_1) payload: the data of a DAQ event message

daq_enable(self: mtf.libs.mtf_pybinder.mtf_xcp, ecu_name: str, channel_name: str) bool

Enable DAQ and read configuration from ECU

ecu_name: ECU name like it’s defined in the A2L file channel_name: Channel used for the communication with the ECU (e.g. CAN_1)

daq_poll(self: mtf.libs.mtf_pybinder.mtf_xcp, ecu_name: str, channel_name: str, data_object: str, interval_ms: int) bool

Add data object to poll for the given ECU

ecu_name: ECU name like it’s defined in the A2L file channel_name: Channel used for the communication with the ECU (e.g. CAN_1) data_object: data object name to poll interval_ms: milliseconds between polling the object, 0 to disable polling

daq_set_callback(self: mtf.libs.mtf_pybinder.mtf_xcp, ecu_name: str, channel_name: str, callback: Callable[[int, str, xcp_value], None]) int

Set callback for updated measurements for the given ECU

ecu_name: ECU name like it’s defined in the A2L file channel_name: Channel used for the communication with the ECU (e.g. CAN_1) callback: Callback to be executed when measurement gets updated

daq_set_list_options(self: mtf.libs.mtf_pybinder.mtf_xcp, ecu_name: str, channel_name: str, list_index: int, options: mtf.libs.mtf_pybinder.xcp_daq_list_options) bool

Set DAQ list options

ecu_name: ECU name like it’s defined in the A2L file channel_name: Channel used for the communication with the ECU (e.g. CAN_1) list_index: Index of the list to set the options for options: Options to be set

daq_start(self: mtf.libs.mtf_pybinder.mtf_xcp, ecu_name: str, channel_name: str) bool

Start data acquisition for the given ECU

ecu_name: ECU name like it’s defined in the A2L file channel_name: Channel used for the communication with the ECU (e.g. CAN_1)

daq_stop(self: mtf.libs.mtf_pybinder.mtf_xcp, ecu_name: str, channel_name: str) bool

Stop data acquisition for the given ECU

ecu_name: ECU name like it’s defined in the A2L file channel_name: Channel used for the communication with the ECU (e.g. CAN_1)

daq_validate_configuration(self: mtf.libs.mtf_pybinder.mtf_xcp, ecu_name: str, channel_name: str, try_fix: bool) bool

Validate (and fix) the current DAQ configuration

ecu_name: ECU name like it’s defined in the A2L file channel_name: Channel used for the communication with the ECU (e.g. CAN_1) try_fix: If false, the configuration is not modified (not supported yet), if true, tries to fix the configuration

daq_watch(self: mtf.libs.mtf_pybinder.mtf_xcp, ecu_name: str, channel_name: str, measurements: list[str]) bool

Set measurements to watch for the given ECU

ecu_name: ECU name like it’s defined in the A2L file channel_name: Channel used for the communication with the ECU (e.g. CAN_1) measurements: Measurement names to watch

deinit(self: mtf.libs.mtf_pybinder.mtf_xcp, ecu_name: str, channel_name: str) bool

Deinit the XCP module

ecu_name: ECU name like it’s defined in the A2L file channel_name: Channel used for the communication with the ECU (e.g. CAN_1)

detect_ecus(self: mtf.libs.mtf_pybinder.mtf_xcp) list[str]

Get list of available Ecus (List[Dict[str, Any]])

disconnect(self: mtf.libs.mtf_pybinder.mtf_xcp, ecu_name: str, channel_name: str) bool

Close connection to the ECU

ecu_name: ECU name like it’s defined in the A2L file channel_name: Channel used for the communication with the ECU (e.g. CAN_1)

get_all_characteristics(self: mtf.libs.mtf_pybinder.mtf_xcp, ecu_name: str, channel_name: str) list[str]

Get list of ECU characteristics defined on the A2L file

get_all_ecu_names(self: mtf.libs.mtf_pybinder.mtf_xcp) list[str]

Get list of ECU defined on the A2L file

get_all_measurements(self: mtf.libs.mtf_pybinder.mtf_xcp, ecu_name: str, channel_name: str) list[str]

Get list of ECU measurements defined on the A2L file

get_object_data_type(self: mtf.libs.mtf_pybinder.mtf_xcp, ecu_name: str, channel_name: str, a2l_obj_name: str) mtf.libs.mtf_pybinder.XcpDataType

Retrieves the data type associated with a given object name.

ecu_name: ECU name like it’s defined in the A2L file channel_name: Channel used for the communication with the ECU (e.g. CAN_1) obj_name: The name of the object for which to retrieve the data type from the A2L file

init(self: mtf.libs.mtf_pybinder.mtf_xcp, ecu_name: str, channel_name: str, a2l_file_path: str) bool

Init the XCP module

ecu_name: ECU name like it’s defined in the A2L file channel_name: Channel used for the communication with the ECU (e.g. CAN_1) a2l_file_path: Path to the A2L file

read(self: mtf.libs.mtf_pybinder.mtf_xcp, ecu_name: str, channel_name: str, variable_name: str, raw_value: bool = False) tuple[float, bool]

Read out variable (calibration or measurement) value from the ECU

ecu_name: ECU name like it’s defined in the A2L file channel_name: Channel used for the communication with the ECU (e.g. CAN_1) variable_name: characteristic/measurement like defined in the a2l file

read_complex_type(self: mtf.libs.mtf_pybinder.mtf_xcp, ecu_name: str, channel_name: str, variable_name: str, raw_value: bool = False) xcp_value

Read out variable (calibration or measurement) value from the ECU

ecu_name: ECU name like it’s defined in the A2L file channel_name: Channel used for the communication with the ECU (e.g. CAN_1) variable_name: characteristic/measurement like defined in the a2l file raw_value: read ECU value without conversion to physical

write(self: mtf.libs.mtf_pybinder.mtf_xcp, ecu_name: str, channel_name: str, variable_name: str, value: float, raw_value: bool = False) bool

Set the ECU internal calibration value

ecu_name: ECU name like it’s defined in the A2L file channel_name: Channel used for the communication with the ECU (e.g. CAN_1) variable_name: characteristic like defined in the a2l file value: float value

write_complex_type(self: mtf.libs.mtf_pybinder.mtf_xcp, ecu_name: str, channel_name: str, variable_name: str, value: xcp_value, raw_value: bool = False) bool

Set the ECU internal calibration value

ecu_name: ECU name like it’s defined in the A2L file channel_name: Channel used for the communication with the ECU (e.g. CAN_1) variable_name: characteristic like defined in the a2l file value: numpy array raw_value: treat value as ECU value and write without conversion