#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:114
This class describes a packet composed of one or more parameters.
Definition: packet.h:72
int32_t AddData(PacketItem &item)
Sets the specified packet item as the data for the packet.
Definition: packet.cpp:478
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)
Sets the checksum parameter for the packet.
Definition: packet.cpp:3577
int32_t AddHeader(PacketItem &item)
Sets the specified packet item as the header for the packet.
Definition: packet.cpp:437
int32_t AddIdentifier(const char *name, packet_identifier_struct *id_struct_ptr)
Adds an identifier to the packet.
Definition: packet.cpp:3818
int32_t AddTrailer(PacketItem &item)
Sets the specified packet item as the trailer for the packet.
Definition: packet.cpp:519
int32_t SaveFile(const char *filename)
Saves the Packet definition to the specified file.
Definition: packet.cpp:2790
int32_t SetLengthParameter(const char *name, packet_zone_type zone, int32_t offset=0)
Sets the length parameter for the packet.
Definition: packet.cpp:3074
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:3400
int32_t CreateGlobalPacketMap()
Creates the map used to hold all of the parameters.
Definition: packet.cpp:2138
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:3229
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:95
int32_t SetStartBit(uint32_t input)
Sets the start location for the parameter as bits.
Definition: parameter.cpp:1725
void Init()
Initializes the object.
Definition: parameter.cpp:412
void SetSampleOffset(uint32_t input)
Sets the sample offset for the parameter.
Definition: parameter.cpp:1788
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:1401
void SetModifiableFlag(bool input)
Sets the modifiable flag for the parameter.
Definition: parameter.cpp:2522
int32_t SetNumberOfSamples(uint32_t input)
Sets the number of samples for the parameter.
Definition: parameter.cpp:1747
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
@ DT_UNSIGNED_INTEGER
Unsigned integer value ranging from 1 to 64 bits in length.
Definition: parameter.h:42
@ DT_NULL_TERMINATED_STRING
ASCII string terminated by a NULL (0x00) character.
Definition: parameter.h:47
@ DT_UNIX_TIME
32 bits seconds since midnight January 1, 1970
Definition: parameter.h:56
@ DT_TWOS_COMPLEMENT
Two's complement integer value ranging from 2 to 64 bits in length.
Definition: parameter.h:41
@ DT_IEEE_FLOATING_POINT
IEEE floating point value. Single precision is 32 bits. Double precision is 64 bits.
Definition: parameter.h:46
@ CONTENT_IDENTIFIER
used to determine content of packet
Definition: trek.h:87
@ START_HEADER
Start of header (beginning of packet)
Definition: packet.h:33
@ END_DATA
End of data (or start of trailer if you prefer)
Definition: packet.h:35
@ TRAILER_ZONE
Trailer (last) zone in packet.
Definition: packet.h:27
@ HEADER_ZONE
Header (first) zone in packet.
Definition: packet.h:25
@ CT_CRC32
32-bit Cyclic redundance check (see ???)
Definition: packet.h:42
@ 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:49
packet_zone_type zone
The zone of the packet to find the idenitifer.
Definition: packet.h:50
bool expected_value_available
Is an expected value available?
Definition: packet.h:54
identifier_types type
The type of identifier.
Definition: packet.h:51
int32_t expected_value
Expected value (only used if expected_value_available = true)
Definition: packet.h:55
bool default_value_available
Is a default value available?
Definition: packet.h:52