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 FixedTimeslotTask::delayForInterval(chron_ms* previousWakeTimeMs, const chron_ms interval) {
|
||||||
bool shouldDelay = false;
|
bool shouldDelay = false;
|
||||||
// Get current wakeup time
|
// Get current wakeup time
|
||||||
|
@ -50,16 +50,6 @@ class FixedTimeslotTask : public FixedTimeslotTaskBase {
|
|||||||
*/
|
*/
|
||||||
ReturnValue_t startTask() override;
|
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;
|
ReturnValue_t sleepFor(uint32_t ms) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -26,11 +26,9 @@ class FixedTimeslotTaskIF : public PeriodicTaskIF {
|
|||||||
* @param executionStep
|
* @param executionStep
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
virtual ReturnValue_t addSlot(object_id_t componentId, uint32_t slotTimeMs,
|
virtual ReturnValue_t addSlot(object_id_t execId, ExecutableObjectIF* obj, uint32_t slotTimeMs,
|
||||||
int8_t executionStep) {
|
int8_t executionStep) = 0;
|
||||||
auto* execObj = ObjectManager::instance()->get<ExecutableObjectIF>(componentId);
|
|
||||||
return addSlot(componentId, execObj, slotTimeMs, executionStep);
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* Add an object with a slot time and the execution step to the task.
|
* 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
|
* The execution step will be passed to the object (e.g. as an operation
|
||||||
@ -40,14 +38,25 @@ class FixedTimeslotTaskIF : public PeriodicTaskIF {
|
|||||||
* @param executionStep
|
* @param executionStep
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
virtual ReturnValue_t addSlot(object_id_t execId, ExecutableObjectIF* obj, uint32_t slotTimeMs,
|
virtual ReturnValue_t addSlot(object_id_t componentId, uint32_t slotTimeMs,
|
||||||
int8_t executionStep) = 0;
|
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
|
* Check whether the sequence is valid and perform all other required
|
||||||
* initialization steps which are needed after task creation
|
* initialization steps which are needed after task creation
|
||||||
*/
|
*/
|
||||||
virtual ReturnValue_t checkSequence() = 0;
|
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_ */
|
#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(); }
|
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() {
|
ReturnValue_t PeriodicTaskBase::initObjsAfterTaskCreation() {
|
||||||
std::set<ExecutableObjectIF*> uniqueObjects;
|
std::set<ExecutableObjectIF*> uniqueObjects;
|
||||||
ReturnValue_t status = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t status = HasReturnvaluesIF::RETURN_OK;
|
||||||
@ -63,11 +69,3 @@ ReturnValue_t PeriodicTaskBase::addComponent(ExecutableObjectIF* object, uint8_t
|
|||||||
|
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
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.
|
* @param object Id of the object to add.
|
||||||
* @return RETURN_OK on success, RETURN_FAILED if the object could not be added.
|
* @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) {
|
virtual ReturnValue_t addComponent(object_id_t object, uint8_t opCode) = 0;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
|
||||||
};
|
|
||||||
|
|
||||||
virtual ReturnValue_t addComponent(object_id_t object) { return addComponent(object, 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.
|
* @param object pointer to the object to add.
|
||||||
* @return RETURN_OK on success, RETURN_FAILED if the object could not be added.
|
* @return RETURN_OK on success, RETURN_FAILED if the object could not be added.
|
||||||
*/
|
*/
|
||||||
virtual ReturnValue_t addComponent(ExecutableObjectIF* object, uint8_t opCode) {
|
virtual ReturnValue_t addComponent(ExecutableObjectIF* object, uint8_t opCode) = 0;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
|
||||||
};
|
|
||||||
|
|
||||||
virtual ReturnValue_t addComponent(ExecutableObjectIF* object) { return addComponent(object, 0); }
|
virtual ReturnValue_t addComponent(ExecutableObjectIF* object) { return addComponent(object, 0); }
|
||||||
|
|
||||||
virtual ReturnValue_t sleepFor(uint32_t ms) = 0;
|
virtual ReturnValue_t sleepFor(uint32_t ms) = 0;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
class PeriodicTaskMock : public PeriodicTaskBase {
|
class PeriodicTaskMock : public PeriodicTaskBase {
|
||||||
public:
|
public:
|
||||||
PeriodicTaskMock(TaskPeriod period, TaskDeadlineMissedFunction dlmFunc)
|
PeriodicTaskMock(TaskPeriod period, TaskDeadlineMissedFunction dlmFunc)
|
||||||
: PeriodicTaskBase(period, dlmFunc) {}
|
: PeriodicTaskBase(period, dlmFunc) {}
|
||||||
|
|
||||||
virtual ~PeriodicTaskMock() {}
|
virtual ~PeriodicTaskMock() {}
|
||||||
/**
|
/**
|
||||||
@ -20,7 +20,6 @@ class PeriodicTaskMock : public PeriodicTaskBase {
|
|||||||
};
|
};
|
||||||
|
|
||||||
virtual ReturnValue_t sleepFor(uint32_t ms) override { return HasReturnvaluesIF::RETURN_OK; };
|
virtual ReturnValue_t sleepFor(uint32_t ms) override { return HasReturnvaluesIF::RETURN_OK; };
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FSFW_UNITTEST_TESTS_MOCKS_PERIODICTASKMOCK_H_
|
#endif // FSFW_UNITTEST_TESTS_MOCKS_PERIODICTASKMOCK_H_
|
||||||
|
Loading…
Reference in New Issue
Block a user