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>
|
|
|
|
|
2022-12-14 09:53:38 +01:00
|
|
|
#include "../mission/utility/DummySdCardManager.h"
|
2022-01-17 15:58:27 +01:00
|
|
|
#include "OBSWConfig.h"
|
2022-11-10 17:32:11 +01:00
|
|
|
#include "fsfw/platform.h"
|
2022-05-05 16:55:08 +02:00
|
|
|
#include "fsfw_tests/integration/task/TestTask.h"
|
2020-11-20 18:10:39 +01:00
|
|
|
|
2022-12-02 16:47:28 +01:00
|
|
|
#if OBSW_ADD_TMTC_UDP_SERVER == 1
|
2021-07-26 13:51:00 +02:00
|
|
|
#include "fsfw/osal/common/UdpTcPollingTask.h"
|
|
|
|
#include "fsfw/osal/common/UdpTmTcBridge.h"
|
2022-12-02 16:47:28 +01:00
|
|
|
#endif
|
|
|
|
#if OBSW_ADD_TMTC_TCP_SERVER == 1
|
2021-07-26 13:51:00 +02:00
|
|
|
#include "fsfw/osal/common/TcpTmTcBridge.h"
|
|
|
|
#include "fsfw/osal/common/TcpTmTcServer.h"
|
|
|
|
#endif
|
2020-11-20 18:10:39 +01:00
|
|
|
|
|
|
|
#if OBSW_ADD_TEST_CODE == 1
|
|
|
|
#include <test/testtasks/TestTask.h>
|
|
|
|
#endif
|
|
|
|
|
2022-06-16 07:00:09 +02:00
|
|
|
#include <dummies/AcuDummy.h>
|
2022-06-17 08:31:36 +02:00
|
|
|
#include <dummies/CoreControllerDummy.h>
|
2022-10-10 17:40:30 +02:00
|
|
|
|
2022-09-15 12:00:58 +02:00
|
|
|
#include "dummies/helpers.h"
|
2022-07-14 17:35:49 +02:00
|
|
|
|
2022-11-10 17:32:11 +01:00
|
|
|
#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;
|
2023-03-09 20:38:50 +01:00
|
|
|
StorageManagerIF* tmStore;
|
|
|
|
StorageManagerIF* ipcStore;
|
|
|
|
PersistentTmStores persistentStores;
|
2022-12-14 09:53:38 +01:00
|
|
|
auto sdcMan = new DummySdCardManager("/tmp");
|
2023-03-09 20:38:50 +01:00
|
|
|
ObjectFactory::produceGenericObjects(nullptr, &pusFunnel, &cfdpFunnel, *sdcMan, &ipcStore,
|
|
|
|
&tmStore, persistentStores);
|
2020-11-20 18:10:39 +01:00
|
|
|
|
2022-11-24 19:41:57 +01:00
|
|
|
auto* dummyGpioIF = new DummyGpioIF();
|
2022-11-24 11:22:55 +01:00
|
|
|
auto* dummySwitcher = new DummyPowerSwitcher(objects::PCDU_HANDLER, 18, 0);
|
2022-11-10 17:32:11 +01:00
|
|
|
#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";
|
2022-11-10 17:32:11 +01:00
|
|
|
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);
|
2022-11-10 17:32:11 +01:00
|
|
|
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);
|
2022-11-10 17:32:11 +01:00
|
|
|
#endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */
|
|
|
|
#endif
|
|
|
|
|
2022-09-15 12:00:58 +02:00
|
|
|
dummy::DummyCfg cfg;
|
2023-02-14 10:02:12 +01:00
|
|
|
dummy::createDummies(cfg, *dummySwitcher, dummyGpioIF);
|
2022-11-24 19:41:57 +01:00
|
|
|
|
|
|
|
HeaterHandler* heaterHandler = nullptr;
|
2022-11-25 10:13:24 +01:00
|
|
|
// new ThermalController(objects::THERMAL_CONTROLLER);
|
2022-11-24 19:41:57 +01:00
|
|
|
ObjectFactory::createGenericHeaterComponents(*dummyGpioIF, *dummySwitcher, heaterHandler);
|
2022-11-25 10:13:24 +01:00
|
|
|
if (heaterHandler == nullptr) {
|
2022-11-24 19:41:57 +01:00
|
|
|
sif::error << "HeaterHandler could not be created" << std::endl;
|
2022-11-25 10:13:24 +01:00
|
|
|
} else {
|
2022-11-24 19:41:57 +01:00
|
|
|
ObjectFactory::createThermalController(*heaterHandler);
|
|
|
|
}
|
2022-01-17 15:58:27 +01:00
|
|
|
new TestTask(objects::TEST_TASK);
|
2020-11-20 18:10:39 +01:00
|
|
|
}
|