object manager singleton now
This commit is contained in:
parent
4caf6e102c
commit
b7e26be45e
@ -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++
|
||||
|
||||
|
@ -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();
|
||||
|
@ -36,7 +36,7 @@ void Factory::setStaticFrameworkObjectIds(){
|
||||
TmPacketBase::timeStamperId = objects::TIME_STAMPER;
|
||||
}
|
||||
|
||||
void ObjectFactory::produce(){
|
||||
void ObjectFactory::produce(void* args){
|
||||
Factory::setStaticFrameworkObjectIds();
|
||||
ObjectFactory::produceGenericObjects();
|
||||
|
||||
|
@ -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_ */
|
||||
|
@ -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();
|
||||
|
@ -51,7 +51,7 @@ void Factory::setStaticFrameworkObjectIds() {
|
||||
|
||||
|
||||
|
||||
void ObjectFactory::produce(){
|
||||
void ObjectFactory::produce(void* args){
|
||||
Factory::setStaticFrameworkObjectIds();
|
||||
ObjectFactory::produceGenericObjects();
|
||||
|
||||
|
@ -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_ */
|
||||
|
@ -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++
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
namespace ObjectFactory {
|
||||
void setStatics();
|
||||
void produce();
|
||||
void produce(void* args);
|
||||
};
|
||||
|
||||
#endif /* BSP_Q7S_OBJECTFACTORY_H_ */
|
||||
|
@ -3,14 +3,14 @@
|
||||
#include "devices/gpioIds.h"
|
||||
|
||||
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
||||
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
||||
#include <fsfw/objectmanager/ObjectManager.h>
|
||||
#include <fsfw/tasks/TaskFactory.h>
|
||||
|
||||
LibgpiodTest::LibgpiodTest(object_id_t objectId, object_id_t gpioIfobjectId,
|
||||
GpioCookie* gpioCookie):
|
||||
TestTask(objectId) {
|
||||
|
||||
gpioInterface = objectManager->get<GpioIF>(gpioIfobjectId);
|
||||
gpioInterface = ObjectManager::instance()->get<GpioIF>(gpioIfobjectId);
|
||||
if (gpioInterface == nullptr) {
|
||||
sif::error << "LibgpiodTest::LibgpiodTest: Invalid Gpio interface." << std::endl;
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include "devices/gpioIds.h"
|
||||
#include "devices/powerSwitcherList.h"
|
||||
|
||||
#include <fsfw/objectmanager/ObjectManager.h>
|
||||
#include <fsfw/ipc/QueueFactory.h>
|
||||
#include <fsfw_hal/common/gpio/GpioCookie.h>
|
||||
|
||||
@ -38,7 +39,7 @@ ReturnValue_t HeaterHandler::initialize() {
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
|
||||
gpioInterface = objectManager->get<GpioIF>(gpioDriverId);
|
||||
gpioInterface = ObjectManager::instance()->get<GpioIF>(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<StorageManagerIF>(objects::IPC_STORE);
|
||||
IPCStore = ObjectManager::instance()->get<StorageManagerIF>(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<PowerSwitchIF>(mainLineSwitcherObjectId);
|
||||
mainLineSwitcher = ObjectManager::instance()->get<PowerSwitchIF>(mainLineSwitcherObjectId);
|
||||
if (mainLineSwitcher == nullptr) {
|
||||
sif::error
|
||||
<< "HeaterHandler::initialize: Failed to get main line switcher. Make sure "
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
#include <fsfw_hal/common/gpio/GpioCookie.h>
|
||||
#include <fsfw/ipc/QueueFactory.h>
|
||||
#include <fsfw/objectmanager/ObjectManager.h>
|
||||
|
||||
|
||||
SolarArrayDeploymentHandler::SolarArrayDeploymentHandler(object_id_t setObjectId_,
|
||||
@ -35,7 +36,7 @@ ReturnValue_t SolarArrayDeploymentHandler::initialize() {
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
|
||||
gpioInterface = objectManager->get<GpioIF>(gpioDriverId);
|
||||
gpioInterface = ObjectManager::instance()->get<GpioIF>(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<PowerSwitchIF>(mainLineSwitcherObjectId);
|
||||
mainLineSwitcher = ObjectManager::instance()->get<PowerSwitchIF>(mainLineSwitcherObjectId);
|
||||
if (mainLineSwitcher == nullptr) {
|
||||
sif::error
|
||||
<< "SolarArrayDeploymentHandler::initialize: Main line switcher failed to fetch object"
|
||||
|
@ -30,7 +30,7 @@ ReturnValue_t ThermalController::initializeAfterTaskCreation() {
|
||||
sif::error << "ThermalController::initializeAfterTaskCreation: Base"
|
||||
<< " class initialization failed!" << std::endl;
|
||||
}
|
||||
HasLocalDataPoolIF* testHkbHandler = objectManager->get<HasLocalDataPoolIF>(
|
||||
HasLocalDataPoolIF* testHkbHandler = ObjectManager::instance()->get<HasLocalDataPoolIF>(
|
||||
TSensorDefinitions::ObjIds::TEST_HKB_HANDLER);
|
||||
if(testHkbHandler == nullptr) {
|
||||
sif::warning << "ThermalController::initializeAfterTaskCreation: Test"
|
||||
|
@ -33,7 +33,7 @@ ReturnValue_t PCDUHandler::initialize() {
|
||||
|
||||
ReturnValue_t result;
|
||||
|
||||
IPCStore = objectManager->get<StorageManagerIF>(objects::IPC_STORE);
|
||||
IPCStore = ObjectManager::instance()->get<StorageManagerIF>(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<HasLocalDataPoolIF>(objects::PDU2_HANDLER);
|
||||
HasLocalDataPoolIF* pdu2Handler = ObjectManager::instance()->get<HasLocalDataPoolIF>(
|
||||
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<HasLocalDataPoolIF>(objects::PDU1_HANDLER);
|
||||
HasLocalDataPoolIF* pdu1Handler = ObjectManager::instance()->get<HasLocalDataPoolIF>(
|
||||
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<GomspaceDeviceHandler>(objects::PDU2_HANDLER);
|
||||
pdu = ObjectManager::instance()->get<GomspaceDeviceHandler>(objects::PDU2_HANDLER);
|
||||
break;
|
||||
case pcduSwitches::DEPLOYMENT_MECHANISM:
|
||||
memoryAddress = PDU2::CONFIG_ADDRESS_OUT_EN_DEPLOYMENT_MECHANISM;
|
||||
pdu = objectManager->get<GomspaceDeviceHandler>(objects::PDU2_HANDLER);
|
||||
pdu = ObjectManager::instance()->get<GomspaceDeviceHandler>(objects::PDU2_HANDLER);
|
||||
break;
|
||||
default:
|
||||
sif::error << "PCDUHandler::sendSwitchCommand: Invalid switch number " << std::endl;
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include <fsfw/ipc/QueueFactory.h>
|
||||
#include <fsfw/tmtcpacket/pus/TmPacketStored.h>
|
||||
#include <fsfw/objectmanager/ObjectManager.h>
|
||||
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
||||
#include <fsfw/tmtcpacket/pus/TmPacketPusC.h>
|
||||
#include <mission/utility/TmFunnel.h>
|
||||
@ -79,7 +80,7 @@ ReturnValue_t TmFunnel::handlePacket(TmTcMessage* message) {
|
||||
|
||||
ReturnValue_t TmFunnel::initialize() {
|
||||
|
||||
tmPool = objectManager->get<StorageManagerIF>(objects::TM_STORE);
|
||||
tmPool = ObjectManager::instance()->get<StorageManagerIF>(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<AcceptsTelemetryIF>(downlinkDestination);
|
||||
ObjectManager::instance()->get<AcceptsTelemetryIF>(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<AcceptsTelemetryIF>(storageDestination);
|
||||
ObjectManager::instance()->get<AcceptsTelemetryIF>(storageDestination);
|
||||
if(storageTarget != nullptr) {
|
||||
storageQueue->setDefaultDestination(
|
||||
storageTarget->getReportReceptionQueue());
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include <test/testtasks/PusTcInjector.h>
|
||||
|
||||
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
||||
#include <fsfw/objectmanager/ObjectManager.h>
|
||||
#include <fsfw/tmtcservices/AcceptsTelecommandsIF.h>
|
||||
#include <fsfw/tmtcservices/TmTcMessage.h>
|
||||
#include <fsfw/tmtcpacket/pus/TcPacketBase.h>
|
||||
@ -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<AcceptsTelecommandsIF>(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<StorageManagerIF>(tcStoreId);
|
||||
tcStore = ObjectManager::instance()->get<StorageManagerIF>(tcStoreId);
|
||||
if(tcStore == nullptr) {
|
||||
sif::error << "PusTcInjector: TC Store not initialized!" << std::endl;
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include <fsfw/objectmanager/frameworkObjects.h>
|
||||
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
||||
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
||||
#include <fsfw/objectmanager/ObjectManager.h>
|
||||
#include <fsfw/timemanager/Stopwatch.h>
|
||||
#include <fsfw/globalfunctions/arrayprinter.h>
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
|
||||
TestTask::TestTask(object_id_t objectId_):
|
||||
SystemObject(objectId_), testMode(testModes::A) {
|
||||
IPCStore = objectManager->get<StorageManagerIF>(objects::IPC_STORE);
|
||||
IPCStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE);
|
||||
}
|
||||
|
||||
TestTask::~TestTask() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user