eive-obsw/mission/core/GenericFactory.cpp

119 lines
4.5 KiB
C++
Raw Normal View History

2020-11-20 18:10:39 +01:00
#include "GenericFactory.h"
2020-12-29 13:59:31 +01:00
2020-12-29 14:39:03 +01:00
#include <OBSWConfig.h>
2020-12-29 13:59:31 +01:00
#include <tmtc/apid.h>
#include <tmtc/pusIds.h>
2021-09-29 10:52:36 +02:00
#include "objects/systemObjectList.h"
2020-11-20 18:10:39 +01:00
#include <fsfw/events/EventManager.h>
#include <fsfw/health/HealthTable.h>
2021-07-15 01:25:32 +02:00
#include <fsfw/internalerror/InternalErrorReporter.h>
2020-11-20 18:10:39 +01:00
#include <fsfw/pus/CService200ModeCommanding.h>
#include <fsfw/pus/Service17Test.h>
#include <fsfw/pus/Service1TelecommandVerification.h>
2021-03-04 18:29:28 +01:00
#include <fsfw/pus/Service20ParameterManagement.h>
#include <fsfw/pus/Service3Housekeeping.h>
2020-11-20 18:10:39 +01:00
#include <fsfw/pus/Service2DeviceAccess.h>
#include <fsfw/pus/Service5EventReporting.h>
#include <fsfw/pus/Service8FunctionManagement.h>
#include <fsfw/pus/Service9TimeManagement.h>
#include <fsfw/storagemanager/PoolManager.h>
#include <fsfw/tcdistribution/CCSDSDistributor.h>
#include <fsfw/tcdistribution/PUSDistributor.h>
#include <fsfw/timemanager/TimeStamper.h>
#include <mission/utility/TmFunnel.h>
2021-09-28 14:58:12 +02:00
#if OBSW_ADD_TCPIP_BRIDGE == 1
#if OBSW_USE_TCP_BRIDGE == 0
// UDP server includes
#include "fsfw/osal/common/UdpTmTcBridge.h"
#include "fsfw/osal/common/UdpTcPollingTask.h"
#else
// TCP server includes
#include "fsfw/osal/common/TcpTmTcBridge.h"
#include "fsfw/osal/common/TcpTmTcServer.h"
#endif
#endif
2020-12-29 13:59:31 +01:00
#if OBSW_ADD_TEST_CODE == 1
2021-09-28 14:58:12 +02:00
#include <test/testtasks/TestTask.h>
2020-11-25 16:17:16 +01:00
#endif
2020-11-20 18:10:39 +01:00
void ObjectFactory::produceGenericObjects() {
2021-09-28 14:58:12 +02:00
// Framework objects
2020-11-20 18:10:39 +01:00
new EventManager(objects::EVENT_MANAGER);
new HealthTable(objects::HEALTH_TABLE);
2020-12-14 22:03:57 +01:00
new InternalErrorReporter(objects::INTERNAL_ERROR_REPORTER);
2020-11-20 18:10:39 +01:00
new TimeStamper(objects::TIME_STAMPER);
{
2020-12-14 22:03:57 +01:00
PoolManager::LocalPoolConfig poolCfg = {
2021-09-15 18:50:23 +02:00
{300, 16}, {300, 32}, {200, 64}, {200, 128}, {100, 1024}, {10, 2048}
2020-12-14 22:03:57 +01:00
};
new PoolManager(objects::TC_STORE, poolCfg);
2020-11-20 18:10:39 +01:00
}
{
2020-12-14 22:03:57 +01:00
PoolManager::LocalPoolConfig poolCfg = {
2021-09-15 18:50:23 +02:00
{300, 16}, {300, 32}, {100, 64}, {100, 128}, {100, 1024}, {10, 2048}
2020-12-14 22:03:57 +01:00
};
new PoolManager(objects::TM_STORE, poolCfg);
2020-11-20 18:10:39 +01:00
}
{
2020-12-14 22:03:57 +01:00
PoolManager::LocalPoolConfig poolCfg = {
2021-09-15 18:50:23 +02:00
{ 300, 16 }, { 200, 32 }, { 150, 64 },
{ 150, 128 }, { 100, 256 }, { 50, 512 }, { 50, 1024 }, { 10, 2048 }
2020-12-14 22:03:57 +01:00
};
new PoolManager(objects::IPC_STORE, poolCfg);
2020-11-20 18:10:39 +01:00
}
new CCSDSDistributor(apid::EIVE_OBSW, objects::CCSDS_PACKET_DISTRIBUTOR);
new PUSDistributor(apid::EIVE_OBSW, objects::PUS_PACKET_DISTRIBUTOR,
objects::CCSDS_PACKET_DISTRIBUTOR);
2021-09-28 14:58:12 +02:00
// Every TM packet goes through this funnel
2020-11-20 18:10:39 +01:00
new TmFunnel(objects::TM_FUNNEL);
2021-09-28 14:58:12 +02:00
// PUS service stack
2020-11-20 18:10:39 +01:00
new Service1TelecommandVerification(objects::PUS_SERVICE_1_VERIFICATION,
2020-12-14 22:03:57 +01:00
apid::EIVE_OBSW, pus::PUS_SERVICE_1, objects::TM_FUNNEL, 20);
2020-11-20 18:10:39 +01:00
new Service2DeviceAccess(objects::PUS_SERVICE_2_DEVICE_ACCESS,
apid::EIVE_OBSW, pus::PUS_SERVICE_2, 3, 10);
new Service3Housekeeping(objects::PUS_SERVICE_3_HOUSEKEEPING,
apid::EIVE_OBSW, pus::PUS_SERVICE_3);
2020-11-20 18:10:39 +01:00
new Service5EventReporting(objects::PUS_SERVICE_5_EVENT_REPORTING,
apid::EIVE_OBSW, pus::PUS_SERVICE_5, 50);
new Service8FunctionManagement(objects::PUS_SERVICE_8_FUNCTION_MGMT,
2021-02-11 08:19:48 +01:00
apid::EIVE_OBSW, pus::PUS_SERVICE_8, 3, 60);
2020-11-20 18:10:39 +01:00
new Service9TimeManagement(objects::PUS_SERVICE_9_TIME_MGMT,
apid::EIVE_OBSW, pus::PUS_SERVICE_9);
new Service17Test(objects::PUS_SERVICE_17_TEST, apid::EIVE_OBSW,
pus::PUS_SERVICE_17);
2021-03-04 18:29:28 +01:00
new Service20ParameterManagement(objects::PUS_SERVICE_20_PARAMETERS, apid::EIVE_OBSW,
pus::PUS_SERVICE_20);
2020-11-20 18:10:39 +01:00
new CService200ModeCommanding(objects::PUS_SERVICE_200_MODE_MGMT,
apid::EIVE_OBSW, pus::PUS_SERVICE_200);
2021-09-28 14:58:12 +02:00
#if OBSW_ADD_TCPIP_BRIDGE == 1
#if OBSW_USE_TCP_BRIDGE == 0
auto tmtcBridge = new UdpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
new UdpTcPollingTask(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE);
sif::info << "Created UDP server for TMTC commanding with listener port " <<
udpBridge->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);
// TCP is stream based. Use packet ID as start marker when parsing for space packets
2021-10-18 18:15:39 +02:00
tcpServer->setSpacePacketParsingOptions({common::PUS_PACKET_ID});
2021-09-28 14:58:12 +02:00
sif::info << "Created TCP server for TMTC commanding with listener port "
<< tcpServer->getTcpPort() << std::endl;
#endif /* OBSW_USE_TMTC_TCP_BRIDGE == 0 */
tmtcBridge->setMaxNumberOfPacketsStored(70);
2021-09-28 14:58:12 +02:00
#endif /* OBSW_ADD_TCPIP_BRIDGE == 1 */
2020-11-20 18:10:39 +01:00
}