uds.segmentation.abstract_segmenter
Definition of API for segmentation and desegmentation strategies.
Module Contents
Classes
Abstract definition of a segmenter class. |
- exception uds.segmentation.abstract_segmenter.SegmentationError[source]
Bases:
ValueError
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
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.
- property supported_packet_classes(self)
Classes that define packet objects supported by this segmenter.
- Return type
Tuple[Type[uds.packet.PacketAlias], Ellipsis]
- is_supported_packet(self, value)[source]
Check if the argument value is a packet object of a supported type.
- Parameters
value (Any) – Value to check.
- Returns
True if provided value is an object of a supported packet type, False otherwise.
- Return type
bool
- is_supported_packets_sequence(self, value)[source]
Check if the argument value is a packet sequence of a supported type.
- Parameters
value (Any) – Value to check.
- Returns
True if provided value is a packet sequence of a supported type, False otherwise.
- Return type
bool
- abstract is_complete_packets_sequence(self, packets)[source]
Check whether provided packets are full sequence of packets that form exactly one diagnostic message.
- Parameters
packets (uds.packet.PacketsSequence) – 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(self, packets)[source]
Perform desegmentation of UDS packets.
- Parameters
packets (uds.packet.PacketsSequence) – 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 an outcome of UDS packets desegmentation.
- Return type
Union[uds.message.UdsMessage, uds.message.UdsMessageRecord]
- abstract segmentation(self, 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 packets that are an outcome of UDS message segmentation.
- Return type
uds.packet.PacketsDefinitionTuple