Update CFDP components #113

Merged
muellerr merged 9 commits from mueller/update-cfdp-components into develop 2022-10-21 15:27:44 +02:00
2 changed files with 11 additions and 10 deletions
Showing only changes of commit bdbe0cc9da - Show all commits

View File

@ -11,15 +11,14 @@ using namespace cfdp;
CfdpHandler::CfdpHandler(const FsfwHandlerParams& fsfwParams, const CfdpHandlerCfg& cfdpCfg) CfdpHandler::CfdpHandler(const FsfwHandlerParams& fsfwParams, const CfdpHandlerCfg& cfdpCfg)
: SystemObject(fsfwParams.objectId), : SystemObject(fsfwParams.objectId),
msgQueue(fsfwParams.msgQueue),
destHandler( destHandler(
DestHandlerParams(LocalEntityCfg(cfdpCfg.id, cfdpCfg.indicCfg, cfdpCfg.faultHandler), DestHandlerParams(LocalEntityCfg(cfdpCfg.id, cfdpCfg.indicCfg, cfdpCfg.faultHandler),
cfdpCfg.userHandler, cfdpCfg.remoteCfgProvider, cfdpCfg.packetInfoList, cfdpCfg.userHandler, cfdpCfg.remoteCfgProvider, cfdpCfg.packetInfoList,
cfdpCfg.lostSegmentsList), cfdpCfg.lostSegmentsList),
FsfwParams(fsfwParams.packetDest, nullptr, this, fsfwParams.tcStore, FsfwParams(fsfwParams.packetDest, nullptr, this, fsfwParams.tcStore,
fsfwParams.tmStore)) { fsfwParams.tmStore)) {
// TODO: Make queue params configurable, or better yet, expect it to be passed externally destHandler.setMsgQueue(msgQueue);
msgQueue = QueueFactory::instance()->createMessageQueue();
destHandler.setMsgQueue(*msgQueue);
} }
[[nodiscard]] const char* CfdpHandler::getName() const { return "CFDP Handler"; } [[nodiscard]] const char* CfdpHandler::getName() const { return "CFDP Handler"; }
@ -28,7 +27,7 @@ CfdpHandler::CfdpHandler(const FsfwHandlerParams& fsfwParams, const CfdpHandlerC
return destHandler.getDestHandlerParams().cfg.localId.getValue(); return destHandler.getDestHandlerParams().cfg.localId.getValue();
} }
[[nodiscard]] MessageQueueId_t CfdpHandler::getRequestQueue() const { return msgQueue->getId(); } [[nodiscard]] MessageQueueId_t CfdpHandler::getRequestQueue() const { return msgQueue.getId(); }
ReturnValue_t CfdpHandler::initialize() { ReturnValue_t CfdpHandler::initialize() {
ReturnValue_t result = destHandler.initialize(); ReturnValue_t result = destHandler.initialize();
@ -47,8 +46,8 @@ ReturnValue_t CfdpHandler::performOperation(uint8_t operationCode) {
ReturnValue_t status; ReturnValue_t status;
ReturnValue_t result = OK; ReturnValue_t result = OK;
TmTcMessage tmtcMsg; TmTcMessage tmtcMsg;
for (status = msgQueue->receiveMessage(&tmtcMsg); status == returnvalue::OK; for (status = msgQueue.receiveMessage(&tmtcMsg); status == returnvalue::OK;
status = msgQueue->receiveMessage(&tmtcMsg)) { status = msgQueue.receiveMessage(&tmtcMsg)) {
result = handleCfdpPacket(tmtcMsg); result = handleCfdpPacket(tmtcMsg);
if (result != OK) { if (result != OK) {
status = result; status = result;

View File

@ -11,13 +11,15 @@
struct FsfwHandlerParams { struct FsfwHandlerParams {
FsfwHandlerParams(object_id_t objectId, HasFileSystemIF& vfs, AcceptsTelemetryIF& packetDest, FsfwHandlerParams(object_id_t objectId, HasFileSystemIF& vfs, AcceptsTelemetryIF& packetDest,
StorageManagerIF& tcStore, StorageManagerIF& tmStore) StorageManagerIF& tcStore, StorageManagerIF& tmStore, MessageQueueIF& msgQueue)
: objectId(objectId), vfs(vfs), packetDest(packetDest), tcStore(tcStore), tmStore(tmStore) {} : objectId(objectId), vfs(vfs), packetDest(packetDest), tcStore(tcStore), tmStore(tmStore),
msgQueue(msgQueue) {}
object_id_t objectId{}; object_id_t objectId{};
HasFileSystemIF& vfs; HasFileSystemIF& vfs;
AcceptsTelemetryIF& packetDest; AcceptsTelemetryIF& packetDest;
StorageManagerIF& tcStore; StorageManagerIF& tcStore;
StorageManagerIF& tmStore; StorageManagerIF& tmStore;
MessageQueueIF& msgQueue;
}; };
struct CfdpHandlerCfg { struct CfdpHandlerCfg {
@ -54,7 +56,7 @@ class CfdpHandler : public SystemObject, public ExecutableObjectIF, public Accep
ReturnValue_t performOperation(uint8_t operationCode) override; ReturnValue_t performOperation(uint8_t operationCode) override;
private: private:
MessageQueueIF* msgQueue = nullptr; MessageQueueIF& msgQueue;
cfdp::DestHandler destHandler; cfdp::DestHandler destHandler;
StorageManagerIF* tcStore = nullptr; StorageManagerIF* tcStore = nullptr;
StorageManagerIF* tmStore = nullptr; StorageManagerIF* tmStore = nullptr;