#include <iostream>
using namespace trek;
using namespace std;
int main()
{
std::string param_name;
int32_t ret_value;
double param_value;
ret_value = pkt.
LoadFile(
"my_file.xml" );
if( ret_value )
{
cout << "Could not open file\n";
return 1;
}
if( ret_value )
{
cout << "Could not find parameter\n";
return 1;
}
param_value = -2;
ret_value = param_ptr->
SetValue( param_value );
if( ret_value )
{
cout << "Could not set the value\n";
return 1;
}
param_ptr->
SetValue( (uint32_t)1024, 1 );
param_ptr->
SetValue( (uint32_t)2048, 2 );
param_ptr->
SetValue( (uint32_t)4096, 3 );
param_value = 1.2345;
uint8_t buf[1000];
uint32_t buf_size;
buf_size = 1000;
ret_value = pkt.
Build( buf, &buf_size );
if( ret_value )
{
cout << "Build failed for the packet\n";
return 1;
}
return 0;
}
This class describes a packet composed of one or more parameters.
Definition: packet.h:72
int32_t LoadFile(const char *filename)
Loads the Packet definition from the specified file.
Definition: packet.cpp:2756
int32_t Build(uint8_t *input_ptr, uint32_t *input_length_ptr)
Builds the packet and places it in the specified buffer.
Definition: packet.cpp:1320
int32_t CreateGlobalPacketMap()
Creates the map used to hold all of the parameters.
Definition: packet.cpp:2138
int32_t FindParameter(const char *name, Parameter **param_ptr)
Finds the specified parameter name in the packet.
Definition: packet.cpp:2348
This class describes a single parameter within a telemetry or command message including its value.
Definition: parameter.h:95
int32_t SetValue(int8_t input, uint16_t sample_number=1)
Sets the value of the parameter with an 8-bit signed integer.
Definition: parameter.cpp:6151
Defines the trek::Packet class.
Defines the trek::Parameter class.
Defines the trek::ParameterCollection class.