eive-obsw/bsp_linux/ObjectFactory.cpp

118 lines
4.2 KiB
C++
Raw Normal View History

2020-09-30 17:17:01 +02:00
#include "ObjectFactory.h"
2020-11-20 18:10:39 +01:00
#include <fsfwconfig/objects/systemObjectList.h>
#include <fsfwconfig/OBSWConfig.h>
#include <fsfwconfig/tmtc/apid.h>
#include <fsfwconfig/tmtc/pusIds.h>
2020-09-30 17:17:01 +02:00
#include <mission/utility/TmFunnel.h>
#include <fsfw/health/HealthTable.h>
#include <fsfw/storagemanager/PoolManager.h>
#include <fsfw/events/EventManager.h>
#include <fsfw/timemanager/TimeStamper.h>
#include <fsfw/internalError/InternalErrorReporter.h>
#include <fsfw/monitoring/MonitoringMessageContent.h>
#include <fsfw/tcdistribution/CCSDSDistributor.h>
#include <fsfw/tcdistribution/PUSDistributor.h>
#include <fsfw/pus/Service1TelecommandVerification.h>
#include <fsfw/pus/Service2DeviceAccess.h>
#include <fsfw/pus/Service5EventReporting.h>
#include <fsfw/pus/Service8FunctionManagement.h>
#include <fsfw/pus/Service9TimeManagement.h>
#include <fsfw/pus/Service17Test.h>
#include <fsfw/pus/CService200ModeCommanding.h>
2020-11-02 18:00:07 +01:00
#include <fsfw/devicehandlers/CookieIF.h>
2020-09-30 17:17:01 +02:00
#include <fsfw/osal/linux/TcUnixUdpPollingTask.h>
#include <fsfw/osal/linux/TmTcUnixUdpBridge.h>
#include <fsfw/tmtcpacket/pus/TmPacketStored.h>
2020-11-20 18:10:39 +01:00
#if OBSW_ADD_TEST_CODE == 1
2020-10-01 02:06:39 +02:00
#include <test/testtasks/TestTask.h>
2020-09-30 17:17:01 +02:00
#endif
void Factory::setStaticFrameworkObjectIds(){
PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR;
PusServiceBase::packetDestination = objects::TM_FUNNEL;
CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR;
CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL;
TmFunnel::downlinkDestination = objects::UDP_BRIDGE;
// No storage object for now.
TmFunnel::storageDestination = objects::NO_OBJECT;
VerificationReporter::messageReceiver = objects::PUS_SERVICE_1_VERIFICATION;
TmPacketStored::timeStamperId = objects::TIME_STAMPER;
}
void ObjectFactory::produce(){
Factory::setStaticFrameworkObjectIds();
/* Framework objects */
new EventManager(objects::EVENT_MANAGER);
new HealthTable(objects::HEALTH_TABLE);
new InternalErrorReporter(objects::INTERNAL_ERROR_REPORTER, 0, 0, 0);
new TimeStamper(objects::TIME_STAMPER);
{
static constexpr uint8_t NUMBER_OF_POOLS = 5;
const uint16_t element_sizes[NUMBER_OF_POOLS] = {16, 32, 64, 128, 1024};
const uint16_t n_elements[NUMBER_OF_POOLS] = {100, 50, 25, 15, 5};
new PoolManager<NUMBER_OF_POOLS>(objects::TC_STORE, element_sizes,
n_elements);
}
{
static constexpr uint8_t NUMBER_OF_POOLS = 5;
const uint16_t element_sizes[NUMBER_OF_POOLS] = {16, 32, 64, 128, 1024};
const uint16_t n_elements[NUMBER_OF_POOLS] = {100, 50, 25, 15, 5};
new PoolManager<NUMBER_OF_POOLS>(objects::TM_STORE, element_sizes,
n_elements);
}
{
static constexpr uint8_t NUMBER_OF_POOLS = 6;
const uint16_t element_sizes[NUMBER_OF_POOLS] = {32, 64, 512,
1024, 2048, 4096};
const uint16_t n_elements[NUMBER_OF_POOLS] = {200, 100, 50, 25, 15, 5};
new PoolManager<NUMBER_OF_POOLS>(objects::IPC_STORE, element_sizes,
n_elements);
}
new CCSDSDistributor(apid::EIVE_OBSW, objects::CCSDS_PACKET_DISTRIBUTOR);
new PUSDistributor(apid::EIVE_OBSW, objects::PUS_PACKET_DISTRIBUTOR,
objects::CCSDS_PACKET_DISTRIBUTOR);
/* TMTC Reception via UDP socket */
new TmFunnel(objects::TM_FUNNEL);
new TmTcUnixUdpBridge(objects::UDP_BRIDGE,
objects::CCSDS_PACKET_DISTRIBUTOR,
objects::TM_STORE, objects::TC_STORE);
new TcUnixUdpPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE);
/* PUS stack */
new Service1TelecommandVerification(objects::PUS_SERVICE_1_VERIFICATION,
apid::EIVE_OBSW, pus::PUS_SERVICE_1, objects::TM_FUNNEL);
new Service2DeviceAccess(objects::PUS_SERVICE_2_DEVICE_ACCESS,
apid::EIVE_OBSW, pus::PUS_SERVICE_2, 3, 10);
new Service5EventReporting(objects::PUS_SERVICE_5_EVENT_REPORTING,
apid::EIVE_OBSW, pus::PUS_SERVICE_5, 50);
new Service8FunctionManagement(objects::PUS_SERVICE_8_FUNCTION_MGMT,
apid::EIVE_OBSW, pus::PUS_SERVICE_8, 3, 10);
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);
new CService200ModeCommanding(objects::PUS_SERVICE_200_MODE_MGMT,
apid::EIVE_OBSW, pus::PUS_SERVICE_200);
/* Test Device Handler */
2020-11-20 18:10:39 +01:00
#if OBSW_ADD_TEST_CODE == 1
2020-10-01 02:06:39 +02:00
new TestTask(objects::TEST_TASK);
2020-09-30 17:17:01 +02:00
#endif
}