TReK C++
5.3.3
Telemetry/Command API
|
Provides functions that are common to all C++ TReK APIs. More...
#include <api_client.h>
Inherited by trek::CommandApi, and trek::TelemetryApi.
Public Member Functions | |
Setup Methods | |
These methods control setting up the API. | |
int32_t | Connect (const char *name) |
Connects this instance of the API to TReK for the specified destination. More... | |
int32_t | Disconnect () |
Disconnects from the destination. More... | |
General API Methods | |
These methods control the behavior of the API. | |
void | SetWaitTimeout (uint32_t timeout) |
Sets the timeout value for API calls that require communicating with TReK. More... | |
uint32_t | GetWaitTimeout () |
Returns the current timeout value for API calls. More... | |
int32_t | Cleanse () |
Cleans up any resources from crashed user programs. More... | |
bool | IsConnected () |
Returns true if API is connected. More... | |
ApiClient () | |
Default constructor. More... | |
virtual | ~ApiClient () |
Class destructor. More... | |
Provides functions that are common to all C++ TReK APIs.
trek::ApiClient::ApiClient | ( | ) |
Default constructor.
There are no other constructors.
|
virtual |
Class destructor.
Removes all resources created with this instance of the class.
int32_t trek::ApiClient::Cleanse | ( | ) |
Cleans up any resources from crashed user programs.
This method can be called at any time. A good practice is to call this method after a successful Connect call. This will allow TReK to remove any resources that are no longer in use by another user program.
Example:
Longer examples that include this method:
tlm_api_cpp_newest/cpp_newest_main.cpp tlm_api_cpp_next/cpp_next_main.cpp cmd_api_cpp/cmd_api_cpp_main.cpp
int32_t trek::ApiClient::Connect | ( | const char * | name | ) |
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.
[in] | name | The name to connect. |
Example:
Longer examples that include this method:
tlm_api_cpp_newest/cpp_newest_main.cpp tlm_api_cpp_next/cpp_next_main.cpp cmd_api_cpp/cmd_api_cpp_main.cpp
int32_t trek::ApiClient::Disconnect | ( | ) |
Disconnects from the destination.
Disconnects this instance of the API from TReK. This method will deallocate any resources used for communication with TReK.
Example:
Longer examples that include this method:
tlm_api_cpp_newest/cpp_newest_main.cpp tlm_api_cpp_next/cpp_next_main.cpp cmd_api_cpp/cmd_api_cpp_main.cpp
uint32_t trek::ApiClient::GetWaitTimeout | ( | ) |
Returns the current timeout value for API calls.
Return value is in milliseconds.
Example:
Longer examples that include this method:
None
bool trek::ApiClient::IsConnected | ( | ) |
Returns true if API is connected.
Example:
Longer examples that include this method:
None
void trek::ApiClient::SetWaitTimeout | ( | uint32_t | timeout | ) |
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.
[in] | timeout | timeout value in milliseconds |
Example:
Longer examples that include this method:
None