|
Telescience Resource Kit
TReK Python
5.4.0 ART
|
This class describes a packet composed of one or more parameters. More...
Inherits PacketItem.
Public Member Functions | |
Initialize / Finalize | |
Functions handling class initialization and finalization. | |
def | Packet ( Optional[Packet] packet=None -> None ) -> def |
Class initializer. More... | |
def | clone ( -> Packet ) -> def |
Creates a new instance of the object with the same contents. | |
def | copy (copy_from: object -> None ) -> def |
Copies the contents of the provided 'copy_from' Packet. More... | |
def | initialize ( -> None ) -> def |
Initializes the object. More... | |
def | load_file (filename: str -> None ) -> def |
Loads the Packet definition from the specified file. More... | |
def | save_file (filename: str -> None ) -> def |
Saves the Packet definition to the specified file. More... | |
def | get_packet_type ( -> str ) -> def |
Gets the packet type. More... | |
def | set_packet_type (new_type: str -> None ) -> def |
Sets the packet type. More... | |
Build/Extract | |
def | build (buffer: bytearray -> int ) -> def |
Builds the packet and places it in the provided buffer. More... | |
def | extract (buffer: bytearray, input_length: int -> int ) -> def |
Extracts all of the parameters in the packet from the specified buffer. More... | |
Parameters | |
Functions handling parameters. | |
def | add_identifier (name: str, id_info: IdentifierInfo -> None ) -> def |
Adds an identifier to the packet. More... | |
def | clear_all_parameter_values ( -> None ) -> def |
Clears each parameter value in the packet. More... | |
def | clear_checksum_parameter ( -> None ) -> def |
Turns off checksum parameter calculation when calling build(). | |
def | clear_counter_parameter ( -> None ) -> def |
Turns off counter generation when calling build(). | |
def | clear_length_parameter ( -> None ) -> def |
Turns off length calculation when calling build(). | |
def | clear_sequence_flags_parameter ( -> None ) -> def |
Removes the seqeuence flags parameter reference from the packet. | |
def | clear_timestamp_parameter ( -> None ) -> def |
Turns off time stamp generation when calling build(). | |
def | find_last_parameter (name: str -> Parameter ) -> def |
Finds the specified parameter name in the packet. More... | |
def | find_parameter (name: str -> Parameter ) -> def |
Finds the specified parameter name in the packet. More... | |
def | get_checksum_parameter ( -> str ) -> def |
Returns the name of the parameter that is used for the checksum of the packet. More... | |
def | get_checksum_parameter_info ( -> ChecksumParameterInfo ) -> def |
Gets the checksum parameter's attributes. More... | |
def | get_counter_parameter ( -> str ) -> def |
Returns the name of the parameter that is used for the counter of the packet. More... | |
def | get_counter_parameter_info ( -> CounterParameterInfo ) -> def |
Gets the counter parameter's associated attributes. More... | |
def | get_fully_qualified_names (name: str -> list[str] ) -> def |
Gets all of the fully qualified names for a given parameter name within a packet. More... | |
def | get_identifier_info (name: str -> IdentifierInfo ) -> def |
Retrieves the attributes associated with the named identifier. More... | |
def | get_identifier_list (recursive: bool=True -> list[str] ) -> def |
Gets a list of the parameter names used as identifiers. More... | |
def | get_length_parameter ( -> str ) -> def |
Returns the name of the parameter that is used for the length of the packet. More... | |
def | get_length_parameter_info ( -> LengthParameterInfo ) -> def |
Gets the length parameter's attributes. More... | |
def | get_parameter_list (full_name: bool=True, mod_only: bool=False -> list[str] ) -> def |
Returns a list of all parameters within the packet. More... | |
def | get_polynomial_info ( -> Optional[ChecksumPolynomialInfo] ) -> def |
Gets CRC32 Generic information. More... | |
def | get_sequence_flags_parameter ( -> str ) -> def |
Returns the name of the parameter that is used for the sequence flags of the packet. More... | |
def | get_sequence_flags_parameter_info ( -> SequenceFlagParameterInfo ) -> def |
Gets the sequence flags parameter's attributes. More... | |
def | get_sorted_parameter_list (full_name: bool=True, mod_only: bool=False -> list[str] ) -> def |
Returns a sorted list of all parameters within a collection by their start location. More... | |
def | get_timestamp_parameter ( -> str ) -> def |
Returns the name of the parameter that is used for the time stamp of the packet. More... | |
def | get_timestamp_parameter_info ( -> TimeStampParameterInfo ) -> def |
Gets the time stamp parameter's attributes. More... | |
def | update_expected_value (name: str, new_value: int -> None ) -> def |
Updates the expected value for an identifier. More... | |
def | set_checksum_parameter (param_name: str, param_info: ChecksumParameterInfo, Optional[ChecksumPolynomialInfo] poly_info=None -> None ) -> def |
Sets the checksum parameter for the packet. More... | |
def | set_counter_parameter (param_name: str, param_info: CounterParameterInfo -> def ) -> def |
Sets the counter parameter for the packet. More... | |
def | set_modifiable_flag_for_all_parameters (new_value: bool -> None ) -> def |
Sets the modifiable flag for all parameters currently in the packet. More... | |
def | set_length_parameter (param_name: str, param_info: LengthParameterInfo -> None ) -> def |
Sets the length parameter for the packet. More... | |
def | set_sequence_flags_parameter (param_name: str, param_info: SequenceFlagParameterInfo -> None ) -> def |
Sets the sequence flags parameter for the packet. More... | |
def | set_timestamp_parameter (param_name: str, param_info: TimeStampParameterInfo -> None ) -> def |
Sets the time stamp parameter for the packet. More... | |
Packet Collection | |
Functions handling adding / removing packets. | |
def | add_data (packet_item: PacketItem -> None ) -> def |
Sets the specified packet item as the data for the packet. More... | |
def | add_header (packet_item: PacketItem -> None ) -> def |
Sets the specified packet item as the header for the packet. More... | |
def | add_trailer (packet_item: PacketItem -> None ) -> def |
Sets the specified packet item as the trailer for the packet. More... | |
def | clear_global_packet_map ( -> None ) -> def |
Removes all parameters from the global packet map. More... | |
def | create_global_packet_map ( -> None ) -> def |
Creates the map used to hold all of the parameters. More... | |
def | get_header_length_in_bits ( -> int ) -> def |
Gets the length of the header in bits. More... | |
def | get_header_length_in_bytes ( -> int ) -> def |
Gets the length of the header in bytes. More... | |
def | get_length_in_bits ( -> int ) -> def |
Gets the length of the packet in bits. More... | |
def | get_length_in_bytes ( -> int ) -> def |
Gets the length of the packet in bytes. More... | |
def | get_maximum_length_in_bits ( -> int ) -> def |
Returns the maximum length of the Packet in bits. More... | |
def | get_validation_errors ( -> str ) -> def |
Gets a string of the last validation errors. More... | |
def | has_checksum_error ( -> bool ) -> def |
Determines if the last packet extraction had a checksum error. More... | |
def | has_data_zone ( -> bool ) -> def |
Determines if the packet has a data zone. More... | |
def | has_header_zone ( -> bool ) -> def |
Determines if the packet has a header zone. More... | |
def | has_length_error ( -> bool ) -> def |
Determines if the last packet extraction had a length error. More... | |
def | has_modifiable_data (data_zone_only: bool=True -> bool ) -> def |
Determines if the packet has any modifiable data. More... | |
def | has_trailer_zone ( -> bool ) -> def |
Determines if the packet has a trailer zone. More... | |
def | has_variable_length_data ( -> bool ) -> def |
Determines if the parameter collection has any variable length data. More... | |
def | is_complete ( -> bool ) -> def |
Determines if the packet definition is considered complete. More... | |
def | is_modifiable (top_level: bool=True -> bool ) -> def |
Determines if any of the data is modifiable. More... | |
def | remove_all_identifiers ( -> None ) -> def |
Removes all identifiers from the packet. More... | |
def | remove_identifier (name: str -> None ) -> def |
Removes the specified parameter as an identifier. More... | |
def | remove_trailer ( -> None ) -> def |
Removes the trailer zone from the packet. More... | |
def | remove_data ( -> None ) -> def |
Removes the data zone from the packet. More... | |
def | remove_header ( -> None ) -> def |
Removes the header zone from the packet. More... | |
def | set_timestamp_offset (offset: float -> None ) -> def |
Sets an offset for the current system time to use when building packets. More... | |
def | validate ( -> int ) -> def |
Validates that the data contained in the packet is logically correct. More... | |
Printing | |
Functions handling printing. | |
def | print_definition (include_value: bool=False -> str ) -> def |
Returns a string with basic information about all parameters in the packet. More... | |
def | print_packet (buffer: bytearray -> str ) -> def |
This method is used to print all of the headers in the packet and a hexidecimal representation of the packet contents. More... | |
def | print_values ( -> str ) -> def |
Returns a string with the value of all parameters in the packet. | |
Parameters | |
Functions handling Parameters. | |
Packet | |
Functions handling Packets. | |
![]() | |
def | remove_all_attributes ( -> None ) -> def |
Removes all attributes. | |
def | remove_attribute (name: str -> None ) -> def |
Removes the attribute by name. More... | |
def | __eq__ (named_item: object -> bool ) -> def |
Equality operator "==". More... | |
def | add_attribute (name: str, value: str -> None ) -> def |
Adds an attribute to the item. More... | |
def | get_alias ( -> str ) -> def |
Returns the alias of the item. More... | |
def | get_attribute (name: str -> str ) -> def |
Get the value of the specified attribute. More... | |
def | get_attribute_list ( -> list[str] ) -> def |
Gets a list of the attribute names. More... | |
def | get_name ( -> str ) -> def |
Returns the name of the item. More... | |
def | get_long_description ( -> str ) -> def |
Returns the long description of the item. More... | |
def | get_short_description ( -> str ) -> def |
Returns the short description of the item. More... | |
def | get_user_description ( -> str ) -> def |
Returns the user description of the item. More... | |
def | get_owner ( -> str ) -> def |
Returns the owner of the item. More... | |
def | get_path ( -> str ) -> def |
Returns the path for the item. More... | |
def | set_name (name: str -> None ) -> def |
Sets the name of the item. More... | |
def | set_alias (alias: str -> None ) -> def |
Sets the alias of the item. More... | |
def | set_short_description (description: str -> None ) -> def |
Sets the short description of the item. More... | |
def | set_long_description (description: str -> None ) -> def |
Sets the long description of the item. More... | |
def | set_user_description (description: str -> None ) -> def |
Sets the user description of the item. More... | |
def | set_owner (owner: str -> None ) -> def |
Sets the owner of the item. More... | |
def | set_path (path: str -> None ) -> def |
Sets the path of the item. More... | |
This class describes a packet composed of one or more parameters.
The Packet class encapsulates one or more parameters that can be built or extracted. The Packet class has three zones: header, data, and trailer. For the Packet to be considered valid, at least one zone must be populated. Each zone can be populated with a ParameterCollection or another Packet. The example below shows a packet that has all three zones populated. The Header and Trailer zones consist of a parameter collection and the Data zone consists of another Packet which only has two zones populated (Header and Data).
( | packet | : Optional[Packet] | ) | -> None |
( | packet_item | : PacketItem | ) | -> None |
Sets the specified packet item as the data for the packet.
A copy of the input is made. Any changes made to the input after being added will not be part of the packet unless the data is removed using remove_data() and the changes are added again. The global packet map is cleared as part of this method.
[in] | packet_item | The Packet or ParameterCollection to use as the data. |
TrekError | 15028 - TREK_DATA_ZONE_ALREADY_EXISTS |
( | packet_item | : PacketItem | ) | -> None |
Sets the specified packet item as the header for the packet.
A copy of the input is made. Any changes made to the input after being added will not be part of the packet unless the header is removed using remove_header() and the changes are added again. The global packet map is cleared as part of this method.
[in] | packet_item | The Packet or ParameterCollection to use as the header. |
TrekError | 15028 - TREK_DATA_ZONE_ALREADY_EXISTS |
( | name | : str | |
id_info | : IdentifierInfo | ||
) | -> None |
Adds an identifier to the packet.
The identifiers are set by build() and will override any data set by a user.
[in] | name | The name of the parameter to use as the identifier. |
[in] | id_info | Identifier attributes. |
TrekError | 15005 - TREK_DATA_ALREADY_EXISTS, 15007 - TREK_DATA_DOES_NOT_EXIST |
( | packet_item | : PacketItem | ) | -> None |
Sets the specified packet item as the trailer for the packet.
A copy of the input is made. Any changes made to the input after being added will not be part of the trailer unless the header is removed using remove_trailer() and the changes are added again. The global packet map is cleared as part of this method.
[in] | packet_item | The Packet or ParameterCollection to use as the trailer. |
( | buffer | : bytearray | ) | -> int |
Builds the packet and places it in the provided buffer.
The parameters composing the packet are built and placed in the buffer. After building the parameters, the length, time stamp, counter, and checksum parameters are set if specified. Since nesting of packets is allowed (packet within a packet). The innermost packet is built first.
[out] | buffer | Buffer to contain the composed packet. |
TrekError | 15029 - TREK_DATA_ERROR_BUILDING_HEADER_ZONE, 15030 - TREK_DATA_ERROR_BUILDING_DATA_ZONE, 15031 - TREK_DATA_ERROR_BUILDING_TRAILER_ZONE, 15032 - TREK_DATA_NOT_ENOUGH_SPACE, 15034 - TREK_DATA_ERROR_BUILDING_LEN_PARAM, 15049 - TREK_DATA_NEG_LEN_ERROR, 15036 - TREK_DATA_ERROR_BUILDING_COUNTER_PARAM, 15037 - TREK_DATA_ERROR_BUILDING_TIME_PARAM, 15057 - TREK_DATA_ERROR_BUILDING_IDENTIFIER, 15038 - TREK_DATA_ERROR_BUILDING_CHECKSUM_PARAM |
( | ) | -> None |
Clears each parameter value in the packet.
This will prevent the build() from succeeding.
( | ) | -> None |
Removes all parameters from the global packet map.
If parameters are added after CreateGlobalPacketMap is called, this method should be called and the global packet map recreated with another call to create_global_packet_map().
( | copy_from | : object | ) | -> None |
( | ) | -> None |
Creates the map used to hold all of the parameters.
The parameters composing the packet are stored in a map for quick lookup. After all of the data has been added to the packet, this method should be called to build the map.
( | buffer | : bytearray | |
input_length | : int | ||
) | -> int |
Extracts all of the parameters in the packet from the specified buffer.
Loops through all of the parameters contained in the packet and extracts their indiviual values (see Parameter for details on what parameter extraction encompasses). If a checksum parameter is defined, the checksum for the buffer is checked to ensure that the data is not corrupt. If the checksum does not match, the data is still extracted. An error will be returned indicating that there is a checksum error. The ParameterStatus associated with any get_value calls for a Parameter will have the Data Quality Checksum Error set to indicate that the value may be bad.
[in,out] | buffer | The buffer from which to extract. |
[in] | input_length | The valid number of bits that can be read. |
TrekError | 15051 - TREK_DATA_NO_PARENT, 15053 - TREK_DATA_EXT_NUM_SAMP_EXTRACT_FAIL, 15002 - TREK_DATA_EXT_NUM_SAMP_PARAM_NOT_FOUND, 15058 - TREK_DATA_EXT_STATUS_PARAM_NOT_FOUND, 15054 - TREK_DATA_EXT_NUM_SAMP_BAD_VALUE, 15052 - TREK_DATA_EXT_NUM_SAMP_VALUE_FAIL, 15008 - TREK_DATA_INVALID_DATA_TYPE, 15012 - TREK_DATA_INVALID_BYTE_ORDER, 15008 - TREK_DATA_INVALID_DATA_TYPE, 15096 - TREK_DATA_PACKET_LENGTH_ERROR |
( | name | : str | ) | -> Parameter |
Finds the specified parameter name in the packet.
This method will return the last parameter successfully extracted in the packet. If multiple parameters are stored in a packet (e.g., the same parameter exists in multiple formats), this is the method to use to get the current value. It is used by all TReK Telemetry API calls.
[in] | name | The name of the parameter to find. |
TrekError | 15007 - TREK_DATA_DOES_NOT_EXIST |
( | name | : str | ) | -> Parameter |
Finds the specified parameter name in the packet.
Parameters are stored in a map with two names. The short name (the actual name is the Parameter class) and a fully qualified name which includes the packet hierarchy. If two or more parameters have the same name, you must use the fully qualified name to find the packet. Otherwise, either name will work. The fully qualified names for a given parameter an be found in get_fully_qualified_names().
[in] | name | The name of the parameter to find. |
TrekError | 15007 - TREK_DATA_DOES_NOT_EXIST, 15033 - TREK_DATA_MORE_THAN_ONE_PARAMETER |
Reimplemented from PacketItem.
( | ) | -> str |
Returns the name of the parameter that is used for the checksum of the packet.
A blank name indicates that the checksum parameter has not been set. If the returned value is not blank, then the checksum attributes associated with the parameter can be retrieved using get_checksum_parameter_info().
( | ) | -> ChecksumParameterInfo |
Gets the checksum parameter's attributes.
Retrieves the zone (header, data, trailer) where the checksum parameter can be found, the start count for the parameter, the direction of the count, the minimum count value the maximum count value, and its parent's start bit. Details about the counter parameter can be retrieved with find_parameter().
TrekError | 15007 - TREK_DATA_DOES_NOT_EXIST |
( | ) | -> str |
Returns the name of the parameter that is used for the counter of the packet.
A blank name indicates that the counter parameter has not been set. If the returned value is not blank, then the counter attributes associated with the parameter can be retrieved using get_counter_parameter_info().
( | ) | -> CounterParameterInfo |
Gets the counter parameter's associated attributes.
Retrieves the zone (header, data, trailer) where the counter parameter can be found, the start count for the parameter, the direction of the count, the minimum count value the maximum count value, and its parent's start bit. Details about the counter parameter can be retrieved with find_parameter().
( | name | : str | ) | -> list[str] |
Gets all of the fully qualified names for a given parameter name within a packet.
Fully qualified names are required to be used when mulitple parameters exist with the same name within a packet. This is most likely to happen when a common parameter name such as "Length" is used more than once. For example, a packet encapsulating another packet may each have a "Length" parameter. It is suggested that more explicit names be used where possible (e.g., "CCSDSLength").
[in] | name | The name of the parameter. |
( | ) | -> int |
Gets the length of the header in bits.
Calculates the length of the header in bits by determining the last bit used by any parameter in the header. create_global_packet_map() must be called before this method will work.
TrekError | 15056 - TREK_DATA_MISSING_ZONE |
( | ) | -> int |
Gets the length of the header in bytes.
Calculates the length of the header in bits by determining the last bit used by any parameter in the header. create_global_packet_map() must be called before this method will work.
TrekError | 15056 - TREK_DATA_MISSING_ZONE |
( | name | : str | ) | -> IdentifierInfo |
Retrieves the attributes associated with the named identifier.
For the specified identifier the following information is retrieved: the zone (header, data, trailer) where it can be found, the type of identifier, when or not it has a default value, the default value, whether or not it has an expected value, the expected value , and its parent's start bit. Details about the identifier parameter can be retrieved with find_parameter().
[in] | name | The name of the parameter used as the identifier. |
TrekError | 15007 - TREK_DATA_DOES_NOT_EXIST |
( | recursive | : bool | ) | -> list[str] |
Gets a list of the parameter names used as identifiers.
The parameter names returned are identified by their short name. It is possible for the same name to appear multiple times. get_fully_qualified_names() can be used to get the detailed name of the parameter to resolve conflicts. If no identifiers are available.
[in] | recursive | If search includes sub-packets. |
( | ) | -> int |
Gets the length of the packet in bits.
Calculates the length of the packet in bits by determining the last bit used by any parameter in the packet. create_global_packet_map() must be called before this method will work. The packet must have a fixed length or it will fail.
TrekError | 15017 - TREK_DATA_FIXED_LENGTH_REQUIRED |
Reimplemented from PacketItem.
( | ) | -> int |
Gets the length of the packet in bytes.
Calculates the length of the packet in bytes by determining the last byte used by any parameter in the packet. create_global_packet_map() must be called before this method will work. The packet must have a fixed length or it will fail.
TrekError | 15017 - TREK_DATA_FIXED_LENGTH_REQUIRED |
Reimplemented from PacketItem.
( | ) | -> str |
Returns the name of the parameter that is used for the length of the packet.
A blank name indicates that the length parameter has not been set. If the returned value is not blank, then the length attributes associated with the parameter can be retrieved using get_length_parameter_info().
( | ) | -> LengthParameterInfo |
Gets the length parameter's attributes.
Retrieves the zone (header, data, trailer) where it the length parameter can be found, the offset associated with the length, and its parent's start bit. Details about the length parameter can be retrieved with find_parameter().
TrekError | 15007 - TREK_DATA_DOES_NOT_EXIST |
( | ) | -> int |
Returns the maximum length of the Packet in bits.
If the Packet has variable length data, the actual length may be less than the returned value.
Reimplemented from PacketItem.
( | ) | -> str |
Gets the packet type.
( | full_name | : bool | |
mod_only | : bool | ||
) | -> list[str] |
Returns a list of all parameters within the packet.
[in] | full_name | True, indicates to return parameter fully qualified names. |
[in] | mod_only | Indicates if the returned data should be limited to modifiable parameters. |
Reimplemented from PacketItem.
( | ) | -> Optional[ChecksumPolynomialInfo] |
Gets CRC32 Generic information.
Retrieves the CRC32 configuration if checksum type is PacketChecksumType.CT_GENERIC_CRC32.
( | ) | -> str |
Returns the name of the parameter that is used for the sequence flags of the packet.
A blank name indicates that the sequence flags parameter has not been set. If the returned value is not blank, then the sequence flags attributes associated with the parameter can be retrieved using get_sequence_flag_parameter_info().
Gets the sequence flags parameter's attributes.
Retrieves the zone (header, data, trailer) where the sequence flag parameter can be found. Details about the sequence flag parameter can be retrieved with find_parameter().
TrekError | 15007 - TREK_DATA_DOES_NOT_EXIST |
( | full_name | : bool | |
mod_only | : bool | ||
) | -> list[str] |
Returns a sorted list of all parameters within a collection by their start location.
[in] | full_name | True, indicates to return parameter fully qualified names. |
[in] | mod_only | Indicates if the returned data should be limited to modifiable parameters. |
Reimplemented from PacketItem.
( | ) | -> str |
Returns the name of the parameter that is used for the time stamp of the packet.
A blank name indicates that the time stamp parameter has not been set. If the returned value is not blank, then the time stamp attributes associated with the parameter can be retrieved using get_timestamp_parameter_info().
( | ) | -> TimeStampParameterInfo |
Gets the time stamp parameter's attributes.
Retrieves the zone (header, data, trailer) where the time stamp parameter can be found, the offset applied to the time (build only), and its parent's start bit. Details about the time parameter can be retrieved with find_parameter().
TrekError | 15007 - TREK_DATA_DOES_NOT_EXIST |
( | ) | -> str |
Gets a string of the last validation errors.
( | ) | -> bool |
Determines if the last packet extraction had a checksum error.
( | ) | -> bool |
Determines if the packet has a data zone.
( | ) | -> bool |
Determines if the packet has a header zone.
( | ) | -> bool |
Determines if the last packet extraction had a length error.
( | data_zone_only | : bool | ) | -> bool |
Determines if the packet has any modifiable data.
[in] | data_zone_only | If True, limits the search to the data zone. |
Reimplemented from PacketItem.
( | ) | -> bool |
Determines if the packet has a trailer zone.
( | ) | -> bool |
Determines if the parameter collection has any variable length data.
Reimplemented from PacketItem.
( | ) | -> None |
( | ) | -> bool |
Determines if the packet definition is considered complete.
Reimplemented from PacketItem.
( | top_level | : bool | ) | -> bool |
Determines if any of the data is modifiable.
Packets are considered modifiable if the data zone contains any modifiable data. If the data zone contains nested packets, any parameter in that packet can make the top level packet modifiable.
[in] | top_level | Designates this packet as top level. Default is true. |
Reimplemented from PacketItem.
( | filename | : str | ) | -> None |
Loads the Packet definition from the specified file.
Reads an XML format for the Packet. It can be written in with save_file().
[in] | filename | The file from which to load the parameter object. |
( | include_value | : bool | ) | -> str |
Returns a string with basic information about all parameters in the packet.
The returned string contains the short name, fully qualified name, start bit, data type, length, and (optionally) value for each parameter in the packet. The parameters are returned based on the order of the start bit. Only the first sample of a parameter's value is shown.
[in] | include_value | If value should be included. |
( | buffer | : bytearray | ) | -> str |
This method is used to print all of the headers in the packet and a hexidecimal representation of the packet contents.
This is the method used by the Data GUI to view packets.
[in] | buffer | The packet to print. |
( | ) | -> None |
Removes all identifiers from the packet.
The parameters corresponding to the identifiers are not removed.
( | ) | -> None |
Removes the data zone from the packet.
Deletes the current data, if any, from the packet. add_data() can be used to add a new data. The global packet map is cleared as part of this method.
( | ) | -> None |
Removes the header zone from the packet.
Deletes the current header, if any, from the packet. add_header() can be used to add a new header. The global packet map is cleared as part of this method.
( | name | : str | ) | -> None |
Removes the specified parameter as an identifier.
The specified parameter is removed as an identifier for this packet. The parameter corresponding to the name is not removed.
[in] | name | The name of the parameter to be removed as an identifier. |
TrekError | 15007 - TREK_DATA_DOES_NOT_EXIST |
( | ) | -> None |
Removes the trailer zone from the packet.
Deletes the current trailer, if any, from the packet. add_trailer() can be used to add a new trailer. The global packet map is cleared as part of this method.
( | filename | : str | ) | -> None |
Saves the Packet definition to the specified file.
Writes an XML format for the Packet. It can be read in with load_file().
[in] | filename | The file to save the packet object. |
( | param_name | : str | |
param_info | : ChecksumParameterInfo | ||
poly_info | : Optional[ChecksumPolynomialInfo] | ||
) | -> None |
Sets the checksum parameter for the packet.
The checksum parameter is used when calling Build to calculate a checksum for the packet as it is built. If the checksum parameter is no longer needed call the clear_checksum_parameter() method. The table below shows the data type that is required for each checksum type.
[in] | param_name | The name of the parameter used for checksum. |
[in] | param_info | Checksum parameter attributes. |
[in] | poly_info | The Polynomial CRC32 information for type PacketChecksumType.CT_GENERIC_CRC32 (optional). |
TrekError | 15007 - TREK_DATA_DOES_NOT_EXIST, 15008 - TREK_DATA_INVALID_DATA_TYPE, 15101 - TREK_DATA_NOT_IN_ZONE |
( | param_name | : str | |
param_info | : CounterParameterInfo | ||
) | -> def |
Sets the counter parameter for the packet.
The counter parameter is used when calling build() to set a counter for the packet as it is built. If the counter parameter is no longer needed call the clear_counter_parameter() method. If min_count and max_count are both set to 0 (default), the counter will use the full size of the counter based on its length.
[in] | param_name | The name of the parameter used for the counter. |
[in] | param_info | Counter parameter attributes. |
TrekError | 15007 - TREK_DATA_DOES_NOT_EXIST, 15065 - TREK_DATA_INVALID_LENGTH |
( | param_name | : str | |
param_info | : LengthParameterInfo | ||
) | -> None |
Sets the length parameter for the packet.
The length parameter is used when calling build() to calculate the length of the packet as it is built. This is necessary for variable length packets, but can be omitted for fixed length packets if desired. If the length parameter is no longer needed call the clear_length_parameter() method.
[in] | param_name | The name of the parameter used for length. |
[in] | param_info | Length parameter attributes. |
TrekError | 15007 - TREK_DATA_DOES_NOT_EXIST |
( | new_value | : bool | ) | -> None |
Sets the modifiable flag for all parameters currently in the packet.
[in] | new_value | The new flag. |
( | new_type | : str | ) | -> None |
Sets the packet type.
Only used in creating new templates.
[in] | new_type | The new type name. |
( | param_name | : str | |
param_info | : SequenceFlagParameterInfo | ||
) | -> None |
Sets the sequence flags parameter for the packet.
The sequence flags parameter is only used to specify if CCSDS packet segmentation is supported for the packet. If the sequence flag parameter is no longer needed call the clear_sequence_flag_parameter() method.
[in] | param_name | The name of the parameter used for sequence flag. |
[in] | param_info | Sequence flag parameter attributes. |
TrekError | 15007 - TREK_DATA_DOES_NOT_EXIST |
( | offset | : float | ) | -> None |
Sets an offset for the current system time to use when building packets.
The offset can be used to simulate time for periods other than the current time. This value is only used for build(). The offset is not applied when extracting the data.
[in] | offset | The offset in seconds. |
( | param_name | : str | |
param_info | : TimeStampParameterInfo | ||
) | -> None |
Sets the time stamp parameter for the packet.
The time stamp parameter is used when calling Build to set the current time for the packet as it is built. If the time stamp parameter is no longer needed call the clear_timestamp_parameter() method.
[in] | param_name | The name of the parameter to be used for time stamp. |
[in] | param_info | The timestamp parameter configuration info. |
TrekError | 15007 - TREK_DATA_DOES_NOT_EXIST |
( | name | : str | |
new_value | : int | ||
) | -> None |
Updates the expected value for an identifier.
[in] | name | The name of the identifier. |
[in] | new_value | The value for the identifier. |
TrekError | 15007 - TREK_DATA_DOES_NOT_EXIST |
( | ) | -> int |
Validates that the data contained in the packet is logically correct.
Checks the data within the packet for errors that could cause the code to crash. Validation is performed as data is populated with information, but it is possbile to bypass some of these checks if the data is read in from a file (load_file()) or data is deleted.