connect mode tree parent: make health helper optional

This commit is contained in:
Robin Müller 2023-01-27 15:08:24 +01:00
parent 049e3b431d
commit da12495335
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
6 changed files with 11 additions and 9 deletions

View File

@ -109,5 +109,5 @@ const HasModesIF& ControllerBase::getModeIF() const { return *this; }
ModeTreeChildIF& ControllerBase::getModeTreeChildIF() { 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

@ -1608,7 +1608,7 @@ 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 { return this; } const HasHealthIF* DeviceHandlerBase::getOptHealthIF() const { return this; }

View File

@ -2,12 +2,12 @@
#include <cstddef> #include <cstddef>
#include "fsfw/globalfunctions/CRC.h"
#include "fsfw/objectmanager/ObjectManager.h" #include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/serialize/SerializeAdapter.h" #include "fsfw/serialize/SerializeAdapter.h"
#include "fsfw/serviceinterface.h" #include "fsfw/serviceinterface.h"
#include "fsfw/tmtcservices/AcceptsTelecommandsIF.h"
#include "fsfw/tmtcpacket/pus/tc/PusTcIF.h" #include "fsfw/tmtcpacket/pus/tc/PusTcIF.h"
#include "fsfw/globalfunctions/CRC.h" #include "fsfw/tmtcservices/AcceptsTelecommandsIF.h"
static constexpr auto DEF_END = SerializeIF::Endianness::BIG; static constexpr auto DEF_END = SerializeIF::Endianness::BIG;

View File

@ -284,7 +284,7 @@ ReturnValue_t SubsystemBase::setHealth(HealthState health) {
HasHealthIF::HealthState SubsystemBase::getHealth() { return healthHelper.getHealth(); } HasHealthIF::HealthState SubsystemBase::getHealth() { return healthHelper.getHealth(); }
ReturnValue_t SubsystemBase::connectModeTreeParent(HasModeTreeChildrenIF& parent) { ReturnValue_t SubsystemBase::connectModeTreeParent(HasModeTreeChildrenIF& parent) {
return modetree::connectModeTreeParent(parent, *this, healthHelper, modeHelper); return modetree::connectModeTreeParent(parent, *this, &healthHelper, modeHelper);
} }
object_id_t SubsystemBase::getObjectId() const { return SystemObject::getObjectId(); } object_id_t SubsystemBase::getObjectId() const { return SystemObject::getObjectId(); }

View File

@ -2,12 +2,14 @@
ReturnValue_t modetree::connectModeTreeParent(HasModeTreeChildrenIF& parent, ReturnValue_t modetree::connectModeTreeParent(HasModeTreeChildrenIF& parent,
const ModeTreeChildIF& child, const ModeTreeChildIF& child,
HealthHelper& healthHelper, ModeHelper& modeHelper) { HealthHelper* healthHelper, ModeHelper& modeHelper) {
ReturnValue_t result = parent.registerChild(child); ReturnValue_t result = parent.registerChild(child);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
healthHelper.setParentQueue(parent.getCommandQueue()); if (healthHelper != nullptr) {
healthHelper->setParentQueue(parent.getCommandQueue());
}
modeHelper.setParentQueue(parent.getCommandQueue()); modeHelper.setParentQueue(parent.getCommandQueue());
return returnvalue::OK; return returnvalue::OK;
} }

View File

@ -7,7 +7,7 @@
namespace modetree { namespace modetree {
ReturnValue_t connectModeTreeParent(HasModeTreeChildrenIF& parent, const ModeTreeChildIF& child, ReturnValue_t connectModeTreeParent(HasModeTreeChildrenIF& parent, const ModeTreeChildIF& child,
HealthHelper& healthHelper, ModeHelper& modeHelper); HealthHelper* healthHelper, ModeHelper& modeHelper);
} }