2021-07-13 20:22:54 +02:00
|
|
|
#include "fsfw/devicehandlers/ChildHandlerBase.h"
|
2020-09-01 11:52:18 +02:00
|
|
|
|
2022-02-02 10:29:30 +01:00
|
|
|
#include "fsfw/subsystem/SubsystemBase.h"
|
2020-09-01 11:52:18 +02:00
|
|
|
|
2022-02-02 10:29:30 +01:00
|
|
|
ChildHandlerBase::ChildHandlerBase(object_id_t setObjectId, object_id_t deviceCommunication,
|
|
|
|
CookieIF* cookie, object_id_t hkDestination,
|
|
|
|
uint32_t thermalStatePoolId, uint32_t thermalRequestPoolId,
|
|
|
|
object_id_t parent, FailureIsolationBase* customFdir,
|
|
|
|
size_t cmdQueueSize)
|
|
|
|
: DeviceHandlerBase(setObjectId, deviceCommunication, cookie,
|
|
|
|
(customFdir == nullptr ? &childHandlerFdir : customFdir), cmdQueueSize),
|
|
|
|
parentId(parent),
|
|
|
|
childHandlerFdir(setObjectId) {
|
|
|
|
this->setHkDestination(hkDestination);
|
|
|
|
this->setThermalStateRequestPoolIds(thermalStatePoolId, thermalRequestPoolId);
|
2020-09-01 11:52:18 +02:00
|
|
|
}
|
|
|
|
|
2022-02-02 10:29:30 +01:00
|
|
|
ChildHandlerBase::~ChildHandlerBase() {}
|
2020-09-01 11:52:18 +02:00
|
|
|
|
|
|
|
ReturnValue_t ChildHandlerBase::initialize() {
|
2022-02-02 10:29:30 +01:00
|
|
|
ReturnValue_t result = DeviceHandlerBase::initialize();
|
2022-08-16 01:08:26 +02:00
|
|
|
if (result != returnvalue::OK) {
|
2022-02-02 10:29:30 +01:00
|
|
|
return result;
|
|
|
|
}
|
2020-09-01 11:52:18 +02:00
|
|
|
|
2022-02-02 10:29:30 +01:00
|
|
|
MessageQueueId_t parentQueue = 0;
|
2020-09-01 11:52:18 +02:00
|
|
|
|
2022-02-02 10:29:30 +01:00
|
|
|
if (parentId != objects::NO_OBJECT) {
|
|
|
|
SubsystemBase* parent = ObjectManager::instance()->get<SubsystemBase>(parentId);
|
|
|
|
if (parent == NULL) {
|
2022-08-16 01:08:26 +02:00
|
|
|
return returnvalue::FAILED;
|
2022-02-02 10:29:30 +01:00
|
|
|
}
|
|
|
|
parentQueue = parent->getCommandQueue();
|
2020-09-01 11:52:18 +02:00
|
|
|
|
2022-02-02 10:29:30 +01:00
|
|
|
parent->registerChild(getObjectId());
|
|
|
|
}
|
2020-09-01 11:52:18 +02:00
|
|
|
|
2022-02-02 10:29:30 +01:00
|
|
|
healthHelper.setParentQueue(parentQueue);
|
2020-09-01 11:52:18 +02:00
|
|
|
|
2022-02-02 10:29:30 +01:00
|
|
|
modeHelper.setParentQueue(parentQueue);
|
2020-09-01 11:52:18 +02:00
|
|
|
|
2022-08-16 01:08:26 +02:00
|
|
|
return returnvalue::OK;
|
2020-09-01 11:52:18 +02:00
|
|
|
}
|