#include <iostream>
#include <stdio.h>
using namespace trek;
using namespace std;
int main()
{
std::string param_name;
int32_t ret_value;
ret_value = pkt.
LoadFile(
"my_file.xml" );
if( ret_value )
{
cout << "Could not open file\n";
return 1;
}
uint8_t buf[100];
uint32_t buf_size;
uint32_t last_bit;
buf[0] = 0x00;
buf[1] = 0x36;
buf[2] = 0x00;
buf[3] = 0x24;
buf[4] = 0xfe;
buf[5] = 0x53;
buf[6] = 0x11;
buf[7] = 0x06;
buf[8] = 0x5b;
buf[9] = 0xff;
buf[10] = 0xff;
buf[11] = 0x00;
buf[12] = 0x00;
buf[13] = 0x00;
buf[14] = 0xff;
buf[15] = 0x00;
buf[16] = 0x00;
buf[17] = 0x01;
buf[18] = 0x00;
buf[19] = 0x00;
buf[20] = 0x01;
buf[21] = 0x00;
buf[22] = 0x00;
buf[23] = 0x00;
buf[24] = 0x00;
buf[25] = 0x00;
buf[26] = 0x00;
buf[27] = 0x10;
buf[28] = 0x88;
buf[29] = 0xc3;
buf[30] = 0xc0;
buf[31] = 0x48;
buf[32] = 0x65;
buf[33] = 0x6c;
buf[34] = 0x70;
buf[35] = 0x21;
buf[36] = 0x00;
buf[37] = 0x20;
buf[38] = 0x96;
buf[39] = 0x54;
buf[40] = 0x1c;
buf_size = 41;
ret_value = pkt.
Extract( buf, buf_size, last_bit );
if( ret_value )
{
cout << "Error extracting data\n";
return 1;
}
for( uint32_t ii = 0; ii < all_params.
Size(); ii++ )
{
printf(
"%s (sample %u): %s\n", all_params.
GetAt(ii),
jj,
}
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
void GetSortedParameterList(StringArray ¶m_list, bool full_name=true, bool mod_only=false)
Returns a list of all parameters within a packet sorted by their start location.
Definition: packet.cpp:2553
int32_t Extract(uint8_t *input_ptr, uint32_t input_length, uint32_t &last_bit_used)
Extracts all of the parameters in the packet from the specified buffer.
Definition: packet.cpp:1714
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
const char * GetValueAsString(uint16_t sample_number=1)
Returns the value of the parameter as a string.
Definition: parameter.cpp:11511
uint32_t GetNumberOfSamples()
Gets the number of samples for the parameter.
Definition: parameter.cpp:3261
This class provides a wrapper for std::vector and std::string so different versions of the standard t...
Definition: string_array.h:19
uint32_t Size()
Returns the number of items in the string array.
Definition: string_array.cpp:67
const char * GetAt(uint32_t index)
Returns the string at the given location.
Definition: string_array.cpp:89
Defines the trek::Packet class.
Defines the trek::Parameter class.
Defines the trek::ParameterCollection class.