uds.packet.can_packet_record

CAN bus specific implementation of UDS packets records.

Module Contents

Classes

CanPacketRecord

Definition of a CAN packet record.

class uds.packet.can_packet_record.CanPacketRecord(frame, direction, addressing_type, addressing_format, transmission_time)[source]

Bases: uds.packet.abstract_can_packet_container.AbstractCanPacketContainer, uds.packet.abstract_packet.AbstractUdsPacketRecord

Inheritance diagram of uds.packet.can_packet_record.CanPacketRecord

Definition of a CAN packet record.

Objects of this class act as a storage for historic information about transmitted or received CAN packet.

Create a record of historic information about a CAN packet that was either received or transmitted.

Parameters:
  • frame (CanFrameAlias) – Either received or transmitted CAN frame that carried this CAN Packet.

  • direction (uds.transmission_attributes.TransmissionDirection) – Information whether this packet was transmitted or received.

  • addressing_type (uds.transmission_attributes.AddressingType) – Addressing type for which this CAN packet is relevant.

  • addressing_format (uds.can.CanAddressingFormat) – CAN addressing format that this CAN packet used.

  • transmission_time (datetime.datetime) – Time stamp when this packet was fully transmitted on a CAN bus.

property raw_frame_data: uds.utilities.RawBytesTupleAlias

Raw data bytes of a frame that carried this CAN packet.

Return type:

uds.utilities.RawBytesTupleAlias

property can_id: int

CAN Identifier (CAN ID) of a CAN Frame that carries this CAN packet.

Return type:

int

property addressing_format: uds.can.CanAddressingFormat

CAN addressing format used by this CAN packet.

Return type:

uds.can.CanAddressingFormat

property addressing_type: uds.transmission_attributes.AddressingType

Addressing type over which this CAN packet was transmitted.

Return type:

uds.transmission_attributes.AddressingType

property packet_type: uds.packet.can_packet_type.CanPacketType

CAN packet type value - N_PCI value of this N_PDU.

Return type:

uds.packet.can_packet_type.CanPacketType

property target_address: int | None

Target Address (TA) value of this CAN Packet.

Target Address value is used with following addressing formats:

None in other cases.

Return type:

Optional[int]

property source_address: int | None

Source Address (SA) value of this CAN Packet.

Source Address value is used with following addressing formats:

None in other cases.

Return type:

Optional[int]

property address_extension: int | None

Address Extension (AE) value of this CAN Packet.

Address Extension is used with following addressing formats:

None in other cases.

Return type:

Optional[int]

static _validate_frame(value)[source]

Validate a CAN frame argument.

Parameters:

value (Any) – Value to validate.

Raises:
  • TypeError – The frame argument has unsupported.

  • ValueError – Some attribute of the frame argument is missing or its value is unexpected.

Return type:

None

__assess_packet_type()

Assess and set value of Packet Type attribute.

Return type:

None

__assess_ai_attributes()

Assess and set values of attributes with Addressing Information.

Raises:

InconsistentArgumentsError – Value of Addressing Type that is already set does not match decoded one.

Return type:

None