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 44 additions and 48 deletions
Showing only changes of commit 1eceef4645 - Show all commits

View File

@ -7,6 +7,13 @@
#include "../returnvalues/returnvalue.h" #include "../returnvalues/returnvalue.h"
#include "ArrayList.h" #include "ArrayList.h"
namespace mapdefs {
static const uint8_t INTERFACE_ID = CLASS_ID::FIXED_MAP;
static const ReturnValue_t KEY_ALREADY_EXISTS = MAKE_RETURN_CODE(0x01);
static const ReturnValue_t MAP_FULL = MAKE_RETURN_CODE(0x02);
static const ReturnValue_t KEY_DOES_NOT_EXIST = MAKE_RETURN_CODE(0x03);
} // namespace mapdefs
/** /**
* @brief Map implementation for maps with a pre-defined size. * @brief Map implementation for maps with a pre-defined size.
* @details * @details
@ -24,11 +31,6 @@ class FixedMap : public SerializeIF {
"derived class from SerializeIF to be serialize-able"); "derived class from SerializeIF to be serialize-able");
public: public:
static const uint8_t INTERFACE_ID = CLASS_ID::FIXED_MAP;
static const ReturnValue_t KEY_ALREADY_EXISTS = MAKE_RETURN_CODE(0x01);
static const ReturnValue_t MAP_FULL = MAKE_RETURN_CODE(0x02);
static const ReturnValue_t KEY_DOES_NOT_EXIST = MAKE_RETURN_CODE(0x03);
private: private:
static const key_t EMPTY_SLOT = -1; static const key_t EMPTY_SLOT = -1;
ArrayList<std::pair<key_t, T>, uint32_t> theMap; ArrayList<std::pair<key_t, T>, uint32_t> theMap;
@ -76,10 +78,10 @@ class FixedMap : public SerializeIF {
ReturnValue_t insert(key_t key, T value, Iterator* storedValue = nullptr) { ReturnValue_t insert(key_t key, T value, Iterator* storedValue = nullptr) {
if (exists(key) == returnvalue::OK) { if (exists(key) == returnvalue::OK) {
return KEY_ALREADY_EXISTS; return mapdefs::KEY_ALREADY_EXISTS;
} }
if (_size == theMap.maxSize()) { if (_size == theMap.maxSize()) {
return MAP_FULL; return mapdefs::MAP_FULL;
} }
theMap[_size].first = key; theMap[_size].first = key;
theMap[_size].second = value; theMap[_size].second = value;
@ -93,7 +95,7 @@ class FixedMap : public SerializeIF {
ReturnValue_t insert(std::pair<key_t, T> pair) { return insert(pair.first, pair.second); } ReturnValue_t insert(std::pair<key_t, T> pair) { return insert(pair.first, pair.second); }
ReturnValue_t exists(key_t key) const { ReturnValue_t exists(key_t key) const {
ReturnValue_t result = KEY_DOES_NOT_EXIST; ReturnValue_t result = mapdefs::KEY_DOES_NOT_EXIST;
if (findIndex(key) < _size) { if (findIndex(key) < _size) {
result = returnvalue::OK; result = returnvalue::OK;
} }
@ -103,7 +105,7 @@ class FixedMap : public SerializeIF {
ReturnValue_t erase(Iterator* iter) { ReturnValue_t erase(Iterator* iter) {
uint32_t i; uint32_t i;
if ((i = findIndex((*iter).value->first)) >= _size) { if ((i = findIndex((*iter).value->first)) >= _size) {
return KEY_DOES_NOT_EXIST; return mapdefs::KEY_DOES_NOT_EXIST;
} }
theMap[i] = theMap[_size - 1]; theMap[i] = theMap[_size - 1];
--_size; --_size;
@ -114,7 +116,7 @@ class FixedMap : public SerializeIF {
ReturnValue_t erase(key_t key) { ReturnValue_t erase(key_t key) {
uint32_t i; uint32_t i;
if ((i = findIndex(key)) >= _size) { if ((i = findIndex(key)) >= _size) {
return KEY_DOES_NOT_EXIST; return mapdefs::KEY_DOES_NOT_EXIST;
} }
theMap[i] = theMap[_size - 1]; theMap[i] = theMap[_size - 1];
--_size; --_size;

View File

@ -21,11 +21,11 @@ ControllerBase::~ControllerBase() { QueueFactory::instance()->deleteMessageQueue
ReturnValue_t ControllerBase::initialize() { ReturnValue_t ControllerBase::initialize() {
ReturnValue_t result = modeHelper.initialize(); ReturnValue_t result = modeHelper.initialize();
if(result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
result = healthHelper.initialize(); result = healthHelper.initialize();
if(result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
return SystemObject::initialize(); return SystemObject::initialize();
@ -106,9 +106,7 @@ const HasHealthIF* ControllerBase::getOptHealthIF() const { return this; }
const HasModesIF& ControllerBase::getModeIF() const { return *this; } const HasModesIF& ControllerBase::getModeIF() const { return *this; }
ModeTreeChildIF& ControllerBase::getModeTreeChildIF() { ModeTreeChildIF& ControllerBase::getModeTreeChildIF() { return *this; }
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

@ -31,7 +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; ModeTreeChildIF &getModeTreeChildIF() override;
/** SystemObject override */ /** SystemObject override */
ReturnValue_t initialize() override; ReturnValue_t initialize() override;

View File

@ -2,14 +2,15 @@
#define FSFW_DEVICEHANDLER_CHILDHANDLERBASE_H_ #define FSFW_DEVICEHANDLER_CHILDHANDLERBASE_H_
#include <fsfw/subsystem/HasModeTreeChildrenIF.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,
HasModeTreeChildrenIF& parent, HasModeTreeChildrenIF& parent, FailureIsolationBase* customFdir = nullptr,
FailureIsolationBase* customFdir = nullptr, size_t cmdQueueSize = 20); size_t cmdQueueSize = 20);
virtual ~ChildHandlerBase(); virtual ~ChildHandlerBase();

View File

@ -1,6 +1,5 @@
#include "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"
@ -13,6 +12,7 @@
#include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface/ServiceInterface.h"
#include "fsfw/storagemanager/StorageManagerIF.h" #include "fsfw/storagemanager/StorageManagerIF.h"
#include "fsfw/subsystem/SubsystemBase.h" #include "fsfw/subsystem/SubsystemBase.h"
#include "fsfw/subsystem/helper.h"
#include "fsfw/thermal/ThermalComponentIF.h" #include "fsfw/thermal/ThermalComponentIF.h"
object_id_t DeviceHandlerBase::powerSwitcherId = objects::NO_OBJECT; object_id_t DeviceHandlerBase::powerSwitcherId = objects::NO_OBJECT;
@ -1593,18 +1593,12 @@ void DeviceHandlerBase::disableCommandsAndReplies() {
} }
} }
ReturnValue_t DeviceHandlerBase::connectModeTreeParent(HasModeTreeChildrenIF &parent) { ReturnValue_t DeviceHandlerBase::connectModeTreeParent(HasModeTreeChildrenIF& parent) {
return modetree::connectModeTreeParent(parent, *this, healthHelper, modeHelper); return modetree::connectModeTreeParent(parent, *this, healthHelper, modeHelper);
} }
const HasHealthIF* DeviceHandlerBase::getOptHealthIF() const { const HasHealthIF* DeviceHandlerBase::getOptHealthIF() const { return this; }
return this;
}
const HasModesIF& DeviceHandlerBase::getModeIF() const { const HasModesIF& DeviceHandlerBase::getModeIF() const { return *this; }
return *this;
}
ModeTreeChildIF& DeviceHandlerBase::getModeTreeChildIF() { ModeTreeChildIF& DeviceHandlerBase::getModeTreeChildIF() { return *this; }
return *this;
}

View File

@ -11,7 +11,6 @@
#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"
@ -22,6 +21,7 @@
#include "fsfw/returnvalues/returnvalue.h" #include "fsfw/returnvalues/returnvalue.h"
#include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface/ServiceInterface.h"
#include "fsfw/serviceinterface/serviceInterfaceDefintions.h" #include "fsfw/serviceinterface/serviceInterfaceDefintions.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"
#include "fsfw/util/dataWrapper.h" #include "fsfw/util/dataWrapper.h"
@ -125,7 +125,7 @@ class DeviceHandlerBase : public DeviceHandlerIF,
uint32_t thermalSetId = DeviceHandlerIF::DEFAULT_THERMAL_SET_ID); uint32_t thermalSetId = DeviceHandlerIF::DEFAULT_THERMAL_SET_ID);
ReturnValue_t connectModeTreeParent(HasModeTreeChildrenIF &parent) override; ReturnValue_t connectModeTreeParent(HasModeTreeChildrenIF &parent) override;
ModeTreeChildIF& getModeTreeChildIF() override; ModeTreeChildIF &getModeTreeChildIF() override;
/** /**
* @brief Helper function to ease device handler development. * @brief Helper function to ease device handler development.
@ -967,8 +967,8 @@ class DeviceHandlerBase : public DeviceHandlerIF,
*/ */
LocalDataPoolManager *getHkManagerHandle() override; LocalDataPoolManager *getHkManagerHandle() override;
const HasHealthIF* getOptHealthIF() const override; const HasHealthIF *getOptHealthIF() const override;
const HasModesIF& getModeIF() const override; const HasModesIF &getModeIF() const override;
/** /**
* Returns the delay cycle count of a reply. * Returns the delay cycle count of a reply.

View File

@ -6,7 +6,7 @@
class ModeTreeConnectionIF { 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; virtual ModeTreeChildIF& getModeTreeChildIF() = 0;
}; };

View File

@ -36,6 +36,13 @@ ReturnValue_t Subsystem::checkSequence(HybridIterator<ModeListEntry> iter,
for (; iter.value != nullptr; ++iter) { for (; iter.value != nullptr; ++iter) {
if (!existsModeTable(iter->getTableId())) { if (!existsModeTable(iter->getTableId())) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
using namespace std;
sif::warning << "Subsystem::checkSequence: "
<< "Object " << setfill('0') << hex << "0x" << setw(8) << getObjectId()
<< setw(0) << ": Mode table for mode ID "
<< "0x" << setw(8) << iter->getTableId() << " does not exist" << dec << endl;
#endif
return TABLE_DOES_NOT_EXIST; return TABLE_DOES_NOT_EXIST;
} else { } else {
ReturnValue_t result = checkTable(getTable(iter->getTableId())); ReturnValue_t result = checkTable(getTable(iter->getTableId()));

View File

@ -131,11 +131,11 @@ MessageQueueId_t SubsystemBase::getCommandQueue() const { return commandQueue->g
ReturnValue_t SubsystemBase::initialize() { ReturnValue_t SubsystemBase::initialize() {
ReturnValue_t result = modeHelper.initialize(); ReturnValue_t result = modeHelper.initialize();
if(result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
result = healthHelper.initialize(); result = healthHelper.initialize();
if(result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
return SystemObject::initialize(); return SystemObject::initialize();
@ -310,10 +310,6 @@ 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 { const HasModesIF& SubsystemBase::getModeIF() const { return *this; }
return *this;
}
ModeTreeChildIF& SubsystemBase::getModeTreeChildIF() { ModeTreeChildIF& SubsystemBase::getModeTreeChildIF() { return *this; }
return *this;
}

View File

@ -6,12 +6,12 @@
#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"
#include "fsfw/returnvalues/returnvalue.h" #include "fsfw/returnvalues/returnvalue.h"
#include "fsfw/subsystem/HasModeTreeChildrenIF.h" #include "fsfw/subsystem/HasModeTreeChildrenIF.h"
#include "fsfw/subsystem/ModeTreeConnectionIF.h"
#include "fsfw/tasks/ExecutableObjectIF.h" #include "fsfw/tasks/ExecutableObjectIF.h"
#include "modes/HasModeSequenceIF.h" #include "modes/HasModeSequenceIF.h"
@ -47,7 +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; ModeTreeChildIF &getModeTreeChildIF() override;
/** /**
* Function to register the child objects. * Function to register the child objects.

View File

@ -4,9 +4,7 @@
TestAssembly::TestAssembly(object_id_t objectId, object_id_t parentId, ModeTreeChildIF& testDevice0, TestAssembly::TestAssembly(object_id_t objectId, object_id_t parentId, ModeTreeChildIF& testDevice0,
ModeTreeChildIF& testDevice1) ModeTreeChildIF& testDevice1)
: AssemblyBase(objectId, parentId), : AssemblyBase(objectId, parentId), deviceHandler0(testDevice0), deviceHandler1(testDevice1) {
deviceHandler0(testDevice0),
deviceHandler1(testDevice1) {
ModeListEntry newModeListEntry; ModeListEntry newModeListEntry;
newModeListEntry.setObject(testDevice0.getObjectId()); newModeListEntry.setObject(testDevice0.getObjectId());
newModeListEntry.setMode(MODE_OFF); newModeListEntry.setMode(MODE_OFF);