minor tweaks

This commit is contained in:
Robin Müller 2020-12-14 11:49:01 +01:00
parent 3dd86039bb
commit a547fafa33
4 changed files with 40 additions and 24 deletions

5
tasks/CMakeLists.txt Normal file
View File

@ -0,0 +1,5 @@
target_sources(${LIB_FSFW_NAME}
PRIVATE
FixedSequenceSlot.cpp
FixedSlotSequence.cpp
)

View File

@ -139,6 +139,15 @@ public:
*/ */
ReturnValue_t checkSequence() const; ReturnValue_t checkSequence() const;
/**
* @brief A custom check can be injected for the respective slot list.
* @details
* This can be used by the developer to check the validity of a certain
* sequence. The function will be run in the #checkSequence function.
* The general check will be continued for now if the custom check function
* fails but a diagnostic debug output will be given.
* @param customCheckFunction
*/
void addCustomCheck(ReturnValue_t (*customCheckFunction)(const SlotList &)); void addCustomCheck(ReturnValue_t (*customCheckFunction)(const SlotList &));
/** /**

View File

@ -1,12 +1,12 @@
#ifndef FRAMEWORK_TASKS_FIXEDTIMESLOTTASKIF_H_ #ifndef FRAMEWORK_TASKS_FIXEDTIMESLOTTASKIF_H_
#define FRAMEWORK_TASKS_FIXEDTIMESLOTTASKIF_H_ #define FRAMEWORK_TASKS_FIXEDTIMESLOTTASKIF_H_
#include "PeriodicTaskIF.h"
#include "../objectmanager/ObjectManagerIF.h" #include "../objectmanager/ObjectManagerIF.h"
#include "../tasks/PeriodicTaskIF.h"
/** /**
* @brief Following the same principle as the base class IF. * @brief Following the same principle as the base class IF.
* This is the interface for a Fixed timeslot task * This is the interface for a Fixed timeslot task
*/ */
class FixedTimeslotTaskIF : public PeriodicTaskIF { class FixedTimeslotTaskIF : public PeriodicTaskIF {
public: public:
@ -20,9 +20,8 @@ public:
* @param executionStep * @param executionStep
* @return * @return
*/ */
virtual ReturnValue_t addSlot(object_id_t componentId, virtual ReturnValue_t addSlot(object_id_t componentId, uint32_t slotTimeMs,
uint32_t slotTimeMs, int8_t executionStep) = 0; int8_t executionStep) = 0;
/** /**
* 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
@ -30,4 +29,6 @@ public:
virtual ReturnValue_t checkSequence() const = 0; virtual ReturnValue_t checkSequence() const = 0;
}; };
#endif /* FRAMEWORK_TASKS_FIXEDTIMESLOTTASKIF_H_ */ #endif /* FRAMEWORK_TASKS_FIXEDTIMESLOTTASKIF_H_ */

View File

@ -1,9 +1,10 @@
#ifndef FRAMEWORK_TASKS_TASKFACTORY_H_ #ifndef FSFW_TASKS_TASKFACTORY_H_
#define FRAMEWORK_TASKS_TASKFACTORY_H_ #define FSFW_TASKS_TASKFACTORY_H_
#include "FixedTimeslotTaskIF.h"
#include "Typedef.h"
#include <cstdlib> #include <cstdlib>
#include "../tasks/FixedTimeslotTaskIF.h"
#include "../tasks/Typedef.h"
/** /**
* Singleton Class that produces Tasks. * Singleton Class that produces Tasks.
@ -19,14 +20,13 @@ public:
static TaskFactory* instance(); static TaskFactory* instance();
/** /**
* Generic interface to create a periodic task * Creates a new periodic task and returns the interface pointer.
* @param name_ Name of the task * @param name_ Name of the task
* @param taskPriority_ Priority of the task * @param taskPriority_ Priority of the task
* @param stackSize_ Stack size if the task * @param stackSize_ Stack Size of the task
* @param periodInSeconds_ Period in seconds * @param period_ Period of the task
* @param deadLineMissedFunction_ This function is called if a deadline was * @param deadLineMissedFunction_ Function to be called if a deadline was missed
* missed * @return PeriodicTaskIF* Pointer to the newly created Task
* @return Pointer to the created periodic task class
*/ */
PeriodicTaskIF* createPeriodicTask(TaskName name_, PeriodicTaskIF* createPeriodicTask(TaskName name_,
TaskPriority taskPriority_, TaskStackSize stackSize_, TaskPriority taskPriority_, TaskStackSize stackSize_,
@ -34,14 +34,13 @@ public:
TaskDeadlineMissedFunction deadLineMissedFunction_); TaskDeadlineMissedFunction deadLineMissedFunction_);
/** /**
* Generic interface to create a fixed timeslot task *
* @param name_ Name of the task * @param name_ Name of the task
* @param taskPriority_ Priority of the task * @param taskPriority_ Priority of the task
* @param stackSize_ Stack size if the task * @param stackSize_ Stack Size of the task
* @param periodInSeconds_ Period in seconds * @param period_ Period of the task
* @param deadLineMissedFunction_ This function is called if a deadline was * @param deadLineMissedFunction_ Function to be called if a deadline was missed
* missed * @return FixedTimeslotTaskIF* Pointer to the newly created Task
* @return Pointer to the created periodic task class
*/ */
FixedTimeslotTaskIF* createFixedTimeslotTask(TaskName name_, FixedTimeslotTaskIF* createFixedTimeslotTask(TaskName name_,
TaskPriority taskPriority_, TaskStackSize stackSize_, TaskPriority taskPriority_, TaskStackSize stackSize_,
@ -51,10 +50,10 @@ public:
/** /**
* Function to be called to delete a task * Function to be called to delete a task
* @param task The pointer to the task that shall be deleted, * @param task The pointer to the task that shall be deleted,
* NULL specifies current Task * nullptr specifies current Task
* @return Success of deletion * @return Success of deletion
*/ */
static ReturnValue_t deleteTask(PeriodicTaskIF* task = NULL); static ReturnValue_t deleteTask(PeriodicTaskIF* task = nullptr);
/** /**
* Function to be called to delay current task * Function to be called to delay current task
@ -62,12 +61,14 @@ public:
* @return Success of deletion * @return Success of deletion
*/ */
static ReturnValue_t delayTask(uint32_t delayMs); static ReturnValue_t delayTask(uint32_t delayMs);
private: private:
/** /**
* External instantiation is not allowed. * External instantiation is not allowed.
*/ */
TaskFactory(); TaskFactory();
static TaskFactory* factoryInstance; static TaskFactory* factoryInstance;
}; };
#endif /* FRAMEWORK_TASKS_TASKFACTORY_H_ */ #endif /* FSFW_TASKS_TASKFACTORY_H_ */