obj factory is singleton now
This commit is contained in:
parent
dfc2e6bf67
commit
0747db41ff
@ -1,6 +1,5 @@
|
|||||||
#include "InitMission.h"
|
#include "InitMission.h"
|
||||||
#include "OBSWConfig.h"
|
#include "OBSWConfig.h"
|
||||||
|
|
||||||
#include "objects/systemObjectList.h"
|
#include "objects/systemObjectList.h"
|
||||||
#include "pollingsequence/pollingSequenceFactory.h"
|
#include "pollingsequence/pollingSequenceFactory.h"
|
||||||
|
|
||||||
@ -8,7 +7,7 @@
|
|||||||
#include "mission/assemblies/TestAssembly.h"
|
#include "mission/assemblies/TestAssembly.h"
|
||||||
|
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
#include "fsfw/serviceinterface/ServiceInterfaceStream.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
#include "fsfw/tasks/FixedTimeslotTaskIF.h"
|
#include "fsfw/tasks/FixedTimeslotTaskIF.h"
|
||||||
#include "fsfw/tasks/PeriodicTaskIF.h"
|
#include "fsfw/tasks/PeriodicTaskIF.h"
|
||||||
#include "fsfw/tasks/TaskFactory.h"
|
#include "fsfw/tasks/TaskFactory.h"
|
||||||
@ -195,7 +194,7 @@ void InitMission::createTasks() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if OBSW_ADD_DEVICE_HANDLER_DEMO
|
#if OBSW_ADD_DEVICE_HANDLER_DEMO
|
||||||
HasModesIF* assembly = objectManager->get<HasModesIF>(objects::TEST_ASSEMBLY);
|
HasModesIF* assembly = ObjectManager::instance()->get<HasModesIF>(objects::TEST_ASSEMBLY);
|
||||||
if (assembly == nullptr){
|
if (assembly == nullptr){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#include <fsfw/tmtcservices/CommandingServiceBase.h>
|
#include <fsfw/tmtcservices/CommandingServiceBase.h>
|
||||||
#include <fsfw/tmtcservices/PusServiceBase.h>
|
#include <fsfw/tmtcservices/PusServiceBase.h>
|
||||||
|
|
||||||
void ObjectFactory::produce() {
|
void ObjectFactory::produce(void* args) {
|
||||||
/* Located inside GenericFactory source file */
|
/* Located inside GenericFactory source file */
|
||||||
Factory::setStaticFrameworkObjectIds();
|
Factory::setStaticFrameworkObjectIds();
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
namespace ObjectFactory {
|
namespace ObjectFactory {
|
||||||
void setStatics();
|
void setStatics();
|
||||||
void produce();
|
void produce(void* args);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* MISSION_CORE_OBJECTFACTORY_H_ */
|
#endif /* MISSION_CORE_OBJECTFACTORY_H_ */
|
||||||
|
@ -33,8 +33,6 @@ ServiceInterfaceStream sif::warning("WARNING", true);
|
|||||||
ServiceInterfaceStream sif::error("ERROR", true);
|
ServiceInterfaceStream sif::error("ERROR", true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ObjectManagerIF *objectManager = nullptr;
|
|
||||||
|
|
||||||
void initTask(void *parameters);
|
void initTask(void *parameters);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -70,8 +68,10 @@ void initTask(void *parameters) {
|
|||||||
sif::printInfo("Creating objects..\n\r");
|
sif::printInfo("Creating objects..\n\r");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
objectManager = new ObjectManager(ObjectFactory::produce);
|
ObjectManager* objManager = ObjectManager::instance();
|
||||||
objectManager->initialize();
|
objManager->setObjectFactoryFunction(ObjectFactory::produce, nullptr);
|
||||||
|
objManager->initialize();
|
||||||
|
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::info << "Creating tasks.." << std::endl;
|
sif::info << "Creating tasks.." << std::endl;
|
||||||
#else
|
#else
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include <hardware_init.h>
|
#include <hardware_init.h>
|
||||||
|
|
||||||
#include <fsfw/ipc/MutexGuard.h>
|
#include <fsfw/ipc/MutexGuard.h>
|
||||||
|
#include <fsfw/objectmanager/ObjectManager.h>
|
||||||
#include <fsfw/serviceinterface/ServiceInterface.h>
|
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||||
|
|
||||||
#include <lwip/timeouts.h>
|
#include <lwip/timeouts.h>
|
||||||
@ -18,7 +19,7 @@ UdpTcLwIpPollingTask::~UdpTcLwIpPollingTask() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t UdpTcLwIpPollingTask::initialize() {
|
ReturnValue_t UdpTcLwIpPollingTask::initialize() {
|
||||||
udpBridge = objectManager->get<TmTcLwIpUdpBridge>(bridgeId);
|
udpBridge = ObjectManager::instance()->get<TmTcLwIpUdpBridge>(bridgeId);
|
||||||
if(udpBridge == nullptr) {
|
if(udpBridge == nullptr) {
|
||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
}
|
}
|
||||||
|
2
fsfw
2
fsfw
@ -1 +1 @@
|
|||||||
Subproject commit 33e7c635c57055597caf3d9e9cbafc15c7364266
|
Subproject commit 50fac22f54031e409306931e15d2e63426aa03b2
|
@ -1,7 +1,7 @@
|
|||||||
#include <mission/assemblies/TestAssembly.h>
|
#include <mission/assemblies/TestAssembly.h>
|
||||||
#include <common/config/commonSystemObjects.h>
|
#include <common/config/commonSystemObjects.h>
|
||||||
|
|
||||||
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
#include <fsfw/objectmanager/ObjectManager.h>
|
||||||
|
|
||||||
|
|
||||||
TestAssembly::TestAssembly(object_id_t objectId, object_id_t parentId):
|
TestAssembly::TestAssembly(object_id_t objectId, object_id_t parentId):
|
||||||
@ -149,8 +149,8 @@ ReturnValue_t TestAssembly::initialize() {
|
|||||||
if(result != RETURN_OK){
|
if(result != RETURN_OK){
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
handler0 = objectManager->get<TestDevice>(objects::TEST_DEVICE_HANDLER_0);
|
handler0 = ObjectManager::instance()->get<TestDevice>(objects::TEST_DEVICE_HANDLER_0);
|
||||||
handler1 = objectManager->get<TestDevice>(objects::TEST_DEVICE_HANDLER_1);
|
handler1 = ObjectManager::instance()->get<TestDevice>(objects::TEST_DEVICE_HANDLER_1);
|
||||||
if((handler0 == nullptr) or (handler1 == nullptr)){
|
if((handler0 == nullptr) or (handler1 == nullptr)){
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
#include "TestController.h"
|
#include "TestController.h"
|
||||||
#include <OBSWConfig.h>
|
#include "OBSWConfig.h"
|
||||||
|
|
||||||
#include <fsfw/datapool/PoolReadGuard.h>
|
#include <fsfw/datapool/PoolReadGuard.h>
|
||||||
|
#include <fsfw/objectmanager/ObjectManager.h>
|
||||||
#include <fsfw/serviceinterface/ServiceInterface.h>
|
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||||
|
|
||||||
TestController::TestController(object_id_t objectId, size_t commandQueueDepth):
|
TestController::TestController(object_id_t objectId, size_t commandQueueDepth):
|
||||||
@ -161,7 +162,7 @@ ReturnValue_t TestController::initializeLocalDataPool(localpool::DataPool &local
|
|||||||
|
|
||||||
ReturnValue_t TestController::initializeAfterTaskCreation() {
|
ReturnValue_t TestController::initializeAfterTaskCreation() {
|
||||||
namespace td = testdevice;
|
namespace td = testdevice;
|
||||||
HasLocalDataPoolIF* device0 = objectManager->get<HasLocalDataPoolIF>(
|
HasLocalDataPoolIF* device0 = ObjectManager::instance()->get<HasLocalDataPoolIF>(
|
||||||
objects::TEST_DEVICE_HANDLER_0);
|
objects::TEST_DEVICE_HANDLER_0);
|
||||||
if(device0 == nullptr) {
|
if(device0 == nullptr) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
@ -183,7 +184,7 @@ ReturnValue_t TestController::initializeAfterTaskCreation() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
HasLocalDataPoolIF* device1 = objectManager->get<HasLocalDataPoolIF>(
|
HasLocalDataPoolIF* device1 = ObjectManager::instance()->get<HasLocalDataPoolIF>(
|
||||||
objects::TEST_DEVICE_HANDLER_1);
|
objects::TEST_DEVICE_HANDLER_1);
|
||||||
if(device1 == nullptr) {
|
if(device1 == nullptr) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include <fsfw/ipc/QueueFactory.h>
|
#include <fsfw/ipc/QueueFactory.h>
|
||||||
|
#include <fsfw/objectmanager/ObjectManager.h>
|
||||||
#include <fsfw/tmtcpacket/pus/TmPacketStored.h>
|
#include <fsfw/tmtcpacket/pus/TmPacketStored.h>
|
||||||
#include <fsfw/serviceinterface/ServiceInterface.h>
|
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||||
#include <fsfw/tmtcpacket/pus/TmPacketPusC.h>
|
#include <fsfw/tmtcpacket/pus/TmPacketPusC.h>
|
||||||
@ -81,7 +82,7 @@ ReturnValue_t TmFunnel::handlePacket(TmTcMessage* message) {
|
|||||||
|
|
||||||
ReturnValue_t TmFunnel::initialize() {
|
ReturnValue_t TmFunnel::initialize() {
|
||||||
|
|
||||||
tmPool = objectManager->get<StorageManagerIF>(objects::TM_STORE);
|
tmPool = ObjectManager::instance()->get<StorageManagerIF>(objects::TM_STORE);
|
||||||
if(tmPool == nullptr) {
|
if(tmPool == nullptr) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::error << "TmFunnel::initialize: TM store not set." << std::endl;
|
sif::error << "TmFunnel::initialize: TM store not set." << std::endl;
|
||||||
@ -91,8 +92,8 @@ ReturnValue_t TmFunnel::initialize() {
|
|||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
AcceptsTelemetryIF* tmTarget =
|
AcceptsTelemetryIF* tmTarget = ObjectManager::instance()->
|
||||||
objectManager->get<AcceptsTelemetryIF>(downlinkDestination);
|
get<AcceptsTelemetryIF>(downlinkDestination);
|
||||||
if(tmTarget == nullptr){
|
if(tmTarget == nullptr){
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::error << "TmFunnel::initialize: Downlink Destination not set." << std::endl;
|
sif::error << "TmFunnel::initialize: Downlink Destination not set." << std::endl;
|
||||||
@ -108,8 +109,8 @@ ReturnValue_t TmFunnel::initialize() {
|
|||||||
return SystemObject::initialize();
|
return SystemObject::initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
AcceptsTelemetryIF* storageTarget =
|
AcceptsTelemetryIF* storageTarget = ObjectManager::instance()->
|
||||||
objectManager->get<AcceptsTelemetryIF>(storageDestination);
|
get<AcceptsTelemetryIF>(storageDestination);
|
||||||
if(storageTarget != nullptr) {
|
if(storageTarget != nullptr) {
|
||||||
storageQueue->setDefaultDestination(
|
storageQueue->setDefaultDestination(
|
||||||
storageTarget->getReportReceptionQueue());
|
storageTarget->getReportReceptionQueue());
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
#include "FsfwExampleTask.h"
|
#include "FsfwExampleTask.h"
|
||||||
#include <OBSWConfig.h>
|
#include "OBSWConfig.h"
|
||||||
#include <commonSystemObjects.h>
|
#include "commonSystemObjects.h"
|
||||||
#include <objects/systemObjectList.h>
|
#include "objects/systemObjectList.h"
|
||||||
|
|
||||||
#include <fsfw/serviceinterface/ServiceInterface.h>
|
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||||
|
#include <fsfw/objectmanager/ObjectManager.h>
|
||||||
#include <fsfw/tasks/TaskFactory.h>
|
#include <fsfw/tasks/TaskFactory.h>
|
||||||
#include <fsfw/ipc/QueueFactory.h>
|
#include <fsfw/ipc/QueueFactory.h>
|
||||||
#include <fsfw/ipc/CommandMessage.h>
|
#include <fsfw/ipc/CommandMessage.h>
|
||||||
@ -83,8 +84,7 @@ object_id_t FsfwExampleTask::getSender() {
|
|||||||
ReturnValue_t FsfwExampleTask::initialize() {
|
ReturnValue_t FsfwExampleTask::initialize() {
|
||||||
// Get the dataset of the sender. Will be cached for later checks.
|
// Get the dataset of the sender. Will be cached for later checks.
|
||||||
object_id_t sender = getSender();
|
object_id_t sender = getSender();
|
||||||
HasLocalDataPoolIF* senderIF =
|
HasLocalDataPoolIF* senderIF = ObjectManager::instance()->get<HasLocalDataPoolIF>(sender);
|
||||||
objectManager->get<HasLocalDataPoolIF>(sender);
|
|
||||||
if(senderIF == nullptr) {
|
if(senderIF == nullptr) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::error << "FsfwDemoTask::initialize: Sender object invalid!" << std::endl;
|
sif::error << "FsfwDemoTask::initialize: Sender object invalid!" << std::endl;
|
||||||
@ -163,7 +163,7 @@ ReturnValue_t FsfwExampleTask::performMonitoringDemo() {
|
|||||||
|
|
||||||
ReturnValue_t FsfwExampleTask::performSendOperation() {
|
ReturnValue_t FsfwExampleTask::performSendOperation() {
|
||||||
object_id_t nextRecipient = getNextRecipient();
|
object_id_t nextRecipient = getNextRecipient();
|
||||||
FsfwExampleTask* target = objectManager->get<FsfwExampleTask>(nextRecipient);
|
FsfwExampleTask* target = ObjectManager::instance()->get<FsfwExampleTask>(nextRecipient);
|
||||||
if (target == nullptr) {
|
if (target == nullptr) {
|
||||||
/* Configuration error */
|
/* Configuration error */
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "TestTask.h"
|
#include "TestTask.h"
|
||||||
|
|
||||||
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
#include <fsfw/objectmanager/ObjectManager.h>
|
||||||
#include <fsfw/serviceinterface/ServiceInterface.h>
|
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||||
|
|
||||||
bool TestTask::oneShotAction = true;
|
bool TestTask::oneShotAction = true;
|
||||||
@ -12,7 +12,7 @@ TestTask::TestTask(object_id_t objectId, bool periodicPrintout):
|
|||||||
if(testLock == nullptr) {
|
if(testLock == nullptr) {
|
||||||
testLock = MutexFactory::instance()->createMutex();
|
testLock = MutexFactory::instance()->createMutex();
|
||||||
}
|
}
|
||||||
IPCStore = objectManager->get<StorageManagerIF>(objects::IPC_STORE);
|
IPCStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE);
|
||||||
}
|
}
|
||||||
|
|
||||||
TestTask::~TestTask() {
|
TestTask::~TestTask() {
|
||||||
|
Reference in New Issue
Block a user