this makes a bit more sense

This commit is contained in:
Robin Müller 2022-09-29 16:47:23 +02:00
parent 227535c461
commit 78314ad966
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
6 changed files with 18 additions and 26 deletions

View File

@ -3,17 +3,12 @@
#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 hkDestination, CookieIF* cookie, object_id_t parent,
uint32_t thermalStatePoolId, uint32_t thermalRequestPoolId, FailureIsolationBase* customFdir, size_t cmdQueueSize)
object_id_t parent, 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), parentId(parent),
childHandlerFdir(setObjectId) { childHandlerFdir(setObjectId) {}
this->setHkDestination(hkDestination);
this->setThermalStateRequestPoolIds(thermalStatePoolId, thermalRequestPoolId);
}
ChildHandlerBase::~ChildHandlerBase() {} ChildHandlerBase::~ChildHandlerBase() {}

View File

@ -7,8 +7,7 @@
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 hkDestination, uint32_t thermalStatePoolId, object_id_t parent = objects::NO_OBJECT,
uint32_t thermalRequestPoolId, object_id_t parent = objects::NO_OBJECT,
FailureIsolationBase* customFdir = nullptr, size_t cmdQueueSize = 20); FailureIsolationBase* customFdir = nullptr, size_t cmdQueueSize = 20);
virtual ~ChildHandlerBase(); virtual ~ChildHandlerBase();

View File

@ -132,14 +132,6 @@ ReturnValue_t DeviceHandlerBase::initialize() {
new DeviceHandlerFailureIsolation(this->getObjectId(), defaultFdirParentId); new DeviceHandlerFailureIsolation(this->getObjectId(), defaultFdirParentId);
} }
if (this->parent != objects::NO_OBJECT) {
HasModesIF* modeIF = ObjectManager::instance()->get<HasModesIF>(this->parent);
HasHealthIF* healthIF = ObjectManager::instance()->get<HasHealthIF>(this->parent);
if (modeIF != nullptr and healthIF != nullptr) {
setParentQueue(modeIF->getCommandQueue());
}
}
communicationInterface = communicationInterface =
ObjectManager::instance()->get<DeviceCommunicationIF>(deviceCommunicationId); ObjectManager::instance()->get<DeviceCommunicationIF>(deviceCommunicationId);
if (communicationInterface == nullptr) { if (communicationInterface == nullptr) {
@ -1578,8 +1570,6 @@ MessageQueueId_t DeviceHandlerBase::getCommanderQueueId(DeviceCommandId_t replyI
void DeviceHandlerBase::setCustomFdir(FailureIsolationBase* fdir) { this->fdirInstance = fdir; } void DeviceHandlerBase::setCustomFdir(FailureIsolationBase* fdir) { this->fdirInstance = fdir; }
void DeviceHandlerBase::setParent(object_id_t parent) { this->parent = parent; }
void DeviceHandlerBase::setPowerSwitcher(PowerSwitchIF* switcher) { void DeviceHandlerBase::setPowerSwitcher(PowerSwitchIF* switcher) {
this->powerSwitcher = switcher; this->powerSwitcher = switcher;
} }

View File

@ -104,7 +104,6 @@ class DeviceHandlerBase : public DeviceHandlerIF,
FailureIsolationBase *fdirInstance = nullptr, size_t cmdQueueSize = 20); FailureIsolationBase *fdirInstance = nullptr, size_t cmdQueueSize = 20);
void setCustomFdir(FailureIsolationBase *fdir); void setCustomFdir(FailureIsolationBase *fdir);
void setParent(object_id_t parent);
void setPowerSwitcher(PowerSwitchIF *switcher); void setPowerSwitcher(PowerSwitchIF *switcher);
void setHkDestination(object_id_t hkDestination); void setHkDestination(object_id_t hkDestination);
@ -200,6 +199,8 @@ class DeviceHandlerBase : public DeviceHandlerIF,
virtual object_id_t getObjectId() const override; virtual object_id_t getObjectId() const override;
/** /**
* This is a helper method for classes which are parent nodes in the mode tree.
* It registers the passed queue as the destination for mode and health messages.
* @param parentQueueId * @param parentQueueId
*/ */
virtual void setParentQueue(MessageQueueId_t parentQueueId); virtual void setParentQueue(MessageQueueId_t parentQueueId);

View File

@ -15,8 +15,8 @@ Service5EventReporting::Service5EventReporting(PsbParams params, size_t maxNumbe
maxNumberReportsPerCycle(maxNumberReportsPerCycle) { maxNumberReportsPerCycle(maxNumberReportsPerCycle) {
auto mqArgs = MqArgs(getObjectId(), static_cast<void*>(this)); auto mqArgs = MqArgs(getObjectId(), static_cast<void*>(this));
psbParams.name = "PUS 5 Event Reporting"; psbParams.name = "PUS 5 Event Reporting";
eventQueue = QueueFactory::instance()->createMessageQueue(messageQueueDepth, eventQueue = QueueFactory::instance()->createMessageQueue(
MessageQueueMessage::MAX_MESSAGE_SIZE, &mqArgs); messageQueueDepth, MessageQueueMessage::MAX_MESSAGE_SIZE, &mqArgs);
} }
Service5EventReporting::~Service5EventReporting() { Service5EventReporting::~Service5EventReporting() {

View File

@ -1,8 +1,9 @@
#include "fsfw/subsystem/SubsystemBase.h" #include "fsfw/subsystem/SubsystemBase.h"
#include "fsfw/FSFW.h"
#include "fsfw/ipc/QueueFactory.h" #include "fsfw/ipc/QueueFactory.h"
#include "fsfw/objectmanager/ObjectManager.h" #include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface.h"
SubsystemBase::SubsystemBase(object_id_t setObjectId, object_id_t parent, Mode_t initialMode, SubsystemBase::SubsystemBase(object_id_t setObjectId, object_id_t parent, Mode_t initialMode,
uint16_t commandQueueDepth) uint16_t commandQueueDepth)
@ -158,7 +159,7 @@ ReturnValue_t SubsystemBase::updateChildChangedHealth(MessageQueueId_t queue, bo
MessageQueueId_t SubsystemBase::getCommandQueue() const { return commandQueue->getId(); } MessageQueueId_t SubsystemBase::getCommandQueue() const { return commandQueue->getId(); }
ReturnValue_t SubsystemBase::initialize() { ReturnValue_t SubsystemBase::initialize() {
MessageQueueId_t parentQueue = MessageQueueIF::NO_QUEUE; MessageQueueId_t also = MessageQueueIF::NO_QUEUE;
ReturnValue_t result = SystemObject::initialize(); ReturnValue_t result = SystemObject::initialize();
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
@ -240,8 +241,14 @@ ReturnValue_t SubsystemBase::handleModeReply(CommandMessage* message) {
} }
ReturnValue_t SubsystemBase::checkTable(HybridIterator<ModeListEntry> tableIter) { ReturnValue_t SubsystemBase::checkTable(HybridIterator<ModeListEntry> tableIter) {
for (; tableIter.value != NULL; ++tableIter) { for (; tableIter.value != nullptr; ++tableIter) {
if (childrenMap.find(tableIter.value->getObject()) == childrenMap.end()) { if (childrenMap.find(tableIter.value->getObject()) == childrenMap.end()) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
using namespace std;
sif::warning << "SubsystemBase::checkTable: Could not find Object " << setfill('0') << hex
<< "0x" << setw(8) << tableIter.value->getObject() << " in object " << setw(8)
<< "0x" << getObjectId() << dec << std::endl;
#endif
return TABLE_CONTAINS_INVALID_OBJECT_ID; return TABLE_CONTAINS_INVALID_OBJECT_ID;
} }
} }