diff --git a/can/interfaces/vector/canlib.py b/can/interfaces/vector/canlib.py index cb1858062..14205327b 100644 --- a/can/interfaces/vector/canlib.py +++ b/can/interfaces/vector/canlib.py @@ -577,6 +577,15 @@ def _detect_available_configs(): ) return configs + @staticmethod + def popup_vector_hw_configuration(wait_for_finish: int = 0) -> None: + """Open vector hardware configuration window. + + :param int wait_for_finish: + Time to wait for user input in milliseconds. + """ + xldriver.xlPopupHwConfig(ctypes.c_char_p(), ctypes.c_uint(wait_for_finish)) + def get_channel_configs(): if xldriver is None: diff --git a/can/interfaces/vector/xldriver.py b/can/interfaces/vector/xldriver.py index 337135755..7a361a29d 100644 --- a/can/interfaces/vector/xldriver.py +++ b/can/interfaces/vector/xldriver.py @@ -229,3 +229,8 @@ def check_status(result, function, arguments): xlCanSetChannelOutput.argtypes = [xlclass.XLportHandle, xlclass.XLaccess, ctypes.c_char] xlCanSetChannelOutput.restype = xlclass.XLstatus xlCanSetChannelOutput.errcheck = check_status + +xlPopupHwConfig = _xlapi_dll.xlPopupHwConfig +xlPopupHwConfig.argtypes = [ctypes.c_char_p, ctypes.c_uint] +xlPopupHwConfig.restype = xlclass.XLstatus +xlPopupHwConfig.errcheck = check_status diff --git a/test/test_vector.py b/test/test_vector.py index d99509df8..a2d47c74e 100644 --- a/test/test_vector.py +++ b/test/test_vector.py @@ -240,6 +240,14 @@ def test_reset(self) -> None: can.interfaces.vector.canlib.xldriver.xlDeactivateChannel.assert_called() can.interfaces.vector.canlib.xldriver.xlActivateChannel.assert_called() + def test_popup_hw_cfg(self) -> None: + canlib.xldriver.xlPopupHwConfig = Mock() + canlib.VectorBus.popup_vector_hw_configuration(10) + assert canlib.xldriver.xlPopupHwConfig.called + args, kwargs = canlib.xldriver.xlPopupHwConfig.call_args + assert isinstance(args[0], ctypes.c_char_p) + assert isinstance(args[1], ctypes.c_uint) + def test_called_without_testing_argument(self) -> None: """This tests if an exception is thrown when we are not running on Windows.""" if os.name != "nt":