uds.can.segmenter ================= .. py:module:: uds.can.segmenter .. autoapi-nested-parse:: Segmentation specific for CAN bus. Classes ------- .. autoapisummary:: uds.can.segmenter.CanSegmenter Module Contents --------------- .. py:class:: CanSegmenter(*, addressing_information, dlc = CanDlcHandler.MIN_BASE_UDS_DLC, min_dlc = None, use_data_optimization = False, filler_byte = DEFAULT_FILLER_BYTE) Bases: :py:obj:`uds.segmentation.AbstractSegmenter` .. autoapi-inheritance-diagram:: uds.can.segmenter.CanSegmenter :parts: 1 :private-bases: Segmenter class that provides utilities for segmentation and desegmentation specific for CAN bus. Configure CAN Segmenter. :param addressing_information: Addressing Information configuration of a node that is taking part in DoCAN communication. :param dlc: Base CAN DLC value to use for creating CAN Packets. :param min_dlc: Minimal CAN DLC to use for CAN Packets during Data Optimization. None value means no restriction. :param use_data_optimization: Information whether to use CAN Frame Data Optimization in created CAN Packets during segmentation. :param filler_byte: Filler byte value to use for CAN Frame Data Padding in created CAN Packets during segmentation. .. py:attribute:: addressing_information :type: uds.can.addressing.AbstractCanAddressingInformation Addressing Information configuration for this UDS Entity. .. py:property:: dlc :type: int Value of base CAN DLC to use for CAN Packets. .. note:: All output CAN Packets (created by :meth:`~uds.segmentation.can_segmenter.CanSegmenter.segmentation`) will have this DLC value set unless :ref:`CAN Frame Data Optimization ` is used. .. py:property:: min_dlc :type: Optional[int] Value of minimal CAN DLC to use for CAN Packets during Data Optimization. .. note:: Output CAN Packets (created by :meth:`~uds.segmentation.can_segmenter.CanSegmenter.segmentation`) will never have DLC smaller than this value even if :ref:`CAN Frame Data Optimization ` is used. .. py:property:: use_data_optimization :type: bool Information whether to use CAN Frame Data Optimization during CAN Packet creation. .. py:property:: filler_byte :type: int Filler byte value to use for CAN Frame Data Padding during segmentation. .. py:property:: supported_addressing_information_class :type: Type[uds.addressing.AbstractAddressingInformation] Addressing Information class supported by this segmenter. .. py:property:: supported_packet_class :type: Type[uds.packet.AbstractPacket] Packet class supported by CAN segmenter. .. py:property:: supported_packet_record_class :type: Type[uds.packet.AbstractPacketRecord] Packet Record class supported by CAN segmenter. .. py:property:: addressing_format :type: uds.can.addressing.CanAddressingFormat CAN Addressing Format used. .. py:method:: __physical_segmentation(message) Segment physically addressed diagnostic message. :param message: UDS message to divide into packets. :raise SegmentationError: Provided diagnostic message cannot be segmented. :return: CAN packets that are an outcome of UDS message segmentation. .. py:method:: __functional_segmentation(message) Segment functionally addressed diagnostic message. :param message: UDS message to divide into packets. :raise SegmentationError: Provided diagnostic message cannot be segmented. :return: CAN packets that are an outcome of UDS message segmentation. .. py:method:: is_desegmented_message(packets) Check whether provided packets are full sequence of packets that form exactly one diagnostic message. :param packets: Packets sequence to check. :raise ValueError: Provided value is not CAN packets sequence. :raise NotImplementedError: There is missing implementation for the provided initial packet type. :return: 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. .. py:method:: get_flow_control_packet(flow_status, block_size = None, st_min = None) Create Flow Control CAN packet. :param flow_status: Value of Flow Status parameter. :param block_size: Value of Block Size parameter. This parameter is only required with ContinueToSend Flow Status, leave None otherwise. :param st_min: Value of Separation Time minimum (STmin) parameter. This parameter is only required with ContinueToSend Flow Status, leave None otherwise. :return: Flow Control CAN packet with provided parameters. .. py:method:: desegmentation(packets) Perform desegmentation of CAN packets. :param packets: CAN packets to desegment into UDS message. :raise SegmentationError: Provided packets are not a complete packets sequence that form a diagnostic message. :raise NotImplementedError: There is missing implementation for the provided CAN Packets type. :return: A diagnostic message that is an outcome of CAN packets desegmentation. .. py:method:: segmentation(message) Perform segmentation of a diagnostic message. :param message: UDS message to divide into packets. :raise TypeError: Provided value is not instance of UdsMessage class. :raise NotImplementedError: There is missing implementation for the Addressing Type used by the provided message. :return: CAN packets that are an outcome of UDS message segmentation.