fsfw/src/fsfw/tasks/PeriodicTaskIF.h

56 lines
1.4 KiB
C
Raw Normal View History

2020-06-23 01:14:28 +02:00
#ifndef FRAMEWORK_TASK_PERIODICTASKIF_H_
#define FRAMEWORK_TASK_PERIODICTASKIF_H_
2022-02-02 10:29:30 +01:00
#include <cstddef>
2020-08-13 20:53:35 +02:00
#include "../objectmanager/SystemObjectIF.h"
#include "../timemanager/Clock.h"
class ExecutableObjectIF;
2020-06-23 01:14:28 +02:00
/**
* New version of TaskIF
* Follows RAII principles, i.e. there's no create or delete method.
* Minimalistic.
2022-02-02 10:29:30 +01:00
*/
class PeriodicTaskIF {
2022-02-02 10:29:30 +01:00
public:
static const size_t MINIMUM_STACK_SIZE;
/**
* @brief A virtual destructor as it is mandatory for interfaces.
*/
virtual ~PeriodicTaskIF() {}
/**
* @brief With the startTask method, a created task can be started
* for the first time.
*/
virtual ReturnValue_t startTask() = 0;
2022-02-02 10:29:30 +01:00
/**
* Add a component (object) to a periodic task.
2022-02-02 10:29:30 +01:00
* @param object
* Add an object to the task. The object needs to implement ExecutableObjectIF
2022-02-02 10:29:30 +01:00
* @return
*/
2022-05-14 09:38:59 +02:00
virtual ReturnValue_t addComponent(object_id_t object, uint8_t opCode = 0) {
2022-02-02 10:29:30 +01:00
return HasReturnvaluesIF::RETURN_FAILED;
};
/**
* Add an object to a periodic task.
* @param object
* Add an object to the task.
* @return
*/
2022-05-14 09:38:59 +02:00
virtual ReturnValue_t addComponent(ExecutableObjectIF* object, uint8_t opCode = 0) {
return HasReturnvaluesIF::RETURN_FAILED;
};
2022-02-02 10:29:30 +01:00
virtual ReturnValue_t sleepFor(uint32_t ms) = 0;
2022-02-02 10:29:30 +01:00
virtual uint32_t getPeriodMs() const = 0;
2022-05-14 09:38:59 +02:00
virtual bool isEmpty() const = 0;
};
#endif /* PERIODICTASKIF_H_ */