using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Command_Example
{
class Program
{
static void Main(string[] args)
{
var callFunction = new Program();
callFunction.Uplink_POIC_Command();
}
public void Uplink_POIC_Command()
{
int return_code = 0;
string destination = "test";
string command_name = "TEST_SWITCH";
return_code = trek_cmd_user_api.Uplink_POIC_Command(destination, command_name);
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();
}
public void Build_and_Uplink_POIC_Command()
{
int return_code = 0;
string destination = "POIC";
string command_name = "CAMERA_MODE";
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 if (return_code == (int)TREK_CMD_API_RETURN_CODES.cmd_API_DESTINATION_NOT_FOUND)
{
Console.WriteLine("Error destination not found: {0}", return_code);
}
else if (return_code == (int)TREK_CMD_API_RETURN_CODES.cmd_API_FAIL)
{
Console.WriteLine("Error sending command: {0}", return_code);
}
Console.ReadKey();
}
public void Uplink_User_Command()
{
int return_code = 0;
byte[] cmd_data = new byte[40];
string destination = "POIC";
string command_name = "CAMERA_MODE";
Array.Clear(cmd_data, 0, cmd_data.Length);
cmd_data[0] = 0x4A;
cmd_data[1] = 0x65;
cmd_data[2] = 0x66;
cmd_data[3] = 0x66;
return_code = trek_cmd_user_api.Uplink_User_Command(destination, command_name, cmd_data, 40);
if (return_code == (int)TREK_CMD_API_RETURN_CODES.cmd_API_SUCCESS)
{
Console.WriteLine("Command successfully sent: {0}");
}
else if (return_code == (int)TREK_CMD_API_RETURN_CODES.cmd_API_DESTINATION_NOT_FOUND)
{
Console.WriteLine("Error sending command: {0}", return_code);
}
else if(return_code == (int)TREK_CMD_API_RETURN_CODES.cmd_API_FAIL)
{
Console.WriteLine("Error sending command: {0}", return_code);
}
Console.ReadKey();
}
}
}