|
TReK Python
5.3.2
Telemetry/Command API
|
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 |
| Class initializer. More... | |
| def | clone () -> Packet |
| Creates a new instance of the object with the same contents. | |
| def | copy (copy_from: object) -> None |
| Copies the contents of the provided 'copy_from' Packet. More... | |
| def | initialize () -> None |
| Initializes the object. More... | |
| def | load_file (filename: str) -> None |
| Loads the Packet definition from the specified file. More... | |
| def | save_file (filename: str) -> None |
| Saves the Packet definition to the specified file. More... | |
Build/Extract | |
| def | build (buffer: bytearray) -> int |
| Builds the packet and places it in the provided buffer. More... | |
| def | extract (buffer: bytearray, input_length: int) -> int |
| Extracts all of the parameters in the packet from the specified buffer. More... | |
Parameters | |
Functions handling parameters. | |
| def | add_identifier (name: str, IdentifierInfo id_info) -> None |
| Adds an identifier to the packet. More... | |
| def | clear_all_parameter_values () -> None |
| Clears each parameter value in the packet. More... | |
| def | clear_checksum_parameter () -> None |
| Turns off checksum parameter calculation when calling build(). | |
| def | clear_counter_parameter () -> None |
| Turns off counter generation when calling build(). | |
| def | clear_length_parameter () -> None |
| Turns off length calculation when calling build(). | |
| def | clear_timestamp_parameter () -> None |
| Turns off time stamp generation when calling build(). | |
| def | find_last_parameter (name: str) -> Parameter |
| Finds the specified parameter name in the packet. More... | |
| def | find_parameter (name: str) -> Parameter |
| Finds the specified parameter name in the packet. More... | |
| def | get_checksum_parameter () -> str |
| Returns the name of the parameter that is used for the checksum of the packet. More... | |
| def | get_checksum_parameter_info () -> ChecksumParameterInfo |
| Gets the checksum parameter's attributes. More... | |
| def | get_counter_parameter () -> str |
| Returns the name of the parameter that is used for the counter of the packet. More... | |
| def | get_counter_parameter_info () -> CounterParameterInfo |
| Gets the counter parameter's associated attributes. More... | |
| def | get_fully_qualified_names (name: str) -> list[str] |
| Gets all of the fully qualified names for a given parameter name within a packet. More... | |
| def | get_identifier_info (name: str) -> IdentifierInfo |
| Retrieves the attributes associated with the named identifier. More... | |
| def | get_identifier_list (recursive: bool=True) -> list[str] |
| Gets a list of the parameter names used as identifiers. More... | |
| def | get_length_parameter () -> str |
| Returns the name of the parameter that is used for the length of the packet. More... | |
| def | get_length_parameter_info () -> LengthParameterInfo |
| Gets the length parameter's attributes. More... | |
| def | get_parameter_list (full_name: bool=True, mod_only: bool=False) -> list[str] |
| Returns a list of all parameters within the packet. More... | |
| def | get_sorted_parameter_list (full_name: bool=True, mod_only: bool=False) -> list[str] |
| Returns a sorted list of all parameters within a collection by their start location. More... | |
| def | get_timestamp_parameter () -> str |
| Returns the name of the parameter that is used for the time stamp of the packet. More... | |
| def | get_timestamp_parameter_info () -> TimeStampParameterInfo |
| Gets the time stamp parameter's attributes. More... | |
| def | update_expected_value (name: str, new_value: int) -> None |
| Updates the expected value for an identifier. More... | |
| def | set_checksum_parameter (param_name: str, ChecksumParameterInfo param_info) -> None |
| Sets the checksum parameter for the packet. More... | |
| def | set_counter_parameter (param_name: str, CounterParameterInfo param_info) -> def |
| Sets the counter parameter for the packet. More... | |
| def | set_modifiable_flag_for_all_parameters (new_value: bool) -> None |
| Sets the modifiable flag for all parameters currently in the packet. More... | |
| def | set_length_parameter (param_name: str, LengthParameterInfo param_info) -> None |
| Sets the length parameter for the packet. More... | |
| def | set_timestamp_parameter (param_name: str, TimeStampParameterInfo param_info) -> None |
| Sets the time stamp parameter for the packet. More... | |
Packet Collection | |
Functions handling adding / removing packets. | |
| def | add_data ( PacketItem packet_item) -> None |
| Sets the specified packet item as the data for the packet. More... | |
| def | add_header ( PacketItem packet_item) -> None |
| Sets the specified packet item as the header for the packet. More... | |
| def | add_trailer ( PacketItem packet_item) -> None |
| Sets the specified packet item as the trailer for the packet. More... | |
| def | clear_global_packet_map () -> None |
| Removes all parameters from the global packet map. More... | |
| def | create_global_packet_map () -> None |
| Creates the map used to hold all of the parameters. More... | |
| def | get_header_length_in_bits () -> int |
| Gets the length of the header in bits. More... | |
| def | get_header_length_in_bytes () -> int |
| Gets the length of the header in bytes. More... | |
| def | get_length_in_bits () -> int |
| Gets the length of the packet in bits. More... | |
| def | get_length_in_bytes () -> int |
| Gets the length of the packet in bytes. More... | |
| def | get_maximum_length_in_bits () -> int |
| Returns the maximum length of the Packet in bits. More... | |
| def | get_validation_errors () -> str |
| Gets a string of the last validation errors. More... | |
| def | has_checksum_error () -> bool |
| Determines if the last packet extraction had a checksum error. More... | |
| def | has_data_zone () -> bool |
| Determines if the packet has a data zone. More... | |
| def | has_header_zone () -> bool |
| Determines if the packet has a header zone. More... | |
| def | has_length_error () -> bool |
| Determines if the last packet extraction had a length error. More... | |
| def | has_modifiable_data (data_zone_only: bool=True) -> bool |
| Determines if the packet has any modifiable data. More... | |
| def | has_trailer_zone () -> bool |
| Determines if the packet has a trailer zone. More... | |
| def | has_variable_length_data () -> bool |
| Determines if the parameter collection has any variable length data. More... | |
| def | is_complete () -> bool |
| Determines if the packet definition is considered complete. More... | |
| def | is_modifiable (top_level: bool=True) -> bool |
| Determines if any of the data is modifiable. More... | |
| def | remove_all_identifiers () -> None |
| Removes all identifiers from the packet. More... | |
| def | remove_identifier (name: str) -> None |
| Removes the specified parameter as an identifier. More... | |
| def | remove_trailer () -> None |
| Removes the trailer zone from the packet. More... | |
| def | remove_data () -> None |
| Removes the data zone from the packet. More... | |
| def | remove_header () -> None |
| Removes the header zone from the packet. More... | |
| def | set_timestamp_offset (offset: float) -> None |
| Sets an offset for the current system time to use when building packets. More... | |
| def | validate () -> int |
| Validates that the data contained in the packet is logically correct. More... | |
Printing | |
Functions handling printing. | |
| def | print_definition (include_value: bool=False) -> str |
| Returns a string with basic information about all parameters in the packet. More... | |
| def | print_packet (buffer: bytearray) -> str |
| 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 |
| Returns a string with the value of all parameters in the packet. | |
Parameters | |
Functions handling Parameters. | |
Packet | |
Functions handling Packets. | |
Public Member Functions inherited from NamedItem | |
| def | __eq__ (named_item: object) -> bool |
| Equality operator "==". More... | |
| def | get_alias () -> str |
| Returns the alias of the item. More... | |
| def | get_name () -> str |
| Returns the name of the item. More... | |
| def | get_long_description () -> str |
| Returns the long description of the item. More... | |
| def | get_short_description () -> str |
| Returns the short description of the item. More... | |
| def | get_user_description () -> str |
| Returns the user description of the item. More... | |
| def | get_owner () -> str |
| Returns the owner of the item. More... | |
| def | set_name (name: str) -> None |
| Sets the name of the item. More... | |
| def | set_alias (alias: str) -> None |
| Sets the alias of the item. More... | |
| def | set_short_description (description: str) -> None |
| Sets the short description of the item. More... | |
| def | set_long_description (description: str) -> None |
| Sets the long description of the item. More... | |
| def | set_user_description (description: str) -> None |
| Sets the user description of the item. More... | |
| def | set_owner (owner: str) -> None |
| Sets the owner 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 | ( | packet | : Optional[Packet] |