Logo
Telescience Resource Kit
TReK .NET Framework  5.4.0 ART
trek::trek_cmd_user_api Class Reference

This class describes a packet composed of one or more parameters. More...

#include <trek_cmd_user_api_dotnet.h>

Static Public Member Functions

static int Uplink_POIC_Command (System::String^ dest_name_ptr, System::String^ cmd_name_ptr)
 This function sends a request to the POIC that will build the command uplink pattern from the current values stored in the POIC Operational Command Database (OCDB). More...
 
static int Uplink_User_Command (System::String^ dest_name_ptr, System::String^ cmd_name_ptr, array< System::Byte >^ cmd_data_ptr, System::UInt32 len_of_cmd_data)
 This function sends the user provided command to the specified destination. More...
 
static int Add_Header_And_Uplink_Command (System::String^ dest_name_ptr, System::String^ cmd_name_ptr, System::String^ header_name_ptr, array< System::Byte >^ cmd_data_ptr, System::UInt32 len_of_cmd_data)
 This function builds the specified header from the information contained in the TReK database associated with the destination and appends the user provided command data to the header. The resulting bit pattern is sent to the destination. More...
 
static int Build_And_Uplink_Command (System::String^ dest_name_ptr, System::String^ cmd_name_ptr)
 This function builds the uplink pattern from the information contained in the TReK database for this destination. Both the header and command are built and the resulting bit pattern is sent to the destination. More...
 
static int Update_Numeric_Field_Value (FIELD_TYPE field_type, System::String^ dest_name_ptr, System::String^ mnemonic_ptr, System::String^ field_name_ptr, System::Double new_value)
 This function updates a local command or header field value with the specified double precision floating point value. More...
 
static int Update_String_Field_Value (FIELD_TYPE field_type, System::String^ dest_name_ptr, System::String^ mnemonic_ptr, System::String^ field_name_ptr, System::String^ new_value_ptr)
 This function updates a local command or header field value with the specified NULL terminated string value. More...
 
static int Update_Binary_Field_Value (FIELD_TYPE field_type, System::String^ dest_name_ptr, System::String^ mnemonic_ptr, System::String^ field_name_ptr, array< System::Byte >^ new_value_ptr, System::Int32 length)
 This function updates a local command or header field value with the specified binary value. More...
 
static int Update_POIC_Database (FIELD_TYPE field_type, System::String^ dest_name_ptr, System::String^ mnemonic_ptr)
 This function updates the modifiable fields in the POIC database with the contents of the local database for the specified command. More...
 
static int Get_Numeric_Field_Value (FIELD_TYPE field_type, System::String^ dest_name_ptr, System::String^ mnemonic_ptr, System::String^ field_name_ptr, [System::Runtime::InteropServices::Out]System::Double %value_ptr)
 This function gets the current value of a local command or header field. More...
 
static int Get_String_Field_Value (FIELD_TYPE field_type, System::String^ dest_name_ptr, System::String^ mnemonic_ptr, System::String^ field_name_ptr, [System::Runtime::InteropServices::Out]System::Int32 %size_of_data_ptr, [System::Runtime::InteropServices::Out]System::String^ %value_ptr)
 This function gets the current value of a local command or header field. More...
 
static int Get_Binary_Field_Value (FIELD_TYPE field_type, System::String^ dest_name_ptr, System::String^ mnemonic_ptr, System::String^ field_name_ptr, [System::Runtime::InteropServices::Out]System::Int32 %size_of_data_ptr, [System::Runtime::InteropServices::Out]array< System::Byte >^ %value_ptr)
 This function gets the current value of a local command or header field. More...
 
static int Get_POIC_Command_System_Configuration (System::String^ dest_name_ptr, [System::Runtime::InteropServices::Out]POIC_COMMAND_SYSTEM_CONFIGURATION %config_ptr)
 This function retrieves the Command System Configuration message for a destination. This message contains all of the items found in the most recent message received from the POIC. More...
 
static int Get_POIC_Command_System_Status (System::String^ dest_name_ptr, [System::Runtime::InteropServices::Out]POIC_COMMAND_SYSTEM_STATUS %status_ptr)
 This function retrieves the Command System Status message for a destination. This message contains all of the items found in the most recent message received from the POIC. More...
 
static int Get_Command_API_Return_Code_As_String (System::Int32^ error_code, System::Int32^ size_of_data, [System::Runtime::InteropServices::Out]System::String^ %message_ptr)
 This function provides a way to retrieve a string value that corresponds to a Command API integer value return code. More...
 
static int Unblock_Destination (System::String^ dest_name_ptr)
 This function bypasses the built in blocking (i.e., waiting for the appropriate "Clear to Send" message to be returned from the POIC) for a destination in TReK. More...
 
static int Set_Number_Of_Retries (System::String^ dest_name_ptr, System::Int32 num_retries)
 This function sets the number of retries for the POIC system to attempt when sending a command uplink to the MCC-H. More...
 

Detailed Description

This class describes a packet composed of one or more parameters.

The Packet class encapsulates one or more parameters that can be built or extracted. The Packet class has three zones: header, data, and trailer. For the Packet to be considered valid, at least one zone must be populated. Each zone can be populated with a ParameterCollection or another Packet. The example below shows a packet that has all three zones populated. The Header and Trailer zones consist of a parameter collection and the Data zone consists of another Packet which only has two zones populated (Header and Data).

Member Function Documentation

◆ Add_Header_And_Uplink_Command()

int trek::trek_cmd_user_api::Add_Header_And_Uplink_Command ( System::String^  dest_name_ptr,
System::String^  cmd_name_ptr,
System::String^  header_name_ptr,
array< System::Byte >^  cmd_data_ptr,
System::UInt32  len_of_cmd_data 
)
static

This function builds the specified header from the information contained in the TReK database associated with the destination and appends the user provided command data to the header. The resulting bit pattern is sent to the destination.

Note
This is a TReK Release 3 .NET compatible function. The Command GUI can be used to set a flag to allow TReK to behave the same as TReK 3.x with respect to the Add_Header_And_Uplink_Command() function. In TReK 3.x this function required two extra bytes for the checksum. TReK 5.x no longer requires those bytes. The new flag (available on the Preferences dialog in the Command GUI) when turned on will remove those two extra bytes to mimic the TReK 3.x behavior. This will also change the TReK 5.x behavior for the InsertDataAndUplinkCommand() method of the CommandApi class. It should only be used if you are exclusively using the Release 3 compatible API.
Parameters
[in]dest_name_ptrThe name of the destination to send the command.
[in]cmd_name_ptrThe name of the command to request for uplink.
[in]header_name_ptrThe name of the header to build. This header must be in the database for the destination.
[in]cmd_data_ptrThe bit pattern for the command data.
[in]len_of_cmd_dataThe length of the command data bit pattern in bytes.
Returns
SUCCESS
CMD_API_DESTINATION_NOT_FOUND
CMD_API_HEADER_NOT_FOUND
CMD_API_INVALID_LENGTH
CMD_API_USER_DISABLED
CMD_API_MCCH_DISABLED
CMD_API_POIC_DISABLED
CMD_API_REMOTE_USERS_DISABLED
CMD_API_MCCH_HAS_LOS
CMD_API_INVALID_COMMAND_MNEMONIC
CMD_API_INCOMPLETE_HEADER
CMD_API_HEADER_FIELD_TOO_LONG
CMD_API_MNEMONIC_LENGTH_ERROR
CMD_API_THREAD_LOCAL_STORAGE_ERROR
CMD_API_INITIALIZATION_ERROR
CMD_API_WAIT_FAILED
CMD_API_WAIT_ABANDONED
CMD_API_ERROR_ATTACHING_THREAD

Example:

// Don't forget to include the following file
//using trek;
// Don't forget to add the following reference file
//trek_command_dotnet_api;
int return_code = 0; // Return code from TReK API
byte[] cmd_data = new byte[30]; // 30 bytes of command data
string destination = "POIC"; // Set Destination Name as shown in the Command Application
string command_name = "TEST_SWITCH"; // Set Command mnemonic as shown in the Command Application
// For this example set all data to 0 except first 4 bytes.
Array.Clear(cmd_data, 0, cmd_data.Length); //Zero all elements
cmd_data[0] = 0x4A;
cmd_data[1] = 0x65;
cmd_data[2] = 0x66;
cmd_data[3] = 0x66;
//Make call to the command application
return_code = trek_cmd_user_api.Add_Header_And_Uplink_Command(destination, command_name, "header", cmd_data, 30);
//Check return to see if command sent successfully
if (return_code == (int)TREK_CMD_API_RETURN_CODES.cmd_API_SUCCESS)
{
Console.WriteLine("Command successfully sent: {0}");
}
else
{
Console.WriteLine("Error sending command: {0}", return_code);
}
Console.ReadKey();
This class describes a packet composed of one or more parameters.
Definition: trek_cmd_user_api_dotnet.h:642
static int Add_Header_And_Uplink_Command(System::String^ dest_name_ptr, System::String^ cmd_name_ptr, System::String^ header_name_ptr, array< System::Byte >^ cmd_data_ptr, System::UInt32 len_of_cmd_data)
This function builds the specified header from the information contained in the TReK database associa...
Definition: trek_cmd_user_api_dotnet.cpp:99
TREK_CMD_API_RETURN_CODES
Definition: trek_cmd_user_api_dotnet.h:288

◆ Build_And_Uplink_Command()

int trek::trek_cmd_user_api::Build_And_Uplink_Command ( System::String^  dest_name_ptr,
System::String^  cmd_name_ptr 
)
static

This function builds the uplink pattern from the information contained in the TReK database for this destination. Both the header and command are built and the resulting bit pattern is sent to the destination.

Note
This is a TReK Release 3 .NET compatible function.
Parameters
[in]dest_name_ptrThe name of the destination to send the command. This destination must be a POIC type destination.
[in]cmd_name_ptrThe name of the command to build for uplink.
Returns
SUCCESS
CMD_API_DESTINATION_NOT_FOUND
CMD_API_USER_DISABLED
CMD_API_MCCH_DISABLED
CMD_API_POIC_DISABLED
CMD_API_REMOTE_USERS_DISABLED
CMD_API_MCCH_HAS_LOS
CMD_API_INVALID_COMMAND_MNEMONIC
CMD_API_INCOMPLETE_COMMAND
CMD_API_INCOMPLETE_HEADER
CMD_API_MNEMONIC_LENGTH_ERROR
CMD_API_COMMAND_FIELD_TOO_LONG
CMD_API_HEADER_FIELD_TOO_LONG
CMD_API_CALIBRATION_ERROR
CMD_API_CALIBRATED_VALUE_ERROR
CMD_API_VALUE_ERROR
CMD_API_THREAD_LOCAL_STORAGE_ERROR
CMD_API_INITIALIZATION_ERROR
CMD_API_WAIT_FAILED
CMD_API_WAIT_ABANDONED
CMD_API_ERROR_ATTACHING_THREAD

Example:

// Don't forget to include the following file
//using trek;
// Don't forget to add the following reference file
//trek_command_dotnet_api;
int return_code = 0; // Return code from TReK API
string destination = "POIC"; // Set Destination Name as shown in the Command Application
string command_name = "CAMERA_MODE"; // Set Command mnemonic as shown in the Command Application
//Make call to the command application
return_code = trek_cmd_user_api.Build_And_Uplink_Command(destination, command_name);
if (return_code == (int)TREK_CMD_API_RETURN_CODES.cmd_API_SUCCESS)
{
Console.WriteLine( "Command built and uplinked\n" );
}
else
{
Console.WriteLine( "Command uplink error {0}", return_code);
}
Console.ReadKey();
static int Build_And_Uplink_Command(System::String^ dest_name_ptr, System::String^ cmd_name_ptr)
This function builds the uplink pattern from the information contained in the TReK database for this ...
Definition: trek_cmd_user_api_dotnet.cpp:366

◆ Get_Binary_Field_Value()

int trek::trek_cmd_user_api::Get_Binary_Field_Value ( FIELD_TYPE  field_type,
System::String^  dest_name_ptr,
System::String^  mnemonic_ptr,
System::String^  field_name_ptr,
[System::Runtime::InteropServices::Out] System::Int32 %  size_of_data_ptr,
[System::Runtime::InteropServices::Out] array< System::Byte >^ %  value_ptr 
)
static

This function gets the current value of a local command or header field.

The command or header must be defined in the database associated with the destination. This function is used to data that cannot be represented as a number or string.

Note
This is a TReK Release 3 ANSI-C compatible function.
Parameters
[in]field_typeEither COMMAND_FIELD or HEADER_FIELD.
[in]dest_name_ptrThe name of the destination to get the command or header.
[in]mnemonic_ptrThe name of the command or header.
[in]field_name_ptrThe name of the field to retrieve the current value for.
[in]size_of_data_ptrThe size of data allocated by the calling program in bytes. You must specify enough space for the data to be copied.
[out]value_ptrThe returned value for the command or header field.
Returns
SUCCESS
CMD_API_NULL_POINTER
CMD_API_ILLEGAL_FIELD_TYPE
CMD_API_DESTINATION_NOT_FOUND
CMD_API_COMMAND_NOT_FOUND
CMD_API_HEADER_NOT_FOUND
CMD_API_FIELD_NOT_FOUND
CMD_API_DATA_TYPE_IS_BINARY
CMD_API_DATA_TYPE_IS_NUMERIC
CMD_API_THREAD_LOCAL_STORAGE_ERROR
CMD_API_WAIT_FAILED
CMD_API_WAIT_ABANDONED
CMD_API_ERROR_ATTACHING_THREAD

Example:

// Don't forget to include the following file
//using trek;
// Don't forget to add the following reference file
//trek_command_dotnet_api;
int return_code = 0; // Return code from TReK API
string String_Field_Value; // value_ptr for Get_String_Field_Value
byte[] Binary_Field_Value = new byte [20]; // value_ptr for Get_Binary_Field_Value
Int32 size_of_data = 20;
// First get a command field value
return_code = trek_cmd_user_api.Get_Binary_Field_Value(FIELD_TYPE.Command_Field, "POIC", "my_command", "field1", out size_of_data, out Binary_Field_Value);
//Check return to see if command sent successfully
if (return_code == (int)TREK_CMD_API_RETURN_CODES.cmd_API_SUCCESS)
{
Console.WriteLine("COmmand field value is {0:X}", Binary_Field_Value[0]);
}
else
{
Console.WriteLine("Error: {0}", return_code);
}
// Now get a binary field value
return_code = trek_cmd_user_api.Get_Binary_Field_Value(FIELD_TYPE.Header_Field, "POIC", "my_header", "field4", out size_of_data, out Binary_Field_Value);
//Check return to see if command sent successfully
if (return_code == (int)TREK_CMD_API_RETURN_CODES.cmd_API_SUCCESS)
{
Console.WriteLine("Header field value is {0:X} ", Binary_Field_Value[0]);
}
else
{
Console.WriteLine("Error: {0}", return_code);
}
Console.ReadKey();
static int Get_Binary_Field_Value(FIELD_TYPE field_type, System::String^ dest_name_ptr, System::String^ mnemonic_ptr, System::String^ field_name_ptr, [System::Runtime::InteropServices::Out]System::Int32 %size_of_data_ptr, [System::Runtime::InteropServices::Out]array< System::Byte >^ %value_ptr)
This function gets the current value of a local command or header field.
Definition: trek_cmd_user_api_dotnet.cpp:1178

◆ Get_Command_API_Return_Code_As_String()

int trek::trek_cmd_user_api::Get_Command_API_Return_Code_As_String ( System::Int32^  error_code,
System::Int32^  size_of_data,
[System::Runtime::InteropServices::Out] System::String^ %  message_ptr 
)
static

This function provides a way to retrieve a string value that corresponds to a Command API integer value return code.

The user must allocate memory for the string.

Note
This is a TReK Release 3 ANSI-C compatible function.
Parameters
[in]error_codeReturned from a call to another TReK Command API function.
[in]size_of_dataThe size of data allocated. Should be at least 70 bytes.
[out]message_ptrThe returned message string.
Returns
SUCCESS
CMD_API_NULL_POINTER
CMD_API_NOT_ENOUGH_SPACE
CMD_API_INVALID_API_RETURN_CODE
CMD_API_THREAD_LOCAL_STORAGE_ERROR
CMD_API_WAIT_FAILED
CMD_API_WAIT_ABANDONED
CMD_API_ERROR_ATTACHING_THREAD

Example:

// Don't forget to include the following file
//using trek;
// Don't forget to add the following reference file
//trek_command_dotnet_api;
int update_return;
int return_code = 0;
byte[] value1 = new byte[2];
byte[] value2 = new byte[4];
string message;
// update a command field
value1[0] = 0x02;
value1[1] = 0x3f;
//get a command field value
update_return = trek_cmd_user_api.Update_Binary_Field_Value(FIELD_TYPE.Command_Field,
"POIC",
"my_command",
"field1",
value1,
2);
//Check return to see if command sent successfully
if (update_return == (int)TREK_CMD_API_RETURN_CODES.cmd_API_SUCCESS)
{
Console.WriteLine("Command field value is {0}", value1);
}
else
{
Console.WriteLine("Error: {0}", update_return);
}
//now print return_code
return_code = trek_cmd_user_api.Get_Command_API_Return_Code_As_String(update_return,
70,
out message);
//Check return to see if command sent successfully
if (return_code == (int)TREK_CMD_API_RETURN_CODES.cmd_API_SUCCESS)
{
Console.WriteLine("Message is {0} ", message);
}
else
{
Console.WriteLine("Error: {0}", return_code);
}
Console.ReadKey();
static int Update_Binary_Field_Value(FIELD_TYPE field_type, System::String^ dest_name_ptr, System::String^ mnemonic_ptr, System::String^ field_name_ptr, array< System::Byte >^ new_value_ptr, System::Int32 length)
This function updates a local command or header field value with the specified binary value.
Definition: trek_cmd_user_api_dotnet.cpp:723

◆ Get_Numeric_Field_Value()

int trek::trek_cmd_user_api::Get_Numeric_Field_Value ( FIELD_TYPE  field_type,
System::String^  dest_name_ptr,
System::String^  mnemonic_ptr,
System::String^  field_name_ptr,
[System::Runtime::InteropServices::Out] System::Double %  value_ptr 
)
static

This function gets the current value of a local command or header field.

The command or header must be defined in the database associated with the destination. This function is used to get all numeric data, including integers and unsigned integers.

Note
This is a TReK Release 3 .NET compatible function.
Parameters
[in]field_typeEither COMMAND_FIELD or HEADER_FIELD.
[in]dest_name_ptrThe name of the destination to get the command or header.
[in]mnemonic_ptrThe name of the command or header.
[in]field_name_ptrThe name of the field to retrieve the current value for.
[out]value_ptrThe returned value for the command or header field.
Returns
SUCCESS
CMD_API_ILLEGAL_FIELD_TYPE
CMD_API_DESTINATION_NOT_FOUND
CMD_API_COMMAND_NOT_FOUND
CMD_API_HEADER_NOT_FOUND
CMD_API_FIELD_NOT_FOUND
CMD_API_DATA_TYPE_IS_BINARY
CMD_API_DATA_TYPE_IS_STRING
CMD_API_THREAD_LOCAL_STORAGE_ERROR
CMD_API_INITIALIZATION_ERROR
CMD_API_WAIT_FAILED
CMD_API_WAIT_ABANDONED
CMD_API_ERROR_ATTACHING_THREAD

Example:

// Don't forget to include the following file
//using trek;
// Don't forget to add the following reference file
//trek_command_dotnet_api;
int return_code = 0; // Return code from TReK API
double value;
// First get a command field value
return_code = trek_cmd_user_api.Get_Numeric_Field_Value(FIELD_TYPE.Command_Field, "POIC", "my_command", "field1", out value);
//Check return to see if command sent successfully
if (return_code == (int)TREK_CMD_API_RETURN_CODES.cmd_API_SUCCESS)
{
Console.WriteLine("Command field value is {0}", value);
}
else
{
Console.WriteLine("Error: {0}", return_code);
}
// Now get a binary field value
return_code = trek_cmd_user_api.Get_Numeric_Field_Value(FIELD_TYPE.Header_Field, "POIC", "my_header", "field4", out value);
//Check return to see if command sent successfully
if (return_code == (int)TREK_CMD_API_RETURN_CODES.cmd_API_SUCCESS)
{
Console.WriteLine("Header field value is {0} ", value);
}
else
{
Console.WriteLine("Error: {0}", return_code);
}
Console.ReadKey();
static int Get_Numeric_Field_Value(FIELD_TYPE field_type, System::String^ dest_name_ptr, System::String^ mnemonic_ptr, System::String^ field_name_ptr, [System::Runtime::InteropServices::Out]System::Double %value_ptr)
This function gets the current value of a local command or header field.
Definition: trek_cmd_user_api_dotnet.cpp:928

◆ Get_POIC_Command_System_Configuration()

int trek::trek_cmd_user_api::Get_POIC_Command_System_Configuration ( System::String^  dest_name_ptr,
[System::Runtime::InteropServices::Out] POIC_COMMAND_SYSTEM_CONFIGURATION %  config_ptr 
)
static

This function retrieves the Command System Configuration message for a destination. This message contains all of the items found in the most recent message received from the POIC.

Note
This is a TReK Release 3 .NET compatible function.
Parameters
[in]dest_name_ptrThe name of the destination. This destination must be a POIC type destination.
[out]config_ptrA structure defined in trek_cmd_user_api.h. You must have allocated memory for this variable before calling the function.
Returns
SUCCESS
CMD_API_DESTINATION_NOT_FOUND
CMD_API_ILLEGAL_DESTINATION_TYPE
CMD_API_THREAD_LOCAL_STORAGE_ERROR
CMD_API_INITIALIZATION_ERROR
CMD_API_WAIT_FAILED
CMD_API_WAIT_ABANDONED
CMD_API_ERROR_ATTACHING_THREAD

Example:

// Don't forget to include the following file
//using trek;
// Don't forget to add the following reference file
//trek_command_dotnet_api;
int return_code = 0; // Return code from TReK API
string destination = "POIC"; // Set Destination Name as shown in the Command Application
POIC_COMMAND_SYSTEM_CONFIGURATION config;
//Make call to the command application
return_code = trek_cmd_user_api.Get_POIC_Command_System_Configuration(destination, out config);
//Check return to see if command sent successfully
if (return_code == (int)TREK_CMD_API_RETURN_CODES.cmd_API_SUCCESS)
{
Console.WriteLine("Received Configuration");
}
else
{
Console.WriteLine("Error: {0}", return_code);
}
Console.ReadKey();
static int Get_POIC_Command_System_Configuration(System::String^ dest_name_ptr, [System::Runtime::InteropServices::Out]POIC_COMMAND_SYSTEM_CONFIGURATION %config_ptr)
This function retrieves the Command System Configuration message for a destination....
Definition: trek_cmd_user_api_dotnet.cpp:1426

◆ Get_POIC_Command_System_Status()

int trek::trek_cmd_user_api::Get_POIC_Command_System_Status ( System::String^  dest_name_ptr,
[System::Runtime::InteropServices::Out] POIC_COMMAND_SYSTEM_STATUS %  status_ptr 
)
static

This function retrieves the Command System Status message for a destination. This message contains all of the items found in the most recent message received from the POIC.

Note
This is a TReK Release 3 .NET compatible function.
Parameters
[in]dest_name_ptrThe name of the destination. This destination must be a POIC type destination.
[out]status_ptrA structure defined in trek_cmd_user_api.h. You must have allocated memory for this variable before calling the function.
Returns
SUCCESS
CMD_API_DESTINATION_NOT_FOUND
CMD_API_ILLEGAL_DESTINATION_TYPE
CMD_API_THREAD_LOCAL_STORAGE_ERROR
CMD_API_INITIALIZATION_ERROR
CMD_API_WAIT_FAILED
CMD_API_WAIT_ABANDONED
CMD_API_ERROR_ATTACHING_THREAD

Example:

// Don't forget to include the following file
//using trek;
// Don't forget to add the following reference file
//trek_command_dotnet_api;
int return_code = 0; // Return code from TReK API
string destination = "POIC"; // Set Destination Name as shown in the Command Application
POIC_COMMAND_SYSTEM_STATUS status; //System Status
//Make call to the command application
return_code = trek_cmd_user_api.Get_POIC_Command_System_Status(destination, out status);
//Check return to see if command sent successfully
if (return_code == (int)TREK_CMD_API_RETURN_CODES.cmd_API_SUCCESS)
{
Console.WriteLine("Received Status");
}
else
{
Console.WriteLine("Error: {0}", return_code);
}
Console.ReadKey();
static int Get_POIC_Command_System_Status(System::String^ dest_name_ptr, [System::Runtime::InteropServices::Out]POIC_COMMAND_SYSTEM_STATUS %status_ptr)
This function retrieves the Command System Status message for a destination. This message contains al...
Definition: trek_cmd_user_api_dotnet.cpp:1515

◆ Get_String_Field_Value()

int trek::trek_cmd_user_api::Get_String_Field_Value ( FIELD_TYPE  field_type,
System::String^  dest_name_ptr,
System::String^  mnemonic_ptr,
System::String^  field_name_ptr,
[System::Runtime::InteropServices::Out] System::Int32 %  size_of_data_ptr,
[System::Runtime::InteropServices::Out] System::String^ %  value_ptr 
)
static

This function gets the current value of a local command or header field.

The command or header must be defined in the database associated with the destination. This function is used to get all string values.

Note
This is a TReK Release 3 ANSI-C compatible function.
Parameters
[in]field_typeEither COMMAND_FIELD or HEADER_FIELD.
[in]dest_name_ptrThe name of the destination to get the command or header.
[in]mnemonic_ptrThe name of the command or header.
[in]field_name_ptrThe name of the field to retrieve the current value for.
[in]size_of_data_ptrThe size of data allocated by the calling program in bytes. You must specify enough space for the data to be copied.
[out]value_ptrThe returned value for the command or header field.
Returns
SUCCESS
CMD_API_NULL_POINTER
CMD_API_ILLEGAL_FIELD_TYPE
CMD_API_DESTINATION_NOT_FOUND
CMD_API_COMMAND_NOT_FOUND
CMD_API_HEADER_NOT_FOUND
CMD_API_FIELD_NOT_FOUND
CMD_API_DATA_TYPE_IS_BINARY
CMD_API_DATA_TYPE_IS_NUMERIC
CMD_API_THREAD_LOCAL_STORAGE_ERROR
CMD_API_WAIT_FAILED
CMD_API_WAIT_ABANDONED
CMD_API_ERROR_ATTACHING_THREAD

Example:

// Don't forget to include the following file
//using trek;
// Don't forget to add the following reference file
//trek_command_dotnet_api;
int return_code = 0; // Return code from TReK API
//string String_Field_Value; // value_ptr for Get_String_Field_Value
char [] String_Field_Value = new char [20]; // value_ptr for Get_String_Field_Value
string value = Convert.ToString(String_Field_Value); // convert value to string
Int32 size_of_data = 20;
// First get a command field value
return_code = trek_cmd_user_api.Get_String_Field_Value(FIELD_TYPE.Command_Field, "POIC", "my_command", "field1", out size_of_data, out value);
//Check return to see if command sent successfully
if (return_code == (int)TREK_CMD_API_RETURN_CODES.cmd_API_SUCCESS)
{
Console.WriteLine("Command field value is {0}", value);
}
else
{
Console.WriteLine("Error: {0}", return_code);
}
// Now get a string field value
return_code = trek_cmd_user_api.Get_String_Field_Value(FIELD_TYPE.Header_Field, "POIC", "my_header", "field4", out size_of_data, out value);
//Check return to see if command sent successfully
if (return_code == (int)TREK_CMD_API_RETURN_CODES.cmd_API_SUCCESS)
{
Console.WriteLine("Header field value is {0} ", value);
}
else
{
Console.WriteLine("Error: {0}", return_code);
}
Console.ReadKey();
static int Get_String_Field_Value(FIELD_TYPE field_type, System::String^ dest_name_ptr, System::String^ mnemonic_ptr, System::String^ field_name_ptr, [System::Runtime::InteropServices::Out]System::Int32 %size_of_data_ptr, [System::Runtime::InteropServices::Out]System::String^ %value_ptr)
This function gets the current value of a local command or header field.
Definition: trek_cmd_user_api_dotnet.cpp:1052

◆ Set_Number_Of_Retries()

int trek::trek_cmd_user_api::Set_Number_Of_Retries ( System::String^  dest_name_ptr,
System::Int32  num_retries 
)
static

This function sets the number of retries for the POIC system to attempt when sending a command uplink to the MCC-H.

This value will be checked whenever a new Command System Configuration message is received for the destination. If the current value set with this function exceeds the maximum number of retries specified in the Command System Configuration message, it will be reset to the value in the Command System Configuration message.

Note
This is a TReK Release 3 .NET compatible function.
Parameters
[in]dest_name_ptrThe name of the destination to change the number of retries.
[in]num_retriesNew number of retries.
Returns
SUCCESS
CMD_API_DESTINATION_NOT_FOUND
CMD_API_ILLEGAL_DESTINATION_TYPE
CMD_API_NUMBER_RETRIES_TOO_LARGE
CMD_API_NUMBER_RETRIES_TOO_SMALL
CMD_API_THREAD_LOCAL_STORAGE_ERROR
CMD_API_INITIALIZATION_ERROR
CMD_API_WAIT_FAILED
CMD_API_WAIT_ABANDONED
CMD_API_ERROR_ATTACHING_THREAD

Example:

// Don't forget to include the following file
//using trek;
// Don't forget to add the following reference file
//trek_command_dotnet_api;
int return_code = 0; // Return code from TReK API
string destination = "POIC"; // Set Destination Name as shown in the Command Application
int num_retries = 2;
//Make call to the command application
return_code = trek_cmd_user_api.Set_Number_Of_Retries(destination, num_retries);
//Check return to see if command sent successfully
if (return_code == (int)TREK_CMD_API_RETURN_CODES.cmd_API_SUCCESS)
{
Console.WriteLine("Command successfully sent: {0}");
}
else
{
Console.WriteLine("Error sending command: {0}", return_code);
}
Console.ReadKey();
static int Set_Number_Of_Retries(System::String^ dest_name_ptr, System::Int32 num_retries)
This function sets the number of retries for the POIC system to attempt when sending a command uplink...
Definition: trek_cmd_user_api_dotnet.cpp:1787

◆ Unblock_Destination()

int trek::trek_cmd_user_api::Unblock_Destination ( System::String^  dest_name_ptr)
static

This function bypasses the built in blocking (i.e., waiting for the appropriate "Clear to Send" message to be returned from the POIC) for a destination in TReK.

It can be safely called for any destination type, but is really only applicable to POIC and TReK destinations. Since this function bypasses the blocking in TReK necessary to meet defined interfaces, the POIC destination may not accept further requests (e.g., command uplinks). This function should only be used as a means to resolve potential interface problems between the POIC and TReK when all other options have been exhausted.

Note
This is a TReK Release 3 .NET compatible function.
Parameters
[in]dest_name_ptrThe name of the destination to unblock.
Returns
SUCCESS
CMD_API_DESTINATION_NOT_FOUND
CMD_API_THREAD_LOCAL_STORAGE_ERROR
CMD_API_INITIALIZATION_ERROR
CMD_API_WAIT_FAILED
CMD_API_WAIT_ABANDONED
CMD_API_ERROR_ATTACHING_THREAD

Example:

// Don't forget to include the following file
//using trek;
// Don't forget to add the following reference file
//trek_command_dotnet_api;
int return_code = 0; // Return code from TReK API
string destination = "POIC"; // Set Destination Name as shown in the Command Application
// update command in destination database
return_code = trek_cmd_user_api.Unblock_Destination(destination);
//Check return to see if command sent successfully
if (return_code == (int)TREK_CMD_API_RETURN_CODES.cmd_API_SUCCESS)
{
Console.WriteLine("Command updated in destination database");
}
else
{
Console.WriteLine("Error sending command: {0}", return_code);
}
Console.ReadKey();
static int Unblock_Destination(System::String^ dest_name_ptr)
This function bypasses the built in blocking (i.e., waiting for the appropriate "Clear to Send" messa...
Definition: trek_cmd_user_api_dotnet.cpp:1715

◆ Update_Binary_Field_Value()

int trek::trek_cmd_user_api::Update_Binary_Field_Value ( FIELD_TYPE  field_type,
System::String^  dest_name_ptr,
System::String^  mnemonic_ptr,
System::String^  field_name_ptr,
array< System::Byte >^  new_value_ptr,
System::Int32  length 
)
static

This function updates a local command or header field value with the specified binary value.

The command or header must be defined in the database associated with the destination. Note: For fixed length fields, if you attempt to store less than the expected number of bytes, the data will be right justified. The remaining bytes of the field will be set to zero.

Note
This is a TReK Release 3 .NET compatible function.
Parameters
[in]field_typeEither COMMAND_FIELD or HEADER_FIELD.
[in]dest_name_ptrThe name of the destination to update the command or header.
[in]mnemonic_ptrThe name of the command or header.
[in]field_name_ptrThe name of the field to update.
[in]new_value_ptrNew binary data for field value.
[in]lengthThe number of bytes of data for new_value_ptr.
Returns
SUCCESS
CMD_API_ILLEGAL_FIELD_TYPE
CMD_API_DESTINATION_NOT_FOUND
CMD_API_COMMAND_NOT_FOUND
CMD_API_HEADER_NOT_FOUND
CMD_API_FIELD_NOT_FOUND
CMD_API_FIELD_NOT_MODIFIABLE
CMD_API_EXPECTED_STRING_DATA_TYPE
CMD_API_EXPECTED_NUMERIC_DATA_TYPE
CMD_API_NOT_ENOUGH_SPACE
CMD_API_INVALID_LENGTH
CMD_API_THREAD_LOCAL_STORAGE_ERROR
CMD_API_INITIALIZATION_ERROR
CMD_API_WAIT_FAILED
CMD_API_WAIT_ABANDONED
CMD_API_ERROR_ATTACHING_THREAD

Example:

// Don't forget to include the following file
//using trek;
// Don't forget to add the following reference file
//trek_command_dotnet_api;
int return_code = 0;
byte[] value1 = new byte[2];
byte[] value2 = new byte[4];
// update a command field
value1[0] = 0x02;
value1[1] = 0x3f;
//get a command field value
return_code = trek_cmd_user_api.Update_Binary_Field_Value(FIELD_TYPE.Command_Field,
"POIC",
"my_command",
"field1",
value1,
2);
//Check return to see if command sent successfully
if (return_code == (int)TREK_CMD_API_RETURN_CODES.cmd_API_SUCCESS)
{
Console.WriteLine("Command field value is {0}", value1);
}
else
{
Console.WriteLine("Error: {0}", return_code);
}
//update a header field
value2[0] = 0x2d;
value2[1] = 0xff;
value2[2] = 0x9f;
value2[3] = 0x00;
return_code = trek_cmd_user_api.Update_Binary_Field_Value(FIELD_TYPE.Header_Field,
"POIC",
"my_header",
"field4",
value2,
4);
//Check return to see if command sent successfully
if (return_code == (int)TREK_CMD_API_RETURN_CODES.cmd_API_SUCCESS)
{
Console.WriteLine("Header field value is {0} ", value2);
}
else
{
Console.WriteLine("Error: {0}", return_code);
}
Console.ReadKey();

◆ Update_Numeric_Field_Value()

int trek::trek_cmd_user_api::Update_Numeric_Field_Value ( FIELD_TYPE  field_type,
System::String^  dest_name_ptr,
System::String^  mnemonic_ptr,
System::String^  field_name_ptr,
System::Double  new_value 
)
static

This function updates a local command or header field value with the specified double precision floating point value.

The command or header must be defined in the database associated with the destination. This function is used to update all numeric data, including integers and unsigned integers. This function allows the numeric fields to be updated as floating point numbers. If the uplink data type for the field is an integer, the value will be truncated when added to the uplink packet.

Note
This is a TReK Release 3 .NET compatible function.
Parameters
[in]field_typeEither COMMAND_FIELD or HEADER_FIELD.
[in]dest_name_ptrThe name of the destination to update the command or header.
[in]mnemonic_ptrThe name of the command or header.
[in]field_name_ptrThe name of the field to update.
[in]new_valueThe new value for the command or header field.
Returns
SUCCESS
CMD_API_ILLEGAL_FIELD_TYPE
CMD_API_DESTINATION_NOT_FOUND
CMD_API_COMMAND_NOT_FOUND
CMD_API_HEADER_NOT_FOUND
CMD_API_FIELD_NOT_FOUND
CMD_API_FIELD_NOT_MODIFIABLE
CMD_API_EXPECTED_BINARY_DATA_TYPE
CMD_API_EXPECTED_STRING_DATA_TYPE
CMD_API_VALUE_LESS_THAN_LOW_RANGE
CMD_API_VALUE_GREATER_THAN_HIGH_RANGE
CMD_API_THREAD_LOCAL_STORAGE_ERROR
CMD_API_INITIALIZATION_ERROR
CMD_API_WAIT_FAILED
CMD_API_WAIT_ABANDONED
CMD_API_ERROR_ATTACHING_THREAD

Example:

// Don't forget to include the following file
//using trek;
// Don't forget to add the following reference file
//trek_command_dotnet_api;
int return_code = 0;
double value1 = 5.3;
double value2 = 6.0;
// update command field
return_code = trek_cmd_user_api.Update_Numeric_Field_Value(FIELD_TYPE.Command_Field, "POIC", "my_command", "field1", value1);
//Check return to see if command sent successfully
if (return_code == (int)TREK_CMD_API_RETURN_CODES.cmd_API_SUCCESS)
{
Console.WriteLine("Command field updated\n");
}
else
{
Console.WriteLine("Error: {0}", return_code);
}
// Now update header field
return_code = trek_cmd_user_api.Update_Numeric_Field_Value(FIELD_TYPE.Header_Field, "POIC", "my_header", "field4", value2);
//Check return to see if command sent successfully
if (return_code == (int)TREK_CMD_API_RETURN_CODES.cmd_API_SUCCESS)
{
Console.WriteLine("Header field updated\n");
}
else
{
Console.WriteLine("Error: {0}", return_code);
}
Console.ReadKey();
static int Update_Numeric_Field_Value(FIELD_TYPE field_type, System::String^ dest_name_ptr, System::String^ mnemonic_ptr, System::String^ field_name_ptr, System::Double new_value)
This function updates a local command or header field value with the specified double precision float...
Definition: trek_cmd_user_api_dotnet.cpp:492

◆ Update_POIC_Database()

int trek::trek_cmd_user_api::Update_POIC_Database ( FIELD_TYPE  field_type,
System::String^  dest_name_ptr,
System::String^  mnemonic_ptr 
)
static

This function updates the modifiable fields in the POIC database with the contents of the local database for the specified command.

Note
This is a TReK Release 3 .NET compatible function.
Parameters
[in]field_typeMust be COMMAND_FIELD
[in]dest_name_ptrThe name of the destination to update the command.
[in]mnemonic_ptrThe name of the command.
Returns
SUCCESS
CMD_API_ILLEGAL_FIELD_TYPE
CMD_API_MNEMONIC_LENGTH_ERROR
CMD_API_DESTINATION_NOT_FOUND
CMD_API_COMMAND_NOT_FOUND
CMD_API_FIELD_NOT_FOUND
CMD_API_HEADER_NOT_FOUND
CMD_API_ILLEGAL_DESTINATION_TYPE
CMD_API_INCOMPLETE_COMMAND
CMD_API_THREAD_LOCAL_STORAGE_ERROR
CMD_API_INITIALIZATION_ERROR
CMD_API_WAIT_FAILED
CMD_API_WAIT_ABANDONED
CMD_API_ERROR_ATTACHING_THREAD

Example:

// Don't forget to include the following file
//using trek;
// Don't forget to add the following reference file
//trek_command_dotnet_api;
// Update Command Destination Database
return_code = trek_cmd_user_api.Update_POIC_Database(FIELD_TYPE.Command_Field, "POIC","my_command");
//Check return to see if command sent successfully
if (return_code == (int)TREK_CMD_API_RETURN_CODES.cmd_API_SUCCESS)
{
Console.WriteLine("Command updated in destination database");
}
else
{
Console.WriteLine("Update Error: {0}", return_code);
}
Console.ReadKey();
static int Update_POIC_Database(FIELD_TYPE field_type, System::String^ dest_name_ptr, System::String^ mnemonic_ptr)
This function updates the modifiable fields in the POIC database with the contents of the local datab...
Definition: trek_cmd_user_api_dotnet.cpp:835

◆ Update_String_Field_Value()

int trek::trek_cmd_user_api::Update_String_Field_Value ( FIELD_TYPE  field_type,
System::String^  dest_name_ptr,
System::String^  mnemonic_ptr,
System::String^  field_name_ptr,
System::String^  new_value_ptr 
)
static

This function updates a local command or header field value with the specified NULL terminated string value.

The command or header must be defined in the database associated with the destination.

Note
This is a TReK Release 3 .NET compatible function.
Parameters
[in]field_typeEither COMMAND_FIELD or HEADER_FIELD.
[in]dest_name_ptrThe name of the destination to update the command or header.
[in]mnemonic_ptrThe name of the command or header.
[in]field_name_ptrThe name of the field to update.
[in]new_value_ptrNew NULL terminated string value for the command or header field.
Returns
SUCCESS
CMD_API_ILLEGAL_FIELD_TYPE
CMD_API_DESTINATION_NOT_FOUND
CMD_API_COMMAND_NOT_FOUND
CMD_API_HEADER_NOT_FOUND
CMD_API_FIELD_NOT_FOUND
CMD_API_FIELD_NOT_MODIFIABLE
CMD_API_EXPECTED_BINARY_DATA_TYPE
CMD_API_EXPECTED_NUMERIC_DATA_TYPE
CMD_API_NOT_ENOUGH_SPACE
CMD_API_INVALID_LENGTH
CMD_API_THREAD_LOCAL_STORAGE_ERROR
CMD_API_INITIALIZATION_ERROR
CMD_API_WAIT_FAILED
CMD_API_WAIT_ABANDONED
CMD_API_ERROR_ATTACHING_THREAD

Example:

// Don't forget to include the following file
//using trek;
// Don't forget to add the following reference file
//trek_command_dotnet_api;
int return_code = 0;
// update command field
return_code = trek_cmd_user_api.Update_String_Field_Value(FIELD_TYPE.Command_Field, "POIC", "my_command", "field1", "");
//Check return to see if command sent successfully
if (return_code == (int)TREK_CMD_API_RETURN_CODES.cmd_API_SUCCESS)
{
Console.WriteLine("Command field updated");
}
else
{
Console.WriteLine("Error: {0}", return_code);
}
// Now update header field
return_code = trek_cmd_user_api.Update_String_Field_Value(FIELD_TYPE.Header_Field, "POIC", "my_header", "field4", "hello world");
//Check return to see if command sent successfully
if (return_code == (int)TREK_CMD_API_RETURN_CODES.cmd_API_SUCCESS)
{
Console.WriteLine("Header field updated");
}
else
{
Console.WriteLine("Error: {0}", return_code);
}
Console.ReadKey();
static int Update_String_Field_Value(FIELD_TYPE field_type, System::String^ dest_name_ptr, System::String^ mnemonic_ptr, System::String^ field_name_ptr, System::String^ new_value_ptr)
This function updates a local command or header field value with the specified NULL terminated string...
Definition: trek_cmd_user_api_dotnet.cpp:593

◆ Uplink_POIC_Command()

int trek::trek_cmd_user_api::Uplink_POIC_Command ( System::String^  dest_name_ptr,
System::String^  cmd_name_ptr 
)
static

This function sends a request to the POIC that will build the command uplink pattern from the current values stored in the POIC Operational Command Database (OCDB).

Note
This is a TReK Release 3 .NET compatible function.
Parameters
[in]dest_name_ptrThe name of the destination to send the command. This destination must be a POIC type destination.
[in]cmd_name_ptrThe name of the command to request for uplink.
Returns
SUCCESS
CMD_API_DESTINATION_NOT_FOUND
CMD_API_USER_DISABLED
CMD_API_MCCH_DISABLED
CMD_API_POIC_DISABLED
CMD_API_REMOTE_USERS_DISABLED
CMD_API_MCCH_HAS_LOS
CMD_API_INVALID_COMMAND_MNEMONIC
CMD_API_MNEMONIC_LENGTH_ERROR
CMD_API_THREAD_LOCAL_STORAGE_ERROR
CMD_API_INITIALIZATION_ERROR
CMD_API_WAIT_FAILED
CMD_API_WAIT_ABANDONED
CMD_API_ERROR_ATTACHING_THREAD

Example:

// Don't forget to include the following file
//using trek;
// Don't forget to add the following reference file
//trek_command_dotnet_api;
int return_code = 0; // Return code from TReK API
string destination = "POIC"; // Set Destination Name as shown in the Command Application
string command_name = "TEST_SWITCH"; // Set Command mnemonic as shown in the Command Application
//Make call to the command application
return_code = trek_cmd_user_api.Uplink_POIC_Command(destination, command_name);
//Check return to see if command sent successfully
if (return_code == (int)TREK_CMD_API_RETURN_CODES.cmd_API_SUCCESS)
{
Console.WriteLine("Command successfully sent: {0}", return_code);
}
else
Console.WriteLine("Error sending command: {0}", return_code);
Console.ReadKey();
static int Uplink_POIC_Command(System::String^ dest_name_ptr, System::String^ cmd_name_ptr)
This function sends a request to the POIC that will build the command uplink pattern from the current...
Definition: trek_cmd_user_api_dotnet.cpp:187

◆ Uplink_User_Command()

int trek::trek_cmd_user_api::Uplink_User_Command ( System::String^  dest_name_ptr,
System::String^  cmd_name_ptr,
array< System::Byte >^  cmd_data_ptr,
System::UInt32  len_of_cmd_data 
)
static

This function sends the user provided command to the specified destination.

Note
This is a TReK Release 3 .NET compatible function.
Parameters
[in]dest_name_ptrThe name of the destination to send the command.
[in]cmd_name_ptrThe name of the command to request for uplink.
[in]cmd_data_ptrThe entire bit pattern for the command. This includes any headers and checksum.
[in]len_of_cmd_dataThe length of the bit pattern to uplink in bytes.
Returns
SUCCESS
CMD_API_DESTINATION_NOT_FOUND
CMD_API_INVALID_LENGTH
CMD_API_USER_DISABLED
CMD_API_MCCH_DISABLED
CMD_API_POIC_DISABLED
CMD_API_REMOTE_USERS_DISABLED
CMD_API_MCCH_HAS_LOS
CMD_API_INVALID_COMMAND_MNEMONIC
CMD_API_MNEMONIC_LENGTH_ERROR
CMD_API_THREAD_LOCAL_STORAGE_ERROR
CMD_API_INITIALIZATION_ERROR
CMD_API_WAIT_FAILED
CMD_API_WAIT_ABANDONED
CMD_API_ERROR_ATTACHING_THREAD

Example:

// Don't forget to include the following file
//using trek;
// Don't forget to add the following reference file
//trek_command_dotnet_api;
int return_code = 0; // Return code from TReK API
byte[] cmd_data = new byte[40]; //a 40-byte command
string destination = "POIC"; // Set Destination Name as shown in the Command Application
string command_name = "CAMERA_MODE"; // Set Command mnemonic as shown in the Command Application
//For this example set all data to 0 except first 4 bytes
Array.Clear(cmd_data, 0, cmd_data.Length); //Zero all elements
cmd_data[0] = 0x4A;
cmd_data[1] = 0x65;
cmd_data[2] = 0x66;
cmd_data[3] = 0x66;
//Make call to the command application
return_code = trek_cmd_user_api.Uplink_User_Command(destination, command_name, cmd_data, 40);
//Check return to see if command sent successfully
if (return_code == (int)TREK_CMD_API_RETURN_CODES.cmd_API_SUCCESS)
{
Console.WriteLine("Command successfully sent");
}
else
{
Console.WriteLine("Error sending command: {0}", return_code);
}
Console.ReadKey();
static int Uplink_User_Command(System::String^ dest_name_ptr, System::String^ cmd_name_ptr, array< System::Byte >^ cmd_data_ptr, System::UInt32 len_of_cmd_data)
This function sends the user provided command to the specified destination.
Definition: trek_cmd_user_api_dotnet.cpp:275