#include <iostream>
using namespace trek;
using namespace std;
int main()
{
int32_t ret_value;
{
cout << "Error setting start bit\n";
return 1;
}
{
cout << "Error setting data type\n";
return 1;
}
{
cout <<"Error setting value\n";
return 1;
}
{
cout << "Error adding parameter\n";
return 1;
}
{
cout << "Error adding header\n";
return 1;
}
800,
true );
std::string name;
if( ret_value )
{
cout << "Error adding identifier parameter\n";
return 1;
}
if( ret_value )
{
cout << "Error setting length parameter\n";
return 1;
}
if( ret_value )
{
cout << "Error setting counter parameter\n";
return 1;
}
if( ret_value )
{
cout << "Error setting time stamp parameter\n";
return 1;
}
0,
0,
if( ret_value )
{
cout << "Error setting checksum parameter\n";
return 1;
}
ret_value = pkt.
SaveFile(
"my_file.xml" );
if( ret_value )
{
cout << "Error saving file\n";
return 1;
}
return 0;
}
void SetName(const char *input_ptr)
Sets the name of the item.
Definition: named_item.cpp:167
This class describes a packet composed of one or more parameters.
Definition: packet.h:76
int32_t AddData(PacketItem &item)
Sets the specified packet item as the data for the packet.
Definition: packet.cpp:503
int32_t AddHeader(PacketItem &item)
Sets the specified packet item as the header for the packet.
Definition: packet.cpp:462
int32_t SetChecksumParameter(const char *name, packet_zone_type zone, packet_checksum_point_type start_pt, int32_t start_offset, packet_checksum_point_type end_pt, int32_t end_offset, packet_checksum_type type, uint32_t polynomial=0x04c11db7, uint32_t init_value=0xffffffff, uint32_t final_xor_value=0xffffffff, bool reflect_input=true, bool reflect_result=true)
Sets the checksum parameter for the packet.
Definition: packet.cpp:3744
int32_t AddIdentifier(const char *name, packet_identifier_struct *id_struct_ptr)
Adds an identifier to the packet.
Definition: packet.cpp:4158
int32_t AddTrailer(PacketItem &item)
Sets the specified packet item as the trailer for the packet.
Definition: packet.cpp:544
int32_t SaveFile(const char *filename)
Saves the Packet definition to the specified file.
Definition: packet.cpp:2942
int32_t SetLengthParameter(const char *name, packet_zone_type zone, int32_t offset=0)
Sets the length parameter for the packet.
Definition: packet.cpp:3226
int32_t SetTimeStampParameter(const char *name, packet_zone_type zone, double offset_in_secs=0)
Sets the time stamp parameter for the packet.
Definition: packet.cpp:3552
int32_t CreateGlobalPacketMap()
Creates the map used to hold all of the parameters.
Definition: packet.cpp:2290
int32_t SetCounterParameter(const char *name, packet_zone_type zone, uint32_t start_count=0, bool fwd_count=true, uint32_t min_count=0, uint32_t max_count=0, uint32_t reset_count=0)
Sets the counter parameter for the packet.
Definition: packet.cpp:3381
This class describes a parameter collection composed of one or more parameters.
Definition: parameter_collection.h:24
virtual void Init()
Initializes the object.
Definition: parameter_collection.cpp:128
int32_t AddParameter(Parameter *input_ptr)
Adds the parameter to the collection.
Definition: parameter_collection.cpp:291
This class describes a single parameter within a telemetry or command message including its value.
Definition: parameter.h:100
int32_t SetStartBit(uint32_t input)
Sets the start location for the parameter as bits.
Definition: parameter.cpp:1833
void Init()
Initializes the object.
Definition: parameter.cpp:421
void SetSampleOffset(uint32_t input)
Sets the sample offset for the parameter.
Definition: parameter.cpp:1896
int32_t SetDataType(parameter_data_type input_type, uint32_t input_len, byte_order_type input_order=BIG_ENDIAN_BYTE_ORDER, bool var_len=false)
Sets the data type, length, and byte order for the parameter.
Definition: parameter.cpp:1480
void SetModifiableFlag(bool input)
Sets the modifiable flag for the parameter.
Definition: parameter.cpp:2658
int32_t SetNumberOfSamples(uint32_t input)
Sets the number of samples for the parameter.
Definition: parameter.cpp:1855
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:7131
@ DT_UNSIGNED_INTEGER
Unsigned integer value ranging from 1 to 64 bits in length.
Definition: parameter.h:43
@ DT_NULL_TERMINATED_STRING
ASCII string terminated by a NULL (0x00) character.
Definition: parameter.h:49
@ DT_UNIX_TIME
32 bits seconds since midnight January 1, 1970
Definition: parameter.h:58
@ DT_TWOS_COMPLEMENT
Two's complement integer value ranging from 2 to 64 bits in length.
Definition: parameter.h:42
@ DT_IEEE_FLOATING_POINT
IEEE floating point value. Single precision is 32 bits. Double precision is 64 bits.
Definition: parameter.h:47
@ CONTENT_IDENTIFIER
used to determine content of packet
Definition: trek.h:87
@ START_HEADER
Start of header (beginning of packet)
Definition: packet.h:35
@ END_DATA
End of data (or start of trailer if you prefer)
Definition: packet.h:37
@ TRAILER_ZONE
Trailer (last) zone in packet.
Definition: packet.h:29
@ HEADER_ZONE
Header (first) zone in packet.
Definition: packet.h:27
@ CT_CRC32
32-bit Cyclic redundance check (see ???)
Definition: packet.h:44
@ BIG_ENDIAN_BYTE_ORDER
Also known as network byte order. Most significant byte is first.
Definition: trek.h:76
@ LITTLE_ENDIAN_BYTE_ORDER
Least significant byte is first.
Definition: trek.h:77
Defines the trek::Packet class.
Defines the trek::Parameter class.
Defines the trek::ParameterCollection class.
Structure of information needed for identifier parameters.
Definition: packet.h:53
packet_zone_type zone
The zone of the packet to find the idenitifer.
Definition: packet.h:54
bool expected_value_available
Is an expected value available?
Definition: packet.h:58
identifier_types type
The type of identifier.
Definition: packet.h:55
int32_t expected_value
Expected value (only used if expected_value_available = true)
Definition: packet.h:59
bool default_value_available
Is a default value available?
Definition: packet.h:56