TReK Python  5.3.3
Telemetry/Command API
Packet Class Reference

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  -> def ) -> def 
 Class initializer. More...
 
def clone ( -> Packet  -> def  -> def ) -> def 
 Creates a new instance of the object with the same contents.
 
def copy (copy_from: object -> None  -> def  -> def ) -> def 
 Copies the contents of the provided 'copy_from' Packet. More...
 
def initialize ( -> None  -> def  -> def ) -> def 
 Initializes the object. More...
 
def load_file (filename: str -> None  -> def  -> def ) -> def 
 Loads the Packet definition from the specified file. More...
 
def save_file (filename: str -> None  -> def  -> def ) -> def 
 Saves the Packet definition to the specified file. More...
 
Build/Extract
def build (buffer: bytearray -> int  -> def  -> def ) -> def 
 Builds the packet and places it in the provided buffer. More...
 
def extract (buffer: bytearray, input_length: int -> int  -> def  -> def ) -> def 
 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  -> def  -> def ) -> def 
 Adds an identifier to the packet. More...
 
def clear_all_parameter_values ( -> None  -> def  -> def ) -> def 
 Clears each parameter value in the packet. More...
 
def clear_checksum_parameter ( -> None  -> def  -> def ) -> def 
 Turns off checksum parameter calculation when calling build().
 
def clear_counter_parameter ( -> None  -> def  -> def ) -> def 
 Turns off counter generation when calling build().
 
def clear_length_parameter ( -> None  -> def  -> def ) -> def 
 Turns off length calculation when calling build().
 
def clear_timestamp_parameter ( -> None  -> def  -> def ) -> def 
 Turns off time stamp generation when calling build().
 
def find_last_parameter (name: str -> Parameter  -> def  -> def ) -> def 
 Finds the specified parameter name in the packet. More...
 
def find_parameter (name: str -> Parameter  -> def  -> def ) -> def 
 Finds the specified parameter name in the packet. More...
 
def get_checksum_parameter ( -> str  -> def  -> def ) -> def 
 Returns the name of the parameter that is used for the checksum of the packet. More...
 
def get_checksum_parameter_info ( -> ChecksumParameterInfo  -> def  -> def ) -> def 
 Gets the checksum parameter's attributes. More...
 
def get_counter_parameter ( -> str  -> def  -> def ) -> def 
 Returns the name of the parameter that is used for the counter of the packet. More...
 
def get_counter_parameter_info ( -> CounterParameterInfo  -> def  -> def ) -> def 
 Gets the counter parameter's associated attributes. More...
 
def get_fully_qualified_names (name: str -> list[str]  -> def  -> def ) -> 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  -> def ) -> def 
 Retrieves the attributes associated with the named identifier. More...
 
def get_identifier_list (recursive: bool=True -> list[str]  -> def  -> def ) -> def 
 Gets a list of the parameter names used as identifiers. More...
 
def get_length_parameter ( -> str  -> def  -> def ) -> def 
 Returns the name of the parameter that is used for the length of the packet. More...
 
def get_length_parameter_info ( -> LengthParameterInfo  -> def  -> def ) -> def 
 Gets the length parameter's attributes. More...
 
def get_parameter_list (full_name: bool=True, mod_only: bool=False -> list[str]  -> def  -> def ) -> def 
 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]  -> def  -> def ) -> def 
 Returns a sorted list of all parameters within a collection by their start location. More...
 
def get_timestamp_parameter ( -> str  -> def  -> def ) -> 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  -> def ) -> def 
 Gets the time stamp parameter's attributes. More...
 
def update_expected_value (name: str, new_value: int -> None  -> def  -> def ) -> def 
 Updates the expected value for an identifier. More...
 
def set_checksum_parameter (param_name: str, ChecksumParameterInfo param_info -> None  -> def  -> def ) -> def 
 Sets the checksum parameter for the packet. More...
 
def set_counter_parameter (param_name: str, CounterParameterInfo param_info -> def  -> def  -> def ) -> def 
 Sets the counter parameter for the packet. More...
 
def set_modifiable_flag_for_all_parameters (new_value: bool -> None  -> def  -> def ) -> def 
 Sets the modifiable flag for all parameters currently in the packet. More...
 
def set_length_parameter (param_name: str, LengthParameterInfo param_info -> None  -> def  -> def ) -> def 
 Sets the length parameter for the packet. More...
 
def set_timestamp_parameter (param_name: str, TimeStampParameterInfo param_info -> None  -> def  -> def ) -> def 
 Sets the time stamp parameter for the packet. More...
 
Packet Collection

Functions handling adding / removing packets.

def add_data ( PacketItem packet_item -> None  -> def  -> def ) -> def 
 Sets the specified packet item as the data for the packet. More...
 
def add_header ( PacketItem packet_item -> None  -> def  -> def ) -> def 
 Sets the specified packet item as the header for the packet. More...
 
def add_trailer ( PacketItem packet_item -> None  -> def  -> def ) -> def 
 Sets the specified packet item as the trailer for the packet. More...
 
def clear_global_packet_map ( -> None  -> def  -> def ) -> def 
 Removes all parameters from the global packet map. More...
 
def create_global_packet_map ( -> None  -> def  -> def ) -> def 
 Creates the map used to hold all of the parameters. More...
 
def get_header_length_in_bits ( -> int  -> def  -> def ) -> def 
 Gets the length of the header in bits. More...
 
def get_header_length_in_bytes ( -> int  -> def  -> def ) -> def 
 Gets the length of the header in bytes. More...
 
def get_length_in_bits ( -> int  -> def  -> def ) -> def 
 Gets the length of the packet in bits. More...
 
def get_length_in_bytes ( -> int  -> def  -> def ) -> def 
 Gets the length of the packet in bytes. More...
 
def get_maximum_length_in_bits ( -> int  -> def  -> def ) -> def 
 Returns the maximum length of the Packet in bits. More...
 
def get_validation_errors ( -> str  -> def  -> def ) -> def 
 Gets a string of the last validation errors. More...
 
def has_checksum_error ( -> bool  -> def  -> def ) -> def 
 Determines if the last packet extraction had a checksum error. More...
 
def has_data_zone ( -> bool  -> def  -> def ) -> def 
 Determines if the packet has a data zone. More...
 
def has_header_zone ( -> bool  -> def  -> def ) -> def 
 Determines if the packet has a header zone. More...
 
def has_length_error ( -> bool  -> def  -> def ) -> def 
 Determines if the last packet extraction had a length error. More...
 
def has_modifiable_data (data_zone_only: bool=True -> bool  -> def  -> def ) -> def 
 Determines if the packet has any modifiable data. More...
 
def has_trailer_zone ( -> bool  -> def  -> def ) -> def 
 Determines if the packet has a trailer zone. More...
 
def has_variable_length_data ( -> bool  -> def  -> def ) -> def 
 Determines if the parameter collection has any variable length data. More...
 
def is_complete ( -> bool  -> def  -> def ) -> def 
 Determines if the packet definition is considered complete. More...
 
def is_modifiable (top_level: bool=True -> bool  -> def  -> def ) -> def 
 Determines if any of the data is modifiable. More...
 
def remove_all_identifiers ( -> None  -> def  -> def ) -> def 
 Removes all identifiers from the packet. More...
 
def remove_identifier (name: str -> None  -> def  -> def ) -> def 
 Removes the specified parameter as an identifier. More...
 
def remove_trailer ( -> None  -> def  -> def ) -> def 
 Removes the trailer zone from the packet. More...
 
def remove_data ( -> None  -> def  -> def ) -> def 
 Removes the data zone from the packet. More...
 
def remove_header ( -> None  -> def  -> def ) -> def 
 Removes the header zone from the packet. More...
 
def set_timestamp_offset (offset: float -> None  -> def  -> def ) -> def 
 Sets an offset for the current system time to use when building packets. More...
 
def validate ( -> int  -> def  -> def ) -> 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  -> def ) -> def 
 Returns a string with basic information about all parameters in the packet. More...
 
def print_packet (buffer: bytearray -> str  -> def  -> def ) -> 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  -> def ) -> def 
 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  -> def  -> def ) -> def 
 Equality operator "==". More...
 
def get_alias ( -> str  -> def  -> def ) -> def 
 Returns the alias of the item. More...
 
def get_name ( -> str  -> def  -> def ) -> def 
 Returns the name of the item. More...
 
def get_long_description ( -> str  -> def  -> def ) -> def 
 Returns the long description of the item. More...
 
def get_short_description ( -> str  -> def  -> def ) -> def 
 Returns the short description of the item. More...
 
def get_user_description ( -> str  -> def  -> def ) -> def 
 Returns the user description of the item. More...
 
def get_owner ( -> str  -> def  -> def ) -> def 
 Returns the owner of the item. More...
 
def set_name (name: str -> None  -> def  -> def ) -> def 
 Sets the name of the item. More...
 
def set_alias (alias: str -> None  -> def  -> def ) -> def 
 Sets the alias of the item. More...
 
def set_short_description (description: str -> None  -> def  -> def ) -> def 
 Sets the short description of the item. More...
 
def set_long_description (description: str -> None  -> def  -> def ) -> def 
 Sets the long description of the item. More...
 
def set_user_description (description: str -> None  -> def  -> def ) -> def 
 Sets the user description of the item. More...
 
def set_owner (owner: str -> None  -> def  -> def ) -> def 
 Sets the owner of the item. More...
 

Detailed Description

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).

Constructor & Destructor Documentation

◆ Packet()

(packet : Optional[Packet]