39 lines
1.3 KiB
C++
39 lines
1.3 KiB
C++
#include "HousekeepingHelper.h"
|
|
#include "GeneratesHousekeepingIF.h"
|
|
|
|
#include <fsfw/objectmanager/ObjectManager.h>
|
|
|
|
HousekeepingHelper::HousekeepingHelper(GeneratesHousekeepingIF* owner): owner(owner) {}
|
|
|
|
ReturnValue_t HousekeepingHelper::initialize() {
|
|
tmManager = ObjectManager::instance()->get<TmManager>(objects::TM_MANAGER);
|
|
if (tmManager == nullptr) {
|
|
return returnvalue::FAILED;
|
|
}
|
|
return returnvalue::OK;
|
|
}
|
|
|
|
const HousekeepingSet* HousekeepingHelper::getHousekeepingSet(HousekeepingSetId_t id) {
|
|
auto iter = housekeepingSets.find(id);
|
|
if (iter == housekeepingSets.end()) {
|
|
return nullptr;
|
|
}
|
|
return iter->second;
|
|
}
|
|
|
|
void HousekeepingHelper::registerSet(HousekeepingSet* set) {
|
|
auto id = set->getId();
|
|
housekeepingSets.emplace(id, set);
|
|
}
|
|
|
|
|
|
ReturnValue_t HousekeepingHelper::reportHousekeeping(HousekeepingSet* set, const Action* action) {
|
|
SystemObjectIF* ownerAsObject = dynamic_cast<SystemObjectIF*>(owner);
|
|
if (ownerAsObject == nullptr) {
|
|
sif::error << "Duuuuuuuude, what the hell?" << std::endl;
|
|
return returnvalue::FAILED;
|
|
}
|
|
return tmManager->sendTmPacket(ownerAsObject->getObjectId(), GeneratesHousekeepingIF::INTERFACE_ID,
|
|
GeneratesHousekeepingIF::Functions::REPORT, set,
|
|
action->tc, action->tcOffset);
|
|
} |