uds.can.packet.can_packet ========================= .. py:module:: uds.can.packet.can_packet .. autoapi-nested-parse:: Implementation of CAN Packet. Classes ------- .. autoapisummary:: uds.can.packet.can_packet.CanPacket Module Contents --------------- .. py:class:: CanPacket(*, addressing_format, packet_type, addressing_type, can_id = None, target_address = None, source_address = None, address_extension = None, dlc = None, **packet_type_specific_kwargs) Bases: :py:obj:`uds.can.packet.abstract_container.AbstractCanPacketContainer`, :py:obj:`uds.packet.AbstractPacket` .. autoapi-inheritance-diagram:: uds.can.packet.can_packet.CanPacket :parts: 1 :private-bases: Definition of a CAN Packet. Objects of this class act as a storage for all relevant attributes of a :ref:`CAN packet `. Later on, such object might be transmitted. Once a packet is transmitted, its historic data would be stored in :class:`~uds.can.packet.can_packet_record.CanPacketRecord`. Create a storage for a single CAN packet. :param addressing_format: CAN Addressing Format used. :param packet_type: Type of this CAN packet. :param addressing_type: Addressing type for which this CAN packet is relevant. :param can_id: CAN Identifier value that is used by this packet. You do not have to provide it if other arguments unambiguously determine CAN ID value. :param target_address: Target Address value carried by this CAN Packet. Leave None if provided `addressing_format` does not use Target Address parameter. You do not have to provide it if `can_id` parameter unambiguously determine TARGET ADDRESS value. :param source_address: Source Address value carried by this CAN packet. Leave None if provided `addressing_format` does not use Source Address parameter. You do not have to provide it if `can_id` parameter unambiguously determine SOURCE ADDRESS value. :param address_extension: Address Extension value carried by this CAN packet. Leave None if provided `addressing_format` does not use Address Extension parameter. :param dlc: DLC value of a CAN frame that carries this CAN Packet. - None - use CAN Data Frame Optimization (CAN ID value will be automatically determined) - int type value - DLC value to set. CAN Data Padding will be used to fill unused data bytes. .. warning:: You have to provide DLC value for packets of First Frame type. :param packet_type_specific_kwargs: Arguments that are specific for provided CAN Packet Type. - :parameter filler_byte: (optional for: SF, CF and FC) Filler Byte value to use for CAN Frame Data Padding. - :parameter payload: (required for: SF, FF and CF) Payload of a diagnostic message that is carried by this CAN packet. - :parameter data_length: (required for: FF) Number of payload bytes of a diagnostic message initiated by this First Frame packet. - :parameter sequence_number: (required for: CF) Sequence number value of this Consecutive Frame. - :parameter flow_status: (required for: FC) Flow status information carried by this Flow Control frame. - :parameter block_size: (required for: FC with ContinueToSend Flow Status) Block size information carried by this Flow Control frame. - :parameter st_min: (required for: FC with ContinueToSend Flow Status) Separation Time minimum information carried by this Flow Control frame. .. py:attribute:: __raw_frame_data :type: bytes :value: b'' .. py:property:: addressing_format :type: uds.can.addressing.CanAddressingFormat CAN Addressing Format used by this CAN packet. .. py:method:: __str__() Present object in string format. .. py:property:: can_id :type: int CAN Identifier (CAN ID) of a CAN Frame that carries this CAN packet. .. py:property:: raw_frame_data :type: bytes Raw data bytes of a CAN frame that carries this CAN packet. .. py:property:: addressing_type :type: uds.addressing.AddressingType Addressing type for which this CAN packet is relevant. .. py:method:: set_addressing_information(*, addressing_type, can_id = None, target_address = None, source_address = None, address_extension = None) Change addressing information for this CAN packet. This function enables to change an entire :ref:`Network Address Information `. :param addressing_type: Addressing type for which this CAN packet is relevant. :param can_id: CAN Identifier value that is used by this packet. You do not have to provide it if other arguments unambiguously determine CAN ID value. :param target_address: Target Address value carried by this CAN Packet. Leave None if provided `addressing_format` does not use Target Address parameter. You do not have to provide it if `can_id` parameter unambiguously determine TARGET ADDRESS value. :param source_address: Source Address value carried by this CAN packet. Leave None if provided `addressing_format` does not use Source Address parameter. You do not have to provide it if `can_id` parameter unambiguously determine SOURCE ADDRESS value. :param address_extension: Address Extension value carried by this CAN packet. Leave None if provided `addressing_format` does not use Address Extension parameter. .. py:method:: set_packet_data(*, packet_type, dlc = None, **packet_type_specific_kwargs) Change packet type and data field of this CAN packet. This function enables to change an entire :ref:`Network Data Field ` and :ref:`Network Protocol Control Information ` for a :ref:`CAN packet `. :param packet_type: Type of this CAN packet. :param dlc: DLC value of a CAN frame that carries this CAN Packet. - None - use CAN Data Frame Optimization (CAN ID value will be automatically determined) - int type value - DLC value to set. CAN Data Padding will be used to fill unused data bytes. .. warning:: You have to provide DLC value for packets of First Frame type. :param packet_type_specific_kwargs: Arguments that are specific for provided CAN Packet Type. - :parameter filler_byte: (optional for: SF, CF and FC) Filler Byte value to use for CAN Frame Data Padding. - :parameter payload: (required for: SF, FF and CF) Payload of a diagnostic message that is carried by this CAN packet. - :parameter data_length: (required for: FF) Number of payload bytes of a diagnostic message initiated by this First Frame packet. - :parameter sequence_number: (required for: CF) Sequence number value of this Consecutive Frame. - :parameter flow_status: (required for: FC) Flow status information carried by this Flow Control frame. - :parameter block_size: (required for: FC with ContinueToSend Flow Status) Block size information carried by this Flow Control frame. - :parameter st_min: (required for: FC with ContinueToSend Flow Status) Separation Time minimum information carried by this Flow Control frame. :raise NotImplementedError: There is missing implementation for the provided CAN Packet Type.