Logo
Telescience Resource Kit
TReK Python  5.4.0 ART
ApiClient Class Reference

Provides common functionality between the Telemetry and Commanding APIs. More...

Inherited by CommandApi, and TelemetryApi.

Public Member Functions

Initialize / Finalize

Functions handling class initialization and destruction.

def ApiClient ( -> None ) -> def 
 Class initializer. More...
 
Connection Handling

Connect to or disconnect from destination or data store.

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

These functions set/get connection timeout behavior.

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

Detailed Description

Provides common functionality between the Telemetry and Commanding APIs.

Use the subclassed TelemetryApi and CommandApi instead.

See also
TelemetryApi
CommandApi

Constructor & Destructor Documentation

◆ ApiClient()

() -> None

Class initializer.

Reimplemented in CommandApi, and TelemetryApi.

Member Function Documentation

◆ cleanse()

() -> None

Cleans up any resources from crashed TReK user programs.

This method can be called at any time. A good practice is to call this method after a successful connect(). This will allow TReK to remove any resources no longer in use.

Exceptions
TrekError31123 - TCA_API_NOT_CONNECTED,

31122 - TCA_WORKER_WAIT_ERR

◆ connect()

(destination : str  ) -> None

Connects this instance of the API to TReK for the specified destination.

This method will allocate the resources necessary to communicate with TReK. When the API connection is no longer needed, disconnect() should be called.

Note
A good practice is to call cleanse() after connecting. See cleanse() for more information.
Parameters
[in]destinationThe name of the destination to connect.
Exceptions
TrekError31111 - TCA_ALREADY_CONNECTED,

31112 - TCA_NAME_LEN_ERROR,

31113 - TCA_LOCAL_MUTEX_CREATE_ERR,

31114 - TCA_OPEN_SERVER_SHM_ERR,

31115 - TCA_OPEN_SERVER_MUTEX_ERR,

31116 - TCA_OPEN_SERVER_SEM_ERR,

31117 - TCA_SERVER_WAIT_ERR,

31118 - TCA_SERVER_SIGNAL_ERR,

31119 - TCA_SESSION_WAIT_ERR,

31120 - TCA_SESSION_REQUEST_FAIL,

31121 - TCA_OPEN_WORKER_SHM_ERR

◆ disconnect()

() -> None

Disconnects from the destination.

Disconnects this instance of the API from TReK. This method will deallocate any resources used for communication.

Exceptions
TrekError31122 - TCA_WORKER_WAIT_ERR

◆ get_wait_timeout()

() -> int

Returns the current timeout value for API calls.

Returns
Timeout in milliseconds

◆ is_connected()

() -> bool

Indicates if the API is connected.

Returns
True, if API is connected

◆ set_wait_timeout()

(timeout : int ) -> None

Sets the timeout value for API calls that require communicating with TReK.

Any method call in this class that requires communication with TReK has a timeout value. This method will set the timeout for all other calls. The timeout should rarely occur and if it does would indicate that another process or thread has locked the command destination in TReK.

Parameters
[in]timeoutTimeout value in milliseconds.