mueller/master #37
@ -5,20 +5,21 @@
|
|||||||
|
|
||||||
#include "fsfw/objectmanager/ObjectManager.h"
|
#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,
|
CFDPDistributor::CFDPDistributor(uint16_t setApid, object_id_t setObjectId,
|
||||||
object_id_t setPacketSource) :
|
object_id_t setPacketSource):
|
||||||
TcDistributor(setObjectId),
|
TcDistributor(setObjectId), apid(setApid), checker(setApid),
|
||||||
tcStatus(RETURN_FAILED), packetSource(setPacketSource) {
|
tcStatus(RETURN_FAILED), packetSource(setPacketSource) {
|
||||||
this->apid = setApid;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CFDPDistributor::~CFDPDistributor() {}
|
CFDPDistributor::~CFDPDistributor() {}
|
||||||
|
|
||||||
CFDPDistributor::TcMqMapIter CFDPDistributor::selectDestination() {
|
CFDPDistributor::TcMqMapIter CFDPDistributor::selectDestination() {
|
||||||
#if CFDP_DISTRIBUTOR_DEBUGGING == 1
|
#if FSFW_CFDP_DISTRIBUTOR_DEBUGGING == 1
|
||||||
store_address_t storeId = this->currentMessage.getStorageId();
|
store_address_t storeId = this->currentMessage.getStorageId();
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::debug << "CFDPDistributor::handlePacket received: " << storeId.poolIndex << ", " <<
|
sif::debug << "CFDPDistributor::handlePacket received: " << storeId.poolIndex << ", " <<
|
||||||
storeId.packetIndex << std::endl;
|
storeId.packetIndex << std::endl;
|
||||||
@ -33,6 +34,18 @@ CFDPDistributor::TcMqMapIter CFDPDistributor::selectDestination() {
|
|||||||
}
|
}
|
||||||
this->currentPacket->setStoreAddress(this->currentMessage.getStorageId());
|
this->currentPacket->setStoreAddress(this->currentMessage.getStorageId());
|
||||||
if (currentPacket->getWholeData() != nullptr) {
|
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);
|
queueMapIt = this->queueMap.find(0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -62,7 +75,7 @@ CFDPDistributor::TcMqMapIter CFDPDistributor::selectDestination() {
|
|||||||
|
|
||||||
ReturnValue_t CFDPDistributor::registerHandler(AcceptsTelecommandsIF* handler) {
|
ReturnValue_t CFDPDistributor::registerHandler(AcceptsTelecommandsIF* handler) {
|
||||||
uint16_t handlerId = handler->getIdentifier(); //should be 0, because CFDPHandler does not set a set a service-ID
|
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
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::info << "CFDPDistributor::registerHandler: Handler ID: " << static_cast<int>(handlerId) << std::endl;
|
sif::info << "CFDPDistributor::registerHandler: Handler ID: " << static_cast<int>(handlerId) << std::endl;
|
||||||
#else
|
#else
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#ifndef FSFW_TCDISTRIBUTION_CFDPDISTRIBUTOR_H_
|
#ifndef FSFW_TCDISTRIBUTION_CFDPDISTRIBUTOR_H_
|
||||||
#define FSFW_TCDISTRIBUTION_CFDPDISTRIBUTOR_H_
|
#define FSFW_TCDISTRIBUTION_CFDPDISTRIBUTOR_H_
|
||||||
|
|
||||||
|
#include <fsfw/tcdistribution/TcPacketCheckCFDP.h>
|
||||||
#include "CFDPDistributorIF.h"
|
#include "CFDPDistributorIF.h"
|
||||||
#include "TcDistributor.h"
|
#include "TcDistributor.h"
|
||||||
#include "../tmtcpacket/cfdp/CFDPPacketStored.h"
|
#include "../tmtcpacket/cfdp/CFDPPacketStored.h"
|
||||||
@ -43,6 +44,7 @@ protected:
|
|||||||
* The currently handled packet is stored here.
|
* The currently handled packet is stored here.
|
||||||
*/
|
*/
|
||||||
CFDPPacketStored* currentPacket = nullptr;
|
CFDPPacketStored* currentPacket = nullptr;
|
||||||
|
TcPacketCheckCFDP checker;
|
||||||
/**
|
/**
|
||||||
* With this variable, the current check status is stored to generate
|
* With this variable, the current check status is stored to generate
|
||||||
* acceptance messages later.
|
* acceptance messages later.
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#include "fsfw/tcdistribution/TcPacketCheckCFDP.h"
|
#include "fsfw/tcdistribution/TcPacketCheckCFDP.h"
|
||||||
|
#include "fsfw/tmtcpacket/cfdp/CFDPPacketStored.h"
|
||||||
|
|
||||||
TcPacketCheckCFDP::TcPacketCheckCFDP(uint16_t setApid): apid(setApid) {
|
TcPacketCheckCFDP::TcPacketCheckCFDP(uint16_t setApid): apid(setApid) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t TcPacketCheckCFDP::checkPacket(TcPacketStoredBase* currentPacket) {
|
ReturnValue_t TcPacketCheckCFDP::checkPacket(SpacePacketBase* currentPacket) {
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
#include "fsfw/FSFW.h"
|
#include "fsfw/FSFW.h"
|
||||||
|
|
||||||
class TcPacketStoredBase;
|
class CFDPPacketStored;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class performs a formal packet check for incoming CFDP Packets.
|
* This class performs a formal packet check for incoming CFDP Packets.
|
||||||
@ -27,7 +27,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
TcPacketCheckCFDP(uint16_t setApid);
|
TcPacketCheckCFDP(uint16_t setApid);
|
||||||
|
|
||||||
ReturnValue_t checkPacket(TcPacketStoredBase* currentPacket) override;
|
ReturnValue_t checkPacket(SpacePacketBase* currentPacket) override;
|
||||||
|
|
||||||
uint16_t getApid() const;
|
uint16_t getApid() const;
|
||||||
};
|
};
|
||||||
|
@ -3,8 +3,7 @@
|
|||||||
|
|
||||||
#include "../returnvalues/HasReturnvaluesIF.h"
|
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||||
|
|
||||||
// TODO TcPacketStoredBase is currently only for PUS packets. not for CFDP packets
|
class SpacePacketBase;
|
||||||
class TcPacketStoredBase;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This interface is used by PacketCheckers for PUS packets and CFDP packets .
|
* 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 INCORRECT_CHECKSUM if checksum is invalid.
|
||||||
* - @c ILLEGAL_APID if APID does not match.
|
* - @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_ */
|
#endif /* FSFW_TCDISTRIBUTION_TCPACKETCHECKIF_H_ */
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "fsfw/tcdistribution/TcPacketCheckPUS.h"
|
#include "fsfw/tcdistribution/TcPacketCheckPUS.h"
|
||||||
|
|
||||||
#include "fsfw/globalfunctions/CRC.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/TcPacketBase.h"
|
||||||
#include "fsfw/tmtcpacket/pus/tc/TcPacketStoredBase.h"
|
#include "fsfw/tmtcpacket/pus/tc/TcPacketStoredBase.h"
|
||||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
@ -10,8 +11,9 @@
|
|||||||
TcPacketCheckPUS::TcPacketCheckPUS(uint16_t setApid): apid(setApid) {
|
TcPacketCheckPUS::TcPacketCheckPUS(uint16_t setApid): apid(setApid) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t TcPacketCheckPUS::checkPacket(TcPacketStoredBase* currentPacket) {
|
ReturnValue_t TcPacketCheckPUS::checkPacket(SpacePacketBase* currentPacket) {
|
||||||
TcPacketBase* tcPacketBase = currentPacket->getPacketBase();
|
TcPacketStoredBase* storedPacket = dynamic_cast<TcPacketStoredBase*>(currentPacket);
|
||||||
|
TcPacketBase* tcPacketBase = storedPacket->getPacketBase();
|
||||||
if(tcPacketBase == nullptr) {
|
if(tcPacketBase == nullptr) {
|
||||||
return RETURN_FAILED;
|
return RETURN_FAILED;
|
||||||
}
|
}
|
||||||
@ -29,7 +31,7 @@ ReturnValue_t TcPacketCheckPUS::checkPacket(TcPacketStoredBase* currentPacket) {
|
|||||||
if (tcPacketBase->getAPID() != this->apid)
|
if (tcPacketBase->getAPID() != this->apid)
|
||||||
return ILLEGAL_APID;
|
return ILLEGAL_APID;
|
||||||
|
|
||||||
if (not currentPacket->isSizeCorrect()) {
|
if (not storedPacket->isSizeCorrect()) {
|
||||||
return INCOMPLETE_PACKET;
|
return INCOMPLETE_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
TcPacketCheckPUS(uint16_t setApid);
|
TcPacketCheckPUS(uint16_t setApid);
|
||||||
|
|
||||||
ReturnValue_t checkPacket(TcPacketStoredBase* currentPacket) override;
|
ReturnValue_t checkPacket(SpacePacketBase* currentPacket) override;
|
||||||
|
|
||||||
uint16_t getApid() const;
|
uint16_t getApid() const;
|
||||||
};
|
};
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
#include "fsfw/container/FIFO.h"
|
#include "fsfw/container/FIFO.h"
|
||||||
#include "fsfw/serialize/SerializeIF.h"
|
#include "fsfw/serialize/SerializeIF.h"
|
||||||
|
|
||||||
class TcPacketStored;
|
|
||||||
class TcPacketStoredBase;
|
class TcPacketStoredBase;
|
||||||
|
|
||||||
namespace Factory{
|
namespace Factory{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user