refactored TcPacketCheck into TcPacketCheckIF to implement a CFDP packet checker
This commit is contained in:
parent
8a4ce91501
commit
4860d984f3
@ -1,10 +1,9 @@
|
||||
#ifndef FSFW_TCDISTRIBUTION_CFDPDISTRIBUTOR_H_
|
||||
#define FSFW_TCDISTRIBUTION_CFDPDISTRIBUTOR_H_
|
||||
|
||||
#include "TcPacketCheckCFDP.h"
|
||||
#include "CFDPDistributorIF.h"
|
||||
#include "TcDistributor.h"
|
||||
#include "TcPacketCheck.h"
|
||||
|
||||
#include "../tmtcpacket/pus/tc.h"
|
||||
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||
#include "../tmtcservices/AcceptsTelecommandsIF.h"
|
||||
@ -43,7 +42,7 @@ protected:
|
||||
/**
|
||||
* This attribute contains the class, that performs a formal packet check.
|
||||
*/
|
||||
TcPacketCheck checker;
|
||||
TcPacketCheckCFDP checker;
|
||||
/**
|
||||
* With this class, verification messages are sent to the
|
||||
* TC Verification service.
|
||||
|
@ -2,7 +2,8 @@ target_sources(${LIB_FSFW_NAME} PRIVATE
|
||||
CCSDSDistributor.cpp
|
||||
PUSDistributor.cpp
|
||||
TcDistributor.cpp
|
||||
TcPacketCheck.cpp
|
||||
TcPacketCheckPUS.cpp
|
||||
TcPacketCheckCFDP.cpp
|
||||
CFDPDistributor.cpp
|
||||
)
|
||||
|
||||
|
@ -1,10 +1,9 @@
|
||||
#ifndef FSFW_TCDISTRIBUTION_PUSDISTRIBUTOR_H_
|
||||
#define FSFW_TCDISTRIBUTION_PUSDISTRIBUTOR_H_
|
||||
|
||||
#include "TcPacketCheckPUS.h"
|
||||
#include "PUSDistributorIF.h"
|
||||
#include "TcDistributor.h"
|
||||
#include "TcPacketCheck.h"
|
||||
|
||||
#include "../tmtcpacket/pus/tc.h"
|
||||
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||
#include "../tmtcservices/AcceptsTelecommandsIF.h"
|
||||
@ -43,7 +42,7 @@ protected:
|
||||
/**
|
||||
* This attribute contains the class, that performs a formal packet check.
|
||||
*/
|
||||
TcPacketCheck checker;
|
||||
TcPacketCheckPUS checker;
|
||||
/**
|
||||
* With this class, verification messages are sent to the
|
||||
* TC Verification service.
|
||||
|
13
tcdistribution/TcPacketCheckCFDP.cpp
Normal file
13
tcdistribution/TcPacketCheckCFDP.cpp
Normal file
@ -0,0 +1,13 @@
|
||||
#include "TcPacketCheckCFDP.h"
|
||||
|
||||
|
||||
TcPacketCheckCFDP::TcPacketCheckCFDP(uint16_t setApid): apid(setApid) {
|
||||
}
|
||||
|
||||
ReturnValue_t TcPacketCheckCFDP::checkPacket(TcPacketStoredBase* currentPacket) {
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
uint16_t TcPacketCheckCFDP::getApid() const {
|
||||
return apid;
|
||||
}
|
35
tcdistribution/TcPacketCheckCFDP.h
Normal file
35
tcdistribution/TcPacketCheckCFDP.h
Normal file
@ -0,0 +1,35 @@
|
||||
#ifndef FSFW_TCDISTRIBUTION_TCPACKETCHECKCFDP_H_
|
||||
#define FSFW_TCDISTRIBUTION_TCPACKETCHECKCFDP_H_
|
||||
|
||||
#include "TcPacketCheckIF.h"
|
||||
|
||||
#include "../FSFW.h"
|
||||
|
||||
class TcPacketStoredBase;
|
||||
|
||||
/**
|
||||
* This class performs a formal packet check for incoming CFDP Packets.
|
||||
* @ingroup tc_distribution
|
||||
*/
|
||||
class TcPacketCheckCFDP :
|
||||
public TcPacketCheckIF,
|
||||
public HasReturnvaluesIF {
|
||||
protected:
|
||||
/**
|
||||
* The packet id each correct packet should have.
|
||||
* It is composed of the APID and some static fields.
|
||||
*/
|
||||
uint16_t apid;
|
||||
public:
|
||||
/**
|
||||
* The constructor only sets the APID attribute.
|
||||
* @param set_apid The APID to set.
|
||||
*/
|
||||
TcPacketCheckCFDP(uint16_t setApid);
|
||||
|
||||
ReturnValue_t checkPacket(TcPacketStoredBase* currentPacket) override;
|
||||
|
||||
uint16_t getApid() const;
|
||||
};
|
||||
|
||||
#endif /* FSFW_TCDISTRIBUTION_TCPACKETCHECKCFDP_H_ */
|
32
tcdistribution/TcPacketCheckIF.h
Normal file
32
tcdistribution/TcPacketCheckIF.h
Normal file
@ -0,0 +1,32 @@
|
||||
#ifndef FSFW_TCDISTRIBUTION_TCPACKETCHECKIF_H_
|
||||
#define FSFW_TCDISTRIBUTION_TCPACKETCHECKIF_H_
|
||||
|
||||
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||
|
||||
// TODO TcPacketStoredBase is currently only for PUS packets. not for CFDP packets
|
||||
class TcPacketStoredBase;
|
||||
|
||||
/**
|
||||
* This interface is used by PacketCheckers for PUS packets and CFDP packets .
|
||||
* @ingroup tc_distribution
|
||||
*/
|
||||
class TcPacketCheckIF {
|
||||
public:
|
||||
/**
|
||||
* The empty virtual destructor.
|
||||
*/
|
||||
virtual ~TcPacketCheckIF() {
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the actual method to formally check a certain Packet.
|
||||
* The packet's Application Data can not be checked here.
|
||||
* @param current_packet The packet to check
|
||||
* @return - @c RETURN_OK on success.
|
||||
* - @c INCORRECT_CHECKSUM if checksum is invalid.
|
||||
* - @c ILLEGAL_APID if APID does not match.
|
||||
*/
|
||||
virtual ReturnValue_t checkPacket(TcPacketStoredBase* currentPacket) = 0;
|
||||
};
|
||||
|
||||
#endif /* FSFW_TCDISTRIBUTION_TCPACKETCHECKIF_H_ */
|
@ -1,4 +1,4 @@
|
||||
#include "TcPacketCheck.h"
|
||||
#include "TcPacketCheckPUS.h"
|
||||
|
||||
#include "../globalfunctions/CRC.h"
|
||||
#include "../tmtcpacket/pus/tc/TcPacketBase.h"
|
||||
@ -7,10 +7,10 @@
|
||||
#include "../storagemanager/StorageManagerIF.h"
|
||||
#include "../tmtcservices/VerificationCodes.h"
|
||||
|
||||
TcPacketCheck::TcPacketCheck(uint16_t setApid): apid(setApid) {
|
||||
TcPacketCheckPUS::TcPacketCheckPUS(uint16_t setApid): apid(setApid) {
|
||||
}
|
||||
|
||||
ReturnValue_t TcPacketCheck::checkPacket(TcPacketStoredBase* currentPacket) {
|
||||
ReturnValue_t TcPacketCheckPUS::checkPacket(TcPacketStoredBase* currentPacket) {
|
||||
TcPacketBase* tcPacketBase = currentPacket->getPacketBase();
|
||||
if(tcPacketBase == nullptr) {
|
||||
return RETURN_FAILED;
|
||||
@ -41,6 +41,6 @@ ReturnValue_t TcPacketCheck::checkPacket(TcPacketStoredBase* currentPacket) {
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
uint16_t TcPacketCheck::getApid() const {
|
||||
uint16_t TcPacketCheckPUS::getApid() const {
|
||||
return apid;
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
#ifndef FSFW_TCDISTRIBUTION_TCPACKETCHECK_H_
|
||||
#define FSFW_TCDISTRIBUTION_TCPACKETCHECK_H_
|
||||
#ifndef FSFW_TCDISTRIBUTION_TCPACKETCHECKPUS_H_
|
||||
#define FSFW_TCDISTRIBUTION_TCPACKETCHECKPUS_H_
|
||||
|
||||
#include "TcPacketCheckIF.h"
|
||||
|
||||
#include "../FSFW.h"
|
||||
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||
@ -12,7 +14,9 @@ class TcPacketStoredBase;
|
||||
* Currently, it only checks if the APID and CRC are correct.
|
||||
* @ingroup tc_distribution
|
||||
*/
|
||||
class TcPacketCheck : public HasReturnvaluesIF {
|
||||
class TcPacketCheckPUS :
|
||||
public TcPacketCheckIF,
|
||||
public HasReturnvaluesIF {
|
||||
protected:
|
||||
/**
|
||||
* Describes the version number a packet must have to pass.
|
||||
@ -49,18 +53,11 @@ public:
|
||||
* The constructor only sets the APID attribute.
|
||||
* @param set_apid The APID to set.
|
||||
*/
|
||||
TcPacketCheck(uint16_t setApid);
|
||||
/**
|
||||
* This is the actual method to formally check a certain Telecommand Packet.
|
||||
* The packet's Application Data can not be checked here.
|
||||
* @param current_packet The packt to check
|
||||
* @return - @c RETURN_OK on success.
|
||||
* - @c INCORRECT_CHECKSUM if checksum is invalid.
|
||||
* - @c ILLEGAL_APID if APID does not match.
|
||||
*/
|
||||
ReturnValue_t checkPacket(TcPacketStoredBase* currentPacket);
|
||||
TcPacketCheckPUS(uint16_t setApid);
|
||||
|
||||
ReturnValue_t checkPacket(TcPacketStoredBase* currentPacket) override;
|
||||
|
||||
uint16_t getApid() const;
|
||||
};
|
||||
|
||||
#endif /* FSFW_TCDISTRIBUTION_TCPACKETCHECK_H_ */
|
||||
#endif /* FSFW_TCDISTRIBUTION_TCPACKETCHECKPUS_H_ */
|
Loading…
Reference in New Issue
Block a user