uds.segmentation.abstract_segmenter

Definition of API for segmentation and desegmentation strategies.

Module Contents

Classes

AbstractSegmenter

Abstract definition of a segmenter class.

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[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 duties. They contain helper methods that are essential for successful segmentation and desegmentation execution.

Note

Each concrete segmenter class handles exactly one bus.

abstract property supported_packet_class: Type[uds.packet.AbstractUdsPacket]

Class of UDS Packet supported by this segmenter.

Return type:

Type[uds.packet.AbstractUdsPacket]

abstract property supported_packet_record_class: Type[uds.packet.AbstractUdsPacketRecord]

Class of UDS Packet Record supported by this segmenter.

Return type:

Type[uds.packet.AbstractUdsPacketRecord]

is_supported_packet_type(packet)[source]

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

Parameters:

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

Returns:

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

Return type:

bool

abstract is_input_packet(**kwargs)[source]

Check if provided frame attributes belong to a UDS packet which is an input for this Segmenter.

Parameters:

kwargs – Attributes of a frame to check.

Returns:

Addressing Type used for transmission of this UDS packet according to the configuration of this Segmenter (if provided attributes belongs to an input UDS packet), otherwise None.

Return type:

Optional[uds.transmission_attributes.AddressingType]

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.AbstractUdsPacketContainer]) – Packets sequence to check.

Returns:

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

Return type:

bool

abstract 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

abstract desegmentation(packets)[source]

Perform desegmentation of UDS packets.

Parameters:

packets (uds.packet.PacketsContainersSequence) – UDS packets to desegment 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 UDS packets.

Return type:

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

abstract segmentation(message)[source]

Perform segmentation of a diagnostic message.

Parameters:

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

Raises:

SegmentationError – Provided diagnostic message cannot be segmented.

Returns:

UDS packet(s) that carry provided diagnostic message.

Return type:

uds.packet.PacketsTuple