uds.can.addressing.normal_addressing

Implementation of Normal CAN Addressing formats.

Classes

NormalCanAddressingInformation

Addressing Information of CAN Entity (either server or client) that uses Normal Addressing format.

NormalFixedCanAddressingInformation

Addressing Information of CAN Entity (either server or client) that uses Normal Fixed Addressing format.

Module Contents

class uds.can.addressing.normal_addressing.NormalCanAddressingInformation(rx_physical_params, tx_physical_params, rx_functional_params, tx_functional_params)[source]

Bases: uds.can.addressing.abstract_addressing_information.AbstractCanAddressingInformation

Inheritance diagram of uds.can.addressing.normal_addressing.NormalCanAddressingInformation

Addressing Information of CAN Entity (either server or client) that uses Normal Addressing format.

Configure Addresses of UDS Entity (either a server or a client) for UDS over CAN communication.

Parameters:
  • rx_physical_params (InputAIParams) – Addressing parameters for incoming physically addressed communication.

  • tx_physical_params (InputAIParams) – Addressing parameters for outgoing physically addressed communication.

  • rx_functional_params (InputAIParams) – Addressing parameters for incoming functionally addressed communication.

  • tx_functional_params (InputAIParams) – Addressing parameters for outgoing functionally addressed communication.

ADDRESSING_FORMAT

CAN Addressing Format used.

AI_DATA_BYTES_NUMBER = 0

Number of CAN frame data bytes that are used to carry Addressing Information.

_validate_addressing_information()[source]

Validate Addressing Information parameters.

Raises:

InconsistencyError – Provided values are not consistent with each other.

Return type:

None

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

Validate Addressing Information parameters in Normal Addressing format.

Parameters:
  • addressing_type (uds.addressing.AddressingType) – Addressing type to validate.

  • addressing_format (uds.can.addressing.addressing_format.CanAddressingFormat) – CAN Addressing Format 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.

Raises:
  • ValueError – Provided Addressing format cannot be handled by this class.

  • UnusedArgumentError – At least one provided parameter is not supported by this Addressing format.

  • InconsistencyError – Provided CAN ID value is incompatible with Normal Addressing format.

Returns:

Normalized dictionary with the provided Addressing Information.

Return type:

uds.can.addressing.abstract_addressing_information.CANAddressingParams

static is_compatible_can_id(can_id, addressing_type=None)[source]

Check whether provided CAN ID is consistent with Normal Addressing format.

Parameters:
  • can_id (int) – Value of CAN ID to check.

  • addressing_type (Optional[uds.addressing.AddressingType]) – Addressing type for which consistency to be performed. Leave None to skip crosscheck between CAN Identifier and Addressing Type.

Returns:

True if CAN ID value is compatible with this CAN Addressing Format, False otherwise.

Return type:

bool

static decode_can_id_ai_params(can_id)[source]

Decode Addressing Information parameters from CAN Identifier.

Parameters:

can_id (int) – Value of a CAN Identifier.

Returns:

Decoded Addressing Information parameters.

Return type:

uds.can.addressing.abstract_addressing_information.AbstractCanAddressingInformation.CanIdAIParams

static decode_data_bytes_ai_params(ai_data_bytes)[source]

Decode Addressing Information parameters from CAN data bytes.

Parameters:

ai_data_bytes (uds.utilities.RawBytesAlias) – Data bytes containing Addressing Information.

Returns:

Decoded Addressing Information parameters.

Return type:

uds.can.addressing.abstract_addressing_information.AbstractCanAddressingInformation.DataBytesAIParamsAlias

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

Generate data bytes that carry Addressing Information.

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

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

Returns:

Data bytes that carry Addressing Information in a CAN frame Data field.

Return type:

bytearray

class uds.can.addressing.normal_addressing.NormalFixedCanAddressingInformation(rx_physical_params, tx_physical_params, rx_functional_params, tx_functional_params)[source]

Bases: uds.can.addressing.abstract_addressing_information.AbstractCanAddressingInformation

Inheritance diagram of uds.can.addressing.normal_addressing.NormalFixedCanAddressingInformation

Addressing Information of CAN Entity (either server or client) that uses Normal Fixed Addressing format.

Configure Addresses of UDS Entity (either a server or a client) for UDS over CAN communication.

Parameters:
  • rx_physical_params (InputAIParams) – Addressing parameters for incoming physically addressed communication.

  • tx_physical_params (InputAIParams) – Addressing parameters for outgoing physically addressed communication.

  • rx_functional_params (InputAIParams) – Addressing parameters for incoming functionally addressed communication.

  • tx_functional_params (InputAIParams) – Addressing parameters for outgoing functionally addressed communication.

ADDRESSING_FORMAT

CAN Addressing format used.

AI_DATA_BYTES_NUMBER = 0

Number of CAN frame data bytes that are used to carry Addressing Information.

_validate_addressing_information()[source]

Validate Addressing Information parameters.

Raises:

InconsistencyError – Provided values are not consistent with each other.

Return type:

None

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

Validate Addressing Information parameters of a CAN packet that uses Normal Fixed Addressing format.

Parameters:
  • addressing_type (uds.addressing.AddressingType) – Addressing type to validate.

  • addressing_format (uds.can.addressing.addressing_format.CanAddressingFormat) – CAN Addressing Format 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.

Raises:
  • ValueError – Provided Addressing format cannot be handled by this class.

  • UnusedArgumentError – At least one provided parameter is not supported by this Addressing format.

  • InconsistencyError – Provided Target Address, Source Address or CAN ID values are incompatible with each other or Normal Fixed Addressing format.

Returns:

Normalized dictionary with the provided Addressing Information.

Return type:

uds.can.addressing.abstract_addressing_information.CANAddressingParams

static is_compatible_can_id(can_id, addressing_type=None)[source]

Check whether provided CAN ID is consistent with Normal Fixed Addressing format.

Parameters:
  • can_id (int) – Value of CAN ID to check.

  • addressing_type (Optional[uds.addressing.AddressingType]) – Addressing type for which consistency to be performed. Leave None to skip crosscheck between CAN Identifier and Addressing Type.

Returns:

True if CAN ID value is compatible with this CAN Addressing Format, False otherwise.

Return type:

bool

classmethod decode_can_id_ai_params(can_id)[source]

Decode Addressing Information parameters from CAN Identifier.

Parameters:

can_id (int) – Value of a CAN Identifier.

Returns:

Decoded Addressing Information parameters.

Return type:

uds.can.addressing.abstract_addressing_information.AbstractCanAddressingInformation.CanIdAIParams

static decode_data_bytes_ai_params(ai_data_bytes)[source]

Decode Addressing Information parameters from CAN data bytes.

Parameters:

ai_data_bytes (uds.utilities.RawBytesAlias) – Data bytes containing Addressing Information.

Returns:

Decoded Addressing Information parameters.

Return type:

uds.can.addressing.abstract_addressing_information.AbstractCanAddressingInformation.DataBytesAIParamsAlias

classmethod encode_can_id(addressing_type, target_address, source_address, priority=CanIdHandler.DEFAULT_PRIORITY_VALUE)[source]

Generate CAN ID value for Normal Fixed CAN Addressing format.

Parameters:
  • addressing_type (uds.addressing.AddressingType) – Addressing type used.

  • target_address (int) – Target Address value to use.

  • source_address (int) – Source Address value to use.

  • priority (int) – Priority parameter value to use.

Raises:

NotImplementedError – There is missing implementation for the provided Addressing Type.

Returns:

Value of CAN ID (compatible with Normal Fixed Addressing Format) that was generated from the provided values.

Return type:

int

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

Generate data bytes that carry Addressing Information.

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

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

Returns:

Data bytes that carry Addressing Information in a CAN frame Data field.

Return type:

bytearray