space_packet_parser.xtce.definitions
Module for parsing XTCE xml files to specify packet format
Attributes
Classes
Object representation of the XTCE definition of a CCSDS packet object |
Module Contents
- space_packet_parser.xtce.definitions.logger
- space_packet_parser.xtce.definitions.DEFAULT_ROOT_CONTAINER = 'CCSDSPacket'
- space_packet_parser.xtce.definitions.TAG_NAME_TO_PARAMETER_TYPE_OBJECT: dict[str, type[space_packet_parser.xtce.parameter_types.ParameterType]]
- class space_packet_parser.xtce.definitions.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:
space_packet_parser.common.AttrComparableObject representation of the XTCE definition of a CCSDS packet object
- parameter_types: dict[str, space_packet_parser.xtce.parameter_types.ParameterType]
- parameters: dict[str, space_packet_parser.xtce.parameters.Parameter]
- containers: dict[str, space_packet_parser.xtce.containers.SequenceContainer]
- ns
- xtce_ns_uri = 'https://www.omg.org/spec/XTCE/20180204'
- xtce_ns_prefix = 'xtce'
- root_container_name = 'CCSDSPacket'
- space_system_name = None
- validation_status = 'Unknown'
- xtce_version = '1.0'
- date = None
- write_xml(filepath: str | pathlib.Path) None
Write out the XTCE XML for this packet definition object to the specified path
- Parameters:
filepath (Union[str, Path]) – Location to write this packet definition
- to_xml_tree() lxml.etree.ElementTree
Initializes and returns an ElementTree object based on parameter type, parameter, and container information
- Return type:
ElementTree.ElementTree
- classmethod from_xtce(xtce_document: str | pathlib.Path | os.PathLike | TextIO, *, root_container_name: str = DEFAULT_ROOT_CONTAINER) XtcePacketDefinition
- static _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]
Parse the <xtce:ContainerSet> element into a dictionary of SequenceContainer objects
- Parameters:
tree (ElementTree.Element) – Full XTCE tree
parameter_lookup (dict[str, parameters.Parameter]) – Parameters that are contained in container entry lists
- Return type:
- static _parse_parameter_type_set(tree: lxml.etree.ElementTree) dict[str, space_packet_parser.xtce.parameter_types.ParameterType]
Parse the <xtce:ParameterTypeSet> into a dictionary of ParameterType objects
- static _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]
Parse an <xtce:ParameterSet> object into a dictionary of Parameter objects
- Parameters:
tree (ElementTree.ElementTree) – Full XTCE tree
parameter_type_lookup (dict[str, parameter_types.ParameterType]) – Parameter types referenced by parameters.
- Return type:
- 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
- Parameters:
binary_data (bytes) – Binary representation of the packet used to get the coming bits and any previously parsed data items to infer field lengths.
root_container_name (Optional[str]) – 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.
- Returns:
A SpacePacket object containing header and data attributes.
- Return type:
- 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
- Parameters:
packet (space_packet_parser.SpacePacket) – Binary representation of the packet used to get the coming bits and any previously parsed data items to infer field lengths.
root_container_name (Optional[str]) – 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.
- Returns:
A SpacePacket object containing header and data attributes.
- Return type:
- 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
- Parameters:
packet (space_packet_parser.SpacePacket) – Binary representation of the packet used to get the coming bits and any previously parsed data items to infer field lengths.
root_container_name (Optional[str]) – 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.
- Returns:
A SpacePacket object containing header and data attributes.
- Return type: