diff --git a/bsp_hosted/core/ObjectFactory.cpp b/bsp_hosted/core/ObjectFactory.cpp index ee1c188..7b2313d 100644 --- a/bsp_hosted/core/ObjectFactory.cpp +++ b/bsp_hosted/core/ObjectFactory.cpp @@ -2,15 +2,12 @@ #include "OBSWConfig.h" #include "bsp_hosted/fsfwconfig/objects/systemObjectList.h" -#include "common/definitions.h" #include "commonConfig.h" #include "example/core/GenericFactory.h" #include "example/test/FsfwTestTask.h" #include "example/utility/TmFunnel.h" -#include "fsfw/cfdp.h" #include "fsfw/storagemanager/PoolManager.h" #include "fsfw/tcdistribution/CcsdsDistributor.h" -#include "fsfw/tcdistribution/CcsdsDistributorIF.h" #include "fsfw/tmtcservices/CommandingServiceBase.h" #include "fsfw_hal/host/HostFilesystem.h" @@ -22,56 +19,21 @@ #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; - } -}; - -class CfdpExampleFaultHandler : public cfdp::FaultHandlerBase { - public: - void noticeOfSuspensionCb(cfdp::TransactionId& id, cfdp::ConditionCode code) override { - sif::warning << "Notice of suspension detected for transaction " << id - << " with condition code: " << cfdp::getConditionCodeString(code) << std::endl; - } - void noticeOfCancellationCb(cfdp::TransactionId& id, cfdp::ConditionCode code) override { - sif::warning << "Notice of suspension detected for transaction " << id - << " with condition code: " << cfdp::getConditionCodeString(code) << std::endl; - } - void abandonCb(cfdp::TransactionId& id, cfdp::ConditionCode code) override { - sif::warning << "Transaction " << id - << " was abandoned, condition code : " << cfdp::getConditionCodeString(code) - << std::endl; - } - void ignoreCb(cfdp::TransactionId& id, cfdp::ConditionCode code) override { - sif::warning << "Fault ignored for transaction " << id - << ", condition code: " << cfdp::getConditionCodeString(code) << std::endl; - } -}; +#if OBSW_ADD_CFDP_COMPONENTS == 1 +// These CFDP containers are user supplied because their size might differ depending on +// which system the example is run on +namespace cfdp { +PacketInfoList<128> PACKET_INFO; +PacketInfoListBase* PACKET_LIST_PTR = &PACKET_INFO; +LostSegmentsList<128> LOST_SEGMENTS; +LostSegmentsListBase* LOST_SEGMENTS_PTR = &LOST_SEGMENTS; +} // namespace cfdp +#endif void ObjectFactory::produce(void* args) { Factory::setStaticFrameworkObjectIds(); - StorageManagerIF* tcStore = nullptr; - StorageManagerIF* tmStore = nullptr; + StorageManagerIF* tcStore; + StorageManagerIF* tmStore; #if OBSW_ADD_CORE_COMPONENTS == 1 { LocalPool::LocalPoolConfig poolCfg = {{100, 16}, {50, 32}, {40, 64}, @@ -92,7 +54,7 @@ void ObjectFactory::produce(void* args) { } TmFunnel* funnel; CcsdsDistributor* ccsdsDistrib; - ObjectFactory::produceGenericObjects(&funnel, &ccsdsDistrib, *tcStore); + ObjectFactory::produceGenericObjects(&funnel, &ccsdsDistrib, *tcStore, *tmStore); // TMTC Reception via TCP/IP socket #if OBSW_USE_TCP_SERVER == 0 auto tmtcBridge = new UdpTmTcBridge(objects::TCPIP_TMTC_BRIDGE, objects::CCSDS_DISTRIBUTOR); @@ -113,27 +75,4 @@ void ObjectFactory::produce(void* args) { periodicEvent = true; #endif new FsfwTestTask(objects::TEST_TASK, periodicEvent); - -#if OBSW_ADD_CFDP_COMPONENTS == 1 - auto* hostFs = new HostFilesystem(); - FsfwHandlerParams params(objects::CFDP_HANDLER, *hostFs, *funnel, *tcStore, *tmStore); - cfdp::IndicationCfg indicationCfg; - UnsignedByteField apid(common::COMMON_CFDP_APID); - cfdp::EntityId localId(apid); - UnsignedByteField remoteEntityId(common::COMMON_CFDP_CLIENT_ENTITY_ID); - cfdp::EntityId remoteId(remoteEntityId); - cfdp::RemoteEntityCfg remoteCfg(remoteId); - remoteCfg.defaultChecksum = cfdp::ChecksumType::CRC_32; - auto* remoteCfgProvider = new cfdp::OneRemoteConfigProvider(remoteCfg); - auto* cfdpUserHandler = new CfdpExampleUserHandler(*hostFs); - auto* cfdpFaultHandler = new CfdpExampleFaultHandler(); - cfdp::PacketInfoList<64> packetList; - cfdp::LostSegmentsList<128> lostSegments; - CfdpHandlerCfg cfg(localId, indicationCfg, *cfdpUserHandler, *cfdpFaultHandler, packetList, - lostSegments, *remoteCfgProvider); - auto* cfdpHandler = new CfdpHandler(params, cfg); - CcsdsDistributorIF::DestInfo info("CFDP Destination", common::COMMON_CFDP_APID, - cfdpHandler->getRequestQueue(), true); - ccsdsDistrib->registerApplication(info); -#endif } diff --git a/example_common b/example_common index 29593e3..86797bb 160000 --- a/example_common +++ b/example_common @@ -1 +1 @@ -Subproject commit 29593e31420fa85cb67b8f2b10020ebde5c05ca2 +Subproject commit 86797bb6db5fde3303d3862cea47f965f5da0c2b diff --git a/fsfw b/fsfw index c38088c..bdbe0cc 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit c38088c64bd4ba63246e5c44f5dae6d7c2efc0e2 +Subproject commit bdbe0cc9da5edcaa8b01af4f6462a2f46d4628bd