fsfw/tmtcpacket/pus/TmPacketMinimal.h

81 lines
2.1 KiB
C
Raw Normal View History

/*
* TmPacketMinimal.h
*
* Created on: 09.03.2015
* Author: baetz
*/
#ifndef FRAMEWORK_TMTCPACKET_PUS_TMPACKETMINIMAL_H_
#define FRAMEWORK_TMTCPACKET_PUS_TMPACKETMINIMAL_H_
#include <framework/tmtcpacket/SpacePacketBase.h>
/**
* 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;
};
/**
* 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;
};
static const uint16_t MINIMUM_SIZE = sizeof(TmPacketMinimalPointer) -1;
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;
};
#endif /* FRAMEWORK_TMTCPACKET_PUS_TMPACKETMINIMAL_H_ */