diff --git a/bsp_hosted/OBSWConfig.h.in b/bsp_hosted/OBSWConfig.h.in index f234e795..e58e534d 100644 --- a/bsp_hosted/OBSWConfig.h.in +++ b/bsp_hosted/OBSWConfig.h.in @@ -102,11 +102,8 @@ /** CMake Defines */ /*******************************************************************/ -// Use TCP instead of UDP for the TMTC bridge. This allows using the TMTC client locally -// 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 0 +#define OBSW_ADD_TMTC_UDP_SERVER 1 +#define OBSW_ADD_TMTC_TCP_SERVER 1 #cmakedefine EIVE_BUILD_GPSD_GPS_HANDLER diff --git a/bsp_hosted/ObjectFactory.cpp b/bsp_hosted/ObjectFactory.cpp index ce281b09..cc955148 100644 --- a/bsp_hosted/ObjectFactory.cpp +++ b/bsp_hosted/ObjectFactory.cpp @@ -13,10 +13,11 @@ #include "fsfw/platform.h" #include "fsfw_tests/integration/task/TestTask.h" -#if OBSW_USE_TMTC_TCP_BRIDGE == 0 +#if OBSW_ADD_TMTC_UDP_SERVER == 1 #include "fsfw/osal/common/UdpTcPollingTask.h" #include "fsfw/osal/common/UdpTmTcBridge.h" -#else +#endif +#if OBSW_ADD_TMTC_TCP_SERVER == 1 #include "fsfw/osal/common/TcpTmTcBridge.h" #include "fsfw/osal/common/TcpTmTcServer.h" #endif diff --git a/bsp_hosted/scheduling.cpp b/bsp_hosted/scheduling.cpp index 5be4429a..469d7f38 100644 --- a/bsp_hosted/scheduling.cpp +++ b/bsp_hosted/scheduling.cpp @@ -69,14 +69,24 @@ void scheduling::initTasks() { if (result != returnvalue::OK) { sif::error << "Object add component failed" << std::endl; } - result = tmtcDistributor->addComponent(objects::TMTC_BRIDGE); + result = tmtcDistributor->addComponent(objects::UDP_TMTC_SERVER); + if (result != returnvalue::OK) { + sif::error << "Add component UDP Unix Bridge failed" << std::endl; + } + result = tmtcDistributor->addComponent(objects::TCP_TMTC_SERVER); if (result != returnvalue::OK) { sif::error << "Add component UDP Unix Bridge failed" << std::endl; } - PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask( - "UDP_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc); - result = tmtcPollingTask->addComponent(objects::TMTC_POLLING_TASK); + PeriodicTaskIF* udpPollingTask = factory->createPeriodicTask( + "UDP_POLLING", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc); + result = udpPollingTask->addComponent(objects::UDP_TMTC_POLLING_TASK); + if (result != returnvalue::OK) { + sif::error << "Add component UDP Polling failed" << std::endl; + } + PeriodicTaskIF* tcpPollingTask = factory->createPeriodicTask( + "TCP_POLLING", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc); + result = tcpPollingTask->addComponent(objects::TCP_TMTC_POLLING_TASK); if (result != returnvalue::OK) { sif::error << "Add component UDP Polling failed" << std::endl; } @@ -139,11 +149,6 @@ void scheduling::initTasks() { PeriodicTaskIF* thermalTask = factory->createPeriodicTask( "THERMAL_CTL_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc); - result = thermalTask->addComponent(objects::SUS_0_N_LOC_XFYFZM_PT_XF); - if (result != returnvalue::OK) { - scheduling::printAddObjectError("SUS_0_dummy", objects::SUS_0_N_LOC_XFYFZM_PT_XF); - } - result = thermalTask->addComponent(objects::CORE_CONTROLLER); if (result != returnvalue::OK) { scheduling::printAddObjectError("Core controller dummy", objects::CORE_CONTROLLER); @@ -180,14 +185,48 @@ void scheduling::initTasks() { } #endif /* OBSW_ADD_TEST_CODE == 1 */ +<<<<<<< HEAD PeriodicTaskIF* tcsTask = factory->createPeriodicTask( "TCS_TASK", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.5, missedDeadlineFunc); scheduling::scheduleTmpTempSensors(tcsTask); scheduling::scheduleRtdSensors(tcsTask); +======= + PeriodicTaskIF* dummyTask = factory->createPeriodicTask( + "DUMMY_TASK", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc); + dummyTask->addComponent(objects::SUS_0_N_LOC_XFYFZM_PT_XF); + dummyTask->addComponent(objects::SUS_1_N_LOC_XBYFZM_PT_XB); + dummyTask->addComponent(objects::SUS_2_N_LOC_XFYBZB_PT_YB); + dummyTask->addComponent(objects::SUS_3_N_LOC_XFYBZF_PT_YF); + dummyTask->addComponent(objects::SUS_4_N_LOC_XMYFZF_PT_ZF); + dummyTask->addComponent(objects::SUS_5_N_LOC_XFYMZB_PT_ZB); + dummyTask->addComponent(objects::SUS_6_R_LOC_XFYBZM_PT_XF); + dummyTask->addComponent(objects::SUS_7_R_LOC_XBYBZM_PT_XB); + dummyTask->addComponent(objects::SUS_8_R_LOC_XBYBZB_PT_YB); + dummyTask->addComponent(objects::SUS_9_R_LOC_XBYBZB_PT_YF); + dummyTask->addComponent(objects::SUS_10_N_LOC_XMYBZF_PT_ZF); + dummyTask->addComponent(objects::SUS_11_R_LOC_XBYMZB_PT_ZB); + dummyTask->addComponent(objects::RTD_0_IC3_PLOC_HEATSPREADER); + dummyTask->addComponent(objects::RTD_1_IC4_PLOC_MISSIONBOARD); + dummyTask->addComponent(objects::RTD_2_IC5_4K_CAMERA); + dummyTask->addComponent(objects::RTD_3_IC6_DAC_HEATSPREADER); + dummyTask->addComponent(objects::RTD_4_IC7_STARTRACKER); + dummyTask->addComponent(objects::RTD_5_IC8_RW1_MX_MY); + dummyTask->addComponent(objects::RTD_6_IC9_DRO); + dummyTask->addComponent(objects::RTD_7_IC10_SCEX); + dummyTask->addComponent(objects::RTD_8_IC11_X8); + dummyTask->addComponent(objects::RTD_9_IC12_HPA); + dummyTask->addComponent(objects::RTD_10_IC13_PL_TX); + dummyTask->addComponent(objects::RTD_11_IC14_MPA); + dummyTask->addComponent(objects::RTD_12_IC15_ACU); + dummyTask->addComponent(objects::RTD_13_IC16_PLPCDU_HEATSPREADER); + dummyTask->addComponent(objects::RTD_14_IC17_TCS_BOARD); + dummyTask->addComponent(objects::RTD_15_IC18_IMTQ); +>>>>>>> origin/develop sif::info << "Starting tasks.." << std::endl; tmtcDistributor->startTask(); - tmtcPollingTask->startTask(); + udpPollingTask->startTask(); + tcpPollingTask->startTask(); pusVerification->startTask(); eventHandling->startTask(); @@ -197,7 +236,11 @@ void scheduling::initTasks() { pstTask->startTask(); thermalTask->startTask(); +<<<<<<< HEAD tcsTask->startTask(); +======= + dummyTask->startTask(); +>>>>>>> origin/develop #if OBSW_ADD_PLOC_SUPERVISOR == 1 supvHelperTask->startTask(); #endif diff --git a/bsp_q7s/OBSWConfig.h.in b/bsp_q7s/OBSWConfig.h.in index fd4c7659..5dff001c 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 33f52f4c..cc299247 100644 --- a/bsp_q7s/core/scheduling.cpp +++ b/bsp_q7s/core/scheduling.cpp @@ -93,11 +93,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) { @@ -116,14 +124,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( @@ -325,8 +343,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 09bb0fa5..3b8b99b9 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 5eef0531..5428d7c4 100644 --- a/mission/core/GenericFactory.cpp +++ b/mission/core/GenericFactory.cpp @@ -37,16 +37,14 @@ #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 "devices/gpioIds.h" #include "fsfw/osal/common/UdpTcPollingTask.h" #include "fsfw/osal/common/UdpTmTcBridge.h" -#include "mission/controller/ThermalController.h" -#include "mission/devices/HeaterHandler.h" -#include "mission/devices/devicedefinitions/GomspaceDefinitions.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" @@ -105,24 +103,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 = @@ -131,9 +128,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);