uds.segmentation.abstract_segmenter

Definition of segmentation and desegmentation strategies.

Exceptions

SegmentationError

UDS segmentation or desegmentation process cannot be completed due to input data inconsistency.

Classes

AbstractSegmenter

Abstract definition of a segmenter class.

Module Contents

exception uds.segmentation.abstract_segmenter.SegmentationError[source]

Bases: ValueError

Inheritance diagram of uds.segmentation.abstract_segmenter.SegmentationError

UDS segmentation or desegmentation process cannot be completed due to input data inconsistency.

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

class uds.segmentation.abstract_segmenter.AbstractSegmenter(addressing_information)[source]

Bases: abc.ABC

Inheritance diagram of uds.segmentation.abstract_segmenter.AbstractSegmenter

Abstract definition of a segmenter class.

Segmenter classes defines UDS segmentation and desegmentation tasks. They contain helper methods that are essential for successful segmentation and desegmentation execution.

Note

Each concrete segmenter class handles exactly one bus/network type.

Initialize common configuration for all segmenters.

Parameters:

addressing_information (uds.addressing.AbstractAddressingInformation) – Addressing Information configuration for this UDS Entity.

property addressing_information: uds.addressing.AbstractAddressingInformation

Addressing Information configuration for this UDS Entity.

Return type:

uds.addressing.AbstractAddressingInformation

property supported_addressing_information_class: Type[uds.addressing.AbstractAddressingInformation]
Abstractmethod:

Return type:

Type[uds.addressing.AbstractAddressingInformation]

Addressing Information class supported by this segmenter.

property supported_packet_class: Type[uds.packet.AbstractPacket]
Abstractmethod:

Return type:

Type[uds.packet.AbstractPacket]

Packet class supported by this segmenter.

property supported_packet_record_class: Type[uds.packet.AbstractPacketRecord]
Abstractmethod:

Return type:

Type[uds.packet.AbstractPacketRecord]

Packet Record class supported by this segmenter.

is_supported_packet_type(packet)[source]

Check if the argument value is a packet object of a supported type.

Parameters:

packet (uds.packet.AbstractPacketContainer) – Packet object to check.

Returns:

True if provided value is an object of a supported packet type, False otherwise.

Return type:

bool

is_supported_packets_sequence_type(packets)[source]

Check if the argument value is a packets sequence of a supported type.

Parameters:

packets (Sequence[uds.packet.AbstractPacketContainer]) – Packets sequence to check.

Returns:

True if provided value is a packets sequence of a supported type, False otherwise.

Return type:

bool

abstractmethod is_desegmented_message(packets)[source]

Check whether provided packets are full sequence of packets that form exactly one diagnostic message.

Parameters:

packets (uds.packet.PacketsContainersSequence) – Packets sequence to check.

Returns:

True if the packets form exactly one diagnostic message. False if there are missing, additional or inconsistent (e.g. two packets that initiate a message) packets.

Return type:

bool

abstractmethod desegmentation(packets)[source]

Perform desegmentation of packets.

Parameters:

packets (uds.packet.PacketsContainersSequence) – Packets to collect into UDS message.

Raises:

SegmentationError – Provided packets are not a complete packet sequence that form a diagnostic message.

Returns:

A diagnostic message that is carried by provided packets.

Return type:

Union[uds.message.UdsMessage, uds.message.UdsMessageRecord]

abstractmethod segmentation(message)[source]

Perform segmentation of a diagnostic message.

Parameters:

message (uds.message.UdsMessage) – UDS message to divide into packets.

Raises:

SegmentationError – Provided diagnostic message cannot be segmented.

Returns:

Packet(s) that carry provided diagnostic message.

Return type:

uds.packet.PacketsTuple