uds.can.addressing_information

Implementation of CAN Addressing Information.

This module contains helper class for managing Addressing Information on CAN bus.

Module Contents

Classes

CanAddressingInformation

CAN Entity (either server or client) Addressing Information.

class uds.can.addressing_information.CanAddressingInformation[source]

CAN Entity (either server or client) Addressing Information.

Create object of CAN Entity (either server or client) Addressing Information.

Parameters:
  • addressing_format – CAN Addressing format used by CAN Entity.

  • rx_physical – Addressing Information parameters used for incoming physically addressed communication.

  • tx_physical – Addressing Information parameters used for outgoing physically addressed communication.

  • rx_functional – Addressing Information parameters used for incoming functionally addressed communication.

  • tx_functional – Addressing Information parameters used for outgoing functionally addressed communication.

class DataBytesAIParamsAlias[source]

Bases: TypedDict

Inheritance diagram of uds.can.addressing_information.CanAddressingInformation.DataBytesAIParamsAlias

Alias of Addressing Information parameters encoded in data field.

Initialize self. See help(type(self)) for accurate signature.

target_address: int
address_extension: int
class DecodedAIParamsAlias[source]

Bases: TypedDict

Inheritance diagram of uds.can.addressing_information.CanAddressingInformation.DecodedAIParamsAlias

Alias of Addressing Information parameters encoded in CAN ID and data field.

Initialize self. See help(type(self)) for accurate signature.

addressing_type: uds.transmission_attributes.AddressingType | None
target_address: int | None
source_address: int | None
address_extension: int | None
ADDRESSING_INFORMATION_MAPPING: Dict[uds.can.addressing_format.CanAddressingFormat, Type[uds.can.abstract_addressing_information.AbstractCanAddressingInformation]]

Dictionary with CAN Addressing format mapping to Addressing Information handler classes.

classmethod validate_packet_ai(addressing_format, addressing_type, can_id=None, target_address=None, source_address=None, address_extension=None)[source]

Validate Addressing Information parameters of a CAN packet.

Parameters:
  • addressing_format (uds.can.addressing_format.CanAddressingFormat) – CAN addressing format value to validate.

  • addressing_type (uds.transmission_attributes.AddressingType) – Addressing type to validate.

  • can_id (Optional[int]) – CAN Identifier value to validate.

  • target_address (Optional[int]) – Target Address value to validate.

  • source_address (Optional[int]) – Source Address value to validate.

  • address_extension (Optional[int]) – Address Extension value to validate.

Returns:

Normalized dictionary with the provided Addressing Information.

Return type:

uds.can.abstract_addressing_information.PacketAIParamsAlias

classmethod validate_ai_data_bytes(addressing_format, ai_data_bytes)[source]

Validate Addressing Information stored in CAN data bytes.

Parameters:
Raises:

InconsistentArgumentsError – Provided number of Addressing Information data bytes does not match Addressing Format used.

Return type:

None

classmethod decode_packet_ai(addressing_format, can_id, ai_data_bytes)[source]

Decode Addressing Information parameters from CAN ID and data bytes.

Warning

This methods might not extract full Addressing Information from the provided data as some of them are system specific.

For example, Addressing Type will not be decoded when either Normal 11bit, Extended or Mixed 11bit addressing format is used as the Addressing Type (in such case) depends on system specific behaviour.

Parameters:
  • addressing_format (uds.can.addressing_format.CanAddressingFormat) – CAN Addressing Format used.

  • can_id (int) – Value of CAN Identifier.

  • ai_data_bytes (uds.utilities.RawBytesAlias) – Data bytes containing Addressing Information. This parameter shall contain either 0 or 1 byte that is located at the beginning of a CAN frame data field. Number of these bytes depends on CAN Addressing Format used.

Returns:

Dictionary with Addressing Information decoded out of the provided CAN ID and data bytes.

Return type:

DecodedAIParamsAlias

classmethod decode_ai_data_bytes(addressing_format, ai_data_bytes)[source]

Decode Addressing Information from CAN data bytes.

Parameters:
  • addressing_format (uds.can.addressing_format.CanAddressingFormat) – CAN Addressing Format used.

  • ai_data_bytes (uds.utilities.RawBytesAlias) – Data bytes containing Addressing Information. This parameter shall contain either 0 or 1 byte that is located at the beginning of a CAN frame data field. Number of these bytes depends on CAN Addressing Format used.

Raises:

NotImplementedError – There is missing implementation for the provided Addressing Format. Please create an issue in our Issues Tracking System with detailed description if you face this error.

Returns:

Dictionary with Addressing Information decoded out of the provided data bytes.

Return type:

DataBytesAIParamsAlias

classmethod encode_ai_data_bytes(addressing_format, target_address=None, address_extension=None)[source]

Generate a list of data bytes that carry Addressing Information.

Parameters:
  • addressing_format (uds.can.addressing_format.CanAddressingFormat) – CAN Addressing Format used.

  • target_address (Optional[int]) – Target Address value used.

  • address_extension (Optional[int]) – Source Address value used.

Raises:

NotImplementedError

There is missing implementation for the provided Addressing Format. Please create an issue in our Issues Tracking System with detailed description if you face this error.

Returns:

List of data bytes that carry Addressing Information in CAN frame Data field.

Return type:

uds.utilities.RawBytesListAlias

classmethod get_ai_data_bytes_number(addressing_format)[source]

Get number of data bytes that are used to carry Addressing Information.

Parameters:

addressing_format (uds.can.addressing_format.CanAddressingFormat) – CAN Addressing Format used.

Returns:

Number of data bytes in a CAN Packet that are used to carry Addressing Information for provided CAN Addressing Format.

Return type:

int