From a547fafa33576ce33423536f28d1fa1333a6423a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 14 Dec 2020 11:49:01 +0100 Subject: [PATCH] minor tweaks --- tasks/CMakeLists.txt | 5 +++++ tasks/FixedSlotSequence.h | 9 +++++++++ tasks/FixedTimeslotTaskIF.h | 11 ++++++----- tasks/TaskFactory.h | 39 +++++++++++++++++++------------------ 4 files changed, 40 insertions(+), 24 deletions(-) create mode 100644 tasks/CMakeLists.txt diff --git a/tasks/CMakeLists.txt b/tasks/CMakeLists.txt new file mode 100644 index 00000000..1964bb4e --- /dev/null +++ b/tasks/CMakeLists.txt @@ -0,0 +1,5 @@ +target_sources(${LIB_FSFW_NAME} + PRIVATE + FixedSequenceSlot.cpp + FixedSlotSequence.cpp +) \ No newline at end of file diff --git a/tasks/FixedSlotSequence.h b/tasks/FixedSlotSequence.h index 19a05f21..077dd10b 100644 --- a/tasks/FixedSlotSequence.h +++ b/tasks/FixedSlotSequence.h @@ -139,6 +139,15 @@ public: */ 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 &)); /** diff --git a/tasks/FixedTimeslotTaskIF.h b/tasks/FixedTimeslotTaskIF.h index 6344efa5..a138db4e 100644 --- a/tasks/FixedTimeslotTaskIF.h +++ b/tasks/FixedTimeslotTaskIF.h @@ -1,12 +1,12 @@ #ifndef FRAMEWORK_TASKS_FIXEDTIMESLOTTASKIF_H_ #define FRAMEWORK_TASKS_FIXEDTIMESLOTTASKIF_H_ +#include "PeriodicTaskIF.h" #include "../objectmanager/ObjectManagerIF.h" -#include "../tasks/PeriodicTaskIF.h" /** * @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 { public: @@ -20,9 +20,8 @@ public: * @param executionStep * @return */ - virtual ReturnValue_t addSlot(object_id_t componentId, - uint32_t slotTimeMs, int8_t executionStep) = 0; - + virtual ReturnValue_t addSlot(object_id_t componentId, uint32_t slotTimeMs, + int8_t executionStep) = 0; /** * Check whether the sequence is valid and perform all other required * initialization steps which are needed after task creation @@ -30,4 +29,6 @@ public: virtual ReturnValue_t checkSequence() const = 0; }; + + #endif /* FRAMEWORK_TASKS_FIXEDTIMESLOTTASKIF_H_ */ diff --git a/tasks/TaskFactory.h b/tasks/TaskFactory.h index fd2f4460..85cdda90 100644 --- a/tasks/TaskFactory.h +++ b/tasks/TaskFactory.h @@ -1,9 +1,10 @@ -#ifndef FRAMEWORK_TASKS_TASKFACTORY_H_ -#define FRAMEWORK_TASKS_TASKFACTORY_H_ +#ifndef FSFW_TASKS_TASKFACTORY_H_ +#define FSFW_TASKS_TASKFACTORY_H_ + +#include "FixedTimeslotTaskIF.h" +#include "Typedef.h" #include -#include "../tasks/FixedTimeslotTaskIF.h" -#include "../tasks/Typedef.h" /** * Singleton Class that produces Tasks. @@ -19,14 +20,13 @@ public: 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 taskPriority_ Priority of the task - * @param stackSize_ Stack size if the task - * @param periodInSeconds_ Period in seconds - * @param deadLineMissedFunction_ This function is called if a deadline was - * missed - * @return Pointer to the created periodic task class + * @param stackSize_ Stack Size of the task + * @param period_ Period of the task + * @param deadLineMissedFunction_ Function to be called if a deadline was missed + * @return PeriodicTaskIF* Pointer to the newly created Task */ PeriodicTaskIF* createPeriodicTask(TaskName name_, TaskPriority taskPriority_, TaskStackSize stackSize_, @@ -34,14 +34,13 @@ public: TaskDeadlineMissedFunction deadLineMissedFunction_); /** - * Generic interface to create a fixed timeslot task + * * @param name_ Name of the task * @param taskPriority_ Priority of the task - * @param stackSize_ Stack size if the task - * @param periodInSeconds_ Period in seconds - * @param deadLineMissedFunction_ This function is called if a deadline was - * missed - * @return Pointer to the created periodic task class + * @param stackSize_ Stack Size of the task + * @param period_ Period of the task + * @param deadLineMissedFunction_ Function to be called if a deadline was missed + * @return FixedTimeslotTaskIF* Pointer to the newly created Task */ FixedTimeslotTaskIF* createFixedTimeslotTask(TaskName name_, TaskPriority taskPriority_, TaskStackSize stackSize_, @@ -51,10 +50,10 @@ public: /** * Function to be called to delete a task * @param task The pointer to the task that shall be deleted, - * NULL specifies current Task + * nullptr specifies current Task * @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 @@ -62,12 +61,14 @@ public: * @return Success of deletion */ static ReturnValue_t delayTask(uint32_t delayMs); + private: /** * External instantiation is not allowed. */ TaskFactory(); static TaskFactory* factoryInstance; + }; -#endif /* FRAMEWORK_TASKS_TASKFACTORY_H_ */ +#endif /* FSFW_TASKS_TASKFACTORY_H_ */