diff --git a/bsp_q7s/OBSWConfig.h.in b/bsp_q7s/OBSWConfig.h.in index 5cde824d..dce3dcc4 100644 --- a/bsp_q7s/OBSWConfig.h.in +++ b/bsp_q7s/OBSWConfig.h.in @@ -124,7 +124,8 @@ // because UDP packets are not allowed in the VPN // This will cause the OBSW to initialize the TMTC bridge responsible for exchanging data with the // CCSDS IP Cores. -#define OBSW_USE_TMTC_TCP_BRIDGE 1 +#define OBSW_ADD_TMTC_TCP_SERVER 1 +#define OBSW_ADD_TMTC_UDP_SERVER 1 #cmakedefine EIVE_BUILD_GPSD_GPS_HANDLER diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index 05660705..a1491044 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -10,9 +10,10 @@ #include "fsfw/timemanager/Stopwatch.h" #include "fsfw/version.h" #include "watchdog/definitions.h" -#if OBSW_USE_TMTC_TCP_BRIDGE == 0 +#if OBSW_ADD_TMTC_UDP_SERVER == 1 #include "fsfw/osal/common/UdpTmTcBridge.h" -#else +#endif +#if OBSW_ADD_TMTC_TCP_SERVER == 1 #include "fsfw/osal/common/TcpTmTcServer.h" #endif #include diff --git a/bsp_q7s/core/scheduling.cpp b/bsp_q7s/core/scheduling.cpp index 5a8c3827..840301d5 100644 --- a/bsp_q7s/core/scheduling.cpp +++ b/bsp_q7s/core/scheduling.cpp @@ -92,11 +92,19 @@ void scheduling::initTasks() { /* TMTC Distribution */ PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask( "DIST", 45, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc); -#if OBSW_ADD_TCPIP_BRIDGE == 1 - result = tmTcDistributor->addComponent(objects::TMTC_BRIDGE); +#if OBSW_ADD_TCPIP_SERVERS == 1 +#if OBSW_ADD_TMTC_UDP_SERVER == 1 + result = tmTcDistributor->addComponent(objects::UDP_TMTC_SERVER); if (result != returnvalue::OK) { - scheduling::printAddObjectError("TMTC_BRIDGE", objects::TMTC_BRIDGE); + scheduling::printAddObjectError("UDP_TMTC_SERVER", objects::UDP_TMTC_SERVER); } +#endif +#if OBSW_ADD_TMTC_TCP_SERVER == 1 + result = tmTcDistributor->addComponent(objects::TCP_TMTC_SERVER); + if (result != returnvalue::OK) { + scheduling::printAddObjectError("TCP_TMTC_SERVER", objects::TCP_TMTC_SERVER); + } +#endif #endif result = tmTcDistributor->addComponent(objects::CCSDS_PACKET_DISTRIBUTOR); if (result != returnvalue::OK) { @@ -115,14 +123,24 @@ void scheduling::initTasks() { scheduling::printAddObjectError("TM_FUNNEL", objects::TM_FUNNEL); } -#if OBSW_ADD_TCPIP_BRIDGE == 1 - PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask( - "TMTC_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc); - result = tmtcPollingTask->addComponent(objects::TMTC_POLLING_TASK); +#if OBSW_ADD_TCPIP_SERVERS == 1 +#if OBSW_ADD_TMTC_UDP_SERVER == 1 + PeriodicTaskIF* udpPollingTask = factory->createPeriodicTask( + "UDP_TMTC_POLLING", 65, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc); + result = udpPollingTask->addComponent(objects::UDP_TMTC_POLLING_TASK); if (result != returnvalue::OK) { - scheduling::printAddObjectError("UDP_POLLING", objects::TMTC_POLLING_TASK); + scheduling::printAddObjectError("UDP_POLLING", objects::UDP_TMTC_POLLING_TASK); } #endif +#if OBSW_ADD_TMTC_TCP_SERVER == 1 + PeriodicTaskIF* tcpPollingTask = factory->createPeriodicTask( + "TCP_TMTC_POLLING", 65, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc); + result = tcpPollingTask->addComponent(objects::TCP_TMTC_POLLING_TASK); + if (result != returnvalue::OK) { + scheduling::printAddObjectError("UDP_POLLING", objects::TCP_TMTC_POLLING_TASK); + } +#endif +#endif #if OBSW_ADD_CCSDS_IP_CORES == 1 PeriodicTaskIF* ccsdsHandlerTask = factory->createPeriodicTask( @@ -320,8 +338,13 @@ void scheduling::initTasks() { sif::info << "Starting tasks.." << std::endl; tmTcDistributor->startTask(); -#if OBSW_ADD_TCPIP_BRIDGE == 1 - tmtcPollingTask->startTask(); +#if OBSW_ADD_TCPIP_SERVERS == 1 +#if OBSW_ADD_TMTC_UDP_SERVER == 1 + udpPollingTask->startTask(); +#endif +#if OBSW_ADD_TMTC_TCP_SERVER == 1 + tcpPollingTask->startTask(); +#endif #endif #if OBSW_ADD_CCSDS_IP_CORES == 1 diff --git a/common/config/commonConfig.h.in b/common/config/commonConfig.h.in index 4fcc308f..effa9c4f 100644 --- a/common/config/commonConfig.h.in +++ b/common/config/commonConfig.h.in @@ -17,7 +17,7 @@ debugging. */ #define OBSW_ADD_LWGPS_TEST 0 // Disable this for mission code. It allows exchanging TMTC packets via the Ethernet port -#define OBSW_ADD_TCPIP_BRIDGE 1 +#define OBSW_ADD_TCPIP_SERVERS 1 #define OBSW_ADD_CFDP_COMPONENTS 1 diff --git a/common/config/eive/objects.h b/common/config/eive/objects.h index a8911347..9fb4aeff 100644 --- a/common/config/eive/objects.h +++ b/common/config/eive/objects.h @@ -8,8 +8,10 @@ enum commonObjects : uint32_t { /* First Byte 0x50-0x52 reserved for PUS Services **/ CCSDS_PACKET_DISTRIBUTOR = 0x50000100, PUS_PACKET_DISTRIBUTOR = 0x50000200, - TMTC_BRIDGE = 0x50000300, - TMTC_POLLING_TASK = 0x50000400, + TCP_TMTC_SERVER = 0x50000300, + UDP_TMTC_SERVER = 0x50000301, + TCP_TMTC_POLLING_TASK = 0x50000400, + UDP_TMTC_POLLING_TASK = 0x50000401, FILE_SYSTEM_HANDLER = 0x50000500, SDC_MANAGER = 0x50000550, PTME = 0x50000600, diff --git a/mission/core/GenericFactory.cpp b/mission/core/GenericFactory.cpp index 114451b2..cca48baf 100644 --- a/mission/core/GenericFactory.cpp +++ b/mission/core/GenericFactory.cpp @@ -33,12 +33,13 @@ #include "objects/systemObjectList.h" #include "tmtc/pusIds.h" -#if OBSW_ADD_TCPIP_BRIDGE == 1 -#if OBSW_USE_TMTC_TCP_BRIDGE == 0 +#if OBSW_ADD_TCPIP_SERVERS == 1 +#if OBSW_ADD_TMTC_UDP_SERVER == 1 // UDP server includes #include "fsfw/osal/common/UdpTcPollingTask.h" #include "fsfw/osal/common/UdpTmTcBridge.h" -#else +#endif +#if OBSW_ADD_TMTC_TCP_SERVER == 1 // TCP server includes #include "fsfw/osal/common/TcpTmTcBridge.h" #include "fsfw/osal/common/TcpTmTcServer.h" @@ -97,24 +98,23 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_, PusTmFun new PoolManager(objects::IPC_STORE, poolCfg); } -#if OBSW_ADD_TCPIP_BRIDGE == 1 -#if OBSW_USE_TMTC_TCP_BRIDGE == 0 - auto tmtcBridge = new UdpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR); - new UdpTcPollingTask(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE); +#if OBSW_ADD_TCPIP_SERVERS == 1 +#if OBSW_ADD_TMTC_UDP_SERVER == 1 + auto udpBridge = new UdpTmTcBridge(objects::UDP_TMTC_SERVER, objects::CCSDS_PACKET_DISTRIBUTOR); + new UdpTcPollingTask(objects::UDP_TMTC_POLLING_TASK, objects::UDP_TMTC_SERVER); sif::info << "Created UDP server for TMTC commanding with listener port " - << tmtcBridge->getUdpPort() << std::endl; -#else - auto tmtcBridge = new TcpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR); - auto tcpServer = new TcpTmTcServer(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE); + << udpBridge->getUdpPort() << std::endl; + udpBridge->setMaxNumberOfPacketsStored(150); +#endif +#if OBSW_ADD_TMTC_TCP_SERVER == 1 + auto tcpBridge = new TcpTmTcBridge(objects::TCP_TMTC_SERVER, objects::CCSDS_PACKET_DISTRIBUTOR); + auto tcpServer = new TcpTmTcServer(objects::TCP_TMTC_POLLING_TASK, objects::TCP_TMTC_SERVER); // TCP is stream based. Use packet ID as start marker when parsing for space packets tcpServer->setSpacePacketParsingOptions({common::PUS_PACKET_ID, common::CFDP_PACKET_ID}); sif::info << "Created TCP server for TMTC commanding with listener port " << tcpServer->getTcpPort() << std::endl; -#if OBSW_TCP_SERVER_WIRETAPPING == 1 - tcpServer->enableWiretapping(true); -#endif /* OBSW_TCP_SERVER_WIRETAPPING == 1 */ + tcpBridge->setMaxNumberOfPacketsStored(150); #endif /* OBSW_USE_TMTC_TCP_BRIDGE == 0 */ - tmtcBridge->setMaxNumberOfPacketsStored(150); #endif /* OBSW_ADD_TCPIP_BRIDGE == 1 */ auto* ccsdsDistrib = @@ -123,9 +123,15 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_, PusTmFun *cfdpFunnel = new CfdpTmFunnel(objects::CFDP_TM_FUNNEL, config::EIVE_CFDP_APID, *tmStore, 50); *pusFunnel = new PusTmFunnel(objects::PUS_TM_FUNNEL, *timeStamper, *tmStore, 80); -#if OBSW_ADD_TCPIP_BRIDGE == 1 - (*cfdpFunnel)->addDestination(*tmtcBridge, 0); - (*pusFunnel)->addDestination(*tmtcBridge, 0); +#if OBSW_ADD_TCPIP_SERVERS == 1 +#if OBSW_ADD_TMTC_UDP_SERVER == 1 + (*cfdpFunnel)->addDestination(*udpBridge, 0); + (*pusFunnel)->addDestination(*udpBridge, 0); +#endif +#if OBSW_ADD_TMTC_TCP_SERVER == 1 + (*cfdpFunnel)->addDestination(*tcpBridge, 0); + (*pusFunnel)->addDestination(*tcpBridge, 0); +#endif #endif // Every TM packet goes through this funnel new TmFunnelHandler(objects::TM_FUNNEL, **pusFunnel, **cfdpFunnel);