copy paste fail

This commit is contained in:
Ulrich Mohr 2022-08-25 22:39:21 +02:00
parent 3260a03544
commit 3f8f17a66e

View File

@ -4,7 +4,7 @@
#include "fsfw/modes/HasModesIF.h" #include "fsfw/modes/HasModesIF.h"
#include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface/ServiceInterface.h"
ModeHelper::ModeHelper(HasModesIF* owner) ModeHelper::ModeHelper(HasModesIF *owner)
: commandedMode(HasModesIF::MODE_OFF), : commandedMode(HasModesIF::MODE_OFF),
commandedSubmode(HasModesIF::SUBMODE_NONE), commandedSubmode(HasModesIF::SUBMODE_NONE),
owner(owner), owner(owner),
@ -12,7 +12,7 @@ ModeHelper::ModeHelper(HasModesIF* owner)
ModeHelper::~ModeHelper() {} ModeHelper::~ModeHelper() {}
ReturnValue_t ModeHelper::handleModeCommand(CommandMessage* command) { ReturnValue_t ModeHelper::handleModeCommand(CommandMessage *command) {
CommandMessage reply; CommandMessage reply;
Mode_t mode; Mode_t mode;
Submode_t submode; Submode_t submode;
@ -108,31 +108,31 @@ bool ModeHelper::isForced() { return forced; }
void ModeHelper::setForced(bool forced) { this->forced = forced; } void ModeHelper::setForced(bool forced) { this->forced = forced; }
#ifdef FSFW_INTROSPECTION #ifdef FSFW_INTROSPECTION
std::vector<std::pair<Mode_t, const char *>> ModeHelper::getModes() const override { std::vector<std::pair<Mode_t, const char *>> ModeHelper::getModes() const {
std::vector<std::pair<Mode_t, const char *>> modeVector; std::vector<std::pair<Mode_t, const char *>> modeVector;
auto modeDefinitionHelper = owner->getModeDefinitionHelper(); auto modeDefinitionHelper = owner->getModeDefinitionHelper();
EnumIF *mode = modeDefinitionHelper.mode; EnumIF *mode = modeDefinitionHelper.mode;
for (size_t i = 0; i < mode->getSize(); i++) { for (size_t i = 0; i < mode->getSize(); i++) {
modeVector.push_back( modeVector.push_back(
std::pair<Mode_t, const char *>(mode->getElements()[i], mode->getDescriptions()[i])); std::pair<Mode_t, const char *>(mode->getElements()[i], mode->getDescriptions()[i]));
}
modeDefinitionHelper.free();
return modeVector;
} }
modeDefinitionHelper.free();
return modeVector;
}
std::vector<std::pair<Submode_t, const char *>> ModeHelper::getSubmodes(Mode_t mode) const override { std::vector<std::pair<Submode_t, const char *>> ModeHelper::getSubmodes(Mode_t mode) const {
auto modeDefinitionHelper = owner->getModeDefinitionHelper(); auto modeDefinitionHelper = owner->getModeDefinitionHelper();
EnumIF *submode = modeDefinitionHelper.submode; EnumIF *submode = modeDefinitionHelper.submode;
std::vector<std::pair<Submode_t, const char *>> submodeVector; std::vector<std::pair<Submode_t, const char *>> submodeVector;
for (size_t i = 0; i < submode->getSize(); i++) { for (size_t i = 0; i < submode->getSize(); i++) {
uint32_t ignored; uint32_t ignored;
if (owner->checkModeCommand(mode, submode->getElements()[i], &ignored) == if (owner->checkModeCommand(mode, submode->getElements()[i], &ignored) ==
HasReturnvaluesIF::RETURN_OK) { HasReturnvaluesIF::RETURN_OK) {
submodeVector.push_back(std::pair<Submode_t, const char *>(submode->getElements()[i], submodeVector.push_back(std::pair<Submode_t, const char *>(submode->getElements()[i],
submode->getDescriptions()[i])); submode->getDescriptions()[i]));
}
} }
modeDefinitionHelper.free();
return submodeVector;
} }
modeDefinitionHelper.free();
return submodeVector;
}
#endif #endif