fixed unittests
This commit is contained in:
parent
92ec24352f
commit
dee40f9079
@ -111,26 +111,6 @@ void FixedTimeslotTask::taskFunctionality() {
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t FixedTimeslotTask::addSlot(object_id_t componentId, uint32_t slotTimeMs,
|
||||
int8_t executionStep) {
|
||||
auto* executableObject = ObjectManager::instance()->get<ExecutableObjectIF>(componentId);
|
||||
if (executableObject != nullptr) {
|
||||
pollingSeqTable.addSlot(componentId, slotTimeMs, executionStep, executableObject, this);
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "Component " << std::hex << "0x" << componentId
|
||||
<< "not found, "
|
||||
"not adding it to PST.."
|
||||
<< std::dec << std::endl;
|
||||
#else
|
||||
sif::printError("Component 0x%08x not found, not adding it to PST..\n",
|
||||
static_cast<unsigned int>(componentId));
|
||||
#endif
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
|
||||
bool FixedTimeslotTask::delayForInterval(chron_ms* previousWakeTimeMs, const chron_ms interval) {
|
||||
bool shouldDelay = false;
|
||||
// Get current wakeup time
|
||||
|
@ -50,16 +50,6 @@ class FixedTimeslotTask : public FixedTimeslotTaskBase {
|
||||
*/
|
||||
ReturnValue_t startTask() override;
|
||||
|
||||
/**
|
||||
* Add timeslot to the polling sequence table.
|
||||
* @param componentId
|
||||
* @param slotTimeMs
|
||||
* @param executionStep
|
||||
* @return
|
||||
*/
|
||||
ReturnValue_t addSlot(object_id_t componentId, uint32_t slotTimeMs,
|
||||
int8_t executionStep) override;
|
||||
|
||||
ReturnValue_t sleepFor(uint32_t ms) override;
|
||||
|
||||
protected:
|
||||
|
@ -26,11 +26,9 @@ class FixedTimeslotTaskIF : public PeriodicTaskIF {
|
||||
* @param executionStep
|
||||
* @return
|
||||
*/
|
||||
virtual ReturnValue_t addSlot(object_id_t componentId, uint32_t slotTimeMs,
|
||||
int8_t executionStep) {
|
||||
auto* execObj = ObjectManager::instance()->get<ExecutableObjectIF>(componentId);
|
||||
return addSlot(componentId, execObj, slotTimeMs, executionStep);
|
||||
}
|
||||
virtual ReturnValue_t addSlot(object_id_t execId, ExecutableObjectIF* obj, uint32_t slotTimeMs,
|
||||
int8_t executionStep) = 0;
|
||||
|
||||
/**
|
||||
* Add an object with a slot time and the execution step to the task.
|
||||
* The execution step will be passed to the object (e.g. as an operation
|
||||
@ -40,14 +38,25 @@ class FixedTimeslotTaskIF : public PeriodicTaskIF {
|
||||
* @param executionStep
|
||||
* @return
|
||||
*/
|
||||
virtual ReturnValue_t addSlot(object_id_t execId, ExecutableObjectIF* obj, uint32_t slotTimeMs,
|
||||
int8_t executionStep) = 0;
|
||||
virtual ReturnValue_t addSlot(object_id_t componentId, uint32_t slotTimeMs,
|
||||
int8_t executionStep) {
|
||||
auto* execObj = ObjectManager::instance()->get<ExecutableObjectIF>(componentId);
|
||||
return addSlot(componentId, execObj, slotTimeMs, executionStep);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the sequence is valid and perform all other required
|
||||
* initialization steps which are needed after task creation
|
||||
*/
|
||||
virtual ReturnValue_t checkSequence() = 0;
|
||||
|
||||
virtual ReturnValue_t addComponent(object_id_t object, uint8_t opCode) {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
|
||||
virtual ReturnValue_t addComponent(ExecutableObjectIF* object, uint8_t opCode) {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* FRAMEWORK_TASKS_FIXEDTIMESLOTTASKIF_H_ */
|
||||
|
@ -21,6 +21,12 @@ uint32_t PeriodicTaskBase::getPeriodMs() const { return static_cast<uint32_t>(pe
|
||||
|
||||
bool PeriodicTaskBase::isEmpty() const { return objectList.empty(); }
|
||||
|
||||
ReturnValue_t PeriodicTaskBase::addComponent(object_id_t object) { return addComponent(object, 0); }
|
||||
|
||||
ReturnValue_t PeriodicTaskBase::addComponent(ExecutableObjectIF* object) {
|
||||
return addComponent(object, 0);
|
||||
}
|
||||
|
||||
ReturnValue_t PeriodicTaskBase::initObjsAfterTaskCreation() {
|
||||
std::set<ExecutableObjectIF*> uniqueObjects;
|
||||
ReturnValue_t status = HasReturnvaluesIF::RETURN_OK;
|
||||
@ -63,11 +69,3 @@ ReturnValue_t PeriodicTaskBase::addComponent(ExecutableObjectIF* object, uint8_t
|
||||
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t PeriodicTaskBase::addComponent(object_id_t object) {
|
||||
return addComponent(object, 0);
|
||||
}
|
||||
|
||||
ReturnValue_t PeriodicTaskBase::addComponent(ExecutableObjectIF *object) {
|
||||
return addComponent(object, 0);
|
||||
}
|
||||
|
@ -31,10 +31,7 @@ class PeriodicTaskIF {
|
||||
* @param object Id of the object to add.
|
||||
* @return RETURN_OK on success, RETURN_FAILED if the object could not be added.
|
||||
*/
|
||||
virtual ReturnValue_t addComponent(object_id_t object, uint8_t opCode) {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
};
|
||||
|
||||
virtual ReturnValue_t addComponent(object_id_t object, uint8_t opCode) = 0;
|
||||
virtual ReturnValue_t addComponent(object_id_t object) { return addComponent(object, 0); };
|
||||
|
||||
/**
|
||||
@ -43,10 +40,7 @@ class PeriodicTaskIF {
|
||||
* @param object pointer to the object to add.
|
||||
* @return RETURN_OK on success, RETURN_FAILED if the object could not be added.
|
||||
*/
|
||||
virtual ReturnValue_t addComponent(ExecutableObjectIF* object, uint8_t opCode) {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
};
|
||||
|
||||
virtual ReturnValue_t addComponent(ExecutableObjectIF* object, uint8_t opCode) = 0;
|
||||
virtual ReturnValue_t addComponent(ExecutableObjectIF* object) { return addComponent(object, 0); }
|
||||
|
||||
virtual ReturnValue_t sleepFor(uint32_t ms) = 0;
|
||||
|
@ -20,7 +20,6 @@ class PeriodicTaskMock : public PeriodicTaskBase {
|
||||
};
|
||||
|
||||
virtual ReturnValue_t sleepFor(uint32_t ms) override { return HasReturnvaluesIF::RETURN_OK; };
|
||||
|
||||
};
|
||||
|
||||
#endif // FSFW_UNITTEST_TESTS_MOCKS_PERIODICTASKMOCK_H_
|
||||
|
Loading…
Reference in New Issue
Block a user