eive-obsw/bsp_hosted/ObjectFactory.cpp

115 lines
4.2 KiB
C++
Raw Normal View History

2020-11-20 18:10:39 +01:00
#include "ObjectFactory.h"
2022-11-24 11:22:55 +01:00
#include <fsfw/power/DummyPowerSwitcher.h>
2020-11-20 18:10:39 +01:00
#include <fsfw/tmtcservices/CommandingServiceBase.h>
#include <fsfw/tmtcservices/PusServiceBase.h>
2022-06-17 08:31:36 +02:00
#include <mission/controller/ThermalController.h>
2020-11-20 18:10:39 +01:00
#include <mission/core/GenericFactory.h>
2022-11-02 14:03:54 +01:00
#include <mission/tmtc/TmFunnelHandler.h>
2022-01-17 15:58:27 +01:00
#include <objects/systemObjectList.h>
#include "OBSWConfig.h"
#include "devConf.h"
2022-09-16 18:10:23 +02:00
#include "eive/definitions.h"
#include "fsfw/platform.h"
2022-05-05 16:55:08 +02:00
#include "fsfw_tests/integration/task/TestTask.h"
#include "tmtc/pusIds.h"
2020-11-20 18:10:39 +01:00
2021-07-26 13:51:00 +02:00
#if OBSW_USE_TMTC_TCP_BRIDGE == 0
#include "fsfw/osal/common/UdpTcPollingTask.h"
#include "fsfw/osal/common/UdpTmTcBridge.h"
#else
#include "fsfw/osal/common/TcpTmTcBridge.h"
#include "fsfw/osal/common/TcpTmTcServer.h"
#endif
2020-11-20 18:10:39 +01:00
2021-06-21 17:09:49 +02:00
#include <fsfw/tmtcpacket/pus/tm.h>
2020-11-20 18:10:39 +01:00
#if OBSW_ADD_TEST_CODE == 1
#include <test/testtasks/TestTask.h>
#endif
#include <dummies/AcuDummy.h>
2022-06-17 08:31:36 +02:00
#include <dummies/BpxDummy.h>
#include <dummies/ComCookieDummy.h>
#include <dummies/ComIFDummy.h>
#include <dummies/CoreControllerDummy.h>
#include <dummies/GyroAdisDummy.h>
#include <dummies/GyroL3GD20Dummy.h>
2022-06-17 08:31:36 +02:00
#include <dummies/ImtqDummy.h>
#include <dummies/MgmLIS3MDLDummy.h>
2022-06-17 08:31:36 +02:00
#include <dummies/P60DockDummy.h>
#include <dummies/PduDummy.h>
#include <dummies/PlPcduDummy.h>
2022-06-17 08:31:36 +02:00
#include <dummies/RwDummy.h>
#include <dummies/StarTrackerDummy.h>
#include <dummies/SusDummy.h>
#include <dummies/SyrlinksDummy.h>
#include <dummies/TemperatureSensorsDummy.h>
2022-10-10 17:40:30 +02:00
#include "dummies/helpers.h"
2022-07-14 17:35:49 +02:00
#include "mission/utility/GlobalConfigHandler.h"
#ifdef PLATFORM_UNIX
#include <fsfw_hal/linux/serial/SerialComIF.h>
#include <fsfw_hal/linux/serial/SerialCookie.h>
#include "devices/gpioIds.h"
#include "fsfw_hal/linux/gpio/Gpio.h"
#include "linux/devices/ploc/PlocMPSoCHandler.h"
#include "linux/devices/ploc/PlocMPSoCHelper.h"
#include "linux/devices/ploc/PlocSupervisorHandler.h"
#include "linux/devices/ploc/PlocSupvUartMan.h"
#include "test/gpio/DummyGpioIF.h"
#endif
2022-01-17 15:58:27 +01:00
void Factory::setStaticFrameworkObjectIds() {
2022-08-16 17:09:46 +02:00
PusServiceBase::PUS_DISTRIBUTOR = objects::PUS_PACKET_DISTRIBUTOR;
2022-11-15 16:44:07 +01:00
PusServiceBase::PACKET_DESTINATION = objects::PUS_TM_FUNNEL;
2020-11-20 18:10:39 +01:00
2022-01-17 15:58:27 +01:00
CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR;
2022-11-15 16:44:07 +01:00
CommandingServiceBase::defaultPacketDestination = objects::PUS_TM_FUNNEL;
2020-11-20 18:10:39 +01:00
2022-08-16 17:09:46 +02:00
VerificationReporter::DEFAULT_RECEIVER = objects::PUS_SERVICE_1_VERIFICATION;
2020-11-20 18:10:39 +01:00
}
2022-01-17 15:58:27 +01:00
void ObjectFactory::produce(void* args) {
Factory::setStaticFrameworkObjectIds();
2022-11-02 14:03:54 +01:00
PusTmFunnel* pusFunnel;
CfdpTmFunnel* cfdpFunnel;
ObjectFactory::produceGenericObjects(nullptr, &pusFunnel, &cfdpFunnel);
2020-11-20 18:10:39 +01:00
DummyGpioIF* dummyGpioIF = new DummyGpioIF();
2022-11-24 11:22:55 +01:00
auto* dummySwitcher = new DummyPowerSwitcher(objects::PCDU_HANDLER, 18, 0);
static_cast<void>(dummyGpioIF);
#ifdef PLATFORM_UNIX
new SerialComIF(objects::UART_COM_IF);
#if OBSW_ADD_PLOC_MPSOC == 1
std::string mpscoDev = "";
auto mpsocCookie = new UartCookie(objects::PLOC_MPSOC_HANDLER, mpscoDev, uart::PLOC_MPSOC_BAUD,
mpsoc::MAX_REPLY_SIZE, UartModes::NON_CANONICAL);
mpsocCookie->setNoFixedSizeReply();
auto plocMpsocHelper = new PlocMPSoCHelper(objects::PLOC_MPSOC_HELPER);
new PlocMPSoCHandler(objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, mpsocCookie,
plocMpsocHelper, Gpio(gpioIds::ENABLE_MPSOC_UART, dummyGpioIF),
objects::PLOC_SUPERVISOR_HANDLER);
#endif /* OBSW_ADD_PLOC_MPSOC == 1 */
#if OBSW_ADD_PLOC_SUPERVISOR == 1
2022-11-15 16:00:32 +01:00
std::string plocSupvString = "/dev/ploc_supv";
auto supervisorCookie =
2022-11-15 17:40:19 +01:00
new SerialCookie(objects::PLOC_SUPERVISOR_HANDLER, plocSupvString, uart::PLOC_SUPV_BAUD,
supv::MAX_PACKET_SIZE * 20, UartModes::NON_CANONICAL);
supervisorCookie->setNoFixedSizeReply();
2022-11-15 17:24:38 +01:00
auto supvHelper = new PlocSupvUartManager(objects::PLOC_SUPERVISOR_HELPER);
2022-11-16 15:25:29 +01:00
new PlocSupervisorHandler(objects::PLOC_SUPERVISOR_HANDLER, supervisorCookie,
Gpio(gpioIds::ENABLE_SUPV_UART, dummyGpioIF), pcdu::PDU1_CH6_PLOC_12V,
*supvHelper);
#endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */
#endif
dummy::DummyCfg cfg;
2022-11-24 11:22:55 +01:00
dummy::createDummies(cfg, *dummySwitcher);
2022-09-30 15:30:31 +02:00
new ThermalController(objects::THERMAL_CONTROLLER);
2022-01-17 15:58:27 +01:00
new TestTask(objects::TEST_TASK);
2020-11-20 18:10:39 +01:00
}