Compare commits

...

100 Commits

Author SHA1 Message Date
a7eb165f34 more clang-tidy improvements 2022-07-04 11:42:47 +02:00
dd1e26e719 Merge branch 'development' into mueller/clang-improvements 2022-06-21 10:42:50 +02:00
541f563683 Merge pull request 'Fix StorageAccessor move assignment' () from gaisser/fsfw:gaisser_storage_accessor_fix into development
Reviewed-on: 
2022-06-21 10:31:36 +02:00
28ea71a077 Merge branch 'development' into gaisser_storage_accessor_fix 2022-06-20 17:56:58 +02:00
a044d7d724 Merge pull request 'new cmake options for CICD build' () from mueller/new-cicd-cmake-opts into development
Reviewed-on: 
2022-06-20 17:56:29 +02:00
687700cee8 Merge branch 'development' into gaisser_storage_accessor_fix 2022-06-20 16:36:49 +02:00
732b615cb3 Merge branch 'development' into mueller/new-cicd-cmake-opts 2022-06-20 16:34:13 +02:00
a2c024b24c Merge remote-tracking branch 'origin/development' into mueller/clang-improvements 2022-06-20 16:18:12 +02:00
394ce2ec3e Merge pull request 'LocalDataPoolManager Warning Text' () from meier/debug-info into development
Reviewed-on: 
2022-06-20 16:15:30 +02:00
dde96ae220 Merge branch 'development' into gaisser_storage_accessor_fix 2022-06-20 16:15:05 +02:00
c3aaab4b93 Merge pull request 'Task IF refactoring' () from mueller/task-if-refactoring into development
Reviewed-on: 
2022-06-20 16:08:03 +02:00
edf1d5ae8d Added more test cases 2022-06-20 16:02:35 +02:00
690991b4b5 include fix 2022-06-20 15:42:08 +02:00
1a294e6a13 include TestsConfig.h 2022-06-20 15:40:15 +02:00
8c4e34153b README updates 2022-06-20 15:36:48 +02:00
b60e4bcb90 Fix StorageAccessor move assignment
* Added Unittest for this
* Fixed missing include in test
2022-06-20 15:15:33 +02:00
b18410aa63 Merge remote-tracking branch 'refs/remotes/origin/mueller/task-if-refactoring' into mueller/task-if-refactoring 2022-06-20 15:02:38 +02:00
7f57a8784a Fixed deadline missed call on linux 2022-06-20 15:02:16 +02:00
4b33aa8262 bump ETL version 2022-06-20 14:25:39 +02:00
d47a908117 Merge branch 'development' into mueller/task-if-refactoring 2022-06-20 09:40:31 +02:00
fce95e04a8 Merge branch 'development' into mueller/new-cicd-cmake-opts 2022-06-20 09:39:58 +02:00
fc742e4270 Merge branch 'development' into meier/debug-info 2022-06-16 07:22:43 +02:00
b5183a19fc minor change in debug text 2022-06-16 07:03:58 +02:00
ca453a8f16 Merge pull request 'run auto formatters' () from KSat/fsfw:mueller/reapply-fmt into development
Reviewed-on: 
2022-06-13 17:04:11 +02:00
b7c0c07141 Merge remote-tracking branch 'origin/development' into mueller/new-cicd-cmake-opts 2022-06-13 16:28:01 +02:00
0158102f11 Merge pull request 'apply afmt, basic CLion support' () from mueller/apply-afmt into development
Reviewed-on: 
2022-06-13 16:27:02 +02:00
69859fdbc9 rerun afmt 2022-06-13 16:21:20 +02:00
90bccc744e Merge pull request 'Fix SPI ComIF shadowing warning' () from KSat/fsfw:mueller/spi-com-if-shadowing into development
Reviewed-on: 
2022-06-13 14:35:46 +02:00
ab89108c55 Merge pull request 'some fixes for TC Map printout function' () from KSat/fsfw:mueller/pus-11-printout-fixes into development
Reviewed-on: 
2022-06-13 14:29:36 +02:00
a682bbe400 remove static missed deadline 2022-06-13 14:23:56 +02:00
e67fc2ab0d some fixes for TC Map printout function 2022-06-13 10:56:37 +02:00
71ce966531 Merge branch 'mueller/spi-com-if-shadowing' of https://egit.irs.uni-stuttgart.de/KSat/fsfw into mueller/spi-com-if-shadowing 2022-06-13 10:54:25 +02:00
6b0f4a159f Merge remote-tracking branch 'upstream/development' into mueller/spi-com-if-shadowing 2022-06-13 10:54:20 +02:00
4a06b558c1 Fix SPI ComIF shadowing warning 2022-06-13 10:53:04 +02:00
6d921f03fd Fix SPI ComIF shadowing warning 2022-06-13 10:50:49 +02:00
65bc8213fe Merge branch 'development' into mueller/new-cicd-cmake-opts 2022-06-13 09:43:32 +02:00
a0ee86ace8 use override instead of virtual as recommended 2022-06-08 17:36:20 +02:00
a07a368272 Merge branch 'development' into mueller/apply-afmt 2022-06-08 17:34:04 +02:00
cb8a4bbbec Merge remote-tracking branch 'origin/development' into mueller/task-if-refactoring 2022-06-08 17:33:12 +02:00
17f54006b8 Merge pull request 'rtems fixes' () from mueller/rtems-fixes into development
Reviewed-on: 
2022-06-08 16:12:53 +02:00
395cf9cfa7 added clion base files 2022-06-08 12:12:33 +02:00
a3c0b441ec update changelog 2022-06-08 12:12:33 +02:00
b4132800ae apply afmt, update .gitignore 2022-06-08 12:12:33 +02:00
ad53b48fcb explicitely ignore returnvalue in linux OSAL 2022-06-08 12:12:09 +02:00
dee40f9079 fixed unittests 2022-06-08 12:12:09 +02:00
92ec24352f fix unit test 2022-06-08 12:12:09 +02:00
3f9e459f48 update changelog 2022-06-08 12:12:09 +02:00
e0c7f8d51d apply afmt 2022-06-08 12:12:09 +02:00
eb79386c92 new addSlot function taking executable pointer 2022-06-08 12:12:09 +02:00
4542f31c40 improved custom checker API
- More clang-tidy improvements
2022-06-08 12:12:09 +02:00
689fb378d8 a regular set should suffice here 2022-06-08 12:12:09 +02:00
98b711a872 update changelog 2022-06-08 12:12:09 +02:00
800aa131fa reverted some unrelated changes 2022-06-08 12:12:09 +02:00
6983980304 missing newline and clang-tidy improvement 2022-06-08 12:12:09 +02:00
7c0ba59993 remove include 2022-06-08 12:12:09 +02:00
28873fc87b refactores rtems task module 2022-06-08 12:12:09 +02:00
24e849ed9c avoid compiler warning 2022-06-08 12:12:09 +02:00
d8985c141e some clang tidy stuff and bugfixes 2022-06-08 12:12:09 +02:00
7602b15256 important bugfix 2022-06-08 12:12:09 +02:00
d1a82bceed rtems fixes 2022-06-08 12:12:09 +02:00
7292b02907 refactor freeRTOS task components 2022-06-08 12:12:09 +02:00
347714d53a refactored and tested hosted and linux task IF 2022-06-08 12:12:09 +02:00
f230fa1617 continued refactoring 2022-06-08 12:12:09 +02:00
93615b100c continued refactoring 2022-06-08 12:12:09 +02:00
e18d3d559e refactoring host osal 2022-06-08 12:12:09 +02:00
08ff061d07 minor bugfix 2022-06-08 12:12:09 +02:00
cc351c1066 new base class for periodic tasks 2022-06-08 12:12:09 +02:00
664a548c53 removed some changes which belong in separate PR 2022-06-08 12:12:09 +02:00
e9895559a3 vector as core container is ok 2022-06-08 12:12:09 +02:00
eda5b8f593 refactor task IF 2022-06-08 12:12:09 +02:00
e03f55604a rtems fixes 2022-06-08 12:11:26 +02:00
51d7df2dba Merge branch 'development' into mueller/new-cicd-cmake-opts 2022-06-08 11:13:13 +02:00
12046a2db6 Merge pull request 'bump etl to 20.28.0' () from mueller/bump-etl into development
Reviewed-on: 
2022-06-08 11:09:42 +02:00
c697d0f8ab bump etl to 20.28.0 2022-05-30 10:34:03 +02:00
e90960a7b6 removed duplicate code 2022-05-27 15:22:39 +02:00
e2b3cdd6c4 Merge remote-tracking branch 'origin/development' into mueller/clang-improvements 2022-05-27 15:15:11 +02:00
940fd6f465 Merge branch 'development' into mueller/new-cicd-cmake-opts 2022-05-23 15:59:13 +02:00
8e9d4b451c better printout if ping test fails 2022-05-16 16:18:44 +02:00
1e7a39a8e1 Merge remote-tracking branch 'upstream/development' into mueller/clang-improvements 2022-05-16 15:01:29 +02:00
816550b69c Merge remote-tracking branch 'upstream/development' into mueller/new-cicd-cmake-opts 2022-05-16 14:58:25 +02:00
8a12a5097e Merge branch 'mueller/apply-afmt' into mueller/new-cicd-cmake-opts 2022-05-13 13:50:41 +02:00
87e4a57ef7 added clion base files 2022-05-13 13:48:13 +02:00
0375ee1881 update changelog 2022-05-13 13:46:54 +02:00
28380deab0 Merge branch 'development' into mueller/clang-improvements 2022-05-13 13:42:30 +02:00
c8e034d975 Merge branch 'development' into mueller/new-cicd-cmake-opts 2022-05-13 13:41:58 +02:00
2708b71d77 Merge remote-tracking branch 'origin/development' into mueller/new-cicd-cmake-opts 2022-05-13 12:00:40 +02:00
6366283ce2 Merge branch 'development' into mueller/apply-afmt 2022-05-13 11:50:03 +02:00
8dc640c162 apply afmt, update .gitignore 2022-05-13 11:39:37 +02:00
2e4b9bcd7c Merge remote-tracking branch 'origin/development' into mueller/new-cicd-cmake-opts 2022-05-12 17:42:49 +02:00
c361751751 Merge remote-tracking branch 'origin/development' into mueller/clang-improvements 2022-05-12 17:34:21 +02:00
17a153485d Merge remote-tracking branch 'origin/development' into mueller/clang-improvements 2022-05-09 16:11:14 +02:00
fffe1f812f Merge remote-tracking branch 'origin/development' into mueller/clang-improvements 2022-05-09 16:10:20 +02:00
aacaf52fd9 Merge branch 'development' into mueller/new-cicd-cmake-opts 2022-05-09 15:34:36 +02:00
89f83f4e3d update changelog 2022-05-09 15:33:03 +02:00
39b7976056 new cmake options for CICD build 2022-05-09 15:26:38 +02:00
2a9300e947 Merge branch 'development' into mueller/clang-improvements 2022-05-02 16:16:19 +02:00
13f3a312be Merge branch 'development' into mueller/clang-improvements 2022-05-02 15:24:24 +02:00
9705bf5d40 bugfixes and clang improvement 2022-05-02 11:25:05 +02:00
5425360876 more clang and clang-tidy improvements 2022-05-02 11:04:12 +02:00
b904d33cfe a lot of clang improvements 2022-05-02 10:43:04 +02:00
119 changed files with 971 additions and 1165 deletions
.gitignore
.idea/codeStyles
.run
CHANGELOG.mdCMakeLists.txtREADME.md
automation
hal/src/fsfw_hal
src/fsfw
action
cfdp
controller
datapool
datapoollocal
devicehandlers
health
housekeeping
ipc
monitoring
osal
parameters
power
pus
serialize
storagemanager
tasks
tcdistribution
thermal
tmtcpacket
tests/src/fsfw_tests

8
.gitignore vendored

@ -1,6 +1,14 @@
# PyCharm and CLion
/.idea/*
!/.idea/runConfigurations
!/.idea/cmake.xml
!/.idea/codeStyles
# Eclipse
.cproject .cproject
.project .project
.settings .settings
.metadata .metadata
/build* /build*
/cmake-build*

14
.idea/codeStyles/Project.xml generated Normal file

@ -0,0 +1,14 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<clangFormatSettings>
<option name="ENABLED" value="true" />
</clangFormatSettings>
<codeStyleSettings language="CMake">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="0" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
</code_scheme>
</component>

5
.idea/codeStyles/codeStyleConfig.xml generated Normal file

@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>

@ -0,0 +1,7 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="fsfw-tests_coverage" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="fsfw-example-hosted" TARGET_NAME="fsfw-tests_coverage" CONFIG_NAME="Debug Unittest" RUN_TARGET_PROJECT_NAME="fsfw-example-hosted" RUN_TARGET_NAME="fsfw-tests">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
</component>

7
.run/fsfw.run.xml Normal file

@ -0,0 +1,7 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="fsfw" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="fsfw-tests" TARGET_NAME="fsfw" CONFIG_NAME="Debug Unittest" RUN_TARGET_PROJECT_NAME="fsfw-tests" RUN_TARGET_NAME="fsfw-tests">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
</component>

@ -12,6 +12,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## Changes ## Changes
- Renamed auto-formatting script to `auto-formatter.sh` and made it more robust.
If `cmake-format` is installed, it will also auto-format the `CMakeLists.txt` files now.
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/625
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/626
- Bump C++ required version to C++17. Every project which uses the FSFW and every modern - Bump C++ required version to C++17. Every project which uses the FSFW and every modern
compiler supports it compiler supports it
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/622 PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/622
@ -43,6 +47,38 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
the message queue. Also streamlined and simplified `MessageQueue` implementation for all OSALs the message queue. Also streamlined and simplified `MessageQueue` implementation for all OSALs
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/583 PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/583
### Task Module Refactoring
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/636
**Refactoring general task code**
- There was a lot of duplicate/boilerplate code inside the individual task IF OSAL implementations.
Remove it by introducing base classes `PeriodicTaskBase` and `FixedTimeslotTaskBase`.
**Refactor PeriodicTaskIF**
- Convert `virtual ReturnValue_t addComponent(object_id_t object)` to
`virtual ReturnValue_t addComponent(object_id_t object, uint8_t opCode = 0)`, allowing to pass
the operation code passed to `performOperation`. Updated API taking
an `ExecutableObjectIF` accordingly
**Refactor FixedTimeslotTaskIF**
- Add additional `addSlot` function which takes an `ExecutableObjectIF` pointer and its Object ID
**Refactor FixedSequenceSlot**
- Introduce typedef `CustomCheckFunc` for `ReturnValue_t (*customCheckFunction)(const SlotList&)`.
- Convert `ReturnValue_t (*customCheckFunction)(const SlotList&)` to
`ReturnValue_t (*customCheckFunction)(const SlotList&, void*)`, allowing arbitrary user arguments
for the custom checker
**Linux Task Module**
- Use composition instead of inheritance for the `PeriodicPosixTask` and make the `PosixTask` a
member of the class
### HAL ### HAL
- HAL Linux Uart: Baudrate and bits per word are enums now, avoiding misconfigurations - HAL Linux Uart: Baudrate and bits per word are enums now, avoiding misconfigurations
@ -84,6 +120,11 @@ https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/593
## Additions ## Additions
- Added options for CI/CD builds: `FSFW_CICD_BUILD`. This allows the source code to know
whether it is running in CI/CD
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/623
- Basic `clion` support: Update `.gitignore` and add some basic run configurations
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/625
- LTO support: Allow using LTO/IPO by setting `FSFW_ENABLE_LTO=1`. CMake is able to detect whether - LTO support: Allow using LTO/IPO by setting `FSFW_ENABLE_LTO=1`. CMake is able to detect whether
the user compiler supports IPO/LPO. LTO is on by default now. Most modern compilers support it, the user compiler supports IPO/LPO. LTO is on by default now. Most modern compilers support it,
can make good use of it and it usually makes the code faster and/or smaller. can make good use of it and it usually makes the code faster and/or smaller.

@ -71,7 +71,7 @@ set(FSFW_ETL_LIB_MAJOR_VERSION
20 20
CACHE STRING "ETL library major version requirement") CACHE STRING "ETL library major version requirement")
set(FSFW_ETL_LIB_VERSION set(FSFW_ETL_LIB_VERSION
${FSFW_ETL_LIB_MAJOR_VERSION}.27.3 ${FSFW_ETL_LIB_MAJOR_VERSION}.28.0
CACHE STRING "ETL library exact version requirement") CACHE STRING "ETL library exact version requirement")
set(FSFW_ETL_LINK_TARGET etl::etl) set(FSFW_ETL_LINK_TARGET etl::etl)
@ -105,6 +105,7 @@ endif()
option(FSFW_BUILD_UNITTESTS option(FSFW_BUILD_UNITTESTS
"Build unittest binary in addition to static library" OFF) "Build unittest binary in addition to static library" OFF)
option(FSFW_CICD_BUILD "Build for CI/CD. This can disable problematic test" OFF)
option(FSFW_BUILD_DOCS "Build documentation with Sphinx and Doxygen" OFF) option(FSFW_BUILD_DOCS "Build documentation with Sphinx and Doxygen" OFF)
if(FSFW_BUILD_UNITTESTS) if(FSFW_BUILD_UNITTESTS)
option(FSFW_TESTS_GEN_COV "Generate coverage data for unittests" ON) option(FSFW_TESTS_GEN_COV "Generate coverage data for unittests" ON)

@ -99,7 +99,7 @@ add and link against the FSFW library in general.
4. Link against the FSFW library 4. Link against the FSFW library
```cmake ```sh
target_link_libraries(${YourProjectName} PRIVATE fsfw) target_link_libraries(${YourProjectName} PRIVATE fsfw)
``` ```
@ -131,7 +131,7 @@ default. This can be disabled by setting the `FSFW_TESTS_COV_GEN` option to `OFF
You can use the following commands inside the `fsfw` folder to set up the build system You can use the following commands inside the `fsfw` folder to set up the build system
```sh ```sh
mkdir build-Unittest && cd build-Unittest mkdir build-tests && cd build-tests
cmake -DFSFW_BUILD_UNITTESTS=ON -DFSFW_OSAL=host -DCMAKE_BUILD_TYPE=Debug .. cmake -DFSFW_BUILD_UNITTESTS=ON -DFSFW_OSAL=host -DCMAKE_BUILD_TYPE=Debug ..
``` ```

@ -14,7 +14,7 @@ pipeline {
stage('Configure') { stage('Configure') {
steps { steps {
dir(BUILDDIR) { dir(BUILDDIR) {
sh 'cmake -DFSFW_OSAL=host -DFSFW_BUILD_UNITTESTS=ON ..' sh 'cmake -DFSFW_OSAL=host -DFSFW_BUILD_UNITTESTS=ON -DFSFW_CICD_BUILD=ON ..'
} }
} }
} }

@ -17,8 +17,6 @@ MgmLIS3MDLHandler::MgmLIS3MDLHandler(object_id_t objectId, object_id_t deviceCom
registers[4] = MGMLIS3MDL::CTRL_REG5_DEFAULT; registers[4] = MGMLIS3MDL::CTRL_REG5_DEFAULT;
} }
MgmLIS3MDLHandler::~MgmLIS3MDLHandler() {}
void MgmLIS3MDLHandler::doStartUp() { void MgmLIS3MDLHandler::doStartUp() {
switch (internalState) { switch (internalState) {
case (InternalState::STATE_NONE): { case (InternalState::STATE_NONE): {
@ -90,7 +88,7 @@ ReturnValue_t MgmLIS3MDLHandler::buildTransitionDeviceCommand(DeviceCommandId_t
uint8_t MgmLIS3MDLHandler::readCommand(uint8_t command, bool continuousCom) { uint8_t MgmLIS3MDLHandler::readCommand(uint8_t command, bool continuousCom) {
command |= (1 << MGMLIS3MDL::RW_BIT); command |= (1 << MGMLIS3MDL::RW_BIT);
if (continuousCom == true) { if (continuousCom) {
command |= (1 << MGMLIS3MDL::MS_BIT); command |= (1 << MGMLIS3MDL::MS_BIT);
} }
return command; return command;
@ -98,7 +96,7 @@ uint8_t MgmLIS3MDLHandler::readCommand(uint8_t command, bool continuousCom) {
uint8_t MgmLIS3MDLHandler::writeCommand(uint8_t command, bool continuousCom) { uint8_t MgmLIS3MDLHandler::writeCommand(uint8_t command, bool continuousCom) {
command &= ~(1 << MGMLIS3MDL::RW_BIT); command &= ~(1 << MGMLIS3MDL::RW_BIT);
if (continuousCom == true) { if (continuousCom) {
command |= (1 << MGMLIS3MDL::MS_BIT); command |= (1 << MGMLIS3MDL::MS_BIT);
} }
return command; return command;

@ -28,7 +28,7 @@ class MgmLIS3MDLHandler : public DeviceHandlerBase {
MgmLIS3MDLHandler(uint32_t objectId, object_id_t deviceCommunication, CookieIF *comCookie, MgmLIS3MDLHandler(uint32_t objectId, object_id_t deviceCommunication, CookieIF *comCookie,
uint32_t transitionDelay); uint32_t transitionDelay);
virtual ~MgmLIS3MDLHandler(); ~MgmLIS3MDLHandler() override = default;
void enablePeriodicPrintouts(bool enable, uint8_t divider); void enablePeriodicPrintouts(bool enable, uint8_t divider);
/** /**
@ -46,7 +46,7 @@ class MgmLIS3MDLHandler : public DeviceHandlerBase {
void doShutDown() override; void doShutDown() override;
void doStartUp() override; void doStartUp() override;
void doTransition(Mode_t modeFrom, Submode_t subModeFrom) override; void doTransition(Mode_t modeFrom, Submode_t subModeFrom) override;
virtual uint32_t getTransitionDelayMs(Mode_t from, Mode_t to) override; uint32_t getTransitionDelayMs(Mode_t from, Mode_t to) override;
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t *commandData, ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t *commandData,
size_t commandDataLen) override; size_t commandDataLen) override;
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t *id) override; ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t *id) override;
@ -60,9 +60,9 @@ class MgmLIS3MDLHandler : public DeviceHandlerBase {
* @param packet * @param packet
* @return * @return
*/ */
virtual ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) override; ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) override;
void fillCommandAndReplyMap() override; void fillCommandAndReplyMap() override;
void modeChanged(void) override; void modeChanged() override;
ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap, ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) override; LocalDataPoolManager &poolManager) override;
@ -72,8 +72,6 @@ class MgmLIS3MDLHandler : public DeviceHandlerBase {
static const uint8_t SINGLE_COMMAND_ANSWER_LEN = 2; static const uint8_t SINGLE_COMMAND_ANSWER_LEN = 2;
uint32_t transitionDelay; uint32_t transitionDelay;
// Single SPI command has 2 bytes, first for adress, second for content
size_t singleComandSize = 2;
// Has the size for all adresses of the lis3mdl + the continous write bit // Has the size for all adresses of the lis3mdl + the continous write bit
uint8_t commandBuffer[MGMLIS3MDL::NR_OF_DATA_AND_CFG_REGISTERS + 1]; uint8_t commandBuffer[MGMLIS3MDL::NR_OF_DATA_AND_CFG_REGISTERS + 1];
@ -88,7 +86,6 @@ class MgmLIS3MDLHandler : public DeviceHandlerBase {
*/ */
uint8_t registers[MGMLIS3MDL::NR_OF_CTRL_REGISTERS]; uint8_t registers[MGMLIS3MDL::NR_OF_CTRL_REGISTERS];
uint8_t statusRegister = 0;
bool goToNormalMode = false; bool goToNormalMode = false;
enum class InternalState { enum class InternalState {
@ -111,14 +108,14 @@ class MgmLIS3MDLHandler : public DeviceHandlerBase {
* @param single command to set the read-bit at * @param single command to set the read-bit at
* @param boolean to select a continuous read bit, default = false * @param boolean to select a continuous read bit, default = false
*/ */
uint8_t readCommand(uint8_t command, bool continuousCom = false); static uint8_t readCommand(uint8_t command, bool continuousCom = false);
/** /**
* Sets the write bit for the command * Sets the write bit for the command
* @param single command to set the write-bit at * @param single command to set the write-bit at
* @param boolean to select a continuous write bit, default = false * @param boolean to select a continuous write bit, default = false
*/ */
uint8_t writeCommand(uint8_t command, bool continuousCom = false); static uint8_t writeCommand(uint8_t command, bool continuousCom = false);
/** /**
* This Method gets the full scale for the measurement range * This Method gets the full scale for the measurement range

@ -329,9 +329,9 @@ ReturnValue_t MgmRM3100Handler::handleDataReadout(const uint8_t *packet) {
int32_t fieldStrengthRawZ = ((packet[7] << 24) | (packet[8] << 16) | (packet[3] << 8)) >> 8; int32_t fieldStrengthRawZ = ((packet[7] << 24) | (packet[8] << 16) | (packet[3] << 8)) >> 8;
// Now scale to physical value in microtesla // Now scale to physical value in microtesla
float fieldStrengthX = fieldStrengthRawX * scaleFactorX; float fieldStrengthX = static_cast<float>(fieldStrengthRawX) * scaleFactorX;
float fieldStrengthY = fieldStrengthRawY * scaleFactorX; float fieldStrengthY = static_cast<float>(fieldStrengthRawY) * scaleFactorY;
float fieldStrengthZ = fieldStrengthRawZ * scaleFactorX; float fieldStrengthZ = static_cast<float>(fieldStrengthRawZ) * scaleFactorZ;
if (periodicPrintout) { if (periodicPrintout) {
if (debugDivider.checkAndIncrement()) { if (debugDivider.checkAndIncrement()) {

@ -72,7 +72,6 @@ class MgmRM3100Handler : public DeviceHandlerBase {
RM3100::Rm3100PrimaryDataset primaryDataset; RM3100::Rm3100PrimaryDataset primaryDataset;
uint8_t commandBuffer[10]; uint8_t commandBuffer[10];
uint8_t commandBufferLen = 0;
uint8_t cmmRegValue = RM3100::CMM_VALUE; uint8_t cmmRegValue = RM3100::CMM_VALUE;
uint8_t tmrcRegValue = RM3100::TMRC_DEFAULT_VALUE; uint8_t tmrcRegValue = RM3100::TMRC_DEFAULT_VALUE;
@ -100,4 +99,4 @@ class MgmRM3100Handler : public DeviceHandlerBase {
PeriodicOperationDivider debugDivider = PeriodicOperationDivider(3); PeriodicOperationDivider debugDivider = PeriodicOperationDivider(3);
}; };
#endif /* MISSION_DEVICEHANDLING_MGMRM3100HANDLER_H_ */ #endif /* MISSION_DEVICES_MGMRM3100HANDLER_H_ */

@ -210,7 +210,7 @@ ReturnValue_t SpiComIF::performRegularSendOperation(SpiCookie* spiCookie, const
#endif #endif
return result; return result;
} }
ReturnValue_t result = gpioComIF->pullLow(gpioId); result = gpioComIF->pullLow(gpioId);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
#if FSFW_VERBOSE_LEVEL >= 1 #if FSFW_VERBOSE_LEVEL >= 1
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1

@ -10,6 +10,10 @@
#include "stm32h7xx_hal.h" #include "stm32h7xx_hal.h"
#include "stm32h7xx_hal_spi.h" #include "stm32h7xx_hal_spi.h"
#ifndef STM_USE_PERIPHERAL_TX_BUFFER_MPU_PROTECTION
#define STM_USE_PERIPHERAL_TX_BUFFER_MPU_PROTECTION 1
#endif
enum class TransferStates { IDLE, WAIT, SUCCESS, FAILURE }; enum class TransferStates { IDLE, WAIT, SUCCESS, FAILURE };
class GyroL3GD20H { class GyroL3GD20H {

@ -6,7 +6,7 @@
ActionHelper::ActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue) ActionHelper::ActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue)
: owner(setOwner), queueToUse(useThisQueue) {} : owner(setOwner), queueToUse(useThisQueue) {}
ActionHelper::~ActionHelper() {} ActionHelper::~ActionHelper() = default;
ReturnValue_t ActionHelper::handleActionMessage(CommandMessage* command) { ReturnValue_t ActionHelper::handleActionMessage(CommandMessage* command) {
if (command->getCommand() == ActionMessage::EXECUTE_ACTION) { if (command->getCommand() == ActionMessage::EXECUTE_ACTION) {
@ -59,7 +59,7 @@ void ActionHelper::setQueueToUse(MessageQueueIF* queue) { queueToUse = queue; }
void ActionHelper::prepareExecution(MessageQueueId_t commandedBy, ActionId_t actionId, void ActionHelper::prepareExecution(MessageQueueId_t commandedBy, ActionId_t actionId,
store_address_t dataAddress) { store_address_t dataAddress) {
const uint8_t* dataPtr = NULL; const uint8_t* dataPtr = nullptr;
size_t size = 0; size_t size = 0;
ReturnValue_t result = ipcStore->getData(dataAddress, &dataPtr, &size); ReturnValue_t result = ipcStore->getData(dataAddress, &dataPtr, &size);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {

@ -1,9 +1,9 @@
#ifndef FSFW_ACTION_ACTIONHELPER_H_ #ifndef FSFW_ACTION_ACTIONHELPER_H_
#define FSFW_ACTION_ACTIONHELPER_H_ #define FSFW_ACTION_ACTIONHELPER_H_
#include "../ipc/MessageQueueIF.h"
#include "../serialize/SerializeIF.h"
#include "ActionMessage.h" #include "ActionMessage.h"
#include "fsfw/ipc/MessageQueueIF.h"
#include "fsfw/serialize/SerializeIF.h"
/** /**
* @brief Action Helper is a helper class which handles action messages * @brief Action Helper is a helper class which handles action messages
* *

@ -2,9 +2,9 @@
#include "fsfw/objectmanager/ObjectManager.h" #include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/storagemanager/StorageManagerIF.h" #include "fsfw/storagemanager/StorageManagerIF.h"
ActionMessage::ActionMessage() {} ActionMessage::ActionMessage() = default;
ActionMessage::~ActionMessage() {} ActionMessage::~ActionMessage() = default;
void ActionMessage::setCommand(CommandMessage* message, ActionId_t fid, void ActionMessage::setCommand(CommandMessage* message, ActionId_t fid,
store_address_t parameters) { store_address_t parameters) {
@ -64,9 +64,8 @@ void ActionMessage::clear(CommandMessage* message) {
switch (message->getCommand()) { switch (message->getCommand()) {
case EXECUTE_ACTION: case EXECUTE_ACTION:
case DATA_REPLY: { case DATA_REPLY: {
StorageManagerIF* ipcStore = auto* ipcStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE);
ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE); if (ipcStore != nullptr) {
if (ipcStore != NULL) {
ipcStore->deleteData(getStoreId(message)); ipcStore->deleteData(getStoreId(message));
} }
break; break;

@ -2,14 +2,14 @@
#include "fsfw/objectmanager/ObjectManager.h" #include "fsfw/objectmanager/ObjectManager.h"
CommandActionHelper::CommandActionHelper(CommandsActionsIF *setOwner) CommandActionHelper::CommandActionHelper(CommandsActionsIF *setOwner)
: owner(setOwner), queueToUse(NULL), ipcStore(NULL), commandCount(0), lastTarget(0) {} : owner(setOwner), queueToUse(nullptr), ipcStore(nullptr), commandCount(0), lastTarget(0) {}
CommandActionHelper::~CommandActionHelper() {} CommandActionHelper::~CommandActionHelper() = default;
ReturnValue_t CommandActionHelper::commandAction(object_id_t commandTo, ActionId_t actionId, ReturnValue_t CommandActionHelper::commandAction(object_id_t commandTo, ActionId_t actionId,
SerializeIF *data) { SerializeIF *data) {
HasActionsIF *receiver = ObjectManager::instance()->get<HasActionsIF>(commandTo); auto *receiver = ObjectManager::instance()->get<HasActionsIF>(commandTo);
if (receiver == NULL) { if (receiver == nullptr) {
return CommandsActionsIF::OBJECT_HAS_NO_FUNCTIONS; return CommandsActionsIF::OBJECT_HAS_NO_FUNCTIONS;
} }
store_address_t storeId; store_address_t storeId;
@ -29,11 +29,8 @@ ReturnValue_t CommandActionHelper::commandAction(object_id_t commandTo, ActionId
ReturnValue_t CommandActionHelper::commandAction(object_id_t commandTo, ActionId_t actionId, ReturnValue_t CommandActionHelper::commandAction(object_id_t commandTo, ActionId_t actionId,
const uint8_t *data, uint32_t size) { const uint8_t *data, uint32_t size) {
// if (commandCount != 0) { auto *receiver = ObjectManager::instance()->get<HasActionsIF>(commandTo);
// return CommandsFunctionsIF::ALREADY_COMMANDING; if (receiver == nullptr) {
// }
HasActionsIF *receiver = ObjectManager::instance()->get<HasActionsIF>(commandTo);
if (receiver == NULL) {
return CommandsActionsIF::OBJECT_HAS_NO_FUNCTIONS; return CommandsActionsIF::OBJECT_HAS_NO_FUNCTIONS;
} }
store_address_t storeId; store_address_t storeId;
@ -59,12 +56,12 @@ ReturnValue_t CommandActionHelper::sendCommand(MessageQueueId_t queueId, ActionI
ReturnValue_t CommandActionHelper::initialize() { ReturnValue_t CommandActionHelper::initialize() {
ipcStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE); ipcStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE);
if (ipcStore == NULL) { if (ipcStore == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
queueToUse = owner->getCommandQueuePtr(); queueToUse = owner->getCommandQueuePtr();
if (queueToUse == NULL) { if (queueToUse == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
@ -104,7 +101,7 @@ ReturnValue_t CommandActionHelper::handleReply(CommandMessage *reply) {
uint8_t CommandActionHelper::getCommandCount() const { return commandCount; } uint8_t CommandActionHelper::getCommandCount() const { return commandCount; }
void CommandActionHelper::extractDataForOwner(ActionId_t actionId, store_address_t storeId) { void CommandActionHelper::extractDataForOwner(ActionId_t actionId, store_address_t storeId) {
const uint8_t *data = NULL; const uint8_t *data = nullptr;
size_t size = 0; size_t size = 0;
ReturnValue_t result = ipcStore->getData(storeId, &data, &size); ReturnValue_t result = ipcStore->getData(storeId, &data, &size);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {

@ -14,14 +14,14 @@ class CommandActionHelper {
friend class CommandsActionsIF; friend class CommandsActionsIF;
public: public:
CommandActionHelper(CommandsActionsIF* owner); explicit CommandActionHelper(CommandsActionsIF* owner);
virtual ~CommandActionHelper(); virtual ~CommandActionHelper();
ReturnValue_t commandAction(object_id_t commandTo, ActionId_t actionId, const uint8_t* data, ReturnValue_t commandAction(object_id_t commandTo, ActionId_t actionId, const uint8_t* data,
uint32_t size); uint32_t size);
ReturnValue_t commandAction(object_id_t commandTo, ActionId_t actionId, SerializeIF* data); ReturnValue_t commandAction(object_id_t commandTo, ActionId_t actionId, SerializeIF* data);
ReturnValue_t initialize(); ReturnValue_t initialize();
ReturnValue_t handleReply(CommandMessage* reply); ReturnValue_t handleReply(CommandMessage* reply);
uint8_t getCommandCount() const; [[nodiscard]] uint8_t getCommandCount() const;
private: private:
CommandsActionsIF* owner; CommandsActionsIF* owner;

@ -1,9 +1,9 @@
#ifndef FSFW_ACTION_COMMANDSACTIONSIF_H_ #ifndef FSFW_ACTION_COMMANDSACTIONSIF_H_
#define FSFW_ACTION_COMMANDSACTIONSIF_H_ #define FSFW_ACTION_COMMANDSACTIONSIF_H_
#include "../ipc/MessageQueueIF.h"
#include "../returnvalues/HasReturnvaluesIF.h"
#include "CommandActionHelper.h" #include "CommandActionHelper.h"
#include "fsfw/ipc/MessageQueueIF.h"
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
/** /**
* Interface to separate commanding actions of other objects. * Interface to separate commanding actions of other objects.
@ -21,7 +21,7 @@ class CommandsActionsIF {
static const uint8_t INTERFACE_ID = CLASS_ID::COMMANDS_ACTIONS_IF; static const uint8_t INTERFACE_ID = CLASS_ID::COMMANDS_ACTIONS_IF;
static const ReturnValue_t OBJECT_HAS_NO_FUNCTIONS = MAKE_RETURN_CODE(1); static const ReturnValue_t OBJECT_HAS_NO_FUNCTIONS = MAKE_RETURN_CODE(1);
static const ReturnValue_t ALREADY_COMMANDING = MAKE_RETURN_CODE(2); static const ReturnValue_t ALREADY_COMMANDING = MAKE_RETURN_CODE(2);
virtual ~CommandsActionsIF() {} virtual ~CommandsActionsIF() = default;
virtual MessageQueueIF* getCommandQueuePtr() = 0; virtual MessageQueueIF* getCommandQueuePtr() = 0;
protected: protected:

@ -1,11 +1,11 @@
#ifndef FSFW_ACTION_HASACTIONSIF_H_ #ifndef FSFW_ACTION_HASACTIONSIF_H_
#define FSFW_ACTION_HASACTIONSIF_H_ #define FSFW_ACTION_HASACTIONSIF_H_
#include "../ipc/MessageQueueIF.h"
#include "../returnvalues/HasReturnvaluesIF.h"
#include "ActionHelper.h" #include "ActionHelper.h"
#include "ActionMessage.h" #include "ActionMessage.h"
#include "SimpleActionHelper.h" #include "SimpleActionHelper.h"
#include "fsfw/ipc/MessageQueueIF.h"
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
/** /**
* @brief * @brief
@ -40,12 +40,12 @@ class HasActionsIF {
static const ReturnValue_t INVALID_PARAMETERS = MAKE_RETURN_CODE(2); static const ReturnValue_t INVALID_PARAMETERS = MAKE_RETURN_CODE(2);
static const ReturnValue_t EXECUTION_FINISHED = MAKE_RETURN_CODE(3); static const ReturnValue_t EXECUTION_FINISHED = MAKE_RETURN_CODE(3);
static const ReturnValue_t INVALID_ACTION_ID = MAKE_RETURN_CODE(4); static const ReturnValue_t INVALID_ACTION_ID = MAKE_RETURN_CODE(4);
virtual ~HasActionsIF() {} virtual ~HasActionsIF() = default;
/** /**
* Function to get the MessageQueueId_t of the implementing object * Function to get the MessageQueueId_t of the implementing object
* @return MessageQueueId_t of the object * @return MessageQueueId_t of the object
*/ */
virtual MessageQueueId_t getCommandQueue() const = 0; [[nodiscard]] virtual MessageQueueId_t getCommandQueue() const = 0;
/** /**
* Execute or initialize the execution of a certain function. * Execute or initialize the execution of a certain function.
* The ActionHelpers will execute this function and behave differently * The ActionHelpers will execute this function and behave differently

@ -3,7 +3,7 @@
SimpleActionHelper::SimpleActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue) SimpleActionHelper::SimpleActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue)
: ActionHelper(setOwner, useThisQueue), isExecuting(false) {} : ActionHelper(setOwner, useThisQueue), isExecuting(false) {}
SimpleActionHelper::~SimpleActionHelper() {} SimpleActionHelper::~SimpleActionHelper() = default;
void SimpleActionHelper::step(ReturnValue_t result) { void SimpleActionHelper::step(ReturnValue_t result) {
// STEP_OFFESET is subtracted to compensate for adding offset in base // STEP_OFFESET is subtracted to compensate for adding offset in base
@ -38,7 +38,7 @@ void SimpleActionHelper::prepareExecution(MessageQueueId_t commandedBy, ActionId
ActionMessage::setStepReply(&reply, actionId, 0, HasActionsIF::IS_BUSY); ActionMessage::setStepReply(&reply, actionId, 0, HasActionsIF::IS_BUSY);
queueToUse->sendMessage(commandedBy, &reply); queueToUse->sendMessage(commandedBy, &reply);
} }
const uint8_t* dataPtr = NULL; const uint8_t* dataPtr = nullptr;
size_t size = 0; size_t size = 0;
ReturnValue_t result = ipcStore->getData(dataAddress, &dataPtr, &size); ReturnValue_t result = ipcStore->getData(dataAddress, &dataPtr, &size);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {

@ -11,15 +11,15 @@
class SimpleActionHelper : public ActionHelper { class SimpleActionHelper : public ActionHelper {
public: public:
SimpleActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue); SimpleActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue);
virtual ~SimpleActionHelper(); ~SimpleActionHelper() override;
void step(ReturnValue_t result = HasReturnvaluesIF::RETURN_OK); void step(ReturnValue_t result = HasReturnvaluesIF::RETURN_OK);
void finish(ReturnValue_t result = HasReturnvaluesIF::RETURN_OK); void finish(ReturnValue_t result = HasReturnvaluesIF::RETURN_OK);
ReturnValue_t reportData(SerializeIF* data); ReturnValue_t reportData(SerializeIF* data);
protected: protected:
void prepareExecution(MessageQueueId_t commandedBy, ActionId_t actionId, void prepareExecution(MessageQueueId_t commandedBy, ActionId_t actionId,
store_address_t dataAddress); store_address_t dataAddress) override;
virtual void resetHelper(); void resetHelper() override;
private: private:
bool isExecuting; bool isExecuting;
@ -28,4 +28,4 @@ class SimpleActionHelper : public ActionHelper {
uint8_t stepCount = 0; uint8_t stepCount = 0;
}; };
#endif /* SIMPLEACTIONHELPER_H_ */ #endif /* FSFW_ACTION_SIMPLEACTIONHELPER_H_ */

@ -13,10 +13,12 @@ AckInfo::AckInfo(cfdp::FileDirectives ackedDirective, cfdp::ConditionCode ackedC
} }
} }
AckInfo::AckInfo() = default;
cfdp::ConditionCode AckInfo::getAckedConditionCode() const { return ackedConditionCode; } cfdp::ConditionCode AckInfo::getAckedConditionCode() const { return ackedConditionCode; }
void AckInfo::setAckedConditionCode(cfdp::ConditionCode ackedConditionCode) { void AckInfo::setAckedConditionCode(cfdp::ConditionCode ackedConditionCode_) {
this->ackedConditionCode = ackedConditionCode; ackedConditionCode = ackedConditionCode_;
if (ackedDirective == cfdp::FileDirectives::FINISH) { if (ackedDirective == cfdp::FileDirectives::FINISH) {
this->directiveSubtypeCode = 0b0001; this->directiveSubtypeCode = 0b0001;
} else { } else {
@ -26,20 +28,18 @@ void AckInfo::setAckedConditionCode(cfdp::ConditionCode ackedConditionCode) {
cfdp::FileDirectives AckInfo::getAckedDirective() const { return ackedDirective; } cfdp::FileDirectives AckInfo::getAckedDirective() const { return ackedDirective; }
void AckInfo::setAckedDirective(cfdp::FileDirectives ackedDirective) { void AckInfo::setAckedDirective(cfdp::FileDirectives ackedDirective_) {
this->ackedDirective = ackedDirective; ackedDirective = ackedDirective_;
} }
uint8_t AckInfo::getDirectiveSubtypeCode() const { return directiveSubtypeCode; } uint8_t AckInfo::getDirectiveSubtypeCode() const { return directiveSubtypeCode; }
void AckInfo::setDirectiveSubtypeCode(uint8_t directiveSubtypeCode) { void AckInfo::setDirectiveSubtypeCode(uint8_t directiveSubtypeCode_) {
this->directiveSubtypeCode = directiveSubtypeCode; directiveSubtypeCode = directiveSubtypeCode_;
} }
cfdp::AckTransactionStatus AckInfo::getTransactionStatus() const { return transactionStatus; } cfdp::AckTransactionStatus AckInfo::getTransactionStatus() const { return transactionStatus; }
AckInfo::AckInfo() {} void AckInfo::setTransactionStatus(cfdp::AckTransactionStatus transactionStatus_) {
transactionStatus = transactionStatus_;
void AckInfo::setTransactionStatus(cfdp::AckTransactionStatus transactionStatus) {
this->transactionStatus = transactionStatus;
} }

@ -9,16 +9,16 @@ class AckInfo {
AckInfo(cfdp::FileDirectives ackedDirective, cfdp::ConditionCode ackedConditionCode, AckInfo(cfdp::FileDirectives ackedDirective, cfdp::ConditionCode ackedConditionCode,
cfdp::AckTransactionStatus transactionStatus, uint8_t directiveSubtypeCode = 0); cfdp::AckTransactionStatus transactionStatus, uint8_t directiveSubtypeCode = 0);
cfdp::ConditionCode getAckedConditionCode() const; [[nodiscard]] cfdp::ConditionCode getAckedConditionCode() const;
void setAckedConditionCode(cfdp::ConditionCode ackedConditionCode); void setAckedConditionCode(cfdp::ConditionCode ackedConditionCode_);
cfdp::FileDirectives getAckedDirective() const; [[nodiscard]] cfdp::FileDirectives getAckedDirective() const;
void setAckedDirective(cfdp::FileDirectives ackedDirective); void setAckedDirective(cfdp::FileDirectives ackedDirective);
uint8_t getDirectiveSubtypeCode() const; [[nodiscard]] uint8_t getDirectiveSubtypeCode() const;
void setDirectiveSubtypeCode(uint8_t directiveSubtypeCode); void setDirectiveSubtypeCode(uint8_t directiveSubtypeCode);
cfdp::AckTransactionStatus getTransactionStatus() const; [[nodiscard]] cfdp::AckTransactionStatus getTransactionStatus() const;
void setTransactionStatus(cfdp::AckTransactionStatus transactionStatus); void setTransactionStatus(cfdp::AckTransactionStatus transactionStatus);
private: private:

@ -13,7 +13,7 @@ class AckPduDeserializer : public FileDirectiveDeserializer {
* @return * @return
* - cfdp::INVALID_DIRECTIVE_FIELDS: Invalid fields * - cfdp::INVALID_DIRECTIVE_FIELDS: Invalid fields
*/ */
ReturnValue_t parseData(); ReturnValue_t parseData() override;
private: private:
bool checkAndSetCodes(uint8_t rawAckedByte, uint8_t rawAckedConditionCode); bool checkAndSetCodes(uint8_t rawAckedByte, uint8_t rawAckedConditionCode);

@ -18,7 +18,7 @@ class AckPduSerializer : public FileDirectiveSerializer {
*/ */
AckPduSerializer(AckInfo& ackInfo, PduConfig& pduConf); AckPduSerializer(AckInfo& ackInfo, PduConfig& pduConf);
size_t getSerializedSize() const override; [[nodiscard]] size_t getSerializedSize() const override;
ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize, ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize,
Endianness streamEndianness) const override; Endianness streamEndianness) const override;

@ -26,7 +26,7 @@ ReturnValue_t ControllerBase::initialize() {
MessageQueueId_t parentQueue = 0; MessageQueueId_t parentQueue = 0;
if (parentId != objects::NO_OBJECT) { if (parentId != objects::NO_OBJECT) {
SubsystemBase* parent = ObjectManager::instance()->get<SubsystemBase>(parentId); auto* parent = ObjectManager::instance()->get<SubsystemBase>(parentId);
if (parent == nullptr) { if (parent == nullptr) {
return RETURN_FAILED; return RETURN_FAILED;
} }
@ -52,7 +52,7 @@ MessageQueueId_t ControllerBase::getCommandQueue() const { return commandQueue->
void ControllerBase::handleQueue() { void ControllerBase::handleQueue() {
CommandMessage command; CommandMessage command;
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; ReturnValue_t result;
for (result = commandQueue->receiveMessage(&command); result == RETURN_OK; for (result = commandQueue->receiveMessage(&command); result == RETURN_OK;
result = commandQueue->receiveMessage(&command)) { result = commandQueue->receiveMessage(&command)) {
result = modeHelper.handleModeCommand(&command); result = modeHelper.handleModeCommand(&command);
@ -73,20 +73,20 @@ void ControllerBase::handleQueue() {
} }
} }
void ControllerBase::startTransition(Mode_t mode, Submode_t submode) { void ControllerBase::startTransition(Mode_t mode_, Submode_t submode_) {
changeHK(this->mode, this->submode, false); changeHK(this->mode, this->submode, false);
triggerEvent(CHANGING_MODE, mode, submode); triggerEvent(CHANGING_MODE, mode, submode);
this->mode = mode; mode = mode_;
this->submode = submode; submode = submode_;
modeHelper.modeChanged(mode, submode); modeHelper.modeChanged(mode, submode);
modeChanged(mode, submode); modeChanged(mode, submode);
announceMode(false); announceMode(false);
changeHK(this->mode, this->submode, true); changeHK(this->mode, this->submode, true);
} }
void ControllerBase::getMode(Mode_t* mode, Submode_t* submode) { void ControllerBase::getMode(Mode_t* mode_, Submode_t* submode_) {
*mode = this->mode; *mode_ = this->mode;
*submode = this->submode; *submode_ = this->submode;
} }
void ControllerBase::setToExternalControl() { healthHelper.setHealth(EXTERNAL_CONTROL); } void ControllerBase::setToExternalControl() { healthHelper.setHealth(EXTERNAL_CONTROL); }
@ -99,7 +99,7 @@ ReturnValue_t ControllerBase::performOperation(uint8_t opCode) {
return RETURN_OK; return RETURN_OK;
} }
void ControllerBase::modeChanged(Mode_t mode, Submode_t submode) { return; } void ControllerBase::modeChanged(Mode_t mode_, Submode_t submode_) {}
ReturnValue_t ControllerBase::setHealth(HealthState health) { ReturnValue_t ControllerBase::setHealth(HealthState health) {
switch (health) { switch (health) {
@ -115,6 +115,6 @@ ReturnValue_t ControllerBase::setHealth(HealthState health) {
HasHealthIF::HealthState ControllerBase::getHealth() { return healthHelper.getHealth(); } HasHealthIF::HealthState ControllerBase::getHealth() { return healthHelper.getHealth(); }
void ControllerBase::setTaskIF(PeriodicTaskIF* task_) { executingTask = task_; } void ControllerBase::setTaskIF(PeriodicTaskIF* task_) { executingTask = task_; }
void ControllerBase::changeHK(Mode_t mode, Submode_t submode, bool enable) {} void ControllerBase::changeHK(Mode_t mode_, Submode_t submode_, bool enable) {}
ReturnValue_t ControllerBase::initializeAfterTaskCreation() { return HasReturnvaluesIF::RETURN_OK; } ReturnValue_t ControllerBase::initializeAfterTaskCreation() { return HasReturnvaluesIF::RETURN_OK; }

@ -24,21 +24,21 @@ class ControllerBase : public HasModesIF,
static const Mode_t MODE_NORMAL = 2; static const Mode_t MODE_NORMAL = 2;
ControllerBase(object_id_t setObjectId, object_id_t parentId, size_t commandQueueDepth = 3); ControllerBase(object_id_t setObjectId, object_id_t parentId, size_t commandQueueDepth = 3);
virtual ~ControllerBase(); ~ControllerBase() override;
/** SystemObject override */ /** SystemObject override */
virtual ReturnValue_t initialize() override; ReturnValue_t initialize() override;
virtual MessageQueueId_t getCommandQueue() const override; [[nodiscard]] MessageQueueId_t getCommandQueue() const override;
/** HasHealthIF overrides */ /** HasHealthIF overrides */
virtual ReturnValue_t setHealth(HealthState health) override; ReturnValue_t setHealth(HealthState health) override;
virtual HasHealthIF::HealthState getHealth() override; HasHealthIF::HealthState getHealth() override;
/** ExecutableObjectIF overrides */ /** ExecutableObjectIF overrides */
virtual ReturnValue_t performOperation(uint8_t opCode) override; ReturnValue_t performOperation(uint8_t opCode) override;
virtual void setTaskIF(PeriodicTaskIF *task) override; void setTaskIF(PeriodicTaskIF *task) override;
virtual ReturnValue_t initializeAfterTaskCreation() override; ReturnValue_t initializeAfterTaskCreation() override;
protected: protected:
/** /**
@ -54,7 +54,7 @@ class ControllerBase : public HasModesIF,
*/ */
virtual void performControlOperation() = 0; virtual void performControlOperation() = 0;
virtual ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode, ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
uint32_t *msToReachTheMode) override = 0; uint32_t *msToReachTheMode) override = 0;
const object_id_t parentId; const object_id_t parentId;
@ -80,10 +80,10 @@ class ControllerBase : public HasModesIF,
/** Mode helpers */ /** Mode helpers */
virtual void modeChanged(Mode_t mode, Submode_t submode); virtual void modeChanged(Mode_t mode, Submode_t submode);
virtual void startTransition(Mode_t mode, Submode_t submode) override; void startTransition(Mode_t mode, Submode_t submode) override;
virtual void getMode(Mode_t *mode, Submode_t *submode) override; void getMode(Mode_t *mode, Submode_t *submode) override;
virtual void setToExternalControl() override; void setToExternalControl() override;
virtual void announceMode(bool recursive); void announceMode(bool recursive) override;
/** HK helpers */ /** HK helpers */
virtual void changeHK(Mode_t mode, Submode_t submode, bool enable); virtual void changeHK(Mode_t mode, Submode_t submode, bool enable);
}; };

@ -6,7 +6,7 @@ ExtendedControllerBase::ExtendedControllerBase(object_id_t objectId, object_id_t
poolManager(this, commandQueue), poolManager(this, commandQueue),
actionHelper(this, commandQueue) {} actionHelper(this, commandQueue) {}
ExtendedControllerBase::~ExtendedControllerBase() {} ExtendedControllerBase::~ExtendedControllerBase() = default;
ReturnValue_t ExtendedControllerBase::executeAction(ActionId_t actionId, ReturnValue_t ExtendedControllerBase::executeAction(ActionId_t actionId,
MessageQueueId_t commandedBy, MessageQueueId_t commandedBy,
@ -31,7 +31,7 @@ ReturnValue_t ExtendedControllerBase::handleCommandMessage(CommandMessage *messa
void ExtendedControllerBase::handleQueue() { void ExtendedControllerBase::handleQueue() {
CommandMessage command; CommandMessage command;
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; ReturnValue_t result;
for (result = commandQueue->receiveMessage(&command); result == RETURN_OK; for (result = commandQueue->receiveMessage(&command); result == RETURN_OK;
result = commandQueue->receiveMessage(&command)) { result = commandQueue->receiveMessage(&command)) {
result = actionHelper.handleActionMessage(&command); result = actionHelper.handleActionMessage(&command);

@ -18,16 +18,16 @@ class ExtendedControllerBase : public ControllerBase,
public HasLocalDataPoolIF { public HasLocalDataPoolIF {
public: public:
ExtendedControllerBase(object_id_t objectId, object_id_t parentId, size_t commandQueueDepth = 3); ExtendedControllerBase(object_id_t objectId, object_id_t parentId, size_t commandQueueDepth = 3);
virtual ~ExtendedControllerBase(); ~ExtendedControllerBase() override;
/* SystemObjectIF overrides */ /* SystemObjectIF overrides */
virtual ReturnValue_t initialize() override; ReturnValue_t initialize() override;
virtual MessageQueueId_t getCommandQueue() const override; [[nodiscard]] MessageQueueId_t getCommandQueue() const override;
/* ExecutableObjectIF overrides */ /* ExecutableObjectIF overrides */
virtual ReturnValue_t performOperation(uint8_t opCode) override; ReturnValue_t performOperation(uint8_t opCode) override;
virtual ReturnValue_t initializeAfterTaskCreation() override; ReturnValue_t initializeAfterTaskCreation() override;
protected: protected:
LocalDataPoolManager poolManager; LocalDataPoolManager poolManager;
@ -39,31 +39,31 @@ class ExtendedControllerBase : public ControllerBase,
* @param message * @param message
* @return * @return
*/ */
virtual ReturnValue_t handleCommandMessage(CommandMessage* message) = 0; ReturnValue_t handleCommandMessage(CommandMessage* message) override = 0;
/** /**
* Periodic helper from ControllerBase, implemented by child class. * Periodic helper from ControllerBase, implemented by child class.
*/ */
virtual void performControlOperation() = 0; void performControlOperation() override = 0;
/* Handle the four messages mentioned above */ /* Handle the four messages mentioned above */
void handleQueue() override; void handleQueue() override;
/* HasActionsIF overrides */ /* HasActionsIF overrides */
virtual ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy, ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
const uint8_t* data, size_t size) override; const uint8_t* data, size_t size) override;
/* HasLocalDatapoolIF overrides */ /* HasLocalDatapoolIF overrides */
virtual LocalDataPoolManager* getHkManagerHandle() override; LocalDataPoolManager* getHkManagerHandle() override;
virtual object_id_t getObjectId() const override; [[nodiscard]] object_id_t getObjectId() const override;
virtual uint32_t getPeriodicOperationFrequency() const override; [[nodiscard]] uint32_t getPeriodicOperationFrequency() const override;
virtual ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap, ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) override = 0; LocalDataPoolManager& poolManager) override = 0;
virtual LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override = 0; LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override = 0;
// Mode abstract functions // Mode abstract functions
virtual ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode, ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
uint32_t* msToReachTheMode) override = 0; uint32_t* msToReachTheMode) override = 0;
}; };

@ -30,7 +30,7 @@ class DataSetIF {
* @brief This is an empty virtual destructor, * @brief This is an empty virtual destructor,
* as it is proposed for C++ interfaces. * as it is proposed for C++ interfaces.
*/ */
virtual ~DataSetIF() {} virtual ~DataSetIF() = default;
/** /**
* @brief This operation provides a method to register local data pool * @brief This operation provides a method to register local data pool
@ -39,7 +39,7 @@ class DataSetIF {
*/ */
virtual ReturnValue_t registerVariable(PoolVariableIF* variable) = 0; virtual ReturnValue_t registerVariable(PoolVariableIF* variable) = 0;
virtual uint16_t getFillCount() const = 0; [[nodiscard]] virtual uint16_t getFillCount() const = 0;
}; };
#endif /* FSFW_DATAPOOL_DATASETIF_H_ */ #endif /* FSFW_DATAPOOL_DATASETIF_H_ */

@ -9,7 +9,7 @@ PoolDataSetBase::PoolDataSetBase(PoolVariableIF** registeredVariablesArray,
const size_t maxFillCount) const size_t maxFillCount)
: registeredVariables(registeredVariablesArray), maxFillCount(maxFillCount) {} : registeredVariables(registeredVariablesArray), maxFillCount(maxFillCount) {}
PoolDataSetBase::~PoolDataSetBase() {} PoolDataSetBase::~PoolDataSetBase() = default;
ReturnValue_t PoolDataSetBase::registerVariable(PoolVariableIF* variable) { ReturnValue_t PoolDataSetBase::registerVariable(PoolVariableIF* variable) {
if (registeredVariables == nullptr) { if (registeredVariables == nullptr) {

@ -64,7 +64,7 @@ class PoolDataSetBase : public PoolDataSetIF, public SerializeIF, public HasRetu
* - @c SET_WAS_ALREADY_READ if read() is called twice without calling * - @c SET_WAS_ALREADY_READ if read() is called twice without calling
* commit() in between * commit() in between
*/ */
virtual ReturnValue_t read(MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING, ReturnValue_t read(MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING,
uint32_t lockTimeout = 20) override; uint32_t lockTimeout = 20) override;
/** /**
* @brief The commit call initializes writing back the registered variables. * @brief The commit call initializes writing back the registered variables.
@ -84,7 +84,7 @@ class PoolDataSetBase : public PoolDataSetIF, public SerializeIF, public HasRetu
* - @c COMMITING_WITHOUT_READING if set was not read yet and * - @c COMMITING_WITHOUT_READING if set was not read yet and
* contains non write-only variables * contains non write-only variables
*/ */
virtual ReturnValue_t commit(MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING, ReturnValue_t commit(MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING,
uint32_t lockTimeout = 20) override; uint32_t lockTimeout = 20) override;
/** /**
@ -92,30 +92,29 @@ class PoolDataSetBase : public PoolDataSetIF, public SerializeIF, public HasRetu
* @param variable * @param variable
* @return * @return
*/ */
virtual ReturnValue_t registerVariable(PoolVariableIF* variable) override; ReturnValue_t registerVariable(PoolVariableIF* variable) override;
/** /**
* Provides the means to lock the underlying data structure to ensure * Provides the means to lock the underlying data structure to ensure
* thread-safety. Default implementation is empty * thread-safety. Default implementation is empty
* @return Always returns -@c RETURN_OK * @return Always returns -@c RETURN_OK
*/ */
virtual ReturnValue_t lockDataPool( ReturnValue_t lockDataPool(MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING,
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING,
uint32_t timeoutMs = 20) override; uint32_t timeoutMs = 20) override;
/** /**
* Provides the means to unlock the underlying data structure to ensure * Provides the means to unlock the underlying data structure to ensure
* thread-safety. Default implementation is empty * thread-safety. Default implementation is empty
* @return Always returns -@c RETURN_OK * @return Always returns -@c RETURN_OK
*/ */
virtual ReturnValue_t unlockDataPool() override; ReturnValue_t unlockDataPool() override;
virtual uint16_t getFillCount() const override; [[nodiscard]] uint16_t getFillCount() const override;
/* SerializeIF implementations */ /* SerializeIF implementations */
virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size, const size_t maxSize, ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize,
SerializeIF::Endianness streamEndianness) const override; SerializeIF::Endianness streamEndianness) const override;
virtual size_t getSerializedSize() const override; [[nodiscard]] size_t getSerializedSize() const override;
virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size, ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
SerializeIF::Endianness streamEndianness) override; SerializeIF::Endianness streamEndianness) override;
/** /**
@ -156,7 +155,7 @@ class PoolDataSetBase : public PoolDataSetIF, public SerializeIF, public HasRetu
const size_t maxFillCount = 0; const size_t maxFillCount = 0;
void setContainer(PoolVariableIF** variablesContainer); void setContainer(PoolVariableIF** variablesContainer);
PoolVariableIF** getContainer() const; [[nodiscard]] PoolVariableIF** getContainer() const;
private: private:
bool protectEveryReadCommitCall = false; bool protectEveryReadCommitCall = false;

@ -11,7 +11,7 @@ PoolEntry<T>::PoolEntry(std::initializer_list<T> initValue, bool setValid)
: length(static_cast<uint8_t>(initValue.size())), valid(setValid) { : length(static_cast<uint8_t>(initValue.size())), valid(setValid) {
this->address = new T[this->length]; this->address = new T[this->length];
if (initValue.size() == 0) { if (initValue.size() == 0) {
std::memset(this->address, 0, this->getByteSize()); std::memset(this->address, 0, PoolEntry<T>::getByteSize());
} else { } else {
std::copy(initValue.begin(), initValue.end(), this->address); std::copy(initValue.begin(), initValue.end(), this->address);
} }
@ -22,9 +22,9 @@ PoolEntry<T>::PoolEntry(T* initValue, uint8_t setLength, bool setValid)
: length(setLength), valid(setValid) { : length(setLength), valid(setValid) {
this->address = new T[this->length]; this->address = new T[this->length];
if (initValue != nullptr) { if (initValue != nullptr) {
std::memcpy(this->address, initValue, this->getByteSize()); std::memcpy(this->address, initValue, PoolEntry<T>::getByteSize());
} else { } else {
std::memset(this->address, 0, this->getByteSize()); std::memset(this->address, 0, PoolEntry<T>::getByteSize());
} }
} }
@ -62,7 +62,7 @@ bool PoolEntry<T>::getValid() {
template <typename T> template <typename T>
void PoolEntry<T>::print() { void PoolEntry<T>::print() {
const char* validString = nullptr; const char* validString;
if (valid) { if (valid) {
validString = "Valid"; validString = "Valid";
} else { } else {

@ -62,7 +62,7 @@ class PoolEntry : public PoolEntryIF {
* @param setValid * @param setValid
* Sets the initialization flag. It is invalid by default. * Sets the initialization flag. It is invalid by default.
*/ */
PoolEntry(T* initValue, uint8_t setLength = 1, bool setValid = false); explicit PoolEntry(T* initValue, uint8_t setLength = 1, bool setValid = false);
//! Explicitely deleted copy ctor, copying is not allowed. //! Explicitely deleted copy ctor, copying is not allowed.
PoolEntry(const PoolEntry&) = delete; PoolEntry(const PoolEntry&) = delete;
@ -77,7 +77,7 @@ class PoolEntry : public PoolEntryIF {
* PoolEntries shall never be copied, as a copy might delete the variable * PoolEntries shall never be copied, as a copy might delete the variable
* on the heap. * on the heap.
*/ */
~PoolEntry(); ~PoolEntry() override;
/** /**
* Return typed pointer to start of data. * Return typed pointer to start of data.
@ -91,32 +91,32 @@ class PoolEntry : public PoolEntryIF {
* For non-array pool entries return type size, for vector entries * For non-array pool entries return type size, for vector entries
* return type size times the number of entries. * return type size times the number of entries.
*/ */
uint8_t getSize(); uint8_t getSize() override;
/** /**
* @brief This operation returns the size in bytes. * @brief This operation returns the size in bytes.
* @details The size is calculated by sizeof(type) * array_size. * @details The size is calculated by sizeof(type) * array_size.
*/ */
uint16_t getByteSize(); uint16_t getByteSize() override;
/** /**
* @brief This operation returns a the address pointer casted to void*. * @brief This operation returns a the address pointer casted to void*.
*/ */
void* getRawData(); void* getRawData() override;
/** /**
* @brief This method allows to set the valid information * @brief This method allows to set the valid information
* of the pool entry. * of the pool entry.
*/ */
void setValid(bool isValid); void setValid(bool isValid) override;
/** /**
* @brief This method allows to get the valid information * @brief This method allows to get the valid information
* of the pool entry. * of the pool entry.
*/ */
bool getValid(); bool getValid() override;
/** /**
* @brief This is a debug method that prints all values and the valid * @brief This is a debug method that prints all values and the valid
* information to the screen. It prints all array entries in a row. * information to the screen. It prints all array entries in a row.
*/ */
void print(); void print() override;
Type getType(); Type getType() override;
private: private:
/** /**

@ -24,7 +24,7 @@ class PoolEntryIF {
* @brief This is an empty virtual destructor, * @brief This is an empty virtual destructor,
* as it is required for C++ interfaces. * as it is required for C++ interfaces.
*/ */
virtual ~PoolEntryIF() {} virtual ~PoolEntryIF() = default;
/** /**
* @brief getSize returns the array size of the entry. * @brief getSize returns the array size of the entry.
* A single variable parameter has size 1. * A single variable parameter has size 1.

@ -11,7 +11,7 @@
*/ */
class PoolReadGuard { class PoolReadGuard {
public: public:
PoolReadGuard(ReadCommitIF* readObject, explicit PoolReadGuard(ReadCommitIF* readObject,
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING, MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING,
uint32_t mutexTimeout = 20) uint32_t mutexTimeout = 20)
: readObject(readObject), mutexTimeout(mutexTimeout) { : readObject(readObject), mutexTimeout(mutexTimeout) {
@ -29,7 +29,7 @@ class PoolReadGuard {
} }
} }
ReturnValue_t getReadResult() const { return readResult; } [[nodiscard]] ReturnValue_t getReadResult() const { return readResult; }
/** /**
* @brief Can be used to suppress commit on destruction. * @brief Can be used to suppress commit on destruction.

@ -1,28 +0,0 @@
#ifndef FSFW_DATAPOOL_POOLVARLIST_H_
#define FSFW_DATAPOOL_POOLVARLIST_H_
#include "../datapool/PoolVariableIF.h"
#include "../datapoolglob/GlobalPoolVariable.h"
template <class T, uint8_t n_var>
class PoolVarList {
private:
GlobPoolVar<T> variables[n_var];
public:
PoolVarList(const uint32_t set_id[n_var], DataSetIF* dataSet,
PoolVariableIF::ReadWriteMode_t setReadWriteMode) {
// I really should have a look at the new init list c++ syntax.
if (dataSet == NULL) {
return;
}
for (uint8_t count = 0; count < n_var; count++) {
variables[count].dataPoolId = set_id[count];
variables[count].readWriteMode = setReadWriteMode;
dataSet->registerVariable(&variables[count]);
}
}
GlobPoolVar<T>& operator[](int i) { return variables[i]; }
};
#endif /* FSFW_DATAPOOL_POOLVARLIST_H_ */

@ -24,8 +24,8 @@ class PoolVariableIF : public SerializeIF, public ReadCommitIF {
static constexpr ReturnValue_t INVALID_READ_WRITE_MODE = MAKE_RETURN_CODE(0xA0); static constexpr ReturnValue_t INVALID_READ_WRITE_MODE = MAKE_RETURN_CODE(0xA0);
static constexpr ReturnValue_t INVALID_POOL_ENTRY = MAKE_RETURN_CODE(0xA1); static constexpr ReturnValue_t INVALID_POOL_ENTRY = MAKE_RETURN_CODE(0xA1);
static constexpr bool VALID = 1; static constexpr bool VALID = true;
static constexpr bool INVALID = 0; static constexpr bool INVALID = false;
static constexpr uint32_t NO_PARAMETER = 0xffffffff; static constexpr uint32_t NO_PARAMETER = 0xffffffff;
enum ReadWriteMode_t { VAR_READ, VAR_WRITE, VAR_READ_WRITE }; enum ReadWriteMode_t { VAR_READ, VAR_WRITE, VAR_READ_WRITE };
@ -34,23 +34,23 @@ class PoolVariableIF : public SerializeIF, public ReadCommitIF {
* @brief This is an empty virtual destructor, * @brief This is an empty virtual destructor,
* as it is proposed for C++ interfaces. * as it is proposed for C++ interfaces.
*/ */
virtual ~PoolVariableIF() {} ~PoolVariableIF() override = default;
/** /**
* @brief This method returns if the variable is write-only, * @brief This method returns if the variable is write-only,
* read-write or read-only. * read-write or read-only.
*/ */
virtual ReadWriteMode_t getReadWriteMode() const = 0; [[nodiscard]] virtual ReadWriteMode_t getReadWriteMode() const = 0;
virtual void setReadWriteMode(ReadWriteMode_t newMode) = 0; virtual void setReadWriteMode(ReadWriteMode_t newMode) = 0;
/** /**
* @brief This operation shall return the data pool id of the variable. * @brief This operation shall return the data pool id of the variable.
*/ */
virtual uint32_t getDataPoolId() const = 0; [[nodiscard]] virtual uint32_t getDataPoolId() const = 0;
/** /**
* @brief With this call, the valid information of the * @brief With this call, the valid information of the
* variable is returned. * variable is returned.
*/ */
virtual bool isValid() const = 0; [[nodiscard]] virtual bool isValid() const = 0;
/** /**
* @brief With this call, the valid information of the variable is set. * @brief With this call, the valid information of the variable is set.
*/ */

@ -12,7 +12,7 @@ class ReadCommitIF {
friend class ReadCommitIFAttorney; friend class ReadCommitIFAttorney;
public: public:
virtual ~ReadCommitIF() {} virtual ~ReadCommitIF() = default;
virtual ReturnValue_t read(MutexIF::TimeoutType timeoutType, uint32_t timeoutMs) = 0; virtual ReturnValue_t read(MutexIF::TimeoutType timeoutType, uint32_t timeoutMs) = 0;
virtual ReturnValue_t commit(MutexIF::TimeoutType timeoutType, uint32_t timeoutMs) = 0; virtual ReturnValue_t commit(MutexIF::TimeoutType timeoutType, uint32_t timeoutMs) = 0;

@ -5,7 +5,7 @@
class SharedDataSetIF { class SharedDataSetIF {
public: public:
virtual ~SharedDataSetIF(){}; virtual ~SharedDataSetIF() = default;
private: private:
virtual ReturnValue_t lockDataset(MutexIF::TimeoutType timeoutType, virtual ReturnValue_t lockDataset(MutexIF::TimeoutType timeoutType,

@ -9,7 +9,8 @@ class MutexIF;
*/ */
class AccessPoolManagerIF { class AccessPoolManagerIF {
public: public:
virtual ~AccessPoolManagerIF(){}; virtual ~AccessPoolManagerIF() = default;
;
virtual MutexIF* getLocalPoolMutex() = 0; virtual MutexIF* getLocalPoolMutex() = 0;

@ -44,14 +44,15 @@ class HasLocalDataPoolIF {
friend class HasLocalDpIFUserAttorney; friend class HasLocalDpIFUserAttorney;
public: public:
virtual ~HasLocalDataPoolIF(){}; virtual ~HasLocalDataPoolIF() = default;
;
static constexpr uint32_t INVALID_LPID = localpool::INVALID_LPID; static constexpr uint32_t INVALID_LPID = localpool::INVALID_LPID;
virtual object_id_t getObjectId() const = 0; [[nodiscard]] virtual object_id_t getObjectId() const = 0;
/** Command queue for housekeeping messages. */ /** Command queue for housekeeping messages. */
virtual MessageQueueId_t getCommandQueue() const = 0; [[nodiscard]] virtual MessageQueueId_t getCommandQueue() const = 0;
/** /**
* Is used by pool owner to initialize the pool map once * Is used by pool owner to initialize the pool map once
@ -66,7 +67,7 @@ class HasLocalDataPoolIF {
* usually be the period the pool owner performs its periodic operation. * usually be the period the pool owner performs its periodic operation.
* @return * @return
*/ */
virtual dur_millis_t getPeriodicOperationFrequency() const = 0; [[nodiscard]] virtual dur_millis_t getPeriodicOperationFrequency() const = 0;
/** /**
* @brief This function will be called by the manager if an update * @brief This function will be called by the manager if an update

@ -1,6 +1,5 @@
#include "fsfw/datapoollocal/LocalDataPoolManager.h" #include "fsfw/datapoollocal/LocalDataPoolManager.h"
#include <array>
#include <cmath> #include <cmath>
#include "fsfw/datapoollocal.h" #include "fsfw/datapoollocal.h"
@ -57,7 +56,7 @@ ReturnValue_t LocalDataPoolManager::initialize(MessageQueueIF* queueToUse) {
} }
if (defaultHkDestination != objects::NO_OBJECT) { if (defaultHkDestination != objects::NO_OBJECT) {
AcceptsHkPacketsIF* hkPacketReceiver = auto* hkPacketReceiver =
ObjectManager::instance()->get<AcceptsHkPacketsIF>(defaultHkDestination); ObjectManager::instance()->get<AcceptsHkPacketsIF>(defaultHkDestination);
if (hkPacketReceiver != nullptr) { if (hkPacketReceiver != nullptr) {
hkDestinationId = hkPacketReceiver->getHkQueue(); hkDestinationId = hkPacketReceiver->getHkQueue();
@ -209,9 +208,9 @@ ReturnValue_t LocalDataPoolManager::handleNotificationSnapshot(HkReceiver& recei
} }
/* Prepare and send update snapshot */ /* Prepare and send update snapshot */
timeval now; timeval now{};
Clock::getClock_timeval(&now); Clock::getClock_timeval(&now);
CCSDSTime::CDS_short cds; CCSDSTime::CDS_short cds{};
CCSDSTime::convertToCcsds(&cds, &now); CCSDSTime::convertToCcsds(&cds, &now);
HousekeepingSnapshot updatePacket( HousekeepingSnapshot updatePacket(
reinterpret_cast<uint8_t*>(&cds), sizeof(cds), reinterpret_cast<uint8_t*>(&cds), sizeof(cds),
@ -245,9 +244,9 @@ ReturnValue_t LocalDataPoolManager::handleNotificationSnapshot(HkReceiver& recei
} }
/* Prepare and send update snapshot */ /* Prepare and send update snapshot */
timeval now; timeval now{};
Clock::getClock_timeval(&now); Clock::getClock_timeval(&now);
CCSDSTime::CDS_short cds; CCSDSTime::CDS_short cds{};
CCSDSTime::convertToCcsds(&cds, &now); CCSDSTime::convertToCcsds(&cds, &now);
HousekeepingSnapshot updatePacket( HousekeepingSnapshot updatePacket(
reinterpret_cast<uint8_t*>(&cds), sizeof(cds), reinterpret_cast<uint8_t*>(&cds), sizeof(cds),
@ -339,8 +338,7 @@ ReturnValue_t LocalDataPoolManager::subscribeForPeriodicPacket(sid_t sid, bool e
float collectionInterval, float collectionInterval,
bool isDiagnostics, bool isDiagnostics,
object_id_t packetDestination) { object_id_t packetDestination) {
AcceptsHkPacketsIF* hkReceiverObject = auto* hkReceiverObject = ObjectManager::instance()->get<AcceptsHkPacketsIF>(packetDestination);
ObjectManager::instance()->get<AcceptsHkPacketsIF>(packetDestination);
if (hkReceiverObject == nullptr) { if (hkReceiverObject == nullptr) {
printWarningOrError(sif::OutputTypes::OUT_WARNING, "subscribeForPeriodicPacket", printWarningOrError(sif::OutputTypes::OUT_WARNING, "subscribeForPeriodicPacket",
QUEUE_OR_DESTINATION_INVALID); QUEUE_OR_DESTINATION_INVALID);
@ -368,8 +366,7 @@ ReturnValue_t LocalDataPoolManager::subscribeForPeriodicPacket(sid_t sid, bool e
ReturnValue_t LocalDataPoolManager::subscribeForUpdatePacket(sid_t sid, bool isDiagnostics, ReturnValue_t LocalDataPoolManager::subscribeForUpdatePacket(sid_t sid, bool isDiagnostics,
bool reportingEnabled, bool reportingEnabled,
object_id_t packetDestination) { object_id_t packetDestination) {
AcceptsHkPacketsIF* hkReceiverObject = auto* hkReceiverObject = ObjectManager::instance()->get<AcceptsHkPacketsIF>(packetDestination);
ObjectManager::instance()->get<AcceptsHkPacketsIF>(packetDestination);
if (hkReceiverObject == nullptr) { if (hkReceiverObject == nullptr) {
printWarningOrError(sif::OutputTypes::OUT_WARNING, "subscribeForPeriodicPacket", printWarningOrError(sif::OutputTypes::OUT_WARNING, "subscribeForPeriodicPacket",
QUEUE_OR_DESTINATION_INVALID); QUEUE_OR_DESTINATION_INVALID);
@ -696,9 +693,10 @@ void LocalDataPoolManager::performPeriodicHkGeneration(HkReceiver& receiver) {
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
/* Configuration error */ /* Configuration error */
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "LocalDataPoolManager::performHkOperation: HK generation failed." << std::endl; sif::warning << "LocalDataPoolManager::performPeriodicHkOperation: HK generation failed."
<< std::endl;
#else #else
sif::printWarning("LocalDataPoolManager::performHkOperation: HK generation failed.\n"); sif::printWarning("LocalDataPoolManager::performPeriodicHkOperation: HK generation failed.\n");
#endif #endif
} }
} }

@ -80,7 +80,7 @@ class LocalDataPoolManager : public ProvidesDataPoolSubscriptionIF, public Acces
*/ */
LocalDataPoolManager(HasLocalDataPoolIF* owner, MessageQueueIF* queueToUse, LocalDataPoolManager(HasLocalDataPoolIF* owner, MessageQueueIF* queueToUse,
bool appendValidityBuffer = true); bool appendValidityBuffer = true);
virtual ~LocalDataPoolManager(); ~LocalDataPoolManager() override;
/** /**
* Assigns the queue to use. Make sure to call this in the #initialize * Assigns the queue to use. Make sure to call this in the #initialize
@ -151,7 +151,7 @@ class LocalDataPoolManager : public ProvidesDataPoolSubscriptionIF, public Acces
* Otherwise, only an notification message is sent. * Otherwise, only an notification message is sent.
* @return * @return
*/ */
ReturnValue_t subscribeForSetUpdateMessage(const uint32_t setId, object_id_t destinationObject, ReturnValue_t subscribeForSetUpdateMessage(uint32_t setId, object_id_t destinationObject,
MessageQueueId_t targetQueueId, MessageQueueId_t targetQueueId,
bool generateSnapshot) override; bool generateSnapshot) override;
@ -169,7 +169,7 @@ class LocalDataPoolManager : public ProvidesDataPoolSubscriptionIF, public Acces
* Otherwise, only an notification message is sent. * Otherwise, only an notification message is sent.
* @return * @return
*/ */
ReturnValue_t subscribeForVariableUpdateMessage(const lp_id_t localPoolId, ReturnValue_t subscribeForVariableUpdateMessage(lp_id_t localPoolId,
object_id_t destinationObject, object_id_t destinationObject,
MessageQueueId_t targetQueueId, MessageQueueId_t targetQueueId,
bool generateSnapshot) override; bool generateSnapshot) override;
@ -252,7 +252,7 @@ class LocalDataPoolManager : public ProvidesDataPoolSubscriptionIF, public Acces
*/ */
void clearReceiversList(); void clearReceiversList();
object_id_t getCreatorObjectId() const; [[nodiscard]] object_id_t getCreatorObjectId() const;
/** /**
* Get the pointer to the mutex. Can be used to lock the data pool * Get the pointer to the mutex. Can be used to lock the data pool
@ -262,7 +262,7 @@ class LocalDataPoolManager : public ProvidesDataPoolSubscriptionIF, public Acces
*/ */
MutexIF* getMutexHandle(); MutexIF* getMutexHandle();
virtual LocalDataPoolManager* getPoolManagerHandle() override; LocalDataPoolManager* getPoolManagerHandle() override;
protected: protected:
/** Core data structure for the actual pool data */ /** Core data structure for the actual pool data */
@ -306,8 +306,8 @@ class LocalDataPoolManager : public ProvidesDataPoolSubscriptionIF, public Acces
struct HkUpdateResetHelper { struct HkUpdateResetHelper {
DataType dataType = DataType::DATA_SET; DataType dataType = DataType::DATA_SET;
DataId dataId; DataId dataId;
uint8_t updateCounter; uint8_t updateCounter{};
uint8_t currentUpdateCounter; uint8_t currentUpdateCounter{};
}; };
using HkUpdateResetList = std::vector<struct HkUpdateResetHelper>; using HkUpdateResetList = std::vector<struct HkUpdateResetHelper>;

@ -207,13 +207,11 @@ class DeviceHandlerBase : public DeviceHandlerIF,
Mode_t getTransitionSourceMode() const; Mode_t getTransitionSourceMode() const;
Submode_t getTransitionSourceSubMode() const; Submode_t getTransitionSourceSubMode() const;
virtual void getMode(Mode_t *mode, Submode_t *submode); void getMode(Mode_t *mode, Submode_t *submode) override;
HealthState getHealth(); HealthState getHealth() override;
ReturnValue_t setHealth(HealthState health); ReturnValue_t setHealth(HealthState health) override;
virtual ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId, ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId, ParameterWrapper *parameterWrapper,
ParameterWrapper *parameterWrapper, const ParameterWrapper *newValues, uint16_t startAtIndex) override;
const ParameterWrapper *newValues,
uint16_t startAtIndex) override;
protected: protected:
/** /**
@ -1042,11 +1040,9 @@ class DeviceHandlerBase : public DeviceHandlerIF,
bool isAwaitingReply(); bool isAwaitingReply();
void handleDeviceTM(SerializeIF *dataSet, DeviceCommandId_t replyId, bool forceDirectTm = false); void handleDeviceTM(SerializeIF *dataSet, DeviceCommandId_t replyId, bool forceDirectTm = false);
// void handleDeviceTM(uint8_t* data, size_t dataSize, DeviceCommandId_t replyId,
// bool forceDirectTm);
virtual ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode, ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
uint32_t *msToReachTheMode); uint32_t *msToReachTheMode) override;
virtual ReturnValue_t letChildHandleMessage(CommandMessage *message); virtual ReturnValue_t letChildHandleMessage(CommandMessage *message);
@ -1062,8 +1058,7 @@ class DeviceHandlerBase : public DeviceHandlerIF,
/** /**
* Same as triggerEvent, but for forwarding if object is used as proxy. * Same as triggerEvent, but for forwarding if object is used as proxy.
*/ */
virtual void forwardEvent(Event event, uint32_t parameter1 = 0, void forwardEvent(Event event, uint32_t parameter1 = 0, uint32_t parameter2 = 0) const override;
uint32_t parameter2 = 0) const override;
/** /**
* Checks if current mode is transitional mode. * Checks if current mode is transitional mode.

@ -36,7 +36,7 @@ class HasHealthIF {
12, 12,
severity::MEDIUM); //!< Recovery was completed. Not necessarily successful. No parameters. severity::MEDIUM); //!< Recovery was completed. Not necessarily successful. No parameters.
virtual ~HasHealthIF() {} virtual ~HasHealthIF() = default;
virtual MessageQueueId_t getCommandQueue() const = 0; virtual MessageQueueId_t getCommandQueue() const = 0;

@ -55,7 +55,7 @@ class HousekeepingSnapshot : public SerializeIF {
: timeStamp(timeStamp), timeStampSize(timeStampSize), updateData(dataSetPtr){}; : timeStamp(timeStamp), timeStampSize(timeStampSize), updateData(dataSetPtr){};
virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize, virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize,
Endianness streamEndianness) const { Endianness streamEndianness) const override {
if (timeStamp != nullptr) { if (timeStamp != nullptr) {
/* Endianness will always be MACHINE, so we can simply use memcpy /* Endianness will always be MACHINE, so we can simply use memcpy
here. */ here. */
@ -70,7 +70,7 @@ class HousekeepingSnapshot : public SerializeIF {
return updateData->serialize(buffer, size, maxSize, streamEndianness); return updateData->serialize(buffer, size, maxSize, streamEndianness);
} }
virtual size_t getSerializedSize() const { virtual size_t getSerializedSize() const override {
if (updateData == nullptr) { if (updateData == nullptr) {
return 0; return 0;
} }

@ -10,25 +10,25 @@ class MessageQueueBase : public MessageQueueIF {
virtual ~MessageQueueBase(); virtual ~MessageQueueBase();
// Default implementations for MessageQueueIF where possible // Default implementations for MessageQueueIF where possible
virtual MessageQueueId_t getLastPartner() const override; MessageQueueId_t getLastPartner() const override;
virtual MessageQueueId_t getId() const override; MessageQueueId_t getId() const override;
virtual MqArgs& getMqArgs() override; MqArgs& getMqArgs() override;
virtual void setDefaultDestination(MessageQueueId_t defaultDestination) override; void setDefaultDestination(MessageQueueId_t defaultDestination) override;
virtual MessageQueueId_t getDefaultDestination() const override; MessageQueueId_t getDefaultDestination() const override;
virtual bool isDefaultDestinationSet() const override; bool isDefaultDestinationSet() const override;
virtual ReturnValue_t sendMessage(MessageQueueId_t sendTo, MessageQueueMessageIF* message, ReturnValue_t sendMessage(MessageQueueId_t sendTo, MessageQueueMessageIF* message,
bool ignoreFault) override; bool ignoreFault) override;
virtual ReturnValue_t sendToDefault(MessageQueueMessageIF* message) override; ReturnValue_t sendToDefault(MessageQueueMessageIF* message) override;
virtual ReturnValue_t reply(MessageQueueMessageIF* message) override; ReturnValue_t reply(MessageQueueMessageIF* message) override;
virtual ReturnValue_t receiveMessage(MessageQueueMessageIF* message, ReturnValue_t receiveMessage(MessageQueueMessageIF* message,
MessageQueueId_t* receivedFrom) override; MessageQueueId_t* receivedFrom) override;
virtual ReturnValue_t sendToDefaultFrom(MessageQueueMessageIF* message, MessageQueueId_t sentFrom, ReturnValue_t sendToDefaultFrom(MessageQueueMessageIF* message, MessageQueueId_t sentFrom,
bool ignoreFault = false) override; bool ignoreFault = false) override;
// OSAL specific, forward the abstract function // OSAL specific, forward the abstract function
virtual ReturnValue_t receiveMessage(MessageQueueMessageIF* message) = 0; ReturnValue_t receiveMessage(MessageQueueMessageIF* message) override = 0;
virtual ReturnValue_t sendMessageFrom(MessageQueueId_t sendTo, MessageQueueMessageIF* message, ReturnValue_t sendMessageFrom(MessageQueueId_t sendTo, MessageQueueMessageIF* message,
MessageQueueId_t sentFrom, bool ignoreFault = false) = 0; MessageQueueId_t sentFrom, bool ignoreFault = false) override = 0;
protected: protected:
MessageQueueId_t id = MessageQueueIF::NO_QUEUE; MessageQueueId_t id = MessageQueueIF::NO_QUEUE;

@ -17,8 +17,8 @@ class AbsLimitMonitor : public MonitorBase<T> {
limit(limit), limit(limit),
violationEvent(violationEvent), violationEvent(violationEvent),
aboveIsViolation(aboveIsViolation) {} aboveIsViolation(aboveIsViolation) {}
virtual ~AbsLimitMonitor() {} virtual ~AbsLimitMonitor() = default;
virtual ReturnValue_t checkSample(T sample, T *crossedLimit) { ReturnValue_t checkSample(T sample, T *crossedLimit) override {
*crossedLimit = limit; *crossedLimit = limit;
if (aboveIsViolation) { if (aboveIsViolation) {
if ((std::abs(sample) > limit)) { if ((std::abs(sample) > limit)) {
@ -32,9 +32,9 @@ class AbsLimitMonitor : public MonitorBase<T> {
return HasReturnvaluesIF::RETURN_OK; // We're not out of range. return HasReturnvaluesIF::RETURN_OK; // We're not out of range.
} }
virtual ReturnValue_t getParameter(uint8_t domainId, uint16_t parameterId, ReturnValue_t getParameter(uint8_t domainId, uint8_t parameterId,
ParameterWrapper *parameterWrapper, ParameterWrapper *parameterWrapper, const ParameterWrapper *newValues,
const ParameterWrapper *newValues, uint16_t startAtIndex) { uint16_t startAtIndex) override {
ReturnValue_t result = this->MonitorBase<T>::getParameter( ReturnValue_t result = this->MonitorBase<T>::getParameter(
domainId, parameterId, parameterWrapper, newValues, startAtIndex); domainId, parameterId, parameterWrapper, newValues, startAtIndex);
// We'll reuse the DOMAIN_ID of MonitorReporter, // We'll reuse the DOMAIN_ID of MonitorReporter,
@ -61,7 +61,7 @@ class AbsLimitMonitor : public MonitorBase<T> {
void setLimit(T value) { limit = value; } void setLimit(T value) { limit = value; }
protected: protected:
void sendTransitionEvent(T currentValue, ReturnValue_t state) { void sendTransitionEvent(T currentValue, ReturnValue_t state) override {
switch (state) { switch (state) {
case MonitoringIF::OUT_OF_RANGE: case MonitoringIF::OUT_OF_RANGE:
EventManagerIF::triggerEvent(this->reportingId, violationEvent, this->globalPoolId.objectId, EventManagerIF::triggerEvent(this->reportingId, violationEvent, this->globalPoolId.objectId,

@ -51,9 +51,8 @@ class MonitorReporter : public HasParametersIF {
return state; return state;
} }
virtual ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId, ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId, ParameterWrapper *parameterWrapper,
ParameterWrapper *parameterWrapper, const ParameterWrapper *newValues, uint16_t startAtIndex) override {
const ParameterWrapper *newValues, uint16_t startAtIndex) {
if (domainId != monitorId) { if (domainId != monitorId) {
return INVALID_DOMAIN_ID; return INVALID_DOMAIN_ID;
} }

@ -1,27 +1,23 @@
#include "fsfw/osal/freertos/FixedTimeslotTask.h" #include "fsfw/osal/freertos/FixedTimeslotTask.h"
#include "fsfw/objectmanager/ObjectManager.h" #include "fsfw/serviceinterface.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
uint32_t FixedTimeslotTask::deadlineMissedCount = 0;
const size_t PeriodicTaskIF::MINIMUM_STACK_SIZE = configMINIMAL_STACK_SIZE; const size_t PeriodicTaskIF::MINIMUM_STACK_SIZE = configMINIMAL_STACK_SIZE;
FixedTimeslotTask::FixedTimeslotTask(TaskName name, TaskPriority setPriority, FixedTimeslotTask::FixedTimeslotTask(TaskName name, TaskPriority setPriority,
TaskStackSize setStack, TaskPeriod overallPeriod, TaskStackSize setStack, TaskPeriod period,
void (*setDeadlineMissedFunc)()) TaskDeadlineMissedFunction dlmFunc_)
: started(false), handle(nullptr), pst(overallPeriod * 1000) { : FixedTimeslotTaskBase(period, dlmFunc_), started(false), handle(nullptr) {
configSTACK_DEPTH_TYPE stackSize = setStack / sizeof(configSTACK_DEPTH_TYPE); configSTACK_DEPTH_TYPE stackSize = setStack / sizeof(configSTACK_DEPTH_TYPE);
xTaskCreate(taskEntryPoint, name, stackSize, this, setPriority, &handle); xTaskCreate(taskEntryPoint, name, stackSize, this, setPriority, &handle);
// All additional attributes are applied to the object.
this->deadlineMissedFunc = setDeadlineMissedFunc;
} }
FixedTimeslotTask::~FixedTimeslotTask() {} FixedTimeslotTask::~FixedTimeslotTask() = default;
void FixedTimeslotTask::taskEntryPoint(void* argument) { void FixedTimeslotTask::taskEntryPoint(void* argument) {
// The argument is re-interpreted as FixedTimeslotTask. The Task object is // The argument is re-interpreted as FixedTimeslotTask. The Task object is
// global, so it is found from any place. // global, so it is found from any place.
FixedTimeslotTask* originalTask(reinterpret_cast<FixedTimeslotTask*>(argument)); auto* originalTask(reinterpret_cast<FixedTimeslotTask*>(argument));
/* Task should not start until explicitly requested, /* Task should not start until explicitly requested,
* but in FreeRTOS, tasks start as soon as they are created if the scheduler * but in FreeRTOS, tasks start as soon as they are created if the scheduler
* is running but not if the scheduler is not running. * is running but not if the scheduler is not running.
@ -32,26 +28,18 @@ void FixedTimeslotTask::taskEntryPoint(void* argument) {
* can continue */ * can continue */
if (not originalTask->started) { if (not originalTask->started) {
vTaskSuspend(NULL); vTaskSuspend(nullptr);
} }
originalTask->taskFunctionality(); originalTask->taskFunctionality();
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::debug << "Polling task " << originalTask->handle << " returned from taskFunctionality." sif::debug << "Polling task " << originalTask->handle << " returned from taskFunctionality."
<< std::endl; << std::endl;
#else
sif::printDebug("Polling task returned from taskFunctionality\n");
#endif #endif
} }
void FixedTimeslotTask::missedDeadlineCounter() {
FixedTimeslotTask::deadlineMissedCount++;
if (FixedTimeslotTask::deadlineMissedCount % 10 == 0) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "PST missed " << FixedTimeslotTask::deadlineMissedCount << " deadlines."
<< std::endl;
#endif
}
}
ReturnValue_t FixedTimeslotTask::startTask() { ReturnValue_t FixedTimeslotTask::startTask() {
started = true; started = true;
@ -63,31 +51,12 @@ ReturnValue_t FixedTimeslotTask::startTask() {
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
ReturnValue_t FixedTimeslotTask::addSlot(object_id_t componentId, uint32_t slotTimeMs, [[noreturn]] void FixedTimeslotTask::taskFunctionality() {
int8_t executionStep) {
ExecutableObjectIF* handler = ObjectManager::instance()->get<ExecutableObjectIF>(componentId);
if (handler != nullptr) {
pst.addSlot(componentId, slotTimeMs, executionStep, handler, this);
return HasReturnvaluesIF::RETURN_OK;
}
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "Component " << std::hex << componentId << " not found, not adding it to pst"
<< std::endl;
#endif
return HasReturnvaluesIF::RETURN_FAILED;
}
uint32_t FixedTimeslotTask::getPeriodMs() const { return pst.getLengthMs(); }
ReturnValue_t FixedTimeslotTask::checkSequence() const { return pst.checkSequence(); }
void FixedTimeslotTask::taskFunctionality() {
// A local iterator for the Polling Sequence Table is created to find the // A local iterator for the Polling Sequence Table is created to find the
// start time for the first entry. // start time for the first entry.
auto slotListIter = pst.current; auto slotListIter = pollingSeqTable.current;
pst.intializeSequenceAfterTaskCreation(); pollingSeqTable.intializeSequenceAfterTaskCreation();
// The start time for the first entry is read. // The start time for the first entry is read.
uint32_t intervalMs = slotListIter->pollingTimeMs; uint32_t intervalMs = slotListIter->pollingTimeMs;
@ -108,10 +77,10 @@ void FixedTimeslotTask::taskFunctionality() {
/* Enter the loop that defines the task behavior. */ /* Enter the loop that defines the task behavior. */
for (;;) { for (;;) {
// The component for this slot is executed and the next one is chosen. // The component for this slot is executed and the next one is chosen.
this->pst.executeAndAdvance(); this->pollingSeqTable.executeAndAdvance();
if (not pst.slotFollowsImmediately()) { if (not pollingSeqTable.slotFollowsImmediately()) {
// Get the interval till execution of the next slot. // Get the interval till execution of the next slot.
intervalMs = this->pst.getIntervalToPreviousSlotMs(); intervalMs = this->pollingSeqTable.getIntervalToPreviousSlotMs();
interval = pdMS_TO_TICKS(intervalMs); interval = pdMS_TO_TICKS(intervalMs);
#if (tskKERNEL_VERSION_MAJOR == 10 && tskKERNEL_VERSION_MINOR >= 4) || tskKERNEL_VERSION_MAJOR > 10 #if (tskKERNEL_VERSION_MAJOR == 10 && tskKERNEL_VERSION_MINOR >= 4) || tskKERNEL_VERSION_MAJOR > 10
@ -132,8 +101,8 @@ void FixedTimeslotTask::taskFunctionality() {
} }
void FixedTimeslotTask::handleMissedDeadline() { void FixedTimeslotTask::handleMissedDeadline() {
if (deadlineMissedFunc != nullptr) { if (dlmFunc != nullptr) {
this->deadlineMissedFunc(); dlmFunc();
} }
} }

@ -4,11 +4,11 @@
#include "FreeRTOS.h" #include "FreeRTOS.h"
#include "FreeRTOSTaskIF.h" #include "FreeRTOSTaskIF.h"
#include "fsfw/tasks/FixedSlotSequence.h" #include "fsfw/tasks/FixedSlotSequence.h"
#include "fsfw/tasks/FixedTimeslotTaskIF.h" #include "fsfw/tasks/FixedTimeslotTaskBase.h"
#include "fsfw/tasks/Typedef.h" #include "fsfw/tasks/definitions.h"
#include "task.h" #include "task.h"
class FixedTimeslotTask : public FixedTimeslotTaskIF, public FreeRTOSTaskIF { class FixedTimeslotTask : public FixedTimeslotTaskBase, public FreeRTOSTaskIF {
public: public:
/** /**
* Keep in mind that you need to call before vTaskStartScheduler()! * Keep in mind that you need to call before vTaskStartScheduler()!
@ -23,7 +23,7 @@ class FixedTimeslotTask : public FixedTimeslotTaskIF, public FreeRTOSTaskIF {
* @return Pointer to the newly created task. * @return Pointer to the newly created task.
*/ */
FixedTimeslotTask(TaskName name, TaskPriority setPriority, TaskStackSize setStack, FixedTimeslotTask(TaskName name, TaskPriority setPriority, TaskStackSize setStack,
TaskPeriod overallPeriod, void (*setDeadlineMissedFunc)()); TaskPeriod overallPeriod, TaskDeadlineMissedFunction dlmFunc);
/** /**
* @brief The destructor of the class. * @brief The destructor of the class.
@ -32,26 +32,9 @@ class FixedTimeslotTask : public FixedTimeslotTaskIF, public FreeRTOSTaskIF {
* initialization for the PST and the device handlers. This is done by * initialization for the PST and the device handlers. This is done by
* calling the PST's destructor. * calling the PST's destructor.
*/ */
virtual ~FixedTimeslotTask(void); ~FixedTimeslotTask() override;
ReturnValue_t startTask(void); ReturnValue_t startTask() override;
/**
* This static function can be used as #deadlineMissedFunc.
* It counts missedDeadlines and prints the number of missed deadlines
* every 10th time.
*/
static void missedDeadlineCounter();
/**
* A helper variable to count missed deadlines.
*/
static uint32_t deadlineMissedCount;
ReturnValue_t addSlot(object_id_t componentId, uint32_t slotTimeMs,
int8_t executionStep) override;
uint32_t getPeriodMs() const override;
ReturnValue_t checkSequence() const override;
ReturnValue_t sleepFor(uint32_t ms) override; ReturnValue_t sleepFor(uint32_t ms) override;
@ -61,17 +44,6 @@ class FixedTimeslotTask : public FixedTimeslotTaskIF, public FreeRTOSTaskIF {
bool started; bool started;
TaskHandle_t handle; TaskHandle_t handle;
FixedSlotSequence pst;
/**
* @brief This attribute holds a function pointer that is executed when
* a deadline was missed.
* @details
* Another function may be announced to determine the actions to perform
* when a deadline was missed. Currently, only one function for missing
* any deadline is allowed. If not used, it shall be declared NULL.
*/
void (*deadlineMissedFunc)(void);
/** /**
* @brief This is the entry point for a new task. * @brief This is the entry point for a new task.
* @details * @details
@ -88,7 +60,7 @@ class FixedTimeslotTask : public FixedTimeslotTaskIF, public FreeRTOSTaskIF {
* It links the functionalities provided by FixedSlotSequence with the * It links the functionalities provided by FixedSlotSequence with the
* OS's System Calls to keep the timing of the periods. * OS's System Calls to keep the timing of the periods.
*/ */
void taskFunctionality(void); [[noreturn]] void taskFunctionality();
void handleMissedDeadline(); void handleMissedDeadline();
}; };

@ -6,11 +6,11 @@
class FreeRTOSTaskIF { class FreeRTOSTaskIF {
public: public:
virtual ~FreeRTOSTaskIF() {} virtual ~FreeRTOSTaskIF() = default;
virtual TaskHandle_t getTaskHandle() = 0; virtual TaskHandle_t getTaskHandle() = 0;
protected: protected:
bool checkMissedDeadline(const TickType_t xLastWakeTime, const TickType_t interval) { static bool checkMissedDeadline(const TickType_t xLastWakeTime, const TickType_t interval) {
/* Check whether deadline was missed while also taking overflows /* Check whether deadline was missed while also taking overflows
* into account. Drawing this on paper with a timeline helps to understand * into account. Drawing this on paper with a timeline helps to understand
* it. */ * it. */

@ -5,27 +5,28 @@
#include "fsfw/tasks/ExecutableObjectIF.h" #include "fsfw/tasks/ExecutableObjectIF.h"
PeriodicTask::PeriodicTask(const char* name, TaskPriority setPriority, TaskStackSize setStack, PeriodicTask::PeriodicTask(const char* name, TaskPriority setPriority, TaskStackSize setStack,
TaskPeriod setPeriod, TaskDeadlineMissedFunction deadlineMissedFunc) TaskPeriod setPeriod, TaskDeadlineMissedFunction dlmFunc_)
: started(false), handle(NULL), period(setPeriod), deadlineMissedFunc(deadlineMissedFunc) { : PeriodicTaskBase(setPeriod, dlmFunc_), started(false), handle(nullptr) {
configSTACK_DEPTH_TYPE stackSize = setStack / sizeof(configSTACK_DEPTH_TYPE); configSTACK_DEPTH_TYPE stackSize = setStack / sizeof(configSTACK_DEPTH_TYPE);
BaseType_t status = xTaskCreate(taskEntryPoint, name, stackSize, this, setPriority, &handle); BaseType_t status = xTaskCreate(taskEntryPoint, name, stackSize, this, setPriority, &handle);
if (status != pdPASS) { if (status != pdPASS) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::debug << "PeriodicTask Insufficient heap memory remaining. " sif::debug << "PeriodicTask::PeriodicTask Insufficient heap memory remaining. Status: "
"Status: "
<< status << std::endl; << status << std::endl;
#else
sif::printDebug("PeriodicTask::PeriodicTask: Insufficient heap memory remaining. Status: %d\n",
status);
#endif #endif
} }
} }
PeriodicTask::~PeriodicTask(void) {
// Do not delete objects, we were responsible for ptrs only. // Do not delete objects, we were responsible for ptrs only.
} PeriodicTask::~PeriodicTask() = default;
void PeriodicTask::taskEntryPoint(void* argument) { void PeriodicTask::taskEntryPoint(void* argument) {
// The argument is re-interpreted as PeriodicTask. The Task object is // The argument is re-interpreted as PeriodicTask. The Task object is
// global, so it is found from any place. // global, so it is found from any place.
PeriodicTask* originalTask(reinterpret_cast<PeriodicTask*>(argument)); auto* originalTask(reinterpret_cast<PeriodicTask*>(argument));
/* Task should not start until explicitly requested, /* Task should not start until explicitly requested,
* but in FreeRTOS, tasks start as soon as they are created if the scheduler * but in FreeRTOS, tasks start as soon as they are created if the scheduler
* is running but not if the scheduler is not running. * is running but not if the scheduler is not running.
@ -36,7 +37,7 @@ void PeriodicTask::taskEntryPoint(void* argument) {
* can continue */ * can continue */
if (not originalTask->started) { if (not originalTask->started) {
vTaskSuspend(NULL); vTaskSuspend(nullptr);
} }
originalTask->taskFunctionality(); originalTask->taskFunctionality();
@ -62,13 +63,11 @@ ReturnValue_t PeriodicTask::sleepFor(uint32_t ms) {
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
void PeriodicTask::taskFunctionality() { [[noreturn]] void PeriodicTask::taskFunctionality() {
TickType_t xLastWakeTime; TickType_t xLastWakeTime;
const TickType_t xPeriod = pdMS_TO_TICKS(this->period * 1000.); const TickType_t xPeriod = pdMS_TO_TICKS(this->period * 1000.);
for (auto const& object : objectList) { initObjsAfterTaskCreation();
object->initializeAfterTaskCreation();
}
/* The xLastWakeTime variable needs to be initialized with the current tick /* The xLastWakeTime variable needs to be initialized with the current tick
count. Note that this is the only time the variable is written to count. Note that this is the only time the variable is written to
@ -77,8 +76,8 @@ void PeriodicTask::taskFunctionality() {
xLastWakeTime = xTaskGetTickCount(); xLastWakeTime = xTaskGetTickCount();
/* Enter the loop that defines the task behavior. */ /* Enter the loop that defines the task behavior. */
for (;;) { for (;;) {
for (auto const& object : objectList) { for (auto const& objectPair : objectList) {
object->performOperation(); objectPair.first->performOperation(objectPair.second);
} }
#if (tskKERNEL_VERSION_MAJOR == 10 && tskKERNEL_VERSION_MINOR >= 4) || tskKERNEL_VERSION_MAJOR > 10 #if (tskKERNEL_VERSION_MAJOR == 10 && tskKERNEL_VERSION_MINOR >= 4) || tskKERNEL_VERSION_MAJOR > 10
@ -95,32 +94,10 @@ void PeriodicTask::taskFunctionality() {
} }
} }
ReturnValue_t PeriodicTask::addComponent(object_id_t object) {
ExecutableObjectIF* newObject = ObjectManager::instance()->get<ExecutableObjectIF>(object);
return addComponent(newObject);
}
ReturnValue_t PeriodicTask::addComponent(ExecutableObjectIF* object) {
if (object == nullptr) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "PeriodicTask::addComponent: Invalid object. Make sure"
"it implement ExecutableObjectIF"
<< std::endl;
#endif
return HasReturnvaluesIF::RETURN_FAILED;
}
objectList.push_back(object);
object->setTaskIF(this);
return HasReturnvaluesIF::RETURN_OK;
}
uint32_t PeriodicTask::getPeriodMs() const { return period * 1000; }
TaskHandle_t PeriodicTask::getTaskHandle() { return handle; } TaskHandle_t PeriodicTask::getTaskHandle() { return handle; }
void PeriodicTask::handleMissedDeadline() { void PeriodicTask::handleMissedDeadline() {
if (deadlineMissedFunc != nullptr) { if (dlmFunc != nullptr) {
this->deadlineMissedFunc(); dlmFunc();
} }
} }

@ -6,8 +6,8 @@
#include "FreeRTOS.h" #include "FreeRTOS.h"
#include "FreeRTOSTaskIF.h" #include "FreeRTOSTaskIF.h"
#include "fsfw/objectmanager/ObjectManagerIF.h" #include "fsfw/objectmanager/ObjectManagerIF.h"
#include "fsfw/tasks/PeriodicTaskIF.h" #include "fsfw/tasks/PeriodicTaskBase.h"
#include "fsfw/tasks/Typedef.h" #include "fsfw/tasks/definitions.h"
#include "task.h" #include "task.h"
class ExecutableObjectIF; class ExecutableObjectIF;
@ -17,7 +17,7 @@ class ExecutableObjectIF;
* periodic activities of multiple objects. * periodic activities of multiple objects.
* @ingroup task_handling * @ingroup task_handling
*/ */
class PeriodicTask : public PeriodicTaskIF, public FreeRTOSTaskIF { class PeriodicTask : public PeriodicTaskBase, public FreeRTOSTaskIF {
public: public:
/** /**
* Keep in Mind that you need to call before this vTaskStartScheduler()! * Keep in Mind that you need to call before this vTaskStartScheduler()!
@ -43,7 +43,7 @@ class PeriodicTask : public PeriodicTaskIF, public FreeRTOSTaskIF {
* @brief Currently, the executed object's lifetime is not coupled with * @brief Currently, the executed object's lifetime is not coupled with
* the task object's lifetime, so the destructor is empty. * the task object's lifetime, so the destructor is empty.
*/ */
virtual ~PeriodicTask(void); ~PeriodicTask() override;
/** /**
* @brief The method to start the task. * @brief The method to start the task.
@ -53,27 +53,6 @@ class PeriodicTask : public PeriodicTaskIF, public FreeRTOSTaskIF {
* to the system call. * to the system call.
*/ */
ReturnValue_t startTask() override; ReturnValue_t startTask() override;
/**
* Adds an object to the list of objects to be executed.
* The objects are executed in the order added.
* @param object Id of the object to add.
* @return
* -@c RETURN_OK on success
* -@c RETURN_FAILED if the object could not be added.
*/
ReturnValue_t addComponent(object_id_t object) override;
/**
* Adds an object to the list of objects to be executed.
* The objects are executed in the order added.
* @param object Id of the object to add.
* @return
* -@c RETURN_OK on success
* -@c RETURN_FAILED if the object could not be added.
*/
ReturnValue_t addComponent(ExecutableObjectIF* object) override;
uint32_t getPeriodMs() const override;
ReturnValue_t sleepFor(uint32_t ms) override; ReturnValue_t sleepFor(uint32_t ms) override;
@ -83,28 +62,6 @@ class PeriodicTask : public PeriodicTaskIF, public FreeRTOSTaskIF {
bool started; bool started;
TaskHandle_t handle; TaskHandle_t handle;
//! Typedef for the List of objects.
typedef std::vector<ExecutableObjectIF*> ObjectList;
/**
* @brief This attribute holds a list of objects to be executed.
*/
ObjectList objectList;
/**
* @brief The period of the task.
* @details
* The period determines the frequency of the task's execution.
* It is expressed in clock ticks.
*/
TaskPeriod period;
/**
* @brief The pointer to the deadline-missed function.
* @details
* This pointer stores the function that is executed if the task's deadline
* is missed so each may react individually on a timing failure.
* The pointer may be NULL, then nothing happens on missing the deadline.
* The deadline is equal to the next execution of the periodic task.
*/
void (*deadlineMissedFunc)(void);
/** /**
* @brief This is the function executed in the new task's context. * @brief This is the function executed in the new task's context.
* @details * @details
@ -125,7 +82,7 @@ class PeriodicTask : public PeriodicTaskIF, public FreeRTOSTaskIF {
* the next period. * the next period.
* On missing the deadline, the deadlineMissedFunction is executed. * On missing the deadline, the deadlineMissedFunction is executed.
*/ */
void taskFunctionality(void); [[noreturn]] void taskFunctionality();
void handleMissedDeadline(); void handleMissedDeadline();
}; };

@ -3,9 +3,7 @@
#include <chrono> #include <chrono>
#include <thread> #include <thread>
#include "fsfw/ipc/MutexFactory.h"
#include "fsfw/objectmanager/ObjectManager.h" #include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/osal/host/FixedTimeslotTask.h"
#include "fsfw/osal/host/Mutex.h" #include "fsfw/osal/host/Mutex.h"
#include "fsfw/osal/host/taskHelpers.h" #include "fsfw/osal/host/taskHelpers.h"
#include "fsfw/platform.h" #include "fsfw/platform.h"
@ -22,12 +20,8 @@
FixedTimeslotTask::FixedTimeslotTask(const char* name, TaskPriority setPriority, FixedTimeslotTask::FixedTimeslotTask(const char* name, TaskPriority setPriority,
TaskStackSize setStack, TaskPeriod setPeriod, TaskStackSize setStack, TaskPeriod setPeriod,
void (*setDeadlineMissedFunc)()) TaskDeadlineMissedFunction dlmFunc_)
: started(false), : FixedTimeslotTaskBase(setPeriod, dlmFunc_), started(false), taskName(name) {
pollingSeqTable(setPeriod * 1000),
taskName(name),
period(setPeriod),
deadlineMissedFunc(setDeadlineMissedFunc) {
// It is propably possible to set task priorities by using the native // It is propably possible to set task priorities by using the native
// task handles for Windows / Linux // task handles for Windows / Linux
mainThread = std::thread(&FixedTimeslotTask::taskEntryPoint, this, this); mainThread = std::thread(&FixedTimeslotTask::taskEntryPoint, this, this);
@ -39,7 +33,7 @@ FixedTimeslotTask::FixedTimeslotTask(const char* name, TaskPriority setPriority,
tasks::insertTaskName(mainThread.get_id(), taskName); tasks::insertTaskName(mainThread.get_id(), taskName);
} }
FixedTimeslotTask::~FixedTimeslotTask(void) { FixedTimeslotTask::~FixedTimeslotTask() {
// Do not delete objects, we were responsible for ptrs only. // Do not delete objects, we were responsible for ptrs only.
terminateThread = true; terminateThread = true;
if (mainThread.joinable()) { if (mainThread.joinable()) {
@ -48,7 +42,7 @@ FixedTimeslotTask::~FixedTimeslotTask(void) {
} }
void FixedTimeslotTask::taskEntryPoint(void* argument) { void FixedTimeslotTask::taskEntryPoint(void* argument) {
FixedTimeslotTask* originalTask(reinterpret_cast<FixedTimeslotTask*>(argument)); auto* originalTask(reinterpret_cast<FixedTimeslotTask*>(argument));
if (not originalTask->started) { if (not originalTask->started) {
// we have to suspend/block here until the task is started. // we have to suspend/block here until the task is started.
@ -81,7 +75,9 @@ ReturnValue_t FixedTimeslotTask::sleepFor(uint32_t ms) {
} }
void FixedTimeslotTask::taskFunctionality() { void FixedTimeslotTask::taskFunctionality() {
pollingSeqTable.intializeSequenceAfterTaskCreation(); ReturnValue_t result = pollingSeqTable.intializeSequenceAfterTaskCreation();
// Ignore returnvalue for now
static_cast<void>(result);
// A local iterator for the Polling Sequence Table is created to // A local iterator for the Polling Sequence Table is created to
// find the start time for the first entry. // find the start time for the first entry.
@ -106,37 +102,15 @@ void FixedTimeslotTask::taskFunctionality() {
// we need to wait before executing the current slot // we need to wait before executing the current slot
// this gives us the time to wait: // this gives us the time to wait:
interval = chron_ms(this->pollingSeqTable.getIntervalToPreviousSlotMs()); interval = chron_ms(this->pollingSeqTable.getIntervalToPreviousSlotMs());
delayForInterval(&currentStartTime, interval); if (not delayForInterval(&currentStartTime, interval)) {
// TODO deadline missed check if (dlmFunc != nullptr) {
dlmFunc();
} }
} }
} }
ReturnValue_t FixedTimeslotTask::addSlot(object_id_t componentId, uint32_t slotTimeMs,
int8_t executionStep) {
ExecutableObjectIF* 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;
} }
ReturnValue_t FixedTimeslotTask::checkSequence() const { return pollingSeqTable.checkSequence(); }
uint32_t FixedTimeslotTask::getPeriodMs() const { return period * 1000; }
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

@ -6,10 +6,10 @@
#include <thread> #include <thread>
#include <vector> #include <vector>
#include "../../objectmanager/ObjectManagerIF.h" #include "fsfw/objectmanager/ObjectManagerIF.h"
#include "../../tasks/FixedSlotSequence.h" #include "fsfw/tasks/FixedSlotSequence.h"
#include "../../tasks/FixedTimeslotTaskIF.h" #include "fsfw/tasks/FixedTimeslotTaskBase.h"
#include "../../tasks/Typedef.h" #include "fsfw/tasks/definitions.h"
class ExecutableObjectIF; class ExecutableObjectIF;
@ -19,7 +19,7 @@ class ExecutableObjectIF;
* @details * @details
* @ingroup task_handling * @ingroup task_handling
*/ */
class FixedTimeslotTask : public FixedTimeslotTaskIF { class FixedTimeslotTask : public FixedTimeslotTaskBase {
public: public:
/** /**
* @brief Standard constructor of the class. * @brief Standard constructor of the class.
@ -39,7 +39,7 @@ class FixedTimeslotTask : public FixedTimeslotTaskIF {
* @brief Currently, the executed object's lifetime is not coupled with * @brief Currently, the executed object's lifetime is not coupled with
* the task object's lifetime, so the destructor is empty. * the task object's lifetime, so the destructor is empty.
*/ */
virtual ~FixedTimeslotTask(void); ~FixedTimeslotTask() override;
/** /**
* @brief The method to start the task. * @brief The method to start the task.
@ -48,56 +48,22 @@ class FixedTimeslotTask : public FixedTimeslotTaskIF {
* The address of the task object is passed as an argument * The address of the task object is passed as an argument
* to the system call. * to the system call.
*/ */
ReturnValue_t startTask(void); ReturnValue_t startTask() override;
/** ReturnValue_t sleepFor(uint32_t ms) 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);
ReturnValue_t checkSequence() const override;
uint32_t getPeriodMs() const;
ReturnValue_t sleepFor(uint32_t ms);
protected: protected:
using chron_ms = std::chrono::milliseconds; using chron_ms = std::chrono::milliseconds;
bool started; bool started;
//!< Typedef for the List of objects.
typedef std::vector<ExecutableObjectIF*> ObjectList;
std::thread mainThread; std::thread mainThread;
std::atomic<bool> terminateThread{false}; std::atomic<bool> terminateThread{false};
//! Polling sequence table which contains the object to execute
//! and information like the timeslots and the passed execution step.
FixedSlotSequence pollingSeqTable;
std::condition_variable initCondition; std::condition_variable initCondition;
std::mutex initMutex; std::mutex initMutex;
std::string taskName; std::string taskName;
/**
* @brief The period of the task.
* @details
* The period determines the frequency of the task's execution.
* It is expressed in clock ticks.
*/
TaskPeriod period;
/**
* @brief The pointer to the deadline-missed function.
* @details
* This pointer stores the function that is executed if the task's deadline
* is missed. So, each may react individually on a timing failure.
* The pointer may be NULL, then nothing happens on missing the deadline.
* The deadline is equal to the next execution of the periodic task.
*/
void (*deadlineMissedFunc)(void);
/** /**
* @brief This is the function executed in the new task's context. * @brief This is the function executed in the new task's context.
* @details * @details
@ -117,9 +83,9 @@ class FixedTimeslotTask : public FixedTimeslotTaskIF {
* the checkAndRestartPeriod system call blocks the task until the next * the checkAndRestartPeriod system call blocks the task until the next
* period. On missing the deadline, the deadlineMissedFunction is executed. * period. On missing the deadline, the deadlineMissedFunction is executed.
*/ */
void taskFunctionality(void); void taskFunctionality();
bool delayForInterval(chron_ms* previousWakeTimeMs, const chron_ms interval); static bool delayForInterval(chron_ms* previousWakeTimeMs, chron_ms interval);
}; };
#endif /* FRAMEWORK_OSAL_HOST_FIXEDTIMESLOTTASK_H_ */ #endif /* FRAMEWORK_OSAL_HOST_FIXEDTIMESLOTTASK_H_ */

@ -3,13 +3,10 @@
#include <chrono> #include <chrono>
#include <thread> #include <thread>
#include "fsfw/ipc/MutexFactory.h"
#include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/osal/host/Mutex.h" #include "fsfw/osal/host/Mutex.h"
#include "fsfw/osal/host/taskHelpers.h" #include "fsfw/osal/host/taskHelpers.h"
#include "fsfw/platform.h" #include "fsfw/platform.h"
#include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface/ServiceInterface.h"
#include "fsfw/tasks/ExecutableObjectIF.h"
#if defined(PLATFORM_WIN) #if defined(PLATFORM_WIN)
#include <processthreadsapi.h> #include <processthreadsapi.h>
@ -20,8 +17,8 @@
#endif #endif
PeriodicTask::PeriodicTask(const char* name, TaskPriority setPriority, TaskStackSize setStack, PeriodicTask::PeriodicTask(const char* name, TaskPriority setPriority, TaskStackSize setStack,
TaskPeriod setPeriod, void (*setDeadlineMissedFunc)()) TaskPeriod setPeriod, TaskDeadlineMissedFunction dlmFunc_)
: started(false), taskName(name), period(setPeriod), deadlineMissedFunc(setDeadlineMissedFunc) { : PeriodicTaskBase(setPeriod, dlmFunc_), started(false), taskName(name) {
// It is probably possible to set task priorities by using the native // It is probably possible to set task priorities by using the native
// task handles for Windows / Linux // task handles for Windows / Linux
mainThread = std::thread(&PeriodicTask::taskEntryPoint, this, this); mainThread = std::thread(&PeriodicTask::taskEntryPoint, this, this);
@ -33,7 +30,7 @@ PeriodicTask::PeriodicTask(const char* name, TaskPriority setPriority, TaskStack
tasks::insertTaskName(mainThread.get_id(), taskName); tasks::insertTaskName(mainThread.get_id(), taskName);
} }
PeriodicTask::~PeriodicTask(void) { PeriodicTask::~PeriodicTask() {
// Do not delete objects, we were responsible for ptrs only. // Do not delete objects, we were responsible for ptrs only.
terminateThread = true; terminateThread = true;
if (mainThread.joinable()) { if (mainThread.joinable()) {
@ -42,7 +39,7 @@ PeriodicTask::~PeriodicTask(void) {
} }
void PeriodicTask::taskEntryPoint(void* argument) { void PeriodicTask::taskEntryPoint(void* argument) {
PeriodicTask* originalTask(reinterpret_cast<PeriodicTask*>(argument)); auto* originalTask(reinterpret_cast<PeriodicTask*>(argument));
if (not originalTask->started) { if (not originalTask->started) {
// we have to suspend/block here until the task is started. // we have to suspend/block here until the task is started.
@ -75,47 +72,27 @@ ReturnValue_t PeriodicTask::sleepFor(uint32_t ms) {
} }
void PeriodicTask::taskFunctionality() { void PeriodicTask::taskFunctionality() {
for (const auto& object : objectList) { initObjsAfterTaskCreation();
object->initializeAfterTaskCreation();
}
std::chrono::milliseconds periodChrono(static_cast<uint32_t>(period * 1000)); std::chrono::milliseconds periodChrono(static_cast<uint32_t>(period * 1000));
auto currentStartTime{std::chrono::duration_cast<std::chrono::milliseconds>( auto currentStartTime{std::chrono::duration_cast<std::chrono::milliseconds>(
std::chrono::system_clock::now().time_since_epoch())}; std::chrono::system_clock::now().time_since_epoch())};
auto nextStartTime{currentStartTime};
/* Enter the loop that defines the task behavior. */ /* Enter the loop that defines the task behavior. */
for (;;) { for (;;) {
if (terminateThread.load()) { if (terminateThread.load()) {
break; break;
} }
for (const auto& object : objectList) { for (const auto& objectPair : objectList) {
object->performOperation(); objectPair.first->performOperation(objectPair.second);
} }
if (not delayForInterval(&currentStartTime, periodChrono)) { if (not delayForInterval(&currentStartTime, periodChrono)) {
if (deadlineMissedFunc != nullptr) { if (dlmFunc != nullptr) {
this->deadlineMissedFunc(); this->dlmFunc();
} }
} }
} }
} }
ReturnValue_t PeriodicTask::addComponent(object_id_t object) {
ExecutableObjectIF* newObject = ObjectManager::instance()->get<ExecutableObjectIF>(object);
return addComponent(newObject);
}
ReturnValue_t PeriodicTask::addComponent(ExecutableObjectIF* object) {
if (object == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED;
}
object->setTaskIF(this);
objectList.push_back(object);
return HasReturnvaluesIF::RETURN_OK;
}
uint32_t PeriodicTask::getPeriodMs() const { return period * 1000; }
bool PeriodicTask::delayForInterval(chron_ms* previousWakeTimeMs, const chron_ms interval) { bool PeriodicTask::delayForInterval(chron_ms* previousWakeTimeMs, const chron_ms interval) {
bool shouldDelay = false; bool shouldDelay = false;
// Get current wakeup time // Get current wakeup time

@ -6,9 +6,9 @@
#include <thread> #include <thread>
#include <vector> #include <vector>
#include "../../objectmanager/ObjectManagerIF.h" #include "fsfw/objectmanager/ObjectManagerIF.h"
#include "../../tasks/PeriodicTaskIF.h" #include "fsfw/tasks/PeriodicTaskBase.h"
#include "../../tasks/Typedef.h" #include "fsfw/tasks/definitions.h"
class ExecutableObjectIF; class ExecutableObjectIF;
@ -19,7 +19,7 @@ class ExecutableObjectIF;
* *
* @ingroup task_handling * @ingroup task_handling
*/ */
class PeriodicTask : public PeriodicTaskIF { class PeriodicTask : public PeriodicTaskBase {
public: public:
/** /**
* @brief Standard constructor of the class. * @brief Standard constructor of the class.
@ -34,12 +34,12 @@ class PeriodicTask : public PeriodicTaskIF {
* assigned. * assigned.
*/ */
PeriodicTask(const char* name, TaskPriority setPriority, TaskStackSize setStack, PeriodicTask(const char* name, TaskPriority setPriority, TaskStackSize setStack,
TaskPeriod setPeriod, void (*setDeadlineMissedFunc)()); TaskPeriod setPeriod, TaskDeadlineMissedFunction dlmFunc);
/** /**
* @brief Currently, the executed object's lifetime is not coupled with * @brief Currently, the executed object's lifetime is not coupled with
* the task object's lifetime, so the destructor is empty. * the task object's lifetime, so the destructor is empty.
*/ */
virtual ~PeriodicTask(void); ~PeriodicTask() override;
/** /**
* @brief The method to start the task. * @brief The method to start the task.
@ -48,63 +48,20 @@ class PeriodicTask : public PeriodicTaskIF {
* The address of the task object is passed as an argument * The address of the task object is passed as an argument
* to the system call. * to the system call.
*/ */
ReturnValue_t startTask(void); ReturnValue_t startTask() override;
/**
* Adds an object to the list of objects to be executed.
* The objects are executed in the order added.
* @param object Id of the object to add.
* @return
* -@c RETURN_OK on success
* -@c RETURN_FAILED if the object could not be added.
*/
ReturnValue_t addComponent(object_id_t object);
/** ReturnValue_t sleepFor(uint32_t ms) override;
* Adds an object to the list of objects to be executed.
* The objects are executed in the order added.
* @param object pointer to the object to add.
* @return
* -@c RETURN_OK on success
* -@c RETURN_FAILED if the object could not be added.
*/
ReturnValue_t addComponent(ExecutableObjectIF* object);
uint32_t getPeriodMs() const;
ReturnValue_t sleepFor(uint32_t ms);
protected: protected:
using chron_ms = std::chrono::milliseconds; using chron_ms = std::chrono::milliseconds;
bool started; bool started;
//!< Typedef for the List of objects.
typedef std::vector<ExecutableObjectIF*> ObjectList;
std::thread mainThread; std::thread mainThread;
std::atomic<bool> terminateThread{false}; std::atomic<bool> terminateThread{false};
/**
* @brief This attribute holds a list of objects to be executed.
*/
ObjectList objectList;
std::condition_variable initCondition; std::condition_variable initCondition;
std::mutex initMutex; std::mutex initMutex;
std::string taskName; std::string taskName;
/**
* @brief The period of the task.
* @details
* The period determines the frequency of the task's execution.
* It is expressed in clock ticks.
*/
TaskPeriod period;
/**
* @brief The pointer to the deadline-missed function.
* @details
* This pointer stores the function that is executed if the task's deadline
* is missed. So, each may react individually on a timing failure.
* The pointer may be NULL, then nothing happens on missing the deadline.
* The deadline is equal to the next execution of the periodic task.
*/
void (*deadlineMissedFunc)(void);
/** /**
* @brief This is the function executed in the new task's context. * @brief This is the function executed in the new task's context.
* @details * @details
@ -124,9 +81,9 @@ class PeriodicTask : public PeriodicTaskIF {
* the checkAndRestartPeriod system call blocks the task until the next * the checkAndRestartPeriod system call blocks the task until the next
* period. On missing the deadline, the deadlineMissedFunction is executed. * period. On missing the deadline, the deadlineMissedFunction is executed.
*/ */
void taskFunctionality(void); void taskFunctionality();
bool delayForInterval(chron_ms* previousWakeTimeMs, const chron_ms interval); static bool delayForInterval(chron_ms* previousWakeTimeMs, chron_ms interval);
}; };
#endif /* PERIODICTASK_H_ */ #endif /* FRAMEWORK_OSAL_HOST_PERIODICTASK_H_ */

@ -14,9 +14,9 @@ TaskFactory* TaskFactory::factoryInstance = new TaskFactory();
// Not used for the host implementation for now because C++ thread abstraction is used // Not used for the host implementation for now because C++ thread abstraction is used
const size_t PeriodicTaskIF::MINIMUM_STACK_SIZE = 0; const size_t PeriodicTaskIF::MINIMUM_STACK_SIZE = 0;
TaskFactory::TaskFactory() {} TaskFactory::TaskFactory() = default;
TaskFactory::~TaskFactory() {} TaskFactory::~TaskFactory() = default;
TaskFactory* TaskFactory::instance() { return TaskFactory::factoryInstance; } TaskFactory* TaskFactory::instance() { return TaskFactory::factoryInstance; }

@ -6,7 +6,7 @@
std::mutex nameMapLock; std::mutex nameMapLock;
std::map<std::thread::id, std::string> taskNameMap; std::map<std::thread::id, std::string> taskNameMap;
ReturnValue_t tasks::insertTaskName(std::thread::id threadId, std::string taskName) { ReturnValue_t tasks::insertTaskName(std::thread::id threadId, const std::string& taskName) {
std::lock_guard<std::mutex> lg(nameMapLock); std::lock_guard<std::mutex> lg(nameMapLock);
auto returnPair = taskNameMap.emplace(threadId, taskName); auto returnPair = taskNameMap.emplace(threadId, taskName);
if (not returnPair.second) { if (not returnPair.second) {

@ -7,7 +7,7 @@
namespace tasks { namespace tasks {
ReturnValue_t insertTaskName(std::thread::id threadId, std::string taskName); ReturnValue_t insertTaskName(std::thread::id threadId, const std::string& taskName);
std::string getTaskName(std::thread::id threadId); std::string getTaskName(std::thread::id threadId);
} // namespace tasks } // namespace tasks

@ -1,22 +1,20 @@
#include "fsfw/osal/linux/FixedTimeslotTask.h" #include "fsfw/osal/linux/FixedTimeslotTask.h"
#include <limits.h> #include <climits>
#include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface/ServiceInterface.h"
uint32_t FixedTimeslotTask::deadlineMissedCount = 0;
const size_t PeriodicTaskIF::MINIMUM_STACK_SIZE = PTHREAD_STACK_MIN; const size_t PeriodicTaskIF::MINIMUM_STACK_SIZE = PTHREAD_STACK_MIN;
FixedTimeslotTask::FixedTimeslotTask(const char* name_, int priority_, size_t stackSize_, FixedTimeslotTask::FixedTimeslotTask(const char* name_, TaskPriority priority_, size_t stackSize_,
uint32_t periodMs_) TaskPeriod periodSeconds_, TaskDeadlineMissedFunction dlmFunc_)
: PosixThread(name_, priority_, stackSize_), pst(periodMs_), started(false) {} : FixedTimeslotTaskBase(periodSeconds_, dlmFunc_),
posixThread(name_, priority_, stackSize_),
FixedTimeslotTask::~FixedTimeslotTask() {} started(false) {}
void* FixedTimeslotTask::taskEntryPoint(void* arg) { void* FixedTimeslotTask::taskEntryPoint(void* arg) {
// The argument is re-interpreted as PollingTask. // The argument is re-interpreted as PollingTask.
FixedTimeslotTask* originalTask(reinterpret_cast<FixedTimeslotTask*>(arg)); auto* originalTask(reinterpret_cast<FixedTimeslotTask*>(arg));
// The task's functionality is called. // The task's functionality is called.
originalTask->taskFunctionality(); originalTask->taskFunctionality();
return nullptr; return nullptr;
@ -24,7 +22,7 @@ void* FixedTimeslotTask::taskEntryPoint(void* arg) {
ReturnValue_t FixedTimeslotTask::startTask() { ReturnValue_t FixedTimeslotTask::startTask() {
started = true; started = true;
createTask(&taskEntryPoint, this); posixThread.createTask(&taskEntryPoint, this);
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
@ -32,63 +30,36 @@ ReturnValue_t FixedTimeslotTask::sleepFor(uint32_t ms) {
return PosixThread::sleep((uint64_t)ms * 1000000); return PosixThread::sleep((uint64_t)ms * 1000000);
} }
uint32_t FixedTimeslotTask::getPeriodMs() const { return pst.getLengthMs(); } [[noreturn]] void FixedTimeslotTask::taskFunctionality() {
ReturnValue_t FixedTimeslotTask::addSlot(object_id_t componentId, uint32_t slotTimeMs,
int8_t executionStep) {
ExecutableObjectIF* executableObject =
ObjectManager::instance()->get<ExecutableObjectIF>(componentId);
if (executableObject != nullptr) {
pst.addSlot(componentId, slotTimeMs, executionStep, executableObject, this);
return HasReturnvaluesIF::RETURN_OK;
}
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "Component " << std::hex << componentId << " not found, not adding it to pst"
<< std::dec << std::endl;
#endif
return HasReturnvaluesIF::RETURN_FAILED;
}
ReturnValue_t FixedTimeslotTask::checkSequence() const { return pst.checkSequence(); }
void FixedTimeslotTask::taskFunctionality() {
// Like FreeRTOS pthreads are running as soon as they are created // Like FreeRTOS pthreads are running as soon as they are created
if (!started) { if (!started) {
suspend(); posixThread.suspend();
} }
pst.intializeSequenceAfterTaskCreation(); // Returnvalue ignored for now
static_cast<void>(pollingSeqTable.intializeSequenceAfterTaskCreation());
// The start time for the first entry is read. // The start time for the first entry is read.
uint64_t lastWakeTime = getCurrentMonotonicTimeMs(); uint64_t lastWakeTime = PosixThread::getCurrentMonotonicTimeMs();
uint64_t interval = pst.getIntervalToNextSlotMs(); uint32_t interval = 0;
// The task's "infinite" inner loop is entered. // The task's "infinite" inner loop is entered.
while (1) { while (true) {
if (pst.slotFollowsImmediately()) { if (pollingSeqTable.slotFollowsImmediately()) {
// Do nothing // Do nothing
} else { } else {
// The interval for the next polling slot is selected. // The interval for the next polling slot is selected.
interval = this->pst.getIntervalToPreviousSlotMs(); interval = pollingSeqTable.getIntervalToPreviousSlotMs();
// The period is checked and restarted with the new interval. // The period is checked and restarted with the new interval.
// If the deadline was missed, the deadlineMissedFunc is called. // If the deadline was missed, the deadlineMissedFunc is called.
if (!PosixThread::delayUntil(&lastWakeTime, interval)) { if (!PosixThread::delayUntil(&lastWakeTime, interval)) {
// No time left on timer -> we missed the deadline // No time left on timer -> we missed the deadline
missedDeadlineCounter(); if (dlmFunc != nullptr) {
dlmFunc();
}
} }
} }
// The device handler for this slot is executed and the next one is chosen. // The device handler for this slot is executed and the next one is chosen.
this->pst.executeAndAdvance(); pollingSeqTable.executeAndAdvance();
}
}
void FixedTimeslotTask::missedDeadlineCounter() {
FixedTimeslotTask::deadlineMissedCount++;
if (FixedTimeslotTask::deadlineMissedCount % 10 == 0) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "PST missed " << FixedTimeslotTask::deadlineMissedCount << " deadlines."
<< std::endl;
#endif
} }
} }

@ -3,11 +3,12 @@
#include <pthread.h> #include <pthread.h>
#include "../../tasks/FixedSlotSequence.h"
#include "../../tasks/FixedTimeslotTaskIF.h"
#include "PosixThread.h" #include "PosixThread.h"
#include "fsfw/tasks/FixedSlotSequence.h"
#include "fsfw/tasks/FixedTimeslotTaskBase.h"
#include "fsfw/tasks/definitions.h"
class FixedTimeslotTask : public FixedTimeslotTaskIF, public PosixThread { class FixedTimeslotTask : public FixedTimeslotTaskBase {
public: public:
/** /**
* Create a generic periodic task. * Create a generic periodic task.
@ -21,29 +22,13 @@ class FixedTimeslotTask : public FixedTimeslotTaskIF, public PosixThread {
* @param period_ * @param period_
* @param deadlineMissedFunc_ * @param deadlineMissedFunc_
*/ */
FixedTimeslotTask(const char* name_, int priority_, size_t stackSize_, uint32_t periodMs_); FixedTimeslotTask(const char* name_, TaskPriority priority_, size_t stackSize_,
virtual ~FixedTimeslotTask(); TaskPeriod periodSeconds_, TaskDeadlineMissedFunction dlmFunc_);
~FixedTimeslotTask() override = default;
virtual ReturnValue_t startTask(); ReturnValue_t startTask() override;
virtual ReturnValue_t sleepFor(uint32_t ms); ReturnValue_t sleepFor(uint32_t ms) override;
virtual uint32_t getPeriodMs() const;
virtual ReturnValue_t addSlot(object_id_t componentId, uint32_t slotTimeMs, int8_t executionStep);
virtual ReturnValue_t checkSequence() const;
/**
* This static function can be used as #deadlineMissedFunc.
* It counts missedDeadlines and prints the number of missed deadlines every 10th time.
*/
static void missedDeadlineCounter();
/**
* A helper variable to count missed deadlines.
*/
static uint32_t deadlineMissedCount;
protected: protected:
/** /**
@ -53,9 +38,12 @@ class FixedTimeslotTask : public FixedTimeslotTaskIF, public PosixThread {
* It links the functionalities provided by FixedSlotSequence with the * It links the functionalities provided by FixedSlotSequence with the
* OS's System Calls to keep the timing of the periods. * OS's System Calls to keep the timing of the periods.
*/ */
virtual void taskFunctionality(); [[noreturn]] virtual void taskFunctionality();
private: private:
PosixThread posixThread;
bool started;
/** /**
* @brief This is the entry point in a new thread. * @brief This is the entry point in a new thread.
* *
@ -68,9 +56,6 @@ class FixedTimeslotTask : public FixedTimeslotTaskIF, public PosixThread {
* arbitrary data. * arbitrary data.
*/ */
static void* taskEntryPoint(void* arg); static void* taskEntryPoint(void* arg);
FixedSlotSequence pst;
bool started;
}; };
#endif /* FSFW_OSAL_LINUX_FIXEDTIMESLOTTASK_H_ */ #endif /* FSFW_OSAL_LINUX_FIXEDTIMESLOTTASK_H_ */

@ -1,86 +1,54 @@
#include "fsfw/osal/linux/PeriodicPosixTask.h" #include "PeriodicPosixTask.h"
#include <errno.h> #include "fsfw/serviceinterface.h"
#include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
#include "fsfw/tasks/ExecutableObjectIF.h" #include "fsfw/tasks/ExecutableObjectIF.h"
PeriodicPosixTask::PeriodicPosixTask(const char* name_, int priority_, size_t stackSize_, PeriodicPosixTask::PeriodicPosixTask(const char* name_, int priority_, size_t stackSize_,
uint32_t period_, void(deadlineMissedFunc_)()) TaskPeriod period_, TaskDeadlineMissedFunction dlmFunc_)
: PosixThread(name_, priority_, stackSize_), : PeriodicTaskBase(period_, dlmFunc_),
objectList(), posixThread(name_, priority_, stackSize_),
started(false), started(false) {}
periodMs(period_),
deadlineMissedFunc(deadlineMissedFunc_) {}
PeriodicPosixTask::~PeriodicPosixTask() {
// Not Implemented
}
void* PeriodicPosixTask::taskEntryPoint(void* arg) { void* PeriodicPosixTask::taskEntryPoint(void* arg) {
// The argument is re-interpreted as PollingTask. // The argument is re-interpreted as PollingTask.
PeriodicPosixTask* originalTask(reinterpret_cast<PeriodicPosixTask*>(arg)); auto* originalTask(reinterpret_cast<PeriodicPosixTask*>(arg));
// The task's functionality is called. // The task's functionality is called.
originalTask->taskFunctionality(); originalTask->taskFunctionality();
return NULL; return nullptr;
}
ReturnValue_t PeriodicPosixTask::addComponent(object_id_t object) {
ExecutableObjectIF* newObject = ObjectManager::instance()->get<ExecutableObjectIF>(object);
return addComponent(newObject);
}
ReturnValue_t PeriodicPosixTask::addComponent(ExecutableObjectIF* object) {
if (object == nullptr) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "PeriodicTask::addComponent: Invalid object. Make sure"
<< " it implements ExecutableObjectIF!" << std::endl;
#else
sif::printError(
"PeriodicTask::addComponent: Invalid object. Make sure it "
"implements ExecutableObjectIF!\n");
#endif
return HasReturnvaluesIF::RETURN_FAILED;
}
objectList.push_back(object);
object->setTaskIF(this);
return HasReturnvaluesIF::RETURN_OK;
} }
ReturnValue_t PeriodicPosixTask::sleepFor(uint32_t ms) { ReturnValue_t PeriodicPosixTask::sleepFor(uint32_t ms) {
return PosixThread::sleep((uint64_t)ms * 1000000); return PosixThread::sleep(static_cast<uint64_t>(ms) * 1000000);
} }
ReturnValue_t PeriodicPosixTask::startTask(void) { ReturnValue_t PeriodicPosixTask::startTask() {
if (isEmpty()) {
return HasReturnvaluesIF::RETURN_FAILED;
}
started = true; started = true;
PosixThread::createTask(&taskEntryPoint, this); posixThread.createTask(&taskEntryPoint, this);
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
void PeriodicPosixTask::taskFunctionality(void) { [[noreturn]] void PeriodicPosixTask::taskFunctionality() {
if (not started) { if (not started) {
suspend(); posixThread.suspend();
} }
for (auto const& object : objectList) { initObjsAfterTaskCreation();
object->initializeAfterTaskCreation();
}
uint64_t lastWakeTime = getCurrentMonotonicTimeMs(); uint64_t lastWakeTime = PosixThread::getCurrentMonotonicTimeMs();
uint64_t periodMs = getPeriodMs();
// The task's "infinite" inner loop is entered. // The task's "infinite" inner loop is entered.
while (1) { while (true) {
for (auto const& object : objectList) { for (auto const& objOpCodePair : objectList) {
object->performOperation(); objOpCodePair.first->performOperation(objOpCodePair.second);
} }
if (not PosixThread::delayUntil(&lastWakeTime, periodMs)) { if (not PosixThread::delayUntil(&lastWakeTime, periodMs)) {
if (this->deadlineMissedFunc != nullptr) { if (dlmFunc != nullptr) {
this->deadlineMissedFunc(); dlmFunc();
} }
} }
} }
} }
uint32_t PeriodicPosixTask::getPeriodMs() const { return periodMs; }

@ -3,12 +3,13 @@
#include <vector> #include <vector>
#include "../../objectmanager/ObjectManagerIF.h"
#include "../../tasks/ExecutableObjectIF.h"
#include "../../tasks/PeriodicTaskIF.h"
#include "PosixThread.h" #include "PosixThread.h"
#include "fsfw/objectmanager/ObjectManagerIF.h"
#include "fsfw/tasks/ExecutableObjectIF.h"
#include "fsfw/tasks/PeriodicTaskBase.h"
#include "fsfw/tasks/PeriodicTaskIF.h"
class PeriodicPosixTask : public PosixThread, public PeriodicTaskIF { class PeriodicPosixTask : public PeriodicTaskBase {
public: public:
/** /**
* Create a generic periodic task. * Create a generic periodic task.
@ -22,9 +23,9 @@ class PeriodicPosixTask : public PosixThread, public PeriodicTaskIF {
* @param period_ * @param period_
* @param deadlineMissedFunc_ * @param deadlineMissedFunc_
*/ */
PeriodicPosixTask(const char* name_, int priority_, size_t stackSize_, uint32_t period_, PeriodicPosixTask(const char* name_, int priority_, size_t stackSize_, TaskPeriod period_,
void (*deadlineMissedFunc_)()); TaskDeadlineMissedFunction dlmFunc_);
virtual ~PeriodicPosixTask(); ~PeriodicPosixTask() override = default;
/** /**
* @brief The method to start the task. * @brief The method to start the task.
@ -34,42 +35,17 @@ class PeriodicPosixTask : public PosixThread, public PeriodicTaskIF {
* to the system call. * to the system call.
*/ */
ReturnValue_t startTask() override; ReturnValue_t startTask() override;
/**
* Adds an object to the list of objects to be executed.
* The objects are executed in the order added.
* @param object Id of the object to add.
* @return RETURN_OK on success, RETURN_FAILED if the object could not be added.
*/
ReturnValue_t addComponent(object_id_t object) override;
/**
* Adds an object to the list of objects to be executed.
* The objects are executed in the order added.
* @param object pointer to the object to add.
* @return RETURN_OK on success, RETURN_FAILED if the object could not be added.
*/
ReturnValue_t addComponent(ExecutableObjectIF* object) override;
uint32_t getPeriodMs() const override;
ReturnValue_t sleepFor(uint32_t ms) override; ReturnValue_t sleepFor(uint32_t ms) override;
private: private:
typedef std::vector<ExecutableObjectIF*> ObjectList; //!< Typedef for the List of objects. PosixThread posixThread;
/**
* @brief This attribute holds a list of objects to be executed.
*/
ObjectList objectList;
/** /**
* @brief Flag to indicate that the task was started and is allowed to run * @brief Flag to indicate that the task was started and is allowed to run
*/ */
bool started; bool started;
/**
* @brief Period of the task in milliseconds
*/
uint32_t periodMs;
/** /**
* @brief The function containing the actual functionality of the task. * @brief The function containing the actual functionality of the task.
* @details The method sets and starts * @details The method sets and starts
@ -78,7 +54,7 @@ class PeriodicPosixTask : public PosixThread, public PeriodicTaskIF {
* will be blocked until the next period. On missing the deadline, the deadlineMissedFunction is * will be blocked until the next period. On missing the deadline, the deadlineMissedFunction is
* executed. * executed.
*/ */
virtual void taskFunctionality(void); [[noreturn]] virtual void taskFunctionality();
/** /**
* @brief This is the entry point in a new thread. * @brief This is the entry point in a new thread.
* *
@ -86,14 +62,6 @@ class PeriodicPosixTask : public PosixThread, public PeriodicTaskIF {
* of the child class. Needs a valid pointer to the derived class. * of the child class. Needs a valid pointer to the derived class.
*/ */
static void* taskEntryPoint(void* arg); static void* taskEntryPoint(void* arg);
/**
* @brief The pointer to the deadline-missed function.
* @details This pointer stores the function that is executed if the task's deadline is missed.
* So, each may react individually on a timing failure. The pointer may be
* NULL, then nothing happens on missing the deadline. The deadline is equal to the next execution
* of the periodic task.
*/
void (*deadlineMissedFunc)();
}; };
#endif /* FRAMEWORK_OSAL_LINUX_PERIODICPOSIXTASK_H_ */ #endif /* FRAMEWORK_OSAL_LINUX_PERIODICPOSIXTASK_H_ */

@ -35,6 +35,21 @@ class PosixThread {
*/ */
void resume(); void resume();
/**
* @brief Function that has to be called by derived class because the
* derived class pointer has to be valid as argument.
* @details
* This function creates a pthread with the given parameters. As the
* function requires a pointer to the derived object it has to be called
* after the this pointer of the derived object is valid.
* Sets the taskEntryPoint as function to be called by new a thread.
* @param fnc_ Function which will be executed by the thread.
* @param arg_
* argument of the taskEntryPoint function, needs to be this pointer
* of derived class
*/
void createTask(void* (*fnc_)(void*), void* arg_);
/** /**
* Delay function similar to FreeRtos delayUntil function * Delay function similar to FreeRtos delayUntil function
* *
@ -55,21 +70,6 @@ class PosixThread {
protected: protected:
pthread_t thread; pthread_t thread;
/**
* @brief Function that has to be called by derived class because the
* derived class pointer has to be valid as argument.
* @details
* This function creates a pthread with the given parameters. As the
* function requires a pointer to the derived object it has to be called
* after the this pointer of the derived object is valid.
* Sets the taskEntryPoint as function to be called by new a thread.
* @param fnc_ Function which will be executed by the thread.
* @param arg_
* argument of the taskEntryPoint function, needs to be this pointer
* of derived class
*/
void createTask(void* (*fnc_)(void*), void* arg_);
private: private:
char name[PTHREAD_MAX_NAMELEN]; char name[PTHREAD_MAX_NAMELEN];
int priority; int priority;

@ -8,21 +8,22 @@
// TODO: Different variant than the lazy loading in QueueFactory. What's better and why? // TODO: Different variant than the lazy loading in QueueFactory. What's better and why?
TaskFactory* TaskFactory::factoryInstance = new TaskFactory(); TaskFactory* TaskFactory::factoryInstance = new TaskFactory();
TaskFactory::~TaskFactory() {} TaskFactory::~TaskFactory() = default;
TaskFactory* TaskFactory::instance() { return TaskFactory::factoryInstance; } TaskFactory* TaskFactory::instance() { return TaskFactory::factoryInstance; }
PeriodicTaskIF* TaskFactory::createPeriodicTask( PeriodicTaskIF* TaskFactory::createPeriodicTask(
TaskName name_, TaskPriority taskPriority_, TaskStackSize stackSize_, TaskName name_, TaskPriority taskPriority_, TaskStackSize stackSize_,
TaskPeriod periodInSeconds_, TaskDeadlineMissedFunction deadLineMissedFunction_) { TaskPeriod periodInSeconds_, TaskDeadlineMissedFunction deadLineMissedFunction_) {
return new PeriodicPosixTask(name_, taskPriority_, stackSize_, periodInSeconds_ * 1000, return new PeriodicPosixTask(name_, taskPriority_, stackSize_, periodInSeconds_,
deadLineMissedFunction_); deadLineMissedFunction_);
} }
FixedTimeslotTaskIF* TaskFactory::createFixedTimeslotTask( FixedTimeslotTaskIF* TaskFactory::createFixedTimeslotTask(
TaskName name_, TaskPriority taskPriority_, TaskStackSize stackSize_, TaskName name_, TaskPriority taskPriority_, TaskStackSize stackSize_,
TaskPeriod periodInSeconds_, TaskDeadlineMissedFunction deadLineMissedFunction_) { TaskPeriod periodInSeconds_, TaskDeadlineMissedFunction deadLineMissedFunction_) {
return new FixedTimeslotTask(name_, taskPriority_, stackSize_, periodInSeconds_ * 1000); return new FixedTimeslotTask(name_, taskPriority_, stackSize_, periodInSeconds_,
deadLineMissedFunction_);
} }
ReturnValue_t TaskFactory::deleteTask(PeriodicTaskIF* task) { ReturnValue_t TaskFactory::deleteTask(PeriodicTaskIF* task) {

@ -1,42 +1,32 @@
#include "fsfw/osal/rtems/FixedTimeslotTask.h" #include "fsfw/osal/rtems/FixedTimeslotTask.h"
#include <rtems/bspIo.h>
#include <rtems/io.h> #include <rtems/io.h>
#include <rtems/rtems/ratemon.h>
#include <rtems/rtems/status.h> #include <rtems/rtems/status.h>
#include <rtems/rtems/tasks.h> #include <rtems/rtems/tasks.h>
#include <rtems/rtems/types.h> #include <rtems/rtems/types.h>
#include <sys/_stdint.h>
#include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/objectmanager/SystemObjectIF.h"
#include "fsfw/osal/rtems/RtemsBasic.h" #include "fsfw/osal/rtems/RtemsBasic.h"
#include "fsfw/returnvalues/HasReturnvaluesIF.h" #include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface/ServiceInterface.h"
#include "fsfw/tasks/FixedSequenceSlot.h"
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
#include <iostream> #include <iostream>
#endif #endif
#include <cstddef> #include <cstddef>
#include <list>
uint32_t FixedTimeslotTask::deadlineMissedCount = 0;
FixedTimeslotTask::FixedTimeslotTask(const char *name, rtems_task_priority setPriority, FixedTimeslotTask::FixedTimeslotTask(const char *name, rtems_task_priority setPriority,
size_t setStack, uint32_t setOverallPeriod, size_t setStack, TaskPeriod setOverallPeriod,
void (*setDeadlineMissedFunc)(void)) TaskDeadlineMissedFunction dlmFunc_)
: RTEMSTaskBase(setPriority, setStack, name), periodId(0), pst(setOverallPeriod) { : FixedTimeslotTaskBase(setOverallPeriod, dlmFunc_),
// All additional attributes are applied to the object. RTEMSTaskBase(setPriority, setStack, name),
this->deadlineMissedFunc = setDeadlineMissedFunc; periodId(0) {}
}
FixedTimeslotTask::~FixedTimeslotTask() {} FixedTimeslotTask::~FixedTimeslotTask() = default;
rtems_task FixedTimeslotTask::taskEntryPoint(rtems_task_argument argument) { rtems_task FixedTimeslotTask::taskEntryPoint(rtems_task_argument argument) {
/* The argument is re-interpreted as a FixedTimeslotTask */ /* The argument is re-interpreted as a FixedTimeslotTask */
FixedTimeslotTask *originalTask(reinterpret_cast<FixedTimeslotTask *>(argument)); auto *originalTask(reinterpret_cast<FixedTimeslotTask *>(argument));
/* The task's functionality is called. */ /* The task's functionality is called. */
return originalTask->taskFunctionality(); return originalTask->taskFunctionality();
/* Should never be reached */ /* Should never be reached */
@ -46,16 +36,6 @@ rtems_task FixedTimeslotTask::taskEntryPoint(rtems_task_argument argument) {
#endif #endif
} }
void FixedTimeslotTask::missedDeadlineCounter() {
FixedTimeslotTask::deadlineMissedCount++;
if (FixedTimeslotTask::deadlineMissedCount % 10 == 0) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "PST missed " << FixedTimeslotTask::deadlineMissedCount << " deadlines."
<< std::endl;
#endif
}
}
ReturnValue_t FixedTimeslotTask::startTask() { ReturnValue_t FixedTimeslotTask::startTask() {
rtems_status_code status = rtems_status_code status =
rtems_task_start(id, FixedTimeslotTask::taskEntryPoint, rtems_task_argument((void *)this)); rtems_task_start(id, FixedTimeslotTask::taskEntryPoint, rtems_task_argument((void *)this));
@ -79,54 +59,35 @@ ReturnValue_t FixedTimeslotTask::startTask() {
} }
} }
ReturnValue_t FixedTimeslotTask::addSlot(object_id_t componentId, uint32_t slotTimeMs, [[noreturn]] void FixedTimeslotTask::taskFunctionality() {
int8_t executionStep) {
ExecutableObjectIF *object = ObjectManager::instance()->get<ExecutableObjectIF>(componentId);
if (object != nullptr) {
pst.addSlot(componentId, slotTimeMs, executionStep, object, this);
return HasReturnvaluesIF::RETURN_OK;
}
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "Component " << std::hex << componentId << " not found, not adding it to pst"
<< std::endl;
#endif
return HasReturnvaluesIF::RETURN_FAILED;
}
uint32_t FixedTimeslotTask::getPeriodMs() const { return pst.getLengthMs(); }
ReturnValue_t FixedTimeslotTask::checkSequence() const { return pst.checkSequence(); }
void FixedTimeslotTask::taskFunctionality() {
/* A local iterator for the Polling Sequence Table is created to find the start time for /* A local iterator for the Polling Sequence Table is created to find the start time for
the first entry. */ the first entry. */
FixedSlotSequence::SlotListIter it = pst.current; auto it = pollingSeqTable.current;
/* Initialize the PST with the correct calling task */ /* Initialize the PST with the correct calling task */
pst.intializeSequenceAfterTaskCreation(); pollingSeqTable.intializeSequenceAfterTaskCreation();
/* The start time for the first entry is read. */ /* The start time for the first entry is read. */
rtems_interval interval = RtemsBasic::convertMsToTicks(it->pollingTimeMs); rtems_interval interval = RtemsBasic::convertMsToTicks(it->pollingTimeMs);
RTEMSTaskBase::setAndStartPeriod(interval, &periodId); RTEMSTaskBase::setAndStartPeriod(interval, &periodId);
// The task's "infinite" inner loop is entered. // The task's "infinite" inner loop is entered.
while (1) { while (true) {
if (pst.slotFollowsImmediately()) { if (pollingSeqTable.slotFollowsImmediately()) {
/* Do nothing */ /* Do nothing */
} else { } else {
/* The interval for the next polling slot is selected. */ /* The interval for the next polling slot is selected. */
interval = RtemsBasic::convertMsToTicks(this->pst.getIntervalToNextSlotMs()); interval = RtemsBasic::convertMsToTicks(pollingSeqTable.getIntervalToNextSlotMs());
/* The period is checked and restarted with the new interval. /* The period is checked and restarted with the new interval.
If the deadline was missed, the deadlineMissedFunc is called. */ If the deadline was missed, the deadlineMissedFunc is called. */
rtems_status_code status = RTEMSTaskBase::restartPeriod(interval, periodId); rtems_status_code status = RTEMSTaskBase::restartPeriod(interval, periodId);
if (status == RTEMS_TIMEOUT) { if (status == RTEMS_TIMEOUT) {
if (this->deadlineMissedFunc != nullptr) { if (dlmFunc != nullptr) {
this->deadlineMissedFunc(); dlmFunc();
} }
} }
} }
/* The device handler for this slot is executed and the next one is chosen. */ /* The device handler for this slot is executed and the next one is chosen. */
this->pst.executeAndAdvance(); this->pollingSeqTable.executeAndAdvance();
} }
} }

@ -1,11 +1,11 @@
#ifndef FSFW_OSAL_RTEMS_FIXEDTIMESLOTTASK_H_ #ifndef FSFW_OSAL_RTEMS_FIXEDTIMESLOTTASK_H_
#define FSFW_OSAL_RTEMS_FIXEDTIMESLOTTASK_H_ #define FSFW_OSAL_RTEMS_FIXEDTIMESLOTTASK_H_
#include "../../tasks/FixedSlotSequence.h"
#include "../../tasks/FixedTimeslotTaskIF.h"
#include "RTEMSTaskBase.h" #include "RTEMSTaskBase.h"
#include "fsfw/tasks/FixedSlotSequence.h"
#include "fsfw/tasks/FixedTimeslotTaskBase.h"
class FixedTimeslotTask : public RTEMSTaskBase, public FixedTimeslotTaskIF { class FixedTimeslotTask : public FixedTimeslotTaskBase, public RTEMSTaskBase {
public: public:
/** /**
* @brief The standard constructor of the class. * @brief The standard constructor of the class.
@ -17,7 +17,7 @@ class FixedTimeslotTask : public RTEMSTaskBase, public FixedTimeslotTaskIF {
* @param getPst The object id of the completely initialized polling sequence. * @param getPst The object id of the completely initialized polling sequence.
*/ */
FixedTimeslotTask(const char *name, rtems_task_priority setPriority, size_t setStackSize, FixedTimeslotTask(const char *name, rtems_task_priority setPriority, size_t setStackSize,
uint32_t overallPeriod, void (*setDeadlineMissedFunc)()); TaskPeriod overallPeriod, TaskDeadlineMissedFunction dlmFunc);
/** /**
* @brief The destructor of the class. * @brief The destructor of the class.
@ -25,44 +25,17 @@ class FixedTimeslotTask : public RTEMSTaskBase, public FixedTimeslotTaskIF {
* The destructor frees all heap memory that was allocated on thread initialization * The destructor frees all heap memory that was allocated on thread initialization
* for the PST andthe device handlers. This is done by calling the PST's destructor. * for the PST andthe device handlers. This is done by calling the PST's destructor.
*/ */
virtual ~FixedTimeslotTask(void); ~FixedTimeslotTask() override;
ReturnValue_t startTask(void); ReturnValue_t startTask(void);
/**
* This static function can be used as #deadlineMissedFunc.
* It counts missedDeadlines and prints the number of missed deadlines every 10th time.
*/
static void missedDeadlineCounter();
/**
* A helper variable to count missed deadlines.
*/
static uint32_t deadlineMissedCount;
ReturnValue_t addSlot(object_id_t componentId, uint32_t slotTimeMs, int8_t executionStep); ReturnValue_t sleepFor(uint32_t ms) override;
uint32_t getPeriodMs() const;
ReturnValue_t checkSequence() const;
ReturnValue_t sleepFor(uint32_t ms);
protected: protected:
/** /**
* @brief id of the associated OS period * @brief id of the associated OS period
*/ */
rtems_id periodId; rtems_id periodId;
FixedSlotSequence pst;
/**
* @brief This attribute holds a function pointer that is executed when a deadline was missed.
*
* @details
* Another function may be announced to determine the actions to perform when a deadline
* was missed. Currently, only one function for missing any deadline is allowed.
* If not used, it shall be declared NULL.
*/
void (*deadlineMissedFunc)(void) = nullptr;
/** /**
* @brief This is the entry point in a new polling thread. * @brief This is the entry point in a new polling thread.
* @details This method is the entry point in the new thread * @details This method is the entry point in the new thread
@ -76,7 +49,7 @@ class FixedTimeslotTask : public RTEMSTaskBase, public FixedTimeslotTaskIF {
* It links the functionalities provided by FixedSlotSequence with the OS's system calls to * It links the functionalities provided by FixedSlotSequence with the OS's system calls to
* keep the timing of the periods. * keep the timing of the periods.
*/ */
void taskFunctionality(void); [[noreturn]] void taskFunctionality();
}; };
#endif /* FSFW_OSAL_RTEMS_FIXEDTIMESLOTTASK_H_ */ #endif /* FSFW_OSAL_RTEMS_FIXEDTIMESLOTTASK_H_ */

@ -65,7 +65,7 @@ ReturnValue_t MessageQueue::sendMessageFrom(MessageQueueId_t sendTo, MessageQueu
} }
ReturnValue_t returnCode = convertReturnCode(result); ReturnValue_t returnCode = convertReturnCode(result);
if (result == MessageQueueIF::EMPTY) { if (returnCode == MessageQueueIF::EMPTY) {
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }

@ -36,7 +36,7 @@ class MessageQueue : public MessageQueueBase {
* @param max_message_size With this parameter, the maximum message size can be adjusted. * @param max_message_size With this parameter, the maximum message size can be adjusted.
* This should be left default. * This should be left default.
*/ */
MessageQueue(size_t message_depth = 3, explicit MessageQueue(size_t message_depth = 3,
size_t max_message_size = MessageQueueMessage::MAX_MESSAGE_SIZE, size_t max_message_size = MessageQueueMessage::MAX_MESSAGE_SIZE,
MqArgs* args = nullptr); MqArgs* args = nullptr);
@ -48,18 +48,19 @@ class MessageQueue : public MessageQueueBase {
* @brief The destructor deletes the formerly created message queue. * @brief The destructor deletes the formerly created message queue.
* @details This is accomplished by using the delete call provided by the operating system. * @details This is accomplished by using the delete call provided by the operating system.
*/ */
virtual ~MessageQueue(); ~MessageQueue() override;
// Implement non-generic MessageQueueIF functions not handled by MessageQueueBase // Implement non-generic MessageQueueIF functions not handled by MessageQueueBase
ReturnValue_t flush(uint32_t* count) override; ReturnValue_t flush(uint32_t* count) override;
ReturnValue_t receiveMessage(MessageQueueMessageIF* message) override;
ReturnValue_t sendMessageFrom(MessageQueueId_t sendTo, MessageQueueMessageIF* message, ReturnValue_t sendMessageFrom(MessageQueueId_t sendTo, MessageQueueMessageIF* message,
MessageQueueId_t sentFrom = NO_QUEUE, MessageQueueId_t sentFrom, bool ignoreFault) override;
bool ignoreFault = false) override;
private: private:
/** /**
* \brief This attribute stores a reference to the internal error reporter for reporting full * @brief This attribute stores a reference to the internal error reporter for reporting full
* queues. \details In the event of a full destination queue, the reporter will be notified. The * queues. @details In the event of a full destination queue, the reporter will be notified. The
* reference is set by lazy loading * reference is set by lazy loading
*/ */
InternalErrorReporterIF* internalErrorReporter; InternalErrorReporterIF* internalErrorReporter;

@ -5,12 +5,12 @@
#include "fsfw/tasks/ExecutableObjectIF.h" #include "fsfw/tasks/ExecutableObjectIF.h"
PeriodicTask::PeriodicTask(const char* name, rtems_task_priority setPriority, size_t setStack, PeriodicTask::PeriodicTask(const char* name, rtems_task_priority setPriority, size_t setStack,
rtems_interval setPeriod, void (*setDeadlineMissedFunc)()) TaskPeriod setPeriod, TaskDeadlineMissedFunction dlmFunc_)
: RTEMSTaskBase(setPriority, setStack, name), : PeriodicTaskBase(setPeriod, dlmFunc_),
periodTicks(RtemsBasic::convertMsToTicks(setPeriod)), RTEMSTaskBase(setPriority, setStack, name),
deadlineMissedFunc(setDeadlineMissedFunc) {} periodTicks(RtemsBasic::convertMsToTicks(static_cast<uint32_t>(setPeriod * 1000.0))) {}
PeriodicTask::~PeriodicTask(void) { PeriodicTask::~PeriodicTask() {
/* Do not delete objects, we were responsible for pointers only. */ /* Do not delete objects, we were responsible for pointers only. */
rtems_rate_monotonic_delete(periodId); rtems_rate_monotonic_delete(periodId);
} }
@ -18,7 +18,7 @@ PeriodicTask::~PeriodicTask(void) {
rtems_task PeriodicTask::taskEntryPoint(rtems_task_argument argument) { rtems_task PeriodicTask::taskEntryPoint(rtems_task_argument argument) {
/* The argument is re-interpreted as MultiObjectTask. The Task object is global, /* The argument is re-interpreted as MultiObjectTask. The Task object is global,
so it is found from any place. */ so it is found from any place. */
PeriodicTask* originalTask(reinterpret_cast<PeriodicTask*>(argument)); auto* originalTask(reinterpret_cast<PeriodicTask*>(argument));
return originalTask->taskFunctionality(); return originalTask->taskFunctionality();
; ;
} }
@ -28,8 +28,10 @@ ReturnValue_t PeriodicTask::startTask() {
rtems_task_start(id, PeriodicTask::taskEntryPoint, rtems_task_argument((void*)this)); rtems_task_start(id, PeriodicTask::taskEntryPoint, rtems_task_argument((void*)this));
if (status != RTEMS_SUCCESSFUL) { if (status != RTEMS_SUCCESSFUL) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "ObjectTask::startTask for " << std::hex << this->getId() << std::dec sif::error << "PeriodicTask::startTask for " << std::hex << this->getId() << std::dec
<< " failed." << std::endl; << " failed" << std::endl;
#else
sif::printError("PeriodicTask::startTask for 0x%08x failed\n", getId());
#endif #endif
} }
switch (status) { switch (status) {
@ -47,38 +49,20 @@ ReturnValue_t PeriodicTask::startTask() {
ReturnValue_t PeriodicTask::sleepFor(uint32_t ms) { return RTEMSTaskBase::sleepFor(ms); } ReturnValue_t PeriodicTask::sleepFor(uint32_t ms) { return RTEMSTaskBase::sleepFor(ms); }
void PeriodicTask::taskFunctionality() { [[noreturn]] void PeriodicTask::taskFunctionality() {
RTEMSTaskBase::setAndStartPeriod(periodTicks, &periodId); RTEMSTaskBase::setAndStartPeriod(periodTicks, &periodId);
for (const auto& object : objectList) { initObjsAfterTaskCreation();
object->initializeAfterTaskCreation();
}
/* The task's "infinite" inner loop is entered. */ /* The task's "infinite" inner loop is entered. */
while (1) { while (true) {
for (const auto& object : objectList) { for (const auto& objectPair : objectList) {
object->performOperation(); objectPair.first->performOperation(objectPair.second);
} }
rtems_status_code status = RTEMSTaskBase::restartPeriod(periodTicks, periodId); rtems_status_code status = RTEMSTaskBase::restartPeriod(periodTicks, periodId);
if (status == RTEMS_TIMEOUT) { if (status == RTEMS_TIMEOUT) {
if (this->deadlineMissedFunc != nullptr) { if (dlmFunc != nullptr) {
this->deadlineMissedFunc(); dlmFunc();
} }
} }
} }
} }
ReturnValue_t PeriodicTask::addComponent(object_id_t object) {
ExecutableObjectIF* newObject = ObjectManager::instance()->get<ExecutableObjectIF>(object);
return addComponent(newObject);
}
ReturnValue_t PeriodicTask::addComponent(ExecutableObjectIF* object) {
if (object == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED;
}
objectList.push_back(object);
object->setTaskIF(this);
return HasReturnvaluesIF::RETURN_OK;
}
uint32_t PeriodicTask::getPeriodMs() const { return RtemsBasic::convertTicksToMs(periodTicks); }

@ -3,9 +3,10 @@
#include <vector> #include <vector>
#include "../../objectmanager/ObjectManagerIF.h"
#include "../../tasks/PeriodicTaskIF.h"
#include "RTEMSTaskBase.h" #include "RTEMSTaskBase.h"
#include "fsfw/objectmanager/ObjectManagerIF.h"
#include "fsfw/tasks/PeriodicTaskBase.h"
#include "fsfw/tasks/PeriodicTaskIF.h"
class ExecutableObjectIF; class ExecutableObjectIF;
@ -18,7 +19,7 @@ class ExecutableObjectIF;
* @author baetz * @author baetz
* @ingroup task_handling * @ingroup task_handling
*/ */
class PeriodicTask : public RTEMSTaskBase, public PeriodicTaskIF { class PeriodicTask : public PeriodicTaskBase, public RTEMSTaskBase {
public: public:
/** /**
* @brief Standard constructor of the class. * @brief Standard constructor of the class.
@ -36,12 +37,12 @@ class PeriodicTask : public RTEMSTaskBase, public PeriodicTaskIF {
* that shall be assigned. * that shall be assigned.
*/ */
PeriodicTask(const char *name, rtems_task_priority setPriority, size_t setStack, PeriodicTask(const char *name, rtems_task_priority setPriority, size_t setStack,
rtems_interval setPeriod, void (*setDeadlineMissedFunc)()); TaskPeriod setPeriod, TaskDeadlineMissedFunction dlmFunc);
/** /**
* @brief Currently, the executed object's lifetime is not coupled with the task object's * @brief Currently, the executed object's lifetime is not coupled with the task object's
* lifetime, so the destructor is empty. * lifetime, so the destructor is empty.
*/ */
virtual ~PeriodicTask(void); ~PeriodicTask() override;
/** /**
* @brief The method to start the task. * @brief The method to start the task.
@ -50,33 +51,11 @@ class PeriodicTask : public RTEMSTaskBase, public PeriodicTaskIF {
* The address of the task object is passed as an argument * The address of the task object is passed as an argument
* to the system call. * to the system call.
*/ */
ReturnValue_t startTask(void); ReturnValue_t startTask() override;
/**
* Adds an object to the list of objects to be executed.
* The objects are executed in the order added.
* @param object Id of the object to add.
* @return RETURN_OK on success, RETURN_FAILED if the object could not be added.
*/
ReturnValue_t addComponent(object_id_t object) override;
/**
* Adds an object to the list of objects to be executed.
* The objects are executed in the order added.
* @param object pointer to the object to add.
* @return RETURN_OK on success, RETURN_FAILED if the object could not be added.
*/
ReturnValue_t addComponent(ExecutableObjectIF *object) override;
uint32_t getPeriodMs() const override;
ReturnValue_t sleepFor(uint32_t ms) override; ReturnValue_t sleepFor(uint32_t ms) override;
protected: protected:
typedef std::vector<ExecutableObjectIF *> ObjectList; //!< Typedef for the List of objects.
/**
* @brief This attribute holds a list of objects to be executed.
*/
ObjectList objectList;
/** /**
* @brief The period of the task. * @brief The period of the task.
* @details The period determines the frequency of the task's execution. It is expressed in * @details The period determines the frequency of the task's execution. It is expressed in
@ -87,14 +66,7 @@ class PeriodicTask : public RTEMSTaskBase, public PeriodicTaskIF {
* @brief id of the associated OS period * @brief id of the associated OS period
*/ */
rtems_id periodId = 0; rtems_id periodId = 0;
/**
* @brief The pointer to the deadline-missed function.
* @details This pointer stores the function that is executed if the task's deadline is missed.
* So, each may react individually on a timing failure. The pointer may be
* nullptr, then nothing happens on missing the deadline. The deadline is equal to the next
* execution of the periodic task.
*/
void (*deadlineMissedFunc)(void);
/** /**
* @brief This is the function executed in the new task's context. * @brief This is the function executed in the new task's context.
* @details It converts the argument back to the thread object type and copies the class * @details It converts the argument back to the thread object type and copies the class
@ -110,7 +82,7 @@ class PeriodicTask : public RTEMSTaskBase, public PeriodicTaskIF {
* are called. Afterwards the checkAndRestartPeriod system call blocks the task until the next * are called. Afterwards the checkAndRestartPeriod system call blocks the task until the next
* period. On missing the deadline, the deadlineMissedFunction is executed. * period. On missing the deadline, the deadlineMissedFunction is executed.
*/ */
void taskFunctionality(void); [[noreturn]] void taskFunctionality();
}; };
#endif /* FSFW_OSAL_RTEMS_PERIODICTASK_H_ */ #endif /* FSFW_OSAL_RTEMS_PERIODICTASK_H_ */

@ -45,9 +45,9 @@ QueueFactory* QueueFactory::instance() {
return factoryInstance; return factoryInstance;
} }
QueueFactory::QueueFactory() {} QueueFactory::QueueFactory() = default;
QueueFactory::~QueueFactory() {} QueueFactory::~QueueFactory() = default;
MessageQueueIF* QueueFactory::createMessageQueue(uint32_t messageDepth, size_t maxMessageSize, MessageQueueIF* QueueFactory::createMessageQueue(uint32_t messageDepth, size_t maxMessageSize,
MqArgs* args) { MqArgs* args) {

@ -32,7 +32,7 @@ RTEMSTaskBase::RTEMSTaskBase(rtems_task_priority set_priority, size_t stack_size
RTEMSTaskBase::~RTEMSTaskBase() { rtems_task_delete(id); } RTEMSTaskBase::~RTEMSTaskBase() { rtems_task_delete(id); }
rtems_id RTEMSTaskBase::getId() { return this->id; } rtems_id RTEMSTaskBase::getId() const { return this->id; }
ReturnValue_t RTEMSTaskBase::sleepFor(uint32_t ms) { ReturnValue_t RTEMSTaskBase::sleepFor(uint32_t ms) {
rtems_status_code status = rtems_task_wake_after(RtemsBasic::convertMsToTicks(ms)); rtems_status_code status = rtems_task_wake_after(RtemsBasic::convertMsToTicks(ms));

@ -36,9 +36,9 @@ class RTEMSTaskBase {
/** /**
* @brief This method returns the task id of this class. * @brief This method returns the task id of this class.
*/ */
rtems_id getId(); rtems_id getId() const;
ReturnValue_t sleepFor(uint32_t ms); static ReturnValue_t sleepFor(uint32_t ms);
static ReturnValue_t setAndStartPeriod(rtems_interval period, rtems_id *periodId); static ReturnValue_t setAndStartPeriod(rtems_interval period, rtems_id *periodId);
static rtems_status_code restartPeriod(rtems_interval period, rtems_id periodId); static rtems_status_code restartPeriod(rtems_interval period, rtems_id periodId);

@ -1,7 +1,6 @@
#include "fsfw/tasks/TaskFactory.h" #include "fsfw/tasks/TaskFactory.h"
#include "fsfw/osal/rtems/FixedTimeslotTask.h" #include "fsfw/osal/rtems/FixedTimeslotTask.h"
#include "fsfw/osal/rtems/InitTask.h"
#include "fsfw/osal/rtems/PeriodicTask.h" #include "fsfw/osal/rtems/PeriodicTask.h"
#include "fsfw/osal/rtems/RtemsBasic.h" #include "fsfw/osal/rtems/RtemsBasic.h"
#include "fsfw/returnvalues/HasReturnvaluesIF.h" #include "fsfw/returnvalues/HasReturnvaluesIF.h"
@ -9,29 +8,29 @@
// TODO: Different variant than the lazy loading in QueueFactory. What's better and why? // TODO: Different variant than the lazy loading in QueueFactory. What's better and why?
TaskFactory* TaskFactory::factoryInstance = new TaskFactory(); TaskFactory* TaskFactory::factoryInstance = new TaskFactory();
TaskFactory::~TaskFactory() {} TaskFactory::TaskFactory() = default;
TaskFactory::~TaskFactory() = default;
TaskFactory* TaskFactory::instance() { return TaskFactory::factoryInstance; } TaskFactory* TaskFactory::instance() { return TaskFactory::factoryInstance; }
PeriodicTaskIF* TaskFactory::createPeriodicTask( PeriodicTaskIF* TaskFactory::createPeriodicTask(
TaskName name_, TaskPriority taskPriority_, TaskStackSize stackSize_, TaskName name_, TaskPriority taskPriority_, TaskStackSize stackSize_,
TaskPeriod periodInSeconds_, TaskDeadlineMissedFunction deadLineMissedFunction_) { TaskPeriod periodInSeconds_, TaskDeadlineMissedFunction deadLineMissedFunction_) {
rtems_interval taskPeriod = periodInSeconds_ * Clock::getTicksPerSecond(); return static_cast<PeriodicTaskIF*>(new PeriodicTask(name_, taskPriority_, stackSize_,
periodInSeconds_, deadLineMissedFunction_));
return static_cast<PeriodicTaskIF*>(
new PeriodicTask(name_, taskPriority_, stackSize_, taskPeriod, deadLineMissedFunction_));
} }
FixedTimeslotTaskIF* TaskFactory::createFixedTimeslotTask( FixedTimeslotTaskIF* TaskFactory::createFixedTimeslotTask(
TaskName name_, TaskPriority taskPriority_, TaskStackSize stackSize_, TaskName name_, TaskPriority taskPriority_, TaskStackSize stackSize_,
TaskPeriod periodInSeconds_, TaskDeadlineMissedFunction deadLineMissedFunction_) { TaskPeriod periodInSeconds_, TaskDeadlineMissedFunction deadLineMissedFunction_) {
rtems_interval taskPeriod = periodInSeconds_ * Clock::getTicksPerSecond(); return static_cast<FixedTimeslotTaskIF*>(new FixedTimeslotTask(
return static_cast<FixedTimeslotTaskIF*>( name_, taskPriority_, stackSize_, periodInSeconds_, deadLineMissedFunction_));
new FixedTimeslotTask(name_, taskPriority_, stackSize_, taskPeriod, deadLineMissedFunction_));
} }
ReturnValue_t TaskFactory::deleteTask(PeriodicTaskIF* task) { ReturnValue_t TaskFactory::deleteTask(PeriodicTaskIF* task) {
// TODO not implemented // This should call the OS specific destructor
delete (dynamic_cast<PeriodicTask*>(task));
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
@ -45,5 +44,3 @@ void TaskFactory::printMissedDeadline() {
/* TODO: Implement */ /* TODO: Implement */
return; return;
} }
TaskFactory::TaskFactory() {}

@ -51,7 +51,7 @@ class HasParametersIF {
return (domainId << 24) + (uniqueId << 16) + linearIndex; return (domainId << 24) + (uniqueId << 16) + linearIndex;
} }
virtual ~HasParametersIF() {} virtual ~HasParametersIF() = default;
/** /**
* This is the generic function overriden by child classes to set * This is the generic function overriden by child classes to set

@ -63,13 +63,13 @@ class Fuse : public SystemObject,
SerializeIF::Endianness streamEndianness) override; SerializeIF::Endianness streamEndianness) override;
void setAllMonitorsToUnchecked(); void setAllMonitorsToUnchecked();
ReturnValue_t performOperation(uint8_t opCode); ReturnValue_t performOperation(uint8_t opCode);
MessageQueueId_t getCommandQueue() const; MessageQueueId_t getCommandQueue() const override;
void setDataPoolEntriesInvalid(); void setDataPoolEntriesInvalid();
ReturnValue_t setHealth(HealthState health); ReturnValue_t setHealth(HealthState health) override;
HasHealthIF::HealthState getHealth(); HasHealthIF::HealthState getHealth() override;
ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId, ParameterWrapper *parameterWrapper, ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId, ParameterWrapper *parameterWrapper,
const ParameterWrapper *newValues, uint16_t startAtIndex); const ParameterWrapper *newValues, uint16_t startAtIndex) override;
private: private:
uint8_t oldFuseState; uint8_t oldFuseState;
@ -81,7 +81,7 @@ class Fuse : public SystemObject,
template <typename... Args> template <typename... Args>
PowerMonitor(Args... args) : MonitorReporter<float>(std::forward<Args>(args)...) {} PowerMonitor(Args... args) : MonitorReporter<float>(std::forward<Args>(args)...) {}
ReturnValue_t checkPower(float sample, float lowerLimit, float upperLimit); ReturnValue_t checkPower(float sample, float lowerLimit, float upperLimit);
void sendTransitionEvent(float currentValue, ReturnValue_t state) {} void sendTransitionEvent(float currentValue, ReturnValue_t state_) override {}
}; };
PowerMonitor powerMonitor; PowerMonitor powerMonitor;
StaticLocalDataSet<3> set; StaticLocalDataSet<3> set;

@ -10,15 +10,15 @@ class PowerComponent : public PowerComponentIF {
PowerComponent(object_id_t setId, uint8_t moduleId, float minPower, float maxPower, PowerComponent(object_id_t setId, uint8_t moduleId, float minPower, float maxPower,
uint8_t switchId1, bool twoSwitches = false, uint8_t switchId2 = 0xFF); uint8_t switchId1, bool twoSwitches = false, uint8_t switchId2 = 0xFF);
virtual object_id_t getDeviceObjectId(); object_id_t getDeviceObjectId() override;
virtual uint8_t getSwitchId1(); uint8_t getSwitchId1() override;
virtual uint8_t getSwitchId2(); uint8_t getSwitchId2() override;
bool hasTwoSwitches(); bool hasTwoSwitches() override;
float getMin(); float getMin() override;
float getMax(); float getMax() override;
ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize, ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize,
Endianness streamEndianness) const override; Endianness streamEndianness) const override;
@ -29,7 +29,7 @@ class PowerComponent : public PowerComponentIF {
Endianness streamEndianness) override; Endianness streamEndianness) override;
ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId, ParameterWrapper* parameterWrapper, ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId, ParameterWrapper* parameterWrapper,
const ParameterWrapper* newValues, uint16_t startAtIndex); const ParameterWrapper* newValues, uint16_t startAtIndex) override;
private: private:
const object_id_t deviceObjectId = objects::NO_OBJECT; const object_id_t deviceObjectId = objects::NO_OBJECT;

@ -7,7 +7,7 @@
class PowerComponentIF : public SerializeIF, public HasParametersIF { class PowerComponentIF : public SerializeIF, public HasParametersIF {
public: public:
virtual ~PowerComponentIF() {} ~PowerComponentIF() override = default;
virtual object_id_t getDeviceObjectId() = 0; virtual object_id_t getDeviceObjectId() = 0;

@ -615,23 +615,23 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::handleInvalidD
template <size_t MAX_NUM_TCS> template <size_t MAX_NUM_TCS>
inline void Service11TelecommandScheduling<MAX_NUM_TCS>::debugPrintMultimapContent() const { inline void Service11TelecommandScheduling<MAX_NUM_TCS>::debugPrintMultimapContent() const {
for ([[maybe_unused]] const auto &dit : telecommandMap) {
#if FSFW_DISABLE_PRINTOUT == 0 #if FSFW_DISABLE_PRINTOUT == 0
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::debug << "Service11TelecommandScheduling::debugPrintMultimapContent: Multimap Content" sif::debug << "Service11TelecommandScheduling::debugPrintMultimapContent: Multimap Content"
<< std::endl; << std::endl;
#else
sif::printDebug("Service11TelecommandScheduling::debugPrintMultimapContent: Multimap Content\n");
#endif
for (const auto &dit : telecommandMap) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::debug << "[" << dit.first << "]: Request ID: " << dit.second.requestId << " | " sif::debug << "[" << dit.first << "]: Request ID: " << dit.second.requestId << " | "
<< "Store Address: " << dit.second.storeAddr.raw << std::endl; << "Store Address: " << dit.second.storeAddr.raw << std::endl;
#else #else
sif::printDebug( sif::printDebug("[%d]: Request ID: %d | Store Address: %d\n", dit.first, dit.second.requestId,
"Service11TelecommandScheduling::debugPrintMultimapContent: Multimap Content\n"); dit.second.storeAddr);
for (auto dit = telecommandMap.begin(); dit != telecommandMap.end(); ++dit) {
sif::printDebug("[%d]: Request ID: %d | Store Address: %d\n", dit->first,
dit->second.requestId, dit->second.storeAddr);
}
#endif
#endif #endif
} }
#endif
} }
template <size_t MAX_NUM_TCS> template <size_t MAX_NUM_TCS>

@ -69,7 +69,7 @@ class FailureReport : public SerializeIF { //!< [EXPORT] : [SUBSERVICE] 2, 4, 6
return result; return result;
} }
virtual size_t getSerializedSize() const { size_t getSerializedSize() const override {
size_t size = 0; size_t size = 0;
size += SerializeAdapter::getSerializedSize(&packetId); size += SerializeAdapter::getSerializedSize(&packetId);
size += sizeof(packetSequenceControl); size += sizeof(packetSequenceControl);

@ -34,7 +34,7 @@ class SerializeIF {
static const ReturnValue_t TOO_MANY_ELEMENTS = static const ReturnValue_t TOO_MANY_ELEMENTS =
MAKE_RETURN_CODE(3); // !< There are too many elements to be deserialized MAKE_RETURN_CODE(3); // !< There are too many elements to be deserialized
virtual ~SerializeIF() {} virtual ~SerializeIF() = default;
/** /**
* @brief * @brief
* Function to serialize the object into a buffer with maxSize. Size represents the written * Function to serialize the object into a buffer with maxSize. Size represents the written
@ -66,7 +66,7 @@ class SerializeIF {
* Gets the size of a object if it would be serialized in a buffer * Gets the size of a object if it would be serialized in a buffer
* @return Size of serialized object * @return Size of serialized object
*/ */
virtual size_t getSerializedSize() const = 0; [[nodiscard]] virtual size_t getSerializedSize() const = 0;
/** /**
* @brief * @brief

@ -10,15 +10,15 @@ StorageAccessor::StorageAccessor(store_address_t storeId) : ConstStorageAccessor
StorageAccessor::StorageAccessor(store_address_t storeId, StorageManagerIF* store) StorageAccessor::StorageAccessor(store_address_t storeId, StorageManagerIF* store)
: ConstStorageAccessor(storeId, store) {} : ConstStorageAccessor(storeId, store) {}
StorageAccessor& StorageAccessor::operator=(StorageAccessor&& other) { StorageAccessor& StorageAccessor::operator=(StorageAccessor&& other) noexcept {
// Call the parent move assignment and also assign own member. // Call the parent move assignment and also assign own member.
dataPointer = other.dataPointer; dataPointer = other.dataPointer;
StorageAccessor::operator=(std::move(other)); ConstStorageAccessor::operator=(std::move(other));
return *this; return *this;
} }
// Call the parent move ctor and also transfer own member. // Call the parent move ctor and also transfer own member.
StorageAccessor::StorageAccessor(StorageAccessor&& other) StorageAccessor::StorageAccessor(StorageAccessor&& other) noexcept
: ConstStorageAccessor(std::move(other)), dataPointer(other.dataPointer) {} : ConstStorageAccessor(std::move(other)), dataPointer(other.dataPointer) {}
ReturnValue_t StorageAccessor::getDataCopy(uint8_t* pointer, size_t maxSize) { ReturnValue_t StorageAccessor::getDataCopy(uint8_t* pointer, size_t maxSize) {

@ -14,7 +14,7 @@ class StorageAccessor : public ConstStorageAccessor {
friend class LocalPool; friend class LocalPool;
public: public:
StorageAccessor(store_address_t storeId); explicit StorageAccessor(store_address_t storeId);
StorageAccessor(store_address_t storeId, StorageManagerIF* store); StorageAccessor(store_address_t storeId, StorageManagerIF* store);
/** /**
@ -25,8 +25,8 @@ class StorageAccessor : public ConstStorageAccessor {
* @param * @param
* @return * @return
*/ */
StorageAccessor& operator=(StorageAccessor&&); StorageAccessor& operator=(StorageAccessor&&) noexcept;
StorageAccessor(StorageAccessor&&); StorageAccessor(StorageAccessor&&) noexcept;
ReturnValue_t write(uint8_t* data, size_t size, uint16_t offset = 0); ReturnValue_t write(uint8_t* data, size_t size, uint16_t offset = 0);
uint8_t* data(); uint8_t* data();

@ -1,2 +1,3 @@
target_sources(${LIB_FSFW_NAME} PRIVATE FixedSequenceSlot.cpp target_sources(
FixedSlotSequence.cpp) ${LIB_FSFW_NAME} PRIVATE FixedSequenceSlot.cpp FixedSlotSequence.cpp
PeriodicTaskBase.cpp FixedTimeslotTaskBase.cpp)

@ -29,7 +29,7 @@ void FixedSlotSequence::executeAndAdvance() {
uint32_t FixedSlotSequence::getIntervalToNextSlotMs() { uint32_t FixedSlotSequence::getIntervalToNextSlotMs() {
uint32_t oldTime; uint32_t oldTime;
SlotListIter slotListIter = current; auto slotListIter = current;
// Get the pollingTimeMs of the current slot object. // Get the pollingTimeMs of the current slot object.
oldTime = slotListIter->pollingTimeMs; oldTime = slotListIter->pollingTimeMs;
// Advance to the next object. // Advance to the next object.
@ -51,7 +51,7 @@ uint32_t FixedSlotSequence::getIntervalToNextSlotMs() {
uint32_t FixedSlotSequence::getIntervalToPreviousSlotMs() { uint32_t FixedSlotSequence::getIntervalToPreviousSlotMs() {
uint32_t currentTime; uint32_t currentTime;
SlotListIter slotListIter = current; auto slotListIter = current;
// Get the pollingTimeMs of the current slot object. // Get the pollingTimeMs of the current slot object.
currentTime = slotListIter->pollingTimeMs; currentTime = slotListIter->pollingTimeMs;
@ -67,7 +67,7 @@ uint32_t FixedSlotSequence::getIntervalToPreviousSlotMs() {
bool FixedSlotSequence::slotFollowsImmediately() { bool FixedSlotSequence::slotFollowsImmediately() {
uint32_t currentTime = current->pollingTimeMs; uint32_t currentTime = current->pollingTimeMs;
SlotListIter fixedSequenceIter = this->current; auto fixedSequenceIter = this->current;
// Get the pollingTimeMs of the current slot object. // Get the pollingTimeMs of the current slot object.
if (fixedSequenceIter == slotList.begin()) return false; if (fixedSequenceIter == slotList.begin()) return false;
fixedSequenceIter--; fixedSequenceIter--;
@ -96,8 +96,8 @@ ReturnValue_t FixedSlotSequence::checkSequence() const {
return FixedTimeslotTaskIF::SLOT_LIST_EMPTY; return FixedTimeslotTaskIF::SLOT_LIST_EMPTY;
} }
if (customCheckFunction != nullptr) { if (customChecker != nullptr) {
ReturnValue_t result = customCheckFunction(slotList); ReturnValue_t result = customChecker(slotList, customCheckArgs);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
// Continue for now but print error output. // Continue for now but print error output.
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
@ -161,6 +161,9 @@ ReturnValue_t FixedSlotSequence::intializeSequenceAfterTaskCreation() const {
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
void FixedSlotSequence::addCustomCheck(ReturnValue_t (*customCheckFunction)(const SlotList&)) { void FixedSlotSequence::addCustomCheck(CustomCheckFunc customChecker_, void* checkerArgs_) {
this->customCheckFunction = customCheckFunction; customChecker = customChecker_;
customCheckArgs = checkerArgs_;
} }
bool FixedSlotSequence::isEmpty() const { return slotList.empty(); }

@ -30,12 +30,12 @@ class FixedSlotSequence {
public: public:
using SlotList = std::multiset<FixedSequenceSlot>; using SlotList = std::multiset<FixedSequenceSlot>;
using SlotListIter = std::multiset<FixedSequenceSlot>::iterator; using SlotListIter = std::multiset<FixedSequenceSlot>::iterator;
using CustomCheckFunc = ReturnValue_t (*)(const SlotList&, void* args);
/** /**
* @brief The constructor of the FixedSlotSequence object. * @brief The constructor of the FixedSlotSequence object.
* @param setLength The period length, expressed in ms. * @param setLength The period length, expressed in ms.
*/ */
FixedSlotSequence(uint32_t setLengthMs); explicit FixedSlotSequence(uint32_t setLengthMs);
/** /**
* @brief The destructor of the FixedSlotSequence object. * @brief The destructor of the FixedSlotSequence object.
@ -106,7 +106,7 @@ class FixedSlotSequence {
/** /**
* @brief This method returns the length of this FixedSlotSequence instance. * @brief This method returns the length of this FixedSlotSequence instance.
*/ */
uint32_t getLengthMs() const; [[nodiscard]] uint32_t getLengthMs() const;
/** /**
* @brief The method to execute the device handler entered in the current * @brief The method to execute the device handler entered in the current
@ -137,7 +137,7 @@ class FixedSlotSequence {
* @return * @return
* - SLOT_LIST_EMPTY if the slot list is empty * - SLOT_LIST_EMPTY if the slot list is empty
*/ */
ReturnValue_t checkSequence() const; [[nodiscard]] ReturnValue_t checkSequence() const;
/** /**
* @brief A custom check can be injected for the respective slot list. * @brief A custom check can be injected for the respective slot list.
@ -149,7 +149,7 @@ class FixedSlotSequence {
* @param customCheckFunction * @param customCheckFunction
* *
*/ */
void addCustomCheck(ReturnValue_t (*customCheckFunction)(const SlotList&)); void addCustomCheck(CustomCheckFunc func, void* userArgs);
/** /**
* @brief Perform any initialization steps required after the executing * @brief Perform any initialization steps required after the executing
@ -157,7 +157,9 @@ class FixedSlotSequence {
* executing task! * executing task!
* @return * @return
*/ */
ReturnValue_t intializeSequenceAfterTaskCreation() const; [[nodiscard]] ReturnValue_t intializeSequenceAfterTaskCreation() const;
[[nodiscard]] bool isEmpty() const;
protected: protected:
/** /**
@ -173,7 +175,8 @@ class FixedSlotSequence {
*/ */
SlotList slotList; SlotList slotList;
ReturnValue_t (*customCheckFunction)(const SlotList&) = nullptr; CustomCheckFunc customChecker = nullptr;
void* customCheckArgs = nullptr;
uint32_t lengthMs; uint32_t lengthMs;
}; };

@ -0,0 +1,27 @@
#include "FixedTimeslotTaskBase.h"
#include "fsfw/objectmanager/ObjectManager.h"
FixedTimeslotTaskBase::FixedTimeslotTaskBase(TaskPeriod period_,
TaskDeadlineMissedFunction dlmFunc_)
: period(period_), pollingSeqTable(getPeriodMs()), dlmFunc(dlmFunc_) {}
uint32_t FixedTimeslotTaskBase::getPeriodMs() const { return static_cast<uint32_t>(period * 1000); }
bool FixedTimeslotTaskBase::isEmpty() const { return pollingSeqTable.isEmpty(); }
ReturnValue_t FixedTimeslotTaskBase::checkSequence() { return pollingSeqTable.checkSequence(); }
ReturnValue_t FixedTimeslotTaskBase::addSlot(object_id_t execId, ExecutableObjectIF* execObj,
uint32_t slotTimeMs, int8_t executionStep) {
if (execObj == nullptr) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "Component 0x" << std::hex << std::setw(8) << std::setfill('0') << execObj
<< std::setfill(' ') << " 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");
#endif
return HasReturnvaluesIF::RETURN_FAILED;
}
pollingSeqTable.addSlot(execId, slotTimeMs, executionStep, execObj, this);
return HasReturnvaluesIF::RETURN_OK;
}

@ -0,0 +1,44 @@
#ifndef FSFW_EXAMPLE_HOSTED_FIXEDTIMESLOTTASKBASE_H
#define FSFW_EXAMPLE_HOSTED_FIXEDTIMESLOTTASKBASE_H
#include "FixedSlotSequence.h"
#include "FixedTimeslotTaskIF.h"
#include "definitions.h"
class FixedTimeslotTaskBase : public FixedTimeslotTaskIF {
public:
explicit FixedTimeslotTaskBase(TaskPeriod period, TaskDeadlineMissedFunction dlmFunc = nullptr);
~FixedTimeslotTaskBase() override = default;
;
protected:
/**
* @brief Period of task in floating point seconds
*/
TaskPeriod period;
//! Polling sequence table which contains the object to execute
//! and information like the timeslots and the passed execution step.
FixedSlotSequence pollingSeqTable;
/**
* @brief The pointer to the deadline-missed function.
* @details
* This pointer stores the function that is executed if the task's deadline
* is missed. So, each may react individually on a timing failure.
* The pointer may be NULL, then nothing happens on missing the deadline.
* The deadline is equal to the next execution of the periodic task.
*/
TaskDeadlineMissedFunction dlmFunc = nullptr;
ReturnValue_t checkSequence() override;
[[nodiscard]] uint32_t getPeriodMs() const override;
[[nodiscard]] bool isEmpty() const override;
ReturnValue_t addSlot(object_id_t execId, ExecutableObjectIF* componentId, uint32_t slotTimeMs,
int8_t executionStep) override;
};
#endif // FSFW_EXAMPLE_HOSTED_FIXEDTIMESLOTTASKBASE_H

@ -2,6 +2,7 @@
#define FRAMEWORK_TASKS_FIXEDTIMESLOTTASKIF_H_ #define FRAMEWORK_TASKS_FIXEDTIMESLOTTASKIF_H_
#include "PeriodicTaskIF.h" #include "PeriodicTaskIF.h"
#include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/objectmanager/ObjectManagerIF.h" #include "fsfw/objectmanager/ObjectManagerIF.h"
#include "fsfw/returnvalues/FwClassIds.h" #include "fsfw/returnvalues/FwClassIds.h"
@ -11,10 +12,23 @@
*/ */
class FixedTimeslotTaskIF : public PeriodicTaskIF { class FixedTimeslotTaskIF : public PeriodicTaskIF {
public: public:
virtual ~FixedTimeslotTaskIF() {} ~FixedTimeslotTaskIF() override = default;
static constexpr ReturnValue_t SLOT_LIST_EMPTY = static constexpr ReturnValue_t SLOT_LIST_EMPTY =
HasReturnvaluesIF::makeReturnCode(CLASS_ID::FIXED_SLOT_TASK_IF, 0); HasReturnvaluesIF::makeReturnCode(CLASS_ID::FIXED_SLOT_TASK_IF, 0);
/**
* 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
* code in #performOperation)
* @param componentId
* @param slotTimeMs
* @param executionStep
* @return
*/
virtual ReturnValue_t addSlot(object_id_t execId, ExecutableObjectIF* obj, uint32_t slotTimeMs,
int8_t executionStep) = 0;
/** /**
* 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
@ -25,12 +39,24 @@ class FixedTimeslotTaskIF : public PeriodicTaskIF {
* @return * @return
*/ */
virtual ReturnValue_t addSlot(object_id_t componentId, 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() const = 0; virtual ReturnValue_t checkSequence() = 0;
ReturnValue_t addComponent(object_id_t object, uint8_t opCode) override {
return HasReturnvaluesIF::RETURN_FAILED;
}
ReturnValue_t addComponent(ExecutableObjectIF* object, uint8_t opCode) override {
return HasReturnvaluesIF::RETURN_FAILED;
}
}; };
#endif /* FRAMEWORK_TASKS_FIXEDTIMESLOTTASKIF_H_ */ #endif /* FRAMEWORK_TASKS_FIXEDTIMESLOTTASKIF_H_ */

@ -0,0 +1,71 @@
#include "PeriodicTaskBase.h"
#include <set>
#include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/serviceinterface.h"
PeriodicTaskBase::PeriodicTaskBase(TaskPeriod period_, TaskDeadlineMissedFunction dlmFunc_)
: period(period_), dlmFunc(dlmFunc_) {
// Hints at configuration error
if (PeriodicTaskBase::getPeriodMs() <= 1) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "Passed task period 0 or smaller than 1 ms" << std::endl;
#else
sif::printWarning("Passed task period 0 or smaller than 1ms\n");
#endif
}
}
uint32_t PeriodicTaskBase::getPeriodMs() const { return static_cast<uint32_t>(period * 1000); }
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() {
std::set<ExecutableObjectIF*> uniqueObjects;
ReturnValue_t status = HasReturnvaluesIF::RETURN_OK;
uint32_t count = 0;
for (const auto& obj : objectList) {
// Ensure that each unique object is initialized once.
if (uniqueObjects.find(obj.first) == uniqueObjects.end()) {
ReturnValue_t result = obj.first->initializeAfterTaskCreation();
if (result != HasReturnvaluesIF::RETURN_OK) {
count++;
status = result;
}
uniqueObjects.emplace(obj.first);
}
}
if (count > 0) {
}
return status;
}
ReturnValue_t PeriodicTaskBase::addComponent(object_id_t object, uint8_t opCode) {
auto* newObject = ObjectManager::instance()->get<ExecutableObjectIF>(object);
return addComponent(newObject, opCode);
}
ReturnValue_t PeriodicTaskBase::addComponent(ExecutableObjectIF* object, uint8_t opCode) {
if (object == nullptr) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "PeriodicTask::addComponent: Invalid object. Make sure"
<< " it implements ExecutableObjectIF!" << std::endl;
#else
sif::printError(
"PeriodicTask::addComponent: Invalid object. Make sure it "
"implements ExecutableObjectIF!\n");
#endif
return HasReturnvaluesIF::RETURN_FAILED;
}
objectList.push_back({object, opCode});
object->setTaskIF(this);
return HasReturnvaluesIF::RETURN_OK;
}

@ -0,0 +1,54 @@
#ifndef FSFW_SRC_FSFW_TASKS_PERIODICTASKBASE_H_
#define FSFW_SRC_FSFW_TASKS_PERIODICTASKBASE_H_
#include <cstdint>
#include <vector>
#include "fsfw/tasks/PeriodicTaskIF.h"
#include "fsfw/tasks/definitions.h"
class ExecutableObjectIF;
class PeriodicTaskBase : public PeriodicTaskIF {
public:
explicit PeriodicTaskBase(TaskPeriod period,
TaskDeadlineMissedFunction deadlineMissedFunc = nullptr);
ReturnValue_t addComponent(object_id_t object, uint8_t opCode) override;
ReturnValue_t addComponent(ExecutableObjectIF* object, uint8_t opCode) override;
ReturnValue_t addComponent(object_id_t object) override;
ReturnValue_t addComponent(ExecutableObjectIF* object) override;
[[nodiscard]] uint32_t getPeriodMs() const override;
[[nodiscard]] bool isEmpty() const override;
ReturnValue_t initObjsAfterTaskCreation();
protected:
//! Typedef for the List of objects. Will contain the objects to execute and their respective
//! operation codes
using ObjectList = std::vector<std::pair<ExecutableObjectIF*, uint8_t>>;
/**
* @brief This attribute holds a list of objects to be executed.
*/
ObjectList objectList;
/**
* @brief Period of task in floating point seconds
*/
TaskPeriod period;
/**
* @brief The pointer to the deadline-missed function.
* @details
* This pointer stores the function that is executed if the task's deadline
* is missed. So, each may react individually on a timing failure.
* The pointer may be NULL, then nothing happens on missing the deadline.
* The deadline is equal to the next execution of the periodic task.
*/
TaskDeadlineMissedFunction dlmFunc = nullptr;
};
#endif /* FSFW_SRC_FSFW_TASKS_PERIODICTASKBASE_H_ */

@ -3,9 +3,8 @@
#include <cstddef> #include <cstddef>
#include "../objectmanager/SystemObjectIF.h" #include "fsfw/objectmanager/SystemObjectIF.h"
#include "../timemanager/Clock.h" #include "fsfw/tasks/ExecutableObjectIF.h"
class ExecutableObjectIF;
/** /**
* New version of TaskIF * New version of TaskIF
@ -18,7 +17,7 @@ class PeriodicTaskIF {
/** /**
* @brief A virtual destructor as it is mandatory for interfaces. * @brief A virtual destructor as it is mandatory for interfaces.
*/ */
virtual ~PeriodicTaskIF() {} virtual ~PeriodicTaskIF() = default;
/** /**
* @brief With the startTask method, a created task can be started * @brief With the startTask method, a created task can be started
* for the first time. * for the first time.
@ -26,28 +25,29 @@ class PeriodicTaskIF {
virtual ReturnValue_t startTask() = 0; virtual ReturnValue_t startTask() = 0;
/** /**
* Add a component (object) to a periodic task. * Adds an object to the list of objects to be executed.
* @param object * The objects are executed in the order added. The object needs to implement
* Add an object to the task. The object needs to implement ExecutableObjectIF * ExecutableObjectIF
* @return * @param object Id of the object to add.
* @return RETURN_OK on success, RETURN_FAILED if the object could not be added.
*/ */
virtual ReturnValue_t addComponent(object_id_t object) { 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); };
};
/** /**
* Add an object to a periodic task. * Adds an object to the list of objects to be executed.
* @param object * The objects are executed in the order added.
* Add an object to the task. * @param object pointer to the object to add.
* @return * @return RETURN_OK on success, RETURN_FAILED if the object could not be added.
*/ */
virtual ReturnValue_t addComponent(ExecutableObjectIF* object) { 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 sleepFor(uint32_t ms) = 0; virtual ReturnValue_t sleepFor(uint32_t ms) = 0;
virtual uint32_t getPeriodMs() const = 0; [[nodiscard]] virtual uint32_t getPeriodMs() const = 0;
[[nodiscard]] virtual bool isEmpty() const = 0;
}; };
#endif /* PERIODICTASKIF_H_ */ #endif /* FRAMEWORK_TASK_PERIODICTASKIF_H_ */

@ -4,7 +4,7 @@
#include <cstdlib> #include <cstdlib>
#include "FixedTimeslotTaskIF.h" #include "FixedTimeslotTaskIF.h"
#include "Typedef.h" #include "definitions.h"
/** /**
* Singleton Class that produces Tasks. * Singleton Class that produces Tasks.

Some files were not shown because too many files have changed in this diff Show More