pass message queue externally
This commit is contained in:
parent
c38088c64b
commit
bdbe0cc9da
@ -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;
|
||||||
|
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user