From f89ca50bcba94bb8ffdd56080dc722dbe69c1790 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 13 Sep 2022 15:29:24 +0200 Subject: [PATCH] switch to default UDP TC server, bugfix --- bsp_hosted/core/CfdpHandler.cpp | 4 ++++ bsp_hosted/core/ObjectFactory.cpp | 13 ++++++++++--- bsp_hosted/fsfwconfig/OBSWConfig.h.in | 2 +- bsp_hosted/fsfwconfig/definitions.h | 10 ++++++++++ bsp_hosted/fsfwconfig/tmtc/apid.h | 12 ------------ fsfw | 2 +- tmtc/.idea/runConfigurations/CFDP_Test.xml | 2 +- tmtc/cfdp_test.txt | 1 + tmtc/common_tmtc | 2 +- tmtc/deps/tmtccmd | 2 +- tmtc/tmtc_conf.json | 2 +- 11 files changed, 31 insertions(+), 21 deletions(-) create mode 100644 bsp_hosted/fsfwconfig/definitions.h delete mode 100644 bsp_hosted/fsfwconfig/tmtc/apid.h create mode 100644 tmtc/cfdp_test.txt diff --git a/bsp_hosted/core/CfdpHandler.cpp b/bsp_hosted/core/CfdpHandler.cpp index d5e49f4..acc41b9 100644 --- a/bsp_hosted/core/CfdpHandler.cpp +++ b/bsp_hosted/core/CfdpHandler.cpp @@ -2,6 +2,7 @@ #include "fsfw/cfdp/pdu/AckPduReader.h" #include "fsfw/cfdp/pdu/PduHeaderReader.h" +#include "fsfw/globalfunctions/arrayprinter.h" #include "fsfw/ipc/QueueFactory.h" #include "fsfw/tmtcservices/TmTcMessage.h" @@ -78,6 +79,9 @@ void CfdpHandler::eofRecvIndication(const cfdp::TransactionId& id) {} ReturnValue_t CfdpHandler::handleCfdpPacket(TmTcMessage& msg) { auto accessorPair = tcStore->getData(msg.getStorageId()); + if(accessorPair.first != OK) { + return accessorPair.first; + } PduHeaderReader reader(accessorPair.second.data(), accessorPair.second.size()); ReturnValue_t result = reader.parseData(); if (result != returnvalue::OK) { diff --git a/bsp_hosted/core/ObjectFactory.cpp b/bsp_hosted/core/ObjectFactory.cpp index 3a3d1d6..9c23b6c 100644 --- a/bsp_hosted/core/ObjectFactory.cpp +++ b/bsp_hosted/core/ObjectFactory.cpp @@ -3,13 +3,16 @@ #include "CfdpHandler.h" #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/storagemanager/PoolManager.h" +#include "fsfw/tcdistribution/CcsdsDistributorIF.h" #include "fsfw/tmtcservices/CommandingServiceBase.h" #include "fsfw_hal/host/HostFilesystem.h" +#include "fsfw/tcdistribution/CcsdsDistributor.h" #if OBSW_USE_TCP_SERVER == 0 #include @@ -42,7 +45,8 @@ void ObjectFactory::produce(void* args) { new PoolManager(objects::IPC_STORE, poolCfg); } TmFunnel* funnel; - ObjectFactory::produceGenericObjects(&funnel, *tcStore); + CcsdsDistributor* ccsdsDistrib; + ObjectFactory::produceGenericObjects(&funnel, &ccsdsDistrib, *tcStore); // TMTC Reception via TCP/IP socket #if OBSW_USE_TCP_SERVER == 0 auto tmtcBridge = new UdpTmTcBridge(objects::TCPIP_TMTC_BRIDGE, objects::CCSDS_DISTRIBUTOR); @@ -68,13 +72,16 @@ void ObjectFactory::produce(void* args) { auto* hostFs = new HostFilesystem(); FsfwHandlerParams params(objects::CFDP_HANDLER, *hostFs, *funnel, *tcStore, *tmStore); cfdp::IndicationCfg indicationCfg; - UnsignedByteField apid(COMMON_APID); + UnsignedByteField apid(common::COMMON_CFDP_APID); cfdp::EntityId localId(apid); cfdp::RemoteEntityCfg remoteCfg; cfdp::OneRemoteConfigProvider remoteCfgProvider(remoteCfg); cfdp::PacketInfoList<64> packetList; cfdp::LostSegmentsList<128> lostSegments; CfdpHandlerCfg cfg(localId, indicationCfg, packetList, lostSegments, remoteCfgProvider); - new CfdpHandler(params, cfg); + 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/bsp_hosted/fsfwconfig/OBSWConfig.h.in b/bsp_hosted/fsfwconfig/OBSWConfig.h.in index 9487c31..c9f2acb 100644 --- a/bsp_hosted/fsfwconfig/OBSWConfig.h.in +++ b/bsp_hosted/fsfwconfig/OBSWConfig.h.in @@ -10,7 +10,7 @@ #define OBSW_TASK_PERIODIC_EVENT 0 // Use a TCP server instead of a UDP server for TMTC reception -#define OBSW_USE_TCP_SERVER 1 +#define OBSW_USE_TCP_SERVER 0 #ifdef __cplusplus diff --git a/bsp_hosted/fsfwconfig/definitions.h b/bsp_hosted/fsfwconfig/definitions.h new file mode 100644 index 0000000..6f6c860 --- /dev/null +++ b/bsp_hosted/fsfwconfig/definitions.h @@ -0,0 +1,10 @@ +#ifndef FSFW_EXAMPLE_HOSTED_DEFINITIONS_H +#define FSFW_EXAMPLE_HOSTED_DEFINITIONS_H + +#include + +namespace cfg { +static constexpr uint32_t OBSW_MAX_SCHEDULED_TCS = 200; +} + +#endif // FSFW_EXAMPLE_HOSTED_DEFINITIONS_H diff --git a/bsp_hosted/fsfwconfig/tmtc/apid.h b/bsp_hosted/fsfwconfig/tmtc/apid.h deleted file mode 100644 index 367b167..0000000 --- a/bsp_hosted/fsfwconfig/tmtc/apid.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef FSFWCONFIG_TMTC_APID_H_ -#define FSFWCONFIG_TMTC_APID_H_ - -#include - -#include - -namespace apid { -static const uint16_t APID = COMMON_APID; -}; - -#endif /* FSFWCONFIG_TMTC_APID_H_ */ diff --git a/fsfw b/fsfw index 26b3e5a..382543f 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 26b3e5a013726d86dfa5c64ec784499c763f143e +Subproject commit 382543fc5989c6608e0aa7550ace6aa70f7d78e3 diff --git a/tmtc/.idea/runConfigurations/CFDP_Test.xml b/tmtc/.idea/runConfigurations/CFDP_Test.xml index 1fba3c4..00d0777 100644 --- a/tmtc/.idea/runConfigurations/CFDP_Test.xml +++ b/tmtc/.idea/runConfigurations/CFDP_Test.xml @@ -13,7 +13,7 @@