pushed cfdp update

This commit is contained in:
Robin Müller 2021-07-21 21:56:31 +02:00
parent 62d109c856
commit b0e1480383
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
8 changed files with 34 additions and 19 deletions

View File

@ -5,20 +5,21 @@
#include "fsfw/objectmanager/ObjectManager.h"
#define CFDP_DISTRIBUTOR_DEBUGGING 0
#ifndef FSFW_CFDP_DISTRIBUTOR_DEBUGGING
#define FSFW_CFDP_DISTRIBUTOR_DEBUGGING 1
#endif
CFDPDistributor::CFDPDistributor(uint16_t setApid, object_id_t setObjectId,
object_id_t setPacketSource) :
TcDistributor(setObjectId),
object_id_t setPacketSource):
TcDistributor(setObjectId), apid(setApid), checker(setApid),
tcStatus(RETURN_FAILED), packetSource(setPacketSource) {
this->apid = setApid;
}
CFDPDistributor::~CFDPDistributor() {}
CFDPDistributor::TcMqMapIter CFDPDistributor::selectDestination() {
#if CFDP_DISTRIBUTOR_DEBUGGING == 1
store_address_t storeId = this->currentMessage.getStorageId();
#if FSFW_CFDP_DISTRIBUTOR_DEBUGGING == 1
store_address_t storeId = this->currentMessage.getStorageId();
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::debug << "CFDPDistributor::handlePacket received: " << storeId.poolIndex << ", " <<
storeId.packetIndex << std::endl;
@ -33,6 +34,18 @@ CFDPDistributor::TcMqMapIter CFDPDistributor::selectDestination() {
}
this->currentPacket->setStoreAddress(this->currentMessage.getStorageId());
if (currentPacket->getWholeData() != nullptr) {
tcStatus = checker.checkPacket(currentPacket);
if(tcStatus != HasReturnvaluesIF::RETURN_OK) {
#if FSFW_VERBOSE_LEVEL >= 1
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::debug << "PUSDistributor::handlePacket: Packet format invalid, code " <<
static_cast<int>(tcStatus) << std::endl;
#else
sif::printDebug("PUSDistributor::handlePacket: Packet format invalid, code %d\n",
static_cast<int>(tcStatus));
#endif
#endif
}
queueMapIt = this->queueMap.find(0);
}
else {
@ -62,7 +75,7 @@ CFDPDistributor::TcMqMapIter CFDPDistributor::selectDestination() {
ReturnValue_t CFDPDistributor::registerHandler(AcceptsTelecommandsIF* handler) {
uint16_t handlerId = handler->getIdentifier(); //should be 0, because CFDPHandler does not set a set a service-ID
#if CFDP_DISTRIBUTOR_DEBUGGING == 1
#if FSFW_CFDP_DISTRIBUTOR_DEBUGGING == 1
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::info << "CFDPDistributor::registerHandler: Handler ID: " << static_cast<int>(handlerId) << std::endl;
#else

View File

@ -1,6 +1,7 @@
#ifndef FSFW_TCDISTRIBUTION_CFDPDISTRIBUTOR_H_
#define FSFW_TCDISTRIBUTION_CFDPDISTRIBUTOR_H_
#include <fsfw/tcdistribution/TcPacketCheckCFDP.h>
#include "CFDPDistributorIF.h"
#include "TcDistributor.h"
#include "../tmtcpacket/cfdp/CFDPPacketStored.h"
@ -43,6 +44,7 @@ protected:
* The currently handled packet is stored here.
*/
CFDPPacketStored* currentPacket = nullptr;
TcPacketCheckCFDP checker;
/**
* With this variable, the current check status is stored to generate
* acceptance messages later.

View File

@ -1,10 +1,10 @@
#include "fsfw/tcdistribution/TcPacketCheckCFDP.h"
#include "fsfw/tmtcpacket/cfdp/CFDPPacketStored.h"
TcPacketCheckCFDP::TcPacketCheckCFDP(uint16_t setApid): apid(setApid) {
}
ReturnValue_t TcPacketCheckCFDP::checkPacket(TcPacketStoredBase* currentPacket) {
ReturnValue_t TcPacketCheckCFDP::checkPacket(SpacePacketBase* currentPacket) {
return RETURN_OK;
}

View File

@ -5,7 +5,7 @@
#include "fsfw/FSFW.h"
class TcPacketStoredBase;
class CFDPPacketStored;
/**
* This class performs a formal packet check for incoming CFDP Packets.
@ -27,7 +27,7 @@ public:
*/
TcPacketCheckCFDP(uint16_t setApid);
ReturnValue_t checkPacket(TcPacketStoredBase* currentPacket) override;
ReturnValue_t checkPacket(SpacePacketBase* currentPacket) override;
uint16_t getApid() const;
};

View File

@ -3,8 +3,7 @@
#include "../returnvalues/HasReturnvaluesIF.h"
// TODO TcPacketStoredBase is currently only for PUS packets. not for CFDP packets
class TcPacketStoredBase;
class SpacePacketBase;
/**
* This interface is used by PacketCheckers for PUS packets and CFDP packets .
@ -26,7 +25,7 @@ public:
* - @c INCORRECT_CHECKSUM if checksum is invalid.
* - @c ILLEGAL_APID if APID does not match.
*/
virtual ReturnValue_t checkPacket(TcPacketStoredBase* currentPacket) = 0;
virtual ReturnValue_t checkPacket(SpacePacketBase* currentPacket) = 0;
};
#endif /* FSFW_TCDISTRIBUTION_TCPACKETCHECKIF_H_ */

View File

@ -1,6 +1,7 @@
#include "fsfw/tcdistribution/TcPacketCheckPUS.h"
#include "fsfw/globalfunctions/CRC.h"
#include "fsfw/tmtcpacket/pus/tc/TcPacketStoredPus.h"
#include "fsfw/tmtcpacket/pus/tc/TcPacketBase.h"
#include "fsfw/tmtcpacket/pus/tc/TcPacketStoredBase.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
@ -10,8 +11,9 @@
TcPacketCheckPUS::TcPacketCheckPUS(uint16_t setApid): apid(setApid) {
}
ReturnValue_t TcPacketCheckPUS::checkPacket(TcPacketStoredBase* currentPacket) {
TcPacketBase* tcPacketBase = currentPacket->getPacketBase();
ReturnValue_t TcPacketCheckPUS::checkPacket(SpacePacketBase* currentPacket) {
TcPacketStoredBase* storedPacket = dynamic_cast<TcPacketStoredBase*>(currentPacket);
TcPacketBase* tcPacketBase = storedPacket->getPacketBase();
if(tcPacketBase == nullptr) {
return RETURN_FAILED;
}
@ -29,7 +31,7 @@ ReturnValue_t TcPacketCheckPUS::checkPacket(TcPacketStoredBase* currentPacket) {
if (tcPacketBase->getAPID() != this->apid)
return ILLEGAL_APID;
if (not currentPacket->isSizeCorrect()) {
if (not storedPacket->isSizeCorrect()) {
return INCOMPLETE_PACKET;
}

View File

@ -55,7 +55,7 @@ public:
*/
TcPacketCheckPUS(uint16_t setApid);
ReturnValue_t checkPacket(TcPacketStoredBase* currentPacket) override;
ReturnValue_t checkPacket(SpacePacketBase* currentPacket) override;
uint16_t getApid() const;
};

View File

@ -14,7 +14,6 @@
#include "fsfw/container/FIFO.h"
#include "fsfw/serialize/SerializeIF.h"
class TcPacketStored;
class TcPacketStoredBase;
namespace Factory{