fsfw/src/fsfw/tcdistribution/TcPacketCheckPUS.h

62 lines
2.0 KiB
C
Raw Normal View History

#ifndef FSFW_TCDISTRIBUTION_TCPACKETCHECKPUS_H_
#define FSFW_TCDISTRIBUTION_TCPACKETCHECKPUS_H_
#include "TcPacketCheckIF.h"
2021-07-19 18:26:54 +02:00
#include "fsfw/FSFW.h"
2022-08-16 12:48:22 +02:00
#include "fsfw/returnvalues/returnvalue.h"
2021-07-19 18:26:54 +02:00
#include "fsfw/tmtcservices/PusVerificationReport.h"
2020-10-01 13:23:06 +02:00
2021-06-13 16:29:13 +02:00
class TcPacketStoredBase;
/**
* This class performs a formal packet check for incoming PUS Telecommand Packets.
* Currently, it only checks if the APID and CRC are correct.
2020-10-01 13:23:06 +02:00
* @ingroup tc_distribution
*/
2022-08-15 20:28:16 +02:00
class TcPacketCheckPUS : public TcPacketCheckIF {
2022-02-02 10:29:30 +01:00
protected:
/**
* Describes the version number a packet must have to pass.
*/
static constexpr uint8_t CCSDS_VERSION_NUMBER = 0;
/**
* Describes the secondary header a packet must have to pass.
*/
static constexpr uint8_t CCSDS_SECONDARY_HEADER_FLAG = 0;
/**
* Describes the TC Packet PUS Version Number a packet must have to pass.
*/
2021-06-14 11:44:39 +02:00
#if FSFW_USE_PUS_C_TELECOMMANDS == 1
2022-02-02 10:29:30 +01:00
static constexpr uint8_t PUS_VERSION_NUMBER = 2;
2021-06-14 11:44:39 +02:00
#else
2022-02-02 10:29:30 +01:00
static constexpr uint8_t PUS_VERSION_NUMBER = 1;
2021-06-14 11:44:39 +02:00
#endif
2022-02-02 10:29:30 +01:00
/**
* The packet id each correct packet should have.
* It is composed of the APID and some static fields.
*/
uint16_t apid;
public:
static const uint8_t INTERFACE_ID = CLASS_ID::TC_PACKET_CHECK;
static const ReturnValue_t ILLEGAL_APID = MAKE_RETURN_CODE(0);
static const ReturnValue_t INCOMPLETE_PACKET = MAKE_RETURN_CODE(1);
static const ReturnValue_t INCORRECT_CHECKSUM = MAKE_RETURN_CODE(2);
static const ReturnValue_t ILLEGAL_PACKET_TYPE = MAKE_RETURN_CODE(3);
static const ReturnValue_t ILLEGAL_PACKET_SUBTYPE = MAKE_RETURN_CODE(4);
static const ReturnValue_t INCORRECT_PRIMARY_HEADER = MAKE_RETURN_CODE(5);
static const ReturnValue_t INCORRECT_SECONDARY_HEADER = MAKE_RETURN_CODE(6);
/**
* The constructor only sets the APID attribute.
* @param set_apid The APID to set.
*/
TcPacketCheckPUS(uint16_t setApid);
ReturnValue_t checkPacket(SpacePacketBase* currentPacket) override;
uint16_t getApid() const;
};
#endif /* FSFW_TCDISTRIBUTION_TCPACKETCHECKPUS_H_ */