uds.can.addressing.addressing_information ========================================= .. py:module:: uds.can.addressing.addressing_information .. autoapi-nested-parse:: Implementation of Addressing Information for CAN bus. This module contains helper class for managing :ref:`Addressing Information ` on CAN bus. Classes ------- .. autoapisummary:: uds.can.addressing.addressing_information.CanAddressingInformation Module Contents --------------- .. py:class:: CanAddressingInformation CAN Entity (either server or client) Addressing Information. Create UDS Addressing Information for a CAN node. :param addressing_format: CAN Addressing format used by CAN node. :param rx_physical_params: Addressing Information parameters used for incoming physically addressed communication. :param tx_physical_params: Addressing Information parameters used for outgoing physically addressed communication. :param rx_functional_params: Addressing Information parameters used for incoming functionally addressed communication. :param tx_functional_params: Addressing Information parameters used for outgoing functionally addressed communication. .. py:attribute:: ADDRESSING_INFORMATION_MAPPING :type: Dict[uds.can.addressing.addressing_format.CanAddressingFormat, Type[uds.can.addressing.abstract_addressing_information.AbstractCanAddressingInformation]] Dictionary with CAN Addressing Formats mapped to Addressing Information handler classes. .. py:method:: get_ai_data_bytes_number(addressing_format) :classmethod: Get number of data bytes that are used to carry Addressing Information. :param addressing_format: CAN Addressing Format used. :return: Number of data bytes in a CAN Packet that are used to carry Addressing Information for provided CAN Addressing Format. .. py:method:: validate_ai_data_bytes(addressing_format, ai_data_bytes) :classmethod: Validate Addressing Information stored in CAN data bytes. :param addressing_format: CAN Addressing Format used. :param ai_data_bytes: Data bytes to validate. :raise InconsistencyError: Provided number of Addressing Information data bytes does not match CAN Addressing Format used. .. py:method:: validate_addressing_params(addressing_format, addressing_type, can_id = None, target_address = None, source_address = None, address_extension = None) :classmethod: Validate Addressing Information parameters of a CAN packet. :param addressing_format: CAN addressing format used. :param addressing_type: Addressing type to validate. :param can_id: CAN Identifier value to validate. :param target_address: Target Address value to validate. :param source_address: Source Address value to validate. :param address_extension: Address Extension value to validate. :return: Normalized dictionary with the provided Addressing Information. .. py:method:: is_compatible_can_id(addressing_format, can_id, addressing_type = None) :classmethod: Check whether provided CAN ID is consistent the provided CAN Addressing Format. :param addressing_format: Addressing format used. :param can_id: CAN ID value to check. :param addressing_type: Addressing type for which consistency to be performed. Leave None to skip crosscheck between CAN Identifier and Addressing Type. :return: True if CAN ID value is compatible with this CAN Addressing Format, False otherwise. .. py:method:: decode_can_id_ai_params(addressing_format, can_id) :classmethod: Decode Addressing Information parameters from CAN Identifier. :param addressing_format: Addressing format used. :param can_id: Value of a CAN Identifier. :return: Decoded Addressing Information parameters. .. py:method:: decode_data_bytes_ai_params(addressing_format, ai_data_bytes) :classmethod: Decode Addressing Information parameters from CAN data bytes. :param addressing_format: Addressing format used. :param ai_data_bytes: Data bytes containing Addressing Information. :return: Decoded Addressing Information parameters. .. py:method:: decode_frame_ai_params(addressing_format, can_id, raw_frame_data) :classmethod: Decode Addressing Information parameters from a CAN Frame. :param addressing_format: Addressing format used. :param can_id: CAN Identifier value of a CAN frame. :param raw_frame_data: Raw data bytes of a CAN frame :return: Decoded Addressing Information parameters. .. py:method:: encode_can_id(addressing_format, addressing_type, target_address, source_address, priority = CanIdHandler.DEFAULT_PRIORITY_VALUE) :classmethod: Generate CAN ID value for Normal Fixed CAN Addressing format. :param addressing_format: Addressing format used. :param addressing_type: Addressing type used. :param target_address: Target Address value to use. :param source_address: Source Address value to use. :param priority: Priority parameter value to use. :raise ValueError: CAN ID cannot be encoded for provided CAN Addressing Format. :return: Value of CAN ID that is compatible with provided CAN Addressing Format and was generated out of the provided values. .. py:method:: encode_ai_data_bytes(addressing_format, target_address = None, address_extension = None) :classmethod: Generate data bytes that carry Addressing Information. :param addressing_format: CAN Addressing Format used. :param target_address: Target Address value used. :param address_extension: Source Address value used. :return: Data bytes that carry Addressing Information in a CAN frame Data field.