uds.segmentation.can_segmenter ============================== .. py:module:: uds.segmentation.can_segmenter .. autoapi-nested-parse:: Segmentation specific for CAN bus. Classes ------- .. autoapisummary:: uds.segmentation.can_segmenter.CanSegmenter Module Contents --------------- .. py:class:: CanSegmenter(*, addressing_information, dlc = CanDlcHandler.MIN_BASE_UDS_DLC, use_data_optimization = False, filler_byte = DEFAULT_FILLER_BYTE) Bases: :py:obj:`uds.segmentation.abstract_segmenter.AbstractSegmenter` .. autoapi-inheritance-diagram:: uds.segmentation.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 CAN node. :param dlc: Base CAN DLC value to use for creating CAN Packets. :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:property:: addressing_information :type: uds.can.AbstractCanAddressingInformation Addressing Information configuration of a CAN node. .. 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:: 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_packet_class :type: Type[uds.packet.AbstractUdsPacket] Class of UDS Packet supported by CAN segmenter. .. py:property:: supported_packet_record_class :type: Type[uds.packet.AbstractUdsPacketRecord] Class of UDS Packet Record supported by CAN segmenter. .. py:property:: addressing_format :type: uds.can.CanAddressingFormat CAN Addressing format used. .. py:property:: rx_packets_physical_ai :type: uds.can.PacketAIParamsAlias Addressing Information parameters of incoming physically addressed CAN packets. .. py:property:: tx_packets_physical_ai :type: uds.can.PacketAIParamsAlias Addressing Information parameters of outgoing physically addressed CAN packets. .. py:property:: rx_packets_functional_ai :type: uds.can.PacketAIParamsAlias Addressing Information parameters of incoming functionally addressed CAN packets. .. py:property:: tx_packets_functional_ai :type: uds.can.PacketAIParamsAlias Addressing Information parameters of outgoing functionally addressed CAN packets. .. py:method:: __physical_segmentation(message) Segment physically addressed diagnostic message. :param message: UDS message to divide into UDS 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 UDS packets. :raise SegmentationError: Provided diagnostic message cannot be segmented. :return: CAN packets that are an outcome of UDS message segmentation. .. py:method:: is_input_packet(can_id, data) Check if provided frame attributes belong to a UDS CAN packet which is an input for this CAN Segmenter. :param can_id: Identifier of CAN frame to check. :param data: Data field of CAN frame to check. :return: Addressing Type used for transmission of this UDS CAN packet according to the configuration of this CAN Segmenter (if provided attributes belongs to an input UDS CAN packet), otherwise None. .. 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. Please create an issue in our `Issues Tracking System `_ with detailed description if you face this error. :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. Please create an issue in our `Issues Tracking System `_ with detailed description if you face this error. :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 UDS packets. :raise TypeError: Provided value is not instance of UdsMessage class. :raise NotImplementedError: There is missing implementation for the Addressing Type used by provided message. Please create an issue in our `Issues Tracking System `_ with detailed description if you face this error. :return: CAN packets that are an outcome of UDS message segmentation.