fsfw/devicehandlers/ChildHandlerBase.cpp

47 lines
1.3 KiB
C++
Raw Normal View History

2020-10-12 18:18:41 +02:00
#include "ChildHandlerBase.h"
2020-09-01 11:52:18 +02:00
#include "../subsystem/SubsystemBase.h"
ChildHandlerBase::ChildHandlerBase(object_id_t setObjectId,
object_id_t deviceCommunication, CookieIF * cookie,
2020-10-12 18:18:41 +02:00
object_id_t hkDestination, uint32_t thermalStatePoolId,
uint32_t thermalRequestPoolId,
object_id_t parent,
FailureIsolationBase* customFdir, size_t cmdQueueSize) :
2020-09-01 11:52:18 +02:00
DeviceHandlerBase(setObjectId, deviceCommunication, cookie,
(customFdir == nullptr? &childHandlerFdir : customFdir),
cmdQueueSize),
parentId(parent), childHandlerFdir(setObjectId) {
2020-10-12 18:18:41 +02:00
this->setHkDestination(hkDestination);
2020-09-01 11:52:18 +02:00
this->setThermalStateRequestPoolIds(thermalStatePoolId,
thermalRequestPoolId);
}
ChildHandlerBase::~ChildHandlerBase() {
}
ReturnValue_t ChildHandlerBase::initialize() {
ReturnValue_t result = DeviceHandlerBase::initialize();
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
MessageQueueId_t parentQueue = 0;
if (parentId != objects::NO_OBJECT) {
2021-06-05 19:52:38 +02:00
SubsystemBase *parent = ObjectManager::instance()->get<SubsystemBase>(parentId);
2020-09-01 11:52:18 +02:00
if (parent == NULL) {
return RETURN_FAILED;
}
parentQueue = parent->getCommandQueue();
parent->registerChild(getObjectId());
}
healthHelper.setParentQueue(parentQueue);
modeHelper.setParentQueue(parentQueue);
return RETURN_OK;
}