EIVE upstream #29

Merged
muellerr merged 693 commits from use-eive-upstream into develop 2023-06-30 15:44:39 +02:00
11 changed files with 73 additions and 62 deletions
Showing only changes of commit 10dd855244 - Show all commits

View File

@ -102,6 +102,10 @@ const HasHealthIF* ControllerBase::getOptHealthIF() const { return this; }
const HasModesIF& ControllerBase::getModeIF() const { return *this; } const HasModesIF& ControllerBase::getModeIF() const { return *this; }
ModeTreeChildIF& ControllerBase::getModeTreeChildIF() {
return *this;
}
ReturnValue_t ControllerBase::connectModeTreeParent(HasModeTreeChildrenIF& parent) { ReturnValue_t ControllerBase::connectModeTreeParent(HasModeTreeChildrenIF& parent) {
return modetree::connectModeTreeParent(parent, *this, healthHelper, modeHelper); return modetree::connectModeTreeParent(parent, *this, healthHelper, modeHelper);
} }

View File

@ -8,7 +8,7 @@
#include "fsfw/objectmanager/SystemObject.h" #include "fsfw/objectmanager/SystemObject.h"
#include "fsfw/subsystem/HasModeTreeChildrenIF.h" #include "fsfw/subsystem/HasModeTreeChildrenIF.h"
#include "fsfw/subsystem/ModeTreeChildIF.h" #include "fsfw/subsystem/ModeTreeChildIF.h"
#include "fsfw/subsystem/modes/ModeTreeConnectionIF.h" #include "fsfw/subsystem/ModeTreeConnectionIF.h"
#include "fsfw/tasks/ExecutableObjectIF.h" #include "fsfw/tasks/ExecutableObjectIF.h"
#include "fsfw/tasks/PeriodicTaskIF.h" #include "fsfw/tasks/PeriodicTaskIF.h"
@ -31,6 +31,7 @@ class ControllerBase : public HasModesIF,
~ControllerBase() override; ~ControllerBase() override;
ReturnValue_t connectModeTreeParent(HasModeTreeChildrenIF &parent) override; ReturnValue_t connectModeTreeParent(HasModeTreeChildrenIF &parent) override;
ModeTreeChildIF& getModeTreeChildIF() override;
/** SystemObject override */ /** SystemObject override */
ReturnValue_t initialize() override; ReturnValue_t initialize() override;

View File

@ -3,11 +3,11 @@
#include "fsfw/subsystem/SubsystemBase.h" #include "fsfw/subsystem/SubsystemBase.h"
ChildHandlerBase::ChildHandlerBase(object_id_t setObjectId, object_id_t deviceCommunication, ChildHandlerBase::ChildHandlerBase(object_id_t setObjectId, object_id_t deviceCommunication,
CookieIF* cookie, object_id_t parent, CookieIF* cookie, HasModeTreeChildrenIF& parent,
FailureIsolationBase* customFdir, size_t cmdQueueSize) FailureIsolationBase* customFdir, size_t cmdQueueSize)
: DeviceHandlerBase(setObjectId, deviceCommunication, cookie, : DeviceHandlerBase(setObjectId, deviceCommunication, cookie,
(customFdir == nullptr ? &childHandlerFdir : customFdir), cmdQueueSize), (customFdir == nullptr ? &childHandlerFdir : customFdir), cmdQueueSize),
parentId(parent), parent(parent),
childHandlerFdir(setObjectId) {} childHandlerFdir(setObjectId) {}
ChildHandlerBase::~ChildHandlerBase() {} ChildHandlerBase::~ChildHandlerBase() {}
@ -18,22 +18,5 @@ ReturnValue_t ChildHandlerBase::initialize() {
return result; return result;
} }
// TODO: Fix this return DeviceHandlerBase::connectModeTreeParent(parent);
// MessageQueueId_t parentQueue = 0;
//
// if (parentId != objects::NO_OBJECT) {
// SubsystemBase* parent = ObjectManager::instance()->get<SubsystemBase>(parentId);
// if (parent == NULL) {
// return returnvalue::FAILED;
// }
// parentQueue = parent->getCommandQueue();
//
// parent->registerChild(getObjectId());
// }
//
// healthHelper.setParentQueue(parentQueue);
//
// modeHelper.setParentQueue(parentQueue);
return returnvalue::OK;
} }

View File

@ -1,13 +1,14 @@
#ifndef FSFW_DEVICEHANDLER_CHILDHANDLERBASE_H_ #ifndef FSFW_DEVICEHANDLER_CHILDHANDLERBASE_H_
#define FSFW_DEVICEHANDLER_CHILDHANDLERBASE_H_ #define FSFW_DEVICEHANDLER_CHILDHANDLERBASE_H_
#include <fsfw/subsystem/HasModeTreeChildrenIF.h>
#include "ChildHandlerFDIR.h" #include "ChildHandlerFDIR.h"
#include "DeviceHandlerBase.h" #include "DeviceHandlerBase.h"
class ChildHandlerBase : public DeviceHandlerBase { class ChildHandlerBase : public DeviceHandlerBase {
public: public:
ChildHandlerBase(object_id_t setObjectId, object_id_t deviceCommunication, CookieIF* cookie, ChildHandlerBase(object_id_t setObjectId, object_id_t deviceCommunication, CookieIF* cookie,
object_id_t parent = objects::NO_OBJECT, HasModeTreeChildrenIF& parent,
FailureIsolationBase* customFdir = nullptr, size_t cmdQueueSize = 20); FailureIsolationBase* customFdir = nullptr, size_t cmdQueueSize = 20);
virtual ~ChildHandlerBase(); virtual ~ChildHandlerBase();
@ -15,7 +16,7 @@ class ChildHandlerBase : public DeviceHandlerBase {
virtual ReturnValue_t initialize(); virtual ReturnValue_t initialize();
protected: protected:
const uint32_t parentId; HasModeTreeChildrenIF& parent;
ChildHandlerFDIR childHandlerFdir; ChildHandlerFDIR childHandlerFdir;
}; };

View File

@ -1,5 +1,6 @@
#include "fsfw/devicehandlers/DeviceHandlerBase.h" #include "DeviceHandlerBase.h"
#include "fsfw/subsystem/helper.h"
#include "fsfw/datapoollocal/LocalPoolVariable.h" #include "fsfw/datapoollocal/LocalPoolVariable.h"
#include "fsfw/devicehandlers/AcceptsDeviceResponsesIF.h" #include "fsfw/devicehandlers/AcceptsDeviceResponsesIF.h"
#include "fsfw/devicehandlers/DeviceTmReportingWrapper.h" #include "fsfw/devicehandlers/DeviceTmReportingWrapper.h"
@ -1591,3 +1592,19 @@ void DeviceHandlerBase::disableCommandsAndReplies() {
} }
} }
} }
ReturnValue_t DeviceHandlerBase::connectModeTreeParent(HasModeTreeChildrenIF &parent) {
return modetree::connectModeTreeParent(parent, *this, healthHelper, modeHelper);
}
const HasHealthIF* DeviceHandlerBase::getOptHealthIF() const {
return this;
}
const HasModesIF& DeviceHandlerBase::getModeIF() const {
return *this;
}
ModeTreeChildIF& DeviceHandlerBase::getModeTreeChildIF() {
return *this;
}

View File

@ -11,6 +11,7 @@
#include "fsfw/action/HasActionsIF.h" #include "fsfw/action/HasActionsIF.h"
#include "fsfw/datapool/PoolVariableIF.h" #include "fsfw/datapool/PoolVariableIF.h"
#include "fsfw/datapoollocal/HasLocalDataPoolIF.h" #include "fsfw/datapoollocal/HasLocalDataPoolIF.h"
#include "fsfw/subsystem/ModeTreeConnectionIF.h"
#include "fsfw/datapoollocal/LocalDataPoolManager.h" #include "fsfw/datapoollocal/LocalDataPoolManager.h"
#include "fsfw/health/HealthHelper.h" #include "fsfw/health/HealthHelper.h"
#include "fsfw/ipc/MessageQueueIF.h" #include "fsfw/ipc/MessageQueueIF.h"
@ -84,6 +85,8 @@ class DeviceHandlerBase : public DeviceHandlerIF,
public HasModesIF, public HasModesIF,
public HasHealthIF, public HasHealthIF,
public HasActionsIF, public HasActionsIF,
public ModeTreeChildIF,
public ModeTreeConnectionIF,
public ReceivesParameterMessagesIF, public ReceivesParameterMessagesIF,
public HasLocalDataPoolIF { public HasLocalDataPoolIF {
friend void(Factory::setStaticFrameworkObjectIds)(); friend void(Factory::setStaticFrameworkObjectIds)();
@ -120,6 +123,10 @@ class DeviceHandlerBase : public DeviceHandlerIF,
lp_id_t thermalStatePoolId = DeviceHandlerIF::DEFAULT_THERMAL_STATE_POOL_ID, lp_id_t thermalStatePoolId = DeviceHandlerIF::DEFAULT_THERMAL_STATE_POOL_ID,
lp_id_t thermalRequestPoolId = DeviceHandlerIF::DEFAULT_THERMAL_HEATING_REQUEST_POOL_ID, lp_id_t thermalRequestPoolId = DeviceHandlerIF::DEFAULT_THERMAL_HEATING_REQUEST_POOL_ID,
uint32_t thermalSetId = DeviceHandlerIF::DEFAULT_THERMAL_SET_ID); uint32_t thermalSetId = DeviceHandlerIF::DEFAULT_THERMAL_SET_ID);
ReturnValue_t connectModeTreeParent(HasModeTreeChildrenIF &parent) override;
ModeTreeChildIF& getModeTreeChildIF() override;
/** /**
* @brief Helper function to ease device handler development. * @brief Helper function to ease device handler development.
* This will instruct the transition to MODE_ON immediately * This will instruct the transition to MODE_ON immediately
@ -165,7 +172,7 @@ class DeviceHandlerBase : public DeviceHandlerIF,
* @param counter Specifies which Action to perform * @param counter Specifies which Action to perform
* @return returnvalue::OK for successful execution * @return returnvalue::OK for successful execution
*/ */
virtual ReturnValue_t performOperation(uint8_t counter) override; ReturnValue_t performOperation(uint8_t counter) override;
/** /**
* @brief Initializes the device handler * @brief Initializes the device handler
@ -175,14 +182,14 @@ class DeviceHandlerBase : public DeviceHandlerIF,
* Calls fillCommandAndReplyMap(). * Calls fillCommandAndReplyMap().
* @return * @return
*/ */
virtual ReturnValue_t initialize() override; ReturnValue_t initialize() override;
/** /**
* @brief Intialization steps performed after all tasks have been created. * @brief Intialization steps performed after all tasks have been created.
* This function will be called by the executing task. * This function will be called by the executing task.
* @return * @return
*/ */
virtual ReturnValue_t initializeAfterTaskCreation() override; ReturnValue_t initializeAfterTaskCreation() override;
/** Destructor. */ /** Destructor. */
virtual ~DeviceHandlerBase(); virtual ~DeviceHandlerBase();
@ -960,6 +967,9 @@ class DeviceHandlerBase : public DeviceHandlerIF,
*/ */
LocalDataPoolManager *getHkManagerHandle() override; LocalDataPoolManager *getHkManagerHandle() override;
const HasHealthIF* getOptHealthIF() const override;
const HasModesIF& getModeIF() const override;
/** /**
* Returns the delay cycle count of a reply. * Returns the delay cycle count of a reply.
* A count != 0 indicates that the command is already executed. * A count != 0 indicates that the command is already executed.

View File

@ -7,6 +7,7 @@ class ModeTreeConnectionIF {
public: public:
virtual ~ModeTreeConnectionIF() = default; virtual ~ModeTreeConnectionIF() = default;
virtual ReturnValue_t connectModeTreeParent(HasModeTreeChildrenIF &parent) = 0; virtual ReturnValue_t connectModeTreeParent(HasModeTreeChildrenIF &parent) = 0;
virtual ModeTreeChildIF& getModeTreeChildIF() = 0;
}; };
#endif /* FSFW_SRC_FSFW_SUBSYSTEM_MODES_MODETREECONNECTIONIF_H_ */ #endif /* FSFW_SRC_FSFW_SUBSYSTEM_MODES_MODETREECONNECTIONIF_H_ */

View File

@ -300,4 +300,10 @@ ReturnValue_t SubsystemBase::registerChild(const ModeTreeChildIF& child) {
const HasHealthIF* SubsystemBase::getOptHealthIF() const { return this; } const HasHealthIF* SubsystemBase::getOptHealthIF() const { return this; }
const HasModesIF& SubsystemBase::getModeIF() const { return *this; } const HasModesIF& SubsystemBase::getModeIF() const {
return *this;
}
ModeTreeChildIF& SubsystemBase::getModeTreeChildIF() {
return *this;
}

View File

@ -1,13 +1,12 @@
#ifndef FSFW_SUBSYSTEM_SUBSYSTEMBASE_H_ #ifndef FSFW_SUBSYSTEM_SUBSYSTEMBASE_H_
#define FSFW_SUBSYSTEM_SUBSYSTEMBASE_H_ #define FSFW_SUBSYSTEM_SUBSYSTEMBASE_H_
#include <fsfw/subsystem/modes/ModeTreeConnectionIF.h>
#include <map> #include <map>
#include "fsfw/container/HybridIterator.h" #include "fsfw/container/HybridIterator.h"
#include "fsfw/health/HasHealthIF.h" #include "fsfw/health/HasHealthIF.h"
#include "fsfw/health/HealthHelper.h" #include "fsfw/health/HealthHelper.h"
#include "fsfw/subsystem/ModeTreeConnectionIF.h"
#include "fsfw/ipc/MessageQueueIF.h" #include "fsfw/ipc/MessageQueueIF.h"
#include "fsfw/modes/HasModesIF.h" #include "fsfw/modes/HasModesIF.h"
#include "fsfw/objectmanager/SystemObject.h" #include "fsfw/objectmanager/SystemObject.h"
@ -48,6 +47,7 @@ class SubsystemBase : public SystemObject,
virtual MessageQueueId_t getCommandQueue() const override; virtual MessageQueueId_t getCommandQueue() const override;
ReturnValue_t connectModeTreeParent(HasModeTreeChildrenIF &parent) override; ReturnValue_t connectModeTreeParent(HasModeTreeChildrenIF &parent) override;
ModeTreeChildIF& getModeTreeChildIF() override;
/** /**
* Function to register the child objects. * Function to register the child objects.

View File

@ -2,19 +2,19 @@
#include <fsfw/objectmanager/ObjectManager.h> #include <fsfw/objectmanager/ObjectManager.h>
TestAssembly::TestAssembly(object_id_t objectId, object_id_t parentId, object_id_t testDevice0, TestAssembly::TestAssembly(object_id_t objectId, object_id_t parentId, ModeTreeChildIF& testDevice0,
object_id_t testDevice1) ModeTreeChildIF& testDevice1)
: AssemblyBase(objectId, parentId), : AssemblyBase(objectId, parentId),
deviceHandler0Id(testDevice0), deviceHandler0(testDevice0),
deviceHandler1Id(testDevice1) { deviceHandler1(testDevice1) {
ModeListEntry newModeListEntry; ModeListEntry newModeListEntry;
newModeListEntry.setObject(testDevice0); newModeListEntry.setObject(testDevice0.getObjectId());
newModeListEntry.setMode(MODE_OFF); newModeListEntry.setMode(MODE_OFF);
newModeListEntry.setSubmode(SUBMODE_NONE); newModeListEntry.setSubmode(SUBMODE_NONE);
commandTable.insert(newModeListEntry); commandTable.insert(newModeListEntry);
newModeListEntry.setObject(testDevice1); newModeListEntry.setObject(testDevice1.getObjectId());
newModeListEntry.setMode(MODE_OFF); newModeListEntry.setMode(MODE_OFF);
newModeListEntry.setSubmode(SUBMODE_NONE); newModeListEntry.setSubmode(SUBMODE_NONE);
@ -43,8 +43,8 @@ ReturnValue_t TestAssembly::commandChildren(Mode_t mode, Submode_t submode) {
commandTable[1].setMode(MODE_OFF); commandTable[1].setMode(MODE_OFF);
commandTable[1].setSubmode(SUBMODE_NONE); commandTable[1].setSubmode(SUBMODE_NONE);
// We try to prefer 0 here but we try to switch to 1 even if it might fail // We try to prefer 0 here but we try to switch to 1 even if it might fail
if (isDeviceAvailable(deviceHandler0Id)) { if (isDeviceAvailable(deviceHandler0.getObjectId())) {
if (childrenMap[deviceHandler0Id].mode == MODE_ON) { if (childrenMap[deviceHandler0.getObjectId()].mode == MODE_ON) {
commandTable[0].setMode(mode); commandTable[0].setMode(mode);
commandTable[0].setSubmode(SUBMODE_NONE); commandTable[0].setSubmode(SUBMODE_NONE);
} else { } else {
@ -53,7 +53,7 @@ ReturnValue_t TestAssembly::commandChildren(Mode_t mode, Submode_t submode) {
result = NEED_SECOND_STEP; result = NEED_SECOND_STEP;
} }
} else { } else {
if (childrenMap[deviceHandler1Id].mode == MODE_ON) { if (childrenMap[deviceHandler1.getObjectId()].mode == MODE_ON) {
commandTable[1].setMode(mode); commandTable[1].setMode(mode);
commandTable[1].setSubmode(SUBMODE_NONE); commandTable[1].setSubmode(SUBMODE_NONE);
} else { } else {
@ -64,7 +64,7 @@ ReturnValue_t TestAssembly::commandChildren(Mode_t mode, Submode_t submode) {
} }
} else { } else {
// Dual Mode Normal // Dual Mode Normal
if (childrenMap[deviceHandler0Id].mode == MODE_ON) { if (childrenMap[deviceHandler0.getObjectId()].mode == MODE_ON) {
commandTable[0].setMode(mode); commandTable[0].setMode(mode);
commandTable[0].setSubmode(SUBMODE_NONE); commandTable[0].setSubmode(SUBMODE_NONE);
} else { } else {
@ -72,7 +72,7 @@ ReturnValue_t TestAssembly::commandChildren(Mode_t mode, Submode_t submode) {
commandTable[0].setSubmode(SUBMODE_NONE); commandTable[0].setSubmode(SUBMODE_NONE);
result = NEED_SECOND_STEP; result = NEED_SECOND_STEP;
} }
if (childrenMap[deviceHandler1Id].mode == MODE_ON) { if (childrenMap[deviceHandler1.getObjectId()].mode == MODE_ON) {
commandTable[1].setMode(mode); commandTable[1].setMode(mode);
commandTable[1].setSubmode(SUBMODE_NONE); commandTable[1].setSubmode(SUBMODE_NONE);
} else { } else {
@ -89,7 +89,7 @@ ReturnValue_t TestAssembly::commandChildren(Mode_t mode, Submode_t submode) {
commandTable[1].setMode(MODE_OFF); commandTable[1].setMode(MODE_OFF);
commandTable[1].setSubmode(SUBMODE_NONE); commandTable[1].setSubmode(SUBMODE_NONE);
// We try to prefer 0 here but we try to switch to 1 even if it might fail // We try to prefer 0 here but we try to switch to 1 even if it might fail
if (isDeviceAvailable(deviceHandler0Id)) { if (isDeviceAvailable(deviceHandler0.getObjectId())) {
commandTable[0].setMode(MODE_ON); commandTable[0].setMode(MODE_ON);
commandTable[0].setSubmode(SUBMODE_NONE); commandTable[0].setSubmode(SUBMODE_NONE);
} else { } else {
@ -133,24 +133,14 @@ ReturnValue_t TestAssembly::initialize() {
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
handler0 = ObjectManager::instance()->get<TestDevice>(deviceHandler0Id); auto* handler0 = ObjectManager::instance()->get<TestDevice>(deviceHandler0.getObjectId());
handler1 = ObjectManager::instance()->get<TestDevice>(deviceHandler1Id); auto* handler1 = ObjectManager::instance()->get<TestDevice>(deviceHandler1.getObjectId());
if ((handler0 == nullptr) or (handler1 == nullptr)) { if ((handler0 == nullptr) or (handler1 == nullptr)) {
return returnvalue::FAILED; return returnvalue::FAILED;
} }
handler0->setParentQueue(this->getCommandQueue()); handler0->connectModeTreeParent(*this);
handler1->setParentQueue(this->getCommandQueue()); handler1->connectModeTreeParent(*this);
// TODO: Fix this
// result = registerChild(deviceHandler0Id);
// if (result != returnvalue::OK) {
// return result;
// }
// result = registerChild(deviceHandler1Id);
// if (result != returnvalue::OK) {
// return result;
// }
return result; return result;
} }

View File

@ -7,8 +7,8 @@
class TestAssembly : public AssemblyBase { class TestAssembly : public AssemblyBase {
public: public:
TestAssembly(object_id_t objectId, object_id_t parentId, object_id_t testDevice0, TestAssembly(object_id_t objectId, object_id_t parentId, ModeTreeChildIF& testDevice0,
object_id_t testDevice1); ModeTreeChildIF& testDevice1);
virtual ~TestAssembly(); virtual ~TestAssembly();
ReturnValue_t initialize() override; ReturnValue_t initialize() override;
@ -41,10 +41,8 @@ class TestAssembly : public AssemblyBase {
private: private:
FixedArrayList<ModeListEntry, 2> commandTable; FixedArrayList<ModeListEntry, 2> commandTable;
object_id_t deviceHandler0Id = 0; ModeTreeChildIF& deviceHandler0;
object_id_t deviceHandler1Id = 0; ModeTreeChildIF& deviceHandler1;
TestDevice* handler0 = nullptr;
TestDevice* handler1 = nullptr;
bool isDeviceAvailable(object_id_t object); bool isDeviceAvailable(object_id_t object);
}; };