diff --git a/bsp_hosted/Dockerfile b/bsp_hosted/Dockerfile index dccf909a..c55ccc67 100644 --- a/bsp_hosted/Dockerfile +++ b/bsp_hosted/Dockerfile @@ -1,6 +1,9 @@ FROM ubuntu:latest # FROM alpine:latest +ENV TZ=Europe/Berlin +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + RUN apt-get update && apt-get install -y cmake g++ # RUN apk add cmake make g++ diff --git a/bsp_hosted/InitMission.cpp b/bsp_hosted/InitMission.cpp index 06bc5646..2743aa36 100644 --- a/bsp_hosted/InitMission.cpp +++ b/bsp_hosted/InitMission.cpp @@ -32,9 +32,9 @@ ObjectManagerIF *objectManager = nullptr; void initmission::initMission() { sif::info << "Building global objects.." << std::endl; /* Instantiate global object manager and also create all objects */ - objectManager = new ObjectManager(ObjectFactory::produce); + ObjectManager::instance()->setObjectFactoryFunction(ObjectFactory::produce, nullptr); sif::info << "Initializing all objects.." << std::endl; - objectManager->initialize(); + ObjectManager::instance()->initialize(); /* This function creates and starts all tasks */ initTasks(); diff --git a/bsp_hosted/ObjectFactory.cpp b/bsp_hosted/ObjectFactory.cpp index da07b0b5..743ee03e 100644 --- a/bsp_hosted/ObjectFactory.cpp +++ b/bsp_hosted/ObjectFactory.cpp @@ -36,7 +36,7 @@ void Factory::setStaticFrameworkObjectIds(){ TmPacketBase::timeStamperId = objects::TIME_STAMPER; } -void ObjectFactory::produce(){ +void ObjectFactory::produce(void* args){ Factory::setStaticFrameworkObjectIds(); ObjectFactory::produceGenericObjects(); diff --git a/bsp_hosted/ObjectFactory.h b/bsp_hosted/ObjectFactory.h index f7fa81ac..feaba70e 100644 --- a/bsp_hosted/ObjectFactory.h +++ b/bsp_hosted/ObjectFactory.h @@ -1,17 +1,10 @@ -/* - * ObjectFactory.h - * - * Created on: Sep 22, 2020 - * Author: steffen - */ - #ifndef BSP_LINUX_OBJECTFACTORY_H_ #define BSP_LINUX_OBJECTFACTORY_H_ namespace ObjectFactory { void setStatics(); - void produce(); + void produce(void* args); }; #endif /* BSP_LINUX_OBJECTFACTORY_H_ */ diff --git a/bsp_linux_board/InitMission.cpp b/bsp_linux_board/InitMission.cpp index e08d73ca..a94c2e7d 100644 --- a/bsp_linux_board/InitMission.cpp +++ b/bsp_linux_board/InitMission.cpp @@ -26,9 +26,9 @@ ObjectManagerIF *objectManager = nullptr; void initmission::initMission() { sif::info << "Building global objects.." << std::endl; /* Instantiate global object manager and also create all objects */ - objectManager = new ObjectManager(ObjectFactory::produce); + ObjectManager::instance()->setObjectFactoryFunction(ObjectFactory::produce, nullptr); sif::info << "Initializing all objects.." << std::endl; - objectManager->initialize(); + ObjectManager::instance()->initialize(); /* This function creates and starts all tasks */ initTasks(); diff --git a/bsp_linux_board/ObjectFactory.cpp b/bsp_linux_board/ObjectFactory.cpp index 57e57531..cefce4cd 100644 --- a/bsp_linux_board/ObjectFactory.cpp +++ b/bsp_linux_board/ObjectFactory.cpp @@ -51,7 +51,7 @@ void Factory::setStaticFrameworkObjectIds() { -void ObjectFactory::produce(){ +void ObjectFactory::produce(void* args){ Factory::setStaticFrameworkObjectIds(); ObjectFactory::produceGenericObjects(); diff --git a/bsp_linux_board/ObjectFactory.h b/bsp_linux_board/ObjectFactory.h index f7fa81ac..feaba70e 100644 --- a/bsp_linux_board/ObjectFactory.h +++ b/bsp_linux_board/ObjectFactory.h @@ -1,17 +1,10 @@ -/* - * ObjectFactory.h - * - * Created on: Sep 22, 2020 - * Author: steffen - */ - #ifndef BSP_LINUX_OBJECTFACTORY_H_ #define BSP_LINUX_OBJECTFACTORY_H_ namespace ObjectFactory { void setStatics(); - void produce(); + void produce(void* args); }; #endif /* BSP_LINUX_OBJECTFACTORY_H_ */ diff --git a/bsp_q7s/Dockerfile b/bsp_q7s/Dockerfile index f9404293..0b4bb80b 100644 --- a/bsp_q7s/Dockerfile +++ b/bsp_q7s/Dockerfile @@ -1,15 +1,18 @@ FROM ubuntu:latest # FROM alpine:latest +ENV TZ=Europe/Berlin +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + RUN apt-get update && apt-get install -y curl cmake g++ # Q7S root filesystem, required for cross-compilation RUN mkdir -p /usr/rootfs; \ - curl https://eive-cloud.irs.uni-stuttgart.de/index.php/s/dnfMy9kGpgynN6J/download/cortexa9hf-neon-xiphos-linux-gnueabi.tar.gz \ + curl --tlsv1 https://eive-cloud.irs.uni-stuttgart.de/index.php/s/dnfMy9kGpgynN6J/download/cortexa9hf-neon-xiphos-linux-gnueabi.tar.gz \ | tar xvz -C /usr/rootfs # Q7S C++ cross-compiler RUN mkdir -p /usr/tools; \ - curl https://eive-cloud.irs.uni-stuttgart.de/index.php/s/RMsbHydJc6PSqcz/download/gcc-arm-linux-gnueabi.tar.gz \ + curl --tlsv1 https://eive-cloud.irs.uni-stuttgart.de/index.php/s/RMsbHydJc6PSqcz/download/gcc-arm-linux-gnueabi.tar.gz \ | tar xvz -C /usr/tools # RUN apk add cmake make g++ diff --git a/bsp_q7s/InitMission.cpp b/bsp_q7s/InitMission.cpp index ce385037..cc3ea26e 100644 --- a/bsp_q7s/InitMission.cpp +++ b/bsp_q7s/InitMission.cpp @@ -33,9 +33,9 @@ ObjectManagerIF *objectManager = nullptr; void initmission::initMission() { sif::info << "Building global objects.." << std::endl; /* Instantiate global object manager and also create all objects */ - objectManager = new ObjectManager(ObjectFactory::produce); + ObjectManager::instance()->setObjectFactoryFunction(ObjectFactory::produce, nullptr); sif::info << "Initializing all objects.." << std::endl; - objectManager->initialize(); + ObjectManager::instance()->initialize(); /* This function creates and starts all tasks */ initTasks(); diff --git a/bsp_q7s/ObjectFactory.cpp b/bsp_q7s/ObjectFactory.cpp index c2eefa51..33314297 100644 --- a/bsp_q7s/ObjectFactory.cpp +++ b/bsp_q7s/ObjectFactory.cpp @@ -81,7 +81,7 @@ void Factory::setStaticFrameworkObjectIds() { -void ObjectFactory::produce(){ +void ObjectFactory::produce(void* args){ Factory::setStaticFrameworkObjectIds(); ObjectFactory::produceGenericObjects(); LinuxLibgpioIF* gpioComIF = new LinuxLibgpioIF(objects::GPIO_IF); diff --git a/bsp_q7s/ObjectFactory.h b/bsp_q7s/ObjectFactory.h index 38ec0e9e..536af52d 100644 --- a/bsp_q7s/ObjectFactory.h +++ b/bsp_q7s/ObjectFactory.h @@ -3,7 +3,7 @@ namespace ObjectFactory { void setStatics(); -void produce(); +void produce(void* args); }; #endif /* BSP_Q7S_OBJECTFACTORY_H_ */ diff --git a/linux/boardtest/LibgpiodTest.cpp b/linux/boardtest/LibgpiodTest.cpp index 3aa9c22a..39e863b4 100644 --- a/linux/boardtest/LibgpiodTest.cpp +++ b/linux/boardtest/LibgpiodTest.cpp @@ -3,14 +3,14 @@ #include "devices/gpioIds.h" #include -#include +#include #include LibgpiodTest::LibgpiodTest(object_id_t objectId, object_id_t gpioIfobjectId, GpioCookie* gpioCookie): TestTask(objectId) { - gpioInterface = objectManager->get(gpioIfobjectId); + gpioInterface = ObjectManager::instance()->get(gpioIfobjectId); if (gpioInterface == nullptr) { sif::error << "LibgpiodTest::LibgpiodTest: Invalid Gpio interface." << std::endl; } diff --git a/linux/devices/HeaterHandler.cpp b/linux/devices/HeaterHandler.cpp index 6f38eb52..60a60328 100644 --- a/linux/devices/HeaterHandler.cpp +++ b/linux/devices/HeaterHandler.cpp @@ -2,6 +2,7 @@ #include "devices/gpioIds.h" #include "devices/powerSwitcherList.h" +#include #include #include @@ -38,7 +39,7 @@ ReturnValue_t HeaterHandler::initialize() { return ObjectManagerIF::CHILD_INIT_FAILED; } - gpioInterface = objectManager->get(gpioDriverId); + gpioInterface = ObjectManager::instance()->get(gpioDriverId); if (gpioInterface == nullptr) { sif::error << "HeaterHandler::initialize: Invalid Gpio interface." << std::endl; return ObjectManagerIF::CHILD_INIT_FAILED; @@ -50,14 +51,14 @@ ReturnValue_t HeaterHandler::initialize() { return ObjectManagerIF::CHILD_INIT_FAILED; } - IPCStore = objectManager->get(objects::IPC_STORE); + IPCStore = ObjectManager::instance()->get(objects::IPC_STORE); if (IPCStore == nullptr) { sif::error << "HeaterHandler::initialize: IPC store not set up in factory." << std::endl; return ObjectManagerIF::CHILD_INIT_FAILED; } if(mainLineSwitcherObjectId != objects::NO_OBJECT) { - mainLineSwitcher = objectManager->get(mainLineSwitcherObjectId); + mainLineSwitcher = ObjectManager::instance()->get(mainLineSwitcherObjectId); if (mainLineSwitcher == nullptr) { sif::error << "HeaterHandler::initialize: Failed to get main line switcher. Make sure " diff --git a/linux/devices/SolarArrayDeploymentHandler.cpp b/linux/devices/SolarArrayDeploymentHandler.cpp index 25be3927..eea546f6 100644 --- a/linux/devices/SolarArrayDeploymentHandler.cpp +++ b/linux/devices/SolarArrayDeploymentHandler.cpp @@ -5,6 +5,7 @@ #include #include +#include SolarArrayDeploymentHandler::SolarArrayDeploymentHandler(object_id_t setObjectId_, @@ -35,7 +36,7 @@ ReturnValue_t SolarArrayDeploymentHandler::initialize() { return ObjectManagerIF::CHILD_INIT_FAILED; } - gpioInterface = objectManager->get(gpioDriverId); + gpioInterface = ObjectManager::instance()->get(gpioDriverId); if (gpioInterface == nullptr) { sif::error << "SolarArrayDeploymentHandler::initialize: Invalid Gpio interface." << std::endl; @@ -50,7 +51,7 @@ ReturnValue_t SolarArrayDeploymentHandler::initialize() { } if (mainLineSwitcherObjectId != objects::NO_OBJECT) { - mainLineSwitcher = objectManager->get(mainLineSwitcherObjectId); + mainLineSwitcher = ObjectManager::instance()->get(mainLineSwitcherObjectId); if (mainLineSwitcher == nullptr) { sif::error << "SolarArrayDeploymentHandler::initialize: Main line switcher failed to fetch object" diff --git a/mission/controller/ThermalController.cpp b/mission/controller/ThermalController.cpp index 7d889993..538e63f3 100644 --- a/mission/controller/ThermalController.cpp +++ b/mission/controller/ThermalController.cpp @@ -30,7 +30,7 @@ ReturnValue_t ThermalController::initializeAfterTaskCreation() { sif::error << "ThermalController::initializeAfterTaskCreation: Base" << " class initialization failed!" << std::endl; } - HasLocalDataPoolIF* testHkbHandler = objectManager->get( + HasLocalDataPoolIF* testHkbHandler = ObjectManager::instance()->get( TSensorDefinitions::ObjIds::TEST_HKB_HANDLER); if(testHkbHandler == nullptr) { sif::warning << "ThermalController::initializeAfterTaskCreation: Test" diff --git a/mission/devices/PCDUHandler.cpp b/mission/devices/PCDUHandler.cpp index 5812c8bf..3ba734fb 100644 --- a/mission/devices/PCDUHandler.cpp +++ b/mission/devices/PCDUHandler.cpp @@ -33,7 +33,7 @@ ReturnValue_t PCDUHandler::initialize() { ReturnValue_t result; - IPCStore = objectManager->get(objects::IPC_STORE); + IPCStore = ObjectManager::instance()->get(objects::IPC_STORE); if (IPCStore == nullptr) { return ObjectManagerIF::CHILD_INIT_FAILED; } @@ -44,7 +44,8 @@ ReturnValue_t PCDUHandler::initialize() { } /* Subscribing for housekeeping table update messages of the PDU2 */ - HasLocalDataPoolIF* pdu2Handler = objectManager->get(objects::PDU2_HANDLER); + HasLocalDataPoolIF* pdu2Handler = ObjectManager::instance()->get( + objects::PDU2_HANDLER); if(pdu2Handler == nullptr) { sif::error << "PCDUHandler::initialize: Invalid pdu2Handler" << std::endl; return RETURN_FAILED; @@ -58,7 +59,8 @@ ReturnValue_t PCDUHandler::initialize() { } /* Subscribing for housekeeping table update messages of the PDU1 */ - HasLocalDataPoolIF* pdu1Handler = objectManager->get(objects::PDU1_HANDLER); + HasLocalDataPoolIF* pdu1Handler = ObjectManager::instance()->get( + objects::PDU1_HANDLER); if(pdu1Handler == nullptr) { sif::error << "PCDUHandler::initialize: Invalid pdu1Handler" << std::endl; return RETURN_FAILED; @@ -207,11 +209,11 @@ void PCDUHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) const switch (switchNr) { case pcduSwitches::TCS_BOARD_8V_HEATER_IN: memoryAddress = PDU2::CONFIG_ADDRESS_OUT_EN_TCS_BOARD_HEATER_IN; - pdu = objectManager->get(objects::PDU2_HANDLER); + pdu = ObjectManager::instance()->get(objects::PDU2_HANDLER); break; case pcduSwitches::DEPLOYMENT_MECHANISM: memoryAddress = PDU2::CONFIG_ADDRESS_OUT_EN_DEPLOYMENT_MECHANISM; - pdu = objectManager->get(objects::PDU2_HANDLER); + pdu = ObjectManager::instance()->get(objects::PDU2_HANDLER); break; default: sif::error << "PCDUHandler::sendSwitchCommand: Invalid switch number " << std::endl; diff --git a/mission/utility/TmFunnel.cpp b/mission/utility/TmFunnel.cpp index a567cbd9..72c41153 100644 --- a/mission/utility/TmFunnel.cpp +++ b/mission/utility/TmFunnel.cpp @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -79,7 +80,7 @@ ReturnValue_t TmFunnel::handlePacket(TmTcMessage* message) { ReturnValue_t TmFunnel::initialize() { - tmPool = objectManager->get(objects::TM_STORE); + tmPool = ObjectManager::instance()->get(objects::TM_STORE); if(tmPool == nullptr) { sif::error << "TmFunnel::initialize: TM store not set." << std::endl; @@ -89,7 +90,7 @@ ReturnValue_t TmFunnel::initialize() { } AcceptsTelemetryIF* tmTarget = - objectManager->get(downlinkDestination); + ObjectManager::instance()->get(downlinkDestination); if(tmTarget == nullptr){ sif::error << "TmFunnel::initialize: Downlink Destination not set." << std::endl; @@ -105,7 +106,7 @@ ReturnValue_t TmFunnel::initialize() { } AcceptsTelemetryIF* storageTarget = - objectManager->get(storageDestination); + ObjectManager::instance()->get(storageDestination); if(storageTarget != nullptr) { storageQueue->setDefaultDestination( storageTarget->getReportReceptionQueue()); diff --git a/test/testtasks/PusTcInjector.cpp b/test/testtasks/PusTcInjector.cpp index b7884cfd..90f2ac75 100644 --- a/test/testtasks/PusTcInjector.cpp +++ b/test/testtasks/PusTcInjector.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include #include #include @@ -47,7 +47,7 @@ ReturnValue_t PusTcInjector::initialize() { // Prepare message queue which is used to send telecommands. injectionQueue = QueueFactory::instance()-> createMessageQueue(INJECTION_QUEUE_DEPTH); - AcceptsTelecommandsIF* targetQueue = objectManager-> + AcceptsTelecommandsIF* targetQueue = ObjectManager::instance()-> get(destination); if(targetQueue == nullptr) { sif::error << "PusTcInjector: CCSDS distributor not initialized yet!" << std::endl; @@ -58,7 +58,7 @@ ReturnValue_t PusTcInjector::initialize() { } // Prepare store used to store TC messages - tcStore = objectManager->get(tcStoreId); + tcStore = ObjectManager::instance()->get(tcStoreId); if(tcStore == nullptr) { sif::error << "PusTcInjector: TC Store not initialized!" << std::endl; return ObjectManagerIF::CHILD_INIT_FAILED; diff --git a/test/testtasks/TestTask.cpp b/test/testtasks/TestTask.cpp index 88a5d13e..a7aeac7b 100644 --- a/test/testtasks/TestTask.cpp +++ b/test/testtasks/TestTask.cpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include @@ -13,7 +13,7 @@ TestTask::TestTask(object_id_t objectId_): SystemObject(objectId_), testMode(testModes::A) { - IPCStore = objectManager->get(objects::IPC_STORE); + IPCStore = ObjectManager::instance()->get(objects::IPC_STORE); } TestTask::~TestTask() {