diff --git a/bsp_hosted/core/CfdpHandler.cpp b/bsp_hosted/core/CfdpHandler.cpp index acc41b9..1b1d466 100644 --- a/bsp_hosted/core/CfdpHandler.cpp +++ b/bsp_hosted/core/CfdpHandler.cpp @@ -11,8 +11,7 @@ using namespace cfdp; CfdpHandler::CfdpHandler(const FsfwHandlerParams& fsfwParams, const CfdpHandlerCfg& cfdpCfg) : SystemObject(fsfwParams.objectId), - UserBase(fsfwParams.vfs), - destHandler(DestHandlerParams(LocalEntityCfg(cfdpCfg.id, cfdpCfg.indicCfg, *this), *this, + destHandler(DestHandlerParams(LocalEntityCfg(cfdpCfg.id, cfdpCfg.indicCfg, *this), cfdpCfg.userHandler, cfdpCfg.remoteCfgProvider, cfdpCfg.packetInfoList, cfdpCfg.lostSegmentsList), FsfwParams(fsfwParams.packetDest, nullptr, this, fsfwParams.tcStore, @@ -63,20 +62,6 @@ ReturnValue_t CfdpHandler::performOperation(uint8_t operationCode) { return status; } -void CfdpHandler::transactionIndication(const cfdp::TransactionId& id) {} -void CfdpHandler::eofSentIndication(const cfdp::TransactionId& id) {} -void CfdpHandler::transactionFinishedIndication(const cfdp::TransactionFinishedParams& params) {} -void CfdpHandler::metadataRecvdIndication(const cfdp::MetadataRecvdParams& params) {} -void CfdpHandler::fileSegmentRecvdIndication(const cfdp::FileSegmentRecvdParams& params) {} -void CfdpHandler::reportIndication(const cfdp::TransactionId& id, cfdp::StatusReportIF& report) {} -void CfdpHandler::suspendedIndication(const cfdp::TransactionId& id, cfdp::ConditionCode code) {} -void CfdpHandler::resumedIndication(const cfdp::TransactionId& id, size_t progress) {} -void CfdpHandler::faultIndication(const cfdp::TransactionId& id, cfdp::ConditionCode code, - size_t progress) {} -void CfdpHandler::abandonedIndication(const cfdp::TransactionId& id, cfdp::ConditionCode code, - size_t progress) {} -void CfdpHandler::eofRecvIndication(const cfdp::TransactionId& id) {} - ReturnValue_t CfdpHandler::handleCfdpPacket(TmTcMessage& msg) { auto accessorPair = tcStore->getData(msg.getStorageId()); if(accessorPair.first != OK) { diff --git a/bsp_hosted/core/CfdpHandler.h b/bsp_hosted/core/CfdpHandler.h index 21aef3f..20bcd7f 100644 --- a/bsp_hosted/core/CfdpHandler.h +++ b/bsp_hosted/core/CfdpHandler.h @@ -22,23 +22,26 @@ struct FsfwHandlerParams { struct CfdpHandlerCfg { CfdpHandlerCfg(cfdp::EntityId localId, cfdp::IndicationCfg indicationCfg, - cfdp::PacketInfoListBase& packetInfo, cfdp::LostSegmentsListBase& lostSegmentsList, + cfdp::UserBase &userHandler, + cfdp::PacketInfoListBase& packetInfo, + cfdp::LostSegmentsListBase& lostSegmentsList, cfdp::RemoteConfigTableIF& remoteCfgProvider) : id(std::move(localId)), indicCfg(indicationCfg), packetInfoList(packetInfo), lostSegmentsList(lostSegmentsList), - remoteCfgProvider(remoteCfgProvider) {} + remoteCfgProvider(remoteCfgProvider), + userHandler(userHandler) {} cfdp::EntityId id; cfdp::IndicationCfg indicCfg; cfdp::PacketInfoListBase& packetInfoList; cfdp::LostSegmentsListBase& lostSegmentsList; cfdp::RemoteConfigTableIF& remoteCfgProvider; + cfdp::UserBase& userHandler; }; class CfdpHandler : public SystemObject, - public cfdp::UserBase, public cfdp::FaultHandlerBase, public ExecutableObjectIF, public AcceptsTelecommandsIF { @@ -52,20 +55,6 @@ class CfdpHandler : public SystemObject, ReturnValue_t initialize() override; ReturnValue_t performOperation(uint8_t operationCode) override; - // CFDP user overrides - void transactionIndication(const cfdp::TransactionId& id) override; - void eofSentIndication(const cfdp::TransactionId& id) override; - void transactionFinishedIndication(const cfdp::TransactionFinishedParams& params) override; - void metadataRecvdIndication(const cfdp::MetadataRecvdParams& params) override; - void fileSegmentRecvdIndication(const cfdp::FileSegmentRecvdParams& params) override; - void reportIndication(const cfdp::TransactionId& id, cfdp::StatusReportIF& report) override; - void suspendedIndication(const cfdp::TransactionId& id, cfdp::ConditionCode code) override; - void resumedIndication(const cfdp::TransactionId& id, size_t progress) override; - void faultIndication(const cfdp::TransactionId& id, cfdp::ConditionCode code, - size_t progress) override; - void abandonedIndication(const cfdp::TransactionId& id, cfdp::ConditionCode code, - size_t progress) override; - void eofRecvIndication(const cfdp::TransactionId& id) override; void noticeOfSuspensionCb(cfdp::ConditionCode code) override; void noticeOfCancellationCb(cfdp::ConditionCode code) override; void abandonCb(cfdp::ConditionCode code) override; diff --git a/bsp_hosted/core/ObjectFactory.cpp b/bsp_hosted/core/ObjectFactory.cpp index 9c23b6c..2e11f38 100644 --- a/bsp_hosted/core/ObjectFactory.cpp +++ b/bsp_hosted/core/ObjectFactory.cpp @@ -22,6 +22,31 @@ #include "fsfw/osal/common/TcpTmTcServer.h" #endif +class CfdpExampleUserHandler: public cfdp::UserBase { + public: + explicit CfdpExampleUserHandler(HasFileSystemIF& vfs): cfdp::UserBase(vfs) {} + + void transactionIndication(const cfdp::TransactionId& id) override {} + void eofSentIndication(const cfdp::TransactionId& id) override {} + void transactionFinishedIndication(const cfdp::TransactionFinishedParams& params) override { + sif::info << "File transaction finished for transaction with " << params.id << std::endl; + } + void metadataRecvdIndication(const cfdp::MetadataRecvdParams& params) override { + sif::info << "Metadata received for transaction with " << params.id << std::endl; + } + void fileSegmentRecvdIndication(const cfdp::FileSegmentRecvdParams& params) override {} + void reportIndication(const cfdp::TransactionId& id, cfdp::StatusReportIF& report) override {} + void suspendedIndication(const cfdp::TransactionId& id, cfdp::ConditionCode code) override {} + void resumedIndication(const cfdp::TransactionId& id, size_t progress) override {} + void faultIndication(const cfdp::TransactionId& id, cfdp::ConditionCode code, + size_t progress) override {} + void abandonedIndication(const cfdp::TransactionId& id, cfdp::ConditionCode code, + size_t progress) override {} + void eofRecvIndication(const cfdp::TransactionId& id) override { + sif::info << "EOF PDU received for transaction with " << id << std::endl; + } +}; + void ObjectFactory::produce(void* args) { Factory::setStaticFrameworkObjectIds(); StorageManagerIF* tcStore = nullptr; @@ -74,11 +99,15 @@ void ObjectFactory::produce(void* args) { cfdp::IndicationCfg indicationCfg; UnsignedByteField apid(common::COMMON_CFDP_APID); cfdp::EntityId localId(apid); - cfdp::RemoteEntityCfg remoteCfg; - cfdp::OneRemoteConfigProvider remoteCfgProvider(remoteCfg); + UnsignedByteField remoteEntityId(common::COMMON_CFDP_CLIENT_ENTITY_ID); + cfdp::EntityId remoteId(remoteEntityId); + cfdp::RemoteEntityCfg remoteCfg(remoteId); + remoteCfg.defaultChecksum = cfdp::ChecksumTypes::CRC_32; + auto* remoteCfgProvider = new cfdp::OneRemoteConfigProvider(remoteCfg); + auto* cfdpUserHandler = new CfdpExampleUserHandler(*hostFs); cfdp::PacketInfoList<64> packetList; cfdp::LostSegmentsList<128> lostSegments; - CfdpHandlerCfg cfg(localId, indicationCfg, packetList, lostSegments, remoteCfgProvider); + CfdpHandlerCfg cfg(localId, indicationCfg, *cfdpUserHandler, packetList, lostSegments, *remoteCfgProvider); auto* cfdpHandler = new CfdpHandler(params, cfg); CcsdsDistributorIF::DestInfo info("CFDP Destination", common::COMMON_CFDP_APID, cfdpHandler->getRequestQueue(), true); diff --git a/example_common b/example_common index 2258577..6b914a2 160000 --- a/example_common +++ b/example_common @@ -1 +1 @@ -Subproject commit 22585773e7b31975a0335344036d3b6baa4d0fcb +Subproject commit 6b914a21fd52fe184784b90984bb4bc2db82544d diff --git a/fsfw b/fsfw index 382543f..44615c1 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 382543fc5989c6608e0aa7550ace6aa70f7d78e3 +Subproject commit 44615c150b7690a3beccf459e3203561f17edf0a diff --git a/tmtc/common_tmtc b/tmtc/common_tmtc index 6ee3fa6..0e1d451 160000 --- a/tmtc/common_tmtc +++ b/tmtc/common_tmtc @@ -1 +1 @@ -Subproject commit 6ee3fa67dc1d34288192b512d4e7cc0927c51b7d +Subproject commit 0e1d4516519573fb33319eac7e9a56906a8db1a6