reference

Python package for controlling Vector CANalyzer tool

CANalyzer(py_log_dir='', user_capl_functions=tuple())

The CANalyzer class represents the CANalyzer application. The CANalyzer class is the foundation for the object hierarchy. You can reach all other methods from the CANalyzer class instance.

add_offline_source_log_file(absolute_log_file_path)

this method adds offline source log file.

Parameters:
  • absolute_log_file_path (str) –

    absolute path of offline source log file.

Returns:
  • bool( bool ) –

    returns True if log file added or already available. False if log file not available.

break_measurement_in_offline_mode()

Interrupts the playback in Offline mode.

call_capl_function(name, *arguments)

Calls a CAPL function. Please note that the number of parameters must agree with that of the CAPL function. not possible to read return value of CAPL function at the moment. only execution status is returned.

Parameters:
  • name (str) –

    The name of the CAPL function. Please make sure this name is already passed as argument during CANalyzer instance creation. see example for more info.

  • arguments (tuple, default: () ) –

    Function parameters p1…p10 (optional).

Returns:
  • bool( bool ) –

    CAPL function execution status. True-success, False-failed.

check_j1939_signal_online(bus, channel, message, signal, source_addr, dest_addr)

Checks whether the measurement is running and the signal has been received.

Parameters:
  • bus (str) –

    The Bus(CAN, LIN, FlexRay, MOST, AFDX, Ethernet) on which the signal is sent.

  • channel (int) –

    The channel on which the signal is sent.

  • message (str) –

    The name of the message to which the signal belongs.

  • signal (str) –

    The name of the signal.

  • source_addr (int) –

    The source address of the ECU that sends the message.

  • dest_addr (int) –

    The destination address of the ECU that receives the message.

Returns:
  • bool( bool ) –

    TRUE: if the measurement is running and the signal has been received. FALSE: if not.

check_j1939_signal_state(bus, channel, message, signal, source_addr, dest_addr)

Returns the state of the signal.

Returns:
  • int( int ) –

    State of the signal. possible values are: 0: The default value of the signal is returned. 1: The measurement is not running; the value set by the application is returned. 3: The signal has been received in the current measurement; the current value is returned.

check_signal_online(bus, channel, message, signal)

Checks whether the measurement is running and the signal has been received.

Parameters:
  • bus (str) –

    The Bus(CAN, LIN, FlexRay, MOST, AFDX, Ethernet) on which the signal is sent.

  • channel (int) –

    The channel on which the signal is sent.

  • message (str) –

    The name of the message to which the signal belongs.

  • signal (str) –

    The name of the signal.

Returns:
  • bool

    TRUE if the measurement is running and the signal has been received. FALSE if not.

check_signal_state(bus, channel, message, signal)

Checks whether the measurement is running and the signal has been received.

Parameters:
  • bus (str) –

    The Bus(CAN, LIN, FlexRay, MOST, AFDX, Ethernet) on which the signal is sent.

  • channel (int) –

    The channel on which the signal is sent.

  • message (str) –

    The name of the message to which the signal belongs.

  • signal (str) –

    The name of the signal.

Returns:
  • int

    State of the signal. 0- The default value of the signal is returned. 1- The measurement is not running; the value set by the application is returned. 2- The measurement is not running; the value of the last measurement is returned. 3- The signal has been received in the current measurement; the current value is returned.

clear_write_window_content()

Clears the contents of the Write Window.

compile_all_capl_nodes()

compiles all CAPL, XML and .NET nodes.

copy_write_window_content()

Copies the contents of the Write Window to the clipboard.

define_system_variable(sys_var_name, value)

define_system_variable Create a system variable with an initial value Args: sys_var_name (str): The name of the system variable. Ex- "sys_var_demo::speed" value (Union[int, float, str]): variable value. Default value 0.

Returns:
  • object( object ) –

    The new Variable object.

disable_write_window_output_file(tab_index=None)

Disables logging of all outputs of the Write Window.

Parameters:
  • tab_index (int, default: None ) –

    The index of the page, for which logging of the output is to be activated. Defaults to None.

enable_write_window_output_file(output_file, tab_index=None)

Enables logging of all outputs of the Write Window in the output file.

Parameters:
  • output_file (str) –

    The complete path of the output file.

  • tab_index (int, default: None ) –

    The index of the page, for which logging of the output is to be activated. Defaults to None.

get_application_info()

Vector CANalyzer Application Version.

Returns:
  • str( str ) –

    return Vector CANalyzer Application Version. "major.minor.build" -> "12.01.04"

get_can_bus_statistics(channel)

Returns CAN Bus Statistics.

Parameters:
  • channel (int) –

    The channel of the statistic that is to be returned.

Returns:
  • dict

    CAN bus statistics.

get_canalyzer_version_info()

The Version class represents the version of the CANalyzer application.

Returns:
  • dict

    "full_name" - The complete CANalyzer version.

  • dict

    "name" - The CANalyzer version.

  • dict

    "build" - The build number of the CANalyzer application.

  • dict

    "major" - The major version number of the CANalyzer application.

  • dict

    "minor" - The minor version number of the CANalyzer application.

  • dict

    "patch" - The patch number of the CANalyzer application.

get_j1939_signal_full_name(bus, channel, message, signal, source_addr, dest_addr)

Determines the fully qualified name of a signal.

Parameters:
  • bus (str) –

    The Bus(CAN, LIN, FlexRay, MOST, AFDX, Ethernet) on which the signal is sent.

  • channel (int) –

    The channel on which the signal is sent.

  • message (str) –

    The name of the message to which the signal belongs.

  • signal (str) –

    The name of the signal.

  • source_addr (int) –

    The source address of the ECU that sends the message.

  • dest_addr (int) –

    The destination address of the ECU that receives the message.

Returns:
  • str( str ) –

    The fully qualified name of a signal. The following format will be used for signals: ::::

get_j1939_signal_value(bus, channel, message, signal, source_addr, dest_addr, raw_value=False)

get_j1939_signal Returns a Signal object.

Parameters:
  • bus (str) –

    The Bus(CAN, LIN, FlexRay, MOST, AFDX, Ethernet) on which the signal is sent.

  • channel (int) –

    The channel on which the signal is sent.

  • message (str) –

    The name of the message to which the signal belongs.

  • signal (str) –

    The name of the signal.

  • source_addr (int) –

    The source address of the ECU that sends the message.

  • dest_addr (int) –

    The destination address of the ECU that receives the message.

  • raw_value (bool, default: False ) –

    return raw value of the signal if true. Default(False) is physical value.

Returns:
  • Union[float, int]

    signal value.

get_measurement_index()

gets the measurement index for the next measurement.

Returns:
  • int

    Measurement Index.

get_measurement_running_status()

Returns the running state of the measurement.

Returns:
  • bool

    True if The measurement is running.

  • bool

    False if The measurement is not running.

get_signal_full_name(bus, channel, message, signal)

Determines the fully qualified name of a signal.

Parameters:
  • bus (str) –

    The Bus(CAN, LIN, FlexRay, MOST, AFDX, Ethernet) on which the signal is sent.

  • channel (int) –

    The channel on which the signal is sent.

  • message (str) –

    The name of the message to which the signal belongs.

  • signal (str) –

    The name of the signal.

Returns:
  • str( str ) –

    The fully qualified name of a signal. The following format will be used for signals: ::::

get_signal_value(bus, channel, message, signal, raw_value=False)

get_signal_value Returns a Signal value.

Parameters:
  • bus (str) –

    The Bus(CAN, LIN, FlexRay, MOST, AFDX, Ethernet) on which the signal is sent.

  • channel (int) –

    The channel on which the signal is sent.

  • message (str) –

    The name of the message to which the signal belongs.

  • signal (str) –

    The name of the signal.

  • raw_value (bool, default: False ) –

    return raw value of the signal if true. Default(False) is physical value.

Returns:
  • Union[float, int]

    signal value.

get_system_variable_value(sys_var_name)

get_system_variable_value Returns a system variable value.

Parameters:
  • sys_var_name (str) –

    The name of the system variable. Ex- "sys_var_demo::speed"

Returns:
  • Union[int, float, str, tuple, None]

    System Variable value.

new(auto_save=False, prompt_user=False)

Creates a new configuration.

Parameters:
  • auto_save (bool, default: False ) –

    A boolean value that indicates whether the active configuration should be saved if it has been changed. Defaults to False.

  • prompt_user (bool, default: False ) –

    A boolean value that indicates whether the user should intervene in error situations. Defaults to False.

open(canalyzer_cfg, visible=True, auto_save=False, prompt_user=False)

Loads CANalyzer configuration.

Parameters:
  • canalyzer_cfg (str) –

    The complete path for the CANalyzer configuration.

  • visible (bool, default: True ) –

    True if you want to see CANalyzer UI. Defaults to True.

  • auto_save (bool, default: False ) –

    A boolean value that indicates whether the active configuration should be saved if it has been changed. Defaults to False.

  • prompt_user (bool, default: False ) –

    A boolean value that indicates whether the user should intervene in error situations. Defaults to False.

Raises:
  • FileNotFoundError

    error when CANalyzer config file not available in pc.

quit()

Quits the application.

read_text_from_write_window()

read the text contents from Write Window.

Returns:
  • str

    The text content.

reset_measurement()

reset the measurement.

Returns:
  • bool

    Measurement running status(True/False).

reset_measurement_in_offline_mode()

Resets the measurement in Offline mode.

save_configuration()

Saves the configuration.

Returns:
  • bool

    True if configuration saved. else False.

save_configuration_as(path, major, minor, create_dir=True)

Saves the configuration as a different CANalyzer version.

Parameters:
  • path (str) –

    The complete file name.

  • major (int) –

    The major version number of the target version.

  • minor (int) –

    The minor version number of the target version.

  • create_dir (bool, default: True ) –

    create directory if not available. default value True.

Returns:
  • bool

    True if configuration saved. else False.

set_measurement_index(index)

sets the measurement index for the next measurement.

Parameters:
  • index (int) –

    index value to set.

Returns:
  • int

    Measurement Index value.

set_system_variable_array_values(sys_var_name, value, index=0)

set_system_variable_array_values sets array of values to system variable.

Parameters:
  • sys_var_name (str) –

    The name of the system variable. Ex- "sys_var_demo::speed"

  • value (tuple) –

    variable values. supported integer array or double array. please always give only one type.

  • index (int, default: 0 ) –

    value of index where values will start updating. Defaults to 0.

set_system_variable_value(sys_var_name, value)

set_system_variable_value sets a value to system variable.

Parameters:
  • sys_var_name (str) –

    The name of the system variable. Ex- "sys_var_demo::speed".

  • value (Union[int, float, str]) –

    variable value. supported CAPL system variable data types integer, double, string and data.

start_measurement(timeout=60)

Starts the measurement.

Parameters:
  • timeout (int, default: 60 ) –

    measurement start/stop event timeout in seconds. Defaults to 60.

Returns:
  • bool

    True if measurement started. else False.

start_measurement_in_animation_mode(animation_delay=100)

Starts the measurement in Animation mode.

Parameters:
  • animation_delay (int, default: 100 ) –

    The animation delay during the measurement in Offline Mode.

step_measurement_event_in_single_step()

Processes a measurement event in single step.

stop_ex_measurement(timeout=60)

StopEx repairs differences in the behavior of the Stop method on deferred stops concerning simulated and real mode in CANalyzer.

Parameters:
  • timeout (int, default: 60 ) –

    measurement start/stop event timeout in seconds. Defaults to 60.

Returns:
  • bool

    True if measurement stopped. else False.

stop_measurement(timeout=60)

Stops the measurement.

Parameters:
  • timeout (int, default: 60 ) –

    measurement start/stop event timeout in seconds. Defaults to 60.

Returns:
  • bool

    True if measurement stopped. else False.

ui_activate_desktop(name)

Activates the desktop with the given name.

Parameters:
  • name (str) –

    The name of the desktop to be activated.

ui_open_baudrate_dialog()

opens the dialog for configuring the bus parameters. Make sure Measurement stopped when using this method.

write_text_in_write_window(text)

Outputs a line of text in the Write Window. Args: text (str): The text.