2016-06-15 23:48:41 +02:00
|
|
|
#ifndef FRAMEWORK_TMTCPACKET_PUS_TMPACKETMINIMAL_H_
|
|
|
|
#define FRAMEWORK_TMTCPACKET_PUS_TMPACKETMINIMAL_H_
|
|
|
|
|
|
|
|
|
2020-08-13 20:53:35 +02:00
|
|
|
#include "../../tmtcpacket/SpacePacketBase.h"
|
|
|
|
#include "../../returnvalues/HasReturnvaluesIF.h"
|
2016-06-15 23:48:41 +02:00
|
|
|
|
2018-07-12 16:29:32 +02:00
|
|
|
struct timeval;
|
|
|
|
class PacketTimestampInterpreterIF;
|
2016-06-15 23:48:41 +02:00
|
|
|
/**
|
|
|
|
* This is a minimal version of a PUS TmPacket without any variable field, or,
|
|
|
|
* in other words with Service Type, Subtype and subcounter only.
|
|
|
|
* This is required for handling TM packets with different APIDs with different
|
|
|
|
* secondary headers.
|
|
|
|
*/
|
|
|
|
class TmPacketMinimal : public SpacePacketBase {
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* This is the default constructor.
|
|
|
|
* It sets its internal data pointer to the address passed and also
|
|
|
|
* forwards the data pointer to the parent SpacePacketBase class.
|
|
|
|
* @param set_address The position where the packet data lies.
|
|
|
|
*/
|
|
|
|
TmPacketMinimal( const uint8_t* set_data );
|
|
|
|
/**
|
|
|
|
* This is the empty default destructor.
|
|
|
|
*/
|
|
|
|
virtual ~TmPacketMinimal();
|
|
|
|
/**
|
|
|
|
* This is a getter for the packet's PUS Service ID, which is the second
|
|
|
|
* byte of the Data Field Header.
|
|
|
|
* @return The packet's PUS Service ID.
|
|
|
|
*/
|
|
|
|
uint8_t getService();
|
|
|
|
/**
|
|
|
|
* This is a getter for the packet's PUS Service Subtype, which is the
|
|
|
|
* third byte of the Data Field Header.
|
|
|
|
* @return The packet's PUS Service Subtype.
|
|
|
|
*/
|
|
|
|
uint8_t getSubService();
|
|
|
|
/**
|
|
|
|
* Returns the subcounter.
|
|
|
|
* @return the subcounter of the Data Field Header.
|
|
|
|
*/
|
|
|
|
uint8_t getPacketSubcounter();
|
|
|
|
struct PUSTmMinimalHeader {
|
|
|
|
uint8_t version_type_ack;
|
|
|
|
uint8_t service_type;
|
|
|
|
uint8_t service_subtype;
|
|
|
|
uint8_t subcounter;
|
|
|
|
};
|
|
|
|
|
2018-07-12 16:29:32 +02:00
|
|
|
ReturnValue_t getPacketTime(timeval* timestamp);
|
|
|
|
|
|
|
|
ReturnValue_t getPacketTimeRaw(const uint8_t** timePtr, uint32_t* size);
|
|
|
|
|
|
|
|
static void setInterpretTimestampObject(PacketTimestampInterpreterIF* interpreter);
|
2016-06-15 23:48:41 +02:00
|
|
|
/**
|
|
|
|
* This struct defines the data structure of a PUS Telecommand Packet when
|
|
|
|
* accessed via a pointer.
|
|
|
|
* @ingroup tmtcpackets
|
|
|
|
*/
|
|
|
|
struct TmPacketMinimalPointer {
|
|
|
|
CCSDSPrimaryHeader primary;
|
|
|
|
PUSTmMinimalHeader data_field;
|
|
|
|
uint8_t rest;
|
|
|
|
};
|
2018-07-12 16:29:32 +02:00
|
|
|
//Must include a checksum and is therefore at least one larger than the above struct.
|
|
|
|
static const uint16_t MINIMUM_SIZE = sizeof(TmPacketMinimalPointer) +1;
|
2016-06-15 23:48:41 +02:00
|
|
|
protected:
|
|
|
|
/**
|
|
|
|
* A pointer to a structure which defines the data structure of
|
|
|
|
* the packet's data.
|
|
|
|
*
|
|
|
|
* To be hardware-safe, all elements are of byte size.
|
|
|
|
*/
|
|
|
|
TmPacketMinimalPointer* tm_data;
|
2018-07-12 16:29:32 +02:00
|
|
|
|
|
|
|
static PacketTimestampInterpreterIF* timestampInterpreter;
|
2016-06-15 23:48:41 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* FRAMEWORK_TMTCPACKET_PUS_TMPACKETMINIMAL_H_ */
|