added TCP support

This commit is contained in:
Robin Müller 2021-07-26 11:33:38 +02:00
parent e82ca9e749
commit be6ae6b7ae
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
11 changed files with 54 additions and 26 deletions

View File

@ -72,13 +72,13 @@ void initmission::initTasks() {
/* UDP bridge */ /* UDP bridge */
PeriodicTaskIF* udpBridgeTask = factory->createPeriodicTask( PeriodicTaskIF* udpBridgeTask = factory->createPeriodicTask(
"UDP_UNIX_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc); "UDP_UNIX_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
result = udpBridgeTask->addComponent(objects::UDP_BRIDGE); result = udpBridgeTask->addComponent(objects::TMTC_BRIDGE);
if(result != HasReturnvaluesIF::RETURN_OK) { if(result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Add component UDP Unix Bridge failed" << std::endl; sif::error << "Add component UDP Unix Bridge failed" << std::endl;
} }
PeriodicTaskIF* udpPollingTask = factory->createPeriodicTask( PeriodicTaskIF* udpPollingTask = factory->createPeriodicTask(
"UDP_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc); "UDP_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = udpPollingTask->addComponent(objects::UDP_POLLING_TASK); result = udpPollingTask->addComponent(objects::TMTC_POLLING_TASK);
if(result != HasReturnvaluesIF::RETURN_OK) { if(result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Add component UDP Polling failed" << std::endl; sif::error << "Add component UDP Polling failed" << std::endl;
} }

View File

@ -28,7 +28,7 @@ void Factory::setStaticFrameworkObjectIds(){
CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR; CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR;
CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL; CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL;
TmFunnel::downlinkDestination = objects::UDP_BRIDGE; TmFunnel::downlinkDestination = objects::TMTC_BRIDGE;
// No storage object for now. // No storage object for now.
TmFunnel::storageDestination = objects::NO_OBJECT; TmFunnel::storageDestination = objects::NO_OBJECT;
@ -40,7 +40,7 @@ void ObjectFactory::produce(void* args){
Factory::setStaticFrameworkObjectIds(); Factory::setStaticFrameworkObjectIds();
ObjectFactory::produceGenericObjects(); ObjectFactory::produceGenericObjects();
new UdpTmTcBridge(objects::UDP_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR); new UdpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
new UdpTcPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE); new UdpTcPollingTask(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE);
} }

View File

@ -66,13 +66,13 @@ void initmission::initTasks() {
/* UDP bridge */ /* UDP bridge */
PeriodicTaskIF* udpBridgeTask = factory->createPeriodicTask( PeriodicTaskIF* udpBridgeTask = factory->createPeriodicTask(
"UDP_UNIX_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc); "UDP_UNIX_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
result = udpBridgeTask->addComponent(objects::UDP_BRIDGE); result = udpBridgeTask->addComponent(objects::TMTC_BRIDGE);
if(result != HasReturnvaluesIF::RETURN_OK) { if(result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Add component UDP Unix Bridge failed" << std::endl; sif::error << "Add component UDP Unix Bridge failed" << std::endl;
} }
PeriodicTaskIF* udpPollingTask = factory->createPeriodicTask( PeriodicTaskIF* udpPollingTask = factory->createPeriodicTask(
"UDP_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc); "UDP_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = udpPollingTask->addComponent(objects::UDP_POLLING_TASK); result = udpPollingTask->addComponent(objects::TMTC_POLLING_TASK);
if(result != HasReturnvaluesIF::RETURN_OK) { if(result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Add component UDP Polling failed" << std::endl; sif::error << "Add component UDP Polling failed" << std::endl;
} }

View File

@ -45,7 +45,7 @@ void Factory::setStaticFrameworkObjectIds() {
CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR; CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR;
CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL; CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL;
TmFunnel::downlinkDestination = objects::UDP_BRIDGE; TmFunnel::downlinkDestination = objects::TMTC_BRIDGE;
// No storage object for now. // No storage object for now.
TmFunnel::storageDestination = objects::NO_OBJECT; TmFunnel::storageDestination = objects::NO_OBJECT;
@ -59,8 +59,8 @@ void ObjectFactory::produce(void* args){
Factory::setStaticFrameworkObjectIds(); Factory::setStaticFrameworkObjectIds();
ObjectFactory::produceGenericObjects(); ObjectFactory::produceGenericObjects();
new UdpTmTcBridge(objects::UDP_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR); new UdpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
new UdpTcPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE); new UdpTcPollingTask(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE);
GpioIF* gpioIF = new LinuxLibgpioIF(objects::GPIO_IF); GpioIF* gpioIF = new LinuxLibgpioIF(objects::GPIO_IF);
GpioCookie* gpioCookie = nullptr; GpioCookie* gpioCookie = nullptr;

View File

@ -82,19 +82,20 @@ void initmission::initTasks() {
} }
/* UDP bridge */ /* UDP bridge */
PeriodicTaskIF* udpBridgeTask = factory->createPeriodicTask( PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask(
"UDP_UNIX_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc); "UDP_UNIX_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
result = udpBridgeTask->addComponent(objects::UDP_BRIDGE); result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE);
if(result != HasReturnvaluesIF::RETURN_OK) { if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("UDP_BRIDGE", objects::UDP_BRIDGE); initmission::printAddObjectError("UDP_BRIDGE", objects::TMTC_BRIDGE);
} }
PeriodicTaskIF* udpPollingTask = factory->createPeriodicTask( PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask(
"UDP_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc); "UDP_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = udpPollingTask->addComponent(objects::UDP_POLLING_TASK); result = tmtcPollingTask->addComponent(objects::TMTC_POLLING_TASK);
if(result != HasReturnvaluesIF::RETURN_OK) { if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("UDP_POLLING", objects::UDP_POLLING_TASK); initmission::printAddObjectError("UDP_POLLING", objects::TMTC_POLLING_TASK);
} }
// FS task, task interval does not matter because it runs in permanent loop, priority low // FS task, task interval does not matter because it runs in permanent loop, priority low
// because it is a non-essential background task // because it is a non-essential background task
PeriodicTaskIF* fsTask = factory->createPeriodicTask( PeriodicTaskIF* fsTask = factory->createPeriodicTask(
@ -133,8 +134,8 @@ void initmission::initTasks() {
sif::info << "Starting tasks.." << std::endl; sif::info << "Starting tasks.." << std::endl;
tmTcDistributor->startTask(); tmTcDistributor->startTask();
udpBridgeTask->startTask(); tmtcBridgeTask->startTask();
udpPollingTask->startTask(); tmtcPollingTask->startTask();
coreController->startTask(); coreController->startTask();
taskStarter(pstTasks, "PST task vector"); taskStarter(pstTasks, "PST task vector");

View File

@ -63,9 +63,16 @@
#include "fsfw/tmtcservices/PusServiceBase.h" #include "fsfw/tmtcservices/PusServiceBase.h"
#include "fsfw/tmtcpacket/pus/tm.h" #include "fsfw/tmtcpacket/pus/tm.h"
/* UDP server includes */ #if OBSW_USE_TMTC_TCP_BRIDGE == 0
// UDP server includes
#include "fsfw/osal/common/UdpTmTcBridge.h" #include "fsfw/osal/common/UdpTmTcBridge.h"
#include "fsfw/osal/common/UdpTcPollingTask.h" #include "fsfw/osal/common/UdpTcPollingTask.h"
#else
// TCP server includes
#include "fsfw/osal/common/TcpTmTcBridge.h"
#include "fsfw/osal/common/TcpTmTcServer.h"
#endif
#include "linux/boardtest/SpiTestClass.h" #include "linux/boardtest/SpiTestClass.h"
#if TEST_LIBGPIOD == 1 #if TEST_LIBGPIOD == 1
@ -83,7 +90,7 @@ void Factory::setStaticFrameworkObjectIds() {
CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR; CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR;
CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL; CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL;
TmFunnel::downlinkDestination = objects::UDP_BRIDGE; TmFunnel::downlinkDestination = objects::TMTC_BRIDGE;
// No storage object for now. // No storage object for now.
TmFunnel::storageDestination = objects::NO_OBJECT; TmFunnel::storageDestination = objects::NO_OBJECT;
@ -131,8 +138,13 @@ void ObjectFactory::produce(void* args){
createReactionWheelComponents(gpioComIF); createReactionWheelComponents(gpioComIF);
#endif /* TE7020 != 0 */ #endif /* TE7020 != 0 */
new UdpTmTcBridge(objects::UDP_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR); #if OBSW_USE_TMTC_TCP_BRIDGE == 0
new UdpTcPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE); new UdpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
new UdpTcPollingTask(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE);
#else
new TcpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
new TcpTmTcServer(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE);
#endif
/* Test Task */ /* Test Task */
#if OBSW_ADD_TEST_CODE == 1 #if OBSW_ADD_TEST_CODE == 1

View File

@ -3,5 +3,4 @@
#define OBSW_ADD_LWGPS_TEST 0 #define OBSW_ADD_LWGPS_TEST 0
#endif /* COMMON_CONFIG_COMMONCONFIG_H_ */ #endif /* COMMON_CONFIG_COMMONCONFIG_H_ */

View File

@ -8,8 +8,8 @@ enum commonObjects: uint32_t {
/* First Byte 0x50-0x52 reserved for PUS Services **/ /* First Byte 0x50-0x52 reserved for PUS Services **/
CCSDS_PACKET_DISTRIBUTOR = 0x50000100, CCSDS_PACKET_DISTRIBUTOR = 0x50000100,
PUS_PACKET_DISTRIBUTOR = 0x50000200, PUS_PACKET_DISTRIBUTOR = 0x50000200,
UDP_BRIDGE = 0x50000300, TMTC_BRIDGE = 0x50000300,
UDP_POLLING_TASK = 0x50000400, TMTC_POLLING_TASK = 0x50000400,
FILE_SYSTEM_HANDLER = 0x50000500, FILE_SYSTEM_HANDLER = 0x50000500,
/* 0x43 ('C') for Controllers */ /* 0x43 ('C') for Controllers */

View File

@ -17,6 +17,11 @@
/* These defines should be disabled for mission code but are useful for /* These defines should be disabled for mission code but are useful for
debugging. */ debugging. */
#define OBSW_VERBOSE_LEVEL 1 #define OBSW_VERBOSE_LEVEL 1
// 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
#define OBSW_USE_TMTC_TCP_BRIDGE 1
#define OBSW_PRINT_MISSED_DEADLINES 1 #define OBSW_PRINT_MISSED_DEADLINES 1
#define OBSW_ADD_TEST_CODE 1 #define OBSW_ADD_TEST_CODE 1
#define OBSW_ADD_TEST_PST 1 #define OBSW_ADD_TEST_PST 1

11
scripts/q7s-port-tcp.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
echo "Setting up all Q7S ports"
echo "-L 1534:192.168.133.10:1534 for connection to TCF agent"
echo "-L 1535:192.168.133.10:22 for file transfers"
echo "-L 1536:192.168.133.10:7303 to TMTC commanding using TCP"
ssh -L 1534:192.168.133.10:1534 \
-L 1535:192.168.133.10:22 \
-L 1536:192.168.133.10:7303 \
eive@2001:7c0:2018:1099:babe:0:e1fe:f1a5 \
-t 'CONSOLE_PREFIX="[Q7S Tunnel]" /bin/bash'

View File

@ -2,7 +2,7 @@
echo "Setting up all Q7S ports" echo "Setting up all Q7S ports"
echo "-L 1534:192.168.133.10:1534 for connection to TCF agent" echo "-L 1534:192.168.133.10:1534 for connection to TCF agent"
echo "-L 1535:192.168.133.10:22 for file transfers" echo "-L 1535:192.168.133.10:22 for file transfers"
echo "-L 1536:192.168.133.10:7301 to TMTC commanding using TCP" echo "-L 1536:192.168.133.10:7301 to TMTC commanding using UDP"
ssh -L 1534:192.168.133.10:1534 \ ssh -L 1534:192.168.133.10:1534 \
-L 1535:192.168.133.10:22 \ -L 1535:192.168.133.10:22 \