space_packet_parser.xtce.definitions ==================================== .. py:module:: space_packet_parser.xtce.definitions .. autoapi-nested-parse:: Module for parsing XTCE xml files to specify packet format Attributes ---------- .. autoapisummary:: space_packet_parser.xtce.definitions.logger space_packet_parser.xtce.definitions.DEFAULT_ROOT_CONTAINER space_packet_parser.xtce.definitions.TAG_NAME_TO_PARAMETER_TYPE_OBJECT Classes ------- .. autoapisummary:: space_packet_parser.xtce.definitions.XtcePacketDefinition Module Contents --------------- .. py:data:: logger .. py:data:: DEFAULT_ROOT_CONTAINER :value: 'CCSDSPacket' .. py:data:: TAG_NAME_TO_PARAMETER_TYPE_OBJECT :type: dict[str, type[space_packet_parser.xtce.parameter_types.ParameterType]] .. py:class:: XtcePacketDefinition(container_set: collections.abc.Iterable[space_packet_parser.xtce.containers.SequenceContainer] | None = None, *, ns: dict = STANDARD_XTCE_NSMAP, xtce_ns_prefix: str = STANDARD_XTCE_NS_PREFIX, root_container_name: str = DEFAULT_ROOT_CONTAINER, space_system_name: str | None = None, validation_status: str = 'Unknown', xtce_version: str = '1.0', date: str | None = None) Bases: :py:obj:`space_packet_parser.common.AttrComparable` Object representation of the XTCE definition of a CCSDS packet object .. py:attribute:: parameter_types :type: dict[str, space_packet_parser.xtce.parameter_types.ParameterType] .. py:attribute:: parameters :type: dict[str, space_packet_parser.xtce.parameters.Parameter] .. py:attribute:: containers :type: dict[str, space_packet_parser.xtce.containers.SequenceContainer] .. py:attribute:: ns .. py:attribute:: xtce_ns_uri :value: 'https://www.omg.org/spec/XTCE/20180204' .. py:attribute:: xtce_ns_prefix :value: 'xtce' .. py:attribute:: root_container_name :value: 'CCSDSPacket' .. py:attribute:: space_system_name :value: None .. py:attribute:: validation_status :value: 'Unknown' .. py:attribute:: xtce_version :value: '1.0' .. py:attribute:: date :value: None .. py:method:: write_xml(filepath: str | pathlib.Path) -> None Write out the XTCE XML for this packet definition object to the specified path :param filepath: Location to write this packet definition :type filepath: Union[str, Path] .. py:method:: to_xml_tree() -> lxml.etree.ElementTree Initializes and returns an ElementTree object based on parameter type, parameter, and container information :rtype: ElementTree.ElementTree .. py:method:: from_xtce(xtce_document: str | pathlib.Path | os.PathLike | TextIO, *, root_container_name: str = DEFAULT_ROOT_CONTAINER) -> XtcePacketDefinition :classmethod: .. py:method:: _parse_container_set(tree: lxml.etree.Element, parameter_lookup: dict[str, space_packet_parser.xtce.parameters.Parameter]) -> dict[str, space_packet_parser.xtce.containers.SequenceContainer] :staticmethod: Parse the element into a dictionary of SequenceContainer objects :param tree: Full XTCE tree :type tree: ElementTree.Element :param parameter_lookup: Parameters that are contained in container entry lists :type parameter_lookup: dict[str, parameters.Parameter] :rtype: dict[str, containers.SequenceContainer] .. py:method:: _parse_parameter_type_set(tree: lxml.etree.ElementTree) -> dict[str, space_packet_parser.xtce.parameter_types.ParameterType] :staticmethod: Parse the into a dictionary of ParameterType objects :param tree: Full XTCE tree :type tree: ElementTree.ElementTree :rtype: dict[str, parameters.ParameterType] .. py:method:: _parse_parameter_set(tree: lxml.etree.ElementTree, parameter_type_lookup: dict[str, space_packet_parser.xtce.parameter_types.ParameterType]) -> dict[str, space_packet_parser.xtce.parameters.Parameter] :staticmethod: Parse an object into a dictionary of Parameter objects :param tree: Full XTCE tree :type tree: ElementTree.ElementTree :param parameter_type_lookup: Parameter types referenced by parameters. :type parameter_type_lookup: dict[str, parameter_types.ParameterType] :rtype: dict[str, parameters.Parameter] .. py:method:: parse_bytes(binary_data: bytes, *, root_container_name: str | None = None) -> space_packet_parser.SpacePacket Parse binary packet data according to the self.packet_definition object :param binary_data: Binary representation of the packet used to get the coming bits and any previously parsed data items to infer field lengths. :type binary_data: bytes :param root_container_name: Default is taken from the XtcePacketDefinition object. Any root container may be specified, but it must begin with the definition of a CCSDS header in order to parse correctly. :type root_container_name: Optional[str] :returns: A SpacePacket object containing header and data attributes. :rtype: SpacePacket .. py:method:: parse_packet(packet: space_packet_parser.SpacePacket, *, root_container_name: str | None = None) -> space_packet_parser.SpacePacket Parse binary packet data according to the self.packet_definition object :param packet: Binary representation of the packet used to get the coming bits and any previously parsed data items to infer field lengths. :type packet: space_packet_parser.SpacePacket :param root_container_name: Default is taken from the XtcePacketDefinition object. Any root container may be specified, but it must begin with the definition of a CCSDS header in order to parse correctly. :type root_container_name: Optional[str] :returns: A SpacePacket object containing header and data attributes. :rtype: SpacePacket .. py:method:: parse_ccsds_packet(packet: space_packet_parser.SpacePacket, *, root_container_name: str | None = None) -> space_packet_parser.SpacePacket Parse binary packet data according to the self.packet_definition object :param packet: Binary representation of the packet used to get the coming bits and any previously parsed data items to infer field lengths. :type packet: space_packet_parser.SpacePacket :param root_container_name: Default is taken from the XtcePacketDefinition object. Any root container may be specified, but it must begin with the definition of a CCSDS header in order to parse correctly. :type root_container_name: Optional[str] :returns: A SpacePacket object containing header and data attributes. :rtype: SpacePacket