From 4b43f337878091bce1a737b0acf98a4fa2bbd968 Mon Sep 17 00:00:00 2001 From: zariiii9003 <52598363+zariiii9003@users.noreply.github.com> Date: Fri, 28 Oct 2022 15:38:44 +0200 Subject: [PATCH] improve vector documentation (#1420) --- can/interfaces/vector/__init__.py | 2 +- can/interfaces/vector/canlib.py | 3 ++ doc/interfaces/vector.rst | 65 +++++++++++++++++++++++++++++-- 3 files changed, 66 insertions(+), 4 deletions(-) diff --git a/can/interfaces/vector/__init__.py b/can/interfaces/vector/__init__.py index cdeb1d3cb..f543a6109 100644 --- a/can/interfaces/vector/__init__.py +++ b/can/interfaces/vector/__init__.py @@ -1,5 +1,5 @@ """ """ -from .canlib import VectorBus, VectorChannelConfig +from .canlib import VectorBus, VectorChannelConfig, get_channel_configs from .exceptions import VectorError, VectorOperationError, VectorInitializationError diff --git a/can/interfaces/vector/canlib.py b/can/interfaces/vector/canlib.py index a36f67e9e..8f5c557d6 100644 --- a/can/interfaces/vector/canlib.py +++ b/can/interfaces/vector/canlib.py @@ -876,6 +876,8 @@ def set_timer_rate(self, timer_rate_ms: int) -> None: class VectorChannelConfig(NamedTuple): + """NamedTuple which contains the channel properties from Vector XL API.""" + name: str hwType: xldefine.XL_HardwareType hwIndex: int @@ -906,6 +908,7 @@ def _get_xl_driver_config() -> xlclass.XLdriverConfig: def get_channel_configs() -> List[VectorChannelConfig]: + """Read channel properties from Vector XL API.""" try: driver_config = _get_xl_driver_config() except VectorError: diff --git a/doc/interfaces/vector.rst b/doc/interfaces/vector.rst index 7b5ede616..a4708c28f 100644 --- a/doc/interfaces/vector.rst +++ b/doc/interfaces/vector.rst @@ -4,7 +4,7 @@ Vector This interface adds support for CAN controllers by `Vector`_. Only Windows is supported. By default this library uses the channel configuration for CANalyzer. -To use a different application, open Vector Hardware Config program and create +To use a different application, open **Vector Hardware Configuration** program and create a new application and assign the channels you may want to use. Specify the application name as ``app_name='Your app name'`` when constructing the bus or in a config file. @@ -21,13 +21,72 @@ application named "python-can":: -Bus ---- +VectorBus +--------- .. autoclass:: can.interfaces.vector.VectorBus + :show-inheritance: + :member-order: bysource + :members: + set_filters, + recv, + send, + send_periodic, + stop_all_periodic_tasks, + flush_tx_buffer, + reset, + shutdown, + popup_vector_hw_configuration, + get_application_config, + set_application_config + +Exceptions +---------- .. autoexception:: can.interfaces.vector.VectorError + :show-inheritance: .. autoexception:: can.interfaces.vector.VectorInitializationError + :show-inheritance: .. autoexception:: can.interfaces.vector.VectorOperationError + :show-inheritance: + +Miscellaneous +------------- + +.. autofunction:: can.interfaces.vector.get_channel_configs + +.. autoclass:: can.interfaces.vector.VectorChannelConfig + :show-inheritance: + :class-doc-from: class + +.. autoclass:: can.interfaces.vector.xldefine.XL_HardwareType + :show-inheritance: + :member-order: bysource + :members: + :undoc-members: + +.. autoclass:: can.interfaces.vector.xldefine.XL_ChannelCapabilities + :show-inheritance: + :member-order: bysource + :members: + :undoc-members: + +.. autoclass:: can.interfaces.vector.xldefine.XL_BusCapabilities + :show-inheritance: + :member-order: bysource + :members: + :undoc-members: + +.. autoclass:: can.interfaces.vector.xldefine.XL_BusTypes + :show-inheritance: + :member-order: bysource + :members: + :undoc-members: + +.. autoclass:: can.interfaces.vector.xldefine.XL_Status + :show-inheritance: + :member-order: bysource + :members: + :undoc-members: .. _Vector: https://vector.com/