|
Telescience Resource Kit
TReK Python
5.4.0 ART
|
This class describes a format collection composed of one or more parameter collections. More...
Inherits PacketItem.
Public Member Functions | |
Initialize / Finalize | |
Functions handling class initialization and finalization. | |
def | FormatCollection ( Optional[FormatCollection] format_collection=None -> def ) -> def |
Class initializer. More... | |
def | clone ( -> FormatCollection ) -> 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' FormatCollection. More... | |
def | initialize ( -> None ) -> def |
Initializes the object. More... | |
def | load_file (filename: str -> None ) -> def |
Loads the FormatCollection definition from the specified file. More... | |
def | save_file (filename: str -> None ) -> def |
Saves the FormatCollection definition to the specified file. More... | |
Format Collection | |
Functions handling adding / removing packets. | |
def | add_format (param_coll: ParameterCollection, format_id: int -> None ) -> def |
Adds the packet to the collection. More... | |
def | get_format_length ( -> int ) -> def |
Returns the length of the format. More... | |
def | get_format_offset ( -> int ) -> def |
Returns the offset of the format. More... | |
def | get_number_of_formats ( -> int ) -> def |
Returns the number of formats in the collection. More... | |
def | remove_format (format_id: int -> None ) -> def |
Removes the specified format from the format collection. More... | |
def | remove_all_formats ( -> None ) -> def |
Removes all formats from the collection. | |
def | set_format_info (offset: int, length: int -> None ) -> def |
Sets the location in the packet buffer where the unsigned format ID can be found. More... | |
Parameters | |
Functions handling parameters. | |
def | find_parameter (name: str -> Parameter ) -> def |
Finds the specified parameter name in the collection. More... | |
def | get_parameter_list (full_name: bool=True, mod_only: bool=False -> list[str] ) -> def |
Returns a list of all parameters within a collection. 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... | |
Packet | |
Functions handling Packets. | |
def | build (byte_buffer: bytearray -> int ) -> def |
Builds the parameters in the collection and places it in the specified buffer. More... | |
def | extract (buffer: bytearray, input_length: int, start_bit: int -> int ) -> def |
Extracts all of the parameters in the collection from the specified buffer. More... | |
def | get_length_in_bits ( -> int ) -> def |
Gets the length of the parameter collection in bits. More... | |
def | get_length_in_bytes ( -> int ) -> def |
Gets the length of the parameter collection in bytes. More... | |
def | get_maximum_length_in_bits ( -> int ) -> def |
Returns the maximum length of the FormatCollection in bits. More... | |
def | has_modifiable_data (data_zone_only: bool=True -> bool ) -> def |
Determines if any of the parameters are modifiable. More... | |
def | has_variable_length_data ( -> bool ) -> def |
Determines if the format collection has any variable length data. More... | |
def | is_complete ( -> bool ) -> def |
Determines if all parameters have a value. More... | |
def | is_modifiable (top_level: bool=True -> bool ) -> def |
Determines if any data is modifiable. More... | |
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 format collection composed of one or more parameter collections.
The FormatCollection class holds one or more formats that can be processed based on the foramt id.
( | format_collection | : Optional[FormatCollection] | ) | -> def |
Class initializer.
[in] | format_collection | (Optional) FormatCollection to copy. By default, initializes a new instance. |
Reimplemented from NamedItem.
( | param_coll | : ParameterCollection | |
format_id | : int | ||
) | -> None |
Adds the packet to the collection.
Adds the parameter collection with the format id specified. The FormatCollection makes a copy of the input.
[in] | param_coll | The ParameterCollection to add to the collection. |
[in] | format_id | The format id assigned. |
TrekError | 15005 - TREK_DATA_ALREADY_EXISTS |
( | byte_buffer | : bytearray | ) | -> int |
Builds the parameters in the collection and places it in the specified buffer.
The parameters composing the collection are built and placed in the buffer.
[in] | byte_buffer | The buffer in which to compile the packet. |
TrekError | 15021 - TREK_DATA_WILL_NOT_FIT |
( | copy_from | : object | ) | -> None |
Copies the contents of the provided 'copy_from' FormatCollection.
[in] | copy_from | FormatCollection to copy from. |
TypeError | if 'copy_from' is not a FormatCollection. |
Reimplemented from NamedItem.
( | buffer | : bytearray | |
input_length | : int | ||
start_bit | : int | ||
) | -> int |
Extracts all of the parameters in the collection from the specified buffer.
Loops through all of the parameters contained in the collection and extracts their indiviual values (see Parameter for details on what parameter extraction encompasses).
buffer | The buffer from which to extract. |
input_length | The valid number of bits that can be read. |
start_bit | The starting bit in the buffer to begin reading. |
( | name | : str | ) | -> Parameter |
Finds the specified parameter name in the collection.
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 can 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.
( | ) | -> int |
Returns the length of the format.
( | ) | -> int |
Returns the offset of the format.
( | ) | -> int |
Gets the length of the parameter collection in bits.
Calculates the length of the parameter collection in bits by determining the last bit used by any parameter in the packet. If the parameter collection contains a variable length parameter, this method will fail.
TrekError | 15017 - TREK_DATA_FIXED_LENGTH_REQUIRED |
Reimplemented from PacketItem.
( | ) | -> int |
Gets the length of the parameter collection in bytes.
Calculates the length of the parameter collection in bits by determining the last bit used by any parameter in the packet. If the parameter collection contains a variable length parameter, this method will fail.
TrekError | 15017 - TREK_DATA_FIXED_LENGTH_REQUIRED |
Reimplemented from PacketItem.
( | ) | -> int |
Returns the maximum length of the FormatCollection in bits.
If the FormatCollection has variable length data, the actual length may be less than the returned value.
Reimplemented from PacketItem.
( | ) | -> int |
Returns the number of formats in the collection.
( | full_name | : bool | |
mod_only | : bool | ||
) | -> list[str] |
Returns a list of all parameters within a collection.
[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.
( | 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.
( | data_zone_only | : bool | ) | -> bool |
Determines if any of the parameters are modifiable.
[in] | data_zone_only | Currently ignored (default value). |
Reimplemented from PacketItem.
( | ) | -> bool |
Determines if the format collection has any variable length data.
Reimplemented from PacketItem.
( | ) | -> None |
Initializes the object.
Clears any set values in the FormatCollection. New instances do not need to be initialized.
Reimplemented from NamedItem.
( | ) | -> bool |
Determines if all parameters have a value.
Reimplemented from PacketItem.
( | top_level | : bool | ) | -> bool |
Determines if any data is modifiable.
[in] | top_level | Designates that this is a top level packet. |
Reimplemented from PacketItem.
( | filename | : str | ) | -> None |
Loads the FormatCollection definition from the specified file.
Reads an XML FormatCollection.
[in] | filename | The file from which to load the FormatCollection object. |
( | format_id | : int | ) | -> None |
Removes the specified format from the format collection.
[in] | format_id | The format id to remove. |
TrekError | 15007 - TREK_DATA_DOES_NOT_EXIST |
( | filename | : str | ) | -> None |
Saves the FormatCollection definition to the specified file.
Writes an XML FormatCollection.
[in] | filename | The file to save the format collection object. |
( | offset | : int | |
length | : int | ||
) | -> None |
Sets the location in the packet buffer where the unsigned format ID can be found.
offset | Offset in bits within packet. |
length | Length in bits. |
TrekError | 15025 - TREK_DATA_VALUE_LESS_THAN_MIN, 15026 - TREK_DATA_VALUE_EXCEEDS_MAX |