py_canoe.CANoe

Source code in src\py_canoe\canoe.py
30
31
32
33
34
35
36
37
38
39
40
41
42
43
def __init__(self, py_canoe_log_dir: str | Path = "", user_capl_functions: Sequence[str] = tuple(), clean_gen_py_cache: bool = False) -> None:
    self.application: Application = None
    try:
        pythoncom.CoInitialize()
        if py_canoe_log_dir:
            update_logger_file_path(logger, py_canoe_log_dir)
        if clean_gen_py_cache:
            self._clean_gen_py_cache()
    except pythoncom.com_error:
        logger.warning("COM already initialized in this thread.")
    except Exception as e:
        logger.error(f"COM init error: {e}")
    finally:
        self.user_capl_functions = user_capl_functions

__enter__()

Enter context manager.

Source code in src\py_canoe\canoe.py
45
46
47
48
49
def __enter__(self):
    """
    Enter context manager.
    """
    return self

__exit__(exc_type, exc_val, exc_tb)

Exit context manager and cleanup resources. Explicitly release resources and uninitialize COM.

Source code in src\py_canoe\canoe.py
51
52
53
54
55
56
57
58
59
60
61
def __exit__(self, exc_type, exc_val, exc_tb):
    """
    Exit context manager and cleanup resources. Explicitly release resources and uninitialize COM.
    """
    try:
        if self.application is not None:
            pythoncom.CoUninitialize()
    except Exception as e:
        logger.error(f"Error during COM uninitialization: {e}.")
    finally:
        self.application = None

add_database(database_file, network)

adds database file to a network channel

Parameters:
  • database_file (str) –

    database file to attach. give full file path.

  • network (str | int) –

    network name or channel number on which you want to add database.

Source code in src\py_canoe\canoe.py
1026
1027
1028
1029
1030
1031
1032
1033
def add_database(self, database_file: str, network: str | int) -> bool:
    """adds database file to a network channel

    Args:
        database_file (str): database file to attach. give full file path.
        network (str | int): network name or channel number on which you want to add database.
    """
    return self.application.configuration.add_database(database_file, network)

add_filters_to_exporter(logger_index, full_names)

Add messages and symbols to exporter filter by their full names.

Parameters:
  • logger_index (int) –

    indicates logger

  • full_names (Iterable) –

    full names of messages and symbols

Source code in src\py_canoe\canoe.py
1272
1273
1274
1275
1276
1277
1278
1279
def add_filters_to_exporter(self, logger_index: int, full_names: 'Iterable'):
    """Add messages and symbols to exporter filter by their full names.

    Args:
        logger_index (int): indicates logger
        full_names (Iterable): full names of messages and symbols
    """
    return self.application.configuration.add_filters_to_exporter(logger_index, full_names)

add_logging_block(full_name)

adds a new logging block to configuration measurement setup.

Parameters:
  • full_name (str) –

    full path to log file as "C:/file.(asc|blf|mf4|...)", may have field functions like {IncMeasurement} in the file name.

Returns:
  • Logging( Logging ) –

    returns Logging object of added logging block.

Source code in src\py_canoe\canoe.py
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
def add_logging_block(self, full_name: str) -> 'Logging':
    """adds a new logging block to configuration measurement setup.

    Args:
        full_name (str): full path to log file as "C:/file.(asc|blf|mf4|...)", may have field functions like {IncMeasurement} in the file name.

    Returns:
        Logging: returns Logging object of added logging block.
    """
    return self.application.configuration.add_logging_block(full_name)

add_netWork(network_name, network_type=BusType.CAN, sw_channel=1)

Adds a new network to the configuration.

Parameters:
  • network_name (str) –

    Name of the new network.

  • network_type (BusType, default: CAN ) –

    Bus type. Defaults to BusType.CAN.

  • sw_channel (int, default: 1 ) –

    Software channel index (1-based) to assign. Defaults to 1.

Returns:
  • Bus –

    The newly added :class:Bus object.

Source code in src\py_canoe\canoe.py
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
def add_netWork(self, network_name: str, network_type: BusType = BusType.CAN,
                sw_channel: int = 1) -> Bus:
    """Adds a new network to the configuration.

    Args:
        network_name: Name of the new network.
        network_type: Bus type. Defaults to BusType.CAN.
        sw_channel: Software channel index (1-based) to assign.
            Defaults to 1.

    Returns:
        The newly added :class:`Bus` object.
    """
    return self.application.configuration.add_netWork(network_name, network_type, sw_channel)

add_netWork_with_hardware(network_name, network_type=BusType.CAN, sw_channel=1, hw_channel=None, arb_phase_config=None, data_phase_config=None)

Add a network and optionally assign a physical hardware channel.

This combines :meth:add_netWork + :meth:set_hardware_channel.

Parameters:
  • network_name (str) –

    Network name.

  • network_type (BusType, default: CAN ) –

    Bus type.

  • sw_channel (int, default: 1 ) –

    Software channel index (1-based).

  • hw_channel (ChannelInfo | None, default: None ) –

    Physical hardware channel from :meth:get_hardware_channels. Pass None to skip hardware assignment.

Returns:
  • Bus –

    The newly added :class:Bus object.

Source code in src\py_canoe\canoe.py
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
def add_netWork_with_hardware(self, network_name: str,
                               network_type: BusType = BusType.CAN,
                               sw_channel: int = 1,
                               hw_channel: ChannelInfo | None = None,
                               arb_phase_config: CanChannelConfiguration | None = None,
                               data_phase_config: CanChannelConfiguration | None = None
                               ) -> Bus:
    """Add a network and optionally assign a physical hardware channel.

    This combines :meth:`add_netWork` + :meth:`set_hardware_channel`.

    Args:
        network_name: Network name.
        network_type: Bus type.
        sw_channel: Software channel index (1-based).
        hw_channel: Physical hardware channel from
            :meth:`get_hardware_channels`.  Pass *None* to skip
            hardware assignment.

    Returns:
        The newly added :class:`Bus` object.
    """
    bus = self.add_netWork(network_name, network_type, sw_channel)
    if hw_channel is not None:
        # app-channel is 0-based; sw_channel is 1-based
        self.set_hardware_channel(sw_channel - 1, hw_channel, network_type)        

    if network_type == BusType.CAN and (arb_phase_config is not None or data_phase_config is not None):
        # a network can only be bound to one channel
        busController = bus.channels.item(1).controller
        if arb_phase_config is not None and data_phase_config is None:
            # can
            arb_phase_config.apply_to_can_set_config(busController)
        if arb_phase_config is not None and data_phase_config is not None:
            # can fd
            arb_phase_config.apply_to_can_set_fd_arb_phase_config(busController)
            data_phase_config.apply_to_can_set_fd_data_phase_config(busController)
        elif arb_phase_config is None and data_phase_config is not None:
            raise ValueError("data_phase_config cannot be set without arb_phase_config")
    return bus

add_offline_source_log_file(absolute_log_file_path)

Adds an offline source log file to the configuration.

Parameters:
  • absolute_log_file_path (str) –

    The absolute path to the log file.

Returns:
  • bool( bool ) –

    True if the operation was successful, False otherwise.

Source code in src\py_canoe\canoe.py
749
750
751
752
753
754
755
756
757
758
759
def add_offline_source_log_file(self, absolute_log_file_path: str) -> bool:
    """
    Adds an offline source log file to the configuration.

    Args:
        absolute_log_file_path (str): The absolute path to the log file.

    Returns:
        bool: True if the operation was successful, False otherwise.
    """
    return self.application.configuration.add_offline_source_log_file(absolute_log_file_path)

add_testEnvironments(name)

Add a new Test Environment to TestSetup.

If you need to create a new test environment, the name field contains the name of the new test environment. If you need to load an existing test environment from a file, the name field contains the file path, which can be an absolute path or relative to the current configuration.

Parameters:
  • name (str) –

    Name or path of the Test Environment

Source code in src\py_canoe\canoe.py
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
def add_testEnvironments(self, name:str) -> TestEnvironment:
    """
    Add a new Test Environment to TestSetup.

    If you need to create a new test environment, the name field contains the name of the new test environment.
    If you need to load an existing test environment from a file, the name field contains the file path,
    which can be an absolute path or relative to the current configuration.

    Args:
        name (str): Name or path of the Test Environment
    """
    return self.application.configuration.add_testEnvironments(name)

attach_to_active_application()

Attach to a active instance of the CANoe application.

Returns:
  • bool( bool ) –

    True if the operation was successful, False otherwise.

Source code in src\py_canoe\canoe.py
154
155
156
157
158
159
160
161
162
163
164
def attach_to_active_application(self) -> bool:
    """
    Attach to a active instance of the CANoe application.

    Returns:
        bool: True if the operation was successful, False otherwise.
    """
    self._reset_application()
    self.application = Application()
    self.application.user_capl_functions = self.user_capl_functions
    return self.application.attach_to_active_application()

break_measurement_in_offline_mode()

Breaks the measurement in offline mode.

Returns:
  • bool( bool ) –

    True if the operation was successful, False otherwise.

Source code in src\py_canoe\canoe.py
1414
1415
1416
1417
1418
1419
1420
1421
def break_measurement_in_offline_mode(self) -> bool:
    """
    Breaks the measurement in offline mode.

    Returns:
        bool: True if the operation was successful, False otherwise.
    """
    return self.application.measurement.break_measurement_in_offline_mode()

call_capl_function(name, *arguments)

Calls a CAPL function.

Parameters:
  • name (str) –

    The name of the CAPL function.

  • *arguments –

    The arguments to pass to the CAPL function.

Returns:
  • bool( bool ) –

    True if the function call was successful, False otherwise.

Source code in src\py_canoe\canoe.py
711
712
713
714
715
716
717
718
719
720
721
722
def call_capl_function(self, name: str, *arguments) -> bool:
    """
    Calls a CAPL function.

    Args:
        name (str): The name of the CAPL function.
        *arguments: The arguments to pass to the CAPL function.

    Returns:
        bool: True if the function call was successful, False otherwise.
    """
    return self.application.capl.call_capl_function(name, *arguments)

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

Checks if a J1939 signal is online.

Parameters:
  • bus (BusType) –

    The bus type.

  • channel (int) –

    The channel number.

  • message (str) –

    The message name.

  • signal (str) –

    The signal name.

  • source_addr (int) –

    The source address.

  • dest_addr (int) –

    The destination address.

Returns:
  • bool( bool ) –

    True if the signal is online, False otherwise.

Source code in src\py_canoe\canoe.py
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
def check_j1939_signal_online(self, bus: BusType | str | int, channel: int, message: str, signal: str, source_addr: int, dest_addr: int) -> bool:
    """
    Checks if a J1939 signal is online.

    Args:
        bus (BusType): The bus type.
        channel (int): The channel number.
        message (str): The message name.
        signal (str): The signal name.
        source_addr (int): The source address.
        dest_addr (int): The destination address.

    Returns:
        bool: True if the signal is online, False otherwise.
    """
    try:
        bus = self._normalize_bus_type(bus)
        bus_obj = self.application.bus(bus)
        signal_obj = bus_obj.get_j1939_signal(channel, message, signal, source_addr, dest_addr)
        is_online = signal_obj.is_online
        logger.info(f'J1939 Signal({signal_obj.full_name}) is online ?: {is_online} ({bus_obj.VALUE_TABLE_SIGNAL_IS_ONLINE[is_online]})')
        return is_online
    except Exception as e:
        logger.error(f"Error checking J1939 bus signal online status: {e}")
        return False

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

Checks the state of a J1939 signal.

Parameters:
  • bus (BusType) –

    The bus type.

  • channel (int) –

    The channel number.

  • message (str) –

    The message name.

  • signal (str) –

    The signal name.

  • source_addr (int) –

    The source address.

  • dest_addr (int) –

    The destination address.

Returns:
  • int( int ) –

    The state of the signal.

Source code in src\py_canoe\canoe.py
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
def check_j1939_signal_state(self, bus: BusType | str | int, channel: int, message: str, signal: str, source_addr: int, dest_addr: int) -> int:
    """
    Checks the state of a J1939 signal.

    Args:
        bus (BusType): The bus type.
        channel (int): The channel number.
        message (str): The message name.
        signal (str): The signal name.
        source_addr (int): The source address.
        dest_addr (int): The destination address.

    Returns:
        int: The state of the signal.
    """
    try:
        bus = self._normalize_bus_type(bus)
        bus_obj = self.application.bus(bus)
        signal_obj = bus_obj.get_j1939_signal(channel, message, signal, source_addr, dest_addr)
        state = signal_obj.state
        logger.info(f'J1939 Signal({signal_obj.full_name}) state: {state} ({bus_obj.VALUE_TABLE_SIGNAL_STATE[state]})')
        return state
    except Exception as e:
        logger.error(f"Error checking J1939 bus signal state: {e}")
        return -1

check_signal_online(bus, channel, message, signal)

Checks if a signal is online.

Parameters:
  • bus (BusType) –

    The bus type.

  • channel (int) –

    The channel number.

  • message (str) –

    The message name.

  • signal (str) –

    The signal name.

Returns:
  • bool( bool ) –

    True if the signal is online, False otherwise.

Source code in src\py_canoe\canoe.py
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
def check_signal_online(self, bus: BusType | str | int, channel: int, message: str, signal: str) -> bool:
    """
    Checks if a signal is online.

    Args:
        bus (BusType): The bus type.
        channel (int): The channel number.
        message (str): The message name.
        signal (str): The signal name.

    Returns:
        bool: True if the signal is online, False otherwise.
    """
    try:
        bus = self._normalize_bus_type(bus)
        bus_obj = self.application.bus(bus)
        signal_obj = bus_obj.get_signal(channel, message, signal)
        is_online = signal_obj.is_online
        logger.info(f'Signal({signal_obj.full_name}) is online ?: {is_online} ({bus_obj.VALUE_TABLE_SIGNAL_IS_ONLINE[is_online]})')
        return is_online
    except Exception as e:
        logger.error(f"Error checking {bus} bus signal online status: {e}")
        return False

check_signal_state(bus, channel, message, signal)

Checks the state of a signal.

Parameters:
  • bus (BusType) –

    The bus type.

  • channel (int) –

    The channel number.

  • message (str) –

    The message name.

  • signal (str) –

    The signal name.

Returns:
  • int( int ) –

    The state of the signal.

Source code in src\py_canoe\canoe.py
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
def check_signal_state(self, bus: BusType | str | int, channel: int, message: str, signal: str) -> int:
    """
    Checks the state of a signal.

    Args:
        bus (BusType): The bus type.
        channel (int): The channel number.
        message (str): The message name.
        signal (str): The signal name.

    Returns:
        int: The state of the signal.
    """
    try:
        bus = self._normalize_bus_type(bus)
        bus_obj = self.application.bus(bus)
        signal_obj = bus_obj.get_signal(channel, message, signal)
        state = signal_obj.state
        logger.info(f'Signal({signal_obj.full_name}) state: {state} ({bus_obj.VALUE_TABLE_SIGNAL_STATE[state]})')
        return state
    except Exception as e:
        logger.error(f"Error checking {bus} bus signal state: {e}")
        return -1

clear_hardware_channels()

Remove all hardware channel mappings for CANoe.

Source code in src\py_canoe\canoe.py
1218
1219
1220
1221
def clear_hardware_channels(self) -> None:
    """Remove all hardware channel mappings for CANoe."""
    with VxlDriver() as drv:
        drv.unset_all_appl_config("CANoe")

clear_write_window_content()

Clears the content of the write window.

Returns:
  • bool( bool ) –

    True if the operation was successful, False otherwise.

Source code in src\py_canoe\canoe.py
1609
1610
1611
1612
1613
1614
1615
1616
def clear_write_window_content(self) -> bool:
    """
    Clears the content of the write window.

    Returns:
        bool: True if the operation was successful, False otherwise.
    """
    return self.application.ui.write.clear()

compile_all_capl_nodes(wait_time=5)

Compiles all CAPL nodes in the application.

Parameters:
  • wait_time (Union[int, float], default: 5 ) –

    The time to wait for the compilation to complete.

Returns:
  • Union[CompileResult, None] –

    The compilation result or None if an error occurred.

Source code in src\py_canoe\canoe.py
699
700
701
702
703
704
705
706
707
708
709
def compile_all_capl_nodes(self, wait_time: Union[int, float] = 5) -> Union[CompileResult, None]:
    """
    Compiles all CAPL nodes in the application.

    Args:
        wait_time (Union[int, float]): The time to wait for the compilation to complete.

    Returns:
        The compilation result or None if an error occurred.
    """
    return self.application.capl.compile(wait_time)

control_replay_block(block_name, start_stop)

Controls the replay block.

Parameters:
  • block_name (str) –

    The name of the replay block.

  • start_stop (bool) –

    True to start the replay block, False to stop it.

Returns:
  • bool( bool ) –

    True if the operation was successful, False otherwise.

Source code in src\py_canoe\canoe.py
786
787
788
789
790
791
792
793
794
795
796
797
def control_replay_block(self, block_name: str, start_stop: bool) -> bool:
    """
    Controls the replay block.

    Args:
        block_name (str): The name of the replay block.
        start_stop (bool): True to start the replay block, False to stop it.

    Returns:
        bool: True if the operation was successful, False otherwise.
    """
    return self.application.configuration.control_replay_block(block_name, start_stop)

control_tester_present(diag_ecu_qualifier_name, value)

Controls the tester present signal.

Parameters:
  • diag_ecu_qualifier_name (str) –

    The diagnostic ECU qualifier name.

  • value (bool) –

    The value to set for the tester present signal.

Returns:
  • bool( bool ) –

    True if the operation was successful, False otherwise.

Source code in src\py_canoe\canoe.py
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
def control_tester_present(self, diag_ecu_qualifier_name: str, value: bool) -> bool:
    """
    Controls the tester present signal.

    Args:
        diag_ecu_qualifier_name (str): The diagnostic ECU qualifier name.
        value (bool): The value to set for the tester present signal.

    Returns:
        bool: True if the operation was successful, False otherwise.
    """
    return self.application.networks.control_tester_present(diag_ecu_qualifier_name, value)

copy_write_window_content()

Copies the content of the write window.

Returns:
  • bool( bool ) –

    True if the operation was successful, False otherwise.

Source code in src\py_canoe\canoe.py
1618
1619
1620
1621
1622
1623
1624
1625
def copy_write_window_content(self) -> bool:
    """
    Copies the content of the write window.

    Returns:
        bool: True if the operation was successful, False otherwise.
    """
    return self.application.ui.write.copy()

define_system_variable(sys_var_name, value, read_only=False)

Defines a system variable.

Parameters:
  • sys_var_name (str) –

    The name of the system variable.

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

    The value of the system variable.

  • read_only (bool, default: False ) –

    Whether the system variable is read-only.

Returns:
  • object( object ) –

    The created system variable object.

Source code in src\py_canoe\canoe.py
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
def define_system_variable(self, sys_var_name: str, value: Union[int, float, str], read_only: bool = False) -> object:
    """
    Defines a system variable.

    Args:
        sys_var_name (str): The name of the system variable.
        value (Union[int, float, str]): The value of the system variable.
        read_only (bool): Whether the system variable is read-only.

    Returns:
        object: The created system variable object.
    """
    return self.application.system.add_variable(sys_var_name, value, read_only)

disable_write_window_output_file(tab_index=None)

Disables the write window output file.

Parameters:
  • tab_index (Optional[int], default: None ) –

    The tab index to disable the output file for.

Returns:
  • bool( bool ) –

    True if the operation was successful, False otherwise.

Source code in src\py_canoe\canoe.py
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
def disable_write_window_output_file(self, tab_index=None) -> bool:
    """
    Disables the write window output file.

    Args:
        tab_index (Optional[int]): The tab index to disable the output file for.

    Returns:
        bool: True if the operation was successful, False otherwise.
    """
    return self.application.ui.write.disable_output_file(tab_index)

enable_disable_replay_block(block_name, enable_disable)

Enables or disables a replay block.

Parameters:
  • block_name (str) –

    The name of the replay block.

  • enable_disable (bool) –

    True to enable the replay block, False to disable it.

Returns:
  • bool( bool ) –

    True if the operation was successful, False otherwise.

Source code in src\py_canoe\canoe.py
799
800
801
802
803
804
805
806
807
808
809
810
def enable_disable_replay_block(self, block_name: str, enable_disable: bool) -> bool:
    """
    Enables or disables a replay block.

    Args:
        block_name (str): The name of the replay block.
        enable_disable (bool): True to enable the replay block, False to disable it.

    Returns:
        bool: True if the operation was successful, False otherwise.
    """
    return self.application.configuration.enable_disable_replay_block(block_name, enable_disable)

enable_write_window_output_file(output_file, tab_index=None)

Enables the write window output file.

Parameters:
  • output_file (str) –

    The output file path.

  • tab_index (Optional[int], default: None ) –

    The tab index to enable the output file for.

Returns:
  • bool( bool ) –

    True if the operation was successful, False otherwise.

Source code in src\py_canoe\canoe.py
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
def enable_write_window_output_file(self, output_file: str, tab_index=None) -> bool:
    """
    Enables the write window output file.

    Args:
        output_file (str): The output file path.
        tab_index (Optional[int]): The tab index to enable the output file for.

    Returns:
        bool: True if the operation was successful, False otherwise.
    """
    return self.application.ui.write.enable_output_file(output_file, tab_index)

execute_all_test_configurations(enable_test_cases=(), disable_test_cases=(), match_by='name', wait_for_completion=True)

executes all test configurations available in test setup.

Parameters:
  • enable_test_cases (Sequence[str], default: () ) –

    Patterns of test cases to enable before execution.

  • disable_test_cases (Sequence[str], default: () ) –

    Patterns of test cases to disable before execution.

  • match_by (str, default: 'name' ) –

    Matching mode for patterns. One of "name", "group", or "fixture". Defaults to "name".

  • wait_for_completion (bool, default: True ) –

    whether to wait for test configuration execution to complete before returning. defaults to True.

Returns:
  • bool( bool ) –

    True if the operation was successful, False otherwise.

Source code in src\py_canoe\canoe.py
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
def execute_all_test_configurations(self, enable_test_cases: Sequence[str] = (),
                                   disable_test_cases: Sequence[str] = (),
                                   match_by: str = "name",
                                   wait_for_completion: bool = True) -> bool:
    """executes all test configurations available in test setup.

    Args:
        enable_test_cases (Sequence[str]): Patterns of test cases to enable before execution.
        disable_test_cases (Sequence[str]): Patterns of test cases to disable before execution.
        match_by (str): Matching mode for patterns. One of "name", "group", or "fixture". Defaults to "name".
        wait_for_completion (bool): whether to wait for test configuration execution to complete before returning. defaults to True.

    Returns:
        bool: True if the operation was successful, False otherwise.
    """
    return self.application.configuration.execute_all_test_configurations(enable_test_cases,
                                                                        disable_test_cases,
                                                                        match_by,
                                                                        wait_for_completion)

execute_all_test_environments()

executes all test environments available in test setup.

Source code in src\py_canoe\canoe.py
1018
1019
1020
def execute_all_test_environments(self):
    """executes all test environments available in test setup."""
    return self.application.configuration.execute_all_test_environments()

execute_all_test_modules_in_test_env(env_name, enable_test_cases=(), disable_test_cases=(), match_by='name')

executes all test modules available in test environment.

Parameters:
  • env_name (str) –

    test environment name. avoid duplicate test environment names in CANoe configuration.

  • enable_test_cases (Sequence[str], default: () ) –

    Patterns of test cases to enable before execution. Forwarded to every test module. Supports wildcard and regex. If empty (default), no test cases are explicitly enabled.

  • disable_test_cases (Sequence[str], default: () ) –

    Patterns of test cases to disable before execution. Forwarded to every test module. Takes precedence over enable_test_cases. If empty (default), no test cases are disabled.

  • match_by (str, default: 'name' ) –

    Which test case attribute the patterns are matched against. Either "name" (default) or "title".

Source code in src\py_canoe\canoe.py
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
def execute_all_test_modules_in_test_env(self, env_name: str, enable_test_cases: Sequence[str] = (), disable_test_cases: Sequence[str] = (), match_by: str = "name"):
    """executes all test modules available in test environment.

    Args:
        env_name (str): test environment name. avoid duplicate test environment names in CANoe configuration.
        enable_test_cases (Sequence[str]): Patterns of test cases to enable before
            execution. Forwarded to every test module. Supports wildcard and regex.
            If empty (default), no test cases are explicitly enabled.
        disable_test_cases (Sequence[str]): Patterns of test cases to disable before
            execution. Forwarded to every test module. Takes precedence over
            enable_test_cases. If empty (default), no test cases are disabled.
        match_by (str): Which test case attribute the patterns are matched against.
            Either "name" (default) or "title".
    """
    return self.application.configuration.execute_all_test_modules_in_test_env(
        env_name, enable_test_cases, disable_test_cases, match_by=match_by)

execute_test_configuration(test_configuration_name, enable_test_cases=(), disable_test_cases=(), match_by='name', wait_for_completion=True)

executes a specific test configuration.

Parameters:
  • test_configuration_name (str) –

    The name of the test configuration to execute.

  • enable_test_cases (Sequence[str], default: () ) –

    Patterns of test cases to enable before execution.

  • disable_test_cases (Sequence[str], default: () ) –

    Patterns of test cases to disable before execution.

  • match_by (str, default: 'name' ) –

    Matching mode for patterns. One of "name", "group", or "fixture". Defaults to "name".

  • wait_for_completion (bool, default: True ) –

    Whether to wait for the test configuration execution to complete before returning. Defaults to True.

Returns:
  • bool( bool ) –

    True if the operation was successful, False otherwise.

Source code in src\py_canoe\canoe.py
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
def execute_test_configuration(self, test_configuration_name: str,
                               enable_test_cases: Sequence[str] = (),
                               disable_test_cases: Sequence[str] = (),
                               match_by: str = "name",
                               wait_for_completion: bool = True) -> bool:
    """executes a specific test configuration.

    Args:
        test_configuration_name (str): The name of the test configuration to execute.
        enable_test_cases (Sequence[str]): Patterns of test cases to enable before execution.
        disable_test_cases (Sequence[str]): Patterns of test cases to disable before execution.
        match_by (str): Matching mode for patterns. One of "name", "group", or "fixture". Defaults to "name".
        wait_for_completion (bool): Whether to wait for the test configuration execution to complete before returning. Defaults to True.

    Returns:
        bool: True if the operation was successful, False otherwise.
    """
    return self.application.configuration.execute_test_configuration(test_configuration_name,
                                                                     enable_test_cases,
                                                                     disable_test_cases,
                                                                     match_by,
                                                                     wait_for_completion)

execute_test_module(test_module_name, enable_test_cases=(), disable_test_cases=(), match_by='name')

use this method to execute test module.

Parameters:
  • test_module_name (str) –

    test module name. avoid duplicate test module names in CANoe configuration.

  • enable_test_cases (Sequence[str], default: () ) –

    Patterns of test cases to enable before execution. Only matching test cases will be checked. Supports wildcard and regex: - Wildcard: "*pass*", "TC_00?", "TC_[0-3]*" - Regex: "(?i)tc_001", "^SmokeTest_.*" If empty (default), no test cases are explicitly enabled.

  • disable_test_cases (Sequence[str], default: () ) –

    Patterns of test cases to disable before execution. Matching test cases will be unchecked. Takes precedence over enable_test_cases. Supports the same wildcard and regex patterns as enable_test_cases. If empty (default), no test cases are explicitly disabled.

  • match_by (str, default: 'name' ) –

    Which test case attribute the patterns are matched against. Either "name" (default) or "title". Use "title" when your patterns describe the test case title rather than its internal name.

Returns:
  • int( int ) –

    test module execution verdict. 0 ='VerdictNotAvailable', 1 = 'VerdictPassed', 2 = 'VerdictFailed',

Examples:

>>> # Enable only smoke test cases (matched by name)
>>> canoe.execute_test_module("MyModule", enable_test_cases=["SmokeTest_*"])
>>> # Disable slow test cases, enable everything else
>>> canoe.execute_test_module("MyModule", enable_test_cases=["*"], disable_test_cases=["*slow*", "*stress*"])
>>> # Use regex to match
>>> canoe.execute_test_module("MyModule", enable_test_cases=["(?i)^tc_(001|002|003)$"])
>>> # Match patterns against the test case title instead of name
>>> canoe.execute_test_module("MyModule", enable_test_cases=["*BLE*"], match_by="title")
Source code in src\py_canoe\canoe.py
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
def execute_test_module(self, test_module_name: str, enable_test_cases: Sequence[str] = (), disable_test_cases: Sequence[str] = (), match_by: str = "name") -> int:
    """use this method to execute test module.

    Args:
        test_module_name (str): test module name. avoid duplicate test module names in CANoe configuration.
        enable_test_cases (Sequence[str]): Patterns of test cases to enable before execution.
            Only matching test cases will be checked. Supports wildcard and regex:
            - Wildcard: ``"*pass*"``, ``"TC_00?"``, ``"TC_[0-3]*"``
            - Regex: ``"(?i)tc_001"``, ``"^SmokeTest_.*"``
            If empty (default), no test cases are explicitly enabled.
        disable_test_cases (Sequence[str]): Patterns of test cases to disable before execution.
            Matching test cases will be unchecked. Takes precedence over enable_test_cases.
            Supports the same wildcard and regex patterns as enable_test_cases.
            If empty (default), no test cases are explicitly disabled.
        match_by (str): Which test case attribute the patterns are matched against.
            Either "name" (default) or "title". Use "title" when your patterns
            describe the test case title rather than its internal name.

    Returns:
        int: test module execution verdict. 0 ='VerdictNotAvailable', 1 = 'VerdictPassed', 2 = 'VerdictFailed',

    Examples:
        >>> # Enable only smoke test cases (matched by name)
        >>> canoe.execute_test_module("MyModule", enable_test_cases=["SmokeTest_*"])

        >>> # Disable slow test cases, enable everything else
        >>> canoe.execute_test_module("MyModule", enable_test_cases=["*"], disable_test_cases=["*slow*", "*stress*"])

        >>> # Use regex to match
        >>> canoe.execute_test_module("MyModule", enable_test_cases=["(?i)^tc_(001|002|003)$"])

        >>> # Match patterns against the test case title instead of name
        >>> canoe.execute_test_module("MyModule", enable_test_cases=["*BLE*"], match_by="title")
    """
    return self.application.configuration.execute_test_module(test_module_name, enable_test_cases, disable_test_cases, match_by=match_by)

get_all_namespace_names()

Returns all namespace names from the current application.

Source code in src\py_canoe\canoe.py
1530
1531
1532
def get_all_namespace_names(self) -> list[str]:
    """Returns all namespace names from the current application."""
    return self.application.system.get_all_namespace_names()

get_all_network_names()

Returns all network names in the current application.

Source code in src\py_canoe\canoe.py
248
249
250
def get_all_network_names(self) -> list[str]:
    """Returns all network names in the current application."""
    return self.application.networks.get_all_network_names()

get_all_variables_in_namespace(namespace_name)

Returns all variables in the specified namespace.

Source code in src\py_canoe\canoe.py
1534
1535
1536
def get_all_variables_in_namespace(self, namespace_name: str) -> list[dict]:
    """Returns all variables in the specified namespace."""
    return self.application.system.get_all_variables_in_namespace(namespace_name)

get_bus_databases_info(bus=BusType.CAN, log_info=False)

Gets the bus databases information.

Parameters:
  • bus (BusType | str | int, default: CAN ) –

    The bus type. Defaults to BusType.CAN.

  • log_info (bool, default: False ) –

    Whether to log the databases information. Defaults to False.

Returns:
  • dict( dict ) –

    The bus databases information.

Source code in src\py_canoe\canoe.py
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
def get_bus_databases_info(self, bus: BusType | str | int = BusType.CAN, log_info: bool = False) -> dict:
    """
    Gets the bus databases information.

    Args:
        bus (BusType | str | int): The bus type. Defaults to BusType.CAN.
        log_info (bool): Whether to log the databases information. Defaults to False.

    Returns:
        dict: The bus databases information.
    """
    try:
        bus = self._normalize_bus_type(bus)
        bus_obj = self.application.bus(bus)
        databases_info = {}
        for db_obj in bus_obj.com_object.Databases:
            db_file = getattr(db_obj, 'FullName', '')
            fetched_db_info = fetch_database_info(db_file)
            ecus = list(fetched_db_info.get('ecus', {}).keys())
            frames = list(fetched_db_info.get('frames', {}).keys())
            frames_signals = list(fetched_db_info.get('frames_signals', {}).keys())
            pdus = list(fetched_db_info.get('pdus', {}).keys())
            pdus_signals = list(fetched_db_info.get('pdus_signals', {}).keys())
            info = {
                'full_name': getattr(db_obj, 'FullName', ''),
                'path': getattr(db_obj, 'Path', ''),
                'name': getattr(db_obj, 'Name', ''),
                'channel': getattr(db_obj, 'Channel', ''),
                'com_obj': db_obj,
                'ecus': ecus,
                'frames': frames,
                'frames_signals': frames_signals,
                'pdus': pdus,
                'pdus_signals': pdus_signals,
            }
            databases_info[info['name']] = info
        if log_info:
            logger.info(f'{bus.name} bus databases information:')
            for db_name, db_info in databases_info.items():
                logger.info(f"    {db_name}:")
                for key, value in db_info.items():
                    logger.info(f"        {key}: {value}")
        return databases_info
    except Exception as e:
        logger.exception(f"Error retrieving {bus} bus databases information: {e}")
        return {}

get_bus_nodes_info(bus=BusType.CAN, log_info=False)

Gets the bus nodes information.

Parameters:
  • bus (BusType | str | int, default: CAN ) –

    The bus type. Defaults to BusType.CAN.

  • log_info (bool, default: False ) –

    Whether to log the nodes information. Defaults to False.

Returns:
  • dict( dict ) –

    The bus nodes information.

Source code in src\py_canoe\canoe.py
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
def get_bus_nodes_info(self, bus: BusType | str | int = BusType.CAN, log_info: bool = False) -> dict:
    """
    Gets the bus nodes information.

    Args:
        bus (BusType | str | int): The bus type. Defaults to BusType.CAN.
        log_info (bool): Whether to log the nodes information. Defaults to False.

    Returns:
        dict: The bus nodes information.
    """
    try:
        bus = self._normalize_bus_type(bus)
        bus_obj = self.application.bus(bus)
        nodes_info = {}
        for node_obj in bus_obj.com_object.Nodes:
            info = {
                'full_name': getattr(node_obj, 'FullName', ''),
                'path': getattr(node_obj, 'Path', ''),
                'name': getattr(node_obj, 'Name', ''),
                'active': getattr(node_obj, 'Active', ''),
                'com_obj': node_obj,
            }
            nodes_info[info['name']] = info
        if log_info:
            logger.info(f'{bus.name} bus nodes information:')
            for node_name, node_info in nodes_info.items():
                logger.info(f"    {node_name}:")
                for key, value in node_info.items():
                    logger.info(f"        {key}: {value}")
        return nodes_info
    except Exception as e:
        logger.error(f"Error retrieving {bus} bus nodes information: {e}")
        return {}

get_can_bus_statistics(channel)

Gets the CAN bus statistics.

Parameters:
  • channel (int) –

    The channel number.

Returns:
  • dict( dict ) –

    The CAN bus statistics.

Source code in src\py_canoe\canoe.py
761
762
763
764
765
766
767
768
769
770
771
def get_can_bus_statistics(self, channel: int) -> dict:
    """
    Gets the CAN bus statistics.

    Args:
        channel (int): The channel number.

    Returns:
        dict: The CAN bus statistics.
    """
    return self.application.configuration.get_can_bus_statistics(channel)

get_canoe_version_info()

Gets the version information of the CANoe application.

Returns:
  • dict( dict[str, str | int] ) –

    The version information.

Source code in src\py_canoe\canoe.py
1652
1653
1654
1655
1656
1657
1658
1659
def get_canoe_version_info(self) -> dict[str, str | int]:
    """
    Gets the version information of the CANoe application.

    Returns:
        dict: The version information.
    """
    return self.application.version.get_canoe_version_info()

get_capl_compilation_result()

Returns the current configuration compilation result.

Source code in src\py_canoe\canoe.py
816
817
818
def get_capl_compilation_result(self) -> dict[str, object]:
    """Returns the current configuration compilation result."""
    return self.application.configuration.get_compilation_result()

get_channelUsage(channel_type=BusType.CAN)

returns the number of channels of a specific type.

Parameters:
  • channel_type (BusType, default: CAN ) –

    type of the channel (BusType.CAN for CAN, BusType.LIN for LIN, BusType.MOST for MOST, BusType.FlexRay for FlexRay, BusType.J1708 for J1708, BusType.Ethernet for Ethernet, BusType.WLAN for WLAN). Defaults to BusType.CAN.

Returns:
  • int( int ) –

    The number of channels of the specified type.

Source code in src\py_canoe\canoe.py
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
def get_channelUsage(self, channel_type:BusType = BusType.CAN) -> int:
    """returns the number of channels of a specific type.

    Args:
        channel_type (BusType): type of the channel (BusType.CAN for CAN, BusType.LIN for LIN, BusType.MOST for MOST, BusType.FlexRay for FlexRay, BusType.J1708 for J1708, BusType.Ethernet for Ethernet, BusType.WLAN for WLAN). Defaults to BusType.CAN.

    Returns:
        int: The number of channels of the specified type.
    """
    return self.application.configuration.general_setup.get_channels_count(channel_type)

get_environment_variable_value(env_var_name, return_timestamp=False)

returns a environment variable value.

Parameters:
  • env_var_name (str) –

    The name of the environment variable. Ex- "float_var"

  • return_timestamp (bool, default: False ) –

    Whether to return the timestamp in timezone utc along with the variable value. Defaults to False.

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

    Union[int, float, str, tuple, None]: The environment variable value or None if not found. If return_timestamp is True, returns a tuple of (variable_value, timestamp).

Source code in src\py_canoe\canoe.py
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
def get_environment_variable_value(self, env_var_name: str, return_timestamp: bool = False) -> Union[int, float, str, tuple, None]:
    """
    returns a environment variable value.

    Args:
        env_var_name (str): The name of the environment variable. Ex- "float_var"
        return_timestamp (bool): Whether to return the timestamp in timezone utc along with the variable value. Defaults to False.

    Returns:
        Union[int, float, str, tuple, None]: The environment variable value or None if not found. If return_timestamp is True, returns a tuple of (variable_value, timestamp).
    """
    variable_value = self.application.environment.get_environment_variable_value(env_var_name)
    if return_timestamp:
        return variable_value, datetime.now(timezone.utc).timestamp()
    return variable_value

get_hardware_channels(bus_type=BusType.CAN)

Return available hardware channels for bus_type.

Parameters:
  • bus_type (BusType, default: CAN ) –

    CANoe bus type (BusType.CAN, BusType.LIN, etc.).

Returns:
  • list[ChannelInfo] –

    List of :class:ChannelInfo objects from the XL Driver.

Source code in src\py_canoe\canoe.py
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
def get_hardware_channels(self, bus_type: BusType = BusType.CAN) -> list[ChannelInfo]:
    """Return available hardware channels for *bus_type*.

    Args:
        bus_type: CANoe bus type (BusType.CAN, BusType.LIN, etc.).

    Returns:
        List of :class:`ChannelInfo` objects from the XL Driver.
    """
    with VxlDriver() as drv:
        return drv.get_channels(self._to_xl_bus(bus_type))

get_hardware_config(app_channel, bus_type=BusType.CAN)

Return the hardware channel mapped to CANoe logical app_channel, or None if not configured.

Source code in src\py_canoe\canoe.py
1223
1224
1225
1226
1227
1228
def get_hardware_config(self, app_channel: int,
                        bus_type: BusType = BusType.CAN) -> ChannelInfo | None:
    """Return the hardware channel mapped to CANoe logical *app_channel*,
    or *None* if not configured."""
    with VxlDriver() as drv:
        return drv.get_appl_config("CANoe", app_channel, self._to_xl_bus(bus_type))

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

Gets the full name of a J1939 signal.

Parameters:
  • bus (BusType) –

    The bus type.

  • channel (int) –

    The channel number.

  • message (str) –

    The message name.

  • signal (str) –

    The signal name.

  • source_addr (int) –

    The source address.

  • dest_addr (int) –

    The destination address.

Returns:
  • Union[str, None] –

    Union[str, None]: The full name of the signal or None if not found.

Source code in src\py_canoe\canoe.py
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
def get_j1939_signal_full_name(self, bus: BusType | str | int, channel: int, message: str, signal: str, source_addr: int, dest_addr: int) -> Union[str, None]:
    """
    Gets the full name of a J1939 signal.

    Args:
        bus (BusType): The bus type.
        channel (int): The channel number.
        message (str): The message name.
        signal (str): The signal name.
        source_addr (int): The source address.
        dest_addr (int): The destination address.

    Returns:
        Union[str, None]: The full name of the signal or None if not found.
    """
    try:
        bus = self._normalize_bus_type(bus)
        signal_obj = self.application.bus(bus).get_j1939_signal(channel, message, signal, source_addr, dest_addr)
        full_name = signal_obj.full_name
        logger.info(f'J1939 Signal full name = {full_name}')
        return full_name
    except Exception as e:
        logger.error(f"Error retrieving J1939 bus signal full name: {e}")
        return None

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

Gets the value of a J1939 signal.

Parameters:
  • bus (BusType) –

    The bus type.

  • channel (int) –

    The channel number.

  • message (str) –

    The message name.

  • signal (str) –

    The signal name.

  • source_addr (int) –

    The source address.

  • dest_addr (int) –

    The destination address.

  • raw_value (bool, default: False ) –

    Whether to get the raw value. Defaults to False.

  • return_timestamp (bool, default: False ) –

    Whether to return the timestamp in timezone utc along with the signal value. Defaults to False.

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

    Union[float, int, None, tuple]: The signal value or None if not found. If return_timestamp is True, returns a tuple of (signal_value, timestamp).

Source code in src\py_canoe\canoe.py
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
def get_j1939_signal_value(self, bus: BusType | str | int, channel: int, message: str, signal: str, source_addr: int, dest_addr: int, raw_value=False, return_timestamp=False) -> Union[float, int, None, tuple]:
    """
    Gets the value of a J1939 signal.

    Args:
        bus (BusType): The bus type.
        channel (int): The channel number.
        message (str): The message name.
        signal (str): The signal name.
        source_addr (int): The source address.
        dest_addr (int): The destination address.
        raw_value (bool): Whether to get the raw value. Defaults to False.
        return_timestamp (bool): Whether to return the timestamp in timezone utc along with the signal value. Defaults to False.

    Returns:
        Union[float, int, None, tuple]: The signal value or None if not found. If return_timestamp is True, returns a tuple of (signal_value, timestamp).
    """
    signal_value = None
    try:
        bus = self._normalize_bus_type(bus)
        signal_obj = self.application.bus(bus).get_j1939_signal(channel, message, signal, source_addr, dest_addr)
        signal_value = signal_obj.raw_value if raw_value else signal_obj.value
        logger.info(f'J1939 Signal({signal_obj.full_name}) value = {signal_value}')
    except Exception as e:
        logger.error(f"Error retrieving J1939 bus signal value: {e}")
    if return_timestamp:
        return signal_value, datetime.now(timezone.utc).timestamp()
    return signal_value

get_logging_blocks()

Return all available logging blocks.

Source code in src\py_canoe\canoe.py
1233
1234
1235
def get_logging_blocks(self) -> list['Logging']:
    """Return all available logging blocks."""
    return self.application.configuration.get_logging_blocks()

get_measurement_index()

Gets the measurement index.

Returns:
  • int( int ) –

    The measurement index.

Source code in src\py_canoe\canoe.py
1441
1442
1443
1444
1445
1446
1447
1448
def get_measurement_index(self) -> int:
    """
    Gets the measurement index.

    Returns:
        int: The measurement index.
    """
    return self.application.measurement.measurement_index

get_measurement_running_status()

Gets the running status of the measurement.

Returns:
  • bool( bool ) –

    True if the measurement is running, False otherwise.

Source code in src\py_canoe\canoe.py
1392
1393
1394
1395
1396
1397
1398
1399
def get_measurement_running_status(self) -> bool:
    """
    Gets the running status of the measurement.

    Returns:
        bool: True if the measurement is running, False otherwise.
    """
    return self.application.measurement.running

get_messages(logger_index)

Return all messages from given logger.

Source code in src\py_canoe\canoe.py
1268
1269
1270
def get_messages(self, logger_index: int) -> list['Message']:
    """Return all messages from given logger."""
    return self.application.configuration.get_messages(logger_index)

get_network(network_name=None)

Return a specific network by name, or None if not found.

Parameters:
  • network_name (str, default: None ) –

    name of the network to retrieve. If None, returns the first network found.

Source code in src\py_canoe\canoe.py
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
def get_network(self,network_name: str = None) -> Bus:
    """Return a specific network by name, or *None* if not found.

    Args:
        network_name: name of the network to retrieve.  If None,
            returns the first network found.
    """
    for bus in self.application.configuration.simulation_setup.buses.item():
        if bus.name == network_name:
            return bus
    return None

get_rt_kernel_architecture()

Returns the current RT Kernel architecture (0=32-bit, 1=64-bit, ...).

Source code in src\py_canoe\canoe.py
1661
1662
1663
def get_rt_kernel_architecture(self) -> int:
    """Returns the current RT Kernel architecture (0=32-bit, 1=64-bit, ...)."""
    return self.application.configuration.execution_environment

get_signal_full_name(bus, channel, message, signal)

Gets the full name of a signal.

Parameters:
  • bus (BusType) –

    The bus type.

  • channel (int) –

    The channel number.

  • message (str) –

    The message name.

  • signal (str) –

    The signal name.

Returns:
  • Union[str, None] –

    Union[str, None]: The full name of the signal or None if not found.

Source code in src\py_canoe\canoe.py
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
def get_signal_full_name(self, bus: BusType | str | int, channel: int, message: str, signal: str) -> Union[str, None]:
    """
    Gets the full name of a signal.

    Args:
        bus (BusType): The bus type.
        channel (int): The channel number.
        message (str): The message name.
        signal (str): The signal name.

    Returns:
        Union[str, None]: The full name of the signal or None if not found.
    """
    try:
        bus = self._normalize_bus_type(bus)
        signal_obj = self.application.bus(bus).get_signal(channel, message, signal)
        full_name = signal_obj.full_name
        logger.info(f'Signal full name = {full_name}')
        return full_name
    except Exception as e:
        logger.error(f"Error retrieving {bus} bus signal full name: {e}")
        return None

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

Gets the value of a signal.

Parameters:
  • bus (BusType | str | int) –

    The bus type.

  • channel (int) –

    The channel number.

  • message (str) –

    The message name.

  • signal (str) –

    The signal name.

  • raw_value (bool, default: False ) –

    Whether to get the raw value. Defaults to False.

  • return_timestamp (bool, default: False ) –

    Whether to return the timestamp in timezone utc along with the signal value. Defaults to False.

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

    Union[int, float, None, tuple]: The signal value or None if not found. If return_timestamp is True, returns a tuple of (signal_value, timestamp).

Source code in src\py_canoe\canoe.py
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
def get_signal_value(self, bus: BusType | str | int, channel: int, message: str, signal: str, raw_value: bool = False, return_timestamp: bool = False) -> Union[int, float, None, tuple]:
    """
    Gets the value of a signal.

    Args:
        bus (BusType | str | int): The bus type.
        channel (int): The channel number.
        message (str): The message name.
        signal (str): The signal name.
        raw_value (bool): Whether to get the raw value. Defaults to False.
        return_timestamp (bool): Whether to return the timestamp in timezone utc along with the signal value. Defaults to False.

    Returns:
        Union[int, float, None, tuple]: The signal value or None if not found. If return_timestamp is True, returns a tuple of (signal_value, timestamp).
    """
    signal_value = None
    try:
        bus = self._normalize_bus_type(bus)
        signal_obj = self.application.bus(bus).get_signal(channel, message, signal)
        signal_value = signal_obj.raw_value if raw_value else signal_obj.value
        logger.info(f"Signal({signal_obj.full_name}) value = {signal_value}")
    except Exception as e:
        logger.error(f"Error retrieving {bus} bus signal value: {e}")
    if return_timestamp:
        return signal_value, datetime.now(timezone.utc).timestamp()
    return signal_value

get_simulation_bus_names()

Returns all simulation bus names from the current application.

Source code in src\py_canoe\canoe.py
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
def get_simulation_bus_names(self) -> list[str]:
    """Returns all simulation bus names from the current application."""
    try:
        sim_buses = self.application.configuration.simulation_setup.buses
        bus_names: list[str] = []
        for i in range(1, sim_buses.count + 1):
            sim_bus = sim_buses.item(i)
            bus_name = getattr(sim_bus, 'name', None)
            if bus_name is not None:
                bus_names.append(bus_name)

        if bus_names:
            logger.info(f'simulation buses: {bus_names}')
            return bus_names

        fallback_network_names = self.application.networks.get_all_network_names()
        if isinstance(fallback_network_names, list):
            logger.info(f'simulation buses: {fallback_network_names}')
            return fallback_network_names

        logger.info('simulation buses: []')
        return []
    except Exception as e:
        raise ConfigurationNotLoadedError(f"Cannot access simulation buses: {e}") from e

get_simulation_database_paths()

Returns all simulation database paths from the current application.

Source code in src\py_canoe\canoe.py
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
def get_simulation_database_paths(self) -> list[str]:
    """Returns all simulation database paths from the current application."""
    try:
        sim_buses = self.application.configuration.simulation_setup.buses
        paths: list[str] = []
        for i in range(1, sim_buses.count + 1):
            sim_bus = sim_buses.item(i)
            dbs = getattr(sim_bus, 'databases', None)
            if dbs is None:
                continue
            for j in range(1, dbs.count + 1):
                db = dbs.item(j)
                if db.full_name is not None:
                    paths.append(db.full_name)

        if paths:
            logger.info(f'simulation database paths: {paths}')
            return paths

        cfg_db_collection = getattr(self.application.configuration.com_object.GeneralSetup.DatabaseSetup, 'Databases', None)
        if cfg_db_collection is None:
            logger.info('simulation database paths: []')
            return []

        from py_canoe.core.child_elements.databases import Databases
        cfg_dbs = Databases(cfg_db_collection)
        for j in range(1, cfg_dbs.count + 1):
            db = cfg_dbs.item(j)
            if db.full_name is not None:
                paths.append(db.full_name)

        logger.info(f'simulation database paths: {paths}')
        return paths
    except Exception as e:
        raise ConfigurationNotLoadedError(f"Cannot access simulation databases: {e}") from e

get_symbols(logger_index)

Return all exporter symbols from given logger.

Source code in src\py_canoe\canoe.py
1264
1265
1266
def get_symbols(self, logger_index: int) -> list['ExporterSymbol']:
    """Return all exporter symbols from given logger."""
    return self.application.configuration.get_symbols(logger_index)

get_system_variable_value(sys_var_name, return_symbolic_name=False, return_timestamp=False, enable_events=True)

Gets the value of a system variable.

Parameters:
  • sys_var_name (str) –

    The name of the system variable.

  • return_symbolic_name (bool, default: False ) –

    Whether to return the symbolic name.

  • return_timestamp (bool, default: False ) –

    Whether to return the timestamp in timezone utc along with the signal value. Defaults to False.

  • enable_events (bool, default: True ) –

    This argument is deprecated and will be removed in a future version.

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

    Union[int, float, str, None, tuple]: The value of the system variable or None if not found. If return_timestamp is True, returns a tuple of (value, timestamp).

Source code in src\py_canoe\canoe.py
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
def get_system_variable_value(self, sys_var_name: str, return_symbolic_name: bool = False, return_timestamp: bool = False, enable_events: bool = True) -> Union[int, float, str, None, tuple]:
    """
    Gets the value of a system variable.

    Args:
        sys_var_name (str): The name of the system variable.
        return_symbolic_name (bool): Whether to return the symbolic name.
        return_timestamp (bool): Whether to return the timestamp in timezone utc along with the signal value. Defaults to False.
        enable_events (bool): This argument is deprecated and will be removed in a future version.

    Returns:
        Union[int, float, str, None, tuple]: The value of the system variable or None if not found. If return_timestamp is True, returns a tuple of (value, timestamp).
    """
    variable_value = self.application.system.get_variable_value(sys_var_name, return_symbolic_name)
    if return_timestamp:
        return variable_value, datetime.now(timezone.utc).timestamp()
    return variable_value

get_test_configurations()

returns dictionary of test configuration names and its class object.

Source code in src\py_canoe\canoe.py
812
813
814
def get_test_configurations(self) -> dict[str, 'TestConfiguration']:
    """returns dictionary of test configuration names and its class object."""
    return self.application.configuration.get_test_configurations()

get_test_environments()

returns dictionary of test environment names and class.

Source code in src\py_canoe\canoe.py
889
890
891
def get_test_environments(self) -> dict:
    """returns dictionary of test environment names and class."""
    return self.application.configuration.get_test_environments()

get_test_module_result(test_module_name, report_timeout=30.0)

Get test module execution result including report path, test case verdicts, and aggregated statistics.

Should be called after execute_test_module() to retrieve the results.

Note: This method does NOT depend on the module's started state. It reads the verdict and report information directly from the test module object, and waits (up to report_timeout seconds) for the report-generated event if it has not fired yet. All returned data are plain Python objects (snapshots), not live COM objects, so they remain valid after the CANoe session ends.

Parameters:
  • test_module_name (str) –

    test module name.

  • report_timeout (float, default: 30.0 ) –

    maximum time in seconds to wait for the report-generated event before giving up. Defaults to 30.0.

Returns:
  • dict( dict ) –

    A dictionary with keys: - "test_module" (str): name of the test module - "verdict" (int): overall test module verdict (0-5) - "verdict_name" (str): human-readable verdict name - "report" (dict): report information with keys: - "success" (bool): whether report generation succeeded - "source_full_name" (str): XML report path - "generated_full_name" (str): HTML report path - "test_cases" (list[dict]): list of test case snapshots, each with keys: name, title, enabled, verdict, verdict_name - "total" (int): total number of test cases - "passed" (int): number of passed test cases - "failed" (int): number of failed test cases - "other" (int): number of test cases with other verdicts - "pass_rate" (float): pass rate as a percentage (0.0-100.0)

Example

canoe.execute_test_module("MyModule") result = canoe.get_test_module_result("MyModule") print(f"Module: {result['test_module']}") print(f"Verdict: {result['verdict_name']}") print(f"Pass rate: {result['pass_rate']:.1f}%") print(f"Passed: {result['passed']}/{result['total']}") print(f"Report: {result['report']['generated_full_name']}") for tc in result['test_cases']: ... print(f" {tc['name']}: {tc['verdict_name']}")

Source code in src\py_canoe\canoe.py
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
def get_test_module_result(self, test_module_name: str, report_timeout: float = 30.0) -> dict:
    """Get test module execution result including report path, test case
    verdicts, and aggregated statistics.

    Should be called after execute_test_module() to retrieve the results.

    Note: This method does NOT depend on the module's started state. It reads
    the verdict and report information directly from the test module object,
    and waits (up to ``report_timeout`` seconds) for the report-generated
    event if it has not fired yet. All returned data are plain Python objects
    (snapshots), not live COM objects, so they remain valid after the CANoe
    session ends.

    Args:
        test_module_name (str): test module name.
        report_timeout (float): maximum time in seconds to wait for the
            report-generated event before giving up. Defaults to 30.0.

    Returns:
        dict: A dictionary with keys:
            - "test_module" (str): name of the test module
            - "verdict" (int): overall test module verdict (0-5)
            - "verdict_name" (str): human-readable verdict name
            - "report" (dict): report information with keys:
                - "success" (bool): whether report generation succeeded
                - "source_full_name" (str): XML report path
                - "generated_full_name" (str): HTML report path
            - "test_cases" (list[dict]): list of test case snapshots, each
              with keys: name, title, enabled, verdict, verdict_name
            - "total" (int): total number of test cases
            - "passed" (int): number of passed test cases
            - "failed" (int): number of failed test cases
            - "other" (int): number of test cases with other verdicts
            - "pass_rate" (float): pass rate as a percentage (0.0-100.0)

    Example:
        >>> canoe.execute_test_module("MyModule")
        >>> result = canoe.get_test_module_result("MyModule")
        >>> print(f"Module: {result['test_module']}")
        >>> print(f"Verdict: {result['verdict_name']}")
        >>> print(f"Pass rate: {result['pass_rate']:.1f}%")
        >>> print(f"Passed: {result['passed']}/{result['total']}")
        >>> print(f"Report: {result['report']['generated_full_name']}")
        >>> for tc in result['test_cases']:
        ...     print(f"  {tc['name']}: {tc['verdict_name']}")
    """
    return self.application.configuration.get_test_module_result(test_module_name, report_timeout=report_timeout)

get_test_modules(env_name)

returns dictionary of test environment test module names and its class object.

Parameters:
  • env_name (str) –

    test environment name. avoid duplicate test environment names in CANoe configuration.

Source code in src\py_canoe\canoe.py
893
894
895
896
897
898
899
def get_test_modules(self, env_name: str) -> dict:
    """returns dictionary of test environment test module names and its class object.

    Args:
        env_name (str): test environment name. avoid duplicate test environment names in CANoe configuration.
    """
    return self.application.configuration.get_test_modules(env_name)

load_logs_for_exporter(logger_index)

Load all source files of exporter and determine symbols/messages.

Parameters:
  • logger_index (int) –

    indicates logger and its log files

Source code in src\py_canoe\canoe.py
1256
1257
1258
1259
1260
1261
1262
def load_logs_for_exporter(self, logger_index: int) -> None:
    """Load all source files of exporter and determine symbols/messages.

    Args:
        logger_index (int): indicates logger and its log files
    """
    return self.application.configuration.load_logs_for_exporter(logger_index)

new(auto_save=False, prompt_user=False, timeout=5)

Creates a new configuration.

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

    Whether to automatically save the configuration. Defaults to False.

  • prompt_user (bool, default: False ) –

    Whether to prompt the user for confirmation. Defaults to False.

  • timeout (int, default: 5 ) –

    The timeout in seconds for the operation. Defaults to 5.

Returns:
  • bool( bool ) –

    True if the operation was successful, False otherwise.

Source code in src\py_canoe\canoe.py
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
def new(self, auto_save=False, prompt_user=False, timeout=5) -> bool:
    """
    Creates a new configuration.

    Args:
        auto_save (bool): Whether to automatically save the configuration. Defaults to False.
        prompt_user (bool): Whether to prompt the user for confirmation. Defaults to False.
        timeout (int): The timeout in seconds for the operation. Defaults to 5.

    Returns:
        bool: True if the operation was successful, False otherwise.
    """
    self._reset_application()
    self.application = Application()
    return self.application.new(auto_save, prompt_user, timeout)

open(canoe_cfg, visible=True, auto_save=True, prompt_user=False, auto_stop=True, timeout=30)

Loads a configuration.

Parameters:
  • canoe_cfg (str) –

    The path to the CANoe configuration file.

  • visible (bool, default: True ) –

    Whether to make the CANoe application visible. Defaults to True.

  • auto_save (bool, default: True ) –

    Whether to automatically save the configuration. Defaults to True.

  • prompt_user (bool, default: False ) –

    Whether to prompt the user for confirmation. Defaults to False.

  • auto_stop (bool, default: True ) –

    This argument is deprecated and will be removed in a future version.

  • timeout (int, default: 30 ) –

    The timeout in seconds for the operation. Defaults to 30.

Returns:
  • bool( bool ) –

    True if the operation was successful, False otherwise.

Source code in src\py_canoe\canoe.py
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
def open(self, canoe_cfg: str | Path, visible: bool = True, auto_save: bool = True, prompt_user: bool = False, auto_stop: bool = True, timeout: int = 30) -> bool:
    """
    Loads a configuration.

    Args:
        canoe_cfg (str): The path to the CANoe configuration file.
        visible (bool): Whether to make the CANoe application visible. Defaults to True.
        auto_save (bool): Whether to automatically save the configuration. Defaults to True.
        prompt_user (bool): Whether to prompt the user for confirmation. Defaults to False.
        auto_stop (bool): This argument is deprecated and will be removed in a future version.
        timeout (int): The timeout in seconds for the operation. Defaults to 30.

    Returns:
        bool: True if the operation was successful, False otherwise.
    """
    self._reset_application()
    self.application = Application()
    self.application.user_capl_functions = self.user_capl_functions
    return self.application.open(canoe_cfg, visible, auto_save, prompt_user, timeout)

profile_signal_value(bus, channel, message, signal, duration=1.0, interval=0.0, raw_value=False, max_samples=None, include_samples=False, include_timestamps=False)

Profiles a signal by sampling it repeatedly and returning basic stats.

This is useful for quickly observing signal stability, typical value range, and timing characteristics without storing all the samples in memory.

Parameters:
  • bus (BusType) –

    The bus type.

  • channel (int) –

    The channel number.

  • message (str) –

    The message name.

  • signal (str) –

    The signal name.

  • duration (float, default: 1.0 ) –

    How long to sample the signal (seconds). Defaults to 1.0.

  • interval (float, default: 0.0 ) –

    Minimum time to wait between samples (seconds). Defaults to 0.0.

  • raw_value (bool, default: False ) –

    Whether to query the raw value. Defaults to False.

  • max_samples (Optional[int], default: None ) –

    Stop after collecting this many samples. Defaults to None.

  • include_samples (bool, default: False ) –

    If True, return the list of sampled values.

  • include_timestamps (bool, default: False ) –

    If True, return the list of timestamps for each sample.

Returns:
  • dict( dict ) –

    A dictionary with keys: - count: number of samples collected - duration: actual sampling duration (seconds) - min: minimum value (or None if no samples) - max: maximum value (or None if no samples) - mean: mean value (or None if no samples) - std: standard deviation (or None if fewer than 2 samples) - samples (optional): list of sampled values - timestamps (optional): list of timestamps in UTC seconds

Source code in src\py_canoe\canoe.py
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
def profile_signal_value(self, bus: BusType | str | int, channel: int, message: str, signal: str, duration: float = 1.0, interval: float = 0.0, raw_value: bool = False, max_samples: Optional[int] = None, include_samples: bool = False, include_timestamps: bool = False,) -> dict:
    """Profiles a signal by sampling it repeatedly and returning basic stats.

    This is useful for quickly observing signal stability, typical value range,
    and timing characteristics without storing all the samples in memory.

    Args:
        bus (BusType): The bus type.
        channel (int): The channel number.
        message (str): The message name.
        signal (str): The signal name.
        duration (float): How long to sample the signal (seconds). Defaults to 1.0.
        interval (float): Minimum time to wait between samples (seconds). Defaults to 0.0.
        raw_value (bool): Whether to query the raw value. Defaults to False.
        max_samples (Optional[int]): Stop after collecting this many samples. Defaults to None.
        include_samples (bool): If True, return the list of sampled values.
        include_timestamps (bool): If True, return the list of timestamps for each sample.

    Returns:
        dict: A dictionary with keys:
            - count: number of samples collected
            - duration: actual sampling duration (seconds)
            - min: minimum value (or None if no samples)
            - max: maximum value (or None if no samples)
            - mean: mean value (or None if no samples)
            - std: standard deviation (or None if fewer than 2 samples)
            - samples (optional): list of sampled values
            - timestamps (optional): list of timestamps in UTC seconds
    """
    if duration <= 0:
        return {
            "count": 0,
            "duration": 0.0,
            "min": None,
            "max": None,
            "mean": None,
            "std": None,
            **({"samples": []} if include_samples else {}),
            **({"timestamps": []} if include_timestamps else {}),
        }

    try:
        bus = self._normalize_bus_type(bus)
        signal_obj = self.application.bus(bus).get_signal(channel, message, signal)
    except Exception as e:
        logger.error(f"Error retrieving signal object for profiling: {e}")
        return {}

    value_getter = (lambda: signal_obj.raw_value) if raw_value else (lambda: signal_obj.value)

    start = time.perf_counter()
    end_time = start + duration
    count = 0
    mean = 0.0
    m2 = 0.0
    min_value = float("inf")
    max_value = float("-inf")
    samples = [] if include_samples else None
    timestamps = [] if include_timestamps else None
    logger.info(f"Starting signal profiling for {message}::{signal} on {bus} bus for duration {duration}s with interval {interval}s...")
    while True:
        now = time.perf_counter()
        if now >= end_time:
            break
        if max_samples is not None and count >= max_samples:
            break

        value = value_getter()
        # Avoid breaking on missing signals; just skip them
        if value is None:
            if interval > 0:
                wait(interval)
            continue

        try:
            numeric = float(value)
        except Exception:
            # If value is not numeric, keep the raw value
            numeric = value

        if include_samples:
            samples.append(numeric)
        if include_timestamps:
            timestamps.append(time.time())

        if isinstance(numeric, (int, float)) and not isinstance(numeric, bool):
            count += 1
            if numeric < min_value:
                min_value = numeric
            if numeric > max_value:
                max_value = numeric

            # Welford's online algorithm for mean and variance
            delta = numeric - mean
            mean += delta / count
            delta2 = numeric - mean
            m2 += delta * delta2
        else:
            # For non-numeric samples we still count them, but cannot compute stats
            count += 1

        if interval > 0:
            wait(interval)

    duration_actual = time.perf_counter() - start
    variance = m2 / (count - 1) if count > 1 else None
    std = variance**0.5 if variance is not None else None

    profiled_signal = {
        "count": count,
        "duration": duration_actual,
        "min": None if count == 0 else (None if min_value == float("inf") else min_value),
        "max": None if count == 0 else (None if max_value == float("-inf") else max_value),
        "mean": None if count == 0 else mean,
        "std": std,
        **({"samples": samples} if include_samples else {}),
        **({"timestamps": timestamps} if include_timestamps else {}),
    }
    logger.info(
        f"Completed signal profiling for {message}::{signal} on {bus} bus: count={count}, duration={duration_actual:.2f}s, "
        f"min={profiled_signal['min']}, max={profiled_signal['max']}, mean={profiled_signal['mean']}, std={profiled_signal['std']}"
    )
    return profiled_signal

quit(timeout=30)

Quits the application.

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

    The timeout in seconds for the operation. Defaults to 30.

Returns:
  • bool( bool ) –

    True if the operation was successful, False otherwise.

Source code in src\py_canoe\canoe.py
140
141
142
143
144
145
146
147
148
149
150
151
152
def quit(self, timeout: int = 30) -> bool:
    """
    Quits the application.

    Args:
        timeout (int): The timeout in seconds for the operation. Defaults to 30.

    Returns:
        bool: True if the operation was successful, False otherwise.
    """
    status = self.application.quit(timeout)
    self._reset_application()
    return status

read_text_from_write_window()

Reads text from the write window.

Returns:
  • Union[str, None] –

    Union[str, None]: The text from the write window or None if not found.

Source code in src\py_canoe\canoe.py
1600
1601
1602
1603
1604
1605
1606
1607
def read_text_from_write_window(self) -> Union[str, None]:
    """
    Reads text from the write window.

    Returns:
        Union[str, None]: The text from the write window or None if not found.
    """
    return self.application.ui.write.text

remove_all_channelUsage()

removes all channels of all types.

Source code in src\py_canoe\canoe.py
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
def remove_all_channelUsage(self) -> None:
    """removes all channels of all types."""
    self.set_channelUsage(BusType.CAN, 0)
    self.set_channelUsage(BusType.LIN, 0)
    self.set_channelUsage(BusType.MOST, 0)
    self.set_channelUsage(BusType.FlexRay, 0)
    self.set_channelUsage(BusType.J1708, 0)
    self.set_channelUsage(BusType.Ethernet, 0)
    self.set_channelUsage(BusType.WLAN, 0)
    self.set_channelUsage(BusType.AFDX, 0)
    self.set_channelUsage(BusType.KLINE, 0)
    self.set_channelUsage(BusType.A429, 0)

remove_all_networks()

Remove ALL networks from the simulation setup.

Note: CANoe requires at least one network, so the last remaining network is kept. Returns the number of networks actually removed.

Source code in src\py_canoe\canoe.py
1127
1128
1129
1130
1131
1132
1133
def remove_all_networks(self) -> int:
    """Remove ALL networks from the simulation setup.

    Note: CANoe requires at least one network, so the last remaining
    network is kept.  Returns the number of networks actually removed.
    """
    return self.application.configuration.remove_all_networks()

remove_database(database_file, database_channel)

remove database file from a channel

Parameters:
  • database_file (str) –

    database file to remove. give full file path.

  • database_channel (int) –

    channel name on which you want to remove database.

Source code in src\py_canoe\canoe.py
1035
1036
1037
1038
1039
1040
1041
1042
def remove_database(self, database_file: str, database_channel: int) -> bool:
    """remove database file from a channel

    Args:
        database_file (str): database file to remove. give full file path.
        database_channel (int): channel name on which you want to remove database.
    """
    return self.application.configuration.remove_database(database_file, database_channel)

remove_logging_block(index)

removes a logging block from configuration measurement setup.

Parameters:
  • index (int) –

    index of logging block to remove. logging blocks indexing starts from 1 and not 0.

Source code in src\py_canoe\canoe.py
1248
1249
1250
1251
1252
1253
1254
def remove_logging_block(self, index: int) -> None:
    """removes a logging block from configuration measurement setup.

    Args:
        index (int): index of logging block to remove. logging blocks indexing starts from 1 and not 0.
    """
    return self.application.configuration.remove_logging_block(index)

remove_netWork(name)

Remove a network by name.

Note: CANoe requires at least one network. The last remaining network cannot be removed.

Parameters:
  • name (str) –

    Network name to remove.

Returns:
  • bool –

    True if the network was found and removed.

Source code in src\py_canoe\canoe.py
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
def remove_netWork(self, name: str) -> bool:
    """Remove a network by name.

    Note: CANoe requires at least one network.  The last remaining
    network cannot be removed.

    Args:
        name: Network name to remove.

    Returns:
        True if the network was found and removed.
    """
    return self.application.configuration.remove_netWork(name)

reset_measurement(timeout=30)

Restarts the measurement if running.

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

    The timeout in seconds for the operation. Defaults to 30.

Returns:
  • bool( bool ) –

    True if the operation was successful, False otherwise.

Source code in src\py_canoe\canoe.py
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
def reset_measurement(self, timeout=30) -> bool:
    """
    Restarts the measurement if running.

    Args:
        timeout (int): The timeout in seconds for the operation. Defaults to 30.

    Returns:
        bool: True if the operation was successful, False otherwise.
    """
    if self.application.measurement.running:
        stop_status = self.stop_measurement(timeout)
        start_status = self.start_measurement(timeout)
        return stop_status and start_status
    else:
        logger.warning("Measurement is not running, cannot reset.")
        return False

reset_measurement_in_offline_mode()

Resets the measurement in offline mode.

Returns:
  • bool( bool ) –

    True if the operation was successful, False otherwise.

Source code in src\py_canoe\canoe.py
1423
1424
1425
1426
1427
1428
1429
1430
def reset_measurement_in_offline_mode(self) -> bool:
    """
    Resets the measurement in offline mode.

    Returns:
        bool: True if the operation was successful, False otherwise.
    """
    return self.application.measurement.reset_measurement_in_offline_mode()

run_capl_compilation()

Runs compilation for the current configuration.

Source code in src\py_canoe\canoe.py
820
821
822
def run_capl_compilation(self) -> bool:
    """Runs compilation for the current configuration."""
    return self.application.configuration.run_compilation()

save_configuration()

Saves the current configuration.

Returns:
  • bool( bool ) –

    True if the operation was successful, False otherwise.

Source code in src\py_canoe\canoe.py
724
725
726
727
728
729
730
731
def save_configuration(self) -> bool:
    """
    Saves the current configuration.

    Returns:
        bool: True if the operation was successful, False otherwise.
    """
    return self.application.configuration.save()

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

Saves the current configuration as a new file.

Parameters:
  • path (str) –

    The path to save the configuration file.

  • major (int) –

    The major version number.

  • minor (int) –

    The minor version number.

  • prompt_user (bool, default: False ) –

    Whether to prompt the user for confirmation. Defaults to False.

  • create_dir (bool, default: True ) –

    Whether to create the directory if it doesn't exist. Defaults to True.

Returns:
  • bool( bool ) –

    True if the operation was successful, False otherwise.

Source code in src\py_canoe\canoe.py
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
def save_configuration_as(self, path: str, major: int, minor: int, prompt_user: bool = False, create_dir: bool = True) -> bool:
    """
    Saves the current configuration as a new file.

    Args:
        path (str): The path to save the configuration file.
        major (int): The major version number.
        minor (int): The minor version number.
        prompt_user (bool): Whether to prompt the user for confirmation. Defaults to False.
        create_dir (bool): Whether to create the directory if it doesn't exist. Defaults to True.

    Returns:
        bool: True if the operation was successful, False otherwise.
    """
    return self.application.configuration.save_as(path, major, minor, prompt_user, create_dir)

send_diag_request(diag_ecu_qualifier_name, request, request_in_bytes=True, return_sender_name=False, response_in_bytearray=False, timeout=30, poll_s=0.01, **kwargs)

Sends a diagnostic request.

Parameters:
  • diag_ecu_qualifier_name (str) –

    The diagnostic ECU qualifier name.

  • request (str) –

    The diagnostic request.

  • request_in_bytes (bool, default: True ) –

    Whether the request is in bytes.

  • return_sender_name (bool, default: False ) –

    Whether to return the sender name.

  • response_in_bytearray (bool, default: False ) –

    Whether to return the response in bytearray.

  • timeout (float, default: 30 ) –

    The timeout in seconds for the operation. Defaults to 30.

  • poll_s (float, default: 0.01 ) –

    The polling interval in seconds to check for the response. Defaults to 0.01.

  • **kwargs (str | int, default: {} ) –

    Key-value pairs used for parametrization of a non-bytes request. Accepts symbolic interpretation of parameter value.

Returns: Union[str, dict]: The response from the diagnostic request.

Example

self.send_diag_request("ECU", "WritePropulsionType", False, PropulsionType="BatteryElectric")

Source code in src\py_canoe\canoe.py
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
def send_diag_request(self, diag_ecu_qualifier_name: str, request: str, request_in_bytes=True, return_sender_name=False, response_in_bytearray=False, timeout: float = 30, poll_s: float = 0.01, **kwargs) -> Union[str, dict]:
    """
    Sends a diagnostic request.

    Args:
        diag_ecu_qualifier_name (str): The diagnostic ECU qualifier name.
        request (str): The diagnostic request.
        request_in_bytes (bool): Whether the request is in bytes.
        return_sender_name (bool): Whether to return the sender name.
        response_in_bytearray (bool): Whether to return the response in bytearray.
        timeout (float): The timeout in seconds for the operation. Defaults to 30.
        poll_s (float): The polling interval in seconds to check for the response. Defaults to 0.01.
        **kwargs (str | int): Key-value pairs used for parametrization of a non-bytes
            request. Accepts symbolic interpretation of parameter value.
    Returns:
        Union[str, dict]: The response from the diagnostic request.

    Example:
        >>> self.send_diag_request("ECU", "WritePropulsionType", False, PropulsionType="BatteryElectric")
    """
    return self.application.networks.send_diag_request(diag_ecu_qualifier_name, request, request_in_bytes, return_sender_name, response_in_bytearray, timeout, poll_s, **kwargs)

set_channelUsage(channel_type, channel_count)

sets the number of channels of a specific type.

Parameters:
  • channel_type (BusType) –

    type of the channel (BusType.CAN for CAN, BusType.LIN for LIN, BusType.MOST for MOST, BusType.FlexRay for FlexRay, BusType.J1708 for J1708, BusType.Ethernet for Ethernet, BusType.WLAN for WLAN).

  • channel_count (int) –

    number of channels to set.

Source code in src\py_canoe\canoe.py
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
def set_channelUsage(self, channel_type:BusType, channel_count:int) -> bool:
    """sets the number of channels of a specific type.

    Args:
        channel_type (BusType): type of the channel (BusType.CAN for CAN, BusType.LIN for LIN, BusType.MOST for MOST, BusType.FlexRay for FlexRay, BusType.J1708 for J1708, BusType.Ethernet for Ethernet, BusType.WLAN for WLAN).
        channel_count (int): number of channels to set.
    """
    self.application.configuration.general_setup.set_channels_count(channel_type, channel_count)

    return self.get_channelUsage(channel_type) == channel_count

set_configuration_modified(modified)

Change status of configuration.

Parameters:
  • modified (bool) –

    True if configuration is modified, False otherwise.

Source code in src\py_canoe\canoe.py
1301
1302
1303
1304
1305
1306
1307
def set_configuration_modified(self, modified: bool) -> None:
    """Change status of configuration.

    Args:
        modified (bool): True if configuration is modified, False otherwise.
    """
    return self.application.configuration.set_configuration_modified(modified)

set_environment_variable_value(env_var_name, value)

Sets the value of an environment variable.

Parameters:
  • env_var_name (str) –

    The name of the environment variable. Ex- "speed".

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

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

Returns:
  • bool( bool ) –

    True if the operation was successful, False otherwise.

Source code in src\py_canoe\canoe.py
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
def set_environment_variable_value(self, env_var_name: str, value: Union[int, float, str, tuple]) -> bool:
    """
    Sets the value of an environment variable.

    Args:
        env_var_name (str): The name of the environment variable. Ex- "speed".
        value (Union[int, float, str, tuple]): variable value. supported CAPL environment variable data types integer, double, string and data.

    Returns:
        bool: True if the operation was successful, False otherwise.
    """
    return self.application.environment.set_environment_variable_value(env_var_name, value)

set_hardware_channel(app_channel, channel, bus_type=BusType.CAN)

Map CANoe logical app_channel (0, 1, ...) to a physical hardware channel returned by :meth:get_hardware_channels.

Example::

chs = app.get_hardware_channels(BusType.CAN)
app.set_hardware_channel(0, chs[0], BusType.CAN)
Source code in src\py_canoe\canoe.py
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
def set_hardware_channel(self, app_channel: int, channel: ChannelInfo,
                         bus_type: BusType = BusType.CAN) -> None:
    """Map CANoe logical *app_channel* (0, 1, ...) to a physical hardware
    *channel* returned by :meth:`get_hardware_channels`.

    Example::

        chs = app.get_hardware_channels(BusType.CAN)
        app.set_hardware_channel(0, chs[0], BusType.CAN)
    """
    with VxlDriver() as drv:
        drv.set_appl_config("CANoe", app_channel, channel, bus=self._to_xl_bus(bus_type))

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

Sets the value of a J1939 signal.

Parameters:
  • bus (BusType) –

    The bus type.

  • channel (int) –

    The channel number.

  • message (str) –

    The message name.

  • signal (str) –

    The signal name.

  • source_addr (int) –

    The source address.

  • dest_addr (int) –

    The destination address.

  • value (Union[float, int]) –

    The value to set.

  • raw_value (bool, default: False ) –

    Whether to set the raw value. Defaults to False.

Returns:
  • bool( bool ) –

    True if the operation was successful, False otherwise.

Source code in src\py_canoe\canoe.py
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
def set_j1939_signal_value(self, bus: BusType | str | int, channel: int, message: str, signal: str, source_addr: int, dest_addr: int, value: Union[float, int], raw_value: bool = False) -> bool:
    """
    Sets the value of a J1939 signal.

    Args:
        bus (BusType): The bus type.
        channel (int): The channel number.
        message (str): The message name.
        signal (str): The signal name.
        source_addr (int): The source address.
        dest_addr (int): The destination address.
        value (Union[float, int]): The value to set.
        raw_value (bool): Whether to set the raw value. Defaults to False.

    Returns:
        bool: True if the operation was successful, False otherwise.
    """
    try:
        bus = self._normalize_bus_type(bus)
        signal_obj = self.application.bus(bus).get_j1939_signal(channel, message, signal, source_addr, dest_addr)
        if raw_value:
            signal_obj.raw_value = int(value)
        else:
            signal_obj.value = value
        logger.info(f'J1939 Signal({signal_obj.full_name}) value set to {value}')
        return True
    except Exception as e:
        logger.error(f"Error setting J1939 bus signal value: {e}")
        return False

set_measurement_index(index)

Sets the measurement index.

Parameters:
  • index (int) –

    The measurement index to set.

Returns:
  • bool( bool ) –

    True if the operation was successful, False otherwise.

Source code in src\py_canoe\canoe.py
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
def set_measurement_index(self, index: int) -> bool:
    """
    Sets the measurement index.

    Args:
        index (int): The measurement index to set.

    Returns:
        bool: True if the operation was successful, False otherwise.
    """
    self.application.measurement.measurement_index = index
    return True

set_replay_block_file(block_name, recording_file_path)

Sets the replay block file.

Parameters:
  • block_name (str) –

    The name of the replay block.

  • recording_file_path (str) –

    The path to the recording file.

Returns:
  • bool( bool ) –

    True if the operation was successful, False otherwise.

Source code in src\py_canoe\canoe.py
773
774
775
776
777
778
779
780
781
782
783
784
def set_replay_block_file(self, block_name: str, recording_file_path: str) -> bool:
    """
    Sets the replay block file.

    Args:
        block_name (str): The name of the replay block.
        recording_file_path (str): The path to the recording file.

    Returns:
        bool: True if the operation was successful, False otherwise.
    """
    return self.application.configuration.set_replay_block_file(block_name, recording_file_path)

set_rt_kernel_architecture(arch)

Sets the RT Kernel architecture (0=32-bit, 1=64-bit).

Source code in src\py_canoe\canoe.py
1665
1666
1667
1668
def set_rt_kernel_architecture(self, arch: int) -> bool:
    """Sets the RT Kernel architecture (0=32-bit, 1=64-bit)."""
    self.application.configuration.execution_environment = arch
    return True

set_signal_value(bus, channel, message, signal, value, raw_value=False)

Sets the value of a signal.

Parameters:
  • bus (BusType) –

    The bus type.

  • channel (int) –

    The channel number.

  • message (str) –

    The message name.

  • signal (str) –

    The signal name.

  • value (Union[int, float]) –

    The value to set.

  • raw_value (bool, default: False ) –

    Whether to set the raw value. Defaults to False.

Returns:
  • bool( bool ) –

    True if the operation was successful, False otherwise.

Source code in src\py_canoe\canoe.py
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
def set_signal_value(self, bus: BusType | str | int, channel: int, message: str, signal: str, value: Union[int, float], raw_value: bool = False) -> bool:
    """
    Sets the value of a signal.

    Args:
        bus (BusType): The bus type.
        channel (int): The channel number.
        message (str): The message name.
        signal (str): The signal name.
        value (Union[int, float]): The value to set.
        raw_value (bool): Whether to set the raw value. Defaults to False.

    Returns:
        bool: True if the operation was successful, False otherwise.
    """
    try:
        bus = self._normalize_bus_type(bus)
        signal_obj = self.application.bus(bus).get_signal(channel, message, signal)
        if raw_value:
            signal_obj.raw_value = int(value)
        else:
            signal_obj.value = value
        logger.info(f"Signal({signal_obj.full_name}) value set to {value}")
        return True
    except Exception as e:
        logger.error(f"Error setting {bus} bus signal value: {e}")
        return False

set_system_variable_array_values(sys_var_name, value, index=0, enable_events=True)

Sets the values of a system variable array.

Parameters:
  • sys_var_name (str) –

    The name of the system variable.

  • value (tuple) –

    The values to set.

  • index (int, default: 0 ) –

    The index to set the values at.

  • enable_events (bool, default: True ) –

    Whether to enable COM events on the Variable object. Defaults to True. When False the write is not confirmed by an update event.

Returns:
  • bool( bool ) –

    True if the operation was successful, False otherwise.

Source code in src\py_canoe\canoe.py
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
def set_system_variable_array_values(self, sys_var_name: str, value: tuple, index: int = 0, enable_events: bool = True) -> bool:
    """
    Sets the values of a system variable array.

    Args:
        sys_var_name (str): The name of the system variable.
        value (tuple): The values to set.
        index (int): The index to set the values at.
        enable_events (bool): Whether to enable COM events on the Variable object. Defaults to True. When False the write is not confirmed by an update event.

    Returns:
        bool: True if the operation was successful, False otherwise.
    """
    return self.application.system.set_variable_array_values(sys_var_name, value, index, enable_events=enable_events)

set_system_variable_value(sys_var_name, value, enable_events=True)

Sets the value of a system variable.

Parameters:
  • sys_var_name (str) –

    The name of the system variable.

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

    The value to set.

  • enable_events (bool, default: True ) –

    Whether to enable COM events on the Variable object. Defaults to True. When False the write is not confirmed by an update event.

Returns:
  • bool( bool ) –

    True if the operation was successful, False otherwise.

Source code in src\py_canoe\canoe.py
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
def set_system_variable_value(self, sys_var_name: str, value: Union[int, float, str], enable_events: bool = True) -> bool:
    """
    Sets the value of a system variable.

    Args:
        sys_var_name (str): The name of the system variable.
        value (Union[int, float, str]): The value to set.
        enable_events (bool): Whether to enable COM events on the Variable object. Defaults to True. When False the write is not confirmed by an update event.

    Returns:
        bool: True if the operation was successful, False otherwise.
    """
    return self.application.system.set_variable_value(sys_var_name, value, enable_events=enable_events)

start_export(logger_index)

Starts the export/conversion of exporter.

Parameters:
  • logger_index (int) –

    indicates logger

Source code in src\py_canoe\canoe.py
1281
1282
1283
1284
1285
1286
1287
def start_export(self, logger_index: int):
    """Starts the export/conversion of exporter.

    Args:
        logger_index (int): indicates logger
    """
    return self.application.configuration.start_export(logger_index)

start_measurement(timeout=30)

Starts the measurement.

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

    The timeout in seconds for the operation. Defaults to 30.

Returns:
  • bool( bool ) –

    True if the operation was successful, False otherwise.

Source code in src\py_canoe\canoe.py
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
def start_measurement(self, timeout: int = 30) -> bool:
    """
    Starts the measurement.

    Args:
        timeout (int): The timeout in seconds for the operation. Defaults to 30.

    Returns:
        bool: True if the operation was successful, False otherwise.
    """
    return self.application.measurement.start(timeout)

start_measurement_in_animation_mode(animation_delay=100, timeout=30)

Starts the measurement in animation mode.

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

    The delay in milliseconds for the animation. Defaults to 100.

  • timeout (int, default: 30 ) –

    The timeout in seconds for the operation. Defaults to 30.

Returns:
  • bool( bool ) –

    True if the operation was successful, False otherwise.

Source code in src\py_canoe\canoe.py
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
def start_measurement_in_animation_mode(self, animation_delay=100, timeout=30) -> bool:
    """
    Starts the measurement in animation mode.

    Args:
        animation_delay (int): The delay in milliseconds for the animation. Defaults to 100.
        timeout (int): The timeout in seconds for the operation. Defaults to 30.

    Returns:
        bool: True if the operation was successful, False otherwise.
    """
    return self.application.measurement.start_measurement_in_animation_mode(animation_delay, timeout)

start_stop_online_logging_block(full_name, start_stop)

start / stop online measurement setup logging block.

Parameters:
  • full_name (str) –

    full path to log file as "C:/file.asc"

  • start_stop (bool) –

    True to start and False to stop.

Returns:
  • bool( bool ) –

    returns true is successfull else false.

Source code in src\py_canoe\canoe.py
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
def start_stop_online_logging_block(self, full_name: str, start_stop: bool) -> bool:
    """start / stop online measurement setup logging block.

    Args:
        full_name (str): full path to log file as "C:/file.asc"
        start_stop (bool): True to start and False to stop.

    Returns:
        bool: returns true is successfull else false.
    """
    return self.application.configuration.start_stop_online_logging_block(full_name, start_stop)

step_measurement_event_in_single_step()

Steps the measurement event in single step mode.

Returns:
  • bool( bool ) –

    True if the operation was successful, False otherwise.

Source code in src\py_canoe\canoe.py
1432
1433
1434
1435
1436
1437
1438
1439
def step_measurement_event_in_single_step(self) -> bool:
    """
    Steps the measurement event in single step mode.

    Returns:
        bool: True if the operation was successful, False otherwise.
    """
    return self.application.measurement.process_measurement_event_in_single_step()

stop_all_test_configurations()

stops execution of all test configurations available in test setup.

Returns:
  • bool( bool ) –

    True if the operation was successful, False otherwise.

Source code in src\py_canoe\canoe.py
844
845
846
847
848
849
850
def stop_all_test_configurations(self) -> bool:
    """stops execution of all test configurations available in test setup.

    Returns:
        bool: True if the operation was successful, False otherwise.
    """
    return self.application.configuration.stop_all_test_configurations()

stop_all_test_environments()

stops execution of all test environments available in test setup.

Source code in src\py_canoe\canoe.py
1022
1023
1024
def stop_all_test_environments(self):
    """stops execution of all test environments available in test setup."""
    return self.application.configuration.stop_all_test_environments()

stop_all_test_modules_in_test_env(env_name)

stops execution of all test modules available in test environment.

Parameters:
  • env_name (str) –

    test environment name. avoid duplicate test environment names in CANoe configuration.

Source code in src\py_canoe\canoe.py
1010
1011
1012
1013
1014
1015
1016
def stop_all_test_modules_in_test_env(self, env_name: str):
    """stops execution of all test modules available in test environment.

    Args:
        env_name (str): test environment name. avoid duplicate test environment names in CANoe configuration.
    """
    return self.application.configuration.stop_all_test_modules_in_test_env(env_name)

stop_ex_measurement(timeout=30)

Stops the measurement.

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

    The timeout in seconds for the operation. Defaults to 30.

Returns:
  • bool( bool ) –

    True if the operation was successful, False otherwise.

Source code in src\py_canoe\canoe.py
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
def stop_ex_measurement(self, timeout=30) -> bool:
    """
    Stops the measurement.

    Args:
        timeout (int): The timeout in seconds for the operation. Defaults to 30.

    Returns:
        bool: True if the operation was successful, False otherwise.
    """
    return self.application.measurement.stop_ex(timeout)

stop_measurement(timeout=30)

Stops the measurement.

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

    The timeout in seconds for the operation. Defaults to 30.

Returns:
  • bool( bool ) –

    True if the operation was successful, False otherwise.

Source code in src\py_canoe\canoe.py
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
def stop_measurement(self, timeout: int = 30) -> bool:
    """
    Stops the measurement.

    Args:
        timeout (int): The timeout in seconds for the operation. Defaults to 30.

    Returns:
        bool: True if the operation was successful, False otherwise.
    """
    return self.application.measurement.stop(timeout)

stop_test_configuration(test_configuration_name)

stops execution of a specific test configuration.

Parameters:
  • test_configuration_name (str) –

    The name of the test configuration to stop.

Returns:
  • bool( bool ) –

    True if the operation was successful, False otherwise.

Source code in src\py_canoe\canoe.py
878
879
880
881
882
883
884
885
886
887
def stop_test_configuration(self, test_configuration_name: str) -> bool:
    """stops execution of a specific test configuration.

    Args:
        test_configuration_name (str): The name of the test configuration to stop.

    Returns:
        bool: True if the operation was successful, False otherwise.
    """
    return self.application.configuration.stop_test_configuration(test_configuration_name)

stop_test_module(test_module_name)

stops execution of test module.

Parameters:
  • test_module_name (str) –

    test module name. avoid duplicate test module names in CANoe configuration.

Source code in src\py_canoe\canoe.py
985
986
987
988
989
990
991
def stop_test_module(self, test_module_name: str):
    """stops execution of test module.

    Args:
        test_module_name (str): test module name. avoid duplicate test module names in CANoe configuration.
    """
    return self.application.configuration.stop_test_module(test_module_name)

ui_activate_desktop(name)

Activates a desktop by name.

Parameters:
  • name (str) –

    The name of the desktop to activate.

Returns:
  • bool( bool ) –

    True if the operation was successful, False otherwise.

Source code in src\py_canoe\canoe.py
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
def ui_activate_desktop(self, name: str) -> bool:
    """
    Activates a desktop by name.

    Args:
        name (str): The name of the desktop to activate.

    Returns:
        bool: True if the operation was successful, False otherwise.
    """
    return self.application.ui.activate_desktop(name)

ui_open_baudrate_dialog()

Opens the baudrate dialog.

Returns:
  • bool( bool ) –

    True if the operation was successful, False otherwise.

Source code in src\py_canoe\canoe.py
1579
1580
1581
1582
1583
1584
1585
1586
def ui_open_baudrate_dialog(self) -> bool:
    """
    Opens the baudrate dialog.

    Returns:
        bool: True if the operation was successful, False otherwise.
    """
    return self.application.ui.open_baudrate_dialog()

write_text_in_write_window(text)

Writes text in the write window.

Parameters:
  • text (str) –

    The text to write.

Returns:
  • bool( bool ) –

    True if the operation was successful, False otherwise.

Source code in src\py_canoe\canoe.py
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
def write_text_in_write_window(self, text: str) -> bool:
    """
    Writes text in the write window.

    Args:
        text (str): The text to write.

    Returns:
        bool: True if the operation was successful, False otherwise.
    """
    return self.application.ui.write.output(text)