|
Telescience Resource Kit
TReK Python
5.4.0 ART
|
Provides access to telemetry features of TReK. More...
Inherits ApiClient.
Public Member Functions | |
Initialize / Finalize | |
Functions handling class initialization and destruction. | |
def | TelemetryApi ( -> None ) -> def |
Class initializer. More... | |
Packet Handling | |
Functions for retrieving packets. | |
def | get_packet_definition (packet_key: str, packet: Packet -> None ) -> def |
Retrieve the Packet definition for the specified key. More... | |
def | get_newest_packet (packet_key: str, buffer: bytearray -> Tuple[int, int] ) -> def |
Gets a copy of the newest packet available from the data store. More... | |
def | get_next_packet (packet_key: str, token: int, buffer: bytearray -> Tuple[int, int, int] ) -> def |
Gets a copy of the next packet available from the data store. More... | |
def | get_this_packet (packet_key: str, token: int, buffer: bytearray -> int ) -> def |
Gets a copy of the specified packet from the data store. More... | |
def | get_source_list ( -> List[str] ) -> def |
Gets the list of packet keys currently being processed. More... | |
def | register_packet_semaphore (packet_key: str -> None ) -> def |
Registers a semaphore to be signaled when a packet arrives. More... | |
def | unregister_packet_semaphore (packet_key: str -> None ) -> def |
Unregisters the packet arrival semaphore. More... | |
def | wait_for_packet (packet_key: str, timeout: int=0 -> bool ) -> def |
Waits for the specified packet to arrive. More... | |
Logging | |
Functions handling TReK logging. | |
def | set_monitor_log_file (filename: str -> None ) -> def |
Sets the filename prefix and path used for writing monitor messages if monitor logging is on. More... | |
def | start_monitor_logging ( -> None ) -> def |
Starts the logging of monitor messages. More... | |
def | stop_monitor_logging ( -> None ) -> def |
Stops the logging of monitor messages. 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 telemetry features of TReK.
This class provides access to the telemetry feature of TReK. Users of the class can get packets, convert and calibrate parameters.
( | ) | -> None |
Class initializer.
TelemetryApi creation:
my_telemetry_api = TelemetryApi()
Reimplemented from ApiClient.
( | packet_key | : str | |
buffer | : bytearray | ||
) | -> Tuple[int, int] |
Gets a copy of the newest packet available from the data store.
The returned packet can be processed with a Packet instance.
[in] | packet_key | The packet key. |
[in,out] | buffer | The buffer to contain the back byte data. |
TrekError | 28010 - TLM_API_NULL_POINTER, 31123 - TCA_API_NOT_CONNECTED, 28026 - TLM_API_PKT_NAME_LEN_ERR, 31020 - TCA_WAIT_TIMEOUT, 28017 - TLM_API_DATA_STORE_WAIT_ERR, 28020 - TLM_API_LENGTH_ERR |
( | packet_key | : str | |
token | : int | ||
buffer | : bytearray | ||
) | -> Tuple[int, int, int] |
Gets a copy of the next packet available from the data store.
Next is determined by the token provided. If this is the first request, the token should be 0. If the next packet is not availible anymore, the oldest packet will be returned and the return 'status' of the method will be TLM_API_MISSING_DATA. If additional data is available, the return 'status' TLM_API_MORE_DATA_AVAILABLE will be returned. A status of TLM_API_MISSING_DATA or TLM_API_MORE_DATA_AVAILABLE is not considered an error. The returned packet can be processed with a Packet instance.
[in] | packet_key | The packet key. |
[in] | token | Token used to determine the previous packet returned. |
[in,out] | buffer | The bytearray buffer holding the byte data of the packet, if successful. |
TrekError | 28010 - TLM_API_NULL_POINTER, 31123 - TCA_API_NOT_CONNECTED, 28026 - TLM_API_PKT_NAME_LEN_ERR, 31020 - TCA_WAIT_TIMEOUT, 28017 - TLM_API_DATA_STORE_WAIT_ERR, 28020 - TLM_API_LENGTH_ERR |
( | packet_key | : str | |
packet | : Packet | ||
) | -> None |
Retrieve the Packet definition for the specified key.
The returned packet definition has all of the parameters available for this packet.
[in] | packet_key | The packet key. |
[in,out] | packet | The Packet instance to hold the packet definition if successful. |
TrekError | 28010 - TLM_API_NULL_POINTER, 31123 - TCA_API_NOT_CONNECTED, 28026 - TLM_API_PKT_NAME_LEN_ERR, 31020 - TCA_WAIT_TIMEOUT, 28017 - TLM_API_DATA_STORE_WAIT_ERR, 16008 - DATA_STORE_PACKET_DOES_NOT_EXIST, 28018 - TLM_API_COULD_NOT_LOAD_FILE |
( | ) | -> List[str] |
Gets the list of packet keys currently being processed.
This method returns a list[str] of the active packets in the corresponding TReK Data application.
TrekError | 31123 - TCA_API_NOT_CONNECTED, 31020 - TCA_WAIT_TIMEOUT, 28017 - TLM_API_DATA_STORE_WAIT_ERR, 28022 - TLM_API_FILE_OPEN_ERR |
( | packet_key | : str | |
token | : int | ||
buffer | : bytearray | ||
) | -> int |
Gets a copy of the specified packet from the data store.
If the packet still exists in the buffer with a matching token, it is returned.
[in] | packet_key | The packey key. |
[in] | token | A token value used to determine the packet to return. |
[out] | buffer | A bytes array of sufficient size to hold the packet data. |
( | packet_key | : str | ) | -> None |
Registers a semaphore to be signaled when a packet arrives.
If successful, wait_for_packet() can be called to be notified of the arrival of the next packet.
[in] | packet_key | The packet key to register. |
TrekError | 28010 - TLM_API_NULL_POINTER, 31123 - TCA_API_NOT_CONNECTED, 28026 - TLM_API_PKT_NAME_LEN_ERR, 31020 - TCA_WAIT_TIMEOUT, 28023 - TLM_API_ALREADY_EXISTS, 28017 - TLM_API_DATA_STORE_WAIT_ERR |
( | filename | : str | ) | -> None |
Sets the filename prefix and path used for writing monitor messages if monitor logging is on.
The filename should be the complete path to the file. The file is not created until start_monitor_logging() is called. When the file is created a timestamp is appended to the name and a ".log" extension is added after the timestamp.
[in] | filename | The full path to a file prefix name for logging. |
TrekError | 28010 - TLM_API_NULL_POINTER, 31123 - TCA_API_NOT_CONNECTED, 28019 - TLM_API_FILE_LEN_ERR, 31020 - TCA_WAIT_TIMEOUT |
( | ) | -> None |
Starts the logging of monitor messages.
The filename prefix and path are set via set_monitor_log_file().
TrekError | 28010 - TLM_API_NULL_POINTER, 31123 - TCA_API_NOT_CONNECTED, 31020 - TCA_WAIT_TIMEOUT |
( | ) | -> None |
Stops the logging of monitor messages.
Closes current file in use for monitor messages. Starting logging again will create a new file.
TrekError | 28010 - TLM_API_NULL_POINTER, 31123 - TCA_API_NOT_CONNECTED, 31020 - TCA_WAIT_TIMEOUT |
( | packet_key | : str | ) | -> None |
Unregisters the packet arrival semaphore.
Removes the semaphore from the list of semaphores to be signalled when the specified packet arrives.
[in] | packet_key | The packet key to unregister. |
TrekError | 28010 - TLM_API_NULL_POINTER, 31123 - TCA_API_NOT_CONNECTED, 28026 - TLM_API_PKT_NAME_LEN_ERR, 31020 - TCA_WAIT_TIMEOUT, 28023 - TLM_API_ALREADY_EXISTS, 28017 - TLM_API_DATA_STORE_WAIT_ERR |
( | packet_key | : str | |
timeout | : int | ||
) | -> bool |
Waits for the specified packet to arrive.
Will wait the specified time for a signal that a new packet has arrived. If the method returns SUCCESS, other API calls can be made to retrieve new data.
[in] | packet_key | The awaited packet key. |
[in] | timeout | The number of milliseconds to wait, 0 = infinite. |
TrekError | 28010 - TLM_API_NULL_POINTER, 31123 - TCA_API_NOT_CONNECTED, 28026 - TLM_API_PKT_NAME_LEN_ERR, 31020 - TCA_WAIT_TIMEOUT, 28024 - TLM_API_DOES_NOT_EXIST |