uds.message.uds_message

Module with common implementation of all diagnostic messages (requests and responses).

Diagnostic message are defined on upper layers of UDS OSI Model.

Module Contents

Classes

AbstractUdsMessageContainer

Abstract definition of a container with a diagnostic message information.

UdsMessage

Definition of a diagnostic message.

UdsMessageRecord

Storage for historic information about a diagnostic message that was either received or transmitted.

class uds.message.uds_message.AbstractUdsMessageContainer[source]

Bases: abc.ABC

Inheritance diagram of uds.message.uds_message.AbstractUdsMessageContainer

Abstract definition of a container with a diagnostic message information.

abstract property payload: uds.utilities.RawBytesTupleAlias

Raw payload bytes carried by this diagnostic message.

Return type:

uds.utilities.RawBytesTupleAlias

abstract property addressing_type: uds.transmission_attributes.AddressingType

Addressing for which this diagnostic message is relevant.

Return type:

uds.transmission_attributes.AddressingType

abstract __eq__(other)[source]

Compare with other object.

Parameters:

other (object) – Object to compare.

Returns:

True if other object has the same type and carries the same diagnostic message, otherwise False.

Return type:

bool

class uds.message.uds_message.UdsMessage(payload, addressing_type)[source]

Bases: AbstractUdsMessageContainer

Inheritance diagram of uds.message.uds_message.UdsMessage

Definition of a diagnostic message.

Objects of this class act as a storage for all relevant attributes of a diagnostic message. Later on, such object might be used in a segmentation process or to transmit the message. Once a message is transmitted, its historic data would be stored in UdsMessageRecord.

Create a storage for a single diagnostic message.

Parameters:
  • payload (uds.utilities.RawBytesAlias) – Raw payload bytes carried by this diagnostic message.

  • addressing_type (uds.transmission_attributes.AddressingType) – Addressing for which this diagnostic message is relevant.

property payload: uds.utilities.RawBytesTupleAlias

Raw payload bytes carried by this diagnostic message.

Return type:

uds.utilities.RawBytesTupleAlias

property addressing_type: uds.transmission_attributes.AddressingType

Addressing for which this diagnostic message is relevant.

Return type:

uds.transmission_attributes.AddressingType

__eq__(other)[source]

Compare with other object.

Parameters:

other (object) – Object to compare.

Returns:

True if other object has the same type and carries the same diagnostic message, otherwise False.

Return type:

bool

class uds.message.uds_message.UdsMessageRecord(packets_records)[source]

Bases: AbstractUdsMessageContainer

Inheritance diagram of uds.message.uds_message.UdsMessageRecord

Storage for historic information about a diagnostic message that was either received or transmitted.

Create a record of historic information about a diagnostic message that was either received or transmitted.

Parameters:

packets_records (uds.packet.PacketsRecordsSequence) – Sequence (in transmission order) of UDS packets records that carried this diagnostic message.

property packets_records: uds.packet.PacketsRecordsTuple

Sequence (in transmission order) of UDS packets records that carried this diagnostic message.

UDS packets sequence is a complete sequence of packets that was exchanged during this diagnostic message transmission.

Return type:

uds.packet.PacketsRecordsTuple

property payload: uds.utilities.RawBytesTupleAlias

Raw payload bytes carried by this diagnostic message.

Return type:

uds.utilities.RawBytesTupleAlias

property addressing_type: uds.transmission_attributes.AddressingType

Addressing which was used to transmit this diagnostic message.

Return type:

uds.transmission_attributes.AddressingType

property direction: uds.transmission_attributes.TransmissionDirection

Information whether this message was received or sent.

Return type:

uds.transmission_attributes.TransmissionDirection

property transmission_start: datetime.datetime

Time stamp when transmission of this message was initiated.

It is determined by a moment of time when the first packet (that carried this message) was published to a bus (either received or transmitted).

Returns:

Time stamp when transmission of this message was initiated.

Return type:

datetime.datetime

property transmission_end: datetime.datetime

Time stamp when transmission of this message was completed.

It is determined by a moment of time when the last packet (that carried this message) was published to a bus (either received or transmitted).

Returns:

Time stamp when transmission of this message was completed.

Return type:

datetime.datetime

__eq__(other)[source]

Compare with other object.

Parameters:

other (object) – Object to compare.

Returns:

True if other object has the same type and carries the same diagnostic message, otherwise False.

Return type:

bool

static __validate_packets_records(value)

Validate whether the argument contains UDS Packets records.

Parameters:

value (uds.packet.PacketsRecordsSequence) – Value to validate.

Raises:
  • TypeError – UDS Packet Records sequence is not list or tuple type.

  • ValueError – At least one of UDS Packet Records sequence elements is not an object of AbstractUdsPacketRecord class.

Return type:

None