2022-05-19 00:44:34 +02:00
|
|
|
#include "FixedTimeslotTaskBase.h"
|
|
|
|
|
|
|
|
#include "fsfw/objectmanager/ObjectManager.h"
|
|
|
|
|
|
|
|
FixedTimeslotTaskBase::FixedTimeslotTaskBase(TaskPeriod period_,
|
|
|
|
TaskDeadlineMissedFunction dlmFunc_)
|
2022-05-27 15:18:28 +02:00
|
|
|
: period(period_), pollingSeqTable(getPeriodMs()), dlmFunc(dlmFunc_) {}
|
2022-05-19 00:44:34 +02:00
|
|
|
uint32_t FixedTimeslotTaskBase::getPeriodMs() const { return static_cast<uint32_t>(period * 1000); }
|
|
|
|
|
|
|
|
bool FixedTimeslotTaskBase::isEmpty() const { return pollingSeqTable.isEmpty(); }
|
|
|
|
|
|
|
|
ReturnValue_t FixedTimeslotTaskBase::checkSequence() { return pollingSeqTable.checkSequence(); }
|
|
|
|
|
2022-05-30 11:25:08 +02:00
|
|
|
ReturnValue_t FixedTimeslotTaskBase::addSlot(object_id_t execId, ExecutableObjectIF* execObj,
|
|
|
|
uint32_t slotTimeMs, int8_t executionStep) {
|
|
|
|
if (execObj == nullptr) {
|
2022-05-19 00:44:34 +02:00
|
|
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
2022-05-30 11:25:08 +02:00
|
|
|
sif::error << "Component 0x" << std::hex << std::setw(8) << std::setfill('0') << execObj
|
|
|
|
<< std::setfill(' ') << " not found, not adding it to PST" << std::dec << std::endl;
|
2022-05-19 00:44:34 +02:00
|
|
|
#else
|
2022-05-30 11:25:08 +02:00
|
|
|
sif::printError("Component 0x%08x not found, not adding it to PST\n");
|
2022-05-19 00:44:34 +02:00
|
|
|
#endif
|
2022-08-15 20:28:16 +02:00
|
|
|
return returnvalue::FAILED;
|
2022-05-30 11:25:08 +02:00
|
|
|
}
|
|
|
|
pollingSeqTable.addSlot(execId, slotTimeMs, executionStep, execObj, this);
|
2022-08-15 20:28:16 +02:00
|
|
|
return returnvalue::OK;
|
2022-05-19 00:44:34 +02:00
|
|
|
}
|