|
Telescience Resource Kit
TReK Python
5.4.0 ART
|
Provides access to command features of TReK. More...
Inherits ApiClient.
Public Member Functions | |
Initialize / Finalize | |
Functions handling class initialization and finalization. | |
def | CommandApi ( -> None ) -> def |
Class initializer. More... | |
Commanding | |
These methods support sending/updating commands. | |
def | get_command (name: str, packet: Packet -> None ) -> def |
Gets the complete definition of the command from the command controller. More... | |
def | get_command_list ( -> List[str] ) -> def |
Get a list of commands known by the command controller. More... | |
def | initiate_command (name: str -> int ) -> def |
Sends a request to the final destination to uplink a command. More... | |
def | insert_data_and_send_command (name: str, byte_data: bytes -> int ) -> def |
Inserts the specified data into a command's 'data zone'. More... | |
def | ready_for_request ( -> bool ) -> def |
Determine if it is ok to send a request on the command connection. More... | |
def | send_binary_command (name: str, binary_data: bytes -> int ) -> def |
Sends the command identified by buf_ptr to the destination using the given name. More... | |
def | send_this_command (packet: Packet -> int ) -> def |
Builds the command defined by Packet and sends it to the destination. More... | |
def | send_trek_command (name: str -> int ) -> def |
Sends the specified command based on the current definition of the command within the command controller. More... | |
def | update_command (packet: Packet -> None ) -> def |
Updates the specified command to the destination. More... | |
def | update_destination_command (name: str -> None ) -> def |
Sends a request to the final destination to update a command. More... | |
Command Sequences | |
These methods support sending/updating commands from a binary command sequences file. | |
def | register_sequence_command_callback (callback_fn: SequenceCommandCallback -> None ) -> def |
Register a callback function to receive sent command notifications. More... | |
def | register_sequence_error_callback (callback_fn: SequenceErrorCallback -> None ) -> def |
Register a callback function to receive notification when a sequence errors. More... | |
def | register_sequence_start_callback (callback_fn: SequenceStartCallback -> None ) -> def |
Register a callback function to receive a command sequence start notification. More... | |
def | register_sequence_wait_callback (callback_fn: SequenceWaitCallback -> None ) -> def |
Register a callback function to receive notification when a sequence pauses. More... | |
def | register_sequence_stop_callback (callback_fn: SequenceStopCallback -> None ) -> def |
Register a callback function to receive notification when a sequence ends. More... | |
def | start_sequence (file_name: str -> int ) -> def |
Start sending commands from the provided command sequence binary file. More... | |
def | stop_sequence (token: int -> None ) -> def |
Stop an active command sequence which correlated to a specific token. More... | |
def | stop_all_sequences ( -> None ) -> def |
Stop all active command sequences. More... | |
def | find_active_sequence (token: int -> int ) -> def |
Check if a sequence correlated to a specific token is active. More... | |
Command Response | |
These methods support command responses. | |
def | get_track (token: int, track_item: TrackItem -> None ) -> def |
Find out any command track information for this 'token'. More... | |
def | get_command_response (name: str, response: CommandResponse -> None ) -> def |
Get the details for a command response. More... | |
def | get_command_response_list ( -> List[str] ) -> def |
Get a list of possible command responses for the command source. More... | |
Blocking | |
These methods support blocking. | |
def | destination_allows_blocking ( -> bool ) -> def |
Determines if a destination allows blocking. More... | |
def | get_destination_type ( -> str ) -> def |
Returns name of destination. More... | |
def | get_blocking_flag ( -> bool ) -> def |
Gets the current value of the blocking flag for this instance of the API. More... | |
def | get_blocking_timeout ( -> int ) -> def |
Gets the current value of the blocking timeout. More... | |
def | set_blocking_flag (new_flag: bool -> None ) -> def |
Sets the blocking flag. More... | |
def | set_blocking_timeout (timeout: int -> None ) -> def |
Sets the amount of time a method that supports blocking will wait to unblock. More... | |
def | unblock_destination ( -> None ) -> def |
Unblocks a destination. More... | |
Configuration Message | |
These methods support configurations. | |
def | get_configuration_message (name: str, param_coll: ParameterCollection -> str ) -> def |
Get the details for a configuration message. More... | |
def | get_configuration_message_list ( -> List[str] ) -> def |
Get a list of messages that a destination allows to be configured by a user. More... | |
def | set_configuration_item (name: str, value: str -> None ) -> def |
Sets the value of a configuration item. More... | |
Status Message | |
These methods provide command status information. | |
def | get_status_item (name: str -> str ) -> def |
Gets the value of the requested item. More... | |
def | get_status_message (name: str, param_coll: ParameterCollection -> str ) -> def |
Get the details for a status message. More... | |
def | get_status_message_list ( -> List[str] ) -> def |
Get a list of messages that the user can send. More... | |
![]() | |
def | cleanse ( -> None ) -> def |
Cleans up any resources from crashed TReK user programs. More... | |
def | connect ( str destination="DefaultDataStore" -> None ) -> def |
Connects this instance of the API to TReK for the specified destination. More... | |
def | is_connected ( -> bool ) -> def |
Indicates if the API is connected. More... | |
def | disconnect ( -> None ) -> def |
Disconnects from the destination. More... | |
def | get_wait_timeout ( -> int ) -> def |
Returns the current timeout value for API calls. More... | |
def | set_wait_timeout (timeout: int -> None ) -> def |
Sets the timeout value for API calls that require communicating with TReK. More... | |
Provides access to command features of TReK.
This class provides access to the command feature of TReK. Users of the class can uplink commands, update commands, receive command track information, and more.
( | ) | -> None |
( | ) | -> bool |
Determines if a destination allows blocking.
This will determine if the blocking flag is available for use.
TrekError | 31123 - TCA_API_NOT_CONNECTED |
( | token | : int | ) | -> int |
Check if a sequence correlated to a specific token is active.
[in] | token | unique token to check if active. |
TrekError | 31123 - TCA_API_NOT_CONNECTED, 31020 - TCA_WAIT_TIMEOUT, 31122 - TCA_WORKER_WAIT_ERR, 15025 - TREK_DATA_VALUE_LESS_THAN_MIN |
( | ) | -> bool |
Gets the current value of the blocking flag for this instance of the API.
TrekError | 31123 - TCA_API_NOT_CONNECTED |
( | ) | -> int |
Gets the current value of the blocking timeout.
TrekError | 31123 - TCA_API_NOT_CONNECTED, 31020 - TCA_WAIT_TIMEOUT |
( | name | : str | |
packet | : Packet | ||
) | -> None |
Gets the complete definition of the command from the command controller.
Populates command information within the provided packet for the requested command. The returned data can be used for the send_this_command() method.
[in] | name | The name of the command to retrieve. |
[out] | packet | The packet definition of the commmand. |
TrekError | 31123 - TCA_API_NOT_CONNECTED, 31020 - TCA_WAIT_TIMEOUT, 11003 - CMD_API_MAX_NAME_LEN_ERROR |
( | ) | -> List[str] |
Get a list of commands known by the command controller.
Details about each command can be obtained by calling the get_command() method.
TrekError | 31123 - TCA_API_NOT_CONNECTED, 31020 - TCA_WAIT_TIMEOUT, 11001 - CMD_API_FILE_OPEN_ERR |
( | name | : str | |
response | : CommandResponse | ||
) | -> None |
Get the details for a command response.
The command response contains the details including the possible error codes and descriptions.
[in] | name | The name of the command response. Usually returned from get_command_response_list(). |
[in,out] | response | The class instance updated to contain the details. |
TrekError | 31123 - TCA_API_NOT_CONNECTED, 31020 - TCA_WAIT_TIMEOUT, 11003 - CMD_API_MAX_NAME_LEN_ERROR |
( | ) | -> List[str] |
Get a list of possible command responses for the command source.
The order of the list is set by the Command Controller and should be listed from first expected response to last expected response. An empty list indicates that no responses are expected from the destination. get_command_response() can be called to get details about each response in the list.
TrekError | 31123 - TCA_API_NOT_CONNECTED, 31020 - TCA_WAIT_TIMEOUT, 11001 - CMD_API_FILE_OPEN_ERR |
( | name | : str | |
param_coll | : ParameterCollection | ||
) | -> str |
Get the details for a configuration message.
The parameter collection will be updated to contain one or more of parameters that may be configured for the destination.
[in] | name | The name of the configuration message. Usually returned from get_configuration_message_list(). |
[in,out] | param_coll | ParameterCollection to hold parameters in the message. |
TrekError | 31123 - TCA_API_NOT_CONNECTED, 31020 - TCA_WAIT_TIMEOUT, 11003 - CMD_API_MAX_NAME_LEN_ERROR, 14014 - CMD_API_NOT_ENOUGH_SPACE |
( | ) | -> List[str] |
Get a list of messages that a destination allows to be configured by a user.
The returned names can be used in calls to get_configuration_message() to get the details of what may be configured.
TrekError | 31123 - TCA_API_NOT_CONNECTED, 31020 - TCA_WAIT_TIMEOUT, 11001 - CMD_API_FILE_OPEN_ERR |
( | ) | -> str |
Returns name of destination.
TrekError | 31123 - TCA_API_NOT_CONNECTED, 31020 - TCA_WAIT_TIMEOUT, 14014 - CMD_API_NOT_ENOUGH_SPACE |
( | name | : str | ) | -> str |
Gets the value of the requested item.
[in] | name | The name of the item to status. |
TrekError | 31123 - TCA_API_NOT_CONNECTED, 31020 - TCA_WAIT_TIMEOUT, 11003 - CMD_API_MAX_NAME_LEN_ERROR |
Request String | Description |
---|---|
AosLos | Indicates if MCC-H currently AOS or LOS. |
CarProcessingEnablement | Indicates if command action reponse processing is enabled or disabled. |
CarTimeout | The amount of time in seconds that the POIC will wait for a CAR message before declaring failure. |
ClearToSendMechanism | The current response required before another command can be uplinked. Valid values are ERR, CAR, and FSV. |
CommandDatabaseVersion | The version of the command database used by the POIC. |
ConnectionStatus | Describes if connection to POIC was successful and if not the reason for failure. |
CrrProcessingEnablement | Indicates if command reaction reponse processing is enabled or disabled. |
CurrentStationMode | Indicates the current ISS mode. |
FsvProcessingEnablement | Indicates if flight system verifier processing is enabled or disabled. |
FsvTimeout | The amount of time in seconds that the POIC will wait for a FSV message before declaring failure. |
KuAosLos | Indicates whether the Ku-Band path is AOS or LOS. If LOS telemetry indicators for commanding may not be available. |
MaximumRetries | The number of attempts the POIC will make to transmit a command. set_configuration_item() can be used to control for individual sessions. |
McchConnection | Indicates if the POIC system is connected to MCC-H. |
McchEnablement | Indicates if the MCC-H is enabled or disabled for commanding. |
MinimumTimeDelay | The time delay required between issuing commands. Value is milliseconds. |
Mission | The mission from the MOP. |
NonEhsCommandingEnablement | Indicates if remote users are enabled or disabled from commanding. |
OperationalSupportMode | The operational support mode from the MOP. |
PoicConnection | Indicates if a remote EHS command system is connected. Not applicable to TReK users. |
PoicEnablement | Indicates if the POIC is enabled or disabled for commanding. |
Project | The project from the MOP. |
RemoteEhsEnablement | Indicates if a remote instance of the EHS system is enabled for commanding. Not applicable to TReK users. |
SourceMessageKey | Internal value used only by the API. |
UplinkPath | Identifiers the uplink path for real-time commands. |
UserEnablement | Indicates if the user in enabled or disabled for S-band commanding. |
UserInhibitStatus | Indicates if the user is inhibited from commanding due to LOS. |
( | name | : str | |
param_coll | : ParameterCollection | ||
) | -> str |
Get the details for a status message.
The parameter collection will be updated to contain one or more of parameters and their current values.
[in] | name | The name of the status message. Usually returned from get_status_message_list(). |
[in,out] | param_coll | ParameterCollection to hold parameters in message. |
TrekError | 31123 - TCA_API_NOT_CONNECTED, 31020 - TCA_WAIT_TIMEOUT, 11003 - CMD_API_MAX_NAME_LEN_ERROR |
( | ) | -> List[str] |
Get a list of messages that the user can send.
The returned message names can be used in calls to get_status_message() to get the contents of the status message.
TrekError | 31123 - TCA_API_NOT_CONNECTED, 31020 - TCA_WAIT_TIMEOUT, 11001 - CMD_API_FILE_OPEN_ERR |
( | token | : int | |
track_item | : TrackItem | ||
) | -> None |
Find out any command track information for this 'token'.
The track item is updated to contains the name of the command, the time the command was sent, and an ordered (by receipt time) list of all responses, if any. It is possible that the same response name is received multiple times for a command.
[in] | token | Token used to correlate specific instances of command sends. The value is returns from a call to send_this_command() or initiate_command(). |
[in,out] | track_item | TrackItem to contain requested information. |
TrekError | 31123 - TCA_API_NOT_CONNECTED, 31020 - TCA_WAIT_TIMEOUT |
( | name | : str | ) | -> int |
Sends a request to the final destination to uplink a command.
If the final destination does not support this means of sending a command, the method will return an error. The returned token can be used to obtain and/or correlate tracking information.
[in] | name | The name of the command. |
TrekError | 31123 - TCA_API_NOT_CONNECTED, 31020 - TCA_WAIT_TIMEOUT, 11002 - CMD_API_MAX_LEN_ERROR, |
( | name | : str | |
byte_data | : bytes | ||
) | -> int |
Inserts the specified data into a command's 'data zone'.
The data field in the command must contain a single parameter for the insertion of the data. The returned token can be used to obtain and/or correlate tracking information.
[in] | name | Name of the command. Some destinations may not require the name, but it is advised for tracking purposes. |
[in] | byte_data | The byte array of data to send. |
TrekError | 31123 - TCA_API_NOT_CONNECTED, 31020 - TCA_WAIT_TIMEOUT, 11002 - CMD_API_MAX_LEN_ERROR, 11003 - CMD_API_MAX_NAME_LEN_ERROR, 11004 - CMD_API_DOES_NOT_EXIST |
( | ) | -> bool |
Determine if it is ok to send a request on the command connection.
TrekError | 31123 - TCA_API_NOT_CONNECTED, 31020 - TCA_WAIT_TIMEOUT |
( | callback_fn | : SequenceCommandCallback | ) | -> None |
Register a callback function to receive sent command notifications.
[in] | callback_fn | Callback method to receive notification when each command executes. |
TrekError | 31123 - TCA_API_NOT_CONNECTED, 31020 - TCA_WAIT_TIMEOUT, 31122 - TCA_WORKER_WAIT_ERR, 11018 - CMD_API_SEM_OPEN_ERROR, 11020 - CMD_API_NOT_CLEAR_TO_SEND |
The user's callback function provided as callaback_fn, follows the following method:
Parameters
token
unique sequence identifier. status
status of the sequence. command
name of the command. count
the number of commands executed. ret_count
return code associated with the command. command_token
unique token for the executed command for tracking. ( | callback_fn | : SequenceErrorCallback | ) | -> None |
Register a callback function to receive notification when a sequence errors.
[in] | callback_fn | Callback method to receive notification. |
TrekError | 31123 - TCA_API_NOT_CONNECTED, 31020 - TCA_WAIT_TIMEOUT, 31122 - TCA_WORKER_WAIT_ERR, 11018 - CMD_API_SEM_OPEN_ERROR, 11020 - CMD_API_NOT_CLEAR_TO_SEND |
The user's callback function provided as callaback_fn, follows the following method:
Parameters
token
unique sequence identifier. count
the number of commands executed. ret_count
return code associated with the command. ( | callback_fn | : SequenceStartCallback | ) | -> None |
Register a callback function to receive a command sequence start notification.
[in] | callback_fn | Callback method to receive notification when a sequence starts. |
TrekError | 31123 - TCA_API_NOT_CONNECTED, 31020 - TCA_WAIT_TIMEOUT, 31122 - TCA_WORKER_WAIT_ERR, 11018 - CMD_API_SEM_OPEN_ERROR, 11020 - CMD_API_NOT_CLEAR_TO_SEND |
The user's callback function provided as callaback_fn, follows the following method:
Parameters
token
unique sequence identifier. sequence_file
full path of the sequence file starting. ( | callback_fn | : SequenceStopCallback | ) | -> None |
Register a callback function to receive notification when a sequence ends.
[in] | callback_fn | Callback method to receive notification. |
TrekError | 31123 - TCA_API_NOT_CONNECTED, 31020 - TCA_WAIT_TIMEOUT, 31122 - TCA_WORKER_WAIT_ERR, 11018 - CMD_API_SEM_OPEN_ERROR, 11020 - CMD_API_NOT_CLEAR_TO_SEND |
The user's callback function provided as callaback_fn, follows the following method:
Parameters
token
unique sequence identifier. status
status of the sequence. count
the number of commands executed. ret_count
return code associated with the command. ( | callback_fn | : SequenceWaitCallback | ) | -> None |
Register a callback function to receive notification when a sequence pauses.
[in] | callback_fn | Callback method to receive notification. |
TrekError | 31123 - TCA_API_NOT_CONNECTED, 31020 - TCA_WAIT_TIMEOUT, 31122 - TCA_WORKER_WAIT_ERR, 11018 - CMD_API_SEM_OPEN_ERROR, 11020 - CMD_API_NOT_CLEAR_TO_SEND |
The user's callback function provided as callaback_fn, follows the following method:
Parameters
token
unique sequence identifier. status
status of the sequence. wait_millis
the amount of time in milliseconds for the wait. ( | name | : str | |
binary_data | : bytes | ||
) | -> int |
Sends the command identified by buf_ptr to the destination using the given name.
The returned token can be used to obtain and/or correlate tracking information.
[in] | name | Name of the command. Some destinations may not require the name, but it is advised for tracking purposes. |
[in] | binary_data | The byte array of data to send. |
TrekError | 31123 - TCA_API_NOT_CONNECTED, 31020 - TCA_WAIT_TIMEOUT, 11002 - CMD_API_MAX_LEN_ERROR, 11003 - CMD_API_MAX_NAME_LEN_ERROR, 11004 - CMD_API_DOES_NOT_EXIST |
( | packet | : Packet | ) | -> int |
Builds the command defined by Packet and sends it to the destination.
The returned token can be used to obtain and/or correlate tracking information.
[in] | packet | A complete definition of the packet to send. All parameter values must have a value. |
TrekError | 31123 - TCA_API_NOT_CONNECTED, 31020 - TCA_WAIT_TIMEOUT |
( | name | : str | ) | -> int |
Sends the specified command based on the current definition of the command within the command controller.
The returned token can be used to obtain and/or correlate tracking information.
[in] | name | The name of the command. Some destinations may not require the name, but it is advisable to set it for tracking purposes. |
TrekError | 31123 - TCA_API_NOT_CONNECTED, 31020 - TCA_WAIT_TIMEOUT, 11003 - CMD_API_MAX_NAME_LEN_ERROR, 11004 - CMD_API_DOES_NOT_EXIST |
( | new_flag | : bool | ) | -> None |
Sets the blocking flag.
If False, it forces a destination to allow commands to be sent.
By default the flag is true. For command controllers that have optional blocking, this flag indicates whether or not the API method will block until the 'clear to send' mechanism is released. The API methods that use this flag are: send_binary_command(), insert_data_and_send_command(), initiate_command(), send_this_command(), and send_trek_command().
[in] | new_flag | New blocking setting. |
TrekError | 31123 - TCA_API_NOT_CONNECTED, 31020 - TCA_WAIT_TIMEOUT |
( | timeout | : int | ) | -> None |
Sets the amount of time a method that supports blocking will wait to unblock.
Value is ignored for destinations that do not support blocking or when user has turned off blocking with set_blocking_flag(). This timeout value should be less than the value set by ApiClient.set_wait_timeout().
The default value for the blocking timeout is 20,000 milliseconds.
[in] | timeout | Timeout value in milliseconds. |
TrekError | 31123 - TCA_API_NOT_CONNECTED, 31020 - TCA_WAIT_TIMEOUT |
( | name | : str | |
value | : str | ||
) | -> None |
Sets the value of a configuration item.
[in] | name | The name of the configuration item. |
[in] | value | The value of the configuration item. |
TrekError | 31123 - TCA_API_NOT_CONNECTED, 31020 - TCA_WAIT_TIMEOUT, 11003 - CMD_API_MAX_NAME_LEN_ERROR |
Request String | Description |
---|---|
NumberOfRetries | Sets the number of times a command will be retried if it does not succeed. Cannot exceed the MaximumRetries status value (get_status_item()). |
( | file_name | : str | ) | -> int |
Start sending commands from the provided command sequence binary file.
The returned token can be used to correlate tracking information.
[in] | file_name | The full path and file name of the binary command sequence to start. |
TrekError | 31123 - TCA_API_NOT_CONNECTED, 31020 - TCA_WAIT_TIMEOUT, 31122 - TCA_WORKER_WAIT_ERR, 11002 - CMD_API_MAX_LEN_ERROR, 11006 - CMD_API_BAD_INDEX, 11018 - CMD_API_SEM_OPEN_ERROR |
( | ) | -> None |
Stop all active command sequences.
TrekError | 31123 - TCA_API_NOT_CONNECTED, 31020 - TCA_WAIT_TIMEOUT, 31122 - TCA_WORKER_WAIT_ERR |
( | token | : int | ) | -> None |
Stop an active command sequence which correlated to a specific token.
[in] | token | unique sequence token to stop. |
TrekError | 31123 - TCA_API_NOT_CONNECTED, 31020 - TCA_WAIT_TIMEOUT, 31122 - TCA_WORKER_WAIT_ERR |
( | ) | -> None |
Unblocks a destination.
If the destination doesn't allow blocking, the function will still return without exception.
This function is provided in case a logic error in the delivered software prevents a command connection from being used. You should not call this method unless it is determined that the delivered software has an error. Please contact the TReK Help Desk if the destination is remaining blocked unexpectedly for help.
TrekError | 31123 - TCA_API_NOT_CONNECTED, 31020 - TCA_WAIT_TIMEOUT |
( | packet | : Packet | ) | -> None |
Updates the specified command to the destination.
The name of the command is retrieved from the Packet. The current definition is removed from the command store and replaced with the new definition supplied. No checks are performed to see if the command defintions match in any way.
[in] | packet | The definition of the new command. |
TrekError | 31123 - TCA_API_NOT_CONNECTED, 11004 - CMD_API_DOES_NOT_EXIST, 11003 - CMD_API_MAX_NAME_LEN_ERROR |
( | name | : str | ) | -> None |
Sends a request to the final destination to update a command.
If the final destination does not support this means of sending a command, the method will return an error. The actual data sent to the destination will vary based on the defined interface.
[in] | name | The name of the command. |
TrekError | 31123 - TCA_API_NOT_CONNECTED, 11003 - CMD_API_MAX_NAME_LEN_ERROR |