2018-07-13 18:28:26 +02:00
|
|
|
#include <framework/osal/linux/FixedTimeslotTask.h>
|
|
|
|
#include <framework/osal/linux/PeriodicPosixTask.h>
|
|
|
|
#include <framework/tasks/TaskFactory.h>
|
|
|
|
#include <framework/returnvalues/HasReturnvaluesIF.h>
|
|
|
|
|
|
|
|
//TODO: Different variant than the lazy loading in QueueFactory. What's better and why?
|
|
|
|
TaskFactory* TaskFactory::factoryInstance = new TaskFactory();
|
|
|
|
|
|
|
|
TaskFactory::~TaskFactory() {
|
|
|
|
}
|
|
|
|
|
|
|
|
TaskFactory* TaskFactory::instance() {
|
|
|
|
return TaskFactory::factoryInstance;
|
|
|
|
}
|
|
|
|
|
2020-06-06 15:47:33 +02:00
|
|
|
PeriodicTaskIF* TaskFactory::createPeriodicTask(TaskName name_,
|
|
|
|
TaskPriority taskPriority_,TaskStackSize stackSize_,
|
|
|
|
TaskPeriod periodInSeconds_,
|
|
|
|
TaskDeadlineMissedFunction deadLineMissedFunction_) {
|
|
|
|
return new PeriodicPosixTask(name_, taskPriority_,stackSize_,
|
|
|
|
periodInSeconds_ * 1000, deadLineMissedFunction_);
|
2018-07-13 18:28:26 +02:00
|
|
|
}
|
|
|
|
|
2020-06-06 15:47:33 +02:00
|
|
|
FixedTimeslotTaskIF* TaskFactory::createFixedTimeslotTask(TaskName name_,
|
|
|
|
TaskPriority taskPriority_,TaskStackSize stackSize_,
|
|
|
|
TaskPeriod periodInSeconds_,
|
|
|
|
TaskDeadlineMissedFunction deadLineMissedFunction_) {
|
|
|
|
return new FixedTimeslotTask(name_, taskPriority_,stackSize_,
|
|
|
|
periodInSeconds_*1000);
|
2018-07-13 18:28:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
ReturnValue_t TaskFactory::deleteTask(PeriodicTaskIF* task) {
|
|
|
|
//TODO not implemented
|
|
|
|
return HasReturnvaluesIF::RETURN_FAILED;
|
|
|
|
}
|
|
|
|
|
|
|
|
ReturnValue_t TaskFactory::delayTask(uint32_t delayMs){
|
|
|
|
return PosixThread::sleep(delayMs*1000000ull);
|
|
|
|
}
|
|
|
|
|
|
|
|
TaskFactory::TaskFactory() {
|
|
|
|
}
|