diff --git a/src/fsfw/action/ActionHelper.cpp b/src/fsfw/action/ActionHelper.cpp index d4332344..4f5c7d1b 100644 --- a/src/fsfw/action/ActionHelper.cpp +++ b/src/fsfw/action/ActionHelper.cpp @@ -57,7 +57,9 @@ void ActionHelper::finish(bool success, MessageQueueId_t reportTo, ActionId_t co void ActionHelper::setQueueToUse(MessageQueueIF* queue) { queueToUse = queue; } -#include +MessageQueueIF const * ActionHelper::getQueue() const { + return queueToUse; +} void ActionHelper::prepareExecution(MessageQueueId_t commandedBy, ActionId_t actionId, store_address_t dataAddress) { diff --git a/src/fsfw/action/ActionHelper.h b/src/fsfw/action/ActionHelper.h index 819c69ae..20302527 100644 --- a/src/fsfw/action/ActionHelper.h +++ b/src/fsfw/action/ActionHelper.h @@ -102,6 +102,12 @@ class ActionHelper { */ void setQueueToUse(MessageQueueIF* queue); + /** + * Needed so templateAction can check if actionHelper was + * contructed already to aid in debuggig a nasty coding error. + */ + MessageQueueIF const * getQueue() const; + void registerAction(Action* action); std::map const* getActionMap(); diff --git a/src/fsfw/action/Parameter.h b/src/fsfw/action/Parameter.h index 59b62b1e..b1457908 100644 --- a/src/fsfw/action/Parameter.h +++ b/src/fsfw/action/Parameter.h @@ -40,6 +40,11 @@ class Parameter : public ParameterIF { return value; } + Parameter& operator =(const T& newValue){ + value = newValue; + return *this; + } + #ifdef FSFW_INTROSPECTION Types::ParameterType getType() override { return enumHelper::value>::template getType(); @@ -66,7 +71,6 @@ class Parameter : public ParameterIF { bool setFloating(double value) override { if (getType() != Types::FLOATING) { - puts("fups"); return false; } this->value = T(value); @@ -75,7 +79,6 @@ class Parameter : public ParameterIF { bool setSigned(int64_t value) override { if ((getType() != Types::SIGNED) && (getType() != Types::ENUM)) { - puts("sups"); return false; } this->value = T(value); diff --git a/src/fsfw/action/TemplateAction.h b/src/fsfw/action/TemplateAction.h index 8b83379e..f9eeccf3 100644 --- a/src/fsfw/action/TemplateAction.h +++ b/src/fsfw/action/TemplateAction.h @@ -1,6 +1,7 @@ #pragma once #include "Action.h" +#include "fsfw/serviceinterface/ServiceInterface.h" template class TemplateAction : public Action { @@ -8,10 +9,15 @@ class TemplateAction : public Action { #ifdef FSFW_INTROSPECTION TemplateAction(owner *myOwner, ActionEnum id) : Action(), myOwner(myOwner) { Action::setEnum(&id); + if (myOwner->getActionHelper()->getQueue() == nullptr) { + sif::error + << "TemplateAction::TemplateAction: Action instances need to be created (ie located) after the actionHelper instance." + << "Program will segfault now..." << std::endl; + } myOwner->getActionHelper()->registerAction(this); } #else - TemplateAction(owner *myOwner, ActionEnum id) : Action((uint32_t) id), myOwner(myOwner) { + TemplateAction(owner *myOwner, ActionEnum id) : Action((uint32_t)id), myOwner(myOwner) { myOwner->getActionHelper()->registerAction(this); } #endif diff --git a/src/fsfw/devicehandlers/DeviceHandlerBase.h b/src/fsfw/devicehandlers/DeviceHandlerBase.h index 1b7ea9db..b406acb0 100644 --- a/src/fsfw/devicehandlers/DeviceHandlerBase.h +++ b/src/fsfw/devicehandlers/DeviceHandlerBase.h @@ -342,7 +342,7 @@ class DeviceHandlerBase : public DeviceHandlerIF, */ virtual ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t *commandData, - size_t commandDataLen) = 0; + size_t commandDataLen) {exit(0);} /* Reply handling */ /** diff --git a/src/fsfw/objectmanager/ObjectManager.cpp b/src/fsfw/objectmanager/ObjectManager.cpp index 39fef5b5..de0fb411 100644 --- a/src/fsfw/objectmanager/ObjectManager.cpp +++ b/src/fsfw/objectmanager/ObjectManager.cpp @@ -78,7 +78,7 @@ SystemObjectIF* ObjectManager::getSystemObject(object_id_t id) { } } -void ObjectManager::initialize() { +void ObjectManager::produce() { if (objectFactoryFunction == nullptr) { #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::error << "ObjectManager::initialize: Passed produceObjects " @@ -90,6 +90,10 @@ void ObjectManager::initialize() { return; } objectFactoryFunction(factoryArgs); +} + +void ObjectManager::initialize() { + produce(); ReturnValue_t result = RETURN_FAILED; uint32_t errorCount = 0; for (auto const& it : objectList) { @@ -143,3 +147,7 @@ void ObjectManager::printList() { } #endif } + +const std::map * ObjectManager::getObjectList(){ + return &objectList; +} diff --git a/src/fsfw/objectmanager/ObjectManager.h b/src/fsfw/objectmanager/ObjectManager.h index 50e4af00..2bdcfc28 100644 --- a/src/fsfw/objectmanager/ObjectManager.h +++ b/src/fsfw/objectmanager/ObjectManager.h @@ -42,7 +42,9 @@ class ObjectManager : public ObjectManagerIF { ReturnValue_t insert(object_id_t id, SystemObjectIF* object) override; ReturnValue_t remove(object_id_t id) override; void initialize() override; + void produce() override; void printList() override; + const std::map * getObjectList() override; protected: SystemObjectIF* getSystemObject(object_id_t id) override; diff --git a/src/fsfw/objectmanager/ObjectManagerIF.h b/src/fsfw/objectmanager/ObjectManagerIF.h index 32a0942f..e4347673 100644 --- a/src/fsfw/objectmanager/ObjectManagerIF.h +++ b/src/fsfw/objectmanager/ObjectManagerIF.h @@ -1,6 +1,8 @@ #ifndef FSFW_OBJECTMANAGER_OBJECTMANAGERIF_H_ #define FSFW_OBJECTMANAGER_OBJECTMANAGERIF_H_ +#include + #include "../returnvalues/HasReturnvaluesIF.h" #include "../serviceinterface/ServiceInterface.h" #include "SystemObjectIF.h" @@ -58,12 +60,14 @@ class ObjectManagerIF : public HasReturnvaluesIF { * @li RETURN_OK in case the object was successfully removed */ virtual ReturnValue_t remove(object_id_t id) = 0; + virtual void produce() = 0; virtual void initialize() = 0; /** * @brief This is a debug function, that prints the current content of the * object list. */ virtual void printList() = 0; + virtual const std::map* getObjectList() = 0; }; #endif /* OBJECTMANAGERIF_H_ */