continue cfdp funnel impl

This commit is contained in:
Robin Müller 2022-10-17 16:35:04 +02:00
parent 7bb9ffc3f7
commit e0a383f0af
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
4 changed files with 33 additions and 8 deletions

View File

@ -64,7 +64,7 @@ void ObjectFactory::produceGenericObjects(PusTmFunnel **pusFunnel,
new CcsdsDistributor(common::COMMON_PUS_APID, objects::CCSDS_DISTRIBUTOR, &tcStore); new CcsdsDistributor(common::COMMON_PUS_APID, objects::CCSDS_DISTRIBUTOR, &tcStore);
new PusDistributor(common::COMMON_PUS_APID, objects::PUS_DISTRIBUTOR, *ccsdsDistrib); new PusDistributor(common::COMMON_PUS_APID, objects::PUS_DISTRIBUTOR, *ccsdsDistrib);
*pusFunnel = new PusTmFunnel(objects::PUS_TM_FUNNEL, tmtcBridge, *stamperAndReader); *pusFunnel = new PusTmFunnel(objects::PUS_TM_FUNNEL, tmtcBridge, *stamperAndReader);
auto *cfdpFunnel = new CfdpTmFunnel(objects::CFDP_TM_FUNNEL, tmtcBridge); auto *cfdpFunnel = new CfdpTmFunnel(objects::CFDP_TM_FUNNEL, tmtcBridge, tmStore);
new TmFunnel(objects::TM_FUNNEL, **pusFunnel, *cfdpFunnel); new TmFunnel(objects::TM_FUNNEL, **pusFunnel, *cfdpFunnel);
#endif /* OBSW_ADD_CORE_COMPONENTS == 1 */ #endif /* OBSW_ADD_CORE_COMPONENTS == 1 */

View File

@ -1,9 +1,11 @@
#include "CfdpTmFunnel.h" #include "CfdpTmFunnel.h"
#include "fsfw/ipc/QueueFactory.h" #include "fsfw/ipc/QueueFactory.h"
#include "fsfw/tmtcservices/TmTcMessage.h"
CfdpTmFunnel::CfdpTmFunnel(object_id_t objectId, const AcceptsTelemetryIF& downlinkDestination) CfdpTmFunnel::CfdpTmFunnel(object_id_t objectId, const AcceptsTelemetryIF& downlinkDestination,
: SystemObject(objectId) { StorageManagerIF& tmStore)
: SystemObject(objectId), tmStore(tmStore) {
msgQueue = QueueFactory::instance()->createMessageQueue(5); msgQueue = QueueFactory::instance()->createMessageQueue(5);
} }
@ -13,6 +15,24 @@ MessageQueueId_t CfdpTmFunnel::getReportReceptionQueue(uint8_t virtualChannel) c
return msgQueue->getId(); return msgQueue->getId();
} }
ReturnValue_t CfdpTmFunnel::performOperation(uint8_t opCode) { return returnvalue::OK; } ReturnValue_t CfdpTmFunnel::performOperation(uint8_t) {
TmTcMessage currentMessage;
ReturnValue_t status = msgQueue->receiveMessage(&currentMessage);
while (status == returnvalue::OK) {
status = handlePacket(currentMessage);
if (status != returnvalue::OK) {
sif::warning << "TmFunnel packet handling failed" << std::endl;
break;
}
status = msgQueue->receiveMessage(&currentMessage);
}
ReturnValue_t CfdpTmFunnel::initialize() { return returnvalue::OK; } if (status == MessageQueueIF::EMPTY) {
return returnvalue::OK;
}
return status;
}
ReturnValue_t CfdpTmFunnel::initialize() { return returnvalue::OK; }
ReturnValue_t CfdpTmFunnel::handlePacket(TmTcMessage& msg) { return 0; }

View File

@ -2,11 +2,14 @@
#define FSFW_EXAMPLE_COMMON_CFDPTMFUNNEL_H #define FSFW_EXAMPLE_COMMON_CFDPTMFUNNEL_H
#include "fsfw/objectmanager/SystemObject.h" #include "fsfw/objectmanager/SystemObject.h"
#include "fsfw/storagemanager/StorageManagerIF.h"
#include "fsfw/tmtcservices/AcceptsTelemetryIF.h" #include "fsfw/tmtcservices/AcceptsTelemetryIF.h"
#include "fsfw/tmtcservices/TmTcMessage.h"
class CfdpTmFunnel : public AcceptsTelemetryIF, public SystemObject { class CfdpTmFunnel : public AcceptsTelemetryIF, public SystemObject {
public: public:
CfdpTmFunnel(object_id_t objectId, const AcceptsTelemetryIF& downlinkDestination); CfdpTmFunnel(object_id_t objectId, const AcceptsTelemetryIF& downlinkDestination,
StorageManagerIF& tmStore);
[[nodiscard]] const char* getName() const override; [[nodiscard]] const char* getName() const override;
[[nodiscard]] MessageQueueId_t getReportReceptionQueue(uint8_t virtualChannel) const override; [[nodiscard]] MessageQueueId_t getReportReceptionQueue(uint8_t virtualChannel) const override;
@ -14,6 +17,9 @@ class CfdpTmFunnel : public AcceptsTelemetryIF, public SystemObject {
ReturnValue_t initialize() override; ReturnValue_t initialize() override;
private: private:
ReturnValue_t handlePacket(TmTcMessage& msg);
MessageQueueIF* msgQueue; MessageQueueIF* msgQueue;
StorageManagerIF& tmStore;
}; };
#endif // FSFW_EXAMPLE_COMMON_CFDPTMFUNNEL_H #endif // FSFW_EXAMPLE_COMMON_CFDPTMFUNNEL_H

View File

@ -32,9 +32,8 @@ ReturnValue_t PusTmFunnel::performOperation(uint8_t) {
if (status == MessageQueueIF::EMPTY) { if (status == MessageQueueIF::EMPTY) {
return returnvalue::OK; return returnvalue::OK;
} else {
return status;
} }
return status;
} }
ReturnValue_t PusTmFunnel::handlePacket(TmTcMessage *message) { ReturnValue_t PusTmFunnel::handlePacket(TmTcMessage *message) {