diff --git a/tcdistribution/TcPacketCheck.cpp b/tcdistribution/TcPacketCheck.cpp index dce0a458..b3a025a4 100644 --- a/tcdistribution/TcPacketCheck.cpp +++ b/tcdistribution/TcPacketCheck.cpp @@ -32,6 +32,7 @@ ReturnValue_t TcPacketCheck::checkPacket(TcPacketStoredBase* currentPacket) { if (not currentPacket->isSizeCorrect()) { return INCOMPLETE_PACKET; } + condition = (tcPacketBase->getSecondaryHeaderFlag() != CCSDS_SECONDARY_HEADER_FLAG) || (tcPacketBase->getPusVersionNumber() != PUS_VERSION_NUMBER); if (condition) { diff --git a/tcdistribution/TcPacketCheck.h b/tcdistribution/TcPacketCheck.h index f7422c19..7106b7e4 100644 --- a/tcdistribution/TcPacketCheck.h +++ b/tcdistribution/TcPacketCheck.h @@ -1,6 +1,7 @@ #ifndef FSFW_TCDISTRIBUTION_TCPACKETCHECK_H_ #define FSFW_TCDISTRIBUTION_TCPACKETCHECK_H_ +#include "../FSFW.h" #include "../returnvalues/HasReturnvaluesIF.h" #include "../tmtcservices/PusVerificationReport.h" @@ -24,7 +25,12 @@ protected: /** * Describes the TC Packet PUS Version Number a packet must have to pass. */ +#if FSFW_USE_PUS_C_TELECOMMANDS == 1 + static constexpr uint8_t PUS_VERSION_NUMBER = 2; +#else static constexpr uint8_t PUS_VERSION_NUMBER = 1; +#endif + /** * The packet id each correct packet should have. * It is composed of the APID and some static fields. diff --git a/tmtcpacket/pus/tc/TcPacketPus.cpp b/tmtcpacket/pus/tc/TcPacketPus.cpp index 1df61c07..334da4e7 100644 --- a/tmtcpacket/pus/tc/TcPacketPus.cpp +++ b/tmtcpacket/pus/tc/TcPacketPus.cpp @@ -62,11 +62,20 @@ void TcPacketPus::setData(const uint8_t* pData) { } uint8_t TcPacketPus::getSecondaryHeaderFlag() const { +#if FSFW_USE_PUS_C_TELECOMMANDS == 1 + // Does not exist for PUS C + return 0; +#else return (tcData->dataField.versionTypeAck & 0b10000000) >> 7; +#endif } uint8_t TcPacketPus::getPusVersionNumber() const { +#if FSFW_USE_PUS_C_TELECOMMANDS == 1 + return (tcData->dataField.versionTypeAck & 0b11110000) >> 4; +#else return (tcData->dataField.versionTypeAck & 0b01110000) >> 4; +#endif } uint16_t TcPacketPus::getSourceId() const {