uds.can.transport_interface.common ================================== .. py:module:: uds.can.transport_interface.common .. autoapi-nested-parse:: Definition of UDS Transport Interface for CAN bus. Classes ------- .. autoapisummary:: uds.can.transport_interface.common.AbstractCanTransportInterface Module Contents --------------- .. py:class:: AbstractCanTransportInterface(network_manager, addressing_information, n_as_timeout = N_AS_TIMEOUT, n_ar_timeout = N_AR_TIMEOUT, n_bs_timeout = N_BS_TIMEOUT, n_cr_timeout = N_CR_TIMEOUT, n_br = DEFAULT_N_BR, n_cs = DEFAULT_N_CS, flow_control_parameters_generator = DEFAULT_FLOW_CONTROL_PARAMETERS, can_version = CanVersion.CLASSIC_CAN, bitrate_switch = False, **segmenter_configuration) Bases: :py:obj:`uds.transport_interface.AbstractTransportInterface`, :py:obj:`abc.ABC` .. autoapi-inheritance-diagram:: uds.can.transport_interface.common.AbstractCanTransportInterface :parts: 1 :private-bases: Abstract definition of Transport Interface for managing Diagnostics on CAN. CAN Transport Interfaces are meant to handle UDS middle layers (Transport and Network) on CAN bus. Create Transport Interface (an object for handling UDS Transport and Network layers). :param network_manager: An object that handles CAN bus (Physical and Data layers of OSI Model). :param addressing_information: Addressing Information configuration of a simulated node that is taking part in DoCAN communication. :param n_as_timeout: Timeout value for :ref:`N_As ` time parameter. :param n_ar_timeout: Timeout value for :ref:`N_Ar ` time parameter. :param n_bs_timeout: Timeout value for :ref:`N_Bs ` time parameter. :param n_cr_timeout: Timeout value for :ref:`N_Cr ` time parameter. :param n_br: Value of :ref:`N_Br ` time parameter to use in communication. :param n_cs: Value of :ref:`N_Cs ` time parameter to use in communication. :param flow_control_parameters_generator: Generator with Flow Control parameters to use. :param can_version: Version of CAN protocol to be used for packets sending. :param bitrate_switch: Whether bitrate switch (BRS) shall be set in sent packets. :param segmenter_configuration: Configuration parameters for CAN Segmenter. - :parameter dlc: Base CAN DLC value to use for CAN packets. - :parameter min_dlc: Minimal CAN DLC to use for CAN Packets during Data Optimization. - :parameter use_data_optimization: Information whether to use :ref:`CAN Frame Data Optimization `. - :parameter filler_byte: Filler byte value to use for :ref:`CAN Frame Data Padding `. .. py:attribute:: N_AS_TIMEOUT :type: uds.utilities.TimeMillisecondsAlias :value: 1000 Timeout value of :ref:`N_As ` time parameter according to ISO 15765-2. .. py:attribute:: N_AR_TIMEOUT :type: uds.utilities.TimeMillisecondsAlias :value: 1000 Timeout value of :ref:`N_Ar ` time parameter according to ISO 15765-2. .. py:attribute:: N_BS_TIMEOUT :type: uds.utilities.TimeMillisecondsAlias :value: 1000 Timeout value of :ref:`N_Bs ` time parameter according to ISO 15765-2. .. py:attribute:: N_CR_TIMEOUT :type: uds.utilities.TimeMillisecondsAlias :value: 1000 Timeout value of :ref:`N_Cr ` time parameter according to ISO 15765-2. .. py:attribute:: DEFAULT_N_BR :type: uds.utilities.TimeMillisecondsAlias :value: 0 Default value for :ref:`N_Br ` time parameter. .. py:attribute:: DEFAULT_N_CS :type: Optional[uds.utilities.TimeMillisecondsAlias] :value: None Default value for :ref:`N_Cs ` time parameter. .. py:attribute:: DEFAULT_FLOW_CONTROL_PARAMETERS Default values generator for :ref:`Flow Control ` parameters (:ref:`Flow Status `, :ref:`Block Size `, :ref:`Separation Time minimum `). .. py:attribute:: __n_ar_measured :type: Optional[uds.utilities.TimeMillisecondsAlias] :value: None .. py:attribute:: __n_as_measured :type: Optional[uds.utilities.TimeMillisecondsAlias] :value: None .. py:attribute:: __n_bs_measured :type: Optional[Tuple[uds.utilities.TimeMillisecondsAlias, Ellipsis]] :value: None .. py:attribute:: __n_cr_measured :type: Optional[Tuple[uds.utilities.TimeMillisecondsAlias, Ellipsis]] :value: None .. py:property:: n_as_timeout :type: uds.utilities.TimeMillisecondsAlias Timeout value for :ref:`N_As ` time parameter. .. py:property:: n_ar_timeout :type: uds.utilities.TimeMillisecondsAlias Timeout value for :ref:`N_Ar ` time parameter. .. py:property:: n_bs_timeout :type: uds.utilities.TimeMillisecondsAlias Timeout value for :ref:`N_Bs ` time parameter. .. py:property:: n_cr_timeout :type: uds.utilities.TimeMillisecondsAlias Timeout value for :ref:`N_Cr ` time parameter. .. py:property:: n_br :type: uds.utilities.TimeMillisecondsAlias Get the value of :ref:`N_Br ` time parameter which is currently set. .. note:: The actual (observed on the bus) value will be slightly longer as it also includes computation and CAN Interface delays. .. py:property:: n_cs :type: Optional[uds.utilities.TimeMillisecondsAlias] Get the value of :ref:`N_Cs ` time parameter which is currently set. .. note:: The actual (observed on the bus) value will be slightly longer as it also includes computation and CAN Interface delays. .. py:property:: flow_control_parameters_generator :type: uds.can.packet.AbstractFlowControlParametersGenerator Get generator of Flow Control parameters (Flow Status, Block Size, Separation Time minimum). .. py:property:: segmenter :type: uds.can.segmenter.CanSegmenter Get the segmenter used by this CAN Transport Interface. .. py:property:: can_version :type: uds.can.frame.CanVersion Get version of CAN protocol to be used for packets sending. .. py:property:: bitrate_switch :type: bool Get value of bitrate switch (BRS) to be used for packets sending. .. py:property:: dlc :type: int Value of base CAN DLC to use for output CAN packets. .. note:: All output CAN packets will have this DLC value set unless :ref:`CAN Frame Data Optimization ` is used. .. py:property:: min_dlc :type: Optional[int] Value of minimal CAN DLC to use for CAN Packets during Data Optimization. .. note:: Output CAN Packets (created by :meth:`~uds.segmentation.can_segmenter.CanSegmenter.segmentation`) will never have DLC smaller than this value even if :ref:`CAN Frame Data Optimization ` is used. .. py:property:: use_data_optimization :type: bool Information whether to use CAN Frame Data Optimization during CAN packets creation. .. seealso:: :ref:`CAN Frame Data Optimization ` .. py:property:: filler_byte :type: int Filler byte value to use for output CAN Frame Data Padding during segmentation. .. seealso:: :ref:`CAN Frame Data Padding ` .. py:property:: n_as_measured :type: Optional[uds.utilities.TimeMillisecondsAlias] Get the last measured value of :ref:`N_As ` time parameter. .. note:: The last measurement comes from the last transmission of Single Frame or First Fame CAN Packet using either :meth:`~uds.can.transport_interface.common.AbstractCanTransportInterface.send_packet` or :meth:`~uds.can.transport_interface.common.AbstractCanTransportInterface.async_send_packet` method. :return: Time in milliseconds or None if the value was never measured. .. py:property:: n_ar_measured :type: Optional[uds.utilities.TimeMillisecondsAlias] Get the last measured value of :ref:`N_Ar ` time parameter. .. note:: The last measurement comes from the last transmission of Flow Control CAN Packet using either :meth:`~uds.can.transport_interface.common.AbstractCanTransportInterface.receive_packet` or :meth:`~uds.can.transport_interface.common.AbstractCanTransportInterface.async_receive_packet` method. :return: Time in milliseconds or None if the value was never measured. .. py:property:: n_bs_measured :type: Optional[Tuple[uds.utilities.TimeMillisecondsAlias, Ellipsis]] Get the last measured values of :ref:`N_Bs ` time parameter. .. note:: The last measurement comes from the last transmission of UDS message using either :meth:`~uds.transport_interface.addressing.AbstractCanTransportInterface.send_message` or :meth:`~uds.transport_interface.addressing.AbstractCanTransportInterface.async_send_message` method. :return: Tuple with times in milliseconds or None if the values could not be measured. .. py:property:: n_br_max :type: uds.utilities.TimeMillisecondsAlias Get the maximum valid value of :ref:`N_Br ` time parameter. .. warning:: To assess maximal value of :ref:`N_Br `, the actual value of :ref:`N_Ar ` time parameter is required. Either the latest measured value of :ref:`N_Ar ` would be used, or 0ms would be assumed (if there are no measurement result). .. py:property:: n_cs_max :type: uds.utilities.TimeMillisecondsAlias Get the maximum valid value of :ref:`N_Cs ` time parameter. .. warning:: To assess maximal value of :ref:`N_Cs `, the actual value of :ref:`N_As ` time parameter is required. Either the latest measured value of :ref:`N_As ` would be used, or 0ms would be assumed (if there are no measurement result). .. py:property:: n_cr_measured :type: Optional[Tuple[uds.utilities.TimeMillisecondsAlias, Ellipsis]] Get the last measured values of :ref:`N_Cr ` time parameter. .. note:: The last measurement comes from the last reception of UDS message using either :meth:`~uds.transport_interface.addressing.AbstractCanTransportInterface.receive_message` or :meth:`~uds.transport_interface.addressing.AbstractCanTransportInterface.async_receive_message` method. :return: Tuple with times in milliseconds or None if the values could not be measured. .. py:method:: _update_n_ar_measured(value) Update measured values of :ref:`N_Ar `. :param value: Value to set. :raise TypeError: Provided value is not int or float type. :raise ValueError: Provided value is out of range. .. py:method:: _update_n_as_measured(value) Update measured values of :ref:`N_As `. :param value: Value to set. :raise TypeError: Provided value is not int or float type. :raise ValueError: Provided value is out of range. .. py:method:: _update_n_bs_measured(message_record) Update measured values of :ref:`N_Bs ` according to timestamps of CAN packet records. :param message_record: Record of UDS message transmitted over CAN. :raise TypeError: Provided value is not UDS message record. :raise ValueError: Provided UDS message record was not transmitted. .. py:method:: _update_n_cr_measured(message_record) Update measured values of :ref:`N_Cr ` according to timestamps of CAN packet records. :param message_record: Record of UDS message received over CAN. :raise TypeError: Provided value is not UDS message record. :raise ValueError: Provided UDS message record was not received. .. py:method:: clear_measurements() Clear measured values of CAN communication parameters.