diff --git a/.run/fsfw-tests_coverage.run.xml b/.run/fsfw-tests_coverage.run.xml
deleted file mode 100644
index 49d9b135..00000000
--- a/.run/fsfw-tests_coverage.run.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.run/fsfw.run.xml b/.run/fsfw.run.xml
deleted file mode 100644
index 72f74939..00000000
--- a/.run/fsfw.run.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9ba6d754..341a8966 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,7 +8,61 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
# [unreleased]
-# [v5.0.0]
+# [v6.0.0]
+
+## Fixes
+
+- I2C Bugfixes: Do not keep iterator as member and fix some incorrect handling with the iterator.
+ Also properly reset the reply size for successfull transfers and erroneous transfers.
+ PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/700
+- Bugfix for Serial Buffer Stream: Setting `doActive` to false now
+ actually fully disables printing.
+ PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/680
+- `TcpTmTcServer.cpp`: The server was actually not able to handle
+ CCSDS packets which were clumped together. This has been fixed now.
+ PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/673
+
+## Added
+
+- Add new `UnsignedByteField` class
+ PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/660
+
+## Changes
+
+- Remove default secondary header argument for
+ `uint16_t getTcSpacePacketIdFromApid(uint16_t apid, bool secondaryHeaderFlag)` and
+ `uint16_t getTmSpacePacketIdFromApid(uint16_t apid, bool secondaryHeaderFlag)`
+ PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/689
+- Removed `HasReturnvaluesIF` class in favor of `returnvalue` namespace with `OK` and `FAILED`
+ constants.
+ PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/659
+- Overhaul of the TMTC stack, including various changes and improvements
+ for other modules
+ PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/655
+ which also includes a migration guide
+- Bump Catch2 dependency to regular version `v3.1.0`
+ PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/678
+- `SerialBufferAdapter`: Rename `setBuffer` to `setConstBuffer` and update
+ API to expect `const uint8_t*` accordingly.
+ PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/677
+- Remove the following user includes from `fsfw/events/Event.h` and
+ `fsfw/returnvalues/returnvalue.h`:
+ - `#include "events/subsystemIdRanges.h"`
+ - `#include "returnvalues/classIds.h"`
+ The user has to include those themselves now
+ PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/675
+- `DeviceHandlerBase`: Set command sender before calling `buildCommandFromCommand`.
+ This allows finishing action commands immediately inside the function.
+ PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/672
+- `DeviceHandlerBase`: New signature of `handleDeviceTm` which expects
+ a `const SerializeIF&` and additional helper variant which expects `const uint8_t*`
+ PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/671
+- Improvements for `AcceptsTelemetryIF` and `AcceptsTelecommandsIF`:
+ - Make functions `const` where it makes sense
+ - Add `const char* getName const` abstract function
+ PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/684
+
+# [v5.0.0] 25.07.2022
## Changes
@@ -19,16 +73,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Bump C++ required version to C++17. Every project which uses the FSFW and every modern
compiler supports it
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/622
-- HAL Linux SPI: Set the Clock Default State when setting new SPI speed
- and mode
- PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/573
-- GPIO HAL: `Direction`, `GpioOperation` and `Levels` are enum classes now, which prevents
- name clashes with Windows defines.
- PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/572
- New CMake option `FSFW_HAL_LINUX_ADD_LIBGPIOD` to specifically exclude `gpiod` code.
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/572
- HAL Devicehandlers: Periodic printout is run-time configurable now
- `oneShotAction` flag in the `TestTask` class is not static anymore
+- `SimpleRingBuffer::writeData` now checks if the amount is larger than the total size of the
+ Buffer and rejects such writeData calls with `returnvalue::FAILED`
+ PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/586
- Major update for version handling, using `git describe` to fetch version information with git.
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/601
- Add helper functions provided by [`cmake-modules`](https://github.com/bilke/cmake-modules)
@@ -46,6 +97,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
creation call. It allows passing context information and an arbitrary user argument into
the message queue. Also streamlined and simplified `MessageQueue` implementation for all OSALs
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/583
+- Internal API change: Moved the `fsfw_hal` to the `src` folder and integration and internal
+ tests part of `fsfw_tests` to `src`. Unittests are now in a dedicated folder called `unittests`
+ PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/653
### Task Module Refactoring
@@ -120,6 +174,8 @@ https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/593
## Additions
+- New constructor for PoolEntry which allows to simply specify the length of the pool entry.
+ This is also the new default constructor for scalar value with 0 as an initial value
- 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
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d8163f3e..e2572b20 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -13,7 +13,7 @@ list(APPEND CMAKE_MODULE_PATH
# Version file handling #
# ##############################################################################
-set(FSFW_VERSION_IF_GIT_FAILS 4)
+set(FSFW_VERSION_IF_GIT_FAILS 5)
set(FSFW_SUBVERSION_IF_GIT_FAILS 0)
set(FSFW_REVISION_IF_GIT_FAILS 0)
@@ -67,6 +67,7 @@ endif()
set(FSFW_SOURCES_DIR "${CMAKE_SOURCE_DIR}/src/fsfw")
set(FSFW_ETL_LIB_NAME etl)
+set(FSFW_ETL_LINK_TARGET etl::etl)
set(FSFW_ETL_LIB_MAJOR_VERSION
20
CACHE STRING "ETL library major version requirement")
@@ -79,7 +80,7 @@ set(FSFW_CATCH2_LIB_MAJOR_VERSION
3
CACHE STRING "Catch2 library major version requirement")
set(FSFW_CATCH2_LIB_VERSION
- v${FSFW_CATCH2_LIB_MAJOR_VERSION}.0.0-preview5
+ v${FSFW_CATCH2_LIB_MAJOR_VERSION}.1.0
CACHE STRING "Catch2 library exact version requirement")
# Keep this off by default for now. See PR:
@@ -103,11 +104,11 @@ if(FSFW_GENERATE_SECTIONS)
option(FSFW_REMOVE_UNUSED_CODE "Remove unused code" ON)
endif()
-option(FSFW_BUILD_UNITTESTS
- "Build unittest binary in addition to static library" OFF)
+option(FSFW_BUILD_TESTS "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)
-if(FSFW_BUILD_UNITTESTS)
+if(FSFW_BUILD_TESTS)
option(FSFW_TESTS_GEN_COV "Generate coverage data for unittests" ON)
endif()
@@ -117,6 +118,12 @@ option(FSFW_ADD_INTERNAL_TESTS "Add internal unit tests" ON)
option(FSFW_ADD_UNITTESTS "Add regular unittests. Requires Catch2" OFF)
option(FSFW_ADD_HAL "Add Hardware Abstraction Layer" ON)
+if(UNIX)
+ option(FSFW_HAL_LINUX_ADD_PERIPHERAL_DRIVERS "Add Linux peripheral drivers"
+ OFF)
+ option(FSFW_HAL_LINUX_ADD_LIBGPIOD "Attempt to add Linux GPIOD drivers" OFF)
+endif()
+
# Optional sources
option(FSFW_ADD_PUS "Compile with PUS sources" ON)
option(FSFW_ADD_MONITORING "Compile with monitoring components" ON)
@@ -139,7 +146,7 @@ if(IPO_SUPPORTED AND FSFW_ENABLE_IPO)
TRUE)
endif()
-if(FSFW_BUILD_UNITTESTS)
+if(FSFW_BUILD_TESTS)
message(
STATUS
"${MSG_PREFIX} Building the FSFW unittests in addition to the static library"
@@ -162,10 +169,9 @@ if(FSFW_BUILD_UNITTESTS)
list(APPEND FSFW_FETCH_CONTENT_TARGETS Catch2)
endif()
- set(FSFW_CONFIG_PATH tests/src/fsfw_tests/unit/testcfg)
- configure_file(tests/src/fsfw_tests/unit/testcfg/FSFWConfig.h.in FSFWConfig.h)
- configure_file(tests/src/fsfw_tests/unit/testcfg/TestsConfig.h.in
- tests/TestsConfig.h)
+ set(FSFW_CONFIG_PATH unittests/testcfg)
+ configure_file(unittests/testcfg/FSFWConfig.h.in FSFWConfig.h)
+ configure_file(unittests/testcfg/TestsConfig.h.in tests/TestsConfig.h)
project(${FSFW_TEST_TGT} CXX C)
add_executable(${FSFW_TEST_TGT})
@@ -183,7 +189,10 @@ if(FSFW_BUILD_UNITTESTS)
endif()
endif()
-message(STATUS "${MSG_PREFIX} Finding and/or providing ETL library")
+message(
+ STATUS
+ "${MSG_PREFIX} Finding and/or providing etl library with version ${FSFW_ETL_LIB_MAJOR_VERSION}"
+)
# Check whether the user has already installed ETL first
find_package(${FSFW_ETL_LIB_NAME} ${FSFW_ETL_LIB_MAJOR_VERSION} QUIET)
@@ -191,7 +200,7 @@ find_package(${FSFW_ETL_LIB_NAME} ${FSFW_ETL_LIB_MAJOR_VERSION} QUIET)
if(NOT ${FSFW_ETL_LIB_NAME}_FOUND)
message(
STATUS
- "No ETL installation was found with find_package. Installing and providing "
+ "${MSG_PREFIX} No ETL installation was found with find_package. Installing and providing "
"etl with FindPackage")
include(FetchContent)
@@ -281,16 +290,15 @@ message(
)
add_subdirectory(src)
-add_subdirectory(tests)
-if(FSFW_ADD_HAL)
- add_subdirectory(hal)
-endif()
add_subdirectory(contrib)
+if(FSFW_BUILD_TESTS)
+ add_subdirectory(unittests)
+endif()
if(FSFW_BUILD_DOCS)
add_subdirectory(docs)
endif()
-if(FSFW_BUILD_UNITTESTS)
+if(FSFW_BUILD_TESTS)
if(FSFW_TESTS_GEN_COV)
if(CMAKE_COMPILER_IS_GNUCXX)
include(CodeCoverage)
@@ -318,7 +326,8 @@ if(FSFW_BUILD_UNITTESTS)
"/usr/local/include/*"
"*/fsfw_tests/*"
"*/catch2-src/*"
- "*/fsfw_hal/*")
+ "*/fsfw_hal/*"
+ "unittests/*")
endif()
target_link_options(${FSFW_TEST_TGT} PRIVATE -fprofile-arcs
@@ -337,7 +346,8 @@ if(FSFW_BUILD_UNITTESTS)
else()
setup_target_for_coverage_lcov(
NAME ${FSFW_TEST_TGT}_coverage EXECUTABLE ${FSFW_TEST_TGT}
- DEPENDENCIES ${FSFW_TEST_TGT})
+ DEPENDENCIES ${FSFW_TEST_TGT}
+ GENHTML_ARGS --html-epilog ${CMAKE_SOURCE_DIR}/unittests/lcov_epilog.html)
endif()
endif()
endif()
@@ -352,7 +362,8 @@ if(NOT FSFW_CONFIG_PATH)
if(NOT FSFW_BUILD_DOCS)
message(
WARNING
- "${MSG_PREFIX} Flight Software Framework configuration path not set")
+ "${MSG_PREFIX} Flight Software Framework configuration path FSFW_CONFIG_PATH not set"
+ )
message(
WARNING
"${MSG_PREFIX} Setting default configuration from ${DEF_CONF_PATH} ..")
@@ -447,8 +458,8 @@ target_include_directories(
target_compile_options(${LIB_FSFW_NAME} PRIVATE ${FSFW_WARNING_FLAGS}
${COMPILER_FLAGS})
-target_link_libraries(${LIB_FSFW_NAME} PRIVATE ${FSFW_ETL_LINK_TARGET}
- ${FSFW_ADDITIONAL_LINK_LIBS})
+target_link_libraries(${LIB_FSFW_NAME} PRIVATE ${FSFW_ADDITIONAL_LINK_LIBS})
+target_link_libraries(${LIB_FSFW_NAME} PUBLIC ${FSFW_ETL_LINK_TARGET})
string(
CONCAT
diff --git a/README.md b/README.md
index 8d611c57..7094e5dc 100644
--- a/README.md
+++ b/README.md
@@ -132,14 +132,14 @@ You can use the following commands inside the `fsfw` folder to set up the build
```sh
mkdir build-tests && cd build-tests
-cmake -DFSFW_BUILD_UNITTESTS=ON -DFSFW_OSAL=host -DCMAKE_BUILD_TYPE=Debug ..
+cmake -DFSFW_BUILD_TESTS=ON -DFSFW_OSAL=host -DCMAKE_BUILD_TYPE=Debug ..
```
You can also use `-DFSFW_OSAL=linux` on Linux systems.
Coverage data in HTML format can be generated using the `CodeCoverage`
[CMake module](https://github.com/bilke/cmake-modules/tree/master).
-To build the unittests, run them and then generare the coverage data in this format,
+To build the unittests, run them and then generate the coverage data in this format,
the following command can be used inside the build directory after the build system was set up
```sh
@@ -175,7 +175,7 @@ cmake -DFSFW_BUILD_DOCS=ON -DFSFW_OSAL=host ..
Then you can generate the documentation using
```sh
-cmake --build . -j
+cmake --build . -- Sphinx -j
```
You can find the generated documentation inside the `docs/sphinx` folder inside the build
@@ -188,7 +188,10 @@ and open the documentation conveniently. Try `helper.py -h for more information.
The formatting is done by the `clang-format` tool. The configuration is contained within the
`.clang-format` file in the repository root. As long as `clang-format` is installed, you
-can run the `apply-clang-format.sh` helper script to format all source files consistently.
+can run the `auto-format.sh` helper script to format all source files consistently. Furthermore cmake-format is required to format CMake files which can be installed with:
+````sh
+sudo pip install cmakelang
+````
## Index
diff --git a/automation/Dockerfile b/automation/Dockerfile
index 0eb98fbb..1bd39b3f 100644
--- a/automation/Dockerfile
+++ b/automation/Dockerfile
@@ -5,10 +5,25 @@ RUN apt-get --yes upgrade
#tzdata is a dependency, won't install otherwise
ARG DEBIAN_FRONTEND=noninteractive
-RUN apt-get --yes install gcc g++ cmake make lcov git valgrind nano iputils-ping
+RUN apt-get --yes install gcc g++ cmake make lcov git valgrind nano iputils-ping python3 pip doxygen graphviz rsync
+
+RUN python3 -m pip install sphinx breathe
RUN git clone https://github.com/catchorg/Catch2.git && \
- cd Catch2 && \
- git checkout v3.0.0-preview5 && \
- cmake -Bbuild -H. -DBUILD_TESTING=OFF && \
- cmake --build build/ --target install
+ cd Catch2 && \
+ git checkout v3.1.0 && \
+ cmake -Bbuild -H. -DBUILD_TESTING=OFF && \
+ cmake --build build/ --target install
+
+RUN git clone https://github.com/ETLCPP/etl.git && \
+ cd etl && \
+ git checkout 20.28.0 && \
+ cmake -B build . && \
+ cmake --install build/
+
+#ssh needs a valid user to work
+RUN adduser --uid 114 jenkins
+
+#add documentation server to known hosts
+RUN echo "|1|/LzCV4BuTmTb2wKnD146l9fTKgQ=|NJJtVjvWbtRt8OYqFgcYRnMQyVw= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNL8ssTonYtgiR/6RRlSIK9WU1ywOcJmxFTLcEblAwH7oifZzmYq3XRfwXrgfMpylEfMFYfCU8JRqtmi19xc21A=" >> /etc/ssh/ssh_known_hosts
+RUN echo "|1|CcBvBc3EG03G+XM5rqRHs6gK/Gg=|oGeJQ+1I8NGI2THIkJsW92DpTzs= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNL8ssTonYtgiR/6RRlSIK9WU1ywOcJmxFTLcEblAwH7oifZzmYq3XRfwXrgfMpylEfMFYfCU8JRqtmi19xc21A=" >> /etc/ssh/ssh_known_hosts
\ No newline at end of file
diff --git a/automation/Jenkinsfile b/automation/Jenkinsfile
index 798b6b1a..27136606 100644
--- a/automation/Jenkinsfile
+++ b/automation/Jenkinsfile
@@ -1,9 +1,13 @@
pipeline {
environment {
- BUILDDIR = 'build-tests'
+ BUILDDIR = 'cmake-build-tests'
+ DOCDDIR = 'cmake-build-documentation'
}
agent {
- docker { image 'fsfw-ci:d2'}
+ docker {
+ image 'fsfw-ci:d6'
+ args '--network host'
+ }
}
stages {
stage('Clean') {
@@ -14,7 +18,7 @@ pipeline {
stage('Configure') {
steps {
dir(BUILDDIR) {
- sh 'cmake -DFSFW_OSAL=host -DFSFW_BUILD_UNITTESTS=ON -DFSFW_CICD_BUILD=ON ..'
+ sh 'cmake -DFSFW_OSAL=host -DFSFW_BUILD_TESTS=ON -DFSFW_CICD_BUILD=ON ..'
}
}
}
@@ -39,5 +43,43 @@ pipeline {
}
}
}
+ stage('Documentation') {
+ when {
+ branch 'development'
+ }
+ steps {
+ dir(DOCDDIR) {
+ sh 'cmake -DFSFW_BUILD_DOCS=ON -DFSFW_OSAL=host ..'
+ sh 'make Sphinx'
+ sshagent(credentials: ['documentation-buildfix']) {
+ sh 'rsync -r --delete docs/sphinx/* buildfix@documentation.irs.uni-stuttgart.de:/fsfw/development'
+ }
+ }
+ dir(BUILDDIR) {
+ sshagent(credentials: ['documentation-buildfix']) {
+ sh 'rsync -r --delete fsfw-tests_coverage/* buildfix@documentation.irs.uni-stuttgart.de:/fsfw/coverage/development'
+ }
+ }
+ }
+ }
+ stage('Master Documentation') {
+ when {
+ branch 'master'
+ }
+ steps {
+ dir(DOCDDIR) {
+ sh 'cmake -DFSFW_BUILD_DOCS=ON -DFSFW_OSAL=host ..'
+ sh 'make Sphinx'
+ sshagent(credentials: ['documentation-buildfix']) {
+ sh 'rsync -r --delete docs/sphinx/* buildfix@documentation.irs.uni-stuttgart.de:/fsfw/master'
+ }
+ }
+ dir(BUILDDIR) {
+ sshagent(credentials: ['documentation-buildfix']) {
+ sh 'rsync -r --delete fsfw-tests_coverage/* buildfix@documentation.irs.uni-stuttgart.de:/fsfw/coverage/master'
+ }
+ }
+ }
+ }
}
}
diff --git a/docs/README-config.md b/docs/README-config.md
deleted file mode 100644
index d71feb97..00000000
--- a/docs/README-config.md
+++ /dev/null
@@ -1,40 +0,0 @@
-Configuring the FSFW
-======
-
-The FSFW can be configured via the `fsfwconfig` folder. A template folder has
-been provided to have a starting point for this. The folder should be added
-to the include path. The primary configuration file is the `FSFWConfig.h` folder. Some
-of the available options will be explained in more detail here.
-
-# Auto-Translation of Events
-
-The FSFW allows the automatic translation of events, which allows developers to track triggered
-events directly via console output. Using this feature requires:
-
-1. `FSFW_OBJ_EVENT_TRANSLATION` set to 1 in the configuration file.
-2. Special auto-generated translation files which translate event IDs and object IDs into
- human readable strings. These files can be generated using the
- [modgen Python scripts](https://git.ksat-stuttgart.de/source/modgen.git).
-3. The generated translation files for the object IDs should be named `translatesObjects.cpp`
- and `translateObjects.h` and should be copied to the `fsfwconfig/objects` folder
-4. The generated translation files for the event IDs should be named `translateEvents.cpp` and
- `translateEvents.h` and should be copied to the `fsfwconfig/events` folder
-
-An example implementations of these translation file generators can be found as part
-of the [SOURCE project here](https://git.ksat-stuttgart.de/source/sourceobsw/-/tree/development/generators)
-or the [FSFW example](https://egit.irs.uni-stuttgart.de/fsfw/fsfw_example_public/src/branch/master/generators)
-
-## Configuring the Event Manager
-
-The number of allowed subscriptions can be modified with the following
-parameters:
-
-``` c++
-namespace fsfwconfig {
-//! Configure the allocated pool sizes for the event manager.
-static constexpr size_t FSFW_EVENTMGMR_MATCHTREE_NODES = 240;
-static constexpr size_t FSFW_EVENTMGMT_EVENTIDMATCHERS = 120;
-static constexpr size_t FSFW_EVENTMGMR_RANGEMATCHERS = 120;
-}
-```
-
diff --git a/docs/README-controllers.md b/docs/README-controllers.md
deleted file mode 100644
index 7af0652d..00000000
--- a/docs/README-controllers.md
+++ /dev/null
@@ -1 +0,0 @@
-## Controllers
diff --git a/docs/README-core.md b/docs/README-core.md
deleted file mode 100644
index e34890ae..00000000
--- a/docs/README-core.md
+++ /dev/null
@@ -1,55 +0,0 @@
-## FSFW Core Modules
-
-These core modules provide the most important functionalities of the
-Flight Software Framework
-
-### Clock
-
- * This is a class of static functions that can be used at anytime
- * Leap Seconds must be set if any time conversions from UTC to other times is used
-
-### ObjectManager
-
-* Must be created during program startup
-* The component which handles all references. All SystemObjects register at this component.
-* Any SystemObject needs to have a unique ObjectId. Those can be managed like objects::framework_objects.
-* A reference to an object can be get by calling the following function. T must be the specific Interface you want to call.
-A nullptr check of the returning Pointer must be done. This function is based on Run-time type information.
-
-```cpp
-template T* ObjectManagerIF::get( object_id_t id )
-```
-* A typical way to create all objects on startup is a handing a static produce function to the
- ObjectManager on creation. By calling objectManager->initialize() the produce function will be
- called and all SystemObjects will be initialized afterwards.
-
-### Event Manager
-
-* Component which allows routing of events
-* Other objects can subscribe to specific events, ranges of events or all events of an object.
-* Subscriptions can be done during runtime but should be done during initialization
-* Amounts of allowed subscriptions can be configured in `FSFWConfig.h`
-
-### Health Table
-
-* A component which holds every health state
-* Provides a thread safe way to access all health states without the need of message exchanges
-
-### Stores
-
-* The message based communication can only exchange a few bytes of information inside the message
- itself. Therefore, additional information can be exchanged with Stores. With this, only the
- store address must be exchanged in the message.
-* Internally, the FSFW uses an IPC Store to exchange data between processes. For incoming TCs a TC
- Store is used. For outgoing TM a TM store is used.
-* All of them should use the Thread Safe Class storagemanager/PoolManager
-
-### Tasks
-
-There are two different types of tasks:
- * The PeriodicTask just executes objects that are of type ExecutableObjectIF in the order of the
- insertion to the Tasks.
- * FixedTimeslotTask executes a list of calls in the order of the given list. This is intended for
- DeviceHandlers, where polling should be in a defined order. An example can be found in
- `defaultcfg/fsfwconfig/pollingSequence` folder
-
diff --git a/docs/README-devicehandlers.md b/docs/README-devicehandlers.md
deleted file mode 100644
index 8b6551aa..00000000
--- a/docs/README-devicehandlers.md
+++ /dev/null
@@ -1 +0,0 @@
-## Device Handlers
diff --git a/docs/README-highlevel.md b/docs/README-highlevel.md
deleted file mode 100644
index 262138a7..00000000
--- a/docs/README-highlevel.md
+++ /dev/null
@@ -1,135 +0,0 @@
-High-level overview
-======
-
-# Structure
-
-The general structure is driven by the usage of interfaces provided by objects.
-The FSFW uses C++11 as baseline. The intention behind this is that this C++ Standard should be
-widely available, even with older compilers.
-The FSFW uses dynamic allocation during the initialization but provides static containers during runtime.
-This simplifies the instantiation of objects and allows the usage of some standard containers.
-Dynamic Allocation after initialization is discouraged and different solutions are provided in the
-FSFW to achieve that. The fsfw uses run-time type information but exceptions are not allowed.
-
-# Failure Handling
-
-Functions should return a defined `ReturnValue_t` to signal to the caller that something has
-gone wrong. Returnvalues must be unique. For this the function `HasReturnvaluesIF::makeReturnCode`
-or the macro `MAKE_RETURN` can be used. The `CLASS_ID` is a unique id for that type of object.
-See `returnvalues/FwClassIds` folder. The user can add custom `CLASS_ID`s via the
-`fsfwconfig` folder.
-
-# OSAL
-
-The FSFW provides operation system abstraction layers for Linux, FreeRTOS and RTEMS.
-The OSAL provides periodic tasks, message queues, clocks and semaphores as well as mutexes.
-The [OSAL README](doc/README-osal.md#top) provides more detailed information on provided components
-and how to use them.
-
-# Core Components
-
-The FSFW has following core components. More detailed informations can be found in the
-[core component section](doc/README-core.md#top):
-
-1. Tasks: Abstraction for different (periodic) task types like periodic tasks or tasks
- with fixed timeslots
-2. ObjectManager: This module stores all `SystemObjects` by mapping a provided unique object ID
- to the object handles.
-3. Static Stores: Different stores are provided to store data of variable size (like telecommands
- or small telemetry) in a pool structure without using dynamic memory allocation.
- These pools are allocated up front.
-3. Clock: This module provided common time related functions
-4. EventManager: This module allows routing of events generated by `SystemObjects`
-5. HealthTable: A component which stores the health states of objects
-
-# Static IDs in the framework
-
-Some parts of the framework use a static routing address for communication.
-An example setup of ids can be found in the example config in `defaultcft/fsfwconfig/objects`
- inside the function `Factory::setStaticFrameworkObjectIds()`.
-
-# Events
-
-Events are tied to objects. EventIds can be generated by calling the Macro MAKE_EVENT.
-This works analog to the returnvalues. Every object that needs own EventIds has to get a
-unique SUBSYSTEM_ID. Every SystemObject can call triggerEvent from the parent class.
-Therefore, event messages contain the specific EventId and the objectId of the object that
-has triggered.
-
-# Internal Communication
-
-Components communicate mostly via Messages through Queues.
-Those queues are created by calling the singleton `QueueFactory::instance()->create()` which
-will create `MessageQueue` instances for the used OSAL.
-
-# External Communication
-
-The external communication with the mission control system is mostly up to the user implementation.
-The FSFW provides PUS Services which can be used to but don't need to be used.
-The services can be seen as a conversion from a TC to a message based communication and back.
-
-## TMTC Communication
-
-The FSFW provides some components to facilitate TMTC handling via the PUS commands.
-For example, a UDP or TCP PUS server socket can be opened on a specific port using the
-files located in `osal/common`. The FSFW example uses this functionality to allow sending telecommands
-and receiving telemetry using the [TMTC commander application](https://github.com/spacefisch/tmtccmd).
-Simple commands like the PUS Service 17 ping service can be tested by simply running the
-`tmtc_client_cli.py` or `tmtc_client_gui.py` utility in
-the [example tmtc folder](https://egit.irs.uni-stuttgart.de/fsfw/fsfw_example_public/src/branch/master/tmtc)
-while the `fsfw_example` application is running.
-
-More generally, any class responsible for handling incoming telecommands and sending telemetry
-can implement the generic `TmTcBridge` class located in `tmtcservices`. Many applications
-also use a dedicated polling task for reading telecommands which passes telecommands
-to the `TmTcBridge` implementation.
-
-## CCSDS Frames, CCSDS Space Packets and PUS
-
-If the communication is based on CCSDS Frames and Space Packets, several classes can be used to
-distributed the packets to the corresponding services. Those can be found in `tcdistribution`.
-If Space Packets are used, a timestamper has to be provided by the user.
-An example can be found in the `timemanager` folder, which uses `CCSDSTime::CDS_short`.
-
-# Device Handlers
-
-DeviceHandlers are another important component of the FSFW.
-The idea is, to have a software counterpart of every physical device to provide a simple mode,
-health and commanding interface. By separating the underlying Communication Interface with
-`DeviceCommunicationIF`, a device handler (DH) can be tested on different hardware.
-The DH has mechanisms to monitor the communication with the physical device which allow
-for FDIR reaction. Device Handlers can be created by implementing `DeviceHandlerBase`.
-A standard FDIR component for the DH will be created automatically but can
-be overwritten by the user. More information on DeviceHandlers can be found in the
-related [documentation section](doc/README-devicehandlers.md#top).
-
-# Modes and Health
-
-The two interfaces `HasModesIF` and `HasHealthIF` provide access for commanding and monitoring
-of components. On-board Mode Management is implement in hierarchy system.
-DeviceHandlers and Controllers are the lowest part of the hierarchy.
-The next layer are Assemblies. Those assemblies act as a component which handle
-redundancies of handlers. Assemblies share a common core with the next level which
-are the Subsystems.
-
-Those Assemblies are intended to act as auto-generated components from a database which describes
-the subsystem modes. The definitions contain transition and target tables which contain the DH,
-Assembly and Controller Modes to be commanded.
-Transition tables contain as many steps as needed to reach the mode from any other mode, e.g. a
-switch into any higher AOCS mode might first turn on the sensors, than the actuators and the
-controller as last component.
-The target table is used to describe the state that is checked continuously by the subsystem.
-All of this allows System Modes to be generated as Subsystem object as well from the same database.
-This System contains list of subsystem modes in the transition and target tables.
-Therefore, it allows a modular system to create system modes and easy commanding of those, because
-only the highest components must be commanded.
-
-The health state represents if the component is able to perform its tasks.
-This can be used to signal the system to avoid using this component instead of a redundant one.
-The on-board FDIR uses the health state for isolation and recovery.
-
-# Unit Tests
-
-Unit Tests are provided in the unittest folder. Those use the catch2 framework but do not include
-catch2 itself. More information on how to run these tests can be found in the separate
-[`fsfw_tests` reposoitory](https://egit.irs.uni-stuttgart.de/fsfw/fsfw_tests)
diff --git a/docs/README-localpools.md b/docs/README-localpools.md
deleted file mode 100644
index 2ee75189..00000000
--- a/docs/README-localpools.md
+++ /dev/null
@@ -1,174 +0,0 @@
-## Local Data Pools Developer Information
-
-The following text is targeted towards mission software developers which would like
-to use the local data pools provided by the FSFW to store data like sensor values so they can be
-used by other software objects like controllers as well. If a custom class should have a local
-pool which can be used by other software objects as well, following steps have to be performed:
-
-1. Create a `LocalDataPoolManager` member object in the custom class
-2. Implement the `HasLocalDataPoolIF` with specifies the interface between the local pool manager
-and the class owning the local pool.
-
-The local data pool manager is also able to process housekeeping service requests in form
-of messages, generate periodic housekeeping packet, generate notification and snapshots of changed
-variables and datasets and process notifications and snapshots coming from other objects.
-The two former tasks are related to the external interface using telemetry and telecommands (TMTC)
-while the later two are related to data consumers like controllers only acting on data change
-detected by the data creator instead of checking the data manually each cycle. Two important
-framework classes `DeviceHandlerBase` and `ExtendedControllerBase` already perform the two steps
-shown above so the steps required are altered slightly.
-
-### Storing and Accessing pool data
-
-The pool manager is responsible for thread-safe access of the pool data, but the actual
-access to the pool data from the point of view of a mission software developer happens via proxy
-classes like pool variable classes. These classes store a copy
-of the pool variable with the matching datatype and copy the actual data from the local pool
-on a `read` call. Changed variables can then be written to the local pool with a `commit` call.
-The `read` and `commit` calls are thread-safe and can be called concurrently from data creators
-and data consumers. Generally, a user will create a dataset class which in turn groups all
-cohesive pool variables. These sets simply iterator over the list of variables and call the
-`read` and `commit` functions of each variable. The following diagram shows the
-high-level architecture of the local data pools.
-
-.. image:: ../misc/logo/FSFW_Logo_V3_bw.png
- :alt: FSFW Logo
-
-
-An example is shown for using the local data pools with a Gyroscope.
-For example, the following code shows an implementation to access data from a Gyroscope taken
-from the SOURCE CubeSat project:
-
-```cpp
-class GyroPrimaryDataset: public StaticLocalDataSet<3 * sizeof(float)> {
-public:
- /**
- * Constructor for data users
- * @param gyroId
- */
- GyroPrimaryDataset(object_id_t gyroId):
- StaticLocalDataSet(sid_t(gyroId, gyrodefs::GYRO_DATA_SET_ID)) {
- setAllVariablesReadOnly();
- }
-
- lp_var_t angVelocityX = lp_var_t(sid.objectId,
- gyrodefs::ANGULAR_VELOCITY_X, this);
- lp_var_t angVelocityY = lp_var_t(sid.objectId,
- gyrodefs::ANGULAR_VELOCITY_Y, this);
- lp_var_t angVelocityZ = lp_var_t(sid.objectId,
- gyrodefs::ANGULAR_VELOCITY_Z, this);
-private:
-
- friend class GyroHandler;
- /**
- * Constructor for data creator
- * @param hkOwner
- */
- GyroPrimaryDataset(HasLocalDataPoolIF* hkOwner):
- StaticLocalDataSet(hkOwner, gyrodefs::GYRO_DATA_SET_ID) {}
-};
-```
-
-There is a public constructor for users which sets all variables to read-only and there is a
-constructor for the GyroHandler data creator by marking it private and declaring the `GyroHandler`
-as a friend class. Both the atittude controller and the `GyroHandler` can now
-use the same class definition to access the pool variables with `read` and `commit` semantics
-in a thread-safe way. Generally, each class requiring access will have the set class as a member
-class. The data creator will also be generally a `DeviceHandlerBase` subclass and some additional
-steps are necessary to expose the set for housekeeping purposes.
-
-### Using the local data pools in a `DeviceHandlerBase` subclass
-
-It is very common to store data generated by devices like a sensor into a pool which can
-then be used by other objects. Therefore, the `DeviceHandlerBase` already has a
-local pool. Using the aforementioned example, our `GyroHandler` will now have the set class
-as a member:
-
-```cpp
-class GyroHandler: ... {
-
-public:
- ...
-private:
- ...
- GyroPrimaryDataset gyroData;
- ...
-};
-```
-
-The constructor used for the creators expects the owner class as a parameter, so we initialize
-the object in the `GyroHandler` constructor like this:
-
-```cpp
-GyroHandler::GyroHandler(object_id_t objectId, object_id_t comIF,
- CookieIF *comCookie, uint8_t switchId):
- DeviceHandlerBase(objectId, comIF, comCookie), switchId(switchId),
- gyroData(this) {}
-```
-
-We need to assign the set to a reply ID used in the `DeviceHandlerBase`.
-The combination of the `GyroHandler` object ID and the reply ID will be the 64-bit structure ID
-`sid_t` and is used to globally identify the set, for example when requesting housekeeping data or
-generating update messages. We need to assign our custom set class in some way so that the local
-pool manager can access the custom data sets as well.
-By default, the `getDataSetHandle` will take care of this tasks. The default implementation for a
-`DeviceHandlerBase` subclass will use the internal command map to retrieve
-a handle to a dataset from a given reply ID. Therefore,
-we assign the set in the `fillCommandAndReplyMap` function:
-
-```cpp
-void GyroHandler::fillCommandAndReplyMap() {
- ...
- this->insertInCommandAndReplyMap(gyrodefs::GYRO_DATA, 3, &gyroData);
- ...
-}
-```
-
-Now, we need to create the actual pool entries as well, using the `initializeLocalDataPool`
-function. Here, we also immediately subscribe for periodic housekeeping packets
-with an interval of 4 seconds. They are still disabled in this example and can be enabled
-with a housekeeping service command.
-
-```cpp
-ReturnValue_t GyroHandler::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
- LocalDataPoolManager &poolManager) {
- localDataPoolMap.emplace(gyrodefs::ANGULAR_VELOCITY_X,
- new PoolEntry({0.0}));
- localDataPoolMap.emplace(gyrodefs::ANGULAR_VELOCITY_Y,
- new PoolEntry({0.0}));
- localDataPoolMap.emplace(gyrodefs::ANGULAR_VELOCITY_Z,
- new PoolEntry({0.0}));
- localDataPoolMap.emplace(gyrodefs::GENERAL_CONFIG_REG42,
- new PoolEntry({0}));
- localDataPoolMap.emplace(gyrodefs::RANGE_CONFIG_REG43,
- new PoolEntry({0}));
-
- poolManager.subscribeForPeriodicPacket(gyroData.getSid(), false, 4.0, false);
- return HasReturnvaluesIF::RETURN_OK;
-}
-```
-
-Now, if we receive some sensor data and converted them into the right format,
-we can write it into the pool like this, using a guard class to ensure the set is commited back
-in any case:
-
-```cpp
-PoolReadGuard readHelper(&gyroData);
-if(readHelper.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
- if(not gyroData.isValid()) {
- gyroData.setValidity(true, true);
- }
-
- gyroData.angVelocityX = angularVelocityX;
- gyroData.angVelocityY = angularVelocityY;
- gyroData.angVelocityZ = angularVelocityZ;
-}
-```
-
-The guard class will commit the changed data on destruction automatically.
-
-### Using the local data pools in a `ExtendedControllerBase` subclass
-
-Coming soon
-
-
diff --git a/docs/README-osal.md b/docs/README-osal.md
deleted file mode 100644
index 6f8ce60f..00000000
--- a/docs/README-osal.md
+++ /dev/null
@@ -1,32 +0,0 @@
-# Operating System Abstraction Layer (OSAL)
-
-Some specific information on the provided OSALs are provided.
-
-## Linux OSAL
-
-This OSAL can be used to compile for Linux host systems like Ubuntu 20.04 or for
-embedded Linux targets like the Raspberry Pi. This OSAL generally requires threading support
-and real-time functionalities. For most UNIX systems, this is done by adding `-lrt` and `-lpthread` to the linked libraries in the compilation process. The CMake build support provided will do this automatically for the `fsfw` target. It should be noted that most UNIX systems need to be configured specifically to allow the real-time functionalities required by the FSFW.
-
-More information on how to set up a Linux system accordingly can be found in the
-[Linux README of the FSFW example application](https://egit.irs.uni-stuttgart.de/fsfw/fsfw_example/src/branch/master/doc/README-linux.md#top)
-
-## Hosted OSAL
-
-This is the newest OSAL. Support for Semaphores has not been implemented yet and will propably be implemented as soon as C++20 with Semaphore support has matured. This OSAL can be used to run the FSFW on any host system, but currently has only been tested on Windows 10 and Ubuntu 20.04. Unlike the other OSALs, it uses dynamic memory allocation (e.g. for the message queue implementation). Cross-platform serial port (USB) support might be added soon.
-
-## FreeRTOS OSAL
-
-FreeRTOS is not included and the developer needs to take care of compiling the FreeRTOS sources and adding the `FreeRTOSConfig.h` file location to the include path. This OSAL has only been tested extensively with the pre-emptive scheduler configuration so far but it should in principle also be possible to use a cooperative scheduler. It is recommended to use the `heap_4` allocation scheme. When using newlib (nano), it is also recommended to add `#define configUSE_NEWLIB_REENTRANT` to the FreeRTOS configuration file to ensure thread-safety.
-
-When using this OSAL, developers also need to provide an implementation for the `vRequestContextSwitchFromISR` function. This has been done because the call to request a context switch from an ISR is generally located in the `portmacro.h` header and is different depending on the target architecture or device.
-
-## RTEMS OSAL
-
-The RTEMS OSAL was the first implemented OSAL which is also used on the active satellite Flying Laptop.
-
-## TCP/IP socket abstraction
-
-The Linux and Host OSAL provide abstraction layers for the socket API. Currently, only UDP sockets have been imlemented. This is very useful to test TMTC handling either on the host computer directly (targeting localhost with a TMTC application) or on embedded Linux devices, sending TMTC packets via Ethernet.
-
-
diff --git a/docs/README-pus.md b/docs/README-pus.md
deleted file mode 100644
index 928d2eda..00000000
--- a/docs/README-pus.md
+++ /dev/null
@@ -1 +0,0 @@
-## PUS Services
diff --git a/docs/api/returnvalue.rst b/docs/api/returnvalue.rst
index b0d43916..da65c141 100644
--- a/docs/api/returnvalue.rst
+++ b/docs/api/returnvalue.rst
@@ -3,7 +3,7 @@
Returnvalue API
==================
-.. doxygenfile:: HasReturnvaluesIF.h
+.. doxygenfile:: returnvalue.h
.. _fwclassids:
diff --git a/docs/conf.py b/docs/conf.py
index 62b17192..eb0f94cd 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -50,6 +50,11 @@ exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
#
html_theme = 'alabaster'
+html_theme_options = {
+ "extra_nav_links": {"Impressum" : "https://www.uni-stuttgart.de/impressum", "Datenschutz": "https://info.irs.uni-stuttgart.de/datenschutz/datenschutzWebmit.html"}
+}
+
+
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
diff --git a/docs/devicehandlers.rst b/docs/devicehandlers.rst
index 0008edb3..9c6929e8 100644
--- a/docs/devicehandlers.rst
+++ b/docs/devicehandlers.rst
@@ -75,11 +75,11 @@ and the respective source file with sensible default return values:
void TestDeviceHandler::doShutDown() {}
ReturnValue_t TestDeviceHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t TestDeviceHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) {
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
void TestDeviceHandler::fillCommandAndReplyMap() {}
@@ -87,17 +87,17 @@ and the respective source file with sensible default return values:
ReturnValue_t TestDeviceHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
const uint8_t* commandData,
size_t commandDataLen) {
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t TestDeviceHandler::scanForReply(const uint8_t* start, size_t remainingSize,
DeviceCommandId_t* foundId, size_t* foundLen) {
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t TestDeviceHandler::interpretDeviceReply(DeviceCommandId_t id,
const uint8_t* packet) {
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
uint32_t TestDeviceHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) {
@@ -106,5 +106,5 @@ and the respective source file with sensible default return values:
ReturnValue_t TestDeviceHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) {
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
diff --git a/docs/getting_started.rst b/docs/getting_started.rst
index 01724b3a..4f8ae543 100644
--- a/docs/getting_started.rst
+++ b/docs/getting_started.rst
@@ -106,7 +106,7 @@ You can use the following commands inside the ``fsfw`` folder to set up the buil
.. code-block:: console
mkdir build-tests && cd build-tests
- cmake -DFSFW_BUILD_UNITTESTS=ON -DFSFW_OSAL=host ..
+ cmake -DFSFW_BUILD_TESTS=ON -DFSFW_OSAL=host ..
You can also use ``-DFSFW_OSAL=linux`` on Linux systems.
diff --git a/docs/highlevel.rst b/docs/highlevel.rst
index 04eb5e7b..ee35c549 100644
--- a/docs/highlevel.rst
+++ b/docs/highlevel.rst
@@ -6,19 +6,20 @@ High-level overview
Structure
----------
-The general structure is driven by the usage of interfaces provided by objects.
-The FSFW uses C++11 as baseline. The intention behind this is that this C++ Standard should be
-widely available, even with older compilers.
-The FSFW uses dynamic allocation during the initialization but provides static containers during runtime.
-This simplifies the instantiation of objects and allows the usage of some standard containers.
-Dynamic Allocation after initialization is discouraged and different solutions are provided in the
-FSFW to achieve that. The fsfw uses run-time type information but exceptions are not allowed.
+The general structure is driven by the usage of interfaces provided by objects.
+The FSFW uses C++17 as baseline. Most modern compilers like GCC should have support for this
+standard, even for micocontrollers.
+
+The FSFW might use dynamic allocation during program initialization but not during runtime.
+It offers pool objects, static containers and it also exposes the
+`Embedded Template Library `_ to allow writing code which does not perform
+allocation during runtime. The fsfw uses run-time type information but will not throw exceptions.
Failure Handling
-----------------
Functions should return a defined :cpp:type:`ReturnValue_t` to signal to the caller that something has
-gone wrong. Returnvalues must be unique. For this the function :cpp:func:`HasReturnvaluesIF::makeReturnCode`
+gone wrong. Returnvalues must be unique. For this the function :cpp:func:`returnvalue::makeCode`
or the :ref:`macro MAKE_RETURN_CODE ` can be used. The ``CLASS_ID`` is a unique ID for that type of object.
See the :ref:`FSFW Class IDs file `. The user can add custom ``CLASS_ID``\s via the
``fsfwconfig`` folder.
diff --git a/docs/localpools.rst b/docs/localpools.rst
index d2afd0a0..f7e1ca47 100644
--- a/docs/localpools.rst
+++ b/docs/localpools.rst
@@ -150,7 +150,7 @@ with a housekeeping service command.
new PoolEntry({0}));
poolManager.subscribeForPeriodicPacket(gyroData.getSid(), false, 4.0, false);
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
Now, if we receive some sensor data and converted them into the right format,
@@ -160,7 +160,7 @@ in any case:
.. code-block:: cpp
PoolReadGuard readHelper(&gyroData);
- if(readHelper.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
+ if(readHelper.getReadResult() == returnvalue::OK) {
if(not gyroData.isValid()) {
gyroData.setValidity(true, true);
}
diff --git a/hal/CMakeLists.txt b/hal/CMakeLists.txt
deleted file mode 100644
index 7a97ae0f..00000000
--- a/hal/CMakeLists.txt
+++ /dev/null
@@ -1,48 +0,0 @@
-cmake_minimum_required(VERSION 3.13)
-
-# Can also be changed by upper CMakeLists.txt file
-find_library(LIB_FSFW_NAME fsfw REQUIRED)
-
-option(FSFW_HAL_ADD_LINUX "Add the Linux HAL to the sources. Requires gpiod library" OFF)
-# On by default for now because I did not have an issue including and compiling those files
-# and libraries on a Desktop Linux system and the primary target of the FSFW is still embedded
-# Linux. The only exception from this is the gpiod library which requires a dedicated installation,
-# but CMake is able to determine whether this library is installed with find_library.
-option(FSFW_HAL_LINUX_ADD_PERIPHERAL_DRIVERS "Add peripheral drivers for embedded Linux" ON)
-option(FSFW_HAL_LINUX_ADD_LIBGPIOD "Target implements libgpiod" ON)
-
-option(FSFW_HAL_ADD_RASPBERRY_PI "Add Raspberry Pi specific code to the sources" OFF)
-option(FSFW_HAL_ADD_STM32H7 "Add the STM32H7 HAL to the sources" OFF)
-option(FSFW_HAL_WARNING_SHADOW_LOCAL_GCC "Enable -Wshadow=local warning in GCC" ON)
-
-set(LINUX_HAL_PATH_NAME linux)
-set(STM32H7_PATH_NAME stm32h7)
-
-add_subdirectory(src)
-
-foreach(INCLUDE_PATH ${FSFW_HAL_ADDITIONAL_INC_PATHS})
- if(IS_ABSOLUTE ${INCLUDE_PATH})
- set(CURR_ABS_INC_PATH "${INCLUDE_PATH}")
- else()
- get_filename_component(CURR_ABS_INC_PATH
- ${INCLUDE_PATH} REALPATH BASE_DIR ${CMAKE_SOURCE_DIR})
- endif()
-
- if(CMAKE_VERBOSE)
- message(STATUS "FSFW include path: ${CURR_ABS_INC_PATH}")
- endif()
-
- list(APPEND FSFW_HAL_ADD_INC_PATHS_ABS ${CURR_ABS_INC_PATH})
-endforeach()
-
-target_include_directories(${LIB_FSFW_NAME} PRIVATE
- ${FSFW_HAL_ADD_INC_PATHS_ABS}
-)
-
-target_compile_definitions(${LIB_FSFW_NAME} PRIVATE
- ${FSFW_HAL_DEFINES}
-)
-
-target_link_libraries(${LIB_FSFW_NAME} PRIVATE
- ${FSFW_HAL_LINK_LIBS}
-)
diff --git a/hal/src/CMakeLists.txt b/hal/src/CMakeLists.txt
deleted file mode 100644
index 76ee45c6..00000000
--- a/hal/src/CMakeLists.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-target_include_directories(${LIB_FSFW_NAME} PRIVATE
- ${CMAKE_CURRENT_SOURCE_DIR}
-)
-
-target_include_directories(${LIB_FSFW_NAME} INTERFACE
- ${CMAKE_CURRENT_SOURCE_DIR}
-)
-
-add_subdirectory(fsfw_hal)
diff --git a/hal/src/fsfw_hal/common/CMakeLists.txt b/hal/src/fsfw_hal/common/CMakeLists.txt
deleted file mode 100644
index f1cfec52..00000000
--- a/hal/src/fsfw_hal/common/CMakeLists.txt
+++ /dev/null
@@ -1 +0,0 @@
-add_subdirectory(gpio)
diff --git a/hal/src/fsfw_hal/common/gpio/CMakeLists.txt b/hal/src/fsfw_hal/common/gpio/CMakeLists.txt
deleted file mode 100644
index 098c05fa..00000000
--- a/hal/src/fsfw_hal/common/gpio/CMakeLists.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-target_sources(${LIB_FSFW_NAME} PRIVATE
- GpioCookie.cpp
-)
\ No newline at end of file
diff --git a/hal/src/fsfw_hal/devicehandlers/CMakeLists.txt b/hal/src/fsfw_hal/devicehandlers/CMakeLists.txt
deleted file mode 100644
index 94e67c72..00000000
--- a/hal/src/fsfw_hal/devicehandlers/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-target_sources(${LIB_FSFW_NAME} PRIVATE
- GyroL3GD20Handler.cpp
- MgmRM3100Handler.cpp
- MgmLIS3MDLHandler.cpp
-)
diff --git a/hal/src/fsfw_hal/linux/CMakeLists.txt b/hal/src/fsfw_hal/linux/CMakeLists.txt
deleted file mode 100644
index f6d1a460..00000000
--- a/hal/src/fsfw_hal/linux/CMakeLists.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-if(FSFW_HAL_ADD_RASPBERRY_PI)
- add_subdirectory(rpi)
-endif()
-
-target_sources(${LIB_FSFW_NAME} PRIVATE
- UnixFileGuard.cpp
- CommandExecutor.cpp
- utility.cpp
-)
-
-if(FSFW_HAL_LINUX_ADD_PERIPHERAL_DRIVERS)
-if(FSFW_HAL_LINUX_ADD_LIBGPIOD)
- add_subdirectory(gpio)
-endif()
- add_subdirectory(uart)
- # Adding those does not really make sense on Apple systems which
- # are generally host systems. It won't even compile as the headers
- # are missing
- if(NOT APPLE)
- add_subdirectory(i2c)
- add_subdirectory(spi)
- endif()
-endif()
-
-add_subdirectory(uio)
diff --git a/hal/src/fsfw_hal/linux/gpio/CMakeLists.txt b/hal/src/fsfw_hal/linux/gpio/CMakeLists.txt
deleted file mode 100644
index b1609850..00000000
--- a/hal/src/fsfw_hal/linux/gpio/CMakeLists.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-# This abstraction layer requires the gpiod library. You can install this library
-# with "sudo apt-get install -y libgpiod-dev". If you are cross-compiling, you need
-# to install the package before syncing the sysroot to your host computer.
-find_library(LIB_GPIO gpiod)
-
-if(${LIB_GPIO} MATCHES LIB_GPIO-NOTFOUND)
- message(STATUS "gpiod library not found, not linking against it")
-else()
- target_sources(${LIB_FSFW_NAME} PRIVATE
- LinuxLibgpioIF.cpp
- )
- target_link_libraries(${LIB_FSFW_NAME} PRIVATE
- ${LIB_GPIO}
- )
-endif()
-
diff --git a/hal/src/fsfw_hal/linux/i2c/CMakeLists.txt b/hal/src/fsfw_hal/linux/i2c/CMakeLists.txt
deleted file mode 100644
index 3eb0882c..00000000
--- a/hal/src/fsfw_hal/linux/i2c/CMakeLists.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-target_sources(${LIB_FSFW_NAME} PUBLIC
- I2cComIF.cpp
- I2cCookie.cpp
-)
-
-
-
-
diff --git a/hal/src/fsfw_hal/linux/rpi/CMakeLists.txt b/hal/src/fsfw_hal/linux/rpi/CMakeLists.txt
deleted file mode 100644
index 47be218c..00000000
--- a/hal/src/fsfw_hal/linux/rpi/CMakeLists.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-target_sources(${LIB_FSFW_NAME} PRIVATE
- GpioRPi.cpp
-)
\ No newline at end of file
diff --git a/hal/src/fsfw_hal/linux/spi/CMakeLists.txt b/hal/src/fsfw_hal/linux/spi/CMakeLists.txt
deleted file mode 100644
index 404e1f47..00000000
--- a/hal/src/fsfw_hal/linux/spi/CMakeLists.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-target_sources(${LIB_FSFW_NAME} PUBLIC
- SpiComIF.cpp
- SpiCookie.cpp
-)
-
-
-
-
diff --git a/hal/src/fsfw_hal/linux/uart/CMakeLists.txt b/hal/src/fsfw_hal/linux/uart/CMakeLists.txt
deleted file mode 100644
index 21ed0278..00000000
--- a/hal/src/fsfw_hal/linux/uart/CMakeLists.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-target_sources(${LIB_FSFW_NAME} PUBLIC
- UartComIF.cpp
- UartCookie.cpp
-)
diff --git a/hal/src/fsfw_hal/linux/uio/CMakeLists.txt b/hal/src/fsfw_hal/linux/uio/CMakeLists.txt
deleted file mode 100644
index e98a0865..00000000
--- a/hal/src/fsfw_hal/linux/uio/CMakeLists.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-target_sources(${LIB_FSFW_NAME} PUBLIC
- UioMapper.cpp
-)
diff --git a/hal/src/fsfw_hal/stm32h7/devicetest/CMakeLists.txt b/hal/src/fsfw_hal/stm32h7/devicetest/CMakeLists.txt
deleted file mode 100644
index 7bd4c3a9..00000000
--- a/hal/src/fsfw_hal/stm32h7/devicetest/CMakeLists.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-target_sources(${LIB_FSFW_NAME} PRIVATE
- GyroL3GD20H.cpp
-)
\ No newline at end of file
diff --git a/hal/src/fsfw_hal/stm32h7/gpio/CMakeLists.txt b/hal/src/fsfw_hal/stm32h7/gpio/CMakeLists.txt
deleted file mode 100644
index 35245b25..00000000
--- a/hal/src/fsfw_hal/stm32h7/gpio/CMakeLists.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-target_sources(${LIB_FSFW_NAME} PRIVATE
- gpio.cpp
-)
diff --git a/hal/src/fsfw_hal/stm32h7/i2c/CMakeLists.txt b/hal/src/fsfw_hal/stm32h7/i2c/CMakeLists.txt
deleted file mode 100644
index 5ecb0990..00000000
--- a/hal/src/fsfw_hal/stm32h7/i2c/CMakeLists.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-target_sources(${LIB_FSFW_NAME} PRIVATE
-)
diff --git a/hal/src/fsfw_hal/stm32h7/spi/CMakeLists.txt b/hal/src/fsfw_hal/stm32h7/spi/CMakeLists.txt
deleted file mode 100644
index aa5541bc..00000000
--- a/hal/src/fsfw_hal/stm32h7/spi/CMakeLists.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-target_sources(${LIB_FSFW_NAME} PRIVATE
- spiCore.cpp
- spiDefinitions.cpp
- spiInterrupts.cpp
- mspInit.cpp
- SpiCookie.cpp
- SpiComIF.cpp
- stm32h743zi.cpp
-)
diff --git a/hal/src/fsfw_hal/stm32h7/uart/CMakeLists.txt b/hal/src/fsfw_hal/stm32h7/uart/CMakeLists.txt
deleted file mode 100644
index 5ecb0990..00000000
--- a/hal/src/fsfw_hal/stm32h7/uart/CMakeLists.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-target_sources(${LIB_FSFW_NAME} PRIVATE
-)
diff --git a/misc/defaultcfg/fsfwconfig/FSFWConfig.h b/misc/defaultcfg/fsfwconfig/FSFWConfig.h
index adf9912f..e80abf24 100644
--- a/misc/defaultcfg/fsfwconfig/FSFWConfig.h
+++ b/misc/defaultcfg/fsfwconfig/FSFWConfig.h
@@ -4,6 +4,10 @@
#include
#include
+// It is assumed the user has a subsystem and class ID list in some user header files.
+// #include "events/subsystemIdRanges.h"
+// #include "returnvalues/classIds.h"
+
//! Used to determine whether C++ ostreams are used which can increase
//! the binary size significantly. If this is disabled,
//! the C stdio functions can be used alternatively
diff --git a/misc/defaultcfg/fsfwconfig/objects/FsfwFactory.cpp b/misc/defaultcfg/fsfwconfig/objects/FsfwFactory.cpp
index 5aef4980..4d6e91f1 100644
--- a/misc/defaultcfg/fsfwconfig/objects/FsfwFactory.cpp
+++ b/misc/defaultcfg/fsfwconfig/objects/FsfwFactory.cpp
@@ -35,8 +35,8 @@ void Factory::produceFsfwObjects(void) {
}
void Factory::setStaticFrameworkObjectIds() {
- PusServiceBase::packetSource = objects::NO_OBJECT;
- PusServiceBase::packetDestination = objects::NO_OBJECT;
+ PusServiceBase::PUS_DISTRIBUTOR = objects::NO_OBJECT;
+ PusServiceBase::PACKET_DESTINATION = objects::NO_OBJECT;
CommandingServiceBase::defaultPacketSource = objects::NO_OBJECT;
CommandingServiceBase::defaultPacketDestination = objects::NO_OBJECT;
diff --git a/misc/defaultcfg/fsfwconfig/pollingsequence/PollingSequenceFactory.cpp b/misc/defaultcfg/fsfwconfig/pollingsequence/PollingSequenceFactory.cpp
index b7f1fb3e..81b927dd 100644
--- a/misc/defaultcfg/fsfwconfig/pollingsequence/PollingSequenceFactory.cpp
+++ b/misc/defaultcfg/fsfwconfig/pollingsequence/PollingSequenceFactory.cpp
@@ -11,15 +11,15 @@ ReturnValue_t pst::pollingSequenceInitDefault(
/* Add polling sequence table here */
- if (thisSequence->checkSequence() == HasReturnvaluesIF::RETURN_OK) {
- return HasReturnvaluesIF::RETURN_OK;
+ if (thisSequence->checkSequence() == returnvalue::OK) {
+ return returnvalue::OK;
}
else {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "pst::pollingSequenceInitDefault: Sequence invalid!"
<< std::endl;
#endif
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
}
diff --git a/misc/defaultcfg/fsfwconfig/pollingsequence/PollingSequenceFactory.h b/misc/defaultcfg/fsfwconfig/pollingsequence/PollingSequenceFactory.h
index c5d41b7d..622cc49a 100644
--- a/misc/defaultcfg/fsfwconfig/pollingsequence/PollingSequenceFactory.h
+++ b/misc/defaultcfg/fsfwconfig/pollingsequence/PollingSequenceFactory.h
@@ -1,7 +1,7 @@
#ifndef POLLINGSEQUENCEFACTORY_H_
#define POLLINGSEQUENCEFACTORY_H_
-#include
+#include
class FixedTimeslotTaskIF;
diff --git a/scripts/auto-formatter.sh b/scripts/auto-formatter.sh
index 405d1268..723add4f 100755
--- a/scripts/auto-formatter.sh
+++ b/scripts/auto-formatter.sh
@@ -3,6 +3,11 @@ if [[ ! -f README.md ]]; then
cd ..
fi
+folder_list=(
+ "./src"
+ "./unittests"
+)
+
cmake_fmt="cmake-format"
file_selectors="-iname CMakeLists.txt"
if command -v ${cmake_fmt} &> /dev/null; then
@@ -15,9 +20,10 @@ fi
cpp_format="clang-format"
file_selectors="-iname *.h -o -iname *.cpp -o -iname *.c -o -iname *.tpp"
if command -v ${cpp_format} &> /dev/null; then
- find ./src ${file_selectors} | xargs ${cpp_format} --style=file -i
- find ./hal ${file_selectors} | xargs ${cpp_format} --style=file -i
- find ./tests ${file_selectors} | xargs ${cpp_format} --style=file -i
+ for dir in ${folder_list[@]}; do
+ echo "Auto-formatting ${dir} recursively"
+ find ${dir} ${file_selectors} | xargs clang-format --style=file -i
+ done
else
echo "No ${cpp_format} tool found, not formatting C++/C files"
fi
diff --git a/scripts/helper.py b/scripts/helper.py
index 4dff908d..9e7a1607 100755
--- a/scripts/helper.py
+++ b/scripts/helper.py
@@ -13,7 +13,7 @@ from shutil import which
from typing import List
-UNITTEST_FOLDER_NAME = "build-tests"
+UNITTEST_FOLDER_NAME = "cmake-build-tests"
DOCS_FOLDER_NAME = "build-docs"
@@ -48,6 +48,20 @@ def main():
action="store_true",
help="Run valgrind on generated test binary",
)
+ parser.add_argument(
+ "-g",
+ "--generators",
+ default = "Ninja",
+ action="store",
+ help="CMake generators",
+ )
+ parser.add_argument(
+ "-w",
+ "--windows",
+ default=False,
+ action="store_true",
+ help="Run on windows",
+ )
args = parser.parse_args()
if args.all:
@@ -115,14 +129,14 @@ def handle_tests_type(args, build_dir_list: list):
if args.create:
if os.path.exists(UNITTEST_FOLDER_NAME):
shutil.rmtree(UNITTEST_FOLDER_NAME)
- create_tests_build_cfg()
+ create_tests_build_cfg(args)
build_directory = UNITTEST_FOLDER_NAME
elif len(build_dir_list) == 0:
print(
"No valid CMake tests build directory found. "
"Trying to set up test build system"
)
- create_tests_build_cfg()
+ create_tests_build_cfg(args)
build_directory = UNITTEST_FOLDER_NAME
elif len(build_dir_list) == 1:
build_directory = build_dir_list[0]
@@ -147,10 +161,15 @@ def handle_tests_type(args, build_dir_list: list):
os.chdir("..")
-def create_tests_build_cfg():
+def create_tests_build_cfg(args):
os.mkdir(UNITTEST_FOLDER_NAME)
os.chdir(UNITTEST_FOLDER_NAME)
- cmd_runner("cmake -DFSFW_OSAL=host -DFSFW_BUILD_UNITTESTS=ON ..")
+ if args.windows:
+ cmake_cmd = 'cmake -G "' + args.generators + '" -DFSFW_OSAL=host -DFSFW_BUILD_TESTS=ON \
+ -DGCOVR_PATH="py -m gcovr" ..'
+ else:
+ cmake_cmd = 'cmake -G "' + args.generators + '" -DFSFW_OSAL=host -DFSFW_BUILD_TESTS=ON ..'
+ cmd_runner(cmake_cmd)
os.chdir("..")
@@ -180,7 +199,7 @@ def check_for_cmake_build_dir(build_dir_list: list) -> list:
def perform_lcov_operation(directory: str, chdir: bool):
if chdir:
os.chdir(directory)
- cmd_runner("cmake --build . -- fsfw-tests_coverage -j")
+ cmd_runner("cmake --build . -j -- fsfw-tests_coverage")
def determine_build_dir(build_dir_list: List[str]):
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 34f21c2f..57b24bd5 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -4,3 +4,8 @@ target_include_directories(${LIB_FSFW_NAME}
INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
add_subdirectory(fsfw)
+if(FSFW_ADD_HAL)
+ add_subdirectory(fsfw_hal)
+endif()
+
+add_subdirectory(fsfw_tests)
diff --git a/src/fsfw/action/ActionHelper.cpp b/src/fsfw/action/ActionHelper.cpp
index d41c78b4..fd6c8afb 100644
--- a/src/fsfw/action/ActionHelper.cpp
+++ b/src/fsfw/action/ActionHelper.cpp
@@ -6,13 +6,13 @@
ActionHelper::ActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue)
: owner(setOwner), queueToUse(useThisQueue) {}
-ActionHelper::~ActionHelper() {}
+ActionHelper::~ActionHelper() = default;
ReturnValue_t ActionHelper::handleActionMessage(CommandMessage* command) {
if (command->getCommand() == ActionMessage::EXECUTE_ACTION) {
ActionId_t currentAction = ActionMessage::getActionId(command);
prepareExecution(command->getSender(), currentAction, ActionMessage::getStoreId(command));
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
} else {
return CommandMessage::UNKNOWN_COMMAND;
}
@@ -21,7 +21,7 @@ ReturnValue_t ActionHelper::handleActionMessage(CommandMessage* command) {
ReturnValue_t ActionHelper::initialize(MessageQueueIF* queueToUse_) {
ipcStore = ObjectManager::instance()->get(objects::IPC_STORE);
if (ipcStore == nullptr) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
if (queueToUse_ != nullptr) {
setQueueToUse(queueToUse_);
@@ -35,10 +35,10 @@ ReturnValue_t ActionHelper::initialize(MessageQueueIF* queueToUse_) {
sif::printWarning("ActionHelper::initialize: No queue set\n");
#endif
#endif /* FSFW_VERBOSE_LEVEL >= 1 */
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
void ActionHelper::step(uint8_t step, MessageQueueId_t reportTo, ActionId_t commandId,
@@ -59,10 +59,10 @@ void ActionHelper::setQueueToUse(MessageQueueIF* queue) { queueToUse = queue; }
void ActionHelper::prepareExecution(MessageQueueId_t commandedBy, ActionId_t actionId,
store_address_t dataAddress) {
- const uint8_t* dataPtr = NULL;
+ const uint8_t* dataPtr = nullptr;
size_t size = 0;
ReturnValue_t result = ipcStore->getData(dataAddress, &dataPtr, &size);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
CommandMessage reply;
ActionMessage::setStepReply(&reply, actionId, 0, result);
queueToUse->sendMessage(commandedBy, &reply);
@@ -75,7 +75,7 @@ void ActionHelper::prepareExecution(MessageQueueId_t commandedBy, ActionId_t act
ActionMessage::setCompletionReply(&reply, actionId, true, result);
queueToUse->sendMessage(commandedBy, &reply);
}
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
CommandMessage reply;
ActionMessage::setStepReply(&reply, actionId, 0, result);
queueToUse->sendMessage(commandedBy, &reply);
@@ -91,11 +91,11 @@ ReturnValue_t ActionHelper::reportData(MessageQueueId_t reportTo, ActionId_t rep
size_t maxSize = data->getSerializedSize();
if (maxSize == 0) {
/* No error, there's simply nothing to report. */
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
size_t size = 0;
ReturnValue_t result = ipcStore->getFreeElement(&storeAddress, maxSize, &dataPtr);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "ActionHelper::reportData: Getting free element from IPC store failed!"
<< std::endl;
@@ -107,7 +107,7 @@ ReturnValue_t ActionHelper::reportData(MessageQueueId_t reportTo, ActionId_t rep
return result;
}
result = data->serialize(&dataPtr, &size, maxSize, SerializeIF::Endianness::BIG);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
ipcStore->deleteData(storeAddress);
return result;
}
@@ -124,7 +124,7 @@ ReturnValue_t ActionHelper::reportData(MessageQueueId_t reportTo, ActionId_t rep
result = queueToUse->sendMessage(reportTo, &reply);
}
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
ipcStore->deleteData(storeAddress);
}
return result;
@@ -137,7 +137,7 @@ ReturnValue_t ActionHelper::reportData(MessageQueueId_t reportTo, ActionId_t rep
CommandMessage reply;
store_address_t storeAddress;
ReturnValue_t result = ipcStore->addData(&storeAddress, data, dataSize);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "ActionHelper::reportData: Adding data to IPC store failed!" << std::endl;
#else
@@ -158,7 +158,7 @@ ReturnValue_t ActionHelper::reportData(MessageQueueId_t reportTo, ActionId_t rep
result = queueToUse->sendMessage(reportTo, &reply);
}
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
ipcStore->deleteData(storeAddress);
}
return result;
diff --git a/src/fsfw/action/ActionHelper.h b/src/fsfw/action/ActionHelper.h
index d86e87d2..4bcecbae 100644
--- a/src/fsfw/action/ActionHelper.h
+++ b/src/fsfw/action/ActionHelper.h
@@ -1,9 +1,9 @@
#ifndef FSFW_ACTION_ACTIONHELPER_H_
#define FSFW_ACTION_ACTIONHELPER_H_
-#include "../ipc/MessageQueueIF.h"
-#include "../serialize/SerializeIF.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
*
@@ -36,7 +36,7 @@ class ActionHelper {
* send to the sender of the message automatically.
*
* @param command Pointer to a command message received by the owner
- * @return HasReturnvaluesIF::RETURN_OK if the message is a action message,
+ * @return returnvalue::OK if the message is a action message,
* CommandMessage::UNKNOW_COMMAND if this message ID is unkown
*/
ReturnValue_t handleActionMessage(CommandMessage* command);
@@ -45,7 +45,7 @@ class ActionHelper {
* helper function
* @param queueToUse_ Pointer to the messageQueue to be used, optional
* if queue was set in constructor
- * @return Returns RETURN_OK if successful
+ * @return Returns returnvalue::OK if successful
*/
ReturnValue_t initialize(MessageQueueIF* queueToUse_ = nullptr);
/**
@@ -58,7 +58,7 @@ class ActionHelper {
* @param result Result of the execution
*/
void step(uint8_t step, MessageQueueId_t reportTo, ActionId_t commandId,
- ReturnValue_t result = HasReturnvaluesIF::RETURN_OK);
+ ReturnValue_t result = returnvalue::OK);
/**
* Function to be called by the owner to send a action completion message
* @param success Specify whether action was completed successfully or not.
@@ -67,7 +67,7 @@ class ActionHelper {
* @param result Result of the execution
*/
void finish(bool success, MessageQueueId_t reportTo, ActionId_t commandId,
- ReturnValue_t result = HasReturnvaluesIF::RETURN_OK);
+ ReturnValue_t result = returnvalue::OK);
/**
* Function to be called by the owner if an action does report data.
* Takes a SerializeIF* pointer and serializes it into the IPC store.
@@ -75,7 +75,7 @@ class ActionHelper {
* message to
* @param replyId ID of the executed command
* @param data Pointer to the data
- * @return Returns RETURN_OK if successful, otherwise failure code
+ * @return Returns returnvalue::OK if successful, otherwise failure code
*/
ReturnValue_t reportData(MessageQueueId_t reportTo, ActionId_t replyId, SerializeIF* data,
bool hideSender = false);
@@ -86,7 +86,7 @@ class ActionHelper {
* message to
* @param replyId ID of the executed command
* @param data Pointer to the data
- * @return Returns RETURN_OK if successful, otherwise failure code
+ * @return Returns returnvalue::OK if successful, otherwise failure code
*/
ReturnValue_t reportData(MessageQueueId_t reportTo, ActionId_t replyId, const uint8_t* data,
size_t dataSize, bool hideSender = false);
diff --git a/src/fsfw/action/ActionMessage.cpp b/src/fsfw/action/ActionMessage.cpp
index 40a516b1..33088055 100644
--- a/src/fsfw/action/ActionMessage.cpp
+++ b/src/fsfw/action/ActionMessage.cpp
@@ -2,9 +2,9 @@
#include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/storagemanager/StorageManagerIF.h"
-ActionMessage::ActionMessage() {}
+ActionMessage::ActionMessage() = default;
-ActionMessage::~ActionMessage() {}
+ActionMessage::~ActionMessage() = default;
void ActionMessage::setCommand(CommandMessage* message, ActionId_t fid,
store_address_t parameters) {
@@ -25,7 +25,7 @@ store_address_t ActionMessage::getStoreId(const CommandMessage* message) {
void ActionMessage::setStepReply(CommandMessage* message, ActionId_t fid, uint8_t step,
ReturnValue_t result) {
- if (result == HasReturnvaluesIF::RETURN_OK) {
+ if (result == returnvalue::OK) {
message->setCommand(STEP_SUCCESS);
} else {
message->setCommand(STEP_FAILED);
@@ -64,9 +64,8 @@ void ActionMessage::clear(CommandMessage* message) {
switch (message->getCommand()) {
case EXECUTE_ACTION:
case DATA_REPLY: {
- StorageManagerIF* ipcStore =
- ObjectManager::instance()->get(objects::IPC_STORE);
- if (ipcStore != NULL) {
+ auto* ipcStore = ObjectManager::instance()->get(objects::IPC_STORE);
+ if (ipcStore != nullptr) {
ipcStore->deleteData(getStoreId(message));
}
break;
diff --git a/src/fsfw/action/ActionMessage.h b/src/fsfw/action/ActionMessage.h
index bd12cc19..38e3aa99 100644
--- a/src/fsfw/action/ActionMessage.h
+++ b/src/fsfw/action/ActionMessage.h
@@ -33,12 +33,12 @@ class ActionMessage {
static store_address_t getStoreId(const CommandMessage* message);
static void setStepReply(CommandMessage* message, ActionId_t fid, uint8_t step,
- ReturnValue_t result = HasReturnvaluesIF::RETURN_OK);
+ ReturnValue_t result = returnvalue::OK);
static uint8_t getStep(const CommandMessage* message);
static ReturnValue_t getReturnCode(const CommandMessage* message);
static void setDataReply(CommandMessage* message, ActionId_t actionId, store_address_t data);
static void setCompletionReply(CommandMessage* message, ActionId_t fid, bool success,
- ReturnValue_t result = HasReturnvaluesIF::RETURN_OK);
+ ReturnValue_t result = returnvalue::OK);
static void clear(CommandMessage* message);
};
diff --git a/src/fsfw/action/CommandActionHelper.cpp b/src/fsfw/action/CommandActionHelper.cpp
index 19d8e9b8..831cd862 100644
--- a/src/fsfw/action/CommandActionHelper.cpp
+++ b/src/fsfw/action/CommandActionHelper.cpp
@@ -2,26 +2,26 @@
#include "fsfw/objectmanager/ObjectManager.h"
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,
SerializeIF *data) {
- HasActionsIF *receiver = ObjectManager::instance()->get(commandTo);
- if (receiver == NULL) {
+ auto *receiver = ObjectManager::instance()->get(commandTo);
+ if (receiver == nullptr) {
return CommandsActionsIF::OBJECT_HAS_NO_FUNCTIONS;
}
store_address_t storeId;
uint8_t *storePointer;
size_t maxSize = data->getSerializedSize();
ReturnValue_t result = ipcStore->getFreeElement(&storeId, maxSize, &storePointer);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
size_t size = 0;
result = data->serialize(&storePointer, &size, maxSize, SerializeIF::Endianness::BIG);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
return sendCommand(receiver->getCommandQueue(), actionId, storeId);
@@ -29,16 +29,13 @@ ReturnValue_t CommandActionHelper::commandAction(object_id_t commandTo, ActionId
ReturnValue_t CommandActionHelper::commandAction(object_id_t commandTo, ActionId_t actionId,
const uint8_t *data, uint32_t size) {
- // if (commandCount != 0) {
- // return CommandsFunctionsIF::ALREADY_COMMANDING;
- // }
- HasActionsIF *receiver = ObjectManager::instance()->get(commandTo);
- if (receiver == NULL) {
+ auto *receiver = ObjectManager::instance()->get(commandTo);
+ if (receiver == nullptr) {
return CommandsActionsIF::OBJECT_HAS_NO_FUNCTIONS;
}
store_address_t storeId;
ReturnValue_t result = ipcStore->addData(&storeId, data, size);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
return sendCommand(receiver->getCommandQueue(), actionId, storeId);
@@ -49,7 +46,7 @@ ReturnValue_t CommandActionHelper::sendCommand(MessageQueueId_t queueId, ActionI
CommandMessage command;
ActionMessage::setCommand(&command, actionId, storeId);
ReturnValue_t result = queueToUse->sendMessage(queueId, &command);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
ipcStore->deleteData(storeId);
}
lastTarget = queueId;
@@ -59,55 +56,55 @@ ReturnValue_t CommandActionHelper::sendCommand(MessageQueueId_t queueId, ActionI
ReturnValue_t CommandActionHelper::initialize() {
ipcStore = ObjectManager::instance()->get(objects::IPC_STORE);
- if (ipcStore == NULL) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ if (ipcStore == nullptr) {
+ return returnvalue::FAILED;
}
queueToUse = owner->getCommandQueuePtr();
- if (queueToUse == NULL) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ if (queueToUse == nullptr) {
+ return returnvalue::FAILED;
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t CommandActionHelper::handleReply(CommandMessage *reply) {
if (reply->getSender() != lastTarget) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
switch (reply->getCommand()) {
case ActionMessage::COMPLETION_SUCCESS:
commandCount--;
owner->completionSuccessfulReceived(ActionMessage::getActionId(reply));
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
case ActionMessage::COMPLETION_FAILED:
commandCount--;
owner->completionFailedReceived(ActionMessage::getActionId(reply),
ActionMessage::getReturnCode(reply));
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
case ActionMessage::STEP_SUCCESS:
owner->stepSuccessfulReceived(ActionMessage::getActionId(reply),
ActionMessage::getStep(reply));
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
case ActionMessage::STEP_FAILED:
commandCount--;
owner->stepFailedReceived(ActionMessage::getActionId(reply), ActionMessage::getStep(reply),
ActionMessage::getReturnCode(reply));
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
case ActionMessage::DATA_REPLY:
extractDataForOwner(ActionMessage::getActionId(reply), ActionMessage::getStoreId(reply));
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
default:
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
}
uint8_t CommandActionHelper::getCommandCount() const { return commandCount; }
void CommandActionHelper::extractDataForOwner(ActionId_t actionId, store_address_t storeId) {
- const uint8_t *data = NULL;
+ const uint8_t *data = nullptr;
size_t size = 0;
ReturnValue_t result = ipcStore->getData(storeId, &data, &size);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return;
}
owner->dataReceived(actionId, data, size);
diff --git a/src/fsfw/action/CommandActionHelper.h b/src/fsfw/action/CommandActionHelper.h
index dd8ad7f1..55176e09 100644
--- a/src/fsfw/action/CommandActionHelper.h
+++ b/src/fsfw/action/CommandActionHelper.h
@@ -4,7 +4,7 @@
#include "ActionMessage.h"
#include "fsfw/ipc/MessageQueueIF.h"
#include "fsfw/objectmanager/ObjectManagerIF.h"
-#include "fsfw/returnvalues/HasReturnvaluesIF.h"
+#include "fsfw/returnvalues/returnvalue.h"
#include "fsfw/serialize/SerializeIF.h"
#include "fsfw/storagemanager/StorageManagerIF.h"
@@ -14,14 +14,14 @@ class CommandActionHelper {
friend class CommandsActionsIF;
public:
- CommandActionHelper(CommandsActionsIF* owner);
+ explicit CommandActionHelper(CommandsActionsIF* owner);
virtual ~CommandActionHelper();
ReturnValue_t commandAction(object_id_t commandTo, ActionId_t actionId, const uint8_t* data,
uint32_t size);
ReturnValue_t commandAction(object_id_t commandTo, ActionId_t actionId, SerializeIF* data);
ReturnValue_t initialize();
ReturnValue_t handleReply(CommandMessage* reply);
- uint8_t getCommandCount() const;
+ [[nodiscard]] uint8_t getCommandCount() const;
private:
CommandsActionsIF* owner;
diff --git a/src/fsfw/action/CommandsActionsIF.h b/src/fsfw/action/CommandsActionsIF.h
index 5870a9f2..a183051d 100644
--- a/src/fsfw/action/CommandsActionsIF.h
+++ b/src/fsfw/action/CommandsActionsIF.h
@@ -1,9 +1,9 @@
#ifndef FSFW_ACTION_COMMANDSACTIONSIF_H_
#define FSFW_ACTION_COMMANDSACTIONSIF_H_
-#include "../ipc/MessageQueueIF.h"
-#include "../returnvalues/HasReturnvaluesIF.h"
#include "CommandActionHelper.h"
+#include "fsfw/ipc/MessageQueueIF.h"
+#include "fsfw/returnvalues/returnvalue.h"
/**
* 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 ReturnValue_t OBJECT_HAS_NO_FUNCTIONS = MAKE_RETURN_CODE(1);
static const ReturnValue_t ALREADY_COMMANDING = MAKE_RETURN_CODE(2);
- virtual ~CommandsActionsIF() {}
+ virtual ~CommandsActionsIF() = default;
virtual MessageQueueIF* getCommandQueuePtr() = 0;
protected:
diff --git a/src/fsfw/action/HasActionsIF.h b/src/fsfw/action/HasActionsIF.h
index acc502d7..29e267a0 100644
--- a/src/fsfw/action/HasActionsIF.h
+++ b/src/fsfw/action/HasActionsIF.h
@@ -1,11 +1,11 @@
#ifndef FSFW_ACTION_HASACTIONSIF_H_
#define FSFW_ACTION_HASACTIONSIF_H_
-#include "../ipc/MessageQueueIF.h"
-#include "../returnvalues/HasReturnvaluesIF.h"
#include "ActionHelper.h"
#include "ActionMessage.h"
#include "SimpleActionHelper.h"
+#include "fsfw/ipc/MessageQueueIF.h"
+#include "fsfw/returnvalues/returnvalue.h"
/**
* @brief
@@ -40,12 +40,12 @@ class HasActionsIF {
static const ReturnValue_t INVALID_PARAMETERS = MAKE_RETURN_CODE(2);
static const ReturnValue_t EXECUTION_FINISHED = MAKE_RETURN_CODE(3);
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
* @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.
* The ActionHelpers will execute this function and behave differently
@@ -53,7 +53,7 @@ class HasActionsIF {
*
* @return
* -@c EXECUTION_FINISHED Finish reply will be generated
- * -@c Not RETURN_OK Step failure reply will be generated
+ * -@c Not returnvalue::OK Step failure reply will be generated
*/
virtual ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
const uint8_t* data, size_t size) = 0;
diff --git a/src/fsfw/action/SimpleActionHelper.cpp b/src/fsfw/action/SimpleActionHelper.cpp
index 894f0df6..b9b9922e 100644
--- a/src/fsfw/action/SimpleActionHelper.cpp
+++ b/src/fsfw/action/SimpleActionHelper.cpp
@@ -3,13 +3,13 @@
SimpleActionHelper::SimpleActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue)
: ActionHelper(setOwner, useThisQueue), isExecuting(false) {}
-SimpleActionHelper::~SimpleActionHelper() {}
+SimpleActionHelper::~SimpleActionHelper() = default;
void SimpleActionHelper::step(ReturnValue_t result) {
// STEP_OFFESET is subtracted to compensate for adding offset in base
// method, which is not necessary here.
ActionHelper::step(stepCount - STEP_OFFSET, lastCommander, lastAction, result);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
resetHelper();
}
}
@@ -38,10 +38,10 @@ void SimpleActionHelper::prepareExecution(MessageQueueId_t commandedBy, ActionId
ActionMessage::setStepReply(&reply, actionId, 0, HasActionsIF::IS_BUSY);
queueToUse->sendMessage(commandedBy, &reply);
}
- const uint8_t* dataPtr = NULL;
+ const uint8_t* dataPtr = nullptr;
size_t size = 0;
ReturnValue_t result = ipcStore->getData(dataAddress, &dataPtr, &size);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
ActionMessage::setStepReply(&reply, actionId, 0, result);
queueToUse->sendMessage(commandedBy, &reply);
return;
@@ -51,12 +51,12 @@ void SimpleActionHelper::prepareExecution(MessageQueueId_t commandedBy, ActionId
result = owner->executeAction(actionId, commandedBy, dataPtr, size);
ipcStore->deleteData(dataAddress);
switch (result) {
- case HasReturnvaluesIF::RETURN_OK:
+ case returnvalue::OK:
isExecuting = true;
stepCount++;
break;
case HasActionsIF::EXECUTION_FINISHED:
- ActionMessage::setCompletionReply(&reply, actionId, true, HasReturnvaluesIF::RETURN_OK);
+ ActionMessage::setCompletionReply(&reply, actionId, true, returnvalue::OK);
queueToUse->sendMessage(commandedBy, &reply);
break;
default:
diff --git a/src/fsfw/action/SimpleActionHelper.h b/src/fsfw/action/SimpleActionHelper.h
index 5cb85fbd..cfe05231 100644
--- a/src/fsfw/action/SimpleActionHelper.h
+++ b/src/fsfw/action/SimpleActionHelper.h
@@ -11,15 +11,15 @@
class SimpleActionHelper : public ActionHelper {
public:
SimpleActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue);
- virtual ~SimpleActionHelper();
- void step(ReturnValue_t result = HasReturnvaluesIF::RETURN_OK);
- void finish(ReturnValue_t result = HasReturnvaluesIF::RETURN_OK);
+ ~SimpleActionHelper() override;
+ void step(ReturnValue_t result = returnvalue::OK);
+ void finish(ReturnValue_t result = returnvalue::OK);
ReturnValue_t reportData(SerializeIF* data);
protected:
void prepareExecution(MessageQueueId_t commandedBy, ActionId_t actionId,
- store_address_t dataAddress);
- virtual void resetHelper();
+ store_address_t dataAddress) override;
+ void resetHelper() override;
private:
bool isExecuting;
@@ -28,4 +28,4 @@ class SimpleActionHelper : public ActionHelper {
uint8_t stepCount = 0;
};
-#endif /* SIMPLEACTIONHELPER_H_ */
+#endif /* FSFW_ACTION_SIMPLEACTIONHELPER_H_ */
diff --git a/src/fsfw/cfdp/CFDPMessage.cpp b/src/fsfw/cfdp/CFDPMessage.cpp
deleted file mode 100644
index fee55715..00000000
--- a/src/fsfw/cfdp/CFDPMessage.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-#include "CFDPMessage.h"
-
-CFDPMessage::CFDPMessage() {}
-
-CFDPMessage::~CFDPMessage() {}
-
-void CFDPMessage::setCommand(CommandMessage *message, store_address_t cfdpPacket) {
- message->setParameter(cfdpPacket.raw);
-}
-
-store_address_t CFDPMessage::getStoreId(const CommandMessage *message) {
- store_address_t storeAddressCFDPPacket;
- storeAddressCFDPPacket = message->getParameter();
- return storeAddressCFDPPacket;
-}
-
-void CFDPMessage::clear(CommandMessage *message) {}
diff --git a/src/fsfw/cfdp/CMakeLists.txt b/src/fsfw/cfdp/CMakeLists.txt
index 0b926a9a..f2affbb4 100644
--- a/src/fsfw/cfdp/CMakeLists.txt
+++ b/src/fsfw/cfdp/CMakeLists.txt
@@ -1,4 +1,4 @@
-target_sources(${LIB_FSFW_NAME} PRIVATE CFDPHandler.cpp CFDPMessage.cpp)
+target_sources(${LIB_FSFW_NAME} PRIVATE CfdpHandler.cpp CfdpMessage.cpp)
add_subdirectory(pdu)
add_subdirectory(tlv)
diff --git a/src/fsfw/cfdp/CFDPHandler.cpp b/src/fsfw/cfdp/CfdpHandler.cpp
similarity index 53%
rename from src/fsfw/cfdp/CFDPHandler.cpp
rename to src/fsfw/cfdp/CfdpHandler.cpp
index 96baa98c..cd6caf3c 100644
--- a/src/fsfw/cfdp/CFDPHandler.cpp
+++ b/src/fsfw/cfdp/CfdpHandler.cpp
@@ -1,33 +1,32 @@
-#include "fsfw/cfdp/CFDPHandler.h"
+#include "fsfw/cfdp/CfdpHandler.h"
-#include "fsfw/cfdp/CFDPMessage.h"
+#include "fsfw/cfdp/CfdpMessage.h"
#include "fsfw/ipc/CommandMessage.h"
#include "fsfw/ipc/QueueFactory.h"
-#include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/storagemanager/storeAddress.h"
#include "fsfw/tmtcservices/AcceptsTelemetryIF.h"
-object_id_t CFDPHandler::packetSource = 0;
-object_id_t CFDPHandler::packetDestination = 0;
+object_id_t CfdpHandler::packetSource = 0;
+object_id_t CfdpHandler::packetDestination = 0;
-CFDPHandler::CFDPHandler(object_id_t setObjectId, CFDPDistributor* dist)
+CfdpHandler::CfdpHandler(object_id_t setObjectId, CFDPDistributor* dist)
: SystemObject(setObjectId) {
requestQueue = QueueFactory::instance()->createMessageQueue(CFDP_HANDLER_MAX_RECEPTION);
distributor = dist;
}
-CFDPHandler::~CFDPHandler() {}
+CfdpHandler::~CfdpHandler() = default;
-ReturnValue_t CFDPHandler::initialize() {
+ReturnValue_t CfdpHandler::initialize() {
ReturnValue_t result = SystemObject::initialize();
- if (result != RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
this->distributor->registerHandler(this);
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
-ReturnValue_t CFDPHandler::handleRequest(store_address_t storeId) {
+ReturnValue_t CfdpHandler::handleRequest(store_address_t storeId) {
#if FSFW_VERBOSE_LEVEL >= 1
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::debug << "CFDPHandler::handleRequest" << std::endl;
@@ -38,20 +37,20 @@ ReturnValue_t CFDPHandler::handleRequest(store_address_t storeId) {
// TODO read out packet from store using storeId
- return RETURN_OK;
+ return returnvalue::OK;
}
-ReturnValue_t CFDPHandler::performOperation(uint8_t opCode) {
- ReturnValue_t status = RETURN_OK;
+ReturnValue_t CfdpHandler::performOperation(uint8_t opCode) {
+ ReturnValue_t status = returnvalue::OK;
CommandMessage currentMessage;
- for (status = this->requestQueue->receiveMessage(¤tMessage); status == RETURN_OK;
+ for (status = this->requestQueue->receiveMessage(¤tMessage); status == returnvalue::OK;
status = this->requestQueue->receiveMessage(¤tMessage)) {
- store_address_t storeId = CFDPMessage::getStoreId(¤tMessage);
+ store_address_t storeId = CfdpMessage::getStoreId(¤tMessage);
this->handleRequest(storeId);
}
- return RETURN_OK;
+ return returnvalue::OK;
}
-uint16_t CFDPHandler::getIdentifier() { return 0; }
+uint32_t CfdpHandler::getIdentifier() const { return 0; }
-MessageQueueId_t CFDPHandler::getRequestQueue() { return this->requestQueue->getId(); }
+MessageQueueId_t CfdpHandler::getRequestQueue() const { return this->requestQueue->getId(); }
diff --git a/src/fsfw/cfdp/CFDPHandler.h b/src/fsfw/cfdp/CfdpHandler.h
similarity index 75%
rename from src/fsfw/cfdp/CFDPHandler.h
rename to src/fsfw/cfdp/CfdpHandler.h
index abbac6b6..14058893 100644
--- a/src/fsfw/cfdp/CFDPHandler.h
+++ b/src/fsfw/cfdp/CfdpHandler.h
@@ -3,7 +3,7 @@
#include "fsfw/ipc/MessageQueueIF.h"
#include "fsfw/objectmanager/SystemObject.h"
-#include "fsfw/returnvalues/HasReturnvaluesIF.h"
+#include "fsfw/returnvalues/returnvalue.h"
#include "fsfw/tasks/ExecutableObjectIF.h"
#include "fsfw/tcdistribution/CFDPDistributor.h"
#include "fsfw/tmtcservices/AcceptsTelecommandsIF.h"
@@ -12,24 +12,21 @@ namespace Factory {
void setStaticFrameworkObjectIds();
}
-class CFDPHandler : public ExecutableObjectIF,
- public AcceptsTelecommandsIF,
- public SystemObject,
- public HasReturnvaluesIF {
+class CfdpHandler : public ExecutableObjectIF, public AcceptsTelecommandsIF, public SystemObject {
friend void(Factory::setStaticFrameworkObjectIds)();
public:
- CFDPHandler(object_id_t setObjectId, CFDPDistributor* distributor);
+ CfdpHandler(object_id_t setObjectId, CFDPDistributor* distributor);
/**
* The destructor is empty.
*/
- virtual ~CFDPHandler();
+ virtual ~CfdpHandler();
virtual ReturnValue_t handleRequest(store_address_t storeId);
virtual ReturnValue_t initialize() override;
- virtual uint16_t getIdentifier() override;
- MessageQueueId_t getRequestQueue() override;
+ uint32_t getIdentifier() const override;
+ MessageQueueId_t getRequestQueue() const override;
ReturnValue_t performOperation(uint8_t opCode) override;
protected:
@@ -45,7 +42,7 @@ class CFDPHandler : public ExecutableObjectIF,
* The current CFDP packet to be processed.
* It is deleted after handleRequest was executed.
*/
- CFDPPacketStored currentPacket;
+ CfdpPacketStored currentPacket;
static object_id_t packetSource;
diff --git a/src/fsfw/cfdp/CfdpMessage.cpp b/src/fsfw/cfdp/CfdpMessage.cpp
new file mode 100644
index 00000000..ea4e2c98
--- /dev/null
+++ b/src/fsfw/cfdp/CfdpMessage.cpp
@@ -0,0 +1,17 @@
+#include "CfdpMessage.h"
+
+CfdpMessage::CfdpMessage() = default;
+
+CfdpMessage::~CfdpMessage() = default;
+
+void CfdpMessage::setCommand(CommandMessage *message, store_address_t cfdpPacket) {
+ message->setParameter(cfdpPacket.raw);
+}
+
+store_address_t CfdpMessage::getStoreId(const CommandMessage *message) {
+ store_address_t storeId;
+ storeId = static_cast(message->getParameter());
+ return storeId;
+}
+
+void CfdpMessage::clear(CommandMessage *message) {}
diff --git a/src/fsfw/cfdp/CFDPMessage.h b/src/fsfw/cfdp/CfdpMessage.h
similarity index 89%
rename from src/fsfw/cfdp/CFDPMessage.h
rename to src/fsfw/cfdp/CfdpMessage.h
index 3de723eb..a3ee9421 100644
--- a/src/fsfw/cfdp/CFDPMessage.h
+++ b/src/fsfw/cfdp/CfdpMessage.h
@@ -5,14 +5,14 @@
#include "fsfw/objectmanager/ObjectManagerIF.h"
#include "fsfw/storagemanager/StorageManagerIF.h"
-class CFDPMessage {
+class CfdpMessage {
private:
- CFDPMessage();
+ CfdpMessage();
public:
static const uint8_t MESSAGE_ID = messagetypes::CFDP;
- virtual ~CFDPMessage();
+ virtual ~CfdpMessage();
static void setCommand(CommandMessage* message, store_address_t cfdpPacket);
static store_address_t getStoreId(const CommandMessage* message);
diff --git a/src/fsfw/cfdp/FileSize.h b/src/fsfw/cfdp/FileSize.h
index 6dae9683..756b0e0a 100644
--- a/src/fsfw/cfdp/FileSize.h
+++ b/src/fsfw/cfdp/FileSize.h
@@ -43,7 +43,7 @@ struct FileSize : public SerializeIF {
uint32_t sizeTmp = 0;
ReturnValue_t result =
SerializeAdapter::deSerialize(&sizeTmp, buffer, size, streamEndianness);
- if (result == HasReturnvaluesIF::RETURN_OK) {
+ if (result == returnvalue::OK) {
fileSize = sizeTmp;
}
return result;
@@ -53,11 +53,11 @@ struct FileSize : public SerializeIF {
ReturnValue_t setFileSize(uint64_t fileSize, bool largeFile) {
if (not largeFile and fileSize > UINT32_MAX) {
// TODO: emit warning here
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
this->fileSize = fileSize;
this->largeFile = largeFile;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
bool isLargeFile() const { return largeFile; }
diff --git a/src/fsfw/cfdp/definitions.h b/src/fsfw/cfdp/definitions.h
index eb21f5bf..53022432 100644
--- a/src/fsfw/cfdp/definitions.h
+++ b/src/fsfw/cfdp/definitions.h
@@ -7,7 +7,7 @@
#include
#include "fsfw/returnvalues/FwClassIds.h"
-#include "fsfw/returnvalues/HasReturnvaluesIF.h"
+#include "fsfw/returnvalues/returnvalue.h"
namespace cfdp {
@@ -15,28 +15,24 @@ static constexpr uint8_t VERSION_BITS = 0b00100000;
static constexpr uint8_t CFDP_CLASS_ID = CLASS_ID::CFDP;
-static constexpr ReturnValue_t INVALID_TLV_TYPE =
- HasReturnvaluesIF::makeReturnCode(CFDP_CLASS_ID, 1);
-static constexpr ReturnValue_t INVALID_DIRECTIVE_FIELDS =
- HasReturnvaluesIF::makeReturnCode(CFDP_CLASS_ID, 2);
-static constexpr ReturnValue_t INVALID_PDU_DATAFIELD_LEN =
- HasReturnvaluesIF::makeReturnCode(CFDP_CLASS_ID, 3);
+static constexpr ReturnValue_t INVALID_TLV_TYPE = returnvalue::makeCode(CFDP_CLASS_ID, 1);
+static constexpr ReturnValue_t INVALID_DIRECTIVE_FIELDS = returnvalue::makeCode(CFDP_CLASS_ID, 2);
+static constexpr ReturnValue_t INVALID_PDU_DATAFIELD_LEN = returnvalue::makeCode(CFDP_CLASS_ID, 3);
static constexpr ReturnValue_t INVALID_ACK_DIRECTIVE_FIELDS =
- HasReturnvaluesIF::makeReturnCode(CFDP_CLASS_ID, 4);
+ returnvalue::makeCode(CFDP_CLASS_ID, 4);
//! Can not parse options. This can also occur because there are options
//! available but the user did not pass a valid options array
static constexpr ReturnValue_t METADATA_CANT_PARSE_OPTIONS =
- HasReturnvaluesIF::makeReturnCode(CFDP_CLASS_ID, 5);
-static constexpr ReturnValue_t NAK_CANT_PARSE_OPTIONS =
- HasReturnvaluesIF::makeReturnCode(CFDP_CLASS_ID, 6);
+ returnvalue::makeCode(CFDP_CLASS_ID, 5);
+static constexpr ReturnValue_t NAK_CANT_PARSE_OPTIONS = returnvalue::makeCode(CFDP_CLASS_ID, 6);
static constexpr ReturnValue_t FINISHED_CANT_PARSE_FS_RESPONSES =
- HasReturnvaluesIF::makeReturnCode(CFDP_CLASS_ID, 6);
+ returnvalue::makeCode(CFDP_CLASS_ID, 6);
static constexpr ReturnValue_t FILESTORE_REQUIRES_SECOND_FILE =
- HasReturnvaluesIF::makeReturnCode(CFDP_CLASS_ID, 8);
+ returnvalue::makeCode(CFDP_CLASS_ID, 8);
//! Can not parse filestore response because user did not pass a valid instance
//! or remaining size is invalid
static constexpr ReturnValue_t FILESTORE_RESPONSE_CANT_PARSE_FS_MESSAGE =
- HasReturnvaluesIF::makeReturnCode(CFDP_CLASS_ID, 9);
+ returnvalue::makeCode(CFDP_CLASS_ID, 9);
//! Checksum types according to the SANA Checksum Types registry
//! https://sanaregistry.org/r/checksum_identifiers/
diff --git a/src/fsfw/cfdp/pdu/AckPduDeserializer.cpp b/src/fsfw/cfdp/pdu/AckPduDeserializer.cpp
index f5babf4b..24357a38 100644
--- a/src/fsfw/cfdp/pdu/AckPduDeserializer.cpp
+++ b/src/fsfw/cfdp/pdu/AckPduDeserializer.cpp
@@ -5,7 +5,7 @@ AckPduDeserializer::AckPduDeserializer(const uint8_t* pduBuf, size_t maxSize, Ac
ReturnValue_t AckPduDeserializer::parseData() {
ReturnValue_t result = FileDirectiveDeserializer::parseData();
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
size_t currentIdx = FileDirectiveDeserializer::getHeaderSize();
@@ -15,7 +15,7 @@ ReturnValue_t AckPduDeserializer::parseData() {
if (not checkAndSetCodes(rawPtr[currentIdx], rawPtr[currentIdx + 1])) {
return cfdp::INVALID_ACK_DIRECTIVE_FIELDS;
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
bool AckPduDeserializer::checkAndSetCodes(uint8_t firstByte, uint8_t secondByte) {
diff --git a/src/fsfw/cfdp/pdu/AckPduSerializer.cpp b/src/fsfw/cfdp/pdu/AckPduSerializer.cpp
index d19418f1..b06f4f00 100644
--- a/src/fsfw/cfdp/pdu/AckPduSerializer.cpp
+++ b/src/fsfw/cfdp/pdu/AckPduSerializer.cpp
@@ -11,7 +11,7 @@ ReturnValue_t AckPduSerializer::serialize(uint8_t **buffer, size_t *size, size_t
Endianness streamEndianness) const {
ReturnValue_t result =
FileDirectiveSerializer::serialize(buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
cfdp::FileDirectives ackedDirective = ackInfo.getAckedDirective();
@@ -21,7 +21,7 @@ ReturnValue_t AckPduSerializer::serialize(uint8_t **buffer, size_t *size, size_t
if (ackedDirective != cfdp::FileDirectives::FINISH and
ackedDirective != cfdp::FileDirectives::EOF_DIRECTIVE) {
// TODO: better returncode
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
if (*size + 2 > maxSize) {
return SerializeIF::BUFFER_TOO_SHORT;
@@ -32,5 +32,5 @@ ReturnValue_t AckPduSerializer::serialize(uint8_t **buffer, size_t *size, size_t
**buffer = ackedConditionCode << 4 | transactionStatus;
*buffer += 1;
*size += 1;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
diff --git a/src/fsfw/cfdp/pdu/EofPduDeserializer.cpp b/src/fsfw/cfdp/pdu/EofPduDeserializer.cpp
index e1ab8dc9..1a70e225 100644
--- a/src/fsfw/cfdp/pdu/EofPduDeserializer.cpp
+++ b/src/fsfw/cfdp/pdu/EofPduDeserializer.cpp
@@ -8,7 +8,7 @@ EofPduDeserializer::EofPduDeserializer(const uint8_t* pduBuf, size_t maxSize, Eo
ReturnValue_t EofPduDeserializer::parseData() {
ReturnValue_t result = FileDirectiveDeserializer::parseData();
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
@@ -31,7 +31,7 @@ ReturnValue_t EofPduDeserializer::parseData() {
uint32_t checksum = 0;
auto endianness = getEndianness();
result = SerializeAdapter::deSerialize(&checksum, &bufPtr, &deserLen, endianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
info.setChecksum(checksum);
@@ -44,7 +44,7 @@ ReturnValue_t EofPduDeserializer::parseData() {
result = SerializeAdapter::deSerialize(&fileSizeValue, &bufPtr, &deserLen, endianness);
info.setFileSize(fileSizeValue, false);
}
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
if (info.getConditionCode() != cfdp::ConditionCode::NO_ERROR) {
@@ -61,7 +61,7 @@ ReturnValue_t EofPduDeserializer::parseData() {
" given TLV pointer invalid");
#endif
#endif /* FSFW_VERBOSE_LEVEL >= 1 */
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
result = tlvPtr->deSerialize(&bufPtr, &deserLen, endianness);
}
diff --git a/src/fsfw/cfdp/pdu/EofPduSerializer.cpp b/src/fsfw/cfdp/pdu/EofPduSerializer.cpp
index e9fe0ca0..aafd332e 100644
--- a/src/fsfw/cfdp/pdu/EofPduSerializer.cpp
+++ b/src/fsfw/cfdp/pdu/EofPduSerializer.cpp
@@ -16,7 +16,7 @@ ReturnValue_t EofPduSerializer::serialize(uint8_t **buffer, size_t *size, size_t
Endianness streamEndianness) const {
ReturnValue_t result =
FileDirectiveSerializer::serialize(buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
if (*size + 1 > maxSize) {
@@ -27,7 +27,7 @@ ReturnValue_t EofPduSerializer::serialize(uint8_t **buffer, size_t *size, size_t
*size += 1;
uint32_t checksum = info.getChecksum();
result = SerializeAdapter::serialize(&checksum, buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
if (info.getFileSize().isLargeFile()) {
diff --git a/src/fsfw/cfdp/pdu/FileDataDeserializer.cpp b/src/fsfw/cfdp/pdu/FileDataDeserializer.cpp
index 240c4188..274f8b8a 100644
--- a/src/fsfw/cfdp/pdu/FileDataDeserializer.cpp
+++ b/src/fsfw/cfdp/pdu/FileDataDeserializer.cpp
@@ -6,7 +6,7 @@ FileDataDeserializer::FileDataDeserializer(const uint8_t* pduBuf, size_t maxSize
ReturnValue_t FileDataDeserializer::parseData() {
ReturnValue_t result = HeaderDeserializer::parseData();
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
size_t currentIdx = HeaderDeserializer::getHeaderSize();
@@ -32,13 +32,13 @@ ReturnValue_t FileDataDeserializer::parseData() {
}
}
result = info.getOffset().deSerialize(&buf, &remSize, this->getEndianness());
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
if (remSize > 0) {
info.setFileData(buf, remSize);
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
SerializeIF::Endianness FileDataDeserializer::getEndianness() const { return endianness; }
diff --git a/src/fsfw/cfdp/pdu/FileDataInfo.cpp b/src/fsfw/cfdp/pdu/FileDataInfo.cpp
index c410adce..39b6472d 100644
--- a/src/fsfw/cfdp/pdu/FileDataInfo.cpp
+++ b/src/fsfw/cfdp/pdu/FileDataInfo.cpp
@@ -50,11 +50,11 @@ ReturnValue_t FileDataInfo::addSegmentMetadataInfo(cfdp::RecordContinuationState
this->segmentMetadataFlag = cfdp::SegmentMetadataFlag::PRESENT;
this->recContState = recContState;
if (segmentMetadataLen > 63) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
this->segmentMetadata = segmentMetadata;
this->segmentMetadataLen = segmentMetadataLen;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
const uint8_t *FileDataInfo::getFileData(size_t *fileSize) const {
diff --git a/src/fsfw/cfdp/pdu/FileDataSerializer.cpp b/src/fsfw/cfdp/pdu/FileDataSerializer.cpp
index 837b418b..bdc2d42f 100644
--- a/src/fsfw/cfdp/pdu/FileDataSerializer.cpp
+++ b/src/fsfw/cfdp/pdu/FileDataSerializer.cpp
@@ -17,7 +17,7 @@ void FileDataSerializer::update() {
ReturnValue_t FileDataSerializer::serialize(uint8_t** buffer, size_t* size, size_t maxSize,
Endianness streamEndianness) const {
ReturnValue_t result = HeaderSerializer::serialize(buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
if (*size + this->getSerializedSize() > maxSize) {
@@ -36,7 +36,7 @@ ReturnValue_t FileDataSerializer::serialize(uint8_t** buffer, size_t* size, size
}
cfdp::FileSize& offset = info.getOffset();
result = offset.serialize(this->getLargeFileFlag(), buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
size_t fileSize = 0;
@@ -47,7 +47,7 @@ ReturnValue_t FileDataSerializer::serialize(uint8_t** buffer, size_t* size, size
std::memcpy(*buffer, readOnlyPtr, fileSize);
*buffer += fileSize;
*size += fileSize;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
size_t FileDataSerializer::getSerializedSize() const {
diff --git a/src/fsfw/cfdp/pdu/FileDirectiveDeserializer.cpp b/src/fsfw/cfdp/pdu/FileDirectiveDeserializer.cpp
index 3c0552f7..9d2a1e0a 100644
--- a/src/fsfw/cfdp/pdu/FileDirectiveDeserializer.cpp
+++ b/src/fsfw/cfdp/pdu/FileDirectiveDeserializer.cpp
@@ -7,7 +7,7 @@ cfdp::FileDirectives FileDirectiveDeserializer::getFileDirective() const { retur
ReturnValue_t FileDirectiveDeserializer::parseData() {
ReturnValue_t result = HeaderDeserializer::parseData();
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
if (this->getPduDataFieldLen() < 1) {
@@ -21,7 +21,7 @@ ReturnValue_t FileDirectiveDeserializer::parseData() {
return cfdp::INVALID_DIRECTIVE_FIELDS;
}
setFileDirective(static_cast(rawPtr[currentIdx]));
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
size_t FileDirectiveDeserializer::getHeaderSize() const {
diff --git a/src/fsfw/cfdp/pdu/FileDirectiveSerializer.cpp b/src/fsfw/cfdp/pdu/FileDirectiveSerializer.cpp
index 98b2d0a2..5845ba56 100644
--- a/src/fsfw/cfdp/pdu/FileDirectiveSerializer.cpp
+++ b/src/fsfw/cfdp/pdu/FileDirectiveSerializer.cpp
@@ -13,13 +13,13 @@ size_t FileDirectiveSerializer::getSerializedSize() const {
ReturnValue_t FileDirectiveSerializer::serialize(uint8_t **buffer, size_t *size, size_t maxSize,
Endianness streamEndianness) const {
if (buffer == nullptr or size == nullptr) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
if (FileDirectiveSerializer::getWholePduSize() > maxSize) {
return BUFFER_TOO_SHORT;
}
ReturnValue_t result = HeaderSerializer::serialize(buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
@@ -29,7 +29,7 @@ ReturnValue_t FileDirectiveSerializer::serialize(uint8_t **buffer, size_t *size,
**buffer = directiveCode;
*buffer += 1;
*size += 1;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
void FileDirectiveSerializer::setDirectiveDataFieldLen(size_t len) {
diff --git a/src/fsfw/cfdp/pdu/FinishedInfo.cpp b/src/fsfw/cfdp/pdu/FinishedInfo.cpp
index c32372a1..ea4ffa89 100644
--- a/src/fsfw/cfdp/pdu/FinishedInfo.cpp
+++ b/src/fsfw/cfdp/pdu/FinishedInfo.cpp
@@ -46,14 +46,14 @@ ReturnValue_t FinishedInfo::setFilestoreResponsesArray(FilestoreResponseTlv** fs
if (maxFsResponsesLen != nullptr) {
this->fsResponsesMaxLen = *maxFsResponsesLen;
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t FinishedInfo::getFilestoreResonses(FilestoreResponseTlv*** fsResponses,
size_t* fsResponsesLen,
size_t* fsResponsesMaxLen) {
if (fsResponses == nullptr) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
*fsResponses = this->fsResponses;
if (fsResponsesLen != nullptr) {
@@ -62,7 +62,7 @@ ReturnValue_t FinishedInfo::getFilestoreResonses(FilestoreResponseTlv*** fsRespo
if (fsResponsesMaxLen != nullptr) {
*fsResponsesMaxLen = this->fsResponsesMaxLen;
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
void FinishedInfo::setFaultLocation(EntityIdTlv* faultLocation) {
@@ -71,10 +71,10 @@ void FinishedInfo::setFaultLocation(EntityIdTlv* faultLocation) {
ReturnValue_t FinishedInfo::getFaultLocation(EntityIdTlv** faultLocation) {
if (this->faultLocation == nullptr) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
*faultLocation = this->faultLocation;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
cfdp::ConditionCode FinishedInfo::getConditionCode() const { return conditionCode; }
diff --git a/src/fsfw/cfdp/pdu/FinishedPduDeserializer.cpp b/src/fsfw/cfdp/pdu/FinishedPduDeserializer.cpp
index feeca617..7d16394e 100644
--- a/src/fsfw/cfdp/pdu/FinishedPduDeserializer.cpp
+++ b/src/fsfw/cfdp/pdu/FinishedPduDeserializer.cpp
@@ -6,7 +6,7 @@ FinishPduDeserializer::FinishPduDeserializer(const uint8_t* pduBuf, size_t maxSi
ReturnValue_t FinishPduDeserializer::parseData() {
ReturnValue_t result = FileDirectiveDeserializer::parseData();
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
size_t currentIdx = FileDirectiveDeserializer::getHeaderSize();
@@ -33,7 +33,7 @@ FinishedInfo& FinishPduDeserializer::getInfo() { return finishedInfo; }
ReturnValue_t FinishPduDeserializer::parseTlvs(size_t remLen, size_t currentIdx, const uint8_t* buf,
cfdp::ConditionCode conditionCode) {
- ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
+ ReturnValue_t result = returnvalue::OK;
size_t fsResponsesIdx = 0;
auto endianness = getEndianness();
FilestoreResponseTlv** fsResponseArray = nullptr;
@@ -60,7 +60,7 @@ ReturnValue_t FinishPduDeserializer::parseTlvs(size_t remLen, size_t currentIdx,
return cfdp::FINISHED_CANT_PARSE_FS_RESPONSES;
}
result = fsResponseArray[fsResponsesIdx]->deSerialize(&buf, &remLen, endianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
fsResponsesIdx += 1;
@@ -72,11 +72,11 @@ ReturnValue_t FinishPduDeserializer::parseTlvs(size_t remLen, size_t currentIdx,
return cfdp::INVALID_TLV_TYPE;
}
result = finishedInfo.getFaultLocation(&faultLocation);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result = faultLocation->deSerialize(&buf, &remLen, endianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
} else {
diff --git a/src/fsfw/cfdp/pdu/FinishedPduSerializer.cpp b/src/fsfw/cfdp/pdu/FinishedPduSerializer.cpp
index 115a2c9c..ccc86908 100644
--- a/src/fsfw/cfdp/pdu/FinishedPduSerializer.cpp
+++ b/src/fsfw/cfdp/pdu/FinishedPduSerializer.cpp
@@ -17,7 +17,7 @@ ReturnValue_t FinishPduSerializer::serialize(uint8_t **buffer, size_t *size, siz
Endianness streamEndianness) const {
ReturnValue_t result =
FileDirectiveSerializer::serialize(buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
if (*size + 1 >= maxSize) {
@@ -34,13 +34,13 @@ ReturnValue_t FinishPduSerializer::serialize(uint8_t **buffer, size_t *size, siz
finishInfo.getFilestoreResonses(&fsResponsesArray, &fsResponsesArrayLen, nullptr);
for (size_t idx = 0; idx < fsResponsesArrayLen; idx++) {
result = fsResponsesArray[idx]->serialize(buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
}
}
EntityIdTlv *entityId = nullptr;
- if (finishInfo.getFaultLocation(&entityId) == HasReturnvaluesIF::RETURN_OK) {
+ if (finishInfo.getFaultLocation(&entityId) == returnvalue::OK) {
result = entityId->serialize(buffer, size, maxSize, streamEndianness);
}
return result;
diff --git a/src/fsfw/cfdp/pdu/HeaderDeserializer.cpp b/src/fsfw/cfdp/pdu/HeaderDeserializer.cpp
index 70f397f8..2dbfed27 100644
--- a/src/fsfw/cfdp/pdu/HeaderDeserializer.cpp
+++ b/src/fsfw/cfdp/pdu/HeaderDeserializer.cpp
@@ -18,7 +18,7 @@ ReturnValue_t HeaderDeserializer::setData(uint8_t *dataPtr, size_t maxSize, void
if (dataPtr == nullptr) {
// Allowed for now
this->fixedHeader = nullptr;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
this->fixedHeader = reinterpret_cast(const_cast(dataPtr));
sourceIdRaw = static_cast(&fixedHeader->variableFieldsStart);
@@ -27,7 +27,7 @@ ReturnValue_t HeaderDeserializer::setData(uint8_t *dataPtr, size_t maxSize, void
seqNumRaw = static_cast(sourceIdRaw) + static_cast(widthEntityIds);
destIdRaw = static_cast(seqNumRaw) + static_cast(widthSeqNum);
this->maxSize = maxSize;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
size_t HeaderDeserializer::getHeaderSize() const {
diff --git a/src/fsfw/cfdp/pdu/HeaderDeserializer.h b/src/fsfw/cfdp/pdu/HeaderDeserializer.h
index ed033697..4c237117 100644
--- a/src/fsfw/cfdp/pdu/HeaderDeserializer.h
+++ b/src/fsfw/cfdp/pdu/HeaderDeserializer.h
@@ -36,8 +36,8 @@ class HeaderDeserializer : public RedirectableDataPointerIF, public PduHeaderIF
/**
* This needs to be called before accessing the PDU fields to avoid segmentation faults.
* @return
- * - RETURN_OK on parse success
- * - RETURN_FAILED Invalid raw data
+ * - returnvalue::OK on parse success
+ * - returnvalue::FAILED Invalid raw data
* - SerializeIF::BUFFER_TOO_SHORT if buffer is shorter than expected
*/
virtual ReturnValue_t parseData();
@@ -61,7 +61,7 @@ class HeaderDeserializer : public RedirectableDataPointerIF, public PduHeaderIF
void getDestId(cfdp::EntityId& destId) const override;
void getTransactionSeqNum(cfdp::TransactionSeqNum& seqNum) const override;
- ReturnValue_t deserResult = HasReturnvaluesIF::RETURN_OK;
+ ReturnValue_t deserResult = returnvalue::OK;
/**
* Can also be used to reset the pointer to a nullptr, but the getter functions will not
diff --git a/src/fsfw/cfdp/pdu/HeaderSerializer.cpp b/src/fsfw/cfdp/pdu/HeaderSerializer.cpp
index 041fb714..5721ad69 100644
--- a/src/fsfw/cfdp/pdu/HeaderSerializer.cpp
+++ b/src/fsfw/cfdp/pdu/HeaderSerializer.cpp
@@ -15,7 +15,7 @@ HeaderSerializer::HeaderSerializer(PduConfig &pduConf, cfdp::PduType pduType,
ReturnValue_t HeaderSerializer::serialize(uint8_t **buffer, size_t *size, size_t maxSize,
Endianness streamEndianness) const {
if (buffer == nullptr or size == nullptr) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
if (maxSize < this->getSerializedSize()) {
return BUFFER_TOO_SHORT;
@@ -32,19 +32,19 @@ ReturnValue_t HeaderSerializer::serialize(uint8_t **buffer, size_t *size, size_t
*buffer += 1;
*size += 4;
ReturnValue_t result = pduConf.sourceId.serialize(buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result = pduConf.seqNum.serialize(buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result = pduConf.destId.serialize(buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
size_t HeaderSerializer::getSerializedSize() const {
@@ -55,7 +55,7 @@ size_t HeaderSerializer::getSerializedSize() const {
ReturnValue_t HeaderSerializer::deSerialize(const uint8_t **buffer, size_t *size,
Endianness streamEndianness) {
// We could implement this, but I prefer dedicated classes
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
size_t HeaderSerializer::getWholePduSize() const {
diff --git a/src/fsfw/cfdp/pdu/KeepAlivePduDeserializer.cpp b/src/fsfw/cfdp/pdu/KeepAlivePduDeserializer.cpp
index 15f80549..79c908cf 100644
--- a/src/fsfw/cfdp/pdu/KeepAlivePduDeserializer.cpp
+++ b/src/fsfw/cfdp/pdu/KeepAlivePduDeserializer.cpp
@@ -6,7 +6,7 @@ KeepAlivePduDeserializer::KeepAlivePduDeserializer(const uint8_t* pduBuf, size_t
ReturnValue_t KeepAlivePduDeserializer::parseData() {
ReturnValue_t result = FileDirectiveDeserializer::parseData();
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
size_t currentIdx = FileDirectiveDeserializer::getHeaderSize();
diff --git a/src/fsfw/cfdp/pdu/KeepAlivePduSerializer.cpp b/src/fsfw/cfdp/pdu/KeepAlivePduSerializer.cpp
index e635ce06..5db4664c 100644
--- a/src/fsfw/cfdp/pdu/KeepAlivePduSerializer.cpp
+++ b/src/fsfw/cfdp/pdu/KeepAlivePduSerializer.cpp
@@ -19,7 +19,7 @@ ReturnValue_t KeepAlivePduSerializer::serialize(uint8_t **buffer, size_t *size,
Endianness streamEndianness) const {
ReturnValue_t result =
FileDirectiveSerializer::serialize(buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
return progress.serialize(this->getLargeFileFlag(), buffer, size, maxSize, streamEndianness);
diff --git a/src/fsfw/cfdp/pdu/MetadataInfo.cpp b/src/fsfw/cfdp/pdu/MetadataInfo.cpp
index a2ca6972..572460cd 100644
--- a/src/fsfw/cfdp/pdu/MetadataInfo.cpp
+++ b/src/fsfw/cfdp/pdu/MetadataInfo.cpp
@@ -39,7 +39,7 @@ cfdp::FileSize& MetadataInfo::getFileSize() { return fileSize; }
ReturnValue_t MetadataInfo::getOptions(cfdp::Tlv*** optionsArray, size_t* optionsLen,
size_t* maxOptsLen) {
if (optionsArray == nullptr or this->optionsArray == nullptr) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
*optionsArray = this->optionsArray;
if (optionsLen != nullptr) {
@@ -48,7 +48,7 @@ ReturnValue_t MetadataInfo::getOptions(cfdp::Tlv*** optionsArray, size_t* option
if (maxOptsLen != nullptr) {
*maxOptsLen = this->maxOptionsLen;
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
bool MetadataInfo::hasOptions() const {
diff --git a/src/fsfw/cfdp/pdu/MetadataPduDeserializer.cpp b/src/fsfw/cfdp/pdu/MetadataPduDeserializer.cpp
index 161eb63a..be9f4ed7 100644
--- a/src/fsfw/cfdp/pdu/MetadataPduDeserializer.cpp
+++ b/src/fsfw/cfdp/pdu/MetadataPduDeserializer.cpp
@@ -6,7 +6,7 @@ MetadataPduDeserializer::MetadataPduDeserializer(const uint8_t* pduBuf, size_t m
ReturnValue_t MetadataPduDeserializer::parseData() {
ReturnValue_t result = FileDirectiveDeserializer::parseData();
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
size_t currentIdx = FileDirectiveDeserializer::getHeaderSize();
@@ -21,15 +21,15 @@ ReturnValue_t MetadataPduDeserializer::parseData() {
buf += 1;
auto endianness = getEndianness();
result = info.getFileSize().deSerialize(&buf, &remSize, endianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result = info.getSourceFileName().deSerialize(&buf, &remSize, endianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result = info.getDestFileName().deSerialize(&buf, &remSize, endianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
@@ -47,7 +47,7 @@ ReturnValue_t MetadataPduDeserializer::parseData() {
return cfdp::METADATA_CANT_PARSE_OPTIONS;
}
result = optionsArray[optsIdx]->deSerialize(&buf, &remSize, endianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
optsIdx++;
diff --git a/src/fsfw/cfdp/pdu/MetadataPduSerializer.cpp b/src/fsfw/cfdp/pdu/MetadataPduSerializer.cpp
index f5c4de0a..041b9b84 100644
--- a/src/fsfw/cfdp/pdu/MetadataPduSerializer.cpp
+++ b/src/fsfw/cfdp/pdu/MetadataPduSerializer.cpp
@@ -17,7 +17,7 @@ ReturnValue_t MetadataPduSerializer::serialize(uint8_t **buffer, size_t *size, s
Endianness streamEndianness) const {
ReturnValue_t result =
FileDirectiveSerializer::serialize(buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
if (*size + 1 >= maxSize) {
@@ -27,15 +27,15 @@ ReturnValue_t MetadataPduSerializer::serialize(uint8_t **buffer, size_t *size, s
*buffer += 1;
*size += 1;
result = info.getFileSize().serialize(buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result = info.getSourceFileName().serialize(buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result = info.getDestFileName().serialize(buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
@@ -45,7 +45,7 @@ ReturnValue_t MetadataPduSerializer::serialize(uint8_t **buffer, size_t *size, s
info.getOptions(&optsArray, &optsLen, nullptr);
for (size_t idx = 0; idx < optsLen; idx++) {
result = optsArray[idx]->serialize(buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
}
diff --git a/src/fsfw/cfdp/pdu/NakPduDeserializer.cpp b/src/fsfw/cfdp/pdu/NakPduDeserializer.cpp
index 9d5f074c..8acc9fc9 100644
--- a/src/fsfw/cfdp/pdu/NakPduDeserializer.cpp
+++ b/src/fsfw/cfdp/pdu/NakPduDeserializer.cpp
@@ -5,7 +5,7 @@ NakPduDeserializer::NakPduDeserializer(const uint8_t* pduBuf, size_t maxSize, Na
ReturnValue_t NakPduDeserializer::parseData() {
ReturnValue_t result = FileDirectiveDeserializer::parseData();
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
size_t currentIdx = FileDirectiveDeserializer::getHeaderSize();
@@ -16,11 +16,11 @@ ReturnValue_t NakPduDeserializer::parseData() {
}
result =
nakInfo.getStartOfScope().deSerialize(&buffer, &remSize, SerializeIF::Endianness::NETWORK);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result = nakInfo.getEndOfScope().deSerialize(&buffer, &remSize, SerializeIF::Endianness::NETWORK);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
nakInfo.setSegmentRequestLen(0);
@@ -39,12 +39,12 @@ ReturnValue_t NakPduDeserializer::parseData() {
}
result =
segReqs[idx].first.deSerialize(&buffer, &remSize, SerializeIF::Endianness::NETWORK);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result =
segReqs[idx].second.deSerialize(&buffer, &remSize, SerializeIF::Endianness::NETWORK);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
idx++;
diff --git a/src/fsfw/cfdp/pdu/NakPduSerializer.cpp b/src/fsfw/cfdp/pdu/NakPduSerializer.cpp
index 95f1bc98..e8634df7 100644
--- a/src/fsfw/cfdp/pdu/NakPduSerializer.cpp
+++ b/src/fsfw/cfdp/pdu/NakPduSerializer.cpp
@@ -17,15 +17,15 @@ ReturnValue_t NakPduSerializer::serialize(uint8_t **buffer, size_t *size, size_t
Endianness streamEndianness) const {
ReturnValue_t result =
FileDirectiveSerializer::serialize(buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result = nakInfo.getStartOfScope().serialize(buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result = nakInfo.getEndOfScope().serialize(buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
if (nakInfo.hasSegmentRequests()) {
@@ -34,11 +34,11 @@ ReturnValue_t NakPduSerializer::serialize(uint8_t **buffer, size_t *size, size_t
nakInfo.getSegmentRequests(&segmentRequests, &segmentRequestLen, nullptr);
for (size_t idx = 0; idx < segmentRequestLen; idx++) {
result = segmentRequests[idx].first.serialize(buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result = segmentRequests[idx].second.serialize(buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
}
diff --git a/src/fsfw/cfdp/pdu/PromptPduDeserializer.cpp b/src/fsfw/cfdp/pdu/PromptPduDeserializer.cpp
index 6a6f5505..7e9e328d 100644
--- a/src/fsfw/cfdp/pdu/PromptPduDeserializer.cpp
+++ b/src/fsfw/cfdp/pdu/PromptPduDeserializer.cpp
@@ -9,7 +9,7 @@ cfdp::PromptResponseRequired PromptPduDeserializer::getPromptResponseRequired()
ReturnValue_t PromptPduDeserializer::parseData() {
ReturnValue_t result = FileDirectiveDeserializer::parseData();
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
size_t currentIdx = FileDirectiveDeserializer::getHeaderSize();
@@ -17,5 +17,5 @@ ReturnValue_t PromptPduDeserializer::parseData() {
return SerializeIF::STREAM_TOO_SHORT;
}
responseRequired = static_cast((rawPtr[currentIdx] >> 7) & 0x01);
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
diff --git a/src/fsfw/cfdp/pdu/PromptPduSerializer.cpp b/src/fsfw/cfdp/pdu/PromptPduSerializer.cpp
index a7287563..e5d5bca7 100644
--- a/src/fsfw/cfdp/pdu/PromptPduSerializer.cpp
+++ b/src/fsfw/cfdp/pdu/PromptPduSerializer.cpp
@@ -13,7 +13,7 @@ ReturnValue_t PromptPduSerializer::serialize(uint8_t **buffer, size_t *size, siz
Endianness streamEndianness) const {
ReturnValue_t result =
FileDirectiveSerializer::serialize(buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
if (*size + 1 > maxSize) {
diff --git a/src/fsfw/cfdp/pdu/VarLenField.cpp b/src/fsfw/cfdp/pdu/VarLenField.cpp
index b11c3b09..f0059270 100644
--- a/src/fsfw/cfdp/pdu/VarLenField.cpp
+++ b/src/fsfw/cfdp/pdu/VarLenField.cpp
@@ -6,7 +6,7 @@
cfdp::VarLenField::VarLenField(cfdp::WidthInBytes width, size_t value) : VarLenField() {
ReturnValue_t result = this->setValue(width, value);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
#if FSFW_DISABLE_PRINTOUT == 0
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "cfdp::VarLenField: Setting value failed" << std::endl;
@@ -25,21 +25,21 @@ ReturnValue_t cfdp::VarLenField::setValue(cfdp::WidthInBytes widthInBytes, size_
switch (widthInBytes) {
case (cfdp::WidthInBytes::ONE_BYTE): {
if (value > UINT8_MAX) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
this->value.oneByte = value;
break;
}
case (cfdp::WidthInBytes::TWO_BYTES): {
if (value > UINT16_MAX) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
this->value.twoBytes = value;
break;
}
case (cfdp::WidthInBytes::FOUR_BYTES): {
if (value > UINT32_MAX) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
this->value.fourBytes = value;
break;
@@ -49,7 +49,7 @@ ReturnValue_t cfdp::VarLenField::setValue(cfdp::WidthInBytes widthInBytes, size_
}
}
this->width = widthInBytes;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
size_t cfdp::VarLenField::getValue() const {
@@ -77,7 +77,7 @@ ReturnValue_t cfdp::VarLenField::serialize(uint8_t **buffer, size_t *size, size_
**buffer = value.oneByte;
*size += 1;
*buffer += 1;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
case (cfdp::WidthInBytes::TWO_BYTES): {
return SerializeAdapter::serialize(&value.twoBytes, buffer, size, maxSize, streamEndianness);
@@ -86,7 +86,7 @@ ReturnValue_t cfdp::VarLenField::serialize(uint8_t **buffer, size_t *size, size_
return SerializeAdapter::serialize(&value.fourBytes, buffer, size, maxSize, streamEndianness);
}
default: {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
}
}
@@ -105,7 +105,7 @@ ReturnValue_t cfdp::VarLenField::deSerialize(const uint8_t **buffer, size_t *siz
case (cfdp::WidthInBytes::ONE_BYTE): {
value.oneByte = **buffer;
*size += 1;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
case (cfdp::WidthInBytes::TWO_BYTES): {
return SerializeAdapter::deSerialize(&value.twoBytes, buffer, size, streamEndianness);
@@ -114,7 +114,7 @@ ReturnValue_t cfdp::VarLenField::deSerialize(const uint8_t **buffer, size_t *siz
return SerializeAdapter::deSerialize(&value.fourBytes, buffer, size, streamEndianness);
}
default: {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
}
}
diff --git a/src/fsfw/cfdp/tlv/FaultHandlerOverrideTlv.cpp b/src/fsfw/cfdp/tlv/FaultHandlerOverrideTlv.cpp
index f5f777ea..bbcb61d2 100644
--- a/src/fsfw/cfdp/tlv/FaultHandlerOverrideTlv.cpp
+++ b/src/fsfw/cfdp/tlv/FaultHandlerOverrideTlv.cpp
@@ -22,7 +22,7 @@ ReturnValue_t FaultHandlerOverrideTlv::serialize(uint8_t **buffer, size_t *size,
**buffer = this->conditionCode << 4 | this->handlerCode;
*buffer += 1;
*size += 1;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
size_t FaultHandlerOverrideTlv::getSerializedSize() const { return getLengthField() + 2; }
@@ -40,7 +40,7 @@ ReturnValue_t FaultHandlerOverrideTlv::deSerialize(const uint8_t **buffer, size_
*size -= 1;
size_t detectedSize = **buffer;
if (detectedSize != getLengthField()) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
*buffer += 1;
*size += 1;
@@ -48,7 +48,7 @@ ReturnValue_t FaultHandlerOverrideTlv::deSerialize(const uint8_t **buffer, size_
this->handlerCode = static_cast(**buffer & 0x0f);
*buffer += 1;
*size += 1;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
cfdp::TlvTypes FaultHandlerOverrideTlv::getType() const { return cfdp::TlvTypes::FAULT_HANDLER; }
diff --git a/src/fsfw/cfdp/tlv/FilestoreRequestTlv.cpp b/src/fsfw/cfdp/tlv/FilestoreRequestTlv.cpp
index 9ad7c645..941e8f5d 100644
--- a/src/fsfw/cfdp/tlv/FilestoreRequestTlv.cpp
+++ b/src/fsfw/cfdp/tlv/FilestoreRequestTlv.cpp
@@ -16,11 +16,11 @@ void FilestoreRequestTlv::setSecondFileName(cfdp::Lv *secondFileName) {
ReturnValue_t FilestoreRequestTlv::serialize(uint8_t **buffer, size_t *size, size_t maxSize,
Endianness streamEndianness) const {
ReturnValue_t result = commonSerialize(buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result = firstFileName.serialize(buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
if (requiresSecondFileName()) {
@@ -30,13 +30,13 @@ ReturnValue_t FilestoreRequestTlv::serialize(uint8_t **buffer, size_t *size, siz
}
secondFileName->serialize(buffer, size, maxSize, streamEndianness);
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t FilestoreRequestTlv::deSerialize(const uint8_t **buffer, size_t *size,
Endianness streamEndianness) {
ReturnValue_t result = commonDeserialize(buffer, size, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
return deSerializeFromValue(buffer, size, streamEndianness);
@@ -63,13 +63,13 @@ ReturnValue_t FilestoreRequestTlv::deSerializeFromValue(const uint8_t **buffer,
*buffer += 1;
*size -= 1;
ReturnValue_t result = firstFileName.deSerialize(buffer, size, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
if (requiresSecondFileName()) {
if (secondFileName == nullptr) {
secondFileNameMissing();
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
result = secondFileName->deSerialize(buffer, size, streamEndianness);
}
diff --git a/src/fsfw/cfdp/tlv/FilestoreResponseTlv.cpp b/src/fsfw/cfdp/tlv/FilestoreResponseTlv.cpp
index 36945725..53aaaf8f 100644
--- a/src/fsfw/cfdp/tlv/FilestoreResponseTlv.cpp
+++ b/src/fsfw/cfdp/tlv/FilestoreResponseTlv.cpp
@@ -32,11 +32,11 @@ ReturnValue_t FilestoreResponseTlv::serialize(uint8_t **buffer, size_t *size, si
Endianness streamEndianness) const {
ReturnValue_t result =
commonSerialize(buffer, size, maxSize, streamEndianness, true, this->statusCode);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result = firstFileName.serialize(buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
if (requiresSecondFileName()) {
@@ -61,7 +61,7 @@ ReturnValue_t FilestoreResponseTlv::serialize(uint8_t **buffer, size_t *size, si
ReturnValue_t FilestoreResponseTlv::deSerialize(const uint8_t **buffer, size_t *size,
Endianness streamEndianness) {
ReturnValue_t result = commonDeserialize(buffer, size, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
return deSerializeFromValue(buffer, size, streamEndianness);
@@ -75,7 +75,7 @@ ReturnValue_t FilestoreResponseTlv::deSerializeFromValue(const uint8_t **buffer,
*buffer += 1;
*size -= 1;
ReturnValue_t result = firstFileName.deSerialize(buffer, size, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
if (requiresSecondFileName()) {
@@ -83,7 +83,7 @@ ReturnValue_t FilestoreResponseTlv::deSerializeFromValue(const uint8_t **buffer,
return cfdp::FILESTORE_REQUIRES_SECOND_FILE;
}
result = secondFileName->deSerialize(buffer, size, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
}
@@ -98,7 +98,7 @@ ReturnValue_t FilestoreResponseTlv::deSerializeFromValue(const uint8_t **buffer,
*size -= 1;
*buffer += 1;
// Ignore empty filestore message
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
return filestoreMsg->deSerialize(buffer, size, streamEndianness);
}
diff --git a/src/fsfw/cfdp/tlv/FilestoreTlvBase.h b/src/fsfw/cfdp/tlv/FilestoreTlvBase.h
index 04012cda..c37cb0ad 100644
--- a/src/fsfw/cfdp/tlv/FilestoreTlvBase.h
+++ b/src/fsfw/cfdp/tlv/FilestoreTlvBase.h
@@ -73,7 +73,7 @@ class FilestoreTlvBase : public TlvIF {
Endianness streamEndianness, bool isResponse = false,
uint8_t responseStatusCode = 0) const {
if (buffer == nullptr or size == nullptr) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
if (maxSize < 3) {
return SerializeIF::BUFFER_TOO_SHORT;
@@ -90,13 +90,13 @@ class FilestoreTlvBase : public TlvIF {
}
*buffer += 1;
*size += 1;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t commonDeserialize(const uint8_t** buffer, size_t* size,
SerializeIF::Endianness streamEndianness) {
if (buffer == nullptr or size == nullptr) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
if (*size < 3) {
return SerializeIF::STREAM_TOO_SHORT;
@@ -114,7 +114,7 @@ class FilestoreTlvBase : public TlvIF {
if (remainingLength == 0) {
return SerializeIF::STREAM_TOO_SHORT;
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
bool requiresSecondFileName() const {
@@ -152,7 +152,7 @@ class FilestoreTlvBase : public TlvIF {
size_t serSize = 0;
uint8_t* valueStart = buffer + 2;
ReturnValue_t result = this->serialize(&buffer, &serSize, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
tlv.setValue(valueStart, serSize - 2);
diff --git a/src/fsfw/cfdp/tlv/Lv.cpp b/src/fsfw/cfdp/tlv/Lv.cpp
index 1bb16301..33c0e381 100644
--- a/src/fsfw/cfdp/tlv/Lv.cpp
+++ b/src/fsfw/cfdp/tlv/Lv.cpp
@@ -21,7 +21,7 @@ cfdp::Lv& cfdp::Lv::operator=(const Lv& other) {
if (value == nullptr or otherSize == 0) {
this->zeroLen = true;
}
- this->value.setBuffer(value, otherSize);
+ this->value.setConstBuffer(value, otherSize);
return *this;
}
@@ -31,13 +31,13 @@ ReturnValue_t cfdp::Lv::serialize(uint8_t** buffer, size_t* size, size_t maxSize
return BUFFER_TOO_SHORT;
}
if (buffer == nullptr or size == nullptr) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
if (zeroLen) {
**buffer = 0;
*size += 1;
*buffer += 1;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
return value.serialize(buffer, size, maxSize, streamEndianness);
}
@@ -54,7 +54,7 @@ size_t cfdp::Lv::getSerializedSize() const {
ReturnValue_t cfdp::Lv::deSerialize(const uint8_t** buffer, size_t* size,
Endianness streamEndianness) {
if (buffer == nullptr or size == nullptr) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
if (*size < 1) {
return SerializeIF::STREAM_TOO_SHORT;
@@ -64,16 +64,16 @@ ReturnValue_t cfdp::Lv::deSerialize(const uint8_t** buffer, size_t* size,
zeroLen = true;
*buffer += 1;
*size -= 1;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
} else if (*size < lengthField + 1) {
return SerializeIF::STREAM_TOO_SHORT;
}
zeroLen = false;
// Zero-copy implementation
- value.setBuffer(const_cast(*buffer + 1), lengthField);
+ value.setConstBuffer(*buffer + 1, lengthField);
*buffer += 1 + lengthField;
*size -= 1 + lengthField;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
const uint8_t* cfdp::Lv::getValue(size_t* size) const {
diff --git a/src/fsfw/cfdp/tlv/Tlv.cpp b/src/fsfw/cfdp/tlv/Tlv.cpp
index f37ff8d5..9d5f7f15 100644
--- a/src/fsfw/cfdp/tlv/Tlv.cpp
+++ b/src/fsfw/cfdp/tlv/Tlv.cpp
@@ -12,7 +12,7 @@ cfdp::Tlv::Tlv() : value(static_cast(nullptr), 0, true) {}
ReturnValue_t cfdp::Tlv::serialize(uint8_t **buffer, size_t *size, size_t maxSize,
Endianness streamEndianness) const {
if (buffer == nullptr or size == nullptr) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
if (*size + 2 > maxSize) {
return BUFFER_TOO_SHORT;
@@ -28,10 +28,10 @@ ReturnValue_t cfdp::Tlv::serialize(uint8_t **buffer, size_t *size, size_t maxSiz
**buffer = 0;
*size += 1;
*buffer += 1;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
if (value.getConstBuffer() == nullptr) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
return value.serialize(buffer, size, maxSize, streamEndianness);
}
@@ -48,7 +48,7 @@ size_t cfdp::Tlv::getSerializedSize() const {
ReturnValue_t cfdp::Tlv::deSerialize(const uint8_t **buffer, size_t *size,
Endianness streamEndianness) {
if (buffer == nullptr or size == nullptr) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
if (*size < 2) {
return STREAM_TOO_SHORT;
@@ -68,17 +68,17 @@ ReturnValue_t cfdp::Tlv::deSerialize(const uint8_t **buffer, size_t *size,
zeroLen = true;
*buffer += 1;
*size -= 1;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
if (lengthField + 1 > *size) {
return SerializeIF::STREAM_TOO_SHORT;
}
zeroLen = false;
// Zero-copy implementation
- value.setBuffer(const_cast(*buffer + 1), lengthField);
+ value.setConstBuffer(*buffer + 1, lengthField);
*buffer += 1 + lengthField;
*size -= 1 + lengthField;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
const uint8_t *cfdp::Tlv::getValue() const { return value.getConstBuffer(); }
@@ -96,7 +96,7 @@ void cfdp::Tlv::setValue(uint8_t *value, size_t len) {
if (len > 0) {
zeroLen = false;
}
- this->value.setBuffer(value, len);
+ this->value.setConstBuffer(value, len);
}
uint8_t cfdp::Tlv::getLengthField() const { return this->value.getSerializedSize() - 1; }
diff --git a/src/fsfw/cfdp/tlv/Tlv.h b/src/fsfw/cfdp/tlv/Tlv.h
index a67c6dd1..dded5652 100644
--- a/src/fsfw/cfdp/tlv/Tlv.h
+++ b/src/fsfw/cfdp/tlv/Tlv.h
@@ -23,7 +23,7 @@ class Tlv : public TlvIF {
* @param maxSize
* @param streamEndianness
* @return
- * - RETURN_OK on success
+ * - returnvalue::OK on success
* - INVALID_TLV_TYPE
* - SerializeIF returncode on wrong serialization parameters
*/
@@ -37,7 +37,7 @@ class Tlv : public TlvIF {
* @param buffer Raw buffer including the size field
* @param size
* @param streamEndianness
- * - RETURN_OK on success
+ * - returnvalue::OK on success
* - INVALID_TLV_TYPE
* - SerializeIF returncode on wrong deserialization parameters
*/
diff --git a/src/fsfw/container/ArrayList.h b/src/fsfw/container/ArrayList.h
index 11f40039..f5f74cf1 100644
--- a/src/fsfw/container/ArrayList.h
+++ b/src/fsfw/container/ArrayList.h
@@ -1,7 +1,7 @@
#ifndef FSFW_CONTAINER_ARRAYLIST_H_
#define FSFW_CONTAINER_ARRAYLIST_H_
-#include "../returnvalues/HasReturnvaluesIF.h"
+#include "../returnvalues/returnvalue.h"
#include "../serialize/SerializeAdapter.h"
#include "../serialize/SerializeIF.h"
@@ -183,7 +183,7 @@ class ArrayList {
* @param entry
* @return
* -@c FULL if the List is full
- * -@c RETURN_OK else
+ * -@c returnvalue::OK else
*/
ReturnValue_t insert(T entry) {
if (size >= maxSize_) {
@@ -191,7 +191,7 @@ class ArrayList {
}
entries[size] = entry;
++size;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
/**
diff --git a/src/fsfw/container/FIFOBase.h b/src/fsfw/container/FIFOBase.h
index 25c75515..bb92790c 100644
--- a/src/fsfw/container/FIFOBase.h
+++ b/src/fsfw/container/FIFOBase.h
@@ -4,7 +4,7 @@
#include
#include
-#include "../returnvalues/HasReturnvaluesIF.h"
+#include "../returnvalues/returnvalue.h"
template
class FIFOBase {
@@ -20,24 +20,24 @@ class FIFOBase {
/**
* Insert value into FIFO
* @param value
- * @return RETURN_OK on success, FULL if full
+ * @return returnvalue::OK on success, FULL if full
*/
ReturnValue_t insert(T value);
/**
* Retrieve item from FIFO. This removes the item from the FIFO.
* @param value Must point to a valid T
- * @return RETURN_OK on success, EMPTY if empty and FAILED if nullptr check failed
+ * @return returnvalue::OK on success, EMPTY if empty and FAILED if nullptr check failed
*/
ReturnValue_t retrieve(T* value);
/**
* Retrieve item from FIFO without removing it from FIFO.
* @param value Must point to a valid T
- * @return RETURN_OK on success, EMPTY if empty and FAILED if nullptr check failed
+ * @return returnvalue::OK on success, EMPTY if empty and FAILED if nullptr check failed
*/
ReturnValue_t peek(T* value);
/**
* Remove item from FIFO.
- * @return RETURN_OK on success, EMPTY if empty
+ * @return returnvalue::OK on success, EMPTY if empty
*/
ReturnValue_t pop();
diff --git a/src/fsfw/container/FIFOBase.tpp b/src/fsfw/container/FIFOBase.tpp
index 91804b6c..63727869 100644
--- a/src/fsfw/container/FIFOBase.tpp
+++ b/src/fsfw/container/FIFOBase.tpp
@@ -17,7 +17,7 @@ inline ReturnValue_t FIFOBase::insert(T value) {
values[writeIndex] = value;
writeIndex = next(writeIndex);
++currentSize;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
};
@@ -27,12 +27,12 @@ inline ReturnValue_t FIFOBase::retrieve(T* value) {
return EMPTY;
} else {
if (value == nullptr) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
*value = values[readIndex];
readIndex = next(readIndex);
--currentSize;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
};
@@ -42,10 +42,10 @@ inline ReturnValue_t FIFOBase::peek(T* value) {
return EMPTY;
} else {
if (value == nullptr) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
*value = values[readIndex];
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
};
diff --git a/src/fsfw/container/FixedMap.h b/src/fsfw/container/FixedMap.h
index 48822cd5..def219d1 100644
--- a/src/fsfw/container/FixedMap.h
+++ b/src/fsfw/container/FixedMap.h
@@ -4,7 +4,7 @@
#include
#include
-#include "../returnvalues/HasReturnvaluesIF.h"
+#include "../returnvalues/returnvalue.h"
#include "ArrayList.h"
/**
@@ -75,7 +75,7 @@ class FixedMap : public SerializeIF {
uint32_t size() const { return _size; }
ReturnValue_t insert(key_t key, T value, Iterator* storedValue = nullptr) {
- if (exists(key) == HasReturnvaluesIF::RETURN_OK) {
+ if (exists(key) == returnvalue::OK) {
return KEY_ALREADY_EXISTS;
}
if (_size == theMap.maxSize()) {
@@ -87,7 +87,7 @@ class FixedMap : public SerializeIF {
*storedValue = Iterator(&theMap[_size]);
}
++_size;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t insert(std::pair pair) { return insert(pair.first, pair.second); }
@@ -95,7 +95,7 @@ class FixedMap : public SerializeIF {
ReturnValue_t exists(key_t key) const {
ReturnValue_t result = KEY_DOES_NOT_EXIST;
if (findIndex(key) < _size) {
- result = HasReturnvaluesIF::RETURN_OK;
+ result = returnvalue::OK;
}
return result;
}
@@ -108,7 +108,7 @@ class FixedMap : public SerializeIF {
theMap[i] = theMap[_size - 1];
--_size;
--((*iter).value);
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t erase(key_t key) {
@@ -118,14 +118,14 @@ class FixedMap : public SerializeIF {
}
theMap[i] = theMap[_size - 1];
--_size;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
T* findValue(key_t key) const { return &theMap[findIndex(key)].second; }
Iterator find(key_t key) const {
ReturnValue_t result = exists(key);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return end();
}
return Iterator(&theMap[findIndex(key)]);
@@ -133,11 +133,11 @@ class FixedMap : public SerializeIF {
ReturnValue_t find(key_t key, T** value) const {
ReturnValue_t result = exists(key);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
*value = &theMap[findIndex(key)].second;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
bool empty() {
@@ -165,7 +165,7 @@ class FixedMap : public SerializeIF {
ReturnValue_t result =
SerializeAdapter::serialize(&this->_size, buffer, size, maxSize, streamEndianness);
uint32_t i = 0;
- while ((result == HasReturnvaluesIF::RETURN_OK) && (i < this->_size)) {
+ while ((result == returnvalue::OK) && (i < this->_size)) {
result =
SerializeAdapter::serialize(&theMap[i].first, buffer, size, maxSize, streamEndianness);
result =
@@ -195,7 +195,7 @@ class FixedMap : public SerializeIF {
return SerializeIF::TOO_MANY_ELEMENTS;
}
uint32_t i = 0;
- while ((result == HasReturnvaluesIF::RETURN_OK) && (i < this->_size)) {
+ while ((result == returnvalue::OK) && (i < this->_size)) {
result = SerializeAdapter::deSerialize(&theMap[i].first, buffer, size, streamEndianness);
result = SerializeAdapter::deSerialize(&theMap[i].second, buffer, size, streamEndianness);
++i;
diff --git a/src/fsfw/container/FixedOrderedMultimap.h b/src/fsfw/container/FixedOrderedMultimap.h
index 3ef8f8f1..73b010ed 100644
--- a/src/fsfw/container/FixedOrderedMultimap.h
+++ b/src/fsfw/container/FixedOrderedMultimap.h
@@ -100,7 +100,7 @@ class FixedOrderedMultimap {
* @param[in] value Value of the new element
* @param[in/out] (optional) storedValue On success this points to the new value, otherwise a
* nullptr
- * @return RETURN_OK if insert was successful, MAP_FULL if no space is available
+ * @return returnvalue::OK if insert was successful, MAP_FULL if no space is available
*/
ReturnValue_t insert(key_t key, T value, Iterator* storedValue = nullptr);
@@ -108,14 +108,14 @@ class FixedOrderedMultimap {
* Used to insert new pair instead of single values
*
* @param pair Pair to be inserted
- * @return RETURN_OK if insert was successful, MAP_FULL if no space is available
+ * @return returnvalue::OK if insert was successful, MAP_FULL if no space is available
*/
ReturnValue_t insert(std::pair pair);
/***
* Can be used to check if a certain key is in the map
* @param key Key to be checked
- * @return RETURN_OK if the key exists KEY_DOES_NOT_EXIST otherwise
+ * @return returnvalue::OK if the key exists KEY_DOES_NOT_EXIST otherwise
*/
ReturnValue_t exists(key_t key) const;
@@ -127,14 +127,14 @@ class FixedOrderedMultimap {
*
* @warning The iterator needs to be valid and dereferenceable
* @param[in/out] iter Pointer to iterator to the element that needs to be ereased
- * @return RETURN_OK if erased, KEY_DOES_NOT_EXIST if the there is no element like this
+ * @return returnvalue::OK if erased, KEY_DOES_NOT_EXIST if the there is no element like this
*/
ReturnValue_t erase(Iterator* iter);
/***
* Used to erase by key
* @param key Key to be erased
- * @return RETURN_OK if erased, KEY_DOES_NOT_EXIST if the there is no element like this
+ * @return returnvalue::OK if erased, KEY_DOES_NOT_EXIST if the there is no element like this
*/
ReturnValue_t erase(key_t key);
@@ -148,7 +148,7 @@ class FixedOrderedMultimap {
*/
Iterator find(key_t key) const {
ReturnValue_t result = exists(key);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return end();
}
return Iterator(&theMap[findFirstIndex(key)]);
@@ -160,7 +160,7 @@ class FixedOrderedMultimap {
*
* @param key Key to search for
* @param value Found value
- * @return RETURN_OK if it points to the value,
+ * @return returnvalue::OK if it points to the value,
* KEY_DOES_NOT_EXIST if the key is not in the map
*/
ReturnValue_t find(key_t key, T** value) const;
diff --git a/src/fsfw/container/FixedOrderedMultimap.tpp b/src/fsfw/container/FixedOrderedMultimap.tpp
index fd58bc44..cfdb5331 100644
--- a/src/fsfw/container/FixedOrderedMultimap.tpp
+++ b/src/fsfw/container/FixedOrderedMultimap.tpp
@@ -16,7 +16,7 @@ inline ReturnValue_t FixedOrderedMultimap::insert(key_t k
if (storedValue != nullptr) {
*storedValue = Iterator(&theMap[position]);
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
template
inline ReturnValue_t FixedOrderedMultimap::insert(std::pair pair) {
@@ -27,7 +27,7 @@ template
inline ReturnValue_t FixedOrderedMultimap::exists(key_t key) const {
ReturnValue_t result = KEY_DOES_NOT_EXIST;
if (findFirstIndex(key) < _size) {
- result = HasReturnvaluesIF::RETURN_OK;
+ result = returnvalue::OK;
}
return result;
}
@@ -44,7 +44,7 @@ inline ReturnValue_t FixedOrderedMultimap::erase(Iterator
} else {
*iter = begin();
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
template
@@ -57,17 +57,17 @@ inline ReturnValue_t FixedOrderedMultimap::erase(key_t ke
removeFromPosition(i);
i = findFirstIndex(key, i);
} while (i < _size);
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
template
inline ReturnValue_t FixedOrderedMultimap::find(key_t key, T **value) const {
ReturnValue_t result = exists(key);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
*value = &theMap[findFirstIndex(key)].second;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
template
diff --git a/src/fsfw/container/IndexedRingMemoryArray.h b/src/fsfw/container/IndexedRingMemoryArray.h
index b76e7d56..127ed5d7 100644
--- a/src/fsfw/container/IndexedRingMemoryArray.h
+++ b/src/fsfw/container/IndexedRingMemoryArray.h
@@ -4,7 +4,7 @@
#include
#include "../globalfunctions/CRC.h"
-#include "../returnvalues/HasReturnvaluesIF.h"
+#include "../returnvalues/returnvalue.h"
#include "../serialize/SerialArrayListAdapter.h"
#include "../serviceinterface/ServiceInterfaceStream.h"
#include "ArrayList.h"
@@ -52,15 +52,15 @@ class Index : public SerializeIF {
Endianness streamEndianness) const {
ReturnValue_t result =
SerializeAdapter::serialize(&blockStartAddress, buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result = indexType.serialize(buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::serialize(&this->size, buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result =
@@ -71,19 +71,19 @@ class Index : public SerializeIF {
ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size, Endianness streamEndianness) {
ReturnValue_t result =
SerializeAdapter::deSerialize(&blockStartAddress, buffer, size, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result = indexType.deSerialize(buffer, size, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::deSerialize(&this->size, buffer, size, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::deSerialize(&this->storedPackets, buffer, size, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
return result;
@@ -449,13 +449,13 @@ class IndexedRingMemoryArray : public SerializeIF, public ArrayList, ui
// Check Next Block
if (!isNextBlockWritable()) {
// The Index is full and does not overwrite old
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
// Next block can be written, update Metadata
currentWriteBlock = getNextWrite();
currentWriteBlock->setSize(0);
currentWriteBlock->setStoredPackets(0);
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
/**
@@ -475,21 +475,21 @@ class IndexedRingMemoryArray : public SerializeIF, public ArrayList, ui
additionalInfo->serialize(buffer, size, maxSize, streamEndianness);
}
ReturnValue_t result = currentWriteBlock->serialize(buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::serialize(&this->size, buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
uint32_t i = 0;
- while ((result == HasReturnvaluesIF::RETURN_OK) && (i < this->size)) {
+ while ((result == returnvalue::OK) && (i < this->size)) {
result =
SerializeAdapter::serialize(&this->entries[i], buffer, size, maxSize, streamEndianness);
++i;
}
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
uint16_t crc = Calculate_CRC(crcBuffer, (*size - oldSize));
@@ -523,44 +523,44 @@ class IndexedRingMemoryArray : public SerializeIF, public ArrayList, ui
*/
ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size, Endianness streamEndianness) {
- ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
+ ReturnValue_t result = returnvalue::OK;
if (additionalInfo != NULL) {
result = additionalInfo->deSerialize(buffer, size, streamEndianness);
}
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
Index tempIndex;
result = tempIndex.deSerialize(buffer, size, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
uint32_t tempSize = 0;
result = SerializeAdapter::deSerialize(&tempSize, buffer, size, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
if (this->size != tempSize) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
uint32_t i = 0;
- while ((result == HasReturnvaluesIF::RETURN_OK) && (i < this->size)) {
+ while ((result == returnvalue::OK) && (i < this->size)) {
result = SerializeAdapter::deSerialize(&this->entries[i], buffer, size, streamEndianness);
++i;
}
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
typename IndexedRingMemoryArray::Iterator cmp(&tempIndex);
for (typename IndexedRingMemoryArray::Iterator it = this->begin(); it != this->end(); ++it) {
if (*(cmp.value) == *(it.value)) {
currentWriteBlock = it;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
}
// Reached if current write block iterator is not found
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
uint32_t getIndexAddress() const { return indexAddress; }
diff --git a/src/fsfw/container/PlacementFactory.h b/src/fsfw/container/PlacementFactory.h
index 936be59d..668e71b8 100644
--- a/src/fsfw/container/PlacementFactory.h
+++ b/src/fsfw/container/PlacementFactory.h
@@ -40,7 +40,7 @@ class PlacementFactory {
store_address_t tempId;
uint8_t* pData = nullptr;
ReturnValue_t result = dataBackend->getFreeElement(&tempId, sizeof(T), &pData);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return nullptr;
}
T* temp = new (pData) T(std::forward(args)...);
@@ -51,12 +51,12 @@ class PlacementFactory {
* This must be called by the user.
*
* @param thisElement Element to be destroyed
- * @return RETURN_OK if the element was destroyed, different errors on failure
+ * @return returnvalue::OK if the element was destroyed, different errors on failure
*/
template
ReturnValue_t destroy(T* thisElement) {
if (thisElement == nullptr) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
// Need to call destructor first, in case something was allocated by the object (shouldn't do
// that, however).
diff --git a/src/fsfw/container/RingBufferBase.h b/src/fsfw/container/RingBufferBase.h
index 98207698..e86f0ee1 100644
--- a/src/fsfw/container/RingBufferBase.h
+++ b/src/fsfw/container/RingBufferBase.h
@@ -3,7 +3,7 @@
#include
-#include "../returnvalues/HasReturnvaluesIF.h"
+#include "../returnvalues/returnvalue.h"
template
class RingBufferBase {
@@ -58,18 +58,18 @@ class RingBufferBase {
ReturnValue_t readData(uint32_t amount, uint8_t n = 0) {
if (getAvailableReadData(n) >= amount) {
incrementRead(amount, n);
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
} else {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
}
ReturnValue_t writeData(uint32_t amount) {
if (availableWriteSpace() >= amount or overwriteOld) {
incrementWrite(amount);
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
} else {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
}
diff --git a/src/fsfw/container/SimpleRingBuffer.cpp b/src/fsfw/container/SimpleRingBuffer.cpp
index bcf3cf20..a006df46 100644
--- a/src/fsfw/container/SimpleRingBuffer.cpp
+++ b/src/fsfw/container/SimpleRingBuffer.cpp
@@ -2,6 +2,9 @@
#include
+#include "fsfw/FSFW.h"
+#include "fsfw/serviceinterface.h"
+
SimpleRingBuffer::SimpleRingBuffer(const size_t size, bool overwriteOld, size_t maxExcessBytes)
: RingBufferBase<>(0, size, overwriteOld), maxExcessBytes(maxExcessBytes) {
if (maxExcessBytes > size) {
@@ -29,14 +32,14 @@ ReturnValue_t SimpleRingBuffer::getFreeElement(uint8_t** writePointer, size_t am
size_t amountTillWrap = writeTillWrap();
if (amountTillWrap < amount) {
if ((amount - amountTillWrap + excessBytes) > maxExcessBytes) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
excessBytes = amount - amountTillWrap;
}
*writePointer = &buffer[write];
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
} else {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
}
@@ -48,6 +51,19 @@ void SimpleRingBuffer::confirmBytesWritten(size_t amount) {
}
ReturnValue_t SimpleRingBuffer::writeData(const uint8_t* data, size_t amount) {
+ if (data == nullptr) {
+ return returnvalue::FAILED;
+ }
+ if (amount > getMaxSize()) {
+#if FSFW_VERBOSE_LEVEL >= 1
+#if FSFW_CPP_OSTREAM_ENABLED == 1
+ sif::error << "SimpleRingBuffer::writeData: Amount of data too large" << std::endl;
+#else
+ sif::printError("SimpleRingBuffer::writeData: Amount of data too large\n");
+#endif
+#endif
+ return returnvalue::FAILED;
+ }
if (availableWriteSpace() >= amount or overwriteOld) {
size_t amountTillWrap = writeTillWrap();
if (amountTillWrap >= amount) {
@@ -58,9 +74,9 @@ ReturnValue_t SimpleRingBuffer::writeData(const uint8_t* data, size_t amount) {
memcpy(buffer, data + amountTillWrap, amount - amountTillWrap);
}
incrementWrite(amount);
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
} else {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
}
@@ -73,7 +89,7 @@ ReturnValue_t SimpleRingBuffer::readData(uint8_t* data, size_t amount, bool incr
// more data available than amount specified.
amount = availableData;
} else {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
}
if (trueAmount != nullptr) {
@@ -89,7 +105,7 @@ ReturnValue_t SimpleRingBuffer::readData(uint8_t* data, size_t amount, bool incr
if (incrementReadPtr) {
deleteData(amount, readRemaining);
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
size_t SimpleRingBuffer::getExcessBytes() const { return excessBytes; }
@@ -108,12 +124,12 @@ ReturnValue_t SimpleRingBuffer::deleteData(size_t amount, bool deleteRemaining,
if (deleteRemaining) {
amount = availableData;
} else {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
}
if (trueAmount != nullptr) {
*trueAmount = amount;
}
incrementRead(amount, READ_PTR);
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
diff --git a/src/fsfw/container/SimpleRingBuffer.h b/src/fsfw/container/SimpleRingBuffer.h
index b9762451..a9892c0c 100644
--- a/src/fsfw/container/SimpleRingBuffer.h
+++ b/src/fsfw/container/SimpleRingBuffer.h
@@ -47,8 +47,8 @@ class SimpleRingBuffer : public RingBufferBase<> {
* Write to circular buffer and increment write pointer by amount.
* @param data
* @param amount
- * @return -@c RETURN_OK if write operation was successful
- * -@c RETURN_FAILED if
+ * @return -@c returnvalue::OK if write operation was successful
+ * -@c returnvalue::FAILED if
*/
ReturnValue_t writeData(const uint8_t* data, size_t amount);
@@ -95,8 +95,8 @@ class SimpleRingBuffer : public RingBufferBase<> {
* If readRemaining was set to true, the true amount read will be assigned
* to the passed value.
* @return
- * - @c RETURN_OK if data was read successfully
- * - @c RETURN_FAILED if not enough data was available and readRemaining
+ * - @c returnvalue::OK if data was read successfully
+ * - @c returnvalue::FAILED if not enough data was available and readRemaining
* was set to false.
*/
ReturnValue_t readData(uint8_t* data, size_t amount, bool incrementReadPtr = false,
diff --git a/src/fsfw/controller/ControllerBase.cpp b/src/fsfw/controller/ControllerBase.cpp
index 953dacb4..a9d19ef2 100644
--- a/src/fsfw/controller/ControllerBase.cpp
+++ b/src/fsfw/controller/ControllerBase.cpp
@@ -20,15 +20,15 @@ ControllerBase::~ControllerBase() { QueueFactory::instance()->deleteMessageQueue
ReturnValue_t ControllerBase::initialize() {
ReturnValue_t result = SystemObject::initialize();
- if (result != RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
MessageQueueId_t parentQueue = 0;
if (parentId != objects::NO_OBJECT) {
- SubsystemBase* parent = ObjectManager::instance()->get(parentId);
+ auto* parent = ObjectManager::instance()->get(parentId);
if (parent == nullptr) {
- return RETURN_FAILED;
+ return returnvalue::FAILED;
}
parentQueue = parent->getCommandQueue();
@@ -36,36 +36,36 @@ ReturnValue_t ControllerBase::initialize() {
}
result = healthHelper.initialize(parentQueue);
- if (result != RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result = modeHelper.initialize(parentQueue);
- if (result != RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
- return RETURN_OK;
+ return returnvalue::OK;
}
MessageQueueId_t ControllerBase::getCommandQueue() const { return commandQueue->getId(); }
void ControllerBase::handleQueue() {
CommandMessage command;
- ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
- for (result = commandQueue->receiveMessage(&command); result == RETURN_OK;
+ ReturnValue_t result;
+ for (result = commandQueue->receiveMessage(&command); result == returnvalue::OK;
result = commandQueue->receiveMessage(&command)) {
result = modeHelper.handleModeCommand(&command);
- if (result == RETURN_OK) {
+ if (result == returnvalue::OK) {
continue;
}
result = healthHelper.handleHealthCommand(&command);
- if (result == RETURN_OK) {
+ if (result == returnvalue::OK) {
continue;
}
result = handleCommandMessage(&command);
- if (result == RETURN_OK) {
+ if (result == returnvalue::OK) {
continue;
}
command.setToUnknownCommand();
@@ -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);
triggerEvent(CHANGING_MODE, mode, submode);
- this->mode = mode;
- this->submode = submode;
+ mode = mode_;
+ submode = submode_;
modeHelper.modeChanged(mode, submode);
modeChanged(mode, submode);
announceMode(false);
changeHK(this->mode, this->submode, true);
}
-void ControllerBase::getMode(Mode_t* mode, Submode_t* submode) {
- *mode = this->mode;
- *submode = this->submode;
+void ControllerBase::getMode(Mode_t* mode_, Submode_t* submode_) {
+ *mode_ = this->mode;
+ *submode_ = this->submode;
}
void ControllerBase::setToExternalControl() { healthHelper.setHealth(EXTERNAL_CONTROL); }
@@ -96,17 +96,17 @@ void ControllerBase::announceMode(bool recursive) { triggerEvent(MODE_INFO, mode
ReturnValue_t ControllerBase::performOperation(uint8_t opCode) {
handleQueue();
performControlOperation();
- return RETURN_OK;
+ return returnvalue::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) {
switch (health) {
case HEALTHY:
case EXTERNAL_CONTROL:
healthHelper.setHealth(health);
- return RETURN_OK;
+ return returnvalue::OK;
default:
return INVALID_HEALTH_STATE;
}
@@ -115,6 +115,6 @@ ReturnValue_t ControllerBase::setHealth(HealthState health) {
HasHealthIF::HealthState ControllerBase::getHealth() { return healthHelper.getHealth(); }
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 returnvalue::OK; }
diff --git a/src/fsfw/controller/ControllerBase.h b/src/fsfw/controller/ControllerBase.h
index 227b859b..56c28585 100644
--- a/src/fsfw/controller/ControllerBase.h
+++ b/src/fsfw/controller/ControllerBase.h
@@ -18,27 +18,26 @@
class ControllerBase : public HasModesIF,
public HasHealthIF,
public ExecutableObjectIF,
- public SystemObject,
- public HasReturnvaluesIF {
+ public SystemObject {
public:
static const Mode_t MODE_NORMAL = 2;
ControllerBase(object_id_t setObjectId, object_id_t parentId, size_t commandQueueDepth = 3);
- virtual ~ControllerBase();
+ ~ControllerBase() 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 */
- virtual ReturnValue_t setHealth(HealthState health) override;
- virtual HasHealthIF::HealthState getHealth() override;
+ ReturnValue_t setHealth(HealthState health) override;
+ HasHealthIF::HealthState getHealth() override;
/** ExecutableObjectIF overrides */
- virtual ReturnValue_t performOperation(uint8_t opCode) override;
- virtual void setTaskIF(PeriodicTaskIF *task) override;
- virtual ReturnValue_t initializeAfterTaskCreation() override;
+ ReturnValue_t performOperation(uint8_t opCode) override;
+ void setTaskIF(PeriodicTaskIF *task) override;
+ ReturnValue_t initializeAfterTaskCreation() override;
protected:
/**
@@ -54,8 +53,8 @@ class ControllerBase : public HasModesIF,
*/
virtual void performControlOperation() = 0;
- virtual ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
- uint32_t *msToReachTheMode) override = 0;
+ ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
+ uint32_t *msToReachTheMode) override = 0;
const object_id_t parentId;
@@ -80,10 +79,10 @@ class ControllerBase : public HasModesIF,
/** Mode helpers */
virtual void modeChanged(Mode_t mode, Submode_t submode);
- virtual void startTransition(Mode_t mode, Submode_t submode) override;
- virtual void getMode(Mode_t *mode, Submode_t *submode) override;
- virtual void setToExternalControl() override;
- virtual void announceMode(bool recursive);
+ void startTransition(Mode_t mode, Submode_t submode) override;
+ void getMode(Mode_t *mode, Submode_t *submode) override;
+ void setToExternalControl() override;
+ void announceMode(bool recursive) override;
/** HK helpers */
virtual void changeHK(Mode_t mode, Submode_t submode, bool enable);
};
diff --git a/src/fsfw/controller/ExtendedControllerBase.cpp b/src/fsfw/controller/ExtendedControllerBase.cpp
index 0dfd9dc7..4d5c90c8 100644
--- a/src/fsfw/controller/ExtendedControllerBase.cpp
+++ b/src/fsfw/controller/ExtendedControllerBase.cpp
@@ -6,13 +6,13 @@ ExtendedControllerBase::ExtendedControllerBase(object_id_t objectId, object_id_t
poolManager(this, commandQueue),
actionHelper(this, commandQueue) {}
-ExtendedControllerBase::~ExtendedControllerBase() {}
+ExtendedControllerBase::~ExtendedControllerBase() = default;
ReturnValue_t ExtendedControllerBase::executeAction(ActionId_t actionId,
MessageQueueId_t commandedBy,
const uint8_t *data, size_t size) {
/* Needs to be overriden and implemented by child class. */
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
object_id_t ExtendedControllerBase::getObjectId() const { return SystemObject::getObjectId(); }
@@ -23,7 +23,7 @@ uint32_t ExtendedControllerBase::getPeriodicOperationFrequency() const {
ReturnValue_t ExtendedControllerBase::handleCommandMessage(CommandMessage *message) {
ReturnValue_t result = actionHelper.handleActionMessage(message);
- if (result == HasReturnvaluesIF::RETURN_OK) {
+ if (result == returnvalue::OK) {
return result;
}
return poolManager.handleHousekeepingMessage(message);
@@ -31,31 +31,31 @@ ReturnValue_t ExtendedControllerBase::handleCommandMessage(CommandMessage *messa
void ExtendedControllerBase::handleQueue() {
CommandMessage command;
- ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
- for (result = commandQueue->receiveMessage(&command); result == RETURN_OK;
+ ReturnValue_t result;
+ for (result = commandQueue->receiveMessage(&command); result == returnvalue::OK;
result = commandQueue->receiveMessage(&command)) {
result = actionHelper.handleActionMessage(&command);
- if (result == RETURN_OK) {
+ if (result == returnvalue::OK) {
continue;
}
result = modeHelper.handleModeCommand(&command);
- if (result == RETURN_OK) {
+ if (result == returnvalue::OK) {
continue;
}
result = healthHelper.handleHealthCommand(&command);
- if (result == RETURN_OK) {
+ if (result == returnvalue::OK) {
continue;
}
result = poolManager.handleHousekeepingMessage(&command);
- if (result == RETURN_OK) {
+ if (result == returnvalue::OK) {
continue;
}
result = handleCommandMessage(&command);
- if (result == RETURN_OK) {
+ if (result == returnvalue::OK) {
continue;
}
command.setToUnknownCommand();
@@ -65,11 +65,11 @@ void ExtendedControllerBase::handleQueue() {
ReturnValue_t ExtendedControllerBase::initialize() {
ReturnValue_t result = ControllerBase::initialize();
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result = actionHelper.initialize(commandQueue);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
@@ -86,7 +86,7 @@ ReturnValue_t ExtendedControllerBase::performOperation(uint8_t opCode) {
/* We do this after performing control operation because variables will be set changed
in this function. */
poolManager.performHkOperation();
- return RETURN_OK;
+ return returnvalue::OK;
}
MessageQueueId_t ExtendedControllerBase::getCommandQueue() const { return commandQueue->getId(); }
diff --git a/src/fsfw/controller/ExtendedControllerBase.h b/src/fsfw/controller/ExtendedControllerBase.h
index f1802b54..75845f02 100644
--- a/src/fsfw/controller/ExtendedControllerBase.h
+++ b/src/fsfw/controller/ExtendedControllerBase.h
@@ -18,16 +18,16 @@ class ExtendedControllerBase : public ControllerBase,
public HasLocalDataPoolIF {
public:
ExtendedControllerBase(object_id_t objectId, object_id_t parentId, size_t commandQueueDepth = 3);
- virtual ~ExtendedControllerBase();
+ ~ExtendedControllerBase() override;
/* 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 */
- virtual ReturnValue_t performOperation(uint8_t opCode) override;
- virtual ReturnValue_t initializeAfterTaskCreation() override;
+ ReturnValue_t performOperation(uint8_t opCode) override;
+ ReturnValue_t initializeAfterTaskCreation() override;
protected:
LocalDataPoolManager poolManager;
@@ -39,34 +39,32 @@ class ExtendedControllerBase : public ControllerBase,
* @param message
* @return
*/
- virtual ReturnValue_t handleCommandMessage(CommandMessage* message) = 0;
+ ReturnValue_t handleCommandMessage(CommandMessage* message) override = 0;
/**
* Periodic helper from ControllerBase, implemented by child class.
*/
- virtual void performControlOperation() = 0;
+ void performControlOperation() override = 0;
// Handle the four messages mentioned above
void handleQueue() override;
- // HasActionsIF overrides
- virtual ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
- const uint8_t* data, size_t size) override;
+ /* HasActionsIF overrides */
+ ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
+ const uint8_t* data, size_t size) override;
- // HasLocalDatapoolIF overrides
- virtual ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
- LocalDataPoolManager& poolManager) override = 0;
- virtual LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override = 0;
+ /* HasLocalDatapoolIF overrides */
+ LocalDataPoolManager* getHkManagerHandle() override;
+ [[nodiscard]] object_id_t getObjectId() const override;
+ [[nodiscard]] uint32_t getPeriodicOperationFrequency() const override;
+
+ ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
+ LocalDataPoolManager& poolManager) override = 0;
+ LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override = 0;
// Mode abstract functions
- virtual ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
- uint32_t* msToReachTheMode) override = 0;
-
- virtual LocalDataPoolManager* getHkManagerHandle() override;
- virtual object_id_t getObjectId() const override;
- virtual uint32_t getPeriodicOperationFrequency() const override;
-
-
+ ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
+ uint32_t* msToReachTheMode) override = 0;
};
#endif /* FSFW_CONTROLLER_EXTENDEDCONTROLLERBASE_H_ */
diff --git a/src/fsfw/coordinates/Sgp4Propagator.cpp b/src/fsfw/coordinates/Sgp4Propagator.cpp
index 4a43842c..e79ffef5 100644
--- a/src/fsfw/coordinates/Sgp4Propagator.cpp
+++ b/src/fsfw/coordinates/Sgp4Propagator.cpp
@@ -152,7 +152,7 @@ ReturnValue_t Sgp4Propagator::initialize(const uint8_t* line1, const uint8_t* li
return MAKE_RETURN_CODE(result);
} else {
initialized = true;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
}
@@ -195,6 +195,6 @@ ReturnValue_t Sgp4Propagator::propagate(double* position, double* velocity, time
if (result != 0) {
return MAKE_RETURN_CODE(result || 0xB0);
} else {
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
}
diff --git a/src/fsfw/coordinates/Sgp4Propagator.h b/src/fsfw/coordinates/Sgp4Propagator.h
index 0edaf459..5cbeb3f2 100644
--- a/src/fsfw/coordinates/Sgp4Propagator.h
+++ b/src/fsfw/coordinates/Sgp4Propagator.h
@@ -7,7 +7,7 @@
#ifndef PLATFORM_WIN
#include
#endif
-#include "fsfw/returnvalues/HasReturnvaluesIF.h"
+#include "fsfw/returnvalues/returnvalue.h"
#include "fsfw_contrib/sgp4/sgp4unit.h"
class Sgp4Propagator {
diff --git a/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h b/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h
index 22ff12e4..71d14e60 100644
--- a/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h
+++ b/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h
@@ -9,12 +9,12 @@
#define CCSDSRETURNVALUESIF_H_
#include "dllConf.h"
-#include "fsfw/returnvalues/HasReturnvaluesIF.h"
+#include "fsfw/returnvalues/returnvalue.h"
/**
* This is a helper class to collect special return values that come up during CCSDS Handling.
* @ingroup ccsds_handling
*/
-class CCSDSReturnValuesIF : public HasReturnvaluesIF {
+class CCSDSReturnValuesIF {
public:
static const uint8_t INTERFACE_ID = CLASS_ID::CCSDS_HANDLER_IF; //!< Basic ID of the interface.
diff --git a/src/fsfw/datalinklayer/DataLinkLayer.cpp b/src/fsfw/datalinklayer/DataLinkLayer.cpp
index ca607478..6fe3e664 100644
--- a/src/fsfw/datalinklayer/DataLinkLayer.cpp
+++ b/src/fsfw/datalinklayer/DataLinkLayer.cpp
@@ -28,7 +28,7 @@ ReturnValue_t DataLinkLayer::frameDelimitingAndFillRemoval() {
TcTransferFrame frame_candidate(frameBuffer);
this->currentFrame = frame_candidate; // should work with shallow copy.
- return RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t DataLinkLayer::frameValidationCheck() {
@@ -59,14 +59,14 @@ ReturnValue_t DataLinkLayer::frameValidationCheck() {
if (USE_CRC) {
return this->frameCheckCRC();
}
- return RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t DataLinkLayer::frameCheckCRC() {
uint16_t checkValue =
CRC::crc16ccitt(this->currentFrame.getFullFrame(), this->currentFrame.getFullSize());
if (checkValue == 0) {
- return RETURN_OK;
+ return returnvalue::OK;
} else {
return CRC_FAILED;
}
@@ -74,7 +74,7 @@ ReturnValue_t DataLinkLayer::frameCheckCRC() {
ReturnValue_t DataLinkLayer::allFramesReception() {
ReturnValue_t status = this->frameDelimitingAndFillRemoval();
- if (status != RETURN_OK) {
+ if (status != returnvalue::OK) {
return status;
}
return this->frameValidationCheck();
@@ -90,7 +90,7 @@ ReturnValue_t DataLinkLayer::virtualChannelDemultiplexing() {
virtualChannelIterator iter = virtualChannels.find(vcId);
if (iter == virtualChannels.end()) {
// Do not report because passive board will get this error all the time.
- return RETURN_OK;
+ return returnvalue::OK;
} else {
return (iter->second)->frameAcceptanceAndReportingMechanism(¤tFrame, clcw);
}
@@ -99,7 +99,7 @@ ReturnValue_t DataLinkLayer::virtualChannelDemultiplexing() {
ReturnValue_t DataLinkLayer::processFrame(uint16_t length) {
receivedDataLength = length;
ReturnValue_t status = allFramesReception();
- if (status != RETURN_OK) {
+ if (status != returnvalue::OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "DataLinkLayer::processFrame: frame reception failed. "
"Error code: "
@@ -117,14 +117,14 @@ ReturnValue_t DataLinkLayer::addVirtualChannel(uint8_t virtualChannelId,
std::pair returnValue = virtualChannels.insert(
std::pair(virtualChannelId, object));
if (returnValue.second == true) {
- return RETURN_OK;
+ return returnvalue::OK;
} else {
- return RETURN_FAILED;
+ return returnvalue::FAILED;
}
}
ReturnValue_t DataLinkLayer::initialize() {
- ReturnValue_t returnValue = RETURN_FAILED;
+ ReturnValue_t returnValue = returnvalue::FAILED;
// Set Virtual Channel ID to first virtual channel instance in this DataLinkLayer instance to
// avoid faulty information (e.g. 0) in the VCID.
if (virtualChannels.begin() != virtualChannels.end()) {
@@ -133,13 +133,13 @@ ReturnValue_t DataLinkLayer::initialize() {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "DataLinkLayer::initialize: No VC assigned to this DLL instance! " << std::endl;
#endif
- return RETURN_FAILED;
+ return returnvalue::FAILED;
}
for (virtualChannelIterator iterator = virtualChannels.begin(); iterator != virtualChannels.end();
iterator++) {
returnValue = iterator->second->initialize();
- if (returnValue != RETURN_OK) break;
+ if (returnValue != returnvalue::OK) break;
}
return returnValue;
}
diff --git a/src/fsfw/datalinklayer/DataLinkLayer.h b/src/fsfw/datalinklayer/DataLinkLayer.h
index 8735feb6..64d2f96b 100644
--- a/src/fsfw/datalinklayer/DataLinkLayer.h
+++ b/src/fsfw/datalinklayer/DataLinkLayer.h
@@ -51,7 +51,7 @@ class DataLinkLayer : public CCSDSReturnValuesIF {
* This method tries to process a frame that is placed in #frameBuffer.
* The procedures described in the Standard are performed.
* @param length Length of the incoming frame candidate.
- * @return @c RETURN_OK on successful handling, otherwise the return codes of the higher
+ * @return @c returnvalue::OK on successful handling, otherwise the return codes of the higher
* methods.
*/
ReturnValue_t processFrame(uint16_t length);
@@ -61,12 +61,12 @@ class DataLinkLayer : public CCSDSReturnValuesIF {
* handle Frames directed to this VC.
* @param virtualChannelId Id of the VC. Shall be smaller than 64.
* @param object Reference to the object that handles the Frame.
- * @return @c RETURN_OK on success, @c RETURN_FAILED otherwise.
+ * @return @c returnvalue::OK on success, @c returnvalue::FAILED otherwise.
*/
ReturnValue_t addVirtualChannel(uint8_t virtualChannelId, VirtualChannelReceptionIF* object);
/**
* The initialization method calls the @c initialize routine of all virtual channels.
- * @return The return code of the first failed VC initialization or @c RETURN_OK.
+ * @return The return code of the first failed VC initialization or @c returnvalue::OK.
*/
ReturnValue_t initialize();
@@ -91,19 +91,19 @@ class DataLinkLayer : public CCSDSReturnValuesIF {
virtualChannels; //!< Map of all virtual channels assigned.
/**
* Method that performs all possible frame validity checks (as specified).
- * @return Various error codes or @c RETURN_OK on success.
+ * @return Various error codes or @c returnvalue::OK on success.
*/
ReturnValue_t frameValidationCheck();
/**
* First method to call.
* Removes start sequence bytes and checks if the complete frame was received.
* SHOULDDO: Maybe handling the start sequence must be done more variable.
- * @return @c RETURN_OK or @c TOO_SHORT.
+ * @return @c returnvalue::OK or @c TOO_SHORT.
*/
ReturnValue_t frameDelimitingAndFillRemoval();
/**
* Small helper method to check the CRC of the Frame.
- * @return @c RETURN_OK or @c CRC_FAILED.
+ * @return @c returnvalue::OK or @c CRC_FAILED.
*/
ReturnValue_t frameCheckCRC();
/**
diff --git a/src/fsfw/datalinklayer/Farm1StateOpen.cpp b/src/fsfw/datalinklayer/Farm1StateOpen.cpp
index cf3339a7..b27f609c 100644
--- a/src/fsfw/datalinklayer/Farm1StateOpen.cpp
+++ b/src/fsfw/datalinklayer/Farm1StateOpen.cpp
@@ -11,7 +11,7 @@ ReturnValue_t Farm1StateOpen::handleADFrame(TcTransferFrame* frame, ClcwIF* clcw
if (diff == 0) {
myVC->vR++;
clcw->setRetransmitFlag(false);
- return RETURN_OK;
+ return returnvalue::OK;
} else if (diff < myVC->positiveWindow && diff > 0) {
clcw->setRetransmitFlag(true);
return NS_POSITIVE_W;
diff --git a/src/fsfw/datalinklayer/Farm1StateOpen.h b/src/fsfw/datalinklayer/Farm1StateOpen.h
index 0bca931d..a1c553ff 100644
--- a/src/fsfw/datalinklayer/Farm1StateOpen.h
+++ b/src/fsfw/datalinklayer/Farm1StateOpen.h
@@ -37,8 +37,8 @@ class Farm1StateOpen : public Farm1StateIF {
* change to Farm1StateLockout.
* @param frame The frame to handle.
* @param clcw Any changes to the CLCW shall be done with the help of this interface.
- * @return If the Sequence Number is ok, it returns #RETURN_OK. Otherwise either #NS_POSITIVE_W,
- * #NS_NEGATIVE_W or NS_LOCKOUT is returned.
+ * @return If the Sequence Number is ok, it returns returnvalue::OK. Otherwise either
+ * #NS_POSITIVE_W, #NS_NEGATIVE_W or NS_LOCKOUT is returned.
*/
ReturnValue_t handleADFrame(TcTransferFrame* frame, ClcwIF* clcw);
/**
diff --git a/src/fsfw/datalinklayer/MapPacketExtraction.cpp b/src/fsfw/datalinklayer/MapPacketExtraction.cpp
index 57aa2f08..c074de73 100644
--- a/src/fsfw/datalinklayer/MapPacketExtraction.cpp
+++ b/src/fsfw/datalinklayer/MapPacketExtraction.cpp
@@ -6,7 +6,7 @@
#include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
#include "fsfw/storagemanager/StorageManagerIF.h"
-#include "fsfw/tmtcpacket/SpacePacketBase.h"
+#include "fsfw/tmtcpacket/ccsds/SpacePacketReader.h"
#include "fsfw/tmtcservices/AcceptsTelecommandsIF.h"
#include "fsfw/tmtcservices/TmTcMessage.h"
@@ -31,7 +31,7 @@ ReturnValue_t MapPacketExtraction::extractPackets(TcTransferFrame* frame) {
if (packetLength <= MAX_PACKET_SIZE) {
memcpy(packetBuffer, frame->getDataField(), packetLength);
bufferPosition = &packetBuffer[packetLength];
- status = RETURN_OK;
+ status = returnvalue::OK;
} else {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "MapPacketExtraction::extractPackets. Packet too large! Size: "
@@ -52,7 +52,7 @@ ReturnValue_t MapPacketExtraction::extractPackets(TcTransferFrame* frame) {
status = sendCompletePacket(packetBuffer, packetLength);
clearBuffers();
}
- status = RETURN_OK;
+ status = returnvalue::OK;
} else {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "MapPacketExtraction::extractPackets. Packet too large! Size: "
@@ -95,7 +95,7 @@ ReturnValue_t MapPacketExtraction::unpackBlockingPackets(TcTransferFrame* frame)
status = sendCompletePacket(packet.getWholeData(), packet.getFullSize());
totalLength -= packet.getFullSize();
position += packet.getFullSize();
- status = RETURN_OK;
+ status = returnvalue::OK;
} else {
status = DATA_CORRUPTED;
totalLength = 0;
@@ -110,7 +110,7 @@ ReturnValue_t MapPacketExtraction::unpackBlockingPackets(TcTransferFrame* frame)
ReturnValue_t MapPacketExtraction::sendCompletePacket(uint8_t* data, uint32_t size) {
store_address_t store_id;
ReturnValue_t status = this->packetStore->addData(&store_id, data, size);
- if (status == RETURN_OK) {
+ if (status == returnvalue::OK) {
TmTcMessage message(store_id);
status = MessageQueueSenderIF::sendMessage(tcQueueId, &message);
}
@@ -130,9 +130,9 @@ ReturnValue_t MapPacketExtraction::initialize() {
ObjectManager::instance()->get(packetDestination);
if ((packetStore != NULL) && (distributor != NULL)) {
tcQueueId = distributor->getRequestQueue();
- return RETURN_OK;
+ return returnvalue::OK;
} else {
- return RETURN_FAILED;
+ return returnvalue::FAILED;
}
}
diff --git a/src/fsfw/datalinklayer/MapPacketExtraction.h b/src/fsfw/datalinklayer/MapPacketExtraction.h
index c2673b2e..fab7f3c3 100644
--- a/src/fsfw/datalinklayer/MapPacketExtraction.h
+++ b/src/fsfw/datalinklayer/MapPacketExtraction.h
@@ -5,7 +5,7 @@
#include "dllConf.h"
#include "fsfw/ipc/MessageQueueSenderIF.h"
#include "fsfw/objectmanager/ObjectManagerIF.h"
-#include "fsfw/returnvalues/HasReturnvaluesIF.h"
+#include "fsfw/returnvalues/returnvalue.h"
class StorageManagerIF;
@@ -36,7 +36,7 @@ class MapPacketExtraction : public MapPacketExtractionIF {
* Method that is called if the segmentation flag is @c NO_SEGMENTATION.
* The method extracts one or more packets within the frame and forwards them to the OBSW.
* @param frame The TC Transfer Frame to work on.
- * @return @c RETURN_OK if all Packets were extracted. If something is entirely wrong,
+ * @return @c returnvalue::OK if all Packets were extracted. If something is entirely wrong,
* @c DATA_CORRUPTED is returned, if some bytes are left over @c RESIDUAL_DATA.
*/
ReturnValue_t unpackBlockingPackets(TcTransferFrame* frame);
@@ -63,7 +63,7 @@ class MapPacketExtraction : public MapPacketExtractionIF {
ReturnValue_t extractPackets(TcTransferFrame* frame);
/**
* The #packetStore and the default destination of #tcQueue are initialized here.
- * @return @c RETURN_OK on success, @c RETURN_FAILED otherwise.
+ * @return @c returnvalue::OK on success, @c returnvalue::FAILED otherwise.
*/
ReturnValue_t initialize();
/**
diff --git a/src/fsfw/datalinklayer/VirtualChannelReception.cpp b/src/fsfw/datalinklayer/VirtualChannelReception.cpp
index 258bc1e6..4c44cf01 100644
--- a/src/fsfw/datalinklayer/VirtualChannelReception.cpp
+++ b/src/fsfw/datalinklayer/VirtualChannelReception.cpp
@@ -57,18 +57,18 @@ ReturnValue_t VirtualChannelReception::doFARM(TcTransferFrame* frame, ClcwIF* cl
ReturnValue_t VirtualChannelReception::frameAcceptanceAndReportingMechanism(TcTransferFrame* frame,
ClcwIF* clcw) {
- ReturnValue_t result = RETURN_OK;
+ ReturnValue_t result = returnvalue::OK;
result = doFARM(frame, &internalClcw);
internalClcw.setReceiverFrameSequenceNumber(vR);
internalClcw.setFarmBCount(farmBCounter);
clcw->setWhole(internalClcw.getAsWhole());
switch (result) {
- case RETURN_OK:
+ case returnvalue::OK:
return mapDemultiplexing(frame);
case BC_IS_SET_VR_COMMAND:
case BC_IS_UNLOCK_COMMAND:
// Need to catch these codes to avoid error reporting later.
- return RETURN_OK;
+ return returnvalue::OK;
default:
break;
}
@@ -79,15 +79,15 @@ ReturnValue_t VirtualChannelReception::addMapChannel(uint8_t mapId, MapPacketExt
std::pair returnValue =
mapChannels.insert(std::pair(mapId, object));
if (returnValue.second == true) {
- return RETURN_OK;
+ return returnvalue::OK;
} else {
- return RETURN_FAILED;
+ return returnvalue::FAILED;
}
}
ReturnValue_t VirtualChannelReception::handleBDFrame(TcTransferFrame* frame, ClcwIF* clcw) {
farmBCounter++;
- return RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t VirtualChannelReception::handleBCFrame(TcTransferFrame* frame, ClcwIF* clcw) {
@@ -107,18 +107,18 @@ ReturnValue_t VirtualChannelReception::handleBCFrame(TcTransferFrame* frame, Clc
uint8_t VirtualChannelReception::getChannelId() const { return channelId; }
ReturnValue_t VirtualChannelReception::initialize() {
- ReturnValue_t returnValue = RETURN_FAILED;
+ ReturnValue_t returnValue = returnvalue::FAILED;
if ((slidingWindowWidth > 254) || (slidingWindowWidth % 2 != 0)) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "VirtualChannelReception::initialize: Illegal sliding window width: "
<< (int)slidingWindowWidth << std::endl;
#endif
- return RETURN_FAILED;
+ return returnvalue::FAILED;
}
for (mapChannelIterator iterator = mapChannels.begin(); iterator != mapChannels.end();
iterator++) {
returnValue = iterator->second->initialize();
- if (returnValue != RETURN_OK) break;
+ if (returnValue != returnvalue::OK) break;
}
return returnValue;
}
diff --git a/src/fsfw/datalinklayer/VirtualChannelReception.h b/src/fsfw/datalinklayer/VirtualChannelReception.h
index 6dc17dd8..429ae9de 100644
--- a/src/fsfw/datalinklayer/VirtualChannelReception.h
+++ b/src/fsfw/datalinklayer/VirtualChannelReception.h
@@ -77,7 +77,7 @@ class VirtualChannelReception : public VirtualChannelReceptionIF, public CCSDSRe
* required.
* @param frame The Tc Transfer Frame to handle.
* @param clcw Any changes on the CLCW shall be done with this method.
- * @return Always returns @c RETURN_OK.
+ * @return Always returns @c returnvalue::OK.
*/
ReturnValue_t handleBDFrame(TcTransferFrame* frame, ClcwIF* clcw);
/**
@@ -102,13 +102,14 @@ class VirtualChannelReception : public VirtualChannelReceptionIF, public CCSDSRe
* Helper method to simplify adding a mapChannel during construction.
* @param mapId The mapId of the object to add.
* @param object Pointer to the MapPacketExtraction object itself.
- * @return @c RETURN_OK if the channel was successfully inserted, @c RETURN_FAILED otherwise.
+ * @return @c returnvalue::OK if the channel was successfully inserted, @c returnvalue::FAILED
+ * otherwise.
*/
ReturnValue_t addMapChannel(uint8_t mapId, MapPacketExtractionIF* object);
/**
* The initialization routine checks the set #slidingWindowWidth and initializes all MAP
* channels.
- * @return @c RETURN_OK on successful initialization, @c RETURN_FAILED otherwise.
+ * @return @c returnvalue::OK on successful initialization, @c returnvalue::FAILED otherwise.
*/
ReturnValue_t initialize();
/**
diff --git a/src/fsfw/datalinklayer/VirtualChannelReceptionIF.h b/src/fsfw/datalinklayer/VirtualChannelReceptionIF.h
index 3426f21c..9239ee0e 100644
--- a/src/fsfw/datalinklayer/VirtualChannelReceptionIF.h
+++ b/src/fsfw/datalinklayer/VirtualChannelReceptionIF.h
@@ -11,7 +11,7 @@
#include "ClcwIF.h"
#include "TcTransferFrame.h"
#include "dllConf.h"
-#include "fsfw/returnvalues/HasReturnvaluesIF.h"
+#include "fsfw/returnvalues/returnvalue.h"
/**
* This is the interface for Virtual Channel reception classes.
@@ -33,13 +33,13 @@ class VirtualChannelReceptionIF {
* Handling the Frame includes forwarding to higher-level procedures.
* @param frame The Tc Transfer Frame that was received and checked.
* @param clcw Any changes to the CLCW value are forwarded by using this parameter.
- * @return The return Value shall indicate successful processing with @c RETURN_OK.
+ * @return The return Value shall indicate successful processing with @c returnvalue::OK.
*/
virtual ReturnValue_t frameAcceptanceAndReportingMechanism(TcTransferFrame* frame,
ClcwIF* clcw) = 0;
/**
* If any other System Objects are required for operation they shall be initialized here.
- * @return @c RETURN_OK for successful initialization.
+ * @return @c returnvalue::OK for successful initialization.
*/
virtual ReturnValue_t initialize() = 0;
/**
diff --git a/src/fsfw/datapool/DataSetIF.h b/src/fsfw/datapool/DataSetIF.h
index 492bcf29..3d4be351 100644
--- a/src/fsfw/datapool/DataSetIF.h
+++ b/src/fsfw/datapool/DataSetIF.h
@@ -1,7 +1,7 @@
#ifndef FSFW_DATAPOOL_DATASETIF_H_
#define FSFW_DATAPOOL_DATASETIF_H_
-#include "../returnvalues/HasReturnvaluesIF.h"
+#include "../returnvalues/returnvalue.h"
#include "../timemanager/Clock.h"
class PoolVariableIF;
diff --git a/src/fsfw/datapool/PoolDataSetBase.cpp b/src/fsfw/datapool/PoolDataSetBase.cpp
index b31f4725..0df21d2a 100644
--- a/src/fsfw/datapool/PoolDataSetBase.cpp
+++ b/src/fsfw/datapool/PoolDataSetBase.cpp
@@ -14,7 +14,7 @@ PoolDataSetBase::~PoolDataSetBase() {}
ReturnValue_t PoolDataSetBase::registerVariable(PoolVariableIF* variable) {
if (registeredVariables == nullptr) {
/* Underlying container invalid */
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
if (state != States::STATE_SET_UNINITIALISED) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
@@ -42,17 +42,17 @@ ReturnValue_t PoolDataSetBase::registerVariable(PoolVariableIF* variable) {
}
registeredVariables[fillCount] = variable;
fillCount++;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t PoolDataSetBase::read(MutexIF::TimeoutType timeoutType, uint32_t lockTimeout) {
- ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
+ ReturnValue_t result = returnvalue::OK;
ReturnValue_t error = result;
if (state == States::STATE_SET_UNINITIALISED) {
lockDataPool(timeoutType, lockTimeout);
for (uint16_t count = 0; count < fillCount; count++) {
result = readVariable(count);
- if (result != RETURN_OK) {
+ if (result != returnvalue::OK) {
error = result;
}
}
@@ -71,7 +71,7 @@ ReturnValue_t PoolDataSetBase::read(MutexIF::TimeoutType timeoutType, uint32_t l
result = SET_WAS_ALREADY_READ;
}
- if (error != HasReturnvaluesIF::RETURN_OK) {
+ if (error != returnvalue::OK) {
result = error;
}
return result;
@@ -80,10 +80,10 @@ ReturnValue_t PoolDataSetBase::read(MutexIF::TimeoutType timeoutType, uint32_t l
uint16_t PoolDataSetBase::getFillCount() const { return fillCount; }
ReturnValue_t PoolDataSetBase::readVariable(uint16_t count) {
- ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
+ ReturnValue_t result = returnvalue::OK;
if (registeredVariables[count] == nullptr) {
/* Configuration error. */
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
/* These checks are often performed by the respective variable implementation too, but I guess
@@ -98,7 +98,7 @@ ReturnValue_t PoolDataSetBase::readVariable(uint16_t count) {
result = ReadCommitIFAttorney::readWithoutLock(registeredVariables[count]);
}
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
result = INVALID_PARAMETER_DEFINITION;
}
}
@@ -108,7 +108,7 @@ ReturnValue_t PoolDataSetBase::readVariable(uint16_t count) {
ReturnValue_t PoolDataSetBase::commit(MutexIF::TimeoutType timeoutType, uint32_t lockTimeout) {
if (state == States::STATE_SET_WAS_READ) {
handleAlreadyReadDatasetCommit(timeoutType, lockTimeout);
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
} else {
return handleUnreadDatasetCommit(timeoutType, lockTimeout);
}
@@ -134,7 +134,7 @@ void PoolDataSetBase::handleAlreadyReadDatasetCommit(MutexIF::TimeoutType timeou
ReturnValue_t PoolDataSetBase::handleUnreadDatasetCommit(MutexIF::TimeoutType timeoutType,
uint32_t lockTimeout) {
- ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
+ ReturnValue_t result = returnvalue::OK;
lockDataPool(timeoutType, lockTimeout);
for (uint16_t count = 0; count < fillCount; count++) {
if ((registeredVariables[count]->getReadWriteMode() == PoolVariableIF::VAR_WRITE) and
@@ -165,17 +165,17 @@ ReturnValue_t PoolDataSetBase::handleUnreadDatasetCommit(MutexIF::TimeoutType ti
ReturnValue_t PoolDataSetBase::lockDataPool(MutexIF::TimeoutType timeoutType,
uint32_t lockTimeout) {
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
-ReturnValue_t PoolDataSetBase::unlockDataPool() { return HasReturnvaluesIF::RETURN_OK; }
+ReturnValue_t PoolDataSetBase::unlockDataPool() { return returnvalue::OK; }
ReturnValue_t PoolDataSetBase::serialize(uint8_t** buffer, size_t* size, const size_t maxSize,
SerializeIF::Endianness streamEndianness) const {
- ReturnValue_t result = HasReturnvaluesIF::RETURN_FAILED;
+ ReturnValue_t result = returnvalue::FAILED;
for (uint16_t count = 0; count < fillCount; count++) {
result = registeredVariables[count]->serialize(buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
}
@@ -184,10 +184,10 @@ ReturnValue_t PoolDataSetBase::serialize(uint8_t** buffer, size_t* size, const s
ReturnValue_t PoolDataSetBase::deSerialize(const uint8_t** buffer, size_t* size,
SerializeIF::Endianness streamEndianness) {
- ReturnValue_t result = HasReturnvaluesIF::RETURN_FAILED;
+ ReturnValue_t result = returnvalue::FAILED;
for (uint16_t count = 0; count < fillCount; count++) {
result = registeredVariables[count]->deSerialize(buffer, size, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
}
diff --git a/src/fsfw/datapool/PoolDataSetBase.h b/src/fsfw/datapool/PoolDataSetBase.h
index dc6ec135..3e7e30c5 100644
--- a/src/fsfw/datapool/PoolDataSetBase.h
+++ b/src/fsfw/datapool/PoolDataSetBase.h
@@ -29,20 +29,20 @@
* @author Bastian Baetz
* @ingroup data_pool
*/
-class PoolDataSetBase : public PoolDataSetIF, public SerializeIF, public HasReturnvaluesIF {
+class PoolDataSetBase : public PoolDataSetIF, public SerializeIF {
public:
/**
* @brief Creates an empty dataset. Use registerVariable or
* supply a pointer to this dataset to PoolVariable
* initializations to register pool variables.
*/
- PoolDataSetBase(PoolVariableIF** registeredVariablesArray, const size_t maxFillCount);
+ PoolDataSetBase(PoolVariableIF** registeredVariablesArray, size_t maxFillCount);
/* Forbidden for now */
PoolDataSetBase(const PoolDataSetBase& otherSet) = delete;
const PoolDataSetBase& operator=(const PoolDataSetBase& otherSet) = delete;
- virtual ~PoolDataSetBase();
+ ~PoolDataSetBase() override;
/**
* @brief The read call initializes reading out all registered variables.
@@ -58,7 +58,7 @@ class PoolDataSetBase : public PoolDataSetIF, public SerializeIF, public HasRetu
* freed afterwards. It is mandatory to call commit after a read call,
* even if the read operation is not successful!
* @return
- * - @c RETURN_OK if all variables were read successfully.
+ * - @c returnvalue::OK if all variables were read successfully.
* - @c INVALID_PARAMETER_DEFINITION if a pool entry does not exist or there
* is a type conflict.
* - @c SET_WAS_ALREADY_READ if read() is called twice without calling
@@ -80,7 +80,7 @@ class PoolDataSetBase : public PoolDataSetIF, public SerializeIF, public HasRetu
* commit() can only be called after read(). If the set only contains
* variables which are write only, commit() can be called without a
* preceding read() call. Every read call must be followed by a commit call!
- * @return - @c RETURN_OK if all variables were read successfully.
+ * @return - @c returnvalue::OK if all variables were read successfully.
* - @c COMMITING_WITHOUT_READING if set was not read yet and
* contains non write-only variables
*/
@@ -97,7 +97,7 @@ class PoolDataSetBase : public PoolDataSetIF, public SerializeIF, public HasRetu
/**
* Provides the means to lock the underlying data structure to ensure
* thread-safety. Default implementation is empty
- * @return Always returns -@c RETURN_OK
+ * @return Always returns -@c returnvalue::OK
*/
virtual ReturnValue_t lockDataPool(
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING,
@@ -105,7 +105,7 @@ class PoolDataSetBase : public PoolDataSetIF, public SerializeIF, public HasRetu
/**
* Provides the means to unlock the underlying data structure to ensure
* thread-safety. Default implementation is empty
- * @return Always returns -@c RETURN_OK
+ * @return Always returns -@c returnvalue::OK
*/
virtual ReturnValue_t unlockDataPool() override;
diff --git a/src/fsfw/datapool/PoolEntry.cpp b/src/fsfw/datapool/PoolEntry.cpp
index fd110e6c..9138a705 100644
--- a/src/fsfw/datapool/PoolEntry.cpp
+++ b/src/fsfw/datapool/PoolEntry.cpp
@@ -7,24 +7,26 @@
#include "fsfw/serviceinterface/ServiceInterface.h"
template
-PoolEntry::PoolEntry(std::initializer_list initValue, bool setValid)
- : length(static_cast(initValue.size())), valid(setValid) {
- this->address = new T[this->length];
- if (initValue.size() == 0) {
- std::memset(this->address, 0, this->getByteSize());
- } else {
- std::copy(initValue.begin(), initValue.end(), this->address);
+PoolEntry::PoolEntry(uint8_t len, bool setValid) : length(len), valid(setValid) {
+ this->address = new T[this->length]();
+ std::memset(this->address, 0, this->getByteSize());
+}
+
+template
+PoolEntry::PoolEntry(std::initializer_list initValues, bool setValid)
+ : length(static_cast(initValues.size())), valid(setValid) {
+ this->address = new T[this->length]();
+ if (initValues.size() > 0) {
+ std::copy(initValues.begin(), initValues.end(), this->address);
}
}
template
-PoolEntry::PoolEntry(T* initValue, uint8_t setLength, bool setValid)
+PoolEntry::PoolEntry(const T* initValue, uint8_t setLength, bool setValid)
: length(setLength), valid(setValid) {
- this->address = new T[this->length];
+ this->address = new T[this->length]();
if (initValue != nullptr) {
std::memcpy(this->address, initValue, this->getByteSize());
- } else {
- std::memset(this->address, 0, this->getByteSize());
}
}
diff --git a/src/fsfw/datapool/PoolEntry.h b/src/fsfw/datapool/PoolEntry.h
index d3d80f09..4010f78d 100644
--- a/src/fsfw/datapool/PoolEntry.h
+++ b/src/fsfw/datapool/PoolEntry.h
@@ -33,6 +33,9 @@ class PoolEntry : public PoolEntryIF {
"instead! The ECSS standard defines a boolean as a one bit "
"field. Therefore it is preferred to store a boolean as an "
"uint8_t");
+
+ PoolEntry(uint8_t len = 1, bool setValid = false);
+
/**
* @brief In the classe's constructor, space is allocated on the heap and
* potential initialization values are copied to that space.
@@ -49,7 +52,7 @@ class PoolEntry : public PoolEntryIF {
* @param setValid
* Sets the initialization flag. It is invalid by default.
*/
- PoolEntry(std::initializer_list initValue = {0}, bool setValid = false);
+ PoolEntry(std::initializer_list initValue, bool setValid = false);
/**
* @brief In the classe's constructor, space is allocated on the heap and
@@ -62,7 +65,7 @@ class PoolEntry : public PoolEntryIF {
* @param setValid
* Sets the initialization flag. It is invalid by default.
*/
- PoolEntry(T* initValue, uint8_t setLength = 1, bool setValid = false);
+ PoolEntry(const T* initValue, uint8_t setLength = 1, bool setValid = false);
//! Explicitely deleted copy ctor, copying is not allowed.
PoolEntry(const PoolEntry&) = delete;
diff --git a/src/fsfw/datapool/PoolReadGuard.h b/src/fsfw/datapool/PoolReadGuard.h
index 24d98933..f9bf35fe 100644
--- a/src/fsfw/datapool/PoolReadGuard.h
+++ b/src/fsfw/datapool/PoolReadGuard.h
@@ -17,7 +17,7 @@ class PoolReadGuard {
: readObject(readObject), mutexTimeout(mutexTimeout) {
if (readObject != nullptr) {
readResult = readObject->read(timeoutType, mutexTimeout);
- if (readResult != HasReturnvaluesIF::RETURN_OK) {
+ if (readResult != returnvalue::OK) {
#if FSFW_VERBOSE_LEVEL == 1
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "PoolReadHelper: Read failed!" << std::endl;
@@ -47,7 +47,7 @@ class PoolReadGuard {
private:
ReadCommitIF* readObject = nullptr;
- ReturnValue_t readResult = HasReturnvaluesIF::RETURN_OK;
+ ReturnValue_t readResult = returnvalue::OK;
bool noCommit = false;
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING;
uint32_t mutexTimeout = 20;
diff --git a/src/fsfw/datapool/PoolVariableIF.h b/src/fsfw/datapool/PoolVariableIF.h
index 95cf898e..69074310 100644
--- a/src/fsfw/datapool/PoolVariableIF.h
+++ b/src/fsfw/datapool/PoolVariableIF.h
@@ -1,7 +1,7 @@
#ifndef FSFW_DATAPOOL_POOLVARIABLEIF_H_
#define FSFW_DATAPOOL_POOLVARIABLEIF_H_
-#include "../returnvalues/HasReturnvaluesIF.h"
+#include "../returnvalues/returnvalue.h"
#include "../serialize/SerializeIF.h"
#include "ReadCommitIF.h"
diff --git a/src/fsfw/datapool/ReadCommitIF.h b/src/fsfw/datapool/ReadCommitIF.h
index 08554be1..ca074dec 100644
--- a/src/fsfw/datapool/ReadCommitIF.h
+++ b/src/fsfw/datapool/ReadCommitIF.h
@@ -2,7 +2,7 @@
#define FSFW_DATAPOOL_READCOMMITIF_H_
#include "../ipc/MutexIF.h"
-#include "../returnvalues/HasReturnvaluesIF.h"
+#include "../returnvalues/returnvalue.h"
/**
* @brief Common interface for all software objects which employ read-commit
diff --git a/src/fsfw/datapool/ReadCommitIFAttorney.h b/src/fsfw/datapool/ReadCommitIFAttorney.h
index ea39ffe5..cca76c97 100644
--- a/src/fsfw/datapool/ReadCommitIFAttorney.h
+++ b/src/fsfw/datapool/ReadCommitIFAttorney.h
@@ -2,7 +2,7 @@
#define FSFW_DATAPOOL_READCOMMITIFATTORNEY_H_
#include
-#include
+#include
/**
* @brief This class determines which members are allowed to access protected members
@@ -12,14 +12,14 @@ class ReadCommitIFAttorney {
private:
static ReturnValue_t readWithoutLock(ReadCommitIF* readCommitIF) {
if (readCommitIF == nullptr) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
return readCommitIF->readWithoutLock();
}
static ReturnValue_t commitWithoutLock(ReadCommitIF* readCommitIF) {
if (readCommitIF == nullptr) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
return readCommitIF->commitWithoutLock();
}
diff --git a/src/fsfw/datapoollocal/HasLocalDataPoolIF.h b/src/fsfw/datapoollocal/HasLocalDataPoolIF.h
index a2925a46..8530fd77 100644
--- a/src/fsfw/datapoollocal/HasLocalDataPoolIF.h
+++ b/src/fsfw/datapoollocal/HasLocalDataPoolIF.h
@@ -79,8 +79,7 @@ class HasLocalDataPoolIF {
* @param clearMessage If this is set to true, the pool manager will take care of
* clearing the store automatically
*/
- virtual void handleChangedDataset(sid_t sid,
- store_address_t storeId = storeId::INVALID_STORE_ADDRESS,
+ virtual void handleChangedDataset(sid_t sid, store_address_t storeId = store_address_t::invalid(),
bool* clearMessage = nullptr) {
if (clearMessage != nullptr) {
*clearMessage = true;
@@ -100,7 +99,7 @@ class HasLocalDataPoolIF {
* after the callback.
*/
virtual void handleChangedPoolVariable(gp_id_t gpid,
- store_address_t storeId = storeId::INVALID_STORE_ADDRESS,
+ store_address_t storeId = store_address_t::invalid(),
bool* clearMessage = nullptr) {
if (clearMessage != nullptr) {
*clearMessage = true;
@@ -111,10 +110,10 @@ class HasLocalDataPoolIF {
* These function can be implemented by pool owner, if they are required
* and used by the housekeeping message interface.
* */
- virtual ReturnValue_t addDataSet(sid_t sid) { return HasReturnvaluesIF::RETURN_FAILED; };
- virtual ReturnValue_t removeDataSet(sid_t sid) { return HasReturnvaluesIF::RETURN_FAILED; };
+ virtual ReturnValue_t addDataSet(sid_t sid) { return returnvalue::FAILED; };
+ virtual ReturnValue_t removeDataSet(sid_t sid) { return returnvalue::FAILED; };
virtual ReturnValue_t changeCollectionInterval(sid_t sid, float newIntervalSeconds) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
};
/**
diff --git a/src/fsfw/datapoollocal/LocalDataPoolManager.cpp b/src/fsfw/datapoollocal/LocalDataPoolManager.cpp
index 215d1753..fa76d2a7 100644
--- a/src/fsfw/datapoollocal/LocalDataPoolManager.cpp
+++ b/src/fsfw/datapoollocal/LocalDataPoolManager.cpp
@@ -1,6 +1,5 @@
#include "fsfw/datapoollocal/LocalDataPoolManager.h"
-#include
#include
#include "fsfw/datapoollocal.h"
@@ -15,21 +14,22 @@
#include "internal/HasLocalDpIFManagerAttorney.h"
#include "internal/LocalPoolDataSetAttorney.h"
+// TODO: Get rid of this. This should be a constructor argument, not something hardcoded in any way
object_id_t LocalDataPoolManager::defaultHkDestination = objects::PUS_SERVICE_3_HOUSEKEEPING;
LocalDataPoolManager::LocalDataPoolManager(HasLocalDataPoolIF* owner, MessageQueueIF* queueToUse,
bool appendValidityBuffer)
: appendValidityBuffer(appendValidityBuffer) {
if (owner == nullptr) {
- printWarningOrError(sif::OutputTypes::OUT_WARNING, "LocalDataPoolManager",
- HasReturnvaluesIF::RETURN_FAILED, "Invalid supplied owner");
+ printWarningOrError(sif::OutputTypes::OUT_WARNING, "LocalDataPoolManager", returnvalue::FAILED,
+ "Invalid supplied owner");
return;
}
this->owner = owner;
mutex = MutexFactory::instance()->createMutex();
if (mutex == nullptr) {
- printWarningOrError(sif::OutputTypes::OUT_ERROR, "LocalDataPoolManager",
- HasReturnvaluesIF::RETURN_FAILED, "Could not create mutex");
+ printWarningOrError(sif::OutputTypes::OUT_ERROR, "LocalDataPoolManager", returnvalue::FAILED,
+ "Could not create mutex");
}
hkQueue = queueToUse;
@@ -51,13 +51,13 @@ ReturnValue_t LocalDataPoolManager::initialize(MessageQueueIF* queueToUse) {
ipcStore = ObjectManager::instance()->get(objects::IPC_STORE);
if (ipcStore == nullptr) {
/* Error, all destinations invalid */
- printWarningOrError(sif::OutputTypes::OUT_ERROR, "initialize", HasReturnvaluesIF::RETURN_FAILED,
+ printWarningOrError(sif::OutputTypes::OUT_ERROR, "initialize", returnvalue::FAILED,
"Could not set IPC store.");
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
if (defaultHkDestination != objects::NO_OBJECT) {
- AcceptsHkPacketsIF* hkPacketReceiver =
+ auto* hkPacketReceiver =
ObjectManager::instance()->get(defaultHkDestination);
if (hkPacketReceiver != nullptr) {
hkDestinationId = hkPacketReceiver->getHkQueue();
@@ -67,7 +67,7 @@ ReturnValue_t LocalDataPoolManager::initialize(MessageQueueIF* queueToUse) {
}
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t LocalDataPoolManager::initializeAfterTaskCreation(uint8_t nonDiagInvlFactor) {
@@ -78,19 +78,19 @@ ReturnValue_t LocalDataPoolManager::initializeAfterTaskCreation(uint8_t nonDiagI
ReturnValue_t LocalDataPoolManager::initializeHousekeepingPoolEntriesOnce() {
if (not mapInitialized) {
ReturnValue_t result = owner->initializeLocalDataPool(localPoolMap, *this);
- if (result == HasReturnvaluesIF::RETURN_OK) {
+ if (result == returnvalue::OK) {
mapInitialized = true;
}
return result;
}
printWarningOrError(sif::OutputTypes::OUT_WARNING, "initializeHousekeepingPoolEntriesOnce",
- HasReturnvaluesIF::RETURN_FAILED, "The map should only be initialized once");
- return HasReturnvaluesIF::RETURN_OK;
+ returnvalue::FAILED, "The map should only be initialized once");
+ return returnvalue::OK;
}
ReturnValue_t LocalDataPoolManager::performHkOperation() {
- ReturnValue_t status = HasReturnvaluesIF::RETURN_OK;
+ ReturnValue_t status = returnvalue::OK;
for (auto& receiver : hkReceivers) {
switch (receiver.reportingType) {
case (ReportingType::PERIODIC): {
@@ -115,7 +115,7 @@ ReturnValue_t LocalDataPoolManager::performHkOperation() {
}
default:
// This should never happen.
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
}
resetHkUpdateResetHelper();
@@ -125,7 +125,7 @@ ReturnValue_t LocalDataPoolManager::performHkOperation() {
ReturnValue_t LocalDataPoolManager::handleHkUpdate(HkReceiver& receiver, ReturnValue_t& status) {
if (receiver.dataType == DataType::LOCAL_POOL_VARIABLE) {
/* Update packets shall only be generated from datasets. */
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
LocalPoolDataSetBase* dataSet =
HasLocalDpIFManagerAttorney::getDataSetHandle(owner, receiver.dataId.sid);
@@ -135,12 +135,12 @@ ReturnValue_t LocalDataPoolManager::handleHkUpdate(HkReceiver& receiver, ReturnV
if (dataSet->hasChanged()) {
/* Prepare and send update notification */
ReturnValue_t result = generateHousekeepingPacket(receiver.dataId.sid, dataSet, true);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
status = result;
}
}
handleChangeResetLogic(receiver.dataType, receiver.dataId, dataSet);
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t LocalDataPoolManager::handleNotificationUpdate(HkReceiver& receiver,
@@ -160,7 +160,7 @@ ReturnValue_t LocalDataPoolManager::handleNotificationUpdate(HkReceiver& receive
HousekeepingMessage::setUpdateNotificationVariableCommand(
¬ification, gp_id_t(owner->getObjectId(), receiver.dataId.localPoolId));
ReturnValue_t result = hkQueue->sendMessage(receiver.destinationQueue, ¬ification);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
status = result;
}
toReset = poolObj;
@@ -179,7 +179,7 @@ ReturnValue_t LocalDataPoolManager::handleNotificationUpdate(HkReceiver& receive
CommandMessage notification;
HousekeepingMessage::setUpdateNotificationSetCommand(¬ification, receiver.dataId.sid);
ReturnValue_t result = hkQueue->sendMessage(receiver.destinationQueue, ¬ification);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
status = result;
}
toReset = dataSet;
@@ -188,7 +188,7 @@ ReturnValue_t LocalDataPoolManager::handleNotificationUpdate(HkReceiver& receive
if (toReset != nullptr) {
handleChangeResetLogic(receiver.dataType, receiver.dataId, toReset);
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t LocalDataPoolManager::handleNotificationSnapshot(HkReceiver& receiver,
@@ -205,13 +205,13 @@ ReturnValue_t LocalDataPoolManager::handleNotificationSnapshot(HkReceiver& recei
}
if (not poolObj->hasChanged()) {
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
/* Prepare and send update snapshot */
- timeval now;
+ timeval now{};
Clock::getClock_timeval(&now);
- CCSDSTime::CDS_short cds;
+ CCSDSTime::CDS_short cds{};
CCSDSTime::convertToCcsds(&cds, &now);
HousekeepingSnapshot updatePacket(
reinterpret_cast(&cds), sizeof(cds),
@@ -219,7 +219,7 @@ ReturnValue_t LocalDataPoolManager::handleNotificationSnapshot(HkReceiver& recei
store_address_t storeId;
ReturnValue_t result = addUpdateToStore(updatePacket, storeId);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
@@ -227,7 +227,7 @@ ReturnValue_t LocalDataPoolManager::handleNotificationSnapshot(HkReceiver& recei
HousekeepingMessage::setUpdateSnapshotVariableCommand(
¬ification, gp_id_t(owner->getObjectId(), receiver.dataId.localPoolId), storeId);
result = hkQueue->sendMessage(receiver.destinationQueue, ¬ification);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
status = result;
}
toReset = poolObj;
@@ -241,13 +241,13 @@ ReturnValue_t LocalDataPoolManager::handleNotificationSnapshot(HkReceiver& recei
}
if (not dataSet->hasChanged()) {
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
/* Prepare and send update snapshot */
- timeval now;
+ timeval now{};
Clock::getClock_timeval(&now);
- CCSDSTime::CDS_short cds;
+ CCSDSTime::CDS_short cds{};
CCSDSTime::convertToCcsds(&cds, &now);
HousekeepingSnapshot updatePacket(
reinterpret_cast(&cds), sizeof(cds),
@@ -255,14 +255,14 @@ ReturnValue_t LocalDataPoolManager::handleNotificationSnapshot(HkReceiver& recei
store_address_t storeId;
ReturnValue_t result = addUpdateToStore(updatePacket, storeId);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
CommandMessage notification;
HousekeepingMessage::setUpdateSnapshotSetCommand(¬ification, receiver.dataId.sid, storeId);
result = hkQueue->sendMessage(receiver.destinationQueue, ¬ification);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
status = result;
}
toReset = dataSet;
@@ -270,7 +270,7 @@ ReturnValue_t LocalDataPoolManager::handleNotificationSnapshot(HkReceiver& recei
if (toReset != nullptr) {
handleChangeResetLogic(receiver.dataType, receiver.dataId, toReset);
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t LocalDataPoolManager::addUpdateToStore(HousekeepingSnapshot& updatePacket,
@@ -279,7 +279,7 @@ ReturnValue_t LocalDataPoolManager::addUpdateToStore(HousekeepingSnapshot& updat
uint8_t* storePtr = nullptr;
ReturnValue_t result =
ipcStore->getFreeElement(&storeId, updatePacket.getSerializedSize(), &storePtr);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
size_t serializedSize = 0;
@@ -291,12 +291,7 @@ ReturnValue_t LocalDataPoolManager::addUpdateToStore(HousekeepingSnapshot& updat
void LocalDataPoolManager::handleChangeResetLogic(DataType type, DataId dataId,
MarkChangedIF* toReset) {
- if (hkUpdateResetList == nullptr) {
- /* Config error */
- return;
- }
- HkUpdateResetList& listRef = *hkUpdateResetList;
- for (auto& changeInfo : listRef) {
+ for (auto& changeInfo : hkUpdateResetList) {
if (changeInfo.dataType != type) {
continue;
}
@@ -326,72 +321,74 @@ void LocalDataPoolManager::handleChangeResetLogic(DataType type, DataId dataId,
}
void LocalDataPoolManager::resetHkUpdateResetHelper() {
- if (hkUpdateResetList == nullptr) {
- return;
- }
-
- for (auto& changeInfo : *hkUpdateResetList) {
+ for (auto& changeInfo : hkUpdateResetList) {
changeInfo.currentUpdateCounter = changeInfo.updateCounter;
}
}
-ReturnValue_t LocalDataPoolManager::subscribeForPeriodicPacket(sid_t sid, bool enableReporting,
- float collectionInterval,
- bool isDiagnostics,
- object_id_t packetDestination) {
- AcceptsHkPacketsIF* hkReceiverObject =
- ObjectManager::instance()->get(packetDestination);
- if (hkReceiverObject == nullptr) {
- printWarningOrError(sif::OutputTypes::OUT_WARNING, "subscribeForPeriodicPacket",
- QUEUE_OR_DESTINATION_INVALID);
- return QUEUE_OR_DESTINATION_INVALID;
- }
+ReturnValue_t LocalDataPoolManager::subscribeForRegularPeriodicPacket(
+ subdp::RegularHkPeriodicParams params) {
+ return subscribeForPeriodicPacket(params);
+}
+ReturnValue_t LocalDataPoolManager::subscribeForDiagPeriodicPacket(
+ subdp::DiagnosticsHkPeriodicParams params) {
+ return subscribeForPeriodicPacket(params);
+}
+
+ReturnValue_t LocalDataPoolManager::subscribeForPeriodicPacket(subdp::ParamsBase& params) {
struct HkReceiver hkReceiver;
- hkReceiver.dataId.sid = sid;
+ hkReceiver.dataId.sid = params.sid;
hkReceiver.reportingType = ReportingType::PERIODIC;
hkReceiver.dataType = DataType::DATA_SET;
- hkReceiver.destinationQueue = hkReceiverObject->getHkQueue();
+ if (params.receiver == MessageQueueIF::NO_QUEUE) {
+ hkReceiver.destinationQueue = hkDestinationId;
+ } else {
+ hkReceiver.destinationQueue = params.receiver;
+ }
- LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, sid);
+ LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, params.sid);
if (dataSet != nullptr) {
- LocalPoolDataSetAttorney::setReportingEnabled(*dataSet, enableReporting);
- LocalPoolDataSetAttorney::setDiagnostic(*dataSet, isDiagnostics);
- LocalPoolDataSetAttorney::initializePeriodicHelper(*dataSet, collectionInterval,
+ LocalPoolDataSetAttorney::setReportingEnabled(*dataSet, params.enableReporting);
+ LocalPoolDataSetAttorney::setDiagnostic(*dataSet, params.isDiagnostics());
+ LocalPoolDataSetAttorney::initializePeriodicHelper(*dataSet, params.collectionInterval,
owner->getPeriodicOperationFrequency());
}
hkReceivers.push_back(hkReceiver);
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
-ReturnValue_t LocalDataPoolManager::subscribeForUpdatePacket(sid_t sid, bool isDiagnostics,
- bool reportingEnabled,
- object_id_t packetDestination) {
- AcceptsHkPacketsIF* hkReceiverObject =
- ObjectManager::instance()->get(packetDestination);
- if (hkReceiverObject == nullptr) {
- printWarningOrError(sif::OutputTypes::OUT_WARNING, "subscribeForPeriodicPacket",
- QUEUE_OR_DESTINATION_INVALID);
- return QUEUE_OR_DESTINATION_INVALID;
- }
+ReturnValue_t LocalDataPoolManager::subscribeForRegularUpdatePacket(
+ subdp::RegularHkUpdateParams params) {
+ return subscribeForUpdatePacket(params);
+}
+ReturnValue_t LocalDataPoolManager::subscribeForDiagUpdatePacket(
+ subdp::DiagnosticsHkUpdateParams params) {
+ return subscribeForUpdatePacket(params);
+}
+ReturnValue_t LocalDataPoolManager::subscribeForUpdatePacket(subdp::ParamsBase& params) {
struct HkReceiver hkReceiver;
- hkReceiver.dataId.sid = sid;
+ hkReceiver.dataId.sid = params.sid;
hkReceiver.reportingType = ReportingType::UPDATE_HK;
hkReceiver.dataType = DataType::DATA_SET;
- hkReceiver.destinationQueue = hkReceiverObject->getHkQueue();
+ if (params.receiver == MessageQueueIF::NO_QUEUE) {
+ hkReceiver.destinationQueue = hkDestinationId;
+ } else {
+ hkReceiver.destinationQueue = params.receiver;
+ }
- LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, sid);
+ LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, params.sid);
if (dataSet != nullptr) {
LocalPoolDataSetAttorney::setReportingEnabled(*dataSet, true);
- LocalPoolDataSetAttorney::setDiagnostic(*dataSet, isDiagnostics);
+ LocalPoolDataSetAttorney::setDiagnostic(*dataSet, params.isDiagnostics());
}
hkReceivers.push_back(hkReceiver);
handleHkUpdateResetListInsertion(hkReceiver.dataType, hkReceiver.dataId);
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t LocalDataPoolManager::subscribeForSetUpdateMessage(const uint32_t setId,
@@ -412,7 +409,7 @@ ReturnValue_t LocalDataPoolManager::subscribeForSetUpdateMessage(const uint32_t
hkReceivers.push_back(hkReceiver);
handleHkUpdateResetListInsertion(hkReceiver.dataType, hkReceiver.dataId);
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t LocalDataPoolManager::subscribeForVariableUpdateMessage(
@@ -432,15 +429,11 @@ ReturnValue_t LocalDataPoolManager::subscribeForVariableUpdateMessage(
hkReceivers.push_back(hkReceiver);
handleHkUpdateResetListInsertion(hkReceiver.dataType, hkReceiver.dataId);
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
void LocalDataPoolManager::handleHkUpdateResetListInsertion(DataType dataType, DataId dataId) {
- if (hkUpdateResetList == nullptr) {
- hkUpdateResetList = new std::vector();
- }
-
- for (auto& updateResetStruct : *hkUpdateResetList) {
+ for (auto& updateResetStruct : hkUpdateResetList) {
if (dataType == DataType::DATA_SET) {
if (updateResetStruct.dataId.sid == dataId.sid) {
updateResetStruct.updateCounter++;
@@ -464,13 +457,13 @@ void LocalDataPoolManager::handleHkUpdateResetListInsertion(DataType dataType, D
} else {
hkUpdateResetHelper.dataId.localPoolId = dataId.localPoolId;
}
- hkUpdateResetList->push_back(hkUpdateResetHelper);
+ hkUpdateResetList.push_back(hkUpdateResetHelper);
}
ReturnValue_t LocalDataPoolManager::handleHousekeepingMessage(CommandMessage* message) {
Command_t command = message->getCommand();
sid_t sid = HousekeepingMessage::getSid(message);
- ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
+ ReturnValue_t result = returnvalue::OK;
switch (command) {
// Houskeeping interface handling.
case (HousekeepingMessage::ENABLE_PERIODIC_DIAGNOSTICS_GENERATION): {
@@ -495,7 +488,7 @@ ReturnValue_t LocalDataPoolManager::handleHousekeepingMessage(CommandMessage* me
case (HousekeepingMessage::REPORT_DIAGNOSTICS_REPORT_STRUCTURES): {
result = generateSetStructurePacket(sid, true);
- if (result == HasReturnvaluesIF::RETURN_OK) {
+ if (result == returnvalue::OK) {
return result;
}
break;
@@ -503,7 +496,7 @@ ReturnValue_t LocalDataPoolManager::handleHousekeepingMessage(CommandMessage* me
case (HousekeepingMessage::REPORT_HK_REPORT_STRUCTURES): {
result = generateSetStructurePacket(sid, false);
- if (result == HasReturnvaluesIF::RETURN_OK) {
+ if (result == returnvalue::OK) {
return result;
}
break;
@@ -543,12 +536,12 @@ ReturnValue_t LocalDataPoolManager::handleHousekeepingMessage(CommandMessage* me
/* Notification handling */
case (HousekeepingMessage::UPDATE_NOTIFICATION_SET): {
owner->handleChangedDataset(sid);
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
case (HousekeepingMessage::UPDATE_NOTIFICATION_VARIABLE): {
gp_id_t globPoolId = HousekeepingMessage::getUpdateNotificationVariableCommand(message);
owner->handleChangedPoolVariable(globPoolId);
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
case (HousekeepingMessage::UPDATE_SNAPSHOT_SET): {
store_address_t storeId;
@@ -558,7 +551,7 @@ ReturnValue_t LocalDataPoolManager::handleHousekeepingMessage(CommandMessage* me
if (clearMessage) {
message->clear();
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
case (HousekeepingMessage::UPDATE_SNAPSHOT_VARIABLE): {
store_address_t storeId;
@@ -568,7 +561,7 @@ ReturnValue_t LocalDataPoolManager::handleHousekeepingMessage(CommandMessage* me
if (clearMessage) {
message->clear();
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
default:
@@ -576,7 +569,7 @@ ReturnValue_t LocalDataPoolManager::handleHousekeepingMessage(CommandMessage* me
}
CommandMessage reply;
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
HousekeepingMessage::setHkRequestFailureReply(&reply, sid, result);
} else {
HousekeepingMessage::setHkRequestSuccessReply(&reply, sid);
@@ -593,7 +586,7 @@ ReturnValue_t LocalDataPoolManager::printPoolEntry(lp_id_t localPoolId) {
return localpool::POOL_ENTRY_NOT_FOUND;
}
poolIter->second->print();
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
MutexIF* LocalDataPoolManager::getMutexHandle() { return mutex; }
@@ -616,7 +609,7 @@ ReturnValue_t LocalDataPoolManager::generateHousekeepingPacket(sid_t sid,
size_t serializedSize = 0;
ReturnValue_t result =
serializeHkPacketIntoStore(hkPacket, storeId, forDownlink, &serializedSize);
- if (result != HasReturnvaluesIF::RETURN_OK or serializedSize == 0) {
+ if (result != returnvalue::OK or serializedSize == 0) {
return result;
}
@@ -639,6 +632,7 @@ ReturnValue_t LocalDataPoolManager::generateHousekeepingPacket(sid_t sid,
/* Error, all destinations invalid */
printWarningOrError(sif::OutputTypes::OUT_WARNING, "generateHousekeepingPacket",
QUEUE_OR_DESTINATION_INVALID);
+ return QUEUE_OR_DESTINATION_INVALID;
}
destination = hkDestinationId;
}
@@ -653,7 +647,7 @@ ReturnValue_t LocalDataPoolManager::serializeHkPacketIntoStore(HousekeepingPacke
uint8_t* dataPtr = nullptr;
const size_t maxSize = hkPacket.getSerializedSize();
ReturnValue_t result = ipcStore->getFreeElement(&storeId, maxSize, &dataPtr);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
@@ -693,10 +687,11 @@ void LocalDataPoolManager::performPeriodicHkGeneration(HkReceiver& receiver) {
}
ReturnValue_t result = generateHousekeepingPacket(sid, dataSet, true);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
/* Configuration error */
#if FSFW_CPP_OSTREAM_ENABLED == 1
- sif::warning << "LocalDataPoolManager::performPeriodicHkOperation: HK generation failed." << std::endl;
+ sif::warning << "LocalDataPoolManager::performPeriodicHkOperation: HK generation failed."
+ << std::endl;
#else
sif::printWarning("LocalDataPoolManager::performPeriodicHkOperation: HK generation failed.\n");
#endif
@@ -723,7 +718,7 @@ ReturnValue_t LocalDataPoolManager::togglePeriodicGeneration(sid_t sid, bool ena
}
LocalPoolDataSetAttorney::setReportingEnabled(*dataSet, enable);
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t LocalDataPoolManager::changeCollectionInterval(sid_t sid, float newCollectionInterval,
@@ -749,7 +744,7 @@ ReturnValue_t LocalDataPoolManager::changeCollectionInterval(sid_t sid, float ne
}
periodicHelper->changeCollectionInterval(newCollectionInterval);
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t LocalDataPoolManager::generateSetStructurePacket(sid_t sid, bool isDiagnostics) {
@@ -777,24 +772,22 @@ ReturnValue_t LocalDataPoolManager::generateSetStructurePacket(sid_t sid, bool i
uint8_t* storePtr = nullptr;
store_address_t storeId;
ReturnValue_t result = ipcStore->getFreeElement(&storeId, expectedSize, &storePtr);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
printWarningOrError(sif::OutputTypes::OUT_ERROR, "generateSetStructurePacket",
- HasReturnvaluesIF::RETURN_FAILED,
- "Could not get free element from IPC store.");
+ returnvalue::FAILED, "Could not get free element from IPC store.");
return result;
}
// Serialize set packet into store.
size_t size = 0;
result = setPacket.serialize(&storePtr, &size, expectedSize, SerializeIF::Endianness::BIG);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
ipcStore->deleteData(storeId);
return result;
}
if (expectedSize != size) {
printWarningOrError(sif::OutputTypes::OUT_WARNING, "generateSetStructurePacket",
- HasReturnvaluesIF::RETURN_FAILED,
- "Expected size is not equal to serialized size");
+ returnvalue::FAILED, "Expected size is not equal to serialized size");
}
// Send structure reporting reply.
@@ -806,7 +799,7 @@ ReturnValue_t LocalDataPoolManager::generateSetStructurePacket(sid_t sid, bool i
}
result = hkQueue->reply(&reply);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
ipcStore->deleteData(storeId);
}
return result;
@@ -816,9 +809,7 @@ void LocalDataPoolManager::clearReceiversList() {
/* Clear the vector completely and releases allocated memory. */
HkReceivers().swap(hkReceivers);
/* Also clear the reset helper if it exists */
- if (hkUpdateResetList != nullptr) {
- HkUpdateResetList().swap(*hkUpdateResetList);
- }
+ HkUpdateResetList().swap(hkUpdateResetList);
}
MutexIF* LocalDataPoolManager::getLocalPoolMutex() { return this->mutex; }
@@ -834,7 +825,7 @@ void LocalDataPoolManager::printWarningOrError(sif::OutputTypes outputType,
errorPrint = "Dataset not found";
} else if (error == POOLOBJECT_NOT_FOUND) {
errorPrint = "Pool Object not found";
- } else if (error == HasReturnvaluesIF::RETURN_FAILED) {
+ } else if (error == returnvalue::FAILED) {
if (outputType == sif::OutputTypes::OUT_WARNING) {
errorPrint = "Generic Warning";
} else {
@@ -878,3 +869,7 @@ void LocalDataPoolManager::printWarningOrError(sif::OutputTypes outputType,
}
LocalDataPoolManager* LocalDataPoolManager::getPoolManagerHandle() { return this; }
+
+void LocalDataPoolManager::setHkDestinationId(MessageQueueId_t hkDestId) {
+ hkDestinationId = hkDestId;
+}
diff --git a/src/fsfw/datapoollocal/LocalDataPoolManager.h b/src/fsfw/datapoollocal/LocalDataPoolManager.h
index e7ec0b6f..8f369ea0 100644
--- a/src/fsfw/datapoollocal/LocalDataPoolManager.h
+++ b/src/fsfw/datapoollocal/LocalDataPoolManager.h
@@ -8,6 +8,7 @@
#include "ProvidesDataPoolSubscriptionIF.h"
#include "fsfw/datapool/DataSetIF.h"
#include "fsfw/datapool/PoolEntry.h"
+#include "fsfw/housekeeping/AcceptsHkPacketsIF.h"
#include "fsfw/housekeeping/HousekeepingMessage.h"
#include "fsfw/housekeeping/HousekeepingPacketDownlink.h"
#include "fsfw/housekeeping/PeriodicHousekeepingHelper.h"
@@ -80,7 +81,9 @@ class LocalDataPoolManager : public ProvidesDataPoolSubscriptionIF, public Acces
*/
LocalDataPoolManager(HasLocalDataPoolIF* owner, MessageQueueIF* queueToUse,
bool appendValidityBuffer = true);
- virtual ~LocalDataPoolManager();
+ ~LocalDataPoolManager() override;
+
+ void setHkDestinationId(MessageQueueId_t hkDestId);
/**
* Assigns the queue to use. Make sure to call this in the #initialize
@@ -112,31 +115,6 @@ class LocalDataPoolManager : public ProvidesDataPoolSubscriptionIF, public Acces
*/
virtual ReturnValue_t performHkOperation();
- /**
- * @brief Subscribe for the generation of periodic packets.
- * @details
- * This subscription mechanism will generally be used by the data creator
- * to generate housekeeping packets which are downlinked directly.
- * @return
- */
- ReturnValue_t subscribeForPeriodicPacket(
- sid_t sid, bool enableReporting, float collectionInterval, bool isDiagnostics,
- object_id_t packetDestination = defaultHkDestination) override;
-
- /**
- * @brief Subscribe for the generation of packets if the dataset
- * is marked as changed.
- * @details
- * This subscription mechanism will generally be used by the data creator.
- * @param sid
- * @param isDiagnostics
- * @param packetDestination
- * @return
- */
- ReturnValue_t subscribeForUpdatePacket(
- sid_t sid, bool reportingEnabled, bool isDiagnostics,
- object_id_t packetDestination = defaultHkDestination) override;
-
/**
* @brief Subscribe for a notification message which will be sent
* if a dataset has changed.
@@ -151,7 +129,7 @@ class LocalDataPoolManager : public ProvidesDataPoolSubscriptionIF, public Acces
* Otherwise, only an notification message is sent.
* @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,
bool generateSnapshot) override;
@@ -169,7 +147,7 @@ class LocalDataPoolManager : public ProvidesDataPoolSubscriptionIF, public Acces
* Otherwise, only an notification message is sent.
* @return
*/
- ReturnValue_t subscribeForVariableUpdateMessage(const lp_id_t localPoolId,
+ ReturnValue_t subscribeForVariableUpdateMessage(lp_id_t localPoolId,
object_id_t destinationObject,
MessageQueueId_t targetQueueId,
bool generateSnapshot) override;
@@ -252,7 +230,7 @@ class LocalDataPoolManager : public ProvidesDataPoolSubscriptionIF, public Acces
*/
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
@@ -262,9 +240,17 @@ class LocalDataPoolManager : public ProvidesDataPoolSubscriptionIF, public Acces
*/
MutexIF* getMutexHandle();
- virtual LocalDataPoolManager* getPoolManagerHandle() override;
+ LocalDataPoolManager* getPoolManagerHandle() override;
+ ReturnValue_t subscribeForRegularPeriodicPacket(subdp::RegularHkPeriodicParams params) override;
+ ReturnValue_t subscribeForDiagPeriodicPacket(subdp::DiagnosticsHkPeriodicParams params) override;
+
+ ReturnValue_t subscribeForRegularUpdatePacket(subdp::RegularHkUpdateParams params) override;
+ ReturnValue_t subscribeForDiagUpdatePacket(subdp::DiagnosticsHkUpdateParams params) override;
protected:
+ ReturnValue_t subscribeForPeriodicPacket(subdp::ParamsBase& params);
+ ReturnValue_t subscribeForUpdatePacket(subdp::ParamsBase& params);
+
/** Core data structure for the actual pool data */
localpool::DataPool localPoolMap;
/** Every housekeeping data manager has a mutex to protect access
@@ -312,8 +298,8 @@ class LocalDataPoolManager : public ProvidesDataPoolSubscriptionIF, public Acces
using HkUpdateResetList = std::vector;
/** This list is used to manage creating multiple update packets and only resetting
- the update flag if all of them were created. Will only be created when needed. */
- HkUpdateResetList* hkUpdateResetList = nullptr;
+ the update flag if all of them were created. */
+ HkUpdateResetList hkUpdateResetList = HkUpdateResetList();
/** This is the map holding the actual data. Should only be initialized
* once ! */
@@ -376,7 +362,7 @@ class LocalDataPoolManager : public ProvidesDataPoolSubscriptionIF, public Acces
ReturnValue_t addUpdateToStore(HousekeepingSnapshot& updatePacket, store_address_t& storeId);
void printWarningOrError(sif::OutputTypes outputType, const char* functionName,
- ReturnValue_t errorCode = HasReturnvaluesIF::RETURN_FAILED,
+ ReturnValue_t errorCode = returnvalue::FAILED,
const char* errorPrint = nullptr);
};
@@ -384,7 +370,7 @@ template
inline ReturnValue_t LocalDataPoolManager::fetchPoolEntry(lp_id_t localPoolId,
PoolEntry** poolEntry) {
if (poolEntry == nullptr) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
auto poolIter = localPoolMap.find(localPoolId);
@@ -400,7 +386,7 @@ inline ReturnValue_t LocalDataPoolManager::fetchPoolEntry(lp_id_t localPoolId,
localpool::POOL_ENTRY_TYPE_CONFLICT);
return localpool::POOL_ENTRY_TYPE_CONFLICT;
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
#endif /* FSFW_DATAPOOLLOCAL_LOCALDATAPOOLMANAGER_H_ */
diff --git a/src/fsfw/datapoollocal/LocalPoolDataSetBase.cpp b/src/fsfw/datapoollocal/LocalPoolDataSetBase.cpp
index 62fdb184..38aad828 100644
--- a/src/fsfw/datapoollocal/LocalPoolDataSetBase.cpp
+++ b/src/fsfw/datapoollocal/LocalPoolDataSetBase.cpp
@@ -85,13 +85,13 @@ ReturnValue_t LocalPoolDataSetBase::lockDataPool(MutexIF::TimeoutType timeoutTyp
if (mutexIfSingleDataCreator != nullptr) {
return mutexIfSingleDataCreator->lockMutex(timeoutType, timeoutMs);
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t LocalPoolDataSetBase::serializeWithValidityBuffer(
uint8_t **buffer, size_t *size, size_t maxSize,
SerializeIF::Endianness streamEndianness) const {
- ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
+ ReturnValue_t result = returnvalue::OK;
const uint8_t validityMaskSize = std::ceil(static_cast(fillCount) / 8.0);
uint8_t *validityPtr = nullptr;
#if defined(_MSC_VER) || defined(__clang__)
@@ -119,7 +119,7 @@ ReturnValue_t LocalPoolDataSetBase::serializeWithValidityBuffer(
}
result = registeredVariables[count]->serialize(buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
}
@@ -135,10 +135,10 @@ ReturnValue_t LocalPoolDataSetBase::serializeWithValidityBuffer(
ReturnValue_t LocalPoolDataSetBase::deSerializeWithValidityBuffer(
const uint8_t **buffer, size_t *size, SerializeIF::Endianness streamEndianness) {
- ReturnValue_t result = HasReturnvaluesIF::RETURN_FAILED;
+ ReturnValue_t result = returnvalue::FAILED;
for (uint16_t count = 0; count < fillCount; count++) {
result = registeredVariables[count]->deSerialize(buffer, size, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
}
@@ -169,7 +169,7 @@ ReturnValue_t LocalPoolDataSetBase::unlockDataPool() {
if (mutexIfSingleDataCreator != nullptr) {
return mutexIfSingleDataCreator->unlockMutex();
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t LocalPoolDataSetBase::serializeLocalPoolIds(uint8_t **buffer, size_t *size,
@@ -185,7 +185,7 @@ ReturnValue_t LocalPoolDataSetBase::serializeLocalPoolIds(uint8_t **buffer, size
lp_id_t currentPoolId = registeredVariables[count]->getDataPoolId();
auto result =
SerializeAdapter::serialize(¤tPoolId, buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "LocalPoolDataSetBase::serializeLocalPoolIds: "
<< "Serialization error!" << std::endl;
@@ -197,7 +197,7 @@ ReturnValue_t LocalPoolDataSetBase::serializeLocalPoolIds(uint8_t **buffer, size
return result;
}
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
uint8_t LocalPoolDataSetBase::getLocalPoolIdsSerializedSize(bool serializeFillCount) const {
diff --git a/src/fsfw/datapoollocal/LocalPoolObjectBase.cpp b/src/fsfw/datapoollocal/LocalPoolObjectBase.cpp
index 82aefc18..5575c3d8 100644
--- a/src/fsfw/datapoollocal/LocalPoolObjectBase.cpp
+++ b/src/fsfw/datapoollocal/LocalPoolObjectBase.cpp
@@ -48,12 +48,12 @@ LocalPoolObjectBase::LocalPoolObjectBase(object_id_t poolOwner, lp_id_t poolId,
if (hkOwner == nullptr) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "LocalPoolVariable: The supplied pool owner 0x" << std::hex << poolOwner
- << std::dec << " did not implement the correct interface "
+ << std::dec << " does not exist or does not implement the correct interface "
<< "HasLocalDataPoolIF" << std::endl;
#else
sif::printError(
- "LocalPoolVariable: The supplied pool owner 0x%08x did not implement the correct "
- "interface HasLocalDataPoolIF\n",
+ "LocalPoolVariable: The supplied pool owner 0x%08x does not exist or does not implement "
+ "the correct interface HasLocalDataPoolIF\n",
poolOwner);
#endif
return;
diff --git a/src/fsfw/datapoollocal/LocalPoolObjectBase.h b/src/fsfw/datapoollocal/LocalPoolObjectBase.h
index b2ffa4c1..a4ecbd55 100644
--- a/src/fsfw/datapoollocal/LocalPoolObjectBase.h
+++ b/src/fsfw/datapoollocal/LocalPoolObjectBase.h
@@ -4,7 +4,7 @@
#include "MarkChangedIF.h"
#include "fsfw/datapool/PoolVariableIF.h"
#include "fsfw/objectmanager/SystemObjectIF.h"
-#include "fsfw/returnvalues/HasReturnvaluesIF.h"
+#include "fsfw/returnvalues/returnvalue.h"
#include "localPoolDefinitions.h"
class LocalDataPoolManager;
@@ -15,7 +15,7 @@ class HasLocalDataPoolIF;
* @brief This class serves as a non-template base for pool objects like pool variables
* or pool vectors.
*/
-class LocalPoolObjectBase : public PoolVariableIF, public HasReturnvaluesIF, public MarkChangedIF {
+class LocalPoolObjectBase : public PoolVariableIF, public MarkChangedIF {
public:
LocalPoolObjectBase(lp_id_t poolId, HasLocalDataPoolIF* hkOwner, DataSetIF* dataSet,
pool_rwm_t setReadWriteMode);
diff --git a/src/fsfw/datapoollocal/LocalPoolVariable.tpp b/src/fsfw/datapoollocal/LocalPoolVariable.tpp
index f800dfd3..969a047b 100644
--- a/src/fsfw/datapoollocal/LocalPoolVariable.tpp
+++ b/src/fsfw/datapoollocal/LocalPoolVariable.tpp
@@ -29,7 +29,7 @@ inline ReturnValue_t LocalPoolVariable::read(MutexIF::TimeoutType timeoutType
}
MutexIF* mutex = LocalDpManagerAttorney::getMutexHandle(*hkManager);
ReturnValue_t result = mutex->lockMutex(timeoutType, timeoutMs);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result = readWithoutLock();
@@ -49,7 +49,7 @@ inline ReturnValue_t LocalPoolVariable::readWithoutLock() {
PoolEntry* poolEntry = nullptr;
ReturnValue_t result =
LocalDpManagerAttorney::fetchPoolEntry(*hkManager, localPoolId, &poolEntry);
- if (result != RETURN_OK) {
+ if (result != returnvalue::OK) {
object_id_t ownerObjectId = hkManager->getCreatorObjectId();
reportReadCommitError("LocalPoolVariable", result, false, ownerObjectId, localPoolId);
return result;
@@ -57,7 +57,7 @@ inline ReturnValue_t LocalPoolVariable::readWithoutLock() {
this->value = *(poolEntry->getDataPtr());
this->valid = poolEntry->getValid();
- return RETURN_OK;
+ return returnvalue::OK;
}
template
@@ -75,7 +75,7 @@ inline ReturnValue_t LocalPoolVariable::commit(MutexIF::TimeoutType timeoutTy
}
MutexIF* mutex = LocalDpManagerAttorney::getMutexHandle(*hkManager);
ReturnValue_t result = mutex->lockMutex(timeoutType, timeoutMs);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result = commitWithoutLock();
@@ -95,7 +95,7 @@ inline ReturnValue_t LocalPoolVariable::commitWithoutLock() {
PoolEntry* poolEntry = nullptr;
ReturnValue_t result =
LocalDpManagerAttorney::fetchPoolEntry(*hkManager, localPoolId, &poolEntry);
- if (result != RETURN_OK) {
+ if (result != returnvalue::OK) {
object_id_t ownerObjectId = hkManager->getCreatorObjectId();
reportReadCommitError("LocalPoolVariable", result, false, ownerObjectId, localPoolId);
return result;
@@ -103,7 +103,7 @@ inline ReturnValue_t LocalPoolVariable::commitWithoutLock() {
*(poolEntry->getDataPtr()) = this->value;
poolEntry->setValid(this->valid);
- return RETURN_OK;
+ return returnvalue::OK;
}
template
diff --git a/src/fsfw/datapoollocal/LocalPoolVector.tpp b/src/fsfw/datapoollocal/LocalPoolVector.tpp
index a2c2b752..939405a9 100644
--- a/src/fsfw/datapoollocal/LocalPoolVector.tpp
+++ b/src/fsfw/datapoollocal/LocalPoolVector.tpp
@@ -43,14 +43,14 @@ inline ReturnValue_t LocalPoolVector::readWithoutLock() {
LocalDpManagerAttorney::fetchPoolEntry(*hkManager, localPoolId, &poolEntry);
memset(this->value, 0, vectorSize * sizeof(T));
- if (result != RETURN_OK) {
+ if (result != returnvalue::OK) {
object_id_t targetObjectId = hkManager->getCreatorObjectId();
reportReadCommitError("LocalPoolVector", result, true, targetObjectId, localPoolId);
return result;
}
std::memcpy(this->value, poolEntry->getDataPtr(), poolEntry->getByteSize());
this->valid = poolEntry->getValid();
- return RETURN_OK;
+ return returnvalue::OK;
}
template
@@ -79,14 +79,14 @@ inline ReturnValue_t LocalPoolVector::commitWithoutLock() {
PoolEntry* poolEntry = nullptr;
ReturnValue_t result =
LocalDpManagerAttorney::fetchPoolEntry(*hkManager, localPoolId, &poolEntry);
- if (result != RETURN_OK) {
+ if (result != returnvalue::OK) {
object_id_t targetObjectId = hkManager->getCreatorObjectId();
reportReadCommitError("LocalPoolVector", result, false, targetObjectId, localPoolId);
return result;
}
std::memcpy(poolEntry->getDataPtr(), this->value, poolEntry->getByteSize());
poolEntry->setValid(this->valid);
- return RETURN_OK;
+ return returnvalue::OK;
}
template
@@ -131,10 +131,10 @@ template
inline ReturnValue_t LocalPoolVector::serialize(
uint8_t** buffer, size_t* size, size_t maxSize,
SerializeIF::Endianness streamEndianness) const {
- ReturnValue_t result = HasReturnvaluesIF::RETURN_FAILED;
+ ReturnValue_t result = returnvalue::FAILED;
for (uint16_t i = 0; i < vectorSize; i++) {
result = SerializeAdapter::serialize(&(value[i]), buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
break;
}
}
@@ -149,10 +149,10 @@ inline size_t LocalPoolVector::getSerializedSize() const {
template
inline ReturnValue_t LocalPoolVector::deSerialize(
const uint8_t** buffer, size_t* size, SerializeIF::Endianness streamEndianness) {
- ReturnValue_t result = HasReturnvaluesIF::RETURN_FAILED;
+ ReturnValue_t result = returnvalue::FAILED;
for (uint16_t i = 0; i < vectorSize; i++) {
result = SerializeAdapter::deSerialize(&(value[i]), buffer, size, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
break;
}
}
diff --git a/src/fsfw/datapoollocal/ProvidesDataPoolSubscriptionIF.h b/src/fsfw/datapoollocal/ProvidesDataPoolSubscriptionIF.h
index 1f13a09d..baf91796 100644
--- a/src/fsfw/datapoollocal/ProvidesDataPoolSubscriptionIF.h
+++ b/src/fsfw/datapoollocal/ProvidesDataPoolSubscriptionIF.h
@@ -1,24 +1,90 @@
#ifndef FSFW_DATAPOOLLOCAL_PROVIDESDATAPOOLSUBSCRIPTION_H_
#define FSFW_DATAPOOLLOCAL_PROVIDESDATAPOOLSUBSCRIPTION_H_
-#include "../ipc/messageQueueDefinitions.h"
-#include "../returnvalues/HasReturnvaluesIF.h"
+#include "fsfw/housekeeping/AcceptsHkPacketsIF.h"
+#include "fsfw/ipc/MessageQueueIF.h"
+#include "fsfw/ipc/messageQueueDefinitions.h"
+#include "fsfw/returnvalues/returnvalue.h"
#include "localPoolDefinitions.h"
+namespace subdp {
+
+struct ParamsBase {
+ ParamsBase(sid_t sid, bool enableReporting, float collectionInterval, bool diagnostics)
+ : sid(sid),
+ enableReporting(enableReporting),
+ collectionInterval(collectionInterval),
+ diagnostics(diagnostics) {}
+
+ [[nodiscard]] bool isDiagnostics() const { return diagnostics; }
+
+ sid_t sid;
+ bool enableReporting;
+ float collectionInterval;
+ MessageQueueId_t receiver = MessageQueueIF::NO_QUEUE;
+
+ protected:
+ bool diagnostics;
+};
+
+struct RegularHkPeriodicParams : public ParamsBase {
+ RegularHkPeriodicParams(sid_t sid, bool enableReporting, float collectionInterval)
+ : ParamsBase(sid, enableReporting, collectionInterval, false) {}
+};
+
+struct DiagnosticsHkPeriodicParams : public ParamsBase {
+ DiagnosticsHkPeriodicParams(sid_t sid, bool enableReporting, float collectionInterval)
+ : ParamsBase(sid, enableReporting, collectionInterval, true) {}
+};
+
+struct RegularHkUpdateParams : public ParamsBase {
+ RegularHkUpdateParams(sid_t sid, bool enableReporting)
+ : ParamsBase(sid, enableReporting, 0.0, false) {}
+};
+
+struct DiagnosticsHkUpdateParams : public ParamsBase {
+ DiagnosticsHkUpdateParams(sid_t sid, bool enableReporting)
+ : ParamsBase(sid, enableReporting, 0.0, true) {}
+};
+} // namespace subdp
+
class ProvidesDataPoolSubscriptionIF {
public:
- virtual ~ProvidesDataPoolSubscriptionIF(){};
-
+ virtual ~ProvidesDataPoolSubscriptionIF() = default;
/**
- * @brief Subscribe for the generation of periodic packets.
+ * @brief Subscribe for the generation of periodic packets. Used for regular HK packets
* @details
* This subscription mechanism will generally be used by the data creator
* to generate housekeeping packets which are downlinked directly.
* @return
*/
- virtual ReturnValue_t subscribeForPeriodicPacket(sid_t sid, bool enableReporting,
- float collectionInterval, bool isDiagnostics,
- object_id_t packetDestination) = 0;
+ virtual ReturnValue_t subscribeForRegularPeriodicPacket(
+ subdp::RegularHkPeriodicParams params) = 0;
+ /**
+ * @brief Subscribe for the generation of periodic packets. Used for diagnostic packets
+ * @details
+ * This subscription mechanism will generally be used by the data creator
+ * to generate housekeeping packets which are downlinked directly.
+ * @return
+ */
+ virtual ReturnValue_t subscribeForDiagPeriodicPacket(
+ subdp::DiagnosticsHkPeriodicParams params) = 0;
+
+ [[deprecated(
+ "Please use the new API which takes all arguments as one wrapper "
+ "struct")]] virtual ReturnValue_t
+ subscribeForPeriodicPacket(sid_t sid, bool enableReporting, float collectionInterval,
+ bool isDiagnostics,
+ object_id_t packetDestination = objects::NO_OBJECT) {
+ if (isDiagnostics) {
+ subdp::DiagnosticsHkPeriodicParams params(sid, enableReporting, collectionInterval);
+ return subscribeForDiagPeriodicPacket(params);
+ } else {
+ subdp::RegularHkPeriodicParams params(sid, enableReporting, collectionInterval);
+ return subscribeForRegularPeriodicPacket(params);
+ }
+ }
+
/**
* @brief Subscribe for the generation of packets if the dataset
* is marked as changed.
@@ -29,9 +95,28 @@ class ProvidesDataPoolSubscriptionIF {
* @param packetDestination
* @return
*/
- virtual ReturnValue_t subscribeForUpdatePacket(sid_t sid, bool reportingEnabled,
- bool isDiagnostics,
- object_id_t packetDestination) = 0;
+ virtual ReturnValue_t subscribeForRegularUpdatePacket(subdp::RegularHkUpdateParams params) = 0;
+ virtual ReturnValue_t subscribeForDiagUpdatePacket(subdp::DiagnosticsHkUpdateParams params) = 0;
+
+ // virtual ReturnValue_t
+ // subscribeForUpdatePacket(sid_t sid, bool reportingEnabled, bool isDiagnostics) {
+ // return subscribeForUpdatePacket(sid, reportingEnabled, isDiagnostics, objects::NO_OBJECT);
+ // }
+
+ [[deprecated(
+ "Please use the new API which takes all arguments as one wrapper "
+ "struct")]] virtual ReturnValue_t
+ subscribeForUpdatePacket(sid_t sid, bool reportingEnabled, bool isDiagnostics,
+ object_id_t packetDestination = objects::NO_OBJECT) {
+ if (isDiagnostics) {
+ subdp::DiagnosticsHkUpdateParams params(sid, reportingEnabled);
+ return subscribeForDiagUpdatePacket(params);
+ } else {
+ subdp::RegularHkUpdateParams params(sid, reportingEnabled);
+ return subscribeForRegularUpdatePacket(params);
+ }
+ }
+
/**
* @brief Subscribe for a notification message which will be sent
* if a dataset has changed.
@@ -46,8 +131,7 @@ class ProvidesDataPoolSubscriptionIF {
* Otherwise, only an notification message is sent.
* @return
*/
- virtual ReturnValue_t subscribeForSetUpdateMessage(const uint32_t setId,
- object_id_t destinationObject,
+ virtual ReturnValue_t subscribeForSetUpdateMessage(uint32_t setId, object_id_t destinationObject,
MessageQueueId_t targetQueueId,
bool generateSnapshot) = 0;
/**
@@ -64,7 +148,7 @@ class ProvidesDataPoolSubscriptionIF {
* only an notification message is sent.
* @return
*/
- virtual ReturnValue_t subscribeForVariableUpdateMessage(const lp_id_t localPoolId,
+ virtual ReturnValue_t subscribeForVariableUpdateMessage(lp_id_t localPoolId,
object_id_t destinationObject,
MessageQueueId_t targetQueueId,
bool generateSnapshot) = 0;
diff --git a/src/fsfw/datapoollocal/SharedLocalDataSet.cpp b/src/fsfw/datapoollocal/SharedLocalDataSet.cpp
index 248c1577..6d0b0b11 100644
--- a/src/fsfw/datapoollocal/SharedLocalDataSet.cpp
+++ b/src/fsfw/datapoollocal/SharedLocalDataSet.cpp
@@ -20,7 +20,7 @@ ReturnValue_t SharedLocalDataSet::lockDataset(MutexIF::TimeoutType timeoutType,
if (datasetLock != nullptr) {
return datasetLock->lockMutex(timeoutType, mutexTimeout);
}
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
SharedLocalDataSet::~SharedLocalDataSet() { MutexFactory::instance()->deleteMutex(datasetLock); }
@@ -29,5 +29,5 @@ ReturnValue_t SharedLocalDataSet::unlockDataset() {
if (datasetLock != nullptr) {
return datasetLock->unlockMutex();
}
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
diff --git a/src/fsfw/devicehandlers/AssemblyBase.cpp b/src/fsfw/devicehandlers/AssemblyBase.cpp
index c29022e5..63178ab9 100644
--- a/src/fsfw/devicehandlers/AssemblyBase.cpp
+++ b/src/fsfw/devicehandlers/AssemblyBase.cpp
@@ -50,7 +50,7 @@ bool AssemblyBase::isInTransition() {
bool AssemblyBase::handleChildrenChanged() {
if (childrenChangedMode) {
ReturnValue_t result = checkChildrenState();
- if (result != RETURN_OK) {
+ if (result != returnvalue::OK) {
handleChildrenLostMode(result);
}
return true;
@@ -116,7 +116,7 @@ void AssemblyBase::handleChildrenTransition() {
break;
}
ReturnValue_t result = checkChildrenState();
- if (result == RETURN_OK) {
+ if (result == returnvalue::OK) {
handleModeReached();
} else {
handleModeTransitionFailed(result);
@@ -149,7 +149,7 @@ void AssemblyBase::handleModeTransitionFailed(ReturnValue_t result) {
void AssemblyBase::sendHealthCommand(MessageQueueId_t sendTo, HealthState health) {
CommandMessage command;
HealthMessage::setHealthMessage(&command, HealthMessage::HEALTH_SET, health);
- if (commandQueue->sendMessage(sendTo, &command) == RETURN_OK) {
+ if (commandQueue->sendMessage(sendTo, &command) == returnvalue::OK) {
commandsOutstanding++;
}
}
@@ -164,25 +164,25 @@ ReturnValue_t AssemblyBase::checkChildrenState() {
ReturnValue_t AssemblyBase::checkChildrenStateOff() {
for (const auto& childIter : childrenMap) {
- if (checkChildOff(childIter.first) != RETURN_OK) {
+ if (checkChildOff(childIter.first) != returnvalue::OK) {
return NOT_ENOUGH_CHILDREN_IN_CORRECT_STATE;
}
}
- return RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t AssemblyBase::checkChildOff(uint32_t objectId) {
ChildInfo childInfo = childrenMap.find(objectId)->second;
if (healthHelper.healthTable->isCommandable(objectId)) {
if (childInfo.submode != SUBMODE_NONE) {
- return RETURN_FAILED;
+ return returnvalue::FAILED;
} else {
if ((childInfo.mode != MODE_OFF) && (childInfo.mode != DeviceHandlerIF::MODE_ERROR_ON)) {
- return RETURN_FAILED;
+ return returnvalue::FAILED;
}
}
}
- return RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t AssemblyBase::checkModeCommand(Mode_t mode, Submode_t submode,
@@ -192,7 +192,7 @@ ReturnValue_t AssemblyBase::checkModeCommand(Mode_t mode, Submode_t submode,
if (submode != SUBMODE_NONE) {
return INVALID_SUBMODE;
}
- return RETURN_OK;
+ return returnvalue::OK;
}
if ((mode != MODE_ON) && (mode != DeviceHandlerIF::MODE_NORMAL)) {
@@ -212,7 +212,7 @@ ReturnValue_t AssemblyBase::handleHealthReply(CommandMessage* message) {
if (health != EXTERNAL_CONTROL) {
updateChildChangedHealth(message->getSender(), true);
}
- return RETURN_OK;
+ return returnvalue::OK;
}
if (message->getCommand() == HealthMessage::REPLY_HEALTH_SET ||
(message->getCommand() == CommandMessage::REPLY_REJECTED &&
@@ -220,9 +220,9 @@ ReturnValue_t AssemblyBase::handleHealthReply(CommandMessage* message) {
if (isInTransition()) {
commandsOutstanding--;
}
- return RETURN_OK;
+ return returnvalue::OK;
}
- return RETURN_FAILED;
+ return returnvalue::FAILED;
}
bool AssemblyBase::checkAndHandleRecovery() {
diff --git a/src/fsfw/devicehandlers/AssemblyBase.h b/src/fsfw/devicehandlers/AssemblyBase.h
index 3e235928..ec0847f1 100644
--- a/src/fsfw/devicehandlers/AssemblyBase.h
+++ b/src/fsfw/devicehandlers/AssemblyBase.h
@@ -53,7 +53,7 @@ class AssemblyBase : public SubsystemBase {
* @param mode
* @param submode
* @return
- * - @c RETURN_OK if ok
+ * - @c returnvalue::OK if ok
* - @c NEED_SECOND_STEP if children need to be commanded again
*/
virtual ReturnValue_t commandChildren(Mode_t mode, Submode_t submode) = 0;
@@ -79,7 +79,7 @@ class AssemblyBase : public SubsystemBase {
* @param submode The targeted submmode
* @return Any information why this combination is invalid from HasModesIF
* like HasModesIF::INVALID_SUBMODE.
- * On success return HasReturnvaluesIF::RETURN_OK
+ * On success return returnvalue::OK
*/
virtual ReturnValue_t isModeCombinationValid(Mode_t mode, Submode_t submode) = 0;
diff --git a/src/fsfw/devicehandlers/ChildHandlerBase.cpp b/src/fsfw/devicehandlers/ChildHandlerBase.cpp
index be4f4798..ecd4cfc8 100644
--- a/src/fsfw/devicehandlers/ChildHandlerBase.cpp
+++ b/src/fsfw/devicehandlers/ChildHandlerBase.cpp
@@ -19,7 +19,7 @@ ChildHandlerBase::~ChildHandlerBase() {}
ReturnValue_t ChildHandlerBase::initialize() {
ReturnValue_t result = DeviceHandlerBase::initialize();
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
@@ -28,7 +28,7 @@ ReturnValue_t ChildHandlerBase::initialize() {
if (parentId != objects::NO_OBJECT) {
SubsystemBase* parent = ObjectManager::instance()->get(parentId);
if (parent == NULL) {
- return RETURN_FAILED;
+ return returnvalue::FAILED;
}
parentQueue = parent->getCommandQueue();
@@ -39,5 +39,5 @@ ReturnValue_t ChildHandlerBase::initialize() {
modeHelper.setParentQueue(parentQueue);
- return RETURN_OK;
+ return returnvalue::OK;
}
diff --git a/src/fsfw/devicehandlers/DeviceCommunicationIF.h b/src/fsfw/devicehandlers/DeviceCommunicationIF.h
index 7a860411..a5546a36 100644
--- a/src/fsfw/devicehandlers/DeviceCommunicationIF.h
+++ b/src/fsfw/devicehandlers/DeviceCommunicationIF.h
@@ -1,7 +1,7 @@
#ifndef FSFW_DEVICES_DEVICECOMMUNICATIONIF_H_
#define FSFW_DEVICES_DEVICECOMMUNICATIONIF_H_
-#include "../returnvalues/HasReturnvaluesIF.h"
+#include "../returnvalues/returnvalue.h"
#include "CookieIF.h"
#include "DeviceHandlerIF.h"
/**
@@ -34,7 +34,7 @@
* @ingroup interfaces
* @ingroup comm
*/
-class DeviceCommunicationIF : public HasReturnvaluesIF {
+class DeviceCommunicationIF {
public:
static const uint8_t INTERFACE_ID = CLASS_ID::DEVICE_COMMUNICATION_IF;
@@ -61,7 +61,7 @@ class DeviceCommunicationIF : public HasReturnvaluesIF {
* initialization.
* @param cookie
* @return
- * - @c RETURN_OK if initialization was successfull
+ * - @c returnvalue::OK if initialization was successfull
* - Everything else triggers failure event with returnvalue as parameter 1
*/
virtual ReturnValue_t initializeInterface(CookieIF *cookie) = 0;
@@ -74,7 +74,7 @@ class DeviceCommunicationIF : public HasReturnvaluesIF {
* @param data
* @param len If this is 0, nothing shall be sent.
* @return
- * - @c RETURN_OK for successfull send
+ * - @c returnvalue::OK for successfull send
* - Everything else triggers failure event with returnvalue as parameter 1
*/
virtual ReturnValue_t sendMessage(CookieIF *cookie, const uint8_t *sendData, size_t sendLen) = 0;
@@ -84,7 +84,7 @@ class DeviceCommunicationIF : public HasReturnvaluesIF {
* Get send confirmation that the data in sendMessage() was sent successfully.
* @param cookie
* @return
- * - @c RETURN_OK if data was sent successfully but a reply is expected
+ * - @c returnvalue::OK if data was sent successfully but a reply is expected
* - NO_REPLY_EXPECTED if data was sent successfully and no reply is expected
* - Everything else to indicate failure
*/
@@ -99,7 +99,7 @@ class DeviceCommunicationIF : public HasReturnvaluesIF {
*
* @param cookie
* @param requestLen Size of data to read
- * @return - @c RETURN_OK to confirm the request for data has been sent.
+ * @return - @c returnvalue::OK to confirm the request for data has been sent.
* - Everything else triggers failure event with
* returnvalue as parameter 1
*/
@@ -113,7 +113,7 @@ class DeviceCommunicationIF : public HasReturnvaluesIF {
* @param buffer [out] Set reply here (by using *buffer = ...)
* @param size [out] size pointer to set (by using *size = ...).
* Set to 0 if no reply was received
- * @return - @c RETURN_OK for successfull receive
+ * @return - @c returnvalue::OK for successfull receive
* - @c NO_REPLY_RECEIVED if not reply was received. Setting size to
* 0 has the same effect
* - Everything else triggers failure event with
diff --git a/src/fsfw/devicehandlers/DeviceHandlerBase.cpp b/src/fsfw/devicehandlers/DeviceHandlerBase.cpp
index dd9bd5d7..8ab540a0 100644
--- a/src/fsfw/devicehandlers/DeviceHandlerBase.cpp
+++ b/src/fsfw/devicehandlers/DeviceHandlerBase.cpp
@@ -8,6 +8,7 @@
#include "fsfw/ipc/MessageQueueMessage.h"
#include "fsfw/ipc/QueueFactory.h"
#include "fsfw/objectmanager/ObjectManager.h"
+#include "fsfw/serialize/SerialBufferAdapter.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
#include "fsfw/storagemanager/StorageManagerIF.h"
#include "fsfw/subsystem/SubsystemBase.h"
@@ -32,7 +33,7 @@ DeviceHandlerBase::DeviceHandlerBase(object_id_t setObjectId, object_id_t device
parameterHelper(this),
actionHelper(this, nullptr),
poolManager(this, nullptr),
- childTransitionFailure(RETURN_OK),
+ childTransitionFailure(returnvalue::OK),
fdirInstance(fdirInstance),
defaultFDIRUsed(fdirInstance == nullptr),
switchOffWasReported(false),
@@ -45,8 +46,8 @@ DeviceHandlerBase::DeviceHandlerBase(object_id_t setObjectId, object_id_t device
cookieInfo.state = COOKIE_UNUSED;
cookieInfo.pendingCommand = deviceCommandMap.end();
if (comCookie == nullptr) {
- printWarningOrError(sif::OutputTypes::OUT_ERROR, "DeviceHandlerBase",
- HasReturnvaluesIF::RETURN_FAILED, "Invalid cookie");
+ printWarningOrError(sif::OutputTypes::OUT_ERROR, "DeviceHandlerBase", returnvalue::FAILED,
+ "Invalid cookie");
}
if (this->fdirInstance == nullptr) {
this->fdirInstance = new DeviceHandlerFailureIsolation(setObjectId, defaultFdirParentId);
@@ -65,7 +66,9 @@ void DeviceHandlerBase::setThermalStateRequestPoolIds(lp_id_t thermalStatePoolId
}
DeviceHandlerBase::~DeviceHandlerBase() {
- delete comCookie;
+ if (comCookie != nullptr) {
+ delete comCookie;
+ }
if (defaultFDIRUsed) {
delete fdirInstance;
}
@@ -77,7 +80,7 @@ ReturnValue_t DeviceHandlerBase::performOperation(uint8_t counter) {
this->lastStep = this->pstStep;
if (getComAction() == CommunicationAction::NOTHING) {
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
if (getComAction() == CommunicationAction::PERFORM_OPERATION) {
@@ -88,11 +91,11 @@ ReturnValue_t DeviceHandlerBase::performOperation(uint8_t counter) {
decrementDeviceReplyMap();
fdirInstance->checkForFailures();
performOperationHook();
- return RETURN_OK;
+ return returnvalue::OK;
}
if (mode == MODE_OFF) {
- return RETURN_OK;
+ return returnvalue::OK;
}
switch (getComAction()) {
@@ -118,12 +121,12 @@ ReturnValue_t DeviceHandlerBase::performOperation(uint8_t counter) {
default:
break;
}
- return RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t DeviceHandlerBase::initialize() {
ReturnValue_t result = SystemObject::initialize();
- if (result != RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
@@ -136,7 +139,7 @@ ReturnValue_t DeviceHandlerBase::initialize() {
}
result = communicationInterface->initializeInterface(comCookie);
- if (result != RETURN_OK) {
+ if (result != returnvalue::OK) {
printWarningOrError(sif::OutputTypes::OUT_ERROR, "initialize",
ObjectManagerIF::CHILD_INIT_FAILED, "ComIF initialization failed");
return result;
@@ -190,30 +193,30 @@ ReturnValue_t DeviceHandlerBase::initialize() {
}
result = healthHelper.initialize();
- if (result != RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result = modeHelper.initialize();
- if (result != RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result = actionHelper.initialize(commandQueue);
- if (result != RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result = fdirInstance->initialize();
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result = parameterHelper.initialize();
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result = poolManager.initialize(commandQueue);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
@@ -222,28 +225,37 @@ ReturnValue_t DeviceHandlerBase::initialize() {
if (thermalSet != nullptr) {
// Set temperature target state to NON_OP.
result = thermalSet->read();
- if (result == HasReturnvaluesIF::RETURN_OK) {
+ if (result == returnvalue::OK) {
thermalSet->heaterRequest.value = ThermalComponentIF::STATE_REQUEST_NON_OPERATIONAL;
thermalSet->heaterRequest.setValid(true);
thermalSet->commit();
}
}
- return RETURN_OK;
+ return returnvalue::OK;
}
void DeviceHandlerBase::decrementDeviceReplyMap() {
+ bool timedOut = false;
for (std::pair& replyPair : deviceReplyMap) {
- if (replyPair.second.delayCycles != 0) {
+ if (replyPair.second.countdown != nullptr && replyPair.second.active) {
+ if (replyPair.second.countdown->hasTimedOut()) {
+ resetTimeoutControlledReply(&replyPair.second);
+ timedOut = true;
+ }
+ }
+ if (replyPair.second.delayCycles != 0 && replyPair.second.countdown == nullptr) {
replyPair.second.delayCycles--;
if (replyPair.second.delayCycles == 0) {
- if (replyPair.second.periodic) {
- replyPair.second.delayCycles = replyPair.second.maxDelayCycles;
- }
- replyToReply(replyPair.first, replyPair.second, TIMEOUT);
- missedReply(replyPair.first);
+ resetDelayCyclesControlledReply(&replyPair.second);
+ timedOut = true;
}
}
+ if (timedOut) {
+ replyToReply(replyPair.first, replyPair.second, TIMEOUT);
+ missedReply(replyPair.first);
+ timedOut = false;
+ }
}
}
@@ -254,42 +266,42 @@ void DeviceHandlerBase::readCommandQueue() {
CommandMessage command;
ReturnValue_t result = commandQueue->receiveMessage(&command);
- if (result != RETURN_OK) {
+ if (result != returnvalue::OK) {
return;
}
result = healthHelper.handleHealthCommand(&command);
- if (result == RETURN_OK) {
+ if (result == returnvalue::OK) {
return;
}
result = modeHelper.handleModeCommand(&command);
- if (result == RETURN_OK) {
+ if (result == returnvalue::OK) {
return;
}
result = actionHelper.handleActionMessage(&command);
- if (result == RETURN_OK) {
+ if (result == returnvalue::OK) {
return;
}
result = parameterHelper.handleParameterMessage(&command);
- if (result == RETURN_OK) {
+ if (result == returnvalue::OK) {
return;
}
result = poolManager.handleHousekeepingMessage(&command);
- if (result == RETURN_OK) {
+ if (result == returnvalue::OK) {
return;
}
result = handleDeviceHandlerMessage(&command);
- if (result == RETURN_OK) {
+ if (result == returnvalue::OK) {
return;
}
result = letChildHandleMessage(&command);
- if (result == RETURN_OK) {
+ if (result == returnvalue::OK) {
return;
}
@@ -317,7 +329,7 @@ void DeviceHandlerBase::doStateMachine() {
sprintf(printout, "Transition timeout (%lu) occured !",
static_cast(childTransitionDelay));
/* Common configuration error for development, so print it */
- printWarningOrError(sif::OutputTypes::OUT_WARNING, "doStateMachine", RETURN_FAILED,
+ printWarningOrError(sif::OutputTypes::OUT_WARNING, "doStateMachine", returnvalue::FAILED,
printout);
#endif
triggerEvent(MODE_TRANSITION_FAILED, childTransitionFailure, 0);
@@ -359,7 +371,6 @@ void DeviceHandlerBase::doStateMachine() {
setMode(MODE_OFF);
break;
}
-
if (currentUptime - timeoutStart >= powerSwitcher->getSwitchDelayMs()) {
triggerEvent(MODE_TRANSITION_FAILED, PowerSwitchIF::SWITCH_TIMEOUT, 0);
setMode(MODE_ERROR_ON);
@@ -397,7 +408,7 @@ ReturnValue_t DeviceHandlerBase::isModeCombinationValid(Mode_t mode, Submode_t s
case MODE_NORMAL:
case MODE_RAW:
if (submode == SUBMODE_NONE) {
- return RETURN_OK;
+ return returnvalue::OK;
} else {
return INVALID_SUBMODE;
}
@@ -408,20 +419,22 @@ ReturnValue_t DeviceHandlerBase::isModeCombinationValid(Mode_t mode, Submode_t s
ReturnValue_t DeviceHandlerBase::insertInCommandAndReplyMap(
DeviceCommandId_t deviceCommand, uint16_t maxDelayCycles, LocalPoolDataSetBase* replyDataSet,
- size_t replyLen, bool periodic, bool hasDifferentReplyId, DeviceCommandId_t replyId) {
+ size_t replyLen, bool periodic, bool hasDifferentReplyId, DeviceCommandId_t replyId,
+ Countdown* countdown) {
// No need to check, as we may try to insert multiple times.
insertInCommandMap(deviceCommand, hasDifferentReplyId, replyId);
if (hasDifferentReplyId) {
- return insertInReplyMap(replyId, maxDelayCycles, replyDataSet, replyLen, periodic);
+ return insertInReplyMap(replyId, maxDelayCycles, replyDataSet, replyLen, periodic, countdown);
} else {
- return insertInReplyMap(deviceCommand, maxDelayCycles, replyDataSet, replyLen, periodic);
+ return insertInReplyMap(deviceCommand, maxDelayCycles, replyDataSet, replyLen, periodic,
+ countdown);
}
}
ReturnValue_t DeviceHandlerBase::insertInReplyMap(DeviceCommandId_t replyId,
uint16_t maxDelayCycles,
LocalPoolDataSetBase* dataSet, size_t replyLen,
- bool periodic) {
+ bool periodic, Countdown* countdown) {
DeviceReplyInfo info;
info.maxDelayCycles = maxDelayCycles;
info.periodic = periodic;
@@ -429,11 +442,12 @@ ReturnValue_t DeviceHandlerBase::insertInReplyMap(DeviceCommandId_t replyId,
info.replyLen = replyLen;
info.dataSet = dataSet;
info.command = deviceCommandMap.end();
+ info.countdown = countdown;
auto resultPair = deviceReplyMap.emplace(replyId, info);
if (resultPair.second) {
- return RETURN_OK;
+ return returnvalue::OK;
} else {
- return RETURN_FAILED;
+ return returnvalue::FAILED;
}
}
@@ -444,13 +458,13 @@ ReturnValue_t DeviceHandlerBase::insertInCommandMap(DeviceCommandId_t deviceComm
info.expectedReplies = 0;
info.isExecuting = false;
info.sendReplyTo = NO_COMMANDER;
- info.useAlternativeReplyId = alternativeReplyId;
+ info.useAlternativeReplyId = useAlternativeReply;
info.alternativeReplyId = alternativeReplyId;
auto resultPair = deviceCommandMap.emplace(deviceCommand, info);
if (resultPair.second) {
- return RETURN_OK;
+ return returnvalue::OK;
} else {
- return RETURN_FAILED;
+ return returnvalue::FAILED;
}
}
@@ -464,7 +478,8 @@ size_t DeviceHandlerBase::getNextReplyLength(DeviceCommandId_t commandId) {
}
DeviceReplyIter iter = deviceReplyMap.find(replyId);
if (iter != deviceReplyMap.end()) {
- if (iter->second.delayCycles != 0) {
+ if ((iter->second.delayCycles != 0 && iter->second.countdown == nullptr) ||
+ (iter->second.active && iter->second.countdown != nullptr)) {
return iter->second.replyLen;
}
}
@@ -485,7 +500,7 @@ ReturnValue_t DeviceHandlerBase::updateReplyMapEntry(DeviceCommandId_t deviceRep
}
info->delayCycles = delayCycles;
info->periodic = periodic;
- return RETURN_OK;
+ return returnvalue::OK;
}
}
@@ -500,22 +515,32 @@ ReturnValue_t DeviceHandlerBase::updatePeriodicReply(bool enable, DeviceCommandI
return COMMAND_NOT_SUPPORTED;
}
if (enable) {
- info->delayCycles = info->maxDelayCycles;
+ info->active = true;
+ if (info->countdown != nullptr) {
+ info->countdown->resetTimer();
+ } else {
+ info->delayCycles = info->maxDelayCycles;
+ }
} else {
- info->delayCycles = 0;
+ info->active = false;
+ if (info->countdown != nullptr) {
+ info->countdown->timeOut();
+ } else {
+ info->delayCycles = 0;
+ }
}
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t DeviceHandlerBase::setReplyDataset(DeviceCommandId_t replyId,
LocalPoolDataSetBase* dataSet) {
auto replyIter = deviceReplyMap.find(replyId);
if (replyIter == deviceReplyMap.end()) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
replyIter->second.dataSet = dataSet;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
void DeviceHandlerBase::callChildStatemachine() {
@@ -554,7 +579,7 @@ void DeviceHandlerBase::setMode(Mode_t newMode, uint8_t newSubmode) {
if (mode == MODE_OFF and thermalSet != nullptr) {
ReturnValue_t result = thermalSet->read();
- if (result == HasReturnvaluesIF::RETURN_OK) {
+ if (result == returnvalue::OK) {
if (thermalSet->heaterRequest.value != ThermalComponentIF::STATE_REQUEST_IGNORE) {
thermalSet->heaterRequest.value = ThermalComponentIF::STATE_REQUEST_NON_OPERATIONAL;
}
@@ -569,7 +594,7 @@ void DeviceHandlerBase::setMode(Mode_t newMode) { setMode(newMode, submode); }
void DeviceHandlerBase::replyReturnvalueToCommand(ReturnValue_t status, uint32_t parameter) {
// This is actually the reply protocol for raw and misc DH commands.
- if (status == RETURN_OK) {
+ if (status == returnvalue::OK) {
CommandMessage reply(CommandMessage::REPLY_COMMAND_OK, 0, parameter);
commandQueue->reply(&reply);
} else {
@@ -582,7 +607,7 @@ void DeviceHandlerBase::replyToCommand(ReturnValue_t status, uint32_t parameter)
// Check if we reply to a raw command.
if (cookieInfo.pendingCommand->first == RAW_COMMAND_ID) {
if (status == NO_REPLY_EXPECTED) {
- status = RETURN_OK;
+ status = returnvalue::OK;
}
replyReturnvalueToCommand(status, parameter);
// Always delete data from a raw command.
@@ -593,7 +618,7 @@ void DeviceHandlerBase::replyToCommand(ReturnValue_t status, uint32_t parameter)
if (cookieInfo.pendingCommand->second.sendReplyTo != NO_COMMANDER) {
MessageQueueId_t queueId = cookieInfo.pendingCommand->second.sendReplyTo;
if (status == NO_REPLY_EXPECTED) {
- actionHelper.finish(true, queueId, cookieInfo.pendingCommand->first, RETURN_OK);
+ actionHelper.finish(true, queueId, cookieInfo.pendingCommand->first, returnvalue::OK);
} else {
actionHelper.step(1, queueId, cookieInfo.pendingCommand->first, status);
}
@@ -610,8 +635,8 @@ void DeviceHandlerBase::replyToReply(const DeviceCommandId_t command, DeviceRepl
}
DeviceCommandInfo* info = &replyInfo.command->second;
if (info == nullptr) {
- printWarningOrError(sif::OutputTypes::OUT_ERROR, "replyToReply",
- HasReturnvaluesIF::RETURN_FAILED, "Command pointer not found");
+ printWarningOrError(sif::OutputTypes::OUT_ERROR, "replyToReply", returnvalue::FAILED,
+ "Command pointer not found");
return;
}
@@ -625,7 +650,7 @@ void DeviceHandlerBase::replyToReply(const DeviceCommandId_t command, DeviceRepl
// Don't send any replies in that case.
if (info->sendReplyTo != NO_COMMANDER) {
bool success = false;
- if (status == HasReturnvaluesIF::RETURN_OK) {
+ if (status == returnvalue::OK) {
success = true;
}
actionHelper.finish(success, info->sendReplyTo, command, status);
@@ -638,7 +663,7 @@ void DeviceHandlerBase::doSendWrite() {
if (cookieInfo.state == COOKIE_WRITE_READY) {
ReturnValue_t result = communicationInterface->sendMessage(comCookie, rawPacket, rawPacketLen);
- if (result == RETURN_OK) {
+ if (result == returnvalue::OK) {
cookieInfo.state = COOKIE_WRITE_SENT;
} else {
// always generate a failure event, so that FDIR knows what's up
@@ -656,7 +681,7 @@ void DeviceHandlerBase::doGetWrite() {
}
cookieInfo.state = COOKIE_UNUSED;
ReturnValue_t result = communicationInterface->getSendSuccess(comCookie);
- if (result == RETURN_OK) {
+ if (result == returnvalue::OK) {
if (wiretappingMode == RAW) {
replyRawData(rawPacket, rawPacketLen, requestedRawTraffic, true);
}
@@ -670,7 +695,7 @@ void DeviceHandlerBase::doGetWrite() {
// always generate a failure event, so that FDIR knows what's up
triggerEvent(DEVICE_SENDING_COMMAND_FAILED, result, cookieInfo.pendingCommand->first);
}
- if (result != RETURN_OK) {
+ if (result != returnvalue::OK) {
cookieInfo.pendingCommand->second.isExecuting = false;
}
replyToCommand(result);
@@ -680,7 +705,7 @@ void DeviceHandlerBase::doSendRead() {
ReturnValue_t result;
result = doSendReadHook();
- if (result != RETURN_OK) {
+ if (result != returnvalue::OK) {
return;
}
@@ -691,7 +716,7 @@ void DeviceHandlerBase::doSendRead() {
result = communicationInterface->requestReceiveMessage(comCookie, replyLen);
- if (result == RETURN_OK) {
+ if (result == returnvalue::OK) {
cookieInfo.state = COOKIE_READ_SENT;
} else {
triggerEvent(DEVICE_REQUESTING_REPLY_FAILED, result);
@@ -717,7 +742,7 @@ void DeviceHandlerBase::doGetRead() {
ReturnValue_t result =
communicationInterface->readReceivedMessage(comCookie, &receivedData, &receivedDataLen);
- if (result != RETURN_OK) {
+ if (result != returnvalue::OK) {
triggerEvent(DEVICE_REQUESTING_REPLY_FAILED, result);
// I think we can allow to ignore one missedReply.
ignoreMissedRepliesCount++;
@@ -740,7 +765,7 @@ void DeviceHandlerBase::doGetRead() {
}
void DeviceHandlerBase::parseReply(const uint8_t* receivedData, size_t receivedDataLen) {
- ReturnValue_t result = HasReturnvaluesIF::RETURN_FAILED;
+ ReturnValue_t result = returnvalue::FAILED;
DeviceCommandId_t foundId = DeviceHandlerIF::NO_COMMAND_ID;
size_t foundLen = 0;
/* The loop may not execute more often than the number of received bytes
@@ -749,7 +774,7 @@ void DeviceHandlerBase::parseReply(const uint8_t* receivedData, size_t receivedD
for (uint32_t count = 0; count < receivedDataLen; count++) {
result = scanForReply(receivedData, remainingLength, &foundId, &foundLen);
switch (result) {
- case RETURN_OK:
+ case returnvalue::OK:
handleReply(receivedData, foundId, foundLen);
if (foundLen == 0) {
printWarningOrError(sif::OutputTypes::OUT_WARNING, "parseReply",
@@ -759,7 +784,7 @@ void DeviceHandlerBase::parseReply(const uint8_t* receivedData, size_t receivedD
break;
case APERIODIC_REPLY: {
result = interpretDeviceReply(foundId, receivedData);
- if (result != RETURN_OK) {
+ if (result != returnvalue::OK) {
replyRawReplyIfnotWiretapped(receivedData, foundLen);
triggerEvent(DEVICE_INTERPRETING_REPLY_FAILED, result, foundId);
}
@@ -808,20 +833,21 @@ void DeviceHandlerBase::handleReply(const uint8_t* receivedData, DeviceCommandId
DeviceReplyInfo* info = &(iter->second);
- if (info->delayCycles != 0) {
+ if ((info->delayCycles != 0 && info->countdown == nullptr) ||
+ (info->active && info->countdown != nullptr)) {
result = interpretDeviceReply(foundId, receivedData);
if (result == IGNORE_REPLY_DATA) {
return;
}
- if (info->periodic) {
- info->delayCycles = info->maxDelayCycles;
- } else {
- info->delayCycles = 0;
+ if (info->active && info->countdown != nullptr) {
+ resetTimeoutControlledReply(info);
+ } else if (info->delayCycles != 0) {
+ resetDelayCyclesControlledReply(info);
}
- if (result != RETURN_OK) {
+ if (result != returnvalue::OK) {
// Report failed interpretation to FDIR.
replyRawReplyIfnotWiretapped(receivedData, foundLen);
triggerEvent(DEVICE_INTERPRETING_REPLY_FAILED, result, foundId);
@@ -837,6 +863,24 @@ void DeviceHandlerBase::handleReply(const uint8_t* receivedData, DeviceCommandId
}
}
+void DeviceHandlerBase::resetTimeoutControlledReply(DeviceReplyInfo* info) {
+ if (info->periodic) {
+ info->countdown->resetTimer();
+ } else {
+ info->active = false;
+ info->countdown->timeOut();
+ }
+}
+
+void DeviceHandlerBase::resetDelayCyclesControlledReply(DeviceReplyInfo* info) {
+ if (info->periodic) {
+ info->delayCycles = info->maxDelayCycles;
+ } else {
+ info->delayCycles = 0;
+ info->active = false;
+ }
+}
+
ReturnValue_t DeviceHandlerBase::getStorageData(store_address_t storageAddress, uint8_t** data,
size_t* len) {
size_t lenTmp;
@@ -844,12 +888,12 @@ ReturnValue_t DeviceHandlerBase::getStorageData(store_address_t storageAddress,
if (IPCStore == nullptr) {
*data = nullptr;
*len = 0;
- return RETURN_FAILED;
+ return returnvalue::FAILED;
}
ReturnValue_t result = IPCStore->modifyData(storageAddress, data, &lenTmp);
- if (result == RETURN_OK) {
+ if (result == returnvalue::OK) {
*len = lenTmp;
- return RETURN_OK;
+ return returnvalue::OK;
} else {
triggerEvent(StorageManagerIF::GET_DATA_FAILED, result, storageAddress.raw);
*data = nullptr;
@@ -866,7 +910,7 @@ void DeviceHandlerBase::replyRawData(const uint8_t* data, size_t len, MessageQue
store_address_t address;
ReturnValue_t result = IPCStore->addData(&address, data, len);
- if (result != RETURN_OK) {
+ if (result != returnvalue::OK) {
triggerEvent(StorageManagerIF::STORE_DATA_FAILED, result);
return;
}
@@ -878,7 +922,7 @@ void DeviceHandlerBase::replyRawData(const uint8_t* data, size_t len, MessageQue
result = commandQueue->sendMessage(sendTo, &command);
- if (result != RETURN_OK) {
+ if (result != returnvalue::OK) {
IPCStore->deleteData(address);
// Silently discard data, this indicates heavy TM traffic which
// should not be increased by additional events.
@@ -914,7 +958,7 @@ MessageQueueId_t DeviceHandlerBase::getCommandQueue() const { return commandQueu
void DeviceHandlerBase::buildRawDeviceCommand(CommandMessage* commandMessage) {
storedRawData = DeviceHandlerMessage::getStoreAddress(commandMessage);
ReturnValue_t result = getStorageData(storedRawData, &rawPacket, &rawPacketLen);
- if (result != RETURN_OK) {
+ if (result != returnvalue::OK) {
replyReturnvalueToCommand(result, RAW_COMMAND_ID);
storedRawData.raw = StorageManagerIF::INVALID_ADDRESS;
} else {
@@ -931,7 +975,7 @@ void DeviceHandlerBase::commandSwitch(ReturnValue_t onOff) {
const uint8_t* switches;
uint8_t numberOfSwitches = 0;
ReturnValue_t result = getSwitches(&switches, &numberOfSwitches);
- if (result == RETURN_OK) {
+ if (result == returnvalue::OK) {
while (numberOfSwitches > 0) {
powerSwitcher->sendSwitchCommand(switches[numberOfSwitches - 1], onOff);
numberOfSwitches--;
@@ -939,7 +983,7 @@ void DeviceHandlerBase::commandSwitch(ReturnValue_t onOff) {
}
}
-ReturnValue_t DeviceHandlerBase::doSendReadHook() { return RETURN_OK; }
+ReturnValue_t DeviceHandlerBase::doSendReadHook() { return returnvalue::OK; }
ReturnValue_t DeviceHandlerBase::getSwitches(const uint8_t** switches, uint8_t* numberOfSwitches) {
return DeviceHandlerBase::NO_SWITCH;
@@ -959,10 +1003,16 @@ ReturnValue_t DeviceHandlerBase::enableReplyInReplyMap(DeviceCommandMap::iterato
}
if (iter != deviceReplyMap.end()) {
DeviceReplyInfo* info = &(iter->second);
+ // If a countdown has been set, the delay cycles will be ignored and the reply times out
+ // as soon as the countdown has expired
info->delayCycles = info->maxDelayCycles;
info->command = command;
command->second.expectedReplies = expectedReplies;
- return RETURN_OK;
+ if (info->countdown != nullptr) {
+ info->countdown->resetTimer();
+ }
+ info->active = true;
+ return returnvalue::OK;
} else {
return NO_REPLY_EXPECTED;
}
@@ -980,7 +1030,7 @@ ReturnValue_t DeviceHandlerBase::getStateOfSwitches(void) {
const uint8_t* switches;
ReturnValue_t result = getSwitches(&switches, &numberOfSwitches);
- if ((result == RETURN_OK) && (numberOfSwitches != 0)) {
+ if ((result == returnvalue::OK) && (numberOfSwitches != 0)) {
while (numberOfSwitches > 0) {
if (powerSwitcher->getSwitchState(switches[numberOfSwitches - 1]) ==
PowerSwitchIF::SWITCH_OFF) {
@@ -1025,7 +1075,7 @@ ReturnValue_t DeviceHandlerBase::checkModeCommand(Mode_t commandedMode, Submode_
if ((commandedMode == MODE_ON) && (mode == MODE_OFF) and (thermalSet != nullptr)) {
ReturnValue_t result = thermalSet->read();
- if (result == HasReturnvaluesIF::RETURN_OK) {
+ if (result == returnvalue::OK) {
if ((thermalSet->heaterRequest.value != ThermalComponentIF::STATE_REQUEST_IGNORE) and
(not ThermalComponentIF::isOperational(thermalSet->thermalState.value))) {
triggerEvent(ThermalComponentIF::TEMP_NOT_IN_OP_RANGE, thermalSet->thermalState.value);
@@ -1085,7 +1135,7 @@ void DeviceHandlerBase::handleTransitionToOnMode(Mode_t commandedMode, Submode_t
triggerEvent(CHANGING_MODE, commandedMode, commandedSubmode);
if (thermalSet != nullptr) {
ReturnValue_t result = thermalSet->read();
- if (result == HasReturnvaluesIF::RETURN_OK) {
+ if (result == returnvalue::OK) {
if (thermalSet->heaterRequest != ThermalComponentIF::STATE_REQUEST_IGNORE) {
thermalSet->heaterRequest = ThermalComponentIF::STATE_REQUEST_OPERATIONAL;
thermalSet->commit();
@@ -1120,7 +1170,7 @@ HasHealthIF::HealthState DeviceHandlerBase::getHealth() { return healthHelper.ge
ReturnValue_t DeviceHandlerBase::setHealth(HealthState health) {
healthHelper.setHealth(health);
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
void DeviceHandlerBase::checkSwitchState() {
@@ -1142,7 +1192,7 @@ ReturnValue_t DeviceHandlerBase::acceptExternalDeviceCommands() {
if ((mode != MODE_ON) && (mode != MODE_NORMAL)) {
return WRONG_MODE_FOR_COMMAND;
}
- return RETURN_OK;
+ return returnvalue::OK;
}
void DeviceHandlerBase::replyRawReplyIfnotWiretapped(const uint8_t* data, size_t len) {
@@ -1171,10 +1221,10 @@ ReturnValue_t DeviceHandlerBase::handleDeviceHandlerMessage(CommandMessage* mess
default:
replyReturnvalueToCommand(INVALID_COMMAND_PARAMETER);
wiretappingMode = OFF;
- return RETURN_OK;
+ return returnvalue::OK;
}
- replyReturnvalueToCommand(RETURN_OK);
- return RETURN_OK;
+ replyReturnvalueToCommand(returnvalue::OK);
+ return returnvalue::OK;
case DeviceHandlerMessage::CMD_RAW:
if ((mode != MODE_RAW)) {
DeviceHandlerMessage::clear(message);
@@ -1182,9 +1232,9 @@ ReturnValue_t DeviceHandlerBase::handleDeviceHandlerMessage(CommandMessage* mess
} else {
buildRawDeviceCommand(message);
}
- return RETURN_OK;
+ return returnvalue::OK;
default:
- return RETURN_FAILED;
+ return returnvalue::FAILED;
}
}
@@ -1196,7 +1246,8 @@ void DeviceHandlerBase::setParentQueue(MessageQueueId_t parentQueueId) {
bool DeviceHandlerBase::isAwaitingReply() {
std::map::iterator iter;
for (iter = deviceReplyMap.begin(); iter != deviceReplyMap.end(); ++iter) {
- if (iter->second.delayCycles != 0) {
+ if ((iter->second.delayCycles != 0 && iter->second.countdown == nullptr) ||
+ (iter->second.active && iter->second.countdown != nullptr)) {
return true;
}
}
@@ -1204,31 +1255,33 @@ bool DeviceHandlerBase::isAwaitingReply() {
}
ReturnValue_t DeviceHandlerBase::letChildHandleMessage(CommandMessage* message) {
- return RETURN_FAILED;
+ return returnvalue::FAILED;
}
-void DeviceHandlerBase::handleDeviceTM(SerializeIF* dataSet, DeviceCommandId_t replyId,
- bool forceDirectTm) {
- if (dataSet == nullptr) {
- return;
- }
+void DeviceHandlerBase::handleDeviceTm(const uint8_t* rawData, size_t rawDataLen,
+ DeviceCommandId_t replyId, bool forceDirectTm) {
+ SerialBufferAdapter bufferWrapper(rawData, rawDataLen);
+ handleDeviceTm(bufferWrapper, replyId, forceDirectTm);
+}
- DeviceReplyMap::iterator iter = deviceReplyMap.find(replyId);
+void DeviceHandlerBase::handleDeviceTm(const SerializeIF& dataSet, DeviceCommandId_t replyId,
+ bool forceDirectTm) {
+ auto iter = deviceReplyMap.find(replyId);
if (iter == deviceReplyMap.end()) {
triggerEvent(DEVICE_UNKNOWN_REPLY, replyId);
return;
}
- /* Regular replies to a command */
+ // Regular replies to a command
if (iter->second.command != deviceCommandMap.end()) {
MessageQueueId_t queueId = iter->second.command->second.sendReplyTo;
if (queueId != NO_COMMANDER) {
- /* This may fail, but we'll ignore the fault. */
- actionHelper.reportData(queueId, replyId, dataSet);
+ // This may fail, but we'll ignore the fault.
+ actionHelper.reportData(queueId, replyId, const_cast(&dataSet));
}
- /* This check should make sure we get any TM but don't get anything doubled. */
+ // This check should make sure we get any TM but don't get anything doubled.
if (wiretappingMode == TM && (requestedRawTraffic != queueId)) {
DeviceTmReportingWrapper wrapper(getObjectId(), replyId, dataSet);
actionHelper.reportData(requestedRawTraffic, replyId, &wrapper);
@@ -1239,22 +1292,17 @@ void DeviceHandlerBase::handleDeviceTM(SerializeIF* dataSet, DeviceCommandId_t r
// hiding of sender needed so the service will handle it as
// unexpected Data, no matter what state (progress or completed)
// it is in
- actionHelper.reportData(defaultRawReceiver, replyId, dataSet, true);
+ actionHelper.reportData(defaultRawReceiver, replyId, const_cast(&dataSet),
+ true);
}
}
- /* Unrequested or aperiodic replies */
+ // Unrequested or aperiodic replies
else {
DeviceTmReportingWrapper wrapper(getObjectId(), replyId, dataSet);
if (wiretappingMode == TM) {
actionHelper.reportData(requestedRawTraffic, replyId, &wrapper);
}
if (forceDirectTm and defaultRawReceiver != MessageQueueIF::NO_QUEUE) {
- // sid_t setSid = sid_t(this->getObjectId(), replyId);
- // LocalPoolDataSetBase* dataset = getDataSetHandle(setSid);
- // if(dataset != nullptr) {
- // poolManager.generateHousekeepingPacket(setSid, dataset, true);
- // }
-
// hiding of sender needed so the service will handle it as
// unexpected Data, no matter what state (progress or completed)
// it is in
@@ -1266,7 +1314,7 @@ void DeviceHandlerBase::handleDeviceTM(SerializeIF* dataSet, DeviceCommandId_t r
ReturnValue_t DeviceHandlerBase::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
const uint8_t* data, size_t size) {
ReturnValue_t result = acceptExternalDeviceCommands();
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
DeviceCommandMap::iterator iter = deviceCommandMap.find(actionId);
@@ -1275,10 +1323,10 @@ ReturnValue_t DeviceHandlerBase::executeAction(ActionId_t actionId, MessageQueue
} else if (iter->second.isExecuting) {
result = COMMAND_ALREADY_SENT;
} else {
+ iter->second.sendReplyTo = commandedBy;
result = buildCommandFromCommand(actionId, data, size);
}
- if (result == RETURN_OK) {
- iter->second.sendReplyTo = commandedBy;
+ if (result == returnvalue::OK) {
iter->second.isExecuting = true;
cookieInfo.pendingCommand = iter;
cookieInfo.state = COOKIE_WRITE_READY;
@@ -1295,7 +1343,7 @@ void DeviceHandlerBase::buildInternalCommand(void) {
if (result == BUSY) {
/* So we can track misconfigurations */
printWarningOrError(sif::OutputTypes::OUT_WARNING, "buildInternalCommand",
- HasReturnvaluesIF::RETURN_FAILED, "Busy.");
+ returnvalue::FAILED, "Busy.");
/* No need to report this */
result = NOTHING_TO_SEND;
}
@@ -1311,7 +1359,7 @@ void DeviceHandlerBase::buildInternalCommand(void) {
if (result == NOTHING_TO_SEND) {
return;
}
- if (result == RETURN_OK) {
+ if (result == returnvalue::OK) {
DeviceCommandMap::iterator iter = deviceCommandMap.find(deviceCommandId);
if (iter == deviceCommandMap.end()) {
#if FSFW_VERBOSE_LEVEL >= 1
@@ -1328,7 +1376,7 @@ void DeviceHandlerBase::buildInternalCommand(void) {
sprintf(output, "Command 0x%08x is executing", static_cast(deviceCommandId));
// so we can track misconfigurations
printWarningOrError(sif::OutputTypes::OUT_WARNING, "buildInternalCommand",
- HasReturnvaluesIF::RETURN_FAILED, output);
+ returnvalue::FAILED, output);
#endif
// this is an internal command, no need to report a failure here,
// missed reply will track if a reply is too late, otherwise, it's ok
@@ -1340,7 +1388,7 @@ void DeviceHandlerBase::buildInternalCommand(void) {
cookieInfo.state = COOKIE_WRITE_READY;
}
}
- if (result != RETURN_OK) {
+ if (result != returnvalue::OK) {
triggerEvent(DEVICE_BUILDING_COMMAND_FAILED, result, deviceCommandId);
}
}
@@ -1351,6 +1399,13 @@ uint8_t DeviceHandlerBase::getReplyDelayCycles(DeviceCommandId_t deviceCommand)
DeviceReplyMap::iterator iter = deviceReplyMap.find(deviceCommand);
if (iter == deviceReplyMap.end()) {
return 0;
+ } else if (iter->second.countdown != nullptr) {
+ // fake a useful return value for legacy code
+ if (iter->second.active) {
+ return 1;
+ } else {
+ return 0;
+ }
}
return iter->second.delayCycles;
}
@@ -1409,7 +1464,7 @@ ReturnValue_t DeviceHandlerBase::initializeLocalDataPool(localpool::DataPool& lo
localDataPoolMap.emplace(thermalSet->heaterRequestPoolId,
new PoolEntry);
}
- return RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t DeviceHandlerBase::initializeAfterTaskCreation() {
@@ -1423,7 +1478,7 @@ ReturnValue_t DeviceHandlerBase::initializeAfterTaskCreation() {
if (setStartupImmediately) {
startTransition(MODE_ON, SUBMODE_NONE);
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
LocalPoolDataSetBase* DeviceHandlerBase::getDataSetHandle(sid_t sid) {
@@ -1461,7 +1516,7 @@ void DeviceHandlerBase::printWarningOrError(sif::OutputTypes errorType, const ch
if (errorPrint == nullptr) {
if (errorCode == ObjectManagerIF::CHILD_INIT_FAILED) {
errorPrint = "Initialization error";
- } else if (errorCode == HasReturnvaluesIF::RETURN_FAILED) {
+ } else if (errorCode == returnvalue::FAILED) {
if (errorType == sif::OutputTypes::OUT_WARNING) {
errorPrint = "Generic Warning";
} else {
diff --git a/src/fsfw/devicehandlers/DeviceHandlerBase.h b/src/fsfw/devicehandlers/DeviceHandlerBase.h
index 84dcb8dc..700e960d 100644
--- a/src/fsfw/devicehandlers/DeviceHandlerBase.h
+++ b/src/fsfw/devicehandlers/DeviceHandlerBase.h
@@ -18,7 +18,7 @@
#include "fsfw/objectmanager/SystemObject.h"
#include "fsfw/parameters/ParameterHelper.h"
#include "fsfw/power/PowerSwitchIF.h"
-#include "fsfw/returnvalues/HasReturnvaluesIF.h"
+#include "fsfw/returnvalues/returnvalue.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
#include "fsfw/serviceinterface/serviceInterfaceDefintions.h"
#include "fsfw/tasks/ExecutableObjectIF.h"
@@ -78,7 +78,6 @@ class StorageManagerIF;
* @ingroup devices
*/
class DeviceHandlerBase : public DeviceHandlerIF,
- public HasReturnvaluesIF,
public ExecutableObjectIF,
public SystemObject,
public HasModesIF,
@@ -145,7 +144,7 @@ class DeviceHandlerBase : public DeviceHandlerIF,
* 4. Decrements counter for timeout of replies by calling
* decrementDeviceReplyMap()
* 5. Performs FDIR check for failures
- * 6. If the device mode is MODE_OFF, return RETURN_OK.
+ * 6. If the device mode is MODE_OFF, return returnvalue::OK.
* Otherwise, perform the Action property and performs depending
* on value specified by input value counter (incremented in PST).
* The child class tells base class what to do by setting this value.
@@ -161,7 +160,7 @@ class DeviceHandlerBase : public DeviceHandlerIF,
* - GET_READ: Access requested reading data by calling doGetRead()
* which calls readReceivedMessage of #communicationInterface
* @param counter Specifies which Action to perform
- * @return RETURN_OK for successful execution
+ * @return returnvalue::OK for successful execution
*/
virtual ReturnValue_t performOperation(uint8_t counter) override;
@@ -282,7 +281,7 @@ class DeviceHandlerBase : public DeviceHandlerIF,
*
* @param[out] id the device command id that has been built
* @return
- * - @c RETURN_OK to send command after setting #rawPacket and
+ * - @c returnvalue::OK to send command after setting #rawPacket and
* #rawPacketLen.
* - @c NOTHING_TO_SEND when no command is to be sent.
* - Anything else triggers an even with the returnvalue as a parameter.
@@ -306,7 +305,7 @@ class DeviceHandlerBase : public DeviceHandlerIF,
*
* @param[out] id the device command id built
* @return
- * - @c RETURN_OK when a command is to be sent
+ * - @c returnvalue::OK when a command is to be sent
* - @c NOTHING_TO_SEND when no command is to be sent
* - Anything else triggers an even with the returnvalue as a parameter
*/
@@ -328,7 +327,7 @@ class DeviceHandlerBase : public DeviceHandlerIF,
* @param commandData Pointer to the data from the direct command
* @param commandDataLen Length of commandData
* @return
- * - @c RETURN_OK to send command after #rawPacket and #rawPacketLen
+ * - @c returnvalue::OK to send command after #rawPacket and #rawPacketLen
* have been set.
* - @c HasActionsIF::EXECUTION_COMPLETE to generate a finish reply immediately. This can
* be used if no reply is expected
@@ -358,8 +357,8 @@ class DeviceHandlerBase : public DeviceHandlerIF,
* @param[out] foundLen length of the data found. Is to be set in function,
* buffer is scanned at previous position + foundLen.
* @return
- * - @c RETURN_OK a valid packet was found at @c start, @c foundLen is valid
- * - @c RETURN_FAILED no reply could be found starting at @c start,
+ * - @c returnvalue::OK a valid packet was found at @c start, @c foundLen is valid
+ * - @c returnvalue::FAILED no reply could be found starting at @c start,
* implies @c foundLen is not valid, base class will call scanForReply()
* again with ++start
* - @c DeviceHandlerIF::INVALID_DATA a packet was found but it is invalid,
@@ -388,10 +387,10 @@ class DeviceHandlerBase : public DeviceHandlerIF,
* @param id the id found by scanForReply()
* @param packet
* @return
- * - @c RETURN_OK when the reply was interpreted.
+ * - @c returnvalue::OK when the reply was interpreted.
* - @c IGNORE_REPLY_DATA Ignore the reply and don't reset reply cycle
* counter.
- * - @c RETURN_FAILED when the reply could not be interpreted,
+ * - @c returnvalue::FAILED when the reply could not be interpreted,
* e.g. logical errors or range violations occurred
*/
virtual ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) = 0;
@@ -448,14 +447,18 @@ class DeviceHandlerBase : public DeviceHandlerIF,
* by the device repeatedly without request) or not. Default is aperiodic (0).
* Please note that periodic replies are disabled by default. You can enable them with
* #updatePeriodicReply
- * @return - @c RETURN_OK when the command was successfully inserted,
- * - @c RETURN_FAILED else.
+ * @param countdown Instead of using maxDelayCycles to timeout a device reply it is also possible
+ * to provide a pointer to a Countdown object which will signal the timeout
+ * when expired
+ * @return - @c returnvalue::OK when the command was successfully inserted,
+ * - @c returnvalue::FAILED else.
*/
ReturnValue_t insertInCommandAndReplyMap(DeviceCommandId_t deviceCommand, uint16_t maxDelayCycles,
LocalPoolDataSetBase *replyDataSet = nullptr,
size_t replyLen = 0, bool periodic = false,
bool hasDifferentReplyId = false,
- DeviceCommandId_t replyId = 0);
+ DeviceCommandId_t replyId = 0,
+ Countdown *countdown = nullptr);
/**
* @brief This is a helper method to insert replies in the reply map.
* @param deviceCommand Identifier of the reply to add.
@@ -465,18 +468,21 @@ class DeviceHandlerBase : public DeviceHandlerIF,
* by the device repeatedly without request) or not. Default is aperiodic (0).
* Please note that periodic replies are disabled by default. You can enable them with
* #updatePeriodicReply
- * @return - @c RETURN_OK when the command was successfully inserted,
- * - @c RETURN_FAILED else.
+ * @param countdown Instead of using maxDelayCycles to timeout a device reply it is also possible
+ * to provide a pointer to a Countdown object which will signal the timeout
+ * when expired
+ * @return - @c returnvalue::OK when the command was successfully inserted,
+ * - @c returnvalue::FAILED else.
*/
ReturnValue_t insertInReplyMap(DeviceCommandId_t deviceCommand, uint16_t maxDelayCycles,
LocalPoolDataSetBase *dataSet = nullptr, size_t replyLen = 0,
- bool periodic = false);
+ bool periodic = false, Countdown *countdown = nullptr);
/**
* @brief A simple command to add a command to the commandList.
* @param deviceCommand The command to add
- * @return - @c RETURN_OK when the command was successfully inserted,
- * - @c RETURN_FAILED else.
+ * @return - @c returnvalue::OK when the command was successfully inserted,
+ * - @c returnvalue::FAILED else.
*/
ReturnValue_t insertInCommandMap(DeviceCommandId_t deviceCommand,
bool useAlternativeReply = false,
@@ -512,8 +518,8 @@ class DeviceHandlerBase : public DeviceHandlerIF,
* @param periodic Indicates if the command is periodic (i.e. it is sent
* by the device repeatedly without request) or not. Default is aperiodic (0).
* Warning: The setting always overrides the value that was entered in the map.
- * @return - @c RETURN_OK when the command was successfully inserted,
- * - @c RETURN_FAILED else.
+ * @return - @c returnvalue::OK when the command was successfully inserted,
+ * - @c returnvalue::FAILED else.
*/
ReturnValue_t updateReplyMapEntry(DeviceCommandId_t deviceReply, uint16_t delayCycles,
uint16_t maxDelayCycles, bool periodic = false);
@@ -596,8 +602,8 @@ class DeviceHandlerBase : public DeviceHandlerIF,
* @param mode
* @param submode
* @return
- * - @c RETURN_OK if valid
- * - @c RETURN_FAILED if invalid
+ * - @c returnvalue::OK if valid
+ * - @c returnvalue::FAILED if invalid
*/
virtual ReturnValue_t isModeCombinationValid(Mode_t mode, Submode_t submode);
/**
@@ -616,8 +622,8 @@ class DeviceHandlerBase : public DeviceHandlerIF,
* @param[out] switches pointer to an array of switches
* @param[out] numberOfSwitches length of returned array
* @return
- * - @c RETURN_OK if the parameters were set
- * - @c RETURN_FAILED if no switches exist
+ * - @c returnvalue::OK if the parameters were set
+ * - @c returnvalue::FAILED if no switches exist
*/
virtual ReturnValue_t getSwitches(const uint8_t **switches, uint8_t *numberOfSwitches);
@@ -783,6 +789,11 @@ class DeviceHandlerBase : public DeviceHandlerIF,
LocalPoolDataSetBase *dataSet = nullptr;
//! The command that expects this reply.
DeviceCommandMap::iterator command;
+ //! Instead of using delayCycles to specify the maximum time to wait for the device reply, it
+ //! is also possible specify a countdown
+ Countdown *countdown = nullptr;
+ //! will be set to true when reply is enabled
+ bool active = false;
};
using DeviceReplyMap = std::map;
@@ -966,7 +977,7 @@ class DeviceHandlerBase : public DeviceHandlerIF,
* - A failure code may be returned if something went fundamentally wrong.
*
* @param deviceCommand
- * @return - RETURN_OK if a reply was activated.
+ * @return - returnvalue::OK if a reply was activated.
* - NO_REPLY_EXPECTED if there was no reply found. This is not an
* error case as many commands do not expect a reply.
*/
@@ -993,7 +1004,7 @@ class DeviceHandlerBase : public DeviceHandlerIF,
*
* @param[out] id the device command id built
* @return
- * - @c RETURN_OK when a command is to be sent
+ * - @c returnvalue::OK when a command is to be sent
* - not @c NOTHING_TO_SEND when no command is to be sent
*/
virtual ReturnValue_t buildChildRawCommand();
@@ -1021,7 +1032,7 @@ class DeviceHandlerBase : public DeviceHandlerIF,
* by #switches are on
* - @c PowerSwitchIF::SWITCH_OFF one of the switches specified by
* #switches are off
- * - @c PowerSwitchIF::RETURN_FAILED if an error occured
+ * - @c PowerSwitchIF::returnvalue::FAILED if an error occured
*/
ReturnValue_t getStateOfSwitches();
@@ -1041,9 +1052,25 @@ class DeviceHandlerBase : public DeviceHandlerIF,
bool isAwaitingReply();
- void handleDeviceTM(SerializeIF *dataSet, DeviceCommandId_t replyId, bool forceDirectTm = false);
- // void handleDeviceTM(uint8_t* data, size_t dataSize, DeviceCommandId_t replyId,
- // bool forceDirectTm);
+ /**
+ * Wrapper function for @handleDeviceTm which wraps the raw buffer with @SerialBufferAdapter.
+ * For interpreted data, prefer the other function.
+ * @param rawData
+ * @param rawDataLen
+ * @param replyId
+ * @param forceDirectTm
+ */
+ void handleDeviceTm(const uint8_t *rawData, size_t rawDataLen, DeviceCommandId_t replyId,
+ bool forceDirectTm = false);
+ /**
+ * Can be used to handle Service 8 data replies. This will also generate the TM wiretapping
+ * packets accordingly.
+ * @param dataSet
+ * @param replyId
+ * @param forceDirectTm
+ */
+ void handleDeviceTm(const SerializeIF &dataSet, DeviceCommandId_t replyId,
+ bool forceDirectTm = false);
virtual ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
uint32_t *msToReachTheMode);
@@ -1074,7 +1101,7 @@ class DeviceHandlerBase : public DeviceHandlerIF,
/**
* Checks if current handler state allows reception of external device commands.
* Default implementation allows commands only in plain MODE_ON and MODE_NORMAL.
- * @return RETURN_OK if commands are accepted, anything else otherwise.
+ * @return returnvalue::OK if commands are accepted, anything else otherwise.
*/
virtual ReturnValue_t acceptExternalDeviceCommands();
@@ -1244,6 +1271,17 @@ class DeviceHandlerBase : public DeviceHandlerIF,
*/
void doGetRead(void);
+ /**
+ * @brief Resets replies which use a timeout to detect missed replies.
+ */
+ void resetTimeoutControlledReply(DeviceReplyInfo *info);
+
+ /**
+ * @brief Resets replies which use a number of maximum delay cycles to detect
+ * missed replies.
+ */
+ void resetDelayCyclesControlledReply(DeviceReplyInfo *info);
+
/**
* Retrive data from the #IPCStore.
*
@@ -1251,9 +1289,9 @@ class DeviceHandlerBase : public DeviceHandlerIF,
* @param[out] data
* @param[out] len
* @return
- * - @c RETURN_OK @c data is valid
- * - @c RETURN_FAILED IPCStore is nullptr
- * - the return value from the IPCStore if it was not @c RETURN_OK
+ * - @c returnvalue::OK @c data is valid
+ * - @c returnvalue::FAILED IPCStore is nullptr
+ * - the return value from the IPCStore if it was not @c returnvalue::OK
*/
ReturnValue_t getStorageData(store_address_t storageAddress, uint8_t **data, size_t *len);
@@ -1283,7 +1321,7 @@ class DeviceHandlerBase : public DeviceHandlerIF,
* @param errorPrint
*/
void printWarningOrError(sif::OutputTypes errorType, const char *functionName,
- ReturnValue_t errorCode = HasReturnvaluesIF::RETURN_FAILED,
+ ReturnValue_t errorCode = returnvalue::FAILED,
const char *errorPrint = nullptr);
};
diff --git a/src/fsfw/devicehandlers/DeviceHandlerFailureIsolation.cpp b/src/fsfw/devicehandlers/DeviceHandlerFailureIsolation.cpp
index 48783c20..a3ac9ff7 100644
--- a/src/fsfw/devicehandlers/DeviceHandlerFailureIsolation.cpp
+++ b/src/fsfw/devicehandlers/DeviceHandlerFailureIsolation.cpp
@@ -23,9 +23,9 @@ DeviceHandlerFailureIsolation::~DeviceHandlerFailureIsolation() {}
ReturnValue_t DeviceHandlerFailureIsolation::eventReceived(EventMessage* event) {
if (isFdirInActionOrAreWeFaulty(event)) {
- return RETURN_OK;
+ return returnvalue::OK;
}
- ReturnValue_t result = RETURN_FAILED;
+ ReturnValue_t result = returnvalue::FAILED;
switch (event->getEvent()) {
case HasModesIF::MODE_TRANSITION_FAILED:
case HasModesIF::OBJECT_IN_INVALID_MODE:
@@ -48,7 +48,7 @@ ReturnValue_t DeviceHandlerFailureIsolation::eventReceived(EventMessage* event)
// The two above should never be confirmed.
case DeviceHandlerIF::DEVICE_MISSED_REPLY:
result = sendConfirmationRequest(event);
- if (result == HasReturnvaluesIF::RETURN_OK) {
+ if (result == returnvalue::OK) {
break;
}
// else
@@ -72,7 +72,7 @@ ReturnValue_t DeviceHandlerFailureIsolation::eventReceived(EventMessage* event)
case PowerSwitchIF::SWITCH_WENT_OFF:
if (powerConfirmation != MessageQueueIF::NO_QUEUE) {
result = sendConfirmationRequest(event, powerConfirmation);
- if (result == RETURN_OK) {
+ if (result == returnvalue::OK) {
setFdirState(DEVICE_MIGHT_BE_OFF);
}
}
@@ -106,9 +106,9 @@ ReturnValue_t DeviceHandlerFailureIsolation::eventReceived(EventMessage* event)
// break;
default:
// We don't know the event, someone else should handle it.
- return RETURN_FAILED;
+ return returnvalue::FAILED;
}
- return RETURN_OK;
+ return returnvalue::OK;
}
void DeviceHandlerFailureIsolation::eventConfirmed(EventMessage* event) {
@@ -162,7 +162,7 @@ void DeviceHandlerFailureIsolation::clearFaultCounters() {
ReturnValue_t DeviceHandlerFailureIsolation::initialize() {
ReturnValue_t result = FailureIsolationBase::initialize();
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "DeviceHandlerFailureIsolation::initialize: Could not"
" initialize FailureIsolationBase."
@@ -176,7 +176,7 @@ ReturnValue_t DeviceHandlerFailureIsolation::initialize() {
powerConfirmation = power->getEventReceptionQueue();
}
- return RETURN_OK;
+ return returnvalue::OK;
}
void DeviceHandlerFailureIsolation::setFdirState(FDIRState state) {
diff --git a/src/fsfw/devicehandlers/DeviceTmReportingWrapper.cpp b/src/fsfw/devicehandlers/DeviceTmReportingWrapper.cpp
index 3da431dc..8fc0d368 100644
--- a/src/fsfw/devicehandlers/DeviceTmReportingWrapper.cpp
+++ b/src/fsfw/devicehandlers/DeviceTmReportingWrapper.cpp
@@ -3,38 +3,30 @@
#include "fsfw/serialize/SerializeAdapter.h"
DeviceTmReportingWrapper::DeviceTmReportingWrapper(object_id_t objectId, ActionId_t actionId,
- SerializeIF* data)
+ const SerializeIF& data)
: objectId(objectId), actionId(actionId), data(data) {}
-DeviceTmReportingWrapper::~DeviceTmReportingWrapper() {}
+DeviceTmReportingWrapper::~DeviceTmReportingWrapper() = default;
ReturnValue_t DeviceTmReportingWrapper::serialize(uint8_t** buffer, size_t* size, size_t maxSize,
Endianness streamEndianness) const {
ReturnValue_t result =
SerializeAdapter::serialize(&objectId, buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::serialize(&actionId, buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
- return data->serialize(buffer, size, maxSize, streamEndianness);
+ return data.serialize(buffer, size, maxSize, streamEndianness);
}
size_t DeviceTmReportingWrapper::getSerializedSize() const {
- return sizeof(objectId) + sizeof(ActionId_t) + data->getSerializedSize();
+ return sizeof(objectId) + sizeof(ActionId_t) + data.getSerializedSize();
}
ReturnValue_t DeviceTmReportingWrapper::deSerialize(const uint8_t** buffer, size_t* size,
Endianness streamEndianness) {
- ReturnValue_t result = SerializeAdapter::deSerialize(&objectId, buffer, size, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
- return result;
- }
- result = SerializeAdapter::deSerialize(&actionId, buffer, size, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
- return result;
- }
- return data->deSerialize(buffer, size, streamEndianness);
+ return returnvalue::FAILED;
}
diff --git a/src/fsfw/devicehandlers/DeviceTmReportingWrapper.h b/src/fsfw/devicehandlers/DeviceTmReportingWrapper.h
index 71c64453..ae385f4c 100644
--- a/src/fsfw/devicehandlers/DeviceTmReportingWrapper.h
+++ b/src/fsfw/devicehandlers/DeviceTmReportingWrapper.h
@@ -7,21 +7,22 @@
class DeviceTmReportingWrapper : public SerializeIF {
public:
- DeviceTmReportingWrapper(object_id_t objectId, ActionId_t actionId, SerializeIF* data);
- virtual ~DeviceTmReportingWrapper();
+ DeviceTmReportingWrapper(object_id_t objectId, ActionId_t actionId, const SerializeIF& data);
+ ~DeviceTmReportingWrapper() override;
- virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize,
- Endianness streamEndianness) const override;
+ ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize,
+ Endianness streamEndianness) const override;
- virtual size_t getSerializedSize() const override;
-
- virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
- Endianness streamEndianness) override;
+ [[nodiscard]] size_t getSerializedSize() const override;
private:
object_id_t objectId;
ActionId_t actionId;
- SerializeIF* data;
+ const SerializeIF& data;
+
+ // Deserialization forbidden
+ ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
+ Endianness streamEndianness) override;
};
#endif /* FSFW_DEVICEHANDLERS_DEVICETMREPORTINGWRAPPER_H_ */
diff --git a/src/fsfw/devicehandlers/HealthDevice.cpp b/src/fsfw/devicehandlers/HealthDevice.cpp
index a626fa6c..4c09964a 100644
--- a/src/fsfw/devicehandlers/HealthDevice.cpp
+++ b/src/fsfw/devicehandlers/HealthDevice.cpp
@@ -16,7 +16,7 @@ HealthDevice::~HealthDevice() { QueueFactory::instance()->deleteMessageQueue(com
ReturnValue_t HealthDevice::performOperation(uint8_t opCode) {
CommandMessage command;
ReturnValue_t result = commandQueue->receiveMessage(&command);
- if (result == HasReturnvaluesIF::RETURN_OK) {
+ if (result == returnvalue::OK) {
result = healthHelper.handleHealthCommand(&command);
}
return result;
@@ -24,7 +24,7 @@ ReturnValue_t HealthDevice::performOperation(uint8_t opCode) {
ReturnValue_t HealthDevice::initialize() {
ReturnValue_t result = SystemObject::initialize();
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
if (parentQueue != 0) {
@@ -50,7 +50,7 @@ bool HealthDevice::hasHealthChanged() {
ReturnValue_t HealthDevice::setHealth(HealthState health) {
healthHelper.setHealth(health);
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
HasHealthIF::HealthState HealthDevice::getHealth() { return healthHelper.getHealth(); }
diff --git a/src/fsfw/events/Event.h b/src/fsfw/events/Event.h
index ecab0493..e48736bf 100644
--- a/src/fsfw/events/Event.h
+++ b/src/fsfw/events/Event.h
@@ -4,8 +4,6 @@
#include
#include "fwSubsystemIdRanges.h"
-// could be moved to more suitable location
-#include
using EventId_t = uint16_t;
using EventSeverity_t = uint8_t;
diff --git a/src/fsfw/events/EventManager.cpp b/src/fsfw/events/EventManager.cpp
index aaa7d6c5..f4466817 100644
--- a/src/fsfw/events/EventManager.cpp
+++ b/src/fsfw/events/EventManager.cpp
@@ -30,18 +30,18 @@ EventManager::~EventManager() {
MessageQueueId_t EventManager::getEventReportQueue() { return eventReportQueue->getId(); }
ReturnValue_t EventManager::performOperation(uint8_t opCode) {
- ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
- while (result == HasReturnvaluesIF::RETURN_OK) {
+ ReturnValue_t result = returnvalue::OK;
+ while (result == returnvalue::OK) {
EventMessage message;
result = eventReportQueue->receiveMessage(&message);
- if (result == HasReturnvaluesIF::RETURN_OK) {
+ if (result == returnvalue::OK) {
#if FSFW_OBJ_EVENT_TRANSLATION == 1
printEvent(&message);
#endif
notifyListeners(&message);
}
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
void EventManager::notifyListeners(EventMessage* message) {
@@ -59,9 +59,9 @@ ReturnValue_t EventManager::registerListener(MessageQueueId_t listener,
auto result = listenerList.insert(std::pair(
listener, EventMatchTree(&factoryBackend, forwardAllButSelected)));
if (!result.second) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t EventManager::subscribeToEvent(MessageQueueId_t listener, EventId_t event) {
@@ -88,6 +88,11 @@ ReturnValue_t EventManager::subscribeToEventRange(MessageQueueId_t listener, Eve
return result;
}
+ReturnValue_t EventManager::unsubscribeFromAllEvents(MessageQueueId_t listener,
+ object_id_t object) {
+ return unsubscribeFromEventRange(listener, 0, 0, true, object);
+}
+
ReturnValue_t EventManager::unsubscribeFromEventRange(MessageQueueId_t listener, EventId_t idFrom,
EventId_t idTo, bool idInverted,
object_id_t reporterFrom,
diff --git a/src/fsfw/events/EventManager.h b/src/fsfw/events/EventManager.h
index f2d642ff..70245f5d 100644
--- a/src/fsfw/events/EventManager.h
+++ b/src/fsfw/events/EventManager.h
@@ -37,6 +37,7 @@ class EventManager : public EventManagerIF, public ExecutableObjectIF, public Sy
EventId_t idTo = 0, bool idInverted = false,
object_id_t reporterFrom = 0, object_id_t reporterTo = 0,
bool reporterInverted = false);
+ ReturnValue_t unsubscribeFromAllEvents(MessageQueueId_t listener, object_id_t object);
ReturnValue_t unsubscribeFromEventRange(MessageQueueId_t listener, EventId_t idFrom = 0,
EventId_t idTo = 0, bool idInverted = false,
object_id_t reporterFrom = 0, object_id_t reporterTo = 0,
diff --git a/src/fsfw/events/EventManagerIF.h b/src/fsfw/events/EventManagerIF.h
index 98051ba0..adb61f2b 100644
--- a/src/fsfw/events/EventManagerIF.h
+++ b/src/fsfw/events/EventManagerIF.h
@@ -20,6 +20,7 @@ class EventManagerIF {
bool forwardAllButSelected = false) = 0;
virtual ReturnValue_t subscribeToEvent(MessageQueueId_t listener, EventId_t event) = 0;
virtual ReturnValue_t subscribeToAllEventsFrom(MessageQueueId_t listener, object_id_t object) = 0;
+ virtual ReturnValue_t unsubscribeFromAllEvents(MessageQueueId_t listener, object_id_t object) = 0;
virtual ReturnValue_t subscribeToEventRange(MessageQueueId_t listener, EventId_t idFrom = 0,
EventId_t idTo = 0, bool idInverted = false,
object_id_t reporterFrom = 0,
diff --git a/src/fsfw/events/eventmatching/EventMatchTree.cpp b/src/fsfw/events/eventmatching/EventMatchTree.cpp
index b564e305..cd3da6a2 100644
--- a/src/fsfw/events/eventmatching/EventMatchTree.cpp
+++ b/src/fsfw/events/eventmatching/EventMatchTree.cpp
@@ -31,12 +31,12 @@ ReturnValue_t EventMatchTree::addMatch(EventId_t idFrom, EventId_t idTo, bool id
iterator lastTest;
ReturnValue_t result = findOrInsertRangeMatcher(
begin(), idFrom, idTo, idInverted, &lastTest);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
if (reporterFrom == 0) {
// No need to add another AND branch
- return RETURN_OK;
+ return returnvalue::OK;
}
if (reporterTo == 0) {
reporterTo = reporterFrom;
@@ -95,7 +95,7 @@ inline ReturnValue_t EventMatchTree::findOrInsertRangeMatcher(iterator start, VA
if ((matcher->rangeMatcher.lowerBound == idFrom) &&
(matcher->rangeMatcher.upperBound == idTo) &&
(matcher->rangeMatcher.inverted == inverted)) {
- return RETURN_OK;
+ return returnvalue::OK;
} else {
iter = iter.right();
}
@@ -115,9 +115,9 @@ inline ReturnValue_t EventMatchTree::findOrInsertRangeMatcher(iterator start, VA
*lastTest = insert(attachToBranch, *lastTest, newNode);
if (*lastTest == end()) {
// This actaully never fails, so creating a dedicated returncode seems an overshoot.
- return RETURN_FAILED;
+ return returnvalue::FAILED;
}
- return RETURN_OK;
+ return returnvalue::OK;
}
template
diff --git a/src/fsfw/events/eventmatching/EventMatchTree.h b/src/fsfw/events/eventmatching/EventMatchTree.h
index 010e0623..0d06f0c2 100644
--- a/src/fsfw/events/eventmatching/EventMatchTree.h
+++ b/src/fsfw/events/eventmatching/EventMatchTree.h
@@ -4,10 +4,10 @@
#include "../../container/PlacementFactory.h"
#include "../../events/EventMessage.h"
#include "../../globalfunctions/matching/MatchTree.h"
-#include "../../returnvalues/HasReturnvaluesIF.h"
+#include "../../returnvalues/returnvalue.h"
class StorageManagerIF;
-class EventMatchTree : public MatchTree, public HasReturnvaluesIF {
+class EventMatchTree : public MatchTree {
public:
EventMatchTree(StorageManagerIF* storageBackend, bool invertedMatch);
virtual ~EventMatchTree();
diff --git a/src/fsfw/fdir/ConfirmsFailuresIF.h b/src/fsfw/fdir/ConfirmsFailuresIF.h
index e4d26907..4424747e 100644
--- a/src/fsfw/fdir/ConfirmsFailuresIF.h
+++ b/src/fsfw/fdir/ConfirmsFailuresIF.h
@@ -2,7 +2,7 @@
#define FRAMEWORK_FDIR_CONFIRMSFAILURESIF_H_
#include "../ipc/MessageQueueSenderIF.h"
-#include "../returnvalues/HasReturnvaluesIF.h"
+#include "../returnvalues/returnvalue.h"
class ConfirmsFailuresIF {
public:
diff --git a/src/fsfw/fdir/FailureIsolationBase.cpp b/src/fsfw/fdir/FailureIsolationBase.cpp
index fedef869..28df16d8 100644
--- a/src/fsfw/fdir/FailureIsolationBase.cpp
+++ b/src/fsfw/fdir/FailureIsolationBase.cpp
@@ -14,6 +14,16 @@ FailureIsolationBase::FailureIsolationBase(object_id_t owner, object_id_t parent
}
FailureIsolationBase::~FailureIsolationBase() {
+ EventManagerIF* manager = ObjectManager::instance()->get(objects::EVENT_MANAGER);
+ if (manager == nullptr) {
+#if FSFW_CPP_OSTREAM_ENABLED == 1
+ sif::error << "FailureIsolationBase::~FailureIsolationBase: Event Manager has not"
+ " been initialized!"
+ << std::endl;
+#endif
+ return;
+ }
+ manager->unsubscribeFromAllEvents(eventQueue->getId(), ownerId);
QueueFactory::instance()->deleteMessageQueue(eventQueue);
}
@@ -25,15 +35,15 @@ ReturnValue_t FailureIsolationBase::initialize() {
" been initialized!"
<< std::endl;
#endif
- return RETURN_FAILED;
+ return returnvalue::FAILED;
}
ReturnValue_t result = manager->registerListener(eventQueue->getId());
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
if (ownerId != objects::NO_OBJECT) {
result = manager->subscribeToAllEventsFrom(eventQueue->getId(), ownerId);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
owner = ObjectManager::instance()->get(ownerId);
@@ -58,16 +68,16 @@ ReturnValue_t FailureIsolationBase::initialize() {
sif::error << "Make sure it implements ConfirmsFailuresIF." << std::endl;
#endif
return ObjectManagerIF::CHILD_INIT_FAILED;
- return RETURN_FAILED;
+ return returnvalue::FAILED;
}
eventQueue->setDefaultDestination(parentIF->getEventReceptionQueue());
}
- return RETURN_OK;
+ return returnvalue::OK;
}
void FailureIsolationBase::checkForFailures() {
EventMessage event;
- for (ReturnValue_t result = eventQueue->receiveMessage(&event); result == RETURN_OK;
+ for (ReturnValue_t result = eventQueue->receiveMessage(&event); result == returnvalue::OK;
result = eventQueue->receiveMessage(&event)) {
if (event.getSender() == eventQueue->getId()) {
// We already got this event, because we sent it.
@@ -114,7 +124,7 @@ ReturnValue_t FailureIsolationBase::sendConfirmationRequest(EventMessage* event,
} else if (faultTreeParent != objects::NO_OBJECT) {
return eventQueue->sendToDefault(event);
}
- return RETURN_FAILED;
+ return returnvalue::FAILED;
}
void FailureIsolationBase::eventConfirmed(EventMessage* event) {}
diff --git a/src/fsfw/fdir/FailureIsolationBase.h b/src/fsfw/fdir/FailureIsolationBase.h
index 85d18add..543ad6cc 100644
--- a/src/fsfw/fdir/FailureIsolationBase.h
+++ b/src/fsfw/fdir/FailureIsolationBase.h
@@ -5,13 +5,11 @@
#include "../health/HealthMessage.h"
#include "../ipc/MessageQueueIF.h"
#include "../parameters/HasParametersIF.h"
-#include "../returnvalues/HasReturnvaluesIF.h"
+#include "../returnvalues/returnvalue.h"
#include "ConfirmsFailuresIF.h"
#include "FaultCounter.h"
-class FailureIsolationBase : public HasReturnvaluesIF,
- public ConfirmsFailuresIF,
- public HasParametersIF {
+class FailureIsolationBase : public ConfirmsFailuresIF, public HasParametersIF {
public:
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::FDIR_1;
static const Event FDIR_CHANGED_STATE =
diff --git a/src/fsfw/fdir/FaultCounter.cpp b/src/fsfw/fdir/FaultCounter.cpp
index e87cf613..eea08817 100644
--- a/src/fsfw/fdir/FaultCounter.cpp
+++ b/src/fsfw/fdir/FaultCounter.cpp
@@ -60,20 +60,20 @@ ReturnValue_t FaultCounter::getParameter(uint8_t domainId, uint8_t uniqueId,
return INVALID_DOMAIN_ID;
}
- switch (uniqueId) {
- case 0:
+ switch (static_cast(uniqueId)) {
+ case ParameterIds::FAILURE_THRESHOLD:
parameterWrapper->set(failureThreshold);
break;
- case 1:
+ case ParameterIds::FAULT_COUNT:
parameterWrapper->set(faultCount);
break;
- case 2:
+ case ParameterIds::TIMEOUT:
parameterWrapper->set(timer.timeout);
break;
default:
return INVALID_IDENTIFIER_ID;
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
void FaultCounter::setParameterDomain(uint8_t domain) { parameterDomain = domain; }
diff --git a/src/fsfw/fdir/FaultCounter.h b/src/fsfw/fdir/FaultCounter.h
index 3b59885c..cca780d6 100644
--- a/src/fsfw/fdir/FaultCounter.h
+++ b/src/fsfw/fdir/FaultCounter.h
@@ -6,6 +6,8 @@
class FaultCounter : public HasParametersIF {
public:
+ enum class ParameterIds { FAILURE_THRESHOLD, FAULT_COUNT, TIMEOUT };
+
FaultCounter();
FaultCounter(uint32_t failureThreshold, uint32_t decrementAfterMs,
uint8_t setParameterDomain = 0);
@@ -25,7 +27,8 @@ class FaultCounter : public HasParametersIF {
virtual ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId,
ParameterWrapper *parameterWrapper,
- const ParameterWrapper *newValues, uint16_t startAtIndex);
+ const ParameterWrapper *newValues = nullptr,
+ uint16_t startAtIndex = 0);
void setParameterDomain(uint8_t domain);
diff --git a/src/fsfw/globalfunctions/AsciiConverter.cpp b/src/fsfw/globalfunctions/AsciiConverter.cpp
index 6d49c777..b99814cb 100644
--- a/src/fsfw/globalfunctions/AsciiConverter.cpp
+++ b/src/fsfw/globalfunctions/AsciiConverter.cpp
@@ -44,7 +44,7 @@ ReturnValue_t AsciiConverter::scanAsciiHexByte(const uint8_t** dataPtr, uint8_t*
*value = *value >> 4;
}
- return RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t AsciiConverter::scanAsciiDecimalNumber_(uint8_t const** dataPtr, uint8_t len,
@@ -99,7 +99,7 @@ ReturnValue_t AsciiConverter::scanAsciiDecimalNumber_(uint8_t const** dataPtr, u
*dataPtr = ptr;
- return RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t AsciiConverter::printFloat(uint8_t* buffer, uint32_t bufferLength, float value,
@@ -124,7 +124,7 @@ ReturnValue_t AsciiConverter::printFloat(uint8_t* buffer, uint32_t bufferLength,
ReturnValue_t result =
printInteger(buffer + streamposition, bufferLength - streamposition - decimalPlaces - 1,
value, &integerSize);
- if (result != RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
streamposition += integerSize;
@@ -161,7 +161,7 @@ ReturnValue_t AsciiConverter::printInteger(uint8_t* buffer, uint32_t bufferLengt
}
if (!leadingZeros && (value == 0)) {
buffer[(*printedSize)++] = '0';
- return RETURN_OK;
+ return returnvalue::OK;
}
while (maximumNumber >= 1) {
uint8_t number = value / maximumNumber;
@@ -174,7 +174,7 @@ ReturnValue_t AsciiConverter::printInteger(uint8_t* buffer, uint32_t bufferLengt
maximumNumber /= 10;
}
}
- return RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t AsciiConverter::printSignedInteger(uint8_t* buffer, uint32_t bufferLength,
diff --git a/src/fsfw/globalfunctions/AsciiConverter.h b/src/fsfw/globalfunctions/AsciiConverter.h
index db382b61..e6cd60a7 100644
--- a/src/fsfw/globalfunctions/AsciiConverter.h
+++ b/src/fsfw/globalfunctions/AsciiConverter.h
@@ -1,9 +1,9 @@
#ifndef ASCIICONVERTER_H_
#define ASCIICONVERTER_H_
-#include "../returnvalues/HasReturnvaluesIF.h"
+#include "../returnvalues/returnvalue.h"
-class AsciiConverter : public HasReturnvaluesIF {
+class AsciiConverter {
public:
static const uint8_t INTERFACE_ID = CLASS_ID::ASCII_CONVERTER;
static const ReturnValue_t TOO_LONG_FOR_TARGET_TYPE = MAKE_RETURN_CODE(1);
diff --git a/src/fsfw/globalfunctions/DleEncoder.cpp b/src/fsfw/globalfunctions/DleEncoder.cpp
index 23caf02a..c93b37c3 100644
--- a/src/fsfw/globalfunctions/DleEncoder.cpp
+++ b/src/fsfw/globalfunctions/DleEncoder.cpp
@@ -73,7 +73,7 @@ ReturnValue_t DleEncoder::encodeStreamEscaped(const uint8_t *sourceStream, size_
++encodedIndex;
}
*encodedLen = encodedIndex;
- return RETURN_OK;
+ return returnvalue::OK;
} else {
return STREAM_TOO_SHORT;
}
@@ -119,7 +119,7 @@ ReturnValue_t DleEncoder::encodeStreamNonEscaped(const uint8_t *sourceStream, si
destStream[encodedIndex++] = ETX_CHAR;
}
*encodedLen = encodedIndex;
- return RETURN_OK;
+ return returnvalue::OK;
} else {
return STREAM_TOO_SHORT;
}
@@ -191,7 +191,7 @@ ReturnValue_t DleEncoder::decodeStreamEscaped(const uint8_t *sourceStream, size_
case (ETX_CHAR): {
*readLen = ++encodedIndex;
*decodedLen = decodedIndex;
- return RETURN_OK;
+ return returnvalue::OK;
}
default: {
destStream[decodedIndex] = sourceStream[encodedIndex];
@@ -255,7 +255,7 @@ ReturnValue_t DleEncoder::decodeStreamNonEscaped(const uint8_t *sourceStream,
// End of stream reached
*readLen = encodedIndex + 2;
*decodedLen = decodedIndex;
- return RETURN_OK;
+ return returnvalue::OK;
} else {
*readLen = encodedIndex;
return DECODING_ERROR;
diff --git a/src/fsfw/globalfunctions/DleEncoder.h b/src/fsfw/globalfunctions/DleEncoder.h
index 009c8656..b7242ebe 100644
--- a/src/fsfw/globalfunctions/DleEncoder.h
+++ b/src/fsfw/globalfunctions/DleEncoder.h
@@ -3,7 +3,7 @@
#include
-#include "fsfw/returnvalues/HasReturnvaluesIF.h"
+#include "fsfw/returnvalues/returnvalue.h"
/**
* @brief This DLE Encoder (Data Link Encoder) can be used to encode and
@@ -30,7 +30,7 @@
* are escaped with DLE. If the receiver detects a DLE char, it needs to read the next char
* to determine whether a start (STX) or end (ETX) of a frame has been detected.
*/
-class DleEncoder : public HasReturnvaluesIF {
+class DleEncoder {
public:
/**
* Create an encoder instance with the given configuration.
@@ -72,7 +72,7 @@ class DleEncoder : public HasReturnvaluesIF {
* @param addStxEtx Adding STX start marker and ETX end marker can be omitted,
* if they are added manually
* @return
- * - RETURN_OK for successful encoding operation
+ * - returnvalue::OK for successful encoding operation
* - STREAM_TOO_SHORT if the destination stream is too short
*/
ReturnValue_t encode(const uint8_t *sourceStream, size_t sourceLen, uint8_t *destStream,
@@ -87,7 +87,7 @@ class DleEncoder : public HasReturnvaluesIF {
* @param maxDestStreamlen
* @param decodedLen
* @return
- * - RETURN_OK for successful decode operation
+ * - returnvalue::OK for successful decode operation
* - DECODE_ERROR if the source stream is invalid
* - STREAM_TOO_SHORT if the destination stream is too short
*/
diff --git a/src/fsfw/globalfunctions/Type.cpp b/src/fsfw/globalfunctions/Type.cpp
index 71193673..42c6817e 100644
--- a/src/fsfw/globalfunctions/Type.cpp
+++ b/src/fsfw/globalfunctions/Type.cpp
@@ -52,12 +52,12 @@ ReturnValue_t Type::serialize(uint8_t** buffer, size_t* size, size_t maxSize,
uint8_t ptc;
uint8_t pfc;
ReturnValue_t result = getPtcPfc(&ptc, &pfc);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::serialize(&ptc, buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
@@ -75,18 +75,18 @@ ReturnValue_t Type::deSerialize(const uint8_t** buffer, size_t* size, Endianness
uint8_t ptc;
uint8_t pfc;
ReturnValue_t result = SerializeAdapter::deSerialize(&ptc, buffer, size, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::deSerialize(&pfc, buffer, size, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
actualType = getActualType(ptc, pfc);
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t Type::getPtcPfc(uint8_t* ptc, uint8_t* pfc) const {
@@ -124,9 +124,9 @@ ReturnValue_t Type::getPtcPfc(uint8_t* ptc, uint8_t* pfc) const {
*pfc = 2;
break;
default:
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
Type::ActualType_t Type::getActualType(uint8_t ptc, uint8_t pfc) {
diff --git a/src/fsfw/globalfunctions/Type.h b/src/fsfw/globalfunctions/Type.h
index 385d7219..918ba4e8 100644
--- a/src/fsfw/globalfunctions/Type.h
+++ b/src/fsfw/globalfunctions/Type.h
@@ -3,7 +3,7 @@
#include
-#include "fsfw/returnvalues/HasReturnvaluesIF.h"
+#include "fsfw/returnvalues/returnvalue.h"
#include "fsfw/serialize/SerializeIF.h"
/**
diff --git a/src/fsfw/globalfunctions/matching/MatchTree.h b/src/fsfw/globalfunctions/matching/MatchTree.h
index ec98e22a..0c31cf2a 100644
--- a/src/fsfw/globalfunctions/matching/MatchTree.h
+++ b/src/fsfw/globalfunctions/matching/MatchTree.h
@@ -40,34 +40,34 @@ class MatchTree : public SerializeableMatcherIF, public BinaryTreecountRight(iter);
ReturnValue_t result =
SerializeAdapter::serialize(&count, buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
if (iter == this->end()) {
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
result = iter->serialize(buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
if (maxDepth > 0) {
MatchTree temp(iter.left(), maxDepth - 1);
result = temp.serialize(buffer, size, maxSize, streamEndianness);
}
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
iter = iter.right();
while (iter != this->end()) {
result = iter->serialize(buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
if (maxDepth > 0) {
MatchTree temp(iter.left(), maxDepth - 1);
result = temp.serialize(buffer, size, maxSize, streamEndianness);
}
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
iter = iter.right();
@@ -106,7 +106,7 @@ class MatchTree : public SerializeableMatcherIF, public BinaryTree, public BinaryTreeerase(position);
- ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
+ ReturnValue_t result = returnvalue::OK;
if (children.first != this->end()) {
result = removeElementAndAllChildren(children.first);
}
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
if (children.second != this->end()) {
result = removeElementAndAllChildren(children.second);
}
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
// Delete element itself.
@@ -143,13 +143,13 @@ class MatchTree : public SerializeableMatcherIF, public BinaryTreeend()) {
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
// Delete everything from the AND branch.
- ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
+ ReturnValue_t result = returnvalue::OK;
if (position.left() != this->end()) {
result = removeElementAndAllChildren(position.left());
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
}
@@ -176,7 +176,7 @@ class MatchTree : public SerializeableMatcherIF, public BinaryTree {
SerializeIF::Endianness streamEndianness) const override {
ReturnValue_t result =
SerializeAdapter::serialize(&lowerBound, buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::serialize(&upperBound, buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
return SerializeAdapter::serialize(&inverted, buffer, size, maxSize, streamEndianness);
@@ -45,11 +45,11 @@ class RangeMatcher : public SerializeableMatcherIF {
SerializeIF::Endianness streamEndianness) override {
ReturnValue_t result =
SerializeAdapter::deSerialize(&lowerBound, buffer, size, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::deSerialize(&upperBound, buffer, size, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
return SerializeAdapter::deSerialize(&inverted, buffer, size, streamEndianness);
diff --git a/src/fsfw/health/HasHealthIF.h b/src/fsfw/health/HasHealthIF.h
index 41abeef3..77a1c12f 100644
--- a/src/fsfw/health/HasHealthIF.h
+++ b/src/fsfw/health/HasHealthIF.h
@@ -3,7 +3,7 @@
#include "../events/Event.h"
#include "../ipc/MessageQueueSenderIF.h"
-#include "../returnvalues/HasReturnvaluesIF.h"
+#include "../returnvalues/returnvalue.h"
class HasHealthIF {
public:
diff --git a/src/fsfw/health/HealthHelper.cpp b/src/fsfw/health/HealthHelper.cpp
index 4bef128c..bf1a92d2 100644
--- a/src/fsfw/health/HealthHelper.cpp
+++ b/src/fsfw/health/HealthHelper.cpp
@@ -5,19 +5,19 @@
HealthHelper::HealthHelper(HasHealthIF* owner, object_id_t objectId)
: objectId(objectId), owner(owner) {}
-HealthHelper::~HealthHelper() {}
+HealthHelper::~HealthHelper() { healthTable->removeObject(objectId); }
ReturnValue_t HealthHelper::handleHealthCommand(CommandMessage* message) {
switch (message->getCommand()) {
case HealthMessage::HEALTH_SET:
handleSetHealthCommand(message);
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
case HealthMessage::HEALTH_ANNOUNCE: {
eventSender->forwardEvent(HasHealthIF::HEALTH_INFO, getHealth(), getHealth());
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
default:
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
}
@@ -53,10 +53,10 @@ ReturnValue_t HealthHelper::initialize() {
}
ReturnValue_t result = healthTable->registerObject(objectId, HasHealthIF::HEALTHY);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
void HealthHelper::setHealth(HasHealthIF::HealthState health) {
@@ -76,7 +76,7 @@ void HealthHelper::informParent(HasHealthIF::HealthState health,
CommandMessage information;
HealthMessage::setHealthMessage(&information, HealthMessage::HEALTH_INFO, health, oldHealth);
if (MessageQueueSenderIF::sendMessage(parentQueue, &information, owner->getCommandQueue()) !=
- HasReturnvaluesIF::RETURN_OK) {
+ returnvalue::OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::debug << "HealthHelper::informParent: sending health reply failed." << std::endl;
#endif
@@ -89,13 +89,13 @@ void HealthHelper::handleSetHealthCommand(CommandMessage* command) {
return;
}
CommandMessage reply;
- if (result == HasReturnvaluesIF::RETURN_OK) {
+ if (result == returnvalue::OK) {
HealthMessage::setHealthMessage(&reply, HealthMessage::REPLY_HEALTH_SET);
} else {
reply.setReplyRejected(result, command->getCommand());
}
if (MessageQueueSenderIF::sendMessage(command->getSender(), &reply, owner->getCommandQueue()) !=
- HasReturnvaluesIF::RETURN_OK) {
+ returnvalue::OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::debug << "HealthHelper::handleHealthCommand: sending health "
"reply failed."
diff --git a/src/fsfw/health/HealthHelper.h b/src/fsfw/health/HealthHelper.h
index 9b3b0e2b..6b550f90 100644
--- a/src/fsfw/health/HealthHelper.h
+++ b/src/fsfw/health/HealthHelper.h
@@ -5,7 +5,7 @@
#include "../events/EventReportingProxyIF.h"
#include "../ipc/MessageQueueIF.h"
#include "../objectmanager/ObjectManagerIF.h"
-#include "../returnvalues/HasReturnvaluesIF.h"
+#include "../returnvalues/returnvalue.h"
#include "HasHealthIF.h"
#include "HealthMessage.h"
#include "HealthTableIF.h"
@@ -55,8 +55,8 @@ class HealthHelper {
*
* @param message
* @return
- * -@c RETURN_OK if the message was handled
- * -@c RETURN_FAILED if the message could not be handled
+ * -@c returnvalue::OK if the message was handled
+ * -@c returnvalue::FAILED if the message could not be handled
* (ie it was not a @c HEALTH_SET or @c HEALTH_READ message)
*/
ReturnValue_t handleHealthCommand(CommandMessage* message);
@@ -88,9 +88,9 @@ class HealthHelper {
* @param parentQueue The queue ID of the parent object.
* Set to 0 if no parent present
* @return
- * -@c RETURN_OK if the Health Table was found and the object
+ * -@c returnvalue::OK if the Health Table was found and the object
* could be registered
- * -@c RETURN_FAILED else
+ * -@c returnvalue::FAILED else
*/
ReturnValue_t initialize(MessageQueueId_t parentQueue);
diff --git a/src/fsfw/health/HealthTable.cpp b/src/fsfw/health/HealthTable.cpp
index ab4881f4..5fb45fb9 100644
--- a/src/fsfw/health/HealthTable.cpp
+++ b/src/fsfw/health/HealthTable.cpp
@@ -21,10 +21,19 @@ HealthTable::~HealthTable() { MutexFactory::instance()->deleteMutex(mutex); }
ReturnValue_t HealthTable::registerObject(object_id_t object,
HasHealthIF::HealthState initilialState) {
if (healthMap.count(object) != 0) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
healthMap.emplace(object, initilialState);
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
+}
+
+ReturnValue_t HealthTable::removeObject(object_id_t object) {
+ mapIterator = healthMap.find(object);
+ if (mapIterator == healthMap.end()) {
+ return returnvalue::FAILED;
+ }
+ healthMap.erase(mapIterator);
+ return returnvalue::OK;
}
void HealthTable::setHealth(object_id_t object, HasHealthIF::HealthState newState) {
@@ -67,7 +76,7 @@ void HealthTable::printAll(uint8_t* pointer, size_t maxSize) {
uint16_t count = healthMap.size();
ReturnValue_t result =
SerializeAdapter::serialize(&count, &pointer, &size, maxSize, SerializeIF::Endianness::BIG);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
#if FSFW_VERBOSE_LEVEL >= 1
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "HealthTable::printAll: Serialization of health table failed" << std::endl;
@@ -80,26 +89,26 @@ void HealthTable::printAll(uint8_t* pointer, size_t maxSize) {
for (const auto& health : healthMap) {
result = SerializeAdapter::serialize(&health.first, &pointer, &size, maxSize,
SerializeIF::Endianness::BIG);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return;
}
uint8_t healthValue = health.second;
result = SerializeAdapter::serialize(&healthValue, &pointer, &size, maxSize,
SerializeIF::Endianness::BIG);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return;
}
}
}
ReturnValue_t HealthTable::iterate(HealthEntry* value, bool reset) {
- ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
+ ReturnValue_t result = returnvalue::OK;
MutexGuard(mutex, timeoutType, mutexTimeoutMs);
if (reset) {
mapIterator = healthMap.begin();
}
if (mapIterator == healthMap.end()) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
*value = *mapIterator;
mapIterator++;
diff --git a/src/fsfw/health/HealthTable.h b/src/fsfw/health/HealthTable.h
index 4718abc3..076228c1 100644
--- a/src/fsfw/health/HealthTable.h
+++ b/src/fsfw/health/HealthTable.h
@@ -9,14 +9,15 @@
class HealthTable : public HealthTableIF, public SystemObject {
public:
- HealthTable(object_id_t objectid);
- virtual ~HealthTable();
+ explicit HealthTable(object_id_t objectid);
+ ~HealthTable() override;
void setMutexTimeout(MutexIF::TimeoutType timeoutType, uint32_t timeoutMs);
/** HealthTableIF overrides */
virtual ReturnValue_t registerObject(
object_id_t object, HasHealthIF::HealthState initilialState = HasHealthIF::HEALTHY) override;
+ ReturnValue_t removeObject(object_id_t object) override;
virtual size_t getPrintSize() override;
virtual void printAll(uint8_t* pointer, size_t maxSize) override;
diff --git a/src/fsfw/health/HealthTableIF.h b/src/fsfw/health/HealthTableIF.h
index 50266ac2..0b993691 100644
--- a/src/fsfw/health/HealthTableIF.h
+++ b/src/fsfw/health/HealthTableIF.h
@@ -4,7 +4,7 @@
#include
#include "../objectmanager/ObjectManagerIF.h"
-#include "../returnvalues/HasReturnvaluesIF.h"
+#include "../returnvalues/returnvalue.h"
#include "ManagesHealthIF.h"
class HealthTableIF : public ManagesHealthIF {
@@ -14,6 +14,8 @@ class HealthTableIF : public ManagesHealthIF {
virtual ReturnValue_t registerObject(
object_id_t object, HasHealthIF::HealthState initilialState = HasHealthIF::HEALTHY) = 0;
+ virtual ReturnValue_t removeObject(object_id_t objectId) = 0;
+
virtual size_t getPrintSize() = 0;
virtual void printAll(uint8_t *pointer, size_t maxSize) = 0;
diff --git a/src/fsfw/housekeeping/AcceptsHkPacketsIF.h b/src/fsfw/housekeeping/AcceptsHkPacketsIF.h
index 07882829..7648e7ed 100644
--- a/src/fsfw/housekeeping/AcceptsHkPacketsIF.h
+++ b/src/fsfw/housekeeping/AcceptsHkPacketsIF.h
@@ -1,12 +1,12 @@
#ifndef FRAMEWORK_HOUSEKEEPING_ACCEPTSHKPACKETSIF_H_
#define FRAMEWORK_HOUSEKEEPING_ACCEPTSHKPACKETSIF_H_
-#include "../ipc/MessageQueueMessageIF.h"
+#include "fsfw/ipc/MessageQueueMessageIF.h"
class AcceptsHkPacketsIF {
public:
- virtual ~AcceptsHkPacketsIF(){};
- virtual MessageQueueId_t getHkQueue() const = 0;
+ virtual ~AcceptsHkPacketsIF() = default;
+ [[nodiscard]] virtual MessageQueueId_t getHkQueue() const = 0;
};
#endif /* FRAMEWORK_HOUSEKEEPING_ACCEPTSHKPACKETSIF_H_ */
diff --git a/src/fsfw/housekeeping/HousekeepingSetPacket.h b/src/fsfw/housekeeping/HousekeepingSetPacket.h
index 96eaaed9..fa039da8 100644
--- a/src/fsfw/housekeeping/HousekeepingSetPacket.h
+++ b/src/fsfw/housekeeping/HousekeepingSetPacket.h
@@ -22,7 +22,7 @@ class HousekeepingSetPacket : public SerialLinkedListAdapter {
Endianness streamEndianness) const override {
ReturnValue_t result =
SerialLinkedListAdapter::serialize(buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
return dataSet->serializeLocalPoolIds(buffer, size, maxSize, streamEndianness);
@@ -36,7 +36,7 @@ class HousekeepingSetPacket : public SerialLinkedListAdapter {
ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
Endianness streamEndianness) override {
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
private:
diff --git a/src/fsfw/housekeeping/HousekeepingSnapshot.h b/src/fsfw/housekeeping/HousekeepingSnapshot.h
index c3eabe80..fe9d3617 100644
--- a/src/fsfw/housekeeping/HousekeepingSnapshot.h
+++ b/src/fsfw/housekeeping/HousekeepingSnapshot.h
@@ -64,7 +64,7 @@ class HousekeepingSnapshot : public SerializeIF {
*buffer += timeStampSize;
}
if (updateData == nullptr) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
return updateData->serialize(buffer, size, maxSize, streamEndianness);
@@ -92,7 +92,7 @@ class HousekeepingSnapshot : public SerializeIF {
}
if (updateData == nullptr) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
if (*size < updateData->getSerializedSize()) {
return SerializeIF::STREAM_TOO_SHORT;
diff --git a/src/fsfw/internalerror/InternalErrorReporter.cpp b/src/fsfw/internalerror/InternalErrorReporter.cpp
index fa16ec3f..b3b77366 100644
--- a/src/fsfw/internalerror/InternalErrorReporter.cpp
+++ b/src/fsfw/internalerror/InternalErrorReporter.cpp
@@ -52,7 +52,7 @@ ReturnValue_t InternalErrorReporter::performOperation(uint8_t opCode) {
{
PoolReadGuard readGuard(&internalErrorDataset);
- if (readGuard.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
+ if (readGuard.getReadResult() == returnvalue::OK) {
internalErrorDataset.queueHits.value += newQueueHits;
internalErrorDataset.storeHits.value += newStoreHits;
internalErrorDataset.tmHits.value += newTmHits;
@@ -64,7 +64,7 @@ ReturnValue_t InternalErrorReporter::performOperation(uint8_t opCode) {
}
poolManager.performHkOperation();
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
void InternalErrorReporter::queueMessageNotSent() { incrementQueueHits(); }
@@ -126,13 +126,14 @@ MessageQueueId_t InternalErrorReporter::getCommandQueue() const {
ReturnValue_t InternalErrorReporter::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) {
- localDataPoolMap.emplace(errorPoolIds::TM_HITS, new PoolEntry());
- localDataPoolMap.emplace(errorPoolIds::QUEUE_HITS, new PoolEntry());
- localDataPoolMap.emplace(errorPoolIds::STORE_HITS, new PoolEntry());
- poolManager.subscribeForPeriodicPacket(internalErrorSid, false, getPeriodicOperationFrequency(),
- true);
+ localDataPoolMap.emplace(errorPoolIds::TM_HITS, &tmHitsEntry);
+ localDataPoolMap.emplace(errorPoolIds::QUEUE_HITS, &queueHitsEntry);
+ localDataPoolMap.emplace(errorPoolIds::STORE_HITS, &storeHitsEntry);
+ poolManager.subscribeForDiagPeriodicPacket(subdp::DiagnosticsHkPeriodicParams(
+ internalErrorSid, false,
+ static_cast(getPeriodicOperationFrequency()) / static_cast(1000.0)));
internalErrorDataset.setValidity(true, true);
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
dur_millis_t InternalErrorReporter::getPeriodicOperationFrequency() const {
@@ -147,7 +148,7 @@ void InternalErrorReporter::setTaskIF(PeriodicTaskIF *task) { this->executingTas
ReturnValue_t InternalErrorReporter::initialize() {
ReturnValue_t result = poolManager.initialize(commandQueue);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
return SystemObject::initialize();
diff --git a/src/fsfw/internalerror/InternalErrorReporter.h b/src/fsfw/internalerror/InternalErrorReporter.h
index 549be4bd..ca82d1a4 100644
--- a/src/fsfw/internalerror/InternalErrorReporter.h
+++ b/src/fsfw/internalerror/InternalErrorReporter.h
@@ -72,6 +72,9 @@ class InternalErrorReporter : public SystemObject,
uint32_t queueHits = 0;
uint32_t tmHits = 0;
uint32_t storeHits = 0;
+ PoolEntry tmHitsEntry = PoolEntry();
+ PoolEntry storeHitsEntry = PoolEntry();
+ PoolEntry queueHitsEntry = PoolEntry();
uint32_t getAndResetQueueHits();
void incrementQueueHits();
diff --git a/src/fsfw/internalerror/InternalErrorReporterIF.h b/src/fsfw/internalerror/InternalErrorReporterIF.h
index 61bb52e7..aa917d21 100644
--- a/src/fsfw/internalerror/InternalErrorReporterIF.h
+++ b/src/fsfw/internalerror/InternalErrorReporterIF.h
@@ -12,7 +12,7 @@
*/
class InternalErrorReporterIF {
public:
- virtual ~InternalErrorReporterIF() {}
+ virtual ~InternalErrorReporterIF() = default;
/**
* @brief Function to be called if a message queue could not be sent.
* @details OSAL Implementations should call this function to indicate that
diff --git a/src/fsfw/ipc/CommandMessageIF.h b/src/fsfw/ipc/CommandMessageIF.h
index aea08203..dc8f7109 100644
--- a/src/fsfw/ipc/CommandMessageIF.h
+++ b/src/fsfw/ipc/CommandMessageIF.h
@@ -1,7 +1,7 @@
#ifndef FSFW_IPC_COMMANDMESSAGEIF_H_
#define FSFW_IPC_COMMANDMESSAGEIF_H_
-#include "../returnvalues/HasReturnvaluesIF.h"
+#include "../returnvalues/returnvalue.h"
#include "FwMessageTypes.h"
#include "MessageQueueMessageIF.h"
diff --git a/src/fsfw/ipc/MessageQueueBase.cpp b/src/fsfw/ipc/MessageQueueBase.cpp
index c43670ed..56041bee 100644
--- a/src/fsfw/ipc/MessageQueueBase.cpp
+++ b/src/fsfw/ipc/MessageQueueBase.cpp
@@ -8,7 +8,7 @@ MessageQueueBase::MessageQueueBase(MessageQueueId_t id, MessageQueueId_t default
}
}
-MessageQueueBase::~MessageQueueBase() {}
+MessageQueueBase::~MessageQueueBase() = default;
ReturnValue_t MessageQueueBase::sendToDefault(MessageQueueMessageIF* message) {
return sendToDefaultFrom(message, this->getId(), false);
diff --git a/src/fsfw/ipc/MessageQueueBase.h b/src/fsfw/ipc/MessageQueueBase.h
index 942b6121..c4de8eeb 100644
--- a/src/fsfw/ipc/MessageQueueBase.h
+++ b/src/fsfw/ipc/MessageQueueBase.h
@@ -7,28 +7,28 @@
class MessageQueueBase : public MessageQueueIF {
public:
MessageQueueBase(MessageQueueId_t id, MessageQueueId_t defaultDest, MqArgs* mqArgs);
- virtual ~MessageQueueBase();
+ ~MessageQueueBase() override;
// Default implementations for MessageQueueIF where possible
- virtual MessageQueueId_t getLastPartner() const override;
- virtual MessageQueueId_t getId() const override;
- virtual MqArgs& getMqArgs() override;
- virtual void setDefaultDestination(MessageQueueId_t defaultDestination) override;
- virtual MessageQueueId_t getDefaultDestination() const override;
- virtual bool isDefaultDestinationSet() const override;
- virtual ReturnValue_t sendMessage(MessageQueueId_t sendTo, MessageQueueMessageIF* message,
- bool ignoreFault) override;
- virtual ReturnValue_t sendToDefault(MessageQueueMessageIF* message) override;
- virtual ReturnValue_t reply(MessageQueueMessageIF* message) override;
- virtual ReturnValue_t receiveMessage(MessageQueueMessageIF* message,
- MessageQueueId_t* receivedFrom) override;
- virtual ReturnValue_t sendToDefaultFrom(MessageQueueMessageIF* message, MessageQueueId_t sentFrom,
- bool ignoreFault = false) override;
+ [[nodiscard]] MessageQueueId_t getLastPartner() const override;
+ [[nodiscard]] MessageQueueId_t getId() const override;
+ MqArgs& getMqArgs() override;
+ void setDefaultDestination(MessageQueueId_t defaultDestination) override;
+ [[nodiscard]] MessageQueueId_t getDefaultDestination() const override;
+ [[nodiscard]] bool isDefaultDestinationSet() const override;
+ ReturnValue_t sendMessage(MessageQueueId_t sendTo, MessageQueueMessageIF* message,
+ bool ignoreFault) override;
+ ReturnValue_t sendToDefault(MessageQueueMessageIF* message) override;
+ ReturnValue_t reply(MessageQueueMessageIF* message) override;
+ ReturnValue_t receiveMessage(MessageQueueMessageIF* message,
+ MessageQueueId_t* receivedFrom) override;
+ ReturnValue_t sendToDefaultFrom(MessageQueueMessageIF* message, MessageQueueId_t sentFrom,
+ bool ignoreFault = false) override;
// OSAL specific, forward the abstract function
- virtual ReturnValue_t receiveMessage(MessageQueueMessageIF* message) = 0;
- virtual ReturnValue_t sendMessageFrom(MessageQueueId_t sendTo, MessageQueueMessageIF* message,
- MessageQueueId_t sentFrom, bool ignoreFault = false) = 0;
+ ReturnValue_t receiveMessage(MessageQueueMessageIF* message) override = 0;
+ ReturnValue_t sendMessageFrom(MessageQueueId_t sendTo, MessageQueueMessageIF* message,
+ MessageQueueId_t sentFrom, bool ignoreFault = false) override = 0;
protected:
MessageQueueId_t id = MessageQueueIF::NO_QUEUE;
diff --git a/src/fsfw/ipc/MessageQueueIF.h b/src/fsfw/ipc/MessageQueueIF.h
index 9532b2d6..fcd7c329 100644
--- a/src/fsfw/ipc/MessageQueueIF.h
+++ b/src/fsfw/ipc/MessageQueueIF.h
@@ -5,7 +5,7 @@
#include
-#include "../returnvalues/HasReturnvaluesIF.h"
+#include "../returnvalues/returnvalue.h"
#include "MessageQueueMessageIF.h"
#include "messageQueueDefinitions.h"
@@ -30,7 +30,7 @@ class MessageQueueIF {
//! [EXPORT] : [COMMENT] Returned if the target destination is invalid.
static constexpr ReturnValue_t DESTINATION_INVALID = MAKE_RETURN_CODE(4);
- virtual ~MessageQueueIF() {}
+ virtual ~MessageQueueIF() = default;
/**
* @brief This operation sends a message to the last communication partner.
* @details
@@ -40,7 +40,7 @@ class MessageQueueIF {
* @param message
* A pointer to a previously created message, which is sent.
* @return
- * -@c RETURN_OK if ok
+ * -@c returnvalue::OK if ok
* -@c NO_REPLY_PARTNER Should return NO_REPLY_PARTNER if partner was found.
*/
virtual ReturnValue_t reply(MessageQueueMessageIF* message) = 0;
@@ -69,24 +69,24 @@ class MessageQueueIF {
* function returns immediately.
* @param message
* A pointer to a message in which the received data is stored.
- * @return -@c RETURN_OK on success
+ * @return -@c returnvalue::OK on success
* -@c MessageQueueIF::EMPTY if queue is empty
*/
virtual ReturnValue_t receiveMessage(MessageQueueMessageIF* message) = 0;
/**
* Deletes all pending messages in the queue.
* @param count The number of flushed messages.
- * @return RETURN_OK on success.
+ * @return returnvalue::OK on success.
*/
virtual ReturnValue_t flush(uint32_t* count) = 0;
/**
* @brief This method returns the message queue ID of the last communication partner.
*/
- virtual MessageQueueId_t getLastPartner() const = 0;
+ [[nodiscard]] virtual MessageQueueId_t getLastPartner() const = 0;
/**
* @brief This method returns the message queue ID of this class's message queue.
*/
- virtual MessageQueueId_t getId() const = 0;
+ [[nodiscard]] virtual MessageQueueId_t getId() const = 0;
/**
* @brief With the sendMessage call, a queue message is sent to a receiving queue.
@@ -104,7 +104,7 @@ class MessageQueueIF {
* @param ignoreFault
* If set to true, the internal software fault counter is not incremented
* if queue is full (if implemented).
- * @return -@c RETURN_OK on success
+ * @return -@c returnvalue::OK on success
* -@c MessageQueueIF::FULL if queue is full
*/
virtual ReturnValue_t sendMessageFrom(MessageQueueId_t sendTo, MessageQueueMessageIF* message,
@@ -136,7 +136,7 @@ class MessageQueueIF {
* @param sentFrom
* The sentFrom information can be set to inject the sender's queue id
* into the message. This variable is set to zero by default.
- * @return -@c RETURN_OK on success
+ * @return -@c returnvalue::OK on success
* -@c MessageQueueIF::FULL if queue is full
*/
virtual ReturnValue_t sendToDefaultFrom(MessageQueueMessageIF* message, MessageQueueId_t sentFrom,
@@ -148,7 +148,7 @@ class MessageQueueIF {
* call of the Implementation class and adds its queue id as
* "sentFrom" information.
* @param message A pointer to a previously created message, which is sent.
- * @return -@c RETURN_OK on success
+ * @return -@c returnvalue::OK on success
* -@c MessageQueueIF::FULL if queue is full
*/
virtual ReturnValue_t sendToDefault(MessageQueueMessageIF* message) = 0;
@@ -159,9 +159,9 @@ class MessageQueueIF {
/**
* @brief This method is a simple getter for the default destination.
*/
- virtual MessageQueueId_t getDefaultDestination() const = 0;
+ [[nodiscard]] virtual MessageQueueId_t getDefaultDestination() const = 0;
- virtual bool isDefaultDestinationSet() const = 0;
+ [[nodiscard]] virtual bool isDefaultDestinationSet() const = 0;
virtual MqArgs& getMqArgs() = 0;
};
diff --git a/src/fsfw/ipc/MessageQueueMessage.cpp b/src/fsfw/ipc/MessageQueueMessage.cpp
index 6899915a..b0ce090f 100644
--- a/src/fsfw/ipc/MessageQueueMessage.cpp
+++ b/src/fsfw/ipc/MessageQueueMessage.cpp
@@ -10,10 +10,10 @@ MessageQueueMessage::MessageQueueMessage() : messageSize(getMinimumMessageSize()
}
MessageQueueMessage::MessageQueueMessage(uint8_t* data, size_t size)
- : messageSize(this->HEADER_SIZE + size) {
- if (size <= this->MAX_DATA_SIZE) {
- memcpy(this->getData(), data, size);
- this->messageSize = this->HEADER_SIZE + size;
+ : messageSize(MessageQueueMessage::HEADER_SIZE + size) {
+ if (size <= MessageQueueMessage::MAX_DATA_SIZE) {
+ std::memcpy(MessageQueueMessage::getData(), data, size);
+ this->messageSize = MessageQueueMessage::HEADER_SIZE + size;
} else {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "MessageQueueMessage: Passed size larger than maximum"
@@ -21,21 +21,23 @@ MessageQueueMessage::MessageQueueMessage(uint8_t* data, size_t size)
<< std::endl;
#endif
memset(this->internalBuffer, 0, sizeof(this->internalBuffer));
- this->messageSize = this->HEADER_SIZE;
+ this->messageSize = MessageQueueMessage::HEADER_SIZE;
}
}
-MessageQueueMessage::~MessageQueueMessage() {}
+MessageQueueMessage::~MessageQueueMessage() = default;
const uint8_t* MessageQueueMessage::getBuffer() const { return this->internalBuffer; }
uint8_t* MessageQueueMessage::getBuffer() { return this->internalBuffer; }
const uint8_t* MessageQueueMessage::getData() const {
- return this->internalBuffer + this->HEADER_SIZE;
+ return this->internalBuffer + MessageQueueMessage::HEADER_SIZE;
}
-uint8_t* MessageQueueMessage::getData() { return this->internalBuffer + this->HEADER_SIZE; }
+uint8_t* MessageQueueMessage::getData() {
+ return this->internalBuffer + MessageQueueMessage::HEADER_SIZE;
+}
MessageQueueId_t MessageQueueMessage::getSender() const {
MessageQueueId_t temp_id;
@@ -58,14 +60,22 @@ void MessageQueueMessage::print(bool printWholeMessage) {
}
}
-void MessageQueueMessage::clear() { memset(this->getBuffer(), 0, this->MAX_MESSAGE_SIZE); }
+void MessageQueueMessage::clear() {
+ memset(this->getBuffer(), 0, MessageQueueMessage::MAX_MESSAGE_SIZE);
+}
size_t MessageQueueMessage::getMessageSize() const { return this->messageSize; }
-void MessageQueueMessage::setMessageSize(size_t messageSize) { this->messageSize = messageSize; }
+void MessageQueueMessage::setMessageSize(size_t messageSize_) { this->messageSize = messageSize_; }
-size_t MessageQueueMessage::getMinimumMessageSize() const { return this->MIN_MESSAGE_SIZE; }
+size_t MessageQueueMessage::getMinimumMessageSize() const {
+ return MessageQueueMessage::MIN_MESSAGE_SIZE;
+}
-size_t MessageQueueMessage::getMaximumMessageSize() const { return this->MAX_MESSAGE_SIZE; }
+size_t MessageQueueMessage::getMaximumMessageSize() const {
+ return MessageQueueMessage::MAX_MESSAGE_SIZE;
+}
-size_t MessageQueueMessage::getMaximumDataSize() const { return this->MAX_DATA_SIZE; }
+size_t MessageQueueMessage::getMaximumDataSize() const {
+ return MessageQueueMessage::MAX_DATA_SIZE;
+}
diff --git a/src/fsfw/ipc/MessageQueueMessage.h b/src/fsfw/ipc/MessageQueueMessage.h
index 30e50ffe..a3d596f1 100644
--- a/src/fsfw/ipc/MessageQueueMessage.h
+++ b/src/fsfw/ipc/MessageQueueMessage.h
@@ -25,6 +25,30 @@
*/
class MessageQueueMessage : public MessageQueueMessageIF {
public:
+ /**
+ * @brief This constant defines the maximum size of the data content,
+ * excluding the header.
+ * @details
+ * It may be changed if necessary, but in general should be kept
+ * as small as possible.
+ */
+ static const size_t MAX_DATA_SIZE = 24;
+ /**
+ * @brief This constant defines the maximum total size in bytes
+ * of a sent message.
+ * @details
+ * It is the sum of the maximum data and the header size. Be aware that
+ * this constant is used to define the buffer sizes for every message
+ * queue in the system. So, a change here may have significant impact on
+ * the required resources.
+ */
+ static constexpr size_t MAX_MESSAGE_SIZE = MAX_DATA_SIZE + HEADER_SIZE;
+ /**
+ * @brief Defines the minimum size of a message where only the
+ * header is included
+ */
+ static constexpr size_t MIN_MESSAGE_SIZE = HEADER_SIZE;
+
/**
* @brief The class is initialized empty with this constructor.
* @details
@@ -50,59 +74,12 @@ class MessageQueueMessage : public MessageQueueMessageIF {
* @brief As no memory is allocated in this class,
* the destructor is empty.
*/
- virtual ~MessageQueueMessage();
+ ~MessageQueueMessage() override;
- /**
- * @brief The size information of each message is stored in
- * this attribute.
- * @details
- * It is public to simplify usage and to allow for passing the size
- * address as a pointer. Care must be taken when inheriting from this class,
- * as every child class is responsible for managing the size information by
- * itself. When using the class to receive a message, the size information
- * is updated automatically.
- *
- * Please note that the minimum size is limited by the size of the header
- * while the maximum size is limited by the maximum allowed message size.
- */
- size_t messageSize;
- /**
- * @brief This constant defines the maximum size of the data content,
- * excluding the header.
- * @details
- * It may be changed if necessary, but in general should be kept
- * as small as possible.
- */
- static const size_t MAX_DATA_SIZE = 24;
-
- /**
- * @brief This constant defines the maximum total size in bytes
- * of a sent message.
- * @details
- * It is the sum of the maximum data and the header size. Be aware that
- * this constant is used to define the buffer sizes for every message
- * queue in the system. So, a change here may have significant impact on
- * the required resources.
- */
- static constexpr size_t MAX_MESSAGE_SIZE = MAX_DATA_SIZE + HEADER_SIZE;
- /**
- * @brief Defines the minimum size of a message where only the
- * header is included
- */
- static constexpr size_t MIN_MESSAGE_SIZE = HEADER_SIZE;
-
- private:
- /**
- * @brief This is the internal buffer that contains the
- * actual message data.
- */
- uint8_t internalBuffer[MAX_MESSAGE_SIZE];
-
- public:
/**
* @brief This method is used to get the complete data of the message.
*/
- const uint8_t* getBuffer() const override;
+ [[nodiscard]] const uint8_t* getBuffer() const override;
/**
* @brief This method is used to get the complete data of the message.
*/
@@ -112,7 +89,7 @@ class MessageQueueMessage : public MessageQueueMessageIF {
* @details
* It shall be used by child classes to add data at the right position.
*/
- const uint8_t* getData() const override;
+ [[nodiscard]] const uint8_t* getData() const override;
/**
* @brief This method is used to fetch the data content of the message.
* @details
@@ -123,7 +100,7 @@ class MessageQueueMessage : public MessageQueueMessageIF {
* @brief This method is used to extract the sender's message
* queue id information from a received message.
*/
- MessageQueueId_t getSender() const override;
+ [[nodiscard]] MessageQueueId_t getSender() const override;
/**
* @brief With this method, the whole content
* and the message size is set to zero.
@@ -138,16 +115,40 @@ class MessageQueueMessage : public MessageQueueMessageIF {
*/
void setSender(MessageQueueId_t setId) override;
- virtual size_t getMessageSize() const override;
- virtual void setMessageSize(size_t messageSize) override;
- virtual size_t getMinimumMessageSize() const override;
- virtual size_t getMaximumMessageSize() const override;
- virtual size_t getMaximumDataSize() const override;
+ [[nodiscard]] size_t getMessageSize() const override;
+ void setMessageSize(size_t messageSize) override;
+ [[nodiscard]] size_t getMinimumMessageSize() const override;
+ [[nodiscard]] size_t getMaximumMessageSize() const override;
+ [[nodiscard]] size_t getMaximumDataSize() const override;
/**
* @brief This is a debug method that prints the content.
*/
void print(bool printWholeMessage);
+
+ /**
+ * TODO: This really should not be public. If it should be possible to pass size address as a
+ * pointer, add a getter function returning a const reference to the size
+ * @brief The size information of each message is stored in
+ * this attribute.
+ * @details
+ * It is public to simplify usage and to allow for passing the size
+ * address as a pointer. Care must be taken when inheriting from this class,
+ * as every child class is responsible for managing the size information by
+ * itself. When using the class to receive a message, the size information
+ * is updated automatically.
+ *
+ * Please note that the minimum size is limited by the size of the header
+ * while the maximum size is limited by the maximum allowed message size.
+ */
+ size_t messageSize;
+
+ private:
+ /**
+ * @brief This is the internal buffer that contains the
+ * actual message data.
+ */
+ uint8_t internalBuffer[MAX_MESSAGE_SIZE] = {};
};
#endif /* FSFW_IPC_MESSAGEQUEUEMESSAGE_H_ */
diff --git a/src/fsfw/ipc/MessageQueueMessageIF.h b/src/fsfw/ipc/MessageQueueMessageIF.h
index dae28926..300a90ab 100644
--- a/src/fsfw/ipc/MessageQueueMessageIF.h
+++ b/src/fsfw/ipc/MessageQueueMessageIF.h
@@ -14,7 +14,7 @@ class MessageQueueMessageIF {
*/
static const size_t HEADER_SIZE = sizeof(MessageQueueId_t);
- virtual ~MessageQueueMessageIF(){};
+ virtual ~MessageQueueMessageIF() = default;
/**
* @brief With this method, the whole content and the message
@@ -29,7 +29,7 @@ class MessageQueueMessageIF {
* @brief Get read-only pointer to the complete data of the message.
* @return
*/
- virtual const uint8_t* getBuffer() const = 0;
+ [[nodiscard]] virtual const uint8_t* getBuffer() const = 0;
/**
* @brief This method is used to get the complete data of the message.
@@ -48,14 +48,14 @@ class MessageQueueMessageIF {
* @brief This method is used to extract the sender's message queue id
* information from a received message.
*/
- virtual MessageQueueId_t getSender() const = 0;
+ [[nodiscard]] virtual MessageQueueId_t getSender() const = 0;
/**
* @brief This method is used to fetch the data content of the message.
* @details
* It shall be used by child classes to add data at the right position.
*/
- virtual const uint8_t* getData() const = 0;
+ [[nodiscard]] virtual const uint8_t* getData() const = 0;
/**
* @brief This method is used to fetch the data content of the message.
* @details
@@ -67,12 +67,28 @@ class MessageQueueMessageIF {
* Get constant message size of current message implementation.
* @return
*/
- virtual size_t getMessageSize() const = 0;
+ [[nodiscard]] virtual size_t getMessageSize() const = 0;
+ /**
+ * Sets the current message size of a given message
+ * @param messageSize
+ */
virtual void setMessageSize(size_t messageSize) = 0;
- virtual size_t getMinimumMessageSize() const = 0;
- virtual size_t getMaximumMessageSize() const = 0;
- virtual size_t getMaximumDataSize() const = 0;
+ /**
+ * Returns the smallest possible message size, including any headers
+ * @return
+ */
+ [[nodiscard]] virtual size_t getMinimumMessageSize() const = 0;
+ /**
+ * Returns the largest possible message size, including any headers
+ * @return
+ */
+ [[nodiscard]] virtual size_t getMaximumMessageSize() const = 0;
+ /**
+ * Returns the largest possible data size without any headers
+ * @return
+ */
+ [[nodiscard]] virtual size_t getMaximumDataSize() const = 0;
};
#endif /* FRAMEWORK_IPC_MESSAGEQUEUEMESSAGEIF_H_ */
diff --git a/src/fsfw/ipc/MessageQueueSenderIF.h b/src/fsfw/ipc/MessageQueueSenderIF.h
index a98862f6..83c7223a 100644
--- a/src/fsfw/ipc/MessageQueueSenderIF.h
+++ b/src/fsfw/ipc/MessageQueueSenderIF.h
@@ -1,14 +1,14 @@
#ifndef FSFW_IPC_MESSAGEQUEUESENDERIF_H_
#define FSFW_IPC_MESSAGEQUEUESENDERIF_H_
-#include "../objectmanager/ObjectManagerIF.h"
#include "MessageQueueIF.h"
#include "MessageQueueMessageIF.h"
+#include "fsfw/objectmanager/ObjectManagerIF.h"
class MessageQueueSenderIF {
public:
- virtual ~MessageQueueSenderIF() {}
-
+ virtual ~MessageQueueSenderIF() = default;
+ MessageQueueSenderIF() = delete;
/**
* Allows sending messages without actually "owning" a message queue.
* Not sure whether this is actually a good idea.
@@ -16,9 +16,6 @@ class MessageQueueSenderIF {
static ReturnValue_t sendMessage(MessageQueueId_t sendTo, MessageQueueMessageIF* message,
MessageQueueId_t sentFrom = MessageQueueIF::NO_QUEUE,
bool ignoreFault = false);
-
- private:
- MessageQueueSenderIF() {}
};
#endif /* FSFW_IPC_MESSAGEQUEUESENDERIF_H_ */
diff --git a/src/fsfw/ipc/MutexGuard.h b/src/fsfw/ipc/MutexGuard.h
index f7b90663..f6d2f25f 100644
--- a/src/fsfw/ipc/MutexGuard.h
+++ b/src/fsfw/ipc/MutexGuard.h
@@ -30,7 +30,7 @@ class MutexGuard {
timeoutMs);
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
- } else if (result != HasReturnvaluesIF::RETURN_OK) {
+ } else if (result != returnvalue::OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "MutexGuard: Lock of Mutex failed with code " << result << std::endl;
#else
@@ -51,7 +51,7 @@ class MutexGuard {
private:
MutexIF* internalMutex;
- ReturnValue_t result = HasReturnvaluesIF::RETURN_FAILED;
+ ReturnValue_t result = returnvalue::FAILED;
};
#endif /* FRAMEWORK_IPC_MUTEXGUARD_H_ */
diff --git a/src/fsfw/ipc/MutexIF.h b/src/fsfw/ipc/MutexIF.h
index 0bdfa1f4..30992f7b 100644
--- a/src/fsfw/ipc/MutexIF.h
+++ b/src/fsfw/ipc/MutexIF.h
@@ -1,7 +1,7 @@
#ifndef FRAMEWORK_IPC_MUTEXIF_H_
#define FRAMEWORK_IPC_MUTEXIF_H_
-#include "../returnvalues/HasReturnvaluesIF.h"
+#include "../returnvalues/returnvalue.h"
/**
* @brief Common interface for OS Mutex objects which provide MUTual EXclusion.
diff --git a/src/fsfw/memory/GenericFileSystemMessage.cpp b/src/fsfw/memory/GenericFileSystemMessage.cpp
index 805c7dcc..cdbfeb62 100644
--- a/src/fsfw/memory/GenericFileSystemMessage.cpp
+++ b/src/fsfw/memory/GenericFileSystemMessage.cpp
@@ -157,10 +157,10 @@ ReturnValue_t GenericFileSystemMessage::clear(CommandMessage *message) {
store_address_t storeId = GenericFileSystemMessage::getStoreId(message);
auto ipcStore = ObjectManager::instance()->get(objects::IPC_STORE);
if (ipcStore == nullptr) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
return ipcStore->deleteData(storeId);
}
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
diff --git a/src/fsfw/memory/HasFileSystemIF.h b/src/fsfw/memory/HasFileSystemIF.h
index 88a7db83..4c081e26 100644
--- a/src/fsfw/memory/HasFileSystemIF.h
+++ b/src/fsfw/memory/HasFileSystemIF.h
@@ -6,7 +6,7 @@
#include "FileSystemArgsIF.h"
#include "fsfw/ipc/messageQueueDefinitions.h"
#include "fsfw/returnvalues/FwClassIds.h"
-#include "fsfw/returnvalues/HasReturnvaluesIF.h"
+#include "fsfw/returnvalues/returnvalue.h"
/**
* @brief Generic interface for objects which expose a file system to enable
diff --git a/src/fsfw/memory/HasMemoryIF.h b/src/fsfw/memory/HasMemoryIF.h
index 7aa66377..fe5c1fc8 100644
--- a/src/fsfw/memory/HasMemoryIF.h
+++ b/src/fsfw/memory/HasMemoryIF.h
@@ -1,7 +1,7 @@
#ifndef HASMEMORYIF_H_
#define HASMEMORYIF_H_
-#include "../returnvalues/HasReturnvaluesIF.h"
+#include "../returnvalues/returnvalue.h"
class HasMemoryIF {
public:
@@ -30,15 +30,13 @@ class HasMemoryIF {
* Sets the address of the memory, if possible.
* startAddress is a proposal for an address, or the base address if multiple addresses are set.
*/
- virtual ReturnValue_t setAddress(uint32_t* startAddress) {
- return HasReturnvaluesIF::RETURN_FAILED;
- }
+ virtual ReturnValue_t setAddress(uint32_t* startAddress) { return returnvalue::FAILED; }
static bool memAccessWasSuccessful(ReturnValue_t result) {
switch (result) {
case DO_IT_MYSELF:
case POINTS_TO_MEMORY:
case POINTS_TO_VARIABLE:
- case HasReturnvaluesIF::RETURN_OK:
+ case returnvalue::OK:
case ACTIVITY_COMPLETED:
return true;
default:
diff --git a/src/fsfw/memory/MemoryHelper.cpp b/src/fsfw/memory/MemoryHelper.cpp
index 462a818e..cf4d205d 100644
--- a/src/fsfw/memory/MemoryHelper.cpp
+++ b/src/fsfw/memory/MemoryHelper.cpp
@@ -24,13 +24,13 @@ ReturnValue_t MemoryHelper::handleMemoryCommand(CommandMessage* message) {
switch (lastCommand) {
case MemoryMessage::CMD_MEMORY_DUMP:
handleMemoryCheckOrDump(message);
- return RETURN_OK;
+ return returnvalue::OK;
case MemoryMessage::CMD_MEMORY_LOAD:
handleMemoryLoad(message);
- return RETURN_OK;
+ return returnvalue::OK;
case MemoryMessage::CMD_MEMORY_CHECK:
handleMemoryCheckOrDump(message);
- return RETURN_OK;
+ return returnvalue::OK;
default:
lastCommand = CommandMessage::CMD_NONE;
return UNKNOWN_CMD;
@@ -51,7 +51,7 @@ void MemoryHelper::completeLoad(ReturnValue_t errorCode, const uint8_t* dataToCo
EndianConverter::convertBigEndian(copyHere, dataToCopy, size);
break;
case HasMemoryIF::ACTIVITY_COMPLETED:
- case RETURN_OK:
+ case returnvalue::OK:
break;
default:
ipcStore->deleteData(ipcAddress);
@@ -75,7 +75,7 @@ void MemoryHelper::completeDump(ReturnValue_t errorCode, const uint8_t* dataToCo
case HasMemoryIF::DO_IT_MYSELF:
busy = true;
return;
- case HasReturnvaluesIF::RETURN_OK:
+ case returnvalue::OK:
case HasMemoryIF::POINTS_TO_MEMORY:
case HasMemoryIF::POINTS_TO_VARIABLE:
//"data" must be valid pointer!
@@ -118,7 +118,7 @@ void MemoryHelper::completeDump(ReturnValue_t errorCode, const uint8_t* dataToCo
ipcStore->deleteData(ipcAddress);
break;
}
- if (queueToUse->sendMessage(lastSender, &reply) != RETURN_OK) {
+ if (queueToUse->sendMessage(lastSender, &reply) != returnvalue::OK) {
reply.clear();
}
}
@@ -148,7 +148,7 @@ void MemoryHelper::handleMemoryLoad(CommandMessage* message) {
uint8_t* dataPointer = NULL;
size_t size = 0;
ReturnValue_t returnCode = ipcStore->getData(ipcAddress, &p_data, &size);
- if (returnCode == RETURN_OK) {
+ if (returnCode == returnvalue::OK) {
returnCode = workOnThis->handleMemoryLoad(address, p_data, size, &dataPointer);
completeLoad(returnCode, p_data, size, dataPointer);
} else {
@@ -164,7 +164,7 @@ void MemoryHelper::handleMemoryCheckOrDump(CommandMessage* message) {
uint32_t size = MemoryMessage::getLength(message);
uint8_t* dataPointer = NULL;
ReturnValue_t returnCode = ipcStore->getFreeElement(&ipcAddress, size, &reservedSpaceInIPC);
- if (returnCode == RETURN_OK) {
+ if (returnCode == returnvalue::OK) {
returnCode = workOnThis->handleMemoryDump(address, size, &dataPointer, reservedSpaceInIPC);
completeDump(returnCode, dataPointer, size);
} else {
@@ -176,7 +176,7 @@ void MemoryHelper::handleMemoryCheckOrDump(CommandMessage* message) {
ReturnValue_t MemoryHelper::initialize(MessageQueueIF* queueToUse_) {
if (queueToUse_ == nullptr) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
this->queueToUse = queueToUse_;
return initialize();
@@ -185,8 +185,8 @@ ReturnValue_t MemoryHelper::initialize(MessageQueueIF* queueToUse_) {
ReturnValue_t MemoryHelper::initialize() {
ipcStore = ObjectManager::instance()->get(objects::IPC_STORE);
if (ipcStore != nullptr) {
- return RETURN_OK;
+ return returnvalue::OK;
} else {
- return RETURN_FAILED;
+ return returnvalue::FAILED;
}
}
diff --git a/src/fsfw/memory/MemoryHelper.h b/src/fsfw/memory/MemoryHelper.h
index 7a645b79..095b366f 100644
--- a/src/fsfw/memory/MemoryHelper.h
+++ b/src/fsfw/memory/MemoryHelper.h
@@ -3,14 +3,14 @@
#include "../ipc/CommandMessage.h"
#include "../ipc/MessageQueueIF.h"
-#include "../returnvalues/HasReturnvaluesIF.h"
+#include "../returnvalues/returnvalue.h"
#include "../storagemanager/StorageManagerIF.h"
#include "AcceptsMemoryMessagesIF.h"
/**
* @brief TODO: documentation.
*/
-class MemoryHelper : public HasReturnvaluesIF {
+class MemoryHelper {
public:
static const uint8_t INTERFACE_ID = CLASS_ID::MEMORY_HELPER;
static const ReturnValue_t UNKNOWN_CMD = MAKE_RETURN_CODE(0xE0);
diff --git a/src/fsfw/modes/HasModesIF.h b/src/fsfw/modes/HasModesIF.h
index 0ebe77d8..599975f8 100644
--- a/src/fsfw/modes/HasModesIF.h
+++ b/src/fsfw/modes/HasModesIF.h
@@ -4,7 +4,7 @@
#include
#include "../events/Event.h"
-#include "../returnvalues/HasReturnvaluesIF.h"
+#include "../returnvalues/returnvalue.h"
#include "ModeHelper.h"
#include "ModeMessage.h"
@@ -53,7 +53,7 @@ class HasModesIF {
protected:
virtual ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
uint32_t *msToReachTheMode) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
virtual void startTransition(Mode_t mode, Submode_t submode) {}
diff --git a/src/fsfw/modes/ModeHelper.cpp b/src/fsfw/modes/ModeHelper.cpp
index 2ea392ab..8c83012f 100644
--- a/src/fsfw/modes/ModeHelper.cpp
+++ b/src/fsfw/modes/ModeHelper.cpp
@@ -25,7 +25,7 @@ ReturnValue_t ModeHelper::handleModeCommand(CommandMessage* command) {
submode = ModeMessage::getSubmode(command);
uint32_t timeout;
ReturnValue_t result = owner->checkModeCommand(mode, submode, &timeout);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
ModeMessage::setCantReachMode(&reply, result);
MessageQueueSenderIF::sendMessage(command->getSender(), &reply, owner->getCommandQueue());
break;
@@ -55,9 +55,9 @@ ReturnValue_t ModeHelper::handleModeCommand(CommandMessage* command) {
owner->announceMode(true);
break;
default:
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t ModeHelper::initialize(MessageQueueId_t parentQueueId) {
@@ -99,7 +99,7 @@ void ModeHelper::setParentQueue(MessageQueueId_t parentQueueId) {
this->parentQueueId = parentQueueId;
}
-ReturnValue_t ModeHelper::initialize(void) { return HasReturnvaluesIF::RETURN_OK; }
+ReturnValue_t ModeHelper::initialize(void) { return returnvalue::OK; }
bool ModeHelper::isTimedOut() { return countdown.hasTimedOut(); }
diff --git a/src/fsfw/modes/ModeHelper.h b/src/fsfw/modes/ModeHelper.h
index 4d0479db..a84408a2 100644
--- a/src/fsfw/modes/ModeHelper.h
+++ b/src/fsfw/modes/ModeHelper.h
@@ -3,7 +3,7 @@
#include "ModeMessage.h"
#include "fsfw/ipc/MessageQueueIF.h"
-#include "fsfw/returnvalues/HasReturnvaluesIF.h"
+#include "fsfw/returnvalues/returnvalue.h"
#include "fsfw/timemanager/Countdown.h"
class HasModesIF;
diff --git a/src/fsfw/monitoring/AbsLimitMonitor.h b/src/fsfw/monitoring/AbsLimitMonitor.h
index c6400166..790808ee 100644
--- a/src/fsfw/monitoring/AbsLimitMonitor.h
+++ b/src/fsfw/monitoring/AbsLimitMonitor.h
@@ -29,7 +29,7 @@ class AbsLimitMonitor : public MonitorBase {
return MonitoringIF::OUT_OF_RANGE;
}
}
- return HasReturnvaluesIF::RETURN_OK; // We're not out of range.
+ return returnvalue::OK; // We're not out of range.
}
virtual ReturnValue_t getParameter(uint8_t domainId, uint16_t parameterId,
@@ -49,7 +49,7 @@ class AbsLimitMonitor : public MonitorBase {
default:
return this->INVALID_IDENTIFIER_ID;
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
bool isOutOfLimits() {
if (this->oldState == MonitoringIF::OUT_OF_RANGE) {
diff --git a/src/fsfw/monitoring/LimitMonitor.h b/src/fsfw/monitoring/LimitMonitor.h
index 229f1dc2..4fe9ee39 100644
--- a/src/fsfw/monitoring/LimitMonitor.h
+++ b/src/fsfw/monitoring/LimitMonitor.h
@@ -32,7 +32,7 @@ class LimitMonitor : public MonitorBase {
*crossedLimit = lowerLimit;
return MonitoringIF::BELOW_LOW_LIMIT;
} else {
- return HasReturnvaluesIF::RETURN_OK; // Within limits.
+ return returnvalue::OK; // Within limits.
}
}
@@ -55,7 +55,7 @@ class LimitMonitor : public MonitorBase {
default:
return this->INVALID_IDENTIFIER_ID;
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
bool isOutOfLimits() {
if (this->oldState == MonitoringIF::ABOVE_HIGH_LIMIT or
diff --git a/src/fsfw/monitoring/LimitViolationReporter.cpp b/src/fsfw/monitoring/LimitViolationReporter.cpp
index 43ecf4d3..ec6fa2e6 100644
--- a/src/fsfw/monitoring/LimitViolationReporter.cpp
+++ b/src/fsfw/monitoring/LimitViolationReporter.cpp
@@ -7,7 +7,7 @@
ReturnValue_t LimitViolationReporter::sendLimitViolationReport(const SerializeIF* data) {
ReturnValue_t result = checkClassLoaded();
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
store_address_t storeId;
@@ -17,12 +17,12 @@ ReturnValue_t LimitViolationReporter::sendLimitViolationReport(const SerializeIF
return MonitoringIF::INVALID_SIZE;
}
result = ipcStore->getFreeElement(&storeId, maxSize, &dataTarget);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
size_t size = 0;
result = data->serialize(&dataTarget, &size, maxSize, SerializeIF::Endianness::BIG);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
CommandMessage report;
@@ -42,10 +42,10 @@ ReturnValue_t LimitViolationReporter::checkClassLoaded() {
if (ipcStore == nullptr) {
ipcStore = ObjectManager::instance()->get(objects::IPC_STORE);
if (ipcStore == nullptr) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
// Lazy initialization.
diff --git a/src/fsfw/monitoring/LimitViolationReporter.h b/src/fsfw/monitoring/LimitViolationReporter.h
index 06b3ba74..12747725 100644
--- a/src/fsfw/monitoring/LimitViolationReporter.h
+++ b/src/fsfw/monitoring/LimitViolationReporter.h
@@ -8,7 +8,7 @@
#define LIMITVIOLATIONREPORTER_H_
#include "../ipc/MessageQueueSenderIF.h"
-#include "../returnvalues/HasReturnvaluesIF.h"
+#include "../returnvalues/returnvalue.h"
#include "../serialize/SerializeIF.h"
#include "../storagemanager/StorageManagerIF.h"
#include "monitoringConf.h"
diff --git a/src/fsfw/monitoring/MonitorBase.h b/src/fsfw/monitoring/MonitorBase.h
index b2653d75..dd0792b2 100644
--- a/src/fsfw/monitoring/MonitorBase.h
+++ b/src/fsfw/monitoring/MonitorBase.h
@@ -36,7 +36,7 @@ class MonitorBase : public MonitorReporter {
// 2. If returning from fetch != OK, parameter is invalid.
// Report (if oldState is != invalidity).
- if (validity != HasReturnvaluesIF::RETURN_OK) {
+ if (validity != returnvalue::OK) {
this->monitorStateIs(validity, sample, 0);
} else {
// 3. Otherwise, check sample.
@@ -56,14 +56,14 @@ class MonitorBase : public MonitorReporter {
protected:
virtual ReturnValue_t fetchSample(T* sample) {
ReturnValue_t result = poolVariable.read();
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
if (not poolVariable.isValid()) {
return MonitoringIF::INVALID;
}
*sample = poolVariable.value;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
LocalPoolVariable poolVariable;
diff --git a/src/fsfw/monitoring/MonitorReporter.h b/src/fsfw/monitoring/MonitorReporter.h
index bcbaf26d..09c39222 100644
--- a/src/fsfw/monitoring/MonitorReporter.h
+++ b/src/fsfw/monitoring/MonitorReporter.h
@@ -70,7 +70,7 @@ class MonitorReporter : public HasParametersIF {
default:
return INVALID_IDENTIFIER_ID;
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
virtual ReturnValue_t setToUnchecked() { return setToState(MonitoringIF::UNCHECKED); }
virtual ReturnValue_t setToInvalid() { return setToState(MonitoringIF::INVALID); }
@@ -135,7 +135,7 @@ class MonitorReporter : public HasParametersIF {
case MonitoringIF::UNCHECKED:
case MonitoringIF::UNSELECTED:
case MonitoringIF::INVALID:
- case HasReturnvaluesIF::RETURN_OK:
+ case returnvalue::OK:
break;
default:
EventManagerIF::triggerEvent(reportingId, MonitoringIF::MONITOR_CHANGED_STATE, state);
@@ -159,7 +159,7 @@ class MonitorReporter : public HasParametersIF {
LimitViolationReporter::sendLimitViolationReport(&report);
oldState = state;
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
};
diff --git a/src/fsfw/monitoring/MonitoringMessageContent.h b/src/fsfw/monitoring/MonitoringMessageContent.h
index fb3ace3d..7a7b5440 100644
--- a/src/fsfw/monitoring/MonitoringMessageContent.h
+++ b/src/fsfw/monitoring/MonitoringMessageContent.h
@@ -8,7 +8,7 @@
#include "../serialize/SerialLinkedListAdapter.h"
#include "../serialize/SerializeElement.h"
#include "../serviceinterface/ServiceInterface.h"
-#include "../timemanager/TimeStamperIF.h"
+#include "../timemanager/TimeWriterIF.h"
#include "HasMonitorsIF.h"
#include "MonitoringIF.h"
#include "monitoringConf.h"
@@ -34,9 +34,9 @@ class MonitoringReportContent : public SerialLinkedListAdapter {
SerializeElement limitValue;
SerializeElement oldState;
SerializeElement newState;
- uint8_t rawTimestamp[TimeStamperIF::MISSION_TIMESTAMP_SIZE] = {};
+ uint8_t rawTimestamp[TimeWriterIF::MAXIMUM_TIMESTAMP_LEN] = {};
SerializeElement> timestampSerializer;
- TimeStamperIF* timeStamper;
+ TimeWriterIF* timeStamper;
MonitoringReportContent()
: SerialLinkedListAdapter(¶meterObjectId),
monitorId(0),
@@ -47,7 +47,7 @@ class MonitoringReportContent : public SerialLinkedListAdapter {
oldState(0),
newState(0),
timestampSerializer(rawTimestamp, sizeof(rawTimestamp)),
- timeStamper(NULL) {
+ timeStamper(nullptr) {
setAllNext();
}
MonitoringReportContent(gp_id_t globalPoolId, T value, T limitValue, ReturnValue_t oldState,
@@ -61,7 +61,7 @@ class MonitoringReportContent : public SerialLinkedListAdapter {
oldState(oldState),
newState(newState),
timestampSerializer(rawTimestamp, sizeof(rawTimestamp)),
- timeStamper(NULL) {
+ timeStamper(nullptr) {
setAllNext();
if (checkAndSetStamper()) {
timeStamper->addTimeStamp(rawTimestamp, sizeof(rawTimestamp));
@@ -79,7 +79,7 @@ class MonitoringReportContent : public SerialLinkedListAdapter {
}
bool checkAndSetStamper() {
if (timeStamper == nullptr) {
- timeStamper = ObjectManager::instance()->get(timeStamperId);
+ timeStamper = ObjectManager::instance()->get(timeStamperId);
if (timeStamper == nullptr) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "MonitoringReportContent::checkAndSetStamper: "
diff --git a/src/fsfw/monitoring/TriplexMonitor.h b/src/fsfw/monitoring/TriplexMonitor.h
index 1d9182aa..e007ea5f 100644
--- a/src/fsfw/monitoring/TriplexMonitor.h
+++ b/src/fsfw/monitoring/TriplexMonitor.h
@@ -49,7 +49,7 @@ class TriplexMonitor : public HasParametersIF {
nAvailable++;
}
}
- ReturnValue_t result = HasReturnvaluesIF::RETURN_FAILED;
+ ReturnValue_t result = returnvalue::FAILED;
switch (nAvailable) {
case 3:
result = doTriplexMonitoring();
@@ -67,9 +67,9 @@ class TriplexMonitor : public HasParametersIF {
ReturnValue_t initialize() {
healthTable = ObjectManager::instance()->get(objects::HEALTH_TABLE);
if (healthTable == NULL) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId, ParameterWrapper *parameterWrapper,
@@ -84,7 +84,7 @@ class TriplexMonitor : public HasParametersIF {
default:
return INVALID_IDENTIFIER_ID;
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
protected:
@@ -96,7 +96,7 @@ class TriplexMonitor : public HasParametersIF {
HealthTableIF *healthTable;
uint8_t domainId;
ReturnValue_t doTriplexMonitoring() {
- ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
+ ReturnValue_t result = returnvalue::OK;
// Find middle value, by ordering indices
uint8_t index[3] = {0, 1, 2};
if (values[index[0]].value > values[index[1]].value) {
@@ -118,7 +118,7 @@ class TriplexMonitor : public HasParametersIF {
if (values[index[2]] > (values[index[1]] + limit)) {
EventManagerIF::triggerEvent(getRefereneceObject(index[2]), eventTripleCheck,
HIGHEST_VALUE_OOL, 0);
- if (result == HasReturnvaluesIF::RETURN_OK) {
+ if (result == returnvalue::OK) {
result = HIGHEST_VALUE_OOL;
} else {
result = BOTH_VALUES_OOL;
@@ -142,7 +142,7 @@ class TriplexMonitor : public HasParametersIF {
return DUPLEX_OOL;
}
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
virtual bool checkObjectHealthState(uint8_t valueIndex) = 0;
virtual object_id_t getRefereneceObject(uint8_t valueIndex) = 0;
diff --git a/src/fsfw/monitoring/TwoValueLimitMonitor.h b/src/fsfw/monitoring/TwoValueLimitMonitor.h
index 79b8c4bb..ad3f5c86 100644
--- a/src/fsfw/monitoring/TwoValueLimitMonitor.h
+++ b/src/fsfw/monitoring/TwoValueLimitMonitor.h
@@ -18,7 +18,7 @@ class TwoValueLimitMonitor : public LimitMonitor {
ReturnValue_t doCheck(T lowSample, T highSample) {
T crossedLimit;
ReturnValue_t currentState = this->checkSample(lowSample, &crossedLimit);
- if (currentState != HasReturnvaluesIF::RETURN_OK) {
+ if (currentState != returnvalue::OK) {
return this->monitorStateIs(currentState, lowSample, crossedLimit);
}
currentState = this->checkSample(highSample, &crossedLimit);
diff --git a/src/fsfw/objectmanager/ObjectManager.cpp b/src/fsfw/objectmanager/ObjectManager.cpp
index 2017938a..ddf5ab80 100644
--- a/src/fsfw/objectmanager/ObjectManager.cpp
+++ b/src/fsfw/objectmanager/ObjectManager.cpp
@@ -21,7 +21,7 @@ void ObjectManager::setObjectFactoryFunction(produce_function_t objFactoryFunc,
this->factoryArgs = factoryArgs;
}
-ObjectManager::ObjectManager() {}
+ObjectManager::ObjectManager() = default;
ObjectManager::~ObjectManager() {
for (auto const& iter : objectList) {
@@ -36,7 +36,7 @@ ReturnValue_t ObjectManager::insert(object_id_t id, SystemObjectIF* object) {
// sif::debug << "ObjectManager::insert: Object " << std::hex
// << (int)id << std::dec << " inserted." << std::endl;
#endif
- return this->RETURN_OK;
+ return returnvalue::OK;
} else {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "ObjectManager::insert: Object ID " << std::hex << static_cast(id)
@@ -53,13 +53,13 @@ ReturnValue_t ObjectManager::insert(object_id_t id, SystemObjectIF* object) {
}
ReturnValue_t ObjectManager::remove(object_id_t id) {
- if (this->getSystemObject(id) != NULL) {
+ if (this->getSystemObject(id) != nullptr) {
this->objectList.erase(id);
#if FSFW_CPP_OSTREAM_ENABLED == 1
// sif::debug << "ObjectManager::removeObject: Object " << std::hex
// << (int)id << std::dec << " removed." << std::endl;
#endif
- return RETURN_OK;
+ return returnvalue::OK;
} else {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "ObjectManager::removeObject: Requested object " << std::hex << (int)id
@@ -90,11 +90,11 @@ void ObjectManager::initialize() {
return;
}
objectFactoryFunction(factoryArgs);
- ReturnValue_t result = RETURN_FAILED;
+ ReturnValue_t result = returnvalue::FAILED;
uint32_t errorCount = 0;
for (auto const& it : objectList) {
result = it.second->initialize();
- if (result != RETURN_OK) {
+ if (result != returnvalue::OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
object_id_t var = it.first;
sif::error << "ObjectManager::initialize: Object 0x" << std::hex << std::setw(8)
@@ -116,7 +116,7 @@ void ObjectManager::initialize() {
errorCount = 0;
for (auto const& it : objectList) {
result = it.second->checkObjectConnections();
- if (result != RETURN_OK) {
+ if (result != returnvalue::OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "ObjectManager::ObjectManager: Object 0x" << std::hex << (int)it.first
<< " connection check failed with code 0x" << result << std::dec << std::endl;
diff --git a/src/fsfw/objectmanager/ObjectManager.h b/src/fsfw/objectmanager/ObjectManager.h
index 50e4af00..e0e74792 100644
--- a/src/fsfw/objectmanager/ObjectManager.h
+++ b/src/fsfw/objectmanager/ObjectManager.h
@@ -38,7 +38,7 @@ class ObjectManager : public ObjectManagerIF {
/**
* @brief In the class's destructor, all objects in the list are deleted.
*/
- virtual ~ObjectManager();
+ ~ObjectManager() override;
ReturnValue_t insert(object_id_t id, SystemObjectIF* object) override;
ReturnValue_t remove(object_id_t id) override;
void initialize() override;
diff --git a/src/fsfw/objectmanager/ObjectManagerIF.h b/src/fsfw/objectmanager/ObjectManagerIF.h
index 32a0942f..81ddd95a 100644
--- a/src/fsfw/objectmanager/ObjectManagerIF.h
+++ b/src/fsfw/objectmanager/ObjectManagerIF.h
@@ -1,7 +1,7 @@
#ifndef FSFW_OBJECTMANAGER_OBJECTMANAGERIF_H_
#define FSFW_OBJECTMANAGER_OBJECTMANAGERIF_H_
-#include "../returnvalues/HasReturnvaluesIF.h"
+#include "../returnvalues/returnvalue.h"
#include "../serviceinterface/ServiceInterface.h"
#include "SystemObjectIF.h"
#include "frameworkObjects.h"
@@ -16,7 +16,7 @@
* @author Bastian Baetz
* @ingroup system_objects
*/
-class ObjectManagerIF : public HasReturnvaluesIF {
+class ObjectManagerIF {
public:
static constexpr uint8_t INTERFACE_ID = CLASS_ID::OBJECT_MANAGER_IF;
static constexpr ReturnValue_t INSERTION_FAILED = MAKE_RETURN_CODE(1);
@@ -48,14 +48,14 @@ class ObjectManagerIF : public HasReturnvaluesIF {
* @param id The new id to be added to the list.
* @param object A pointer to the object to be added.
* @return @li INSERTION_FAILED in case the object could not be inserted.
- * @li RETURN_OK in case the object was successfully inserted
+ * @li returnvalue::OK in case the object was successfully inserted
*/
virtual ReturnValue_t insert(object_id_t id, SystemObjectIF* object) = 0;
/**
* @brief With this call, an object is removed from the list.
* @param id The object id of the object to be removed.
* @return @li NOT_FOUND in case the object was not found
- * @li RETURN_OK in case the object was successfully removed
+ * @li returnvalue::OK in case the object was successfully removed
*/
virtual ReturnValue_t remove(object_id_t id) = 0;
virtual void initialize() = 0;
diff --git a/src/fsfw/objectmanager/SystemObject.cpp b/src/fsfw/objectmanager/SystemObject.cpp
index 7f8acfd8..90839013 100644
--- a/src/fsfw/objectmanager/SystemObject.cpp
+++ b/src/fsfw/objectmanager/SystemObject.cpp
@@ -22,9 +22,9 @@ void SystemObject::triggerEvent(Event event, uint32_t parameter1, uint32_t param
EventManagerIF::triggerEvent(objectId, event, parameter1, parameter2);
}
-ReturnValue_t SystemObject::initialize() { return HasReturnvaluesIF::RETURN_OK; }
+ReturnValue_t SystemObject::initialize() { return returnvalue::OK; }
-ReturnValue_t SystemObject::checkObjectConnections() { return HasReturnvaluesIF::RETURN_OK; }
+ReturnValue_t SystemObject::checkObjectConnections() { return returnvalue::OK; }
void SystemObject::forwardEvent(Event event, uint32_t parameter1, uint32_t parameter2) const {
EventManagerIF::triggerEvent(objectId, event, parameter1, parameter2);
diff --git a/src/fsfw/objectmanager/SystemObjectIF.h b/src/fsfw/objectmanager/SystemObjectIF.h
index 72fe9044..b9243de2 100644
--- a/src/fsfw/objectmanager/SystemObjectIF.h
+++ b/src/fsfw/objectmanager/SystemObjectIF.h
@@ -4,7 +4,7 @@
#include
#include "../events/EventReportingProxyIF.h"
-#include "../returnvalues/HasReturnvaluesIF.h"
+#include "../returnvalues/returnvalue.h"
/**
* @defgroup system_objects Software System Object Management
* The classes to create System Objects and classes to manage these are
@@ -16,7 +16,7 @@
* This is the typedef for object identifiers.
* @ingroup system_objects
*/
-typedef uint32_t object_id_t;
+using object_id_t = uint32_t;
/**
* This interface allows a class to be included in the object manager
@@ -45,8 +45,8 @@ class SystemObjectIF : public EventReportingProxyIF {
* which might not have been built yet.
* Therefore, a two-step initialization resolves this problem and prevents
* circular dependencies of not-fully initialized objects on start up.
- * @return - @c RETURN_OK in case the initialization was successful
- * - @c RETURN_FAILED otherwise
+ * @return - @c returnvalue::OK in case the initialization was successful
+ * - @c returnvalue::FAILED otherwise
*/
virtual ReturnValue_t initialize() = 0;
/**
@@ -54,7 +54,7 @@ class SystemObjectIF : public EventReportingProxyIF {
* for operation.
* Some objects need certain other objects (or a certain number), to be
* registered as children. These checks can be done in this method.
- * @return - @c RETURN_OK in case the check was successful
+ * @return - @c returnvalue::OK in case the check was successful
* - @c any other code otherwise
*/
virtual ReturnValue_t checkObjectConnections() = 0;
diff --git a/src/fsfw/objectmanager/frameworkObjects.h b/src/fsfw/objectmanager/frameworkObjects.h
index cddc6ba2..9487147d 100644
--- a/src/fsfw/objectmanager/frameworkObjects.h
+++ b/src/fsfw/objectmanager/frameworkObjects.h
@@ -33,6 +33,7 @@ enum framework_objects : object_id_t {
TC_STORE = 0x534f0100,
TM_STORE = 0x534f0200,
TIME_STAMPER = 0x53500010,
+ VERIFICATION_REPORTER = 0x53500020,
FSFW_OBJECTS_END = 0x53ffffff,
NO_OBJECT = 0xFFFFFFFF
diff --git a/src/fsfw/osal/InternalErrorCodes.h b/src/fsfw/osal/InternalErrorCodes.h
index 5924d4c9..abec460f 100644
--- a/src/fsfw/osal/InternalErrorCodes.h
+++ b/src/fsfw/osal/InternalErrorCodes.h
@@ -1,7 +1,7 @@
#ifndef INTERNALERRORCODES_H_
#define INTERNALERRORCODES_H_
-#include "fsfw/returnvalues/HasReturnvaluesIF.h"
+#include "fsfw/returnvalues/returnvalue.h"
class InternalErrorCodes {
public:
diff --git a/src/fsfw/osal/common/TcpIpBase.cpp b/src/fsfw/osal/common/TcpIpBase.cpp
index 67e71053..7e989c36 100644
--- a/src/fsfw/osal/common/TcpIpBase.cpp
+++ b/src/fsfw/osal/common/TcpIpBase.cpp
@@ -21,10 +21,10 @@ ReturnValue_t TcpIpBase::initialize() {
sif::error << "TmTcWinUdpBridge::TmTcWinUdpBridge: WSAStartup failed with error: " << err
<< std::endl;
#endif
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
#endif
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
TcpIpBase::~TcpIpBase() {
diff --git a/src/fsfw/osal/common/TcpIpBase.h b/src/fsfw/osal/common/TcpIpBase.h
index ccbd12ca..6cc71fbf 100644
--- a/src/fsfw/osal/common/TcpIpBase.h
+++ b/src/fsfw/osal/common/TcpIpBase.h
@@ -2,7 +2,7 @@
#define FSFW_OSAL_COMMON_TCPIPIF_H_
#include "../../platform.h"
-#include "../../returnvalues/HasReturnvaluesIF.h"
+#include "../../returnvalues/returnvalue.h"
#ifdef PLATFORM_WIN
#include
diff --git a/src/fsfw/osal/common/TcpTmTcBridge.cpp b/src/fsfw/osal/common/TcpTmTcBridge.cpp
index 4b2bea73..f99a8bc1 100644
--- a/src/fsfw/osal/common/TcpTmTcBridge.cpp
+++ b/src/fsfw/osal/common/TcpTmTcBridge.cpp
@@ -18,7 +18,7 @@
TcpTmTcBridge::TcpTmTcBridge(object_id_t objectId, object_id_t tcDestination, object_id_t tmStoreId,
object_id_t tcStoreId)
- : TmTcBridge(objectId, tcDestination, tmStoreId, tcStoreId) {
+ : TmTcBridge("TCP TMTC Bridge", objectId, tcDestination, tmStoreId, tcStoreId) {
mutex = MutexFactory::instance()->createMutex();
// Connection is always up, TM is requested by connecting to server and receiving packets
registerCommConnect();
@@ -26,7 +26,7 @@ TcpTmTcBridge::TcpTmTcBridge(object_id_t objectId, object_id_t tcDestination, ob
ReturnValue_t TcpTmTcBridge::initialize() {
ReturnValue_t result = TmTcBridge::initialize();
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "TcpTmTcBridge::initialize: TmTcBridge initialization failed!" << std::endl;
#else
@@ -35,7 +35,7 @@ ReturnValue_t TcpTmTcBridge::initialize() {
return result;
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
TcpTmTcBridge::~TcpTmTcBridge() {
@@ -48,21 +48,20 @@ ReturnValue_t TcpTmTcBridge::handleTm() {
// Simply store the telemetry in the FIFO, the server will use it to access the TM
MutexGuard guard(mutex, timeoutType, mutexTimeoutMs);
TmTcMessage message;
- ReturnValue_t status = HasReturnvaluesIF::RETURN_OK;
+ ReturnValue_t status = returnvalue::OK;
for (ReturnValue_t result = tmTcReceptionQueue->receiveMessage(&message);
- result == HasReturnvaluesIF::RETURN_OK;
- result = tmTcReceptionQueue->receiveMessage(&message)) {
+ result == returnvalue::OK; result = tmTcReceptionQueue->receiveMessage(&message)) {
status = storeDownlinkData(&message);
- if (status != HasReturnvaluesIF::RETURN_OK) {
+ if (status != returnvalue::OK) {
break;
}
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t TcpTmTcBridge::sendTm(const uint8_t *data, size_t dataLen) {
// Not used. The Server uses the FIFO to access and send the telemetry.
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
void TcpTmTcBridge::setMutexProperties(MutexIF::TimeoutType timeoutType, dur_millis_t timeoutMs) {
diff --git a/src/fsfw/osal/common/TcpTmTcServer.cpp b/src/fsfw/osal/common/TcpTmTcServer.cpp
index a8890006..dff959ba 100644
--- a/src/fsfw/osal/common/TcpTmTcServer.cpp
+++ b/src/fsfw/osal/common/TcpTmTcServer.cpp
@@ -39,7 +39,7 @@ ReturnValue_t TcpTmTcServer::initialize() {
using namespace tcpip;
ReturnValue_t result = TcpIpBase::initialize();
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
@@ -47,7 +47,7 @@ ReturnValue_t TcpTmTcServer::initialize() {
case (ReceptionModes::SPACE_PACKETS): {
spacePacketParser = new SpacePacketParser(validPacketIds);
if (spacePacketParser == nullptr) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
#if defined PLATFORM_UNIX
tcpConfig.tcpFlags |= MSG_DONTWAIT;
@@ -79,7 +79,7 @@ ReturnValue_t TcpTmTcServer::initialize() {
retval = getaddrinfo(nullptr, tcpConfig.tcpPort.c_str(), &hints, &addrResult);
if (retval != 0) {
handleError(Protocol::TCP, ErrorSources::GETADDRINFO_CALL);
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
// Open TCP (stream) socket
@@ -88,7 +88,7 @@ ReturnValue_t TcpTmTcServer::initialize() {
if (listenerTcpSocket == INVALID_SOCKET) {
freeaddrinfo(addrResult);
handleError(Protocol::TCP, ErrorSources::SOCKET_CALL);
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
// Bind to the address found by getaddrinfo
@@ -96,11 +96,11 @@ ReturnValue_t TcpTmTcServer::initialize() {
if (retval == SOCKET_ERROR) {
freeaddrinfo(addrResult);
handleError(Protocol::TCP, ErrorSources::BIND_CALL);
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
freeaddrinfo(addrResult);
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
TcpTmTcServer::~TcpTmTcServer() { closeSocket(listenerTcpSocket); }
@@ -151,7 +151,7 @@ ReturnValue_t TcpTmTcServer::initializeAfterTaskCreation() {
targetTcDestination = tmtcBridge->getRequestQueue();
tcStore = tmtcBridge->tcStore;
tmStore = tmtcBridge->tmStore;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
void TcpTmTcServer::handleServerOperation(socket_t& connSocket) {
@@ -161,7 +161,7 @@ void TcpTmTcServer::handleServerOperation(socket_t& connSocket) {
while (true) {
ssize_t retval = recv(connSocket, reinterpret_cast(receptionBuffer.data()),
- receptionBuffer.capacity(), tcpConfig.tcpFlags);
+ receptionBuffer.size(), tcpConfig.tcpFlags);
if (retval == 0) {
size_t availableReadData = ringBuffer.getAvailableReadData();
if (availableReadData > lastRingBufferSize) {
@@ -214,11 +214,11 @@ ReturnValue_t TcpTmTcServer::handleTcReception(uint8_t* spacePacket, size_t pack
}
if (spacePacket == nullptr or packetSize == 0) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
store_address_t storeId;
ReturnValue_t result = tcStore->addData(&storeId, spacePacket, packetSize);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
#if FSFW_VERBOSE_LEVEL >= 1
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "TcpTmTcServer::handleServerOperation: Data storage with packet size"
@@ -236,7 +236,7 @@ ReturnValue_t TcpTmTcServer::handleTcReception(uint8_t* spacePacket, size_t pack
TmTcMessage message(storeId);
result = MessageQueueSenderIF::sendMessage(targetTcDestination, &message);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
#if FSFW_VERBOSE_LEVEL >= 1
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "TcpTmTcServer::handleServerOperation: "
@@ -273,7 +273,7 @@ ReturnValue_t TcpTmTcServer::handleTmSending(socket_t connSocket, bool& tmSent)
// Using the store accessor will take care of deleting TM from the store automatically
ConstStorageAccessor storeAccessor(storeId);
ReturnValue_t result = tmStore->getData(storeId, storeAccessor);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
if (wiretappingEnabled) {
@@ -297,12 +297,12 @@ ReturnValue_t TcpTmTcServer::handleTmSending(socket_t connSocket, bool& tmSent)
return CONN_BROKEN;
}
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t TcpTmTcServer::handleTcRingBufferData(size_t availableReadData) {
- ReturnValue_t status = HasReturnvaluesIF::RETURN_OK;
- ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
+ ReturnValue_t status = returnvalue::OK;
+ ReturnValue_t result = returnvalue::OK;
size_t readAmount = availableReadData;
lastRingBufferSize = availableReadData;
if (readAmount >= ringBuffer.getMaxSize()) {
@@ -335,31 +335,27 @@ ReturnValue_t TcpTmTcServer::handleTcRingBufferData(size_t availableReadData) {
}
ringBuffer.readData(receptionBuffer.data(), readAmount, true);
const uint8_t* bufPtr = receptionBuffer.data();
- const uint8_t** bufPtrPtr = &bufPtr;
- size_t startIdx = 0;
- size_t foundSize = 0;
- size_t readLen = 0;
- while (readLen < readAmount) {
- if (spacePacketParser == nullptr) {
- return HasReturnvaluesIF::RETURN_FAILED;
- }
- result =
- spacePacketParser->parseSpacePackets(bufPtrPtr, readAmount, startIdx, foundSize, readLen);
+ SpacePacketParser::FoundPacketInfo info;
+ if (spacePacketParser == nullptr) {
+ return returnvalue::FAILED;
+ }
+ spacePacketParser->reset();
+ while (spacePacketParser->getAmountRead() < readAmount) {
+ result = spacePacketParser->parseSpacePackets(&bufPtr, readAmount, info);
switch (result) {
case (SpacePacketParser::NO_PACKET_FOUND):
case (SpacePacketParser::SPLIT_PACKET): {
break;
}
- case (HasReturnvaluesIF::RETURN_OK): {
- result = handleTcReception(receptionBuffer.data() + startIdx, foundSize);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ case (returnvalue::OK): {
+ result = handleTcReception(receptionBuffer.data() + info.startIdx, info.sizeFound);
+ if (result != returnvalue::OK) {
status = result;
}
}
}
- ringBuffer.deleteData(foundSize);
+ ringBuffer.deleteData(info.sizeFound);
lastRingBufferSize = ringBuffer.getAvailableReadData();
- std::memset(receptionBuffer.data() + startIdx, 0, foundSize);
}
return status;
}
diff --git a/src/fsfw/osal/common/TcpTmTcServer.h b/src/fsfw/osal/common/TcpTmTcServer.h
index faf6e0a1..0e2182a5 100644
--- a/src/fsfw/osal/common/TcpTmTcServer.h
+++ b/src/fsfw/osal/common/TcpTmTcServer.h
@@ -108,7 +108,7 @@ class TcpTmTcServer : public SystemObject, public TcpIpBase, public ExecutableOb
StorageManagerIF* tmStore = nullptr;
private:
- static constexpr ReturnValue_t CONN_BROKEN = HasReturnvaluesIF::makeReturnCode(1, 0);
+ static constexpr ReturnValue_t CONN_BROKEN = returnvalue::makeCode(1, 0);
//! TMTC bridge is cached.
object_id_t tmtcBridgeId = objects::NO_OBJECT;
TcpTmTcBridge* tmtcBridge = nullptr;
diff --git a/src/fsfw/osal/common/UdpTcPollingTask.cpp b/src/fsfw/osal/common/UdpTcPollingTask.cpp
index bcc8e9e3..4304fdd2 100644
--- a/src/fsfw/osal/common/UdpTcPollingTask.cpp
+++ b/src/fsfw/osal/common/UdpTcPollingTask.cpp
@@ -66,7 +66,7 @@ UdpTcPollingTask::UdpTcPollingTask(object_id_t objectId, object_id_t tmtcUdpBrid
#endif /* FSFW_UDP_RCV_WIRETAPPING_ENABLED == 1 */
ReturnValue_t result = handleSuccessfullTcRead(bytesReceived);
- if (result != HasReturnvaluesIF::RETURN_FAILED) {
+ if (result != returnvalue::FAILED) {
}
tmtcBridge->checkAndSetClientAddress(senderAddress);
}
@@ -80,20 +80,20 @@ ReturnValue_t UdpTcPollingTask::handleSuccessfullTcRead(size_t bytesRead) {
#endif
ReturnValue_t result = tcStore->addData(&storeId, receptionBuffer.data(), bytesRead);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
#if FSFW_VERBOSE_LEVEL >= 1
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "UdpTcPollingTask::transferPusToSoftwareBus: Data storage failed." << std::endl;
sif::warning << "Packet size: " << bytesRead << std::endl;
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
#endif /* FSFW_VERBOSE_LEVEL >= 1 */
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
TmTcMessage message(storeId);
result = MessageQueueSenderIF::sendMessage(targetTcDestination, &message);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
#if FSFW_VERBOSE_LEVEL >= 1
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "UdpTcPollingTask::handleSuccessfullTcRead: "
@@ -124,11 +124,11 @@ ReturnValue_t UdpTcPollingTask::initialize() {
}
ReturnValue_t result = TcpIpBase::initialize();
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t UdpTcPollingTask::initializeAfterTaskCreation() {
@@ -138,7 +138,7 @@ ReturnValue_t UdpTcPollingTask::initializeAfterTaskCreation() {
/* The server socket is set up in the bridge intialization. Calling this function here
ensures that it is set up regardless of which class was initialized first */
this->serverSocket = tmtcBridge->serverSocket;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
void UdpTcPollingTask::setTimeout(double timeoutSeconds) {
diff --git a/src/fsfw/osal/common/UdpTmTcBridge.cpp b/src/fsfw/osal/common/UdpTmTcBridge.cpp
index e3cad58f..c0848ceb 100644
--- a/src/fsfw/osal/common/UdpTmTcBridge.cpp
+++ b/src/fsfw/osal/common/UdpTmTcBridge.cpp
@@ -22,7 +22,7 @@ const std::string UdpTmTcBridge::DEFAULT_SERVER_PORT = tcpip::DEFAULT_SERVER_POR
UdpTmTcBridge::UdpTmTcBridge(object_id_t objectId, object_id_t tcDestination,
const std::string &udpServerPort_, object_id_t tmStoreId,
object_id_t tcStoreId)
- : TmTcBridge(objectId, tcDestination, tmStoreId, tcStoreId) {
+ : TmTcBridge("UDP TMTC Bridge", objectId, tcDestination, tmStoreId, tcStoreId) {
if (udpServerPort_.empty()) {
udpServerPort = DEFAULT_SERVER_PORT;
} else {
@@ -35,7 +35,7 @@ UdpTmTcBridge::UdpTmTcBridge(object_id_t objectId, object_id_t tcDestination,
ReturnValue_t UdpTmTcBridge::initialize() {
ReturnValue_t result = TmTcBridge::initialize();
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "UdpTmTcBridge::initialize: TmTcBridge initialization failed!" << std::endl;
#endif
@@ -56,7 +56,7 @@ ReturnValue_t UdpTmTcBridge::initialize() {
#else
sif::printError("UdpTmTcBridge::UdpTmTcBridge: WSAStartup failed with error: %d\n", err);
#endif
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
#endif
@@ -75,14 +75,14 @@ ReturnValue_t UdpTmTcBridge::initialize() {
int retval = getaddrinfo(nullptr, udpServerPort.c_str(), &hints, &addrResult);
if (retval != 0) {
tcpip::handleError(tcpip::Protocol::UDP, tcpip::ErrorSources::GETADDRINFO_CALL);
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
serverSocket = socket(addrResult->ai_family, addrResult->ai_socktype, addrResult->ai_protocol);
if (serverSocket == INVALID_SOCKET) {
freeaddrinfo(addrResult);
tcpip::handleError(tcpip::Protocol::UDP, tcpip::ErrorSources::SOCKET_CALL);
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
#if FSFW_UDP_SEND_WIRETAPPING_ENABLED == 1
@@ -93,10 +93,10 @@ ReturnValue_t UdpTmTcBridge::initialize() {
if (retval != 0) {
freeaddrinfo(addrResult);
tcpip::handleError(tcpip::Protocol::UDP, tcpip::ErrorSources::BIND_CALL);
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
freeaddrinfo(addrResult);
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
UdpTmTcBridge::~UdpTmTcBridge() {
@@ -131,7 +131,7 @@ ReturnValue_t UdpTmTcBridge::sendTm(const uint8_t *data, size_t dataLen) {
" sent."
<< std::endl;
#endif
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
void UdpTmTcBridge::checkAndSetClientAddress(sockaddr &newAddress) {
diff --git a/src/fsfw/osal/freertos/BinSemaphUsingTask.cpp b/src/fsfw/osal/freertos/BinSemaphUsingTask.cpp
index 7ffd61d3..54226e18 100644
--- a/src/fsfw/osal/freertos/BinSemaphUsingTask.cpp
+++ b/src/fsfw/osal/freertos/BinSemaphUsingTask.cpp
@@ -42,7 +42,7 @@ ReturnValue_t BinarySemaphoreUsingTask::acquireWithTickTimeout(TimeoutType timeo
TickType_t timeoutTicks) {
BaseType_t returncode = ulTaskNotifyTake(pdTRUE, timeoutTicks);
if (returncode == pdPASS) {
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
} else {
return SemaphoreIF::SEMAPHORE_TIMEOUT;
}
@@ -56,10 +56,10 @@ ReturnValue_t BinarySemaphoreUsingTask::release(TaskHandle_t taskHandle) {
}
BaseType_t returncode = xTaskNotifyGive(taskHandle);
if (returncode == pdPASS) {
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
} else {
// This should never happen.
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
}
@@ -82,7 +82,7 @@ ReturnValue_t BinarySemaphoreUsingTask::releaseFromISR(TaskHandle_t taskHandle,
return SemaphoreIF::SEMAPHORE_NOT_OWNED;
}
vTaskNotifyGiveFromISR(taskHandle, higherPriorityTaskWoken);
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
uint8_t BinarySemaphoreUsingTask::getSemaphoreCounterFromISR(TaskHandle_t taskHandle,
diff --git a/src/fsfw/osal/freertos/BinSemaphUsingTask.h b/src/fsfw/osal/freertos/BinSemaphUsingTask.h
index 34b0d031..480296ee 100644
--- a/src/fsfw/osal/freertos/BinSemaphUsingTask.h
+++ b/src/fsfw/osal/freertos/BinSemaphUsingTask.h
@@ -2,7 +2,7 @@
#define FSFW_OSAL_FREERTOS_BINSEMAPHUSINGTASK_H_
#include "FreeRTOS.h"
-#include "fsfw/returnvalues/HasReturnvaluesIF.h"
+#include "fsfw/returnvalues/returnvalue.h"
#include "fsfw/tasks/SemaphoreIF.h"
#include "task.h"
@@ -20,7 +20,7 @@
* (for example in the initializeAfterTaskCreation() function) or
* by calling refreshTaskHandle() with the correct executing task.
*/
-class BinarySemaphoreUsingTask : public SemaphoreIF, public HasReturnvaluesIF {
+class BinarySemaphoreUsingTask : public SemaphoreIF {
public:
static const uint8_t INTERFACE_ID = CLASS_ID::SEMAPHORE_IF;
@@ -50,8 +50,8 @@ class BinarySemaphoreUsingTask : public SemaphoreIF, public HasReturnvaluesIF {
/**
* Same as acquire() with timeout in FreeRTOS ticks.
* @param timeoutTicks
- * @return - @c RETURN_OK on success
- * - @c RETURN_FAILED on failure
+ * @return - @c returnvalue::OK on success
+ * - @c returnvalue::FAILED on failure
*/
ReturnValue_t acquireWithTickTimeout(TimeoutType timeoutType = TimeoutType::BLOCKING,
TickType_t timeoutTicks = portMAX_DELAY);
@@ -65,8 +65,8 @@ class BinarySemaphoreUsingTask : public SemaphoreIF, public HasReturnvaluesIF {
/**
* Wrapper function to give back semaphore from handle
* @param semaphore
- * @return - @c RETURN_OK on success
- * - @c RETURN_FAILED on failure
+ * @return - @c returnvalue::OK on success
+ * - @c returnvalue::FAILED on failure
*/
static ReturnValue_t release(TaskHandle_t taskToNotify);
@@ -76,8 +76,8 @@ class BinarySemaphoreUsingTask : public SemaphoreIF, public HasReturnvaluesIF {
* @param higherPriorityTaskWoken This will be set to pdPASS if a task with
* a higher priority was unblocked. A context switch should be requested
* from an ISR if this is the case (see TaskManagement functions)
- * @return - @c RETURN_OK on success
- * - @c RETURN_FAILED on failure
+ * @return - @c returnvalue::OK on success
+ * - @c returnvalue::FAILED on failure
*/
static ReturnValue_t releaseFromISR(TaskHandle_t taskToNotify,
BaseType_t* higherPriorityTaskWoken);
diff --git a/src/fsfw/osal/freertos/BinarySemaphore.cpp b/src/fsfw/osal/freertos/BinarySemaphore.cpp
index 6e53380c..0ab621bc 100644
--- a/src/fsfw/osal/freertos/BinarySemaphore.cpp
+++ b/src/fsfw/osal/freertos/BinarySemaphore.cpp
@@ -59,7 +59,7 @@ ReturnValue_t BinarySemaphore::acquireWithTickTimeout(TimeoutType timeoutType,
BaseType_t returncode = xSemaphoreTake(handle, timeoutTicks);
if (returncode == pdPASS) {
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
} else {
return SemaphoreIF::SEMAPHORE_TIMEOUT;
}
@@ -73,7 +73,7 @@ ReturnValue_t BinarySemaphore::release(SemaphoreHandle_t semaphore) {
}
BaseType_t returncode = xSemaphoreGive(semaphore);
if (returncode == pdPASS) {
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
} else {
return SemaphoreIF::SEMAPHORE_NOT_OWNED;
}
@@ -91,7 +91,7 @@ ReturnValue_t BinarySemaphore::releaseFromISR(SemaphoreHandle_t semaphore,
}
BaseType_t returncode = xSemaphoreGiveFromISR(semaphore, higherPriorityTaskWoken);
if (returncode == pdPASS) {
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
} else {
return SemaphoreIF::SEMAPHORE_NOT_OWNED;
}
diff --git a/src/fsfw/osal/freertos/BinarySemaphore.h b/src/fsfw/osal/freertos/BinarySemaphore.h
index e2ca3c9d..bd1148ec 100644
--- a/src/fsfw/osal/freertos/BinarySemaphore.h
+++ b/src/fsfw/osal/freertos/BinarySemaphore.h
@@ -2,7 +2,7 @@
#define FSFW_OSAL_FREERTOS_BINARYSEMPAHORE_H_
#include "FreeRTOS.h"
-#include "fsfw/returnvalues/HasReturnvaluesIF.h"
+#include "fsfw/returnvalues/returnvalue.h"
#include "fsfw/tasks/SemaphoreIF.h"
#include "semphr.h"
@@ -22,7 +22,7 @@
* @author R. Mueller
* @ingroup osal
*/
-class BinarySemaphore : public SemaphoreIF, public HasReturnvaluesIF {
+class BinarySemaphore : public SemaphoreIF {
public:
static const uint8_t INTERFACE_ID = CLASS_ID::SEMAPHORE_IF;
@@ -47,7 +47,7 @@ class BinarySemaphore : public SemaphoreIF, public HasReturnvaluesIF {
* for a maximum of #timeoutMs or until the semaphore is given back,
* for example by an ISR or another task.
* @param timeoutMs
- * @return -@c RETURN_OK on success
+ * @return -@c returnvalue::OK on success
* -@c SemaphoreIF::SEMAPHORE_TIMEOUT on timeout
*/
ReturnValue_t acquire(TimeoutType timeoutType = TimeoutType::BLOCKING,
@@ -56,7 +56,7 @@ class BinarySemaphore : public SemaphoreIF, public HasReturnvaluesIF {
/**
* Same as lockBinarySemaphore() with timeout in FreeRTOS ticks.
* @param timeoutTicks
- * @return -@c RETURN_OK on success
+ * @return -@c returnvalue::OK on success
* -@c SemaphoreIF::SEMAPHORE_TIMEOUT on timeout
*/
ReturnValue_t acquireWithTickTimeout(TimeoutType timeoutType = TimeoutType::BLOCKING,
@@ -64,7 +64,7 @@ class BinarySemaphore : public SemaphoreIF, public HasReturnvaluesIF {
/**
* Release the binary semaphore.
- * @return -@c RETURN_OK on success
+ * @return -@c returnvalue::OK on success
* -@c SemaphoreIF::SEMAPHORE_NOT_OWNED if the semaphores is
* already available.
*/
@@ -79,7 +79,7 @@ class BinarySemaphore : public SemaphoreIF, public HasReturnvaluesIF {
/**
* Wrapper function to give back semaphore from handle
* @param semaphore
- * @return -@c RETURN_OK on success
+ * @return -@c returnvalue::OK on success
* -@c SemaphoreIF::SEMAPHORE_NOT_OWNED if the semaphores is
* already available.
*/
@@ -91,7 +91,7 @@ class BinarySemaphore : public SemaphoreIF, public HasReturnvaluesIF {
* @param higherPriorityTaskWoken This will be set to pdPASS if a task with
* a higher priority was unblocked. A context switch from an ISR should
* then be requested (see TaskManagement functions)
- * @return -@c RETURN_OK on success
+ * @return -@c returnvalue::OK on success
* -@c SemaphoreIF::SEMAPHORE_NOT_OWNED if the semaphores is
* already available.
*/
diff --git a/src/fsfw/osal/freertos/Clock.cpp b/src/fsfw/osal/freertos/Clock.cpp
index cabf7d81..dc00ac7e 100644
--- a/src/fsfw/osal/freertos/Clock.cpp
+++ b/src/fsfw/osal/freertos/Clock.cpp
@@ -17,7 +17,7 @@ ReturnValue_t Clock::setClock(const TimeOfDay_t* time) {
timeval time_timeval;
ReturnValue_t result = convertTimeOfDayToTimeval(time, &time_timeval);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
@@ -31,7 +31,7 @@ ReturnValue_t Clock::setClock(const timeval* time) {
Timekeeper::instance()->setOffset(offset);
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t Clock::getClock_timeval(timeval* time) {
@@ -41,13 +41,13 @@ ReturnValue_t Clock::getClock_timeval(timeval* time) {
*time = offset + uptime;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t Clock::getUptime(timeval* uptime) {
*uptime = getUptime();
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
timeval Clock::getUptime() {
@@ -58,7 +58,7 @@ timeval Clock::getUptime() {
ReturnValue_t Clock::getUptime(uint32_t* uptimeMs) {
timeval uptime = getUptime();
*uptimeMs = uptime.tv_sec * 1000 + uptime.tv_usec / 1000;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
// uint32_t Clock::getUptimeSeconds() {
@@ -69,17 +69,17 @@ ReturnValue_t Clock::getUptime(uint32_t* uptimeMs) {
ReturnValue_t Clock::getClock_usecs(uint64_t* time) {
timeval time_timeval;
ReturnValue_t result = getClock_timeval(&time_timeval);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
*time = time_timeval.tv_sec * 1000000 + time_timeval.tv_usec;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t Clock::getDateAndTime(TimeOfDay_t* time) {
timeval time_timeval;
ReturnValue_t result = getClock_timeval(&time_timeval);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
struct tm time_tm;
@@ -96,7 +96,7 @@ ReturnValue_t Clock::getDateAndTime(TimeOfDay_t* time) {
time->usecond = time_timeval.tv_usec;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t Clock::convertTimeOfDayToTimeval(const TimeOfDay_t* from, timeval* to) {
@@ -115,10 +115,10 @@ ReturnValue_t Clock::convertTimeOfDayToTimeval(const TimeOfDay_t* from, timeval*
to->tv_sec = seconds;
to->tv_usec = from->usecond;
// Fails in 2038..
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t Clock::convertTimevalToJD2000(timeval time, double* JD2000) {
*JD2000 = (time.tv_sec - 946728000. + time.tv_usec / 1000000.) / 24. / 3600.;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
diff --git a/src/fsfw/osal/freertos/CountingSemaphUsingTask.cpp b/src/fsfw/osal/freertos/CountingSemaphUsingTask.cpp
index 0e4d967d..f58e1be9 100644
--- a/src/fsfw/osal/freertos/CountingSemaphUsingTask.cpp
+++ b/src/fsfw/osal/freertos/CountingSemaphUsingTask.cpp
@@ -65,7 +65,7 @@ ReturnValue_t CountingSemaphoreUsingTask::acquireWithTickTimeout(TimeoutType tim
// Decrement notfication value without resetting it.
BaseType_t oldCount = ulTaskNotifyTake(pdFALSE, timeoutTicks);
if (getSemaphoreCounter() == oldCount - 1) {
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
} else {
return SemaphoreIF::SEMAPHORE_TIMEOUT;
}
@@ -81,10 +81,10 @@ ReturnValue_t CountingSemaphoreUsingTask::release() {
ReturnValue_t CountingSemaphoreUsingTask::release(TaskHandle_t taskToNotify) {
BaseType_t returncode = xTaskNotifyGive(taskToNotify);
if (returncode == pdPASS) {
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
} else {
// This should never happen.
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
}
@@ -99,7 +99,7 @@ TaskHandle_t CountingSemaphoreUsingTask::getTaskHandle() { return handle; }
ReturnValue_t CountingSemaphoreUsingTask::releaseFromISR(TaskHandle_t taskToNotify,
BaseType_t* higherPriorityTaskWoken) {
vTaskNotifyGiveFromISR(taskToNotify, higherPriorityTaskWoken);
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
uint8_t CountingSemaphoreUsingTask::getSemaphoreCounterFromISR(
diff --git a/src/fsfw/osal/freertos/CountingSemaphUsingTask.h b/src/fsfw/osal/freertos/CountingSemaphUsingTask.h
index 86b27267..4426f29b 100644
--- a/src/fsfw/osal/freertos/CountingSemaphUsingTask.h
+++ b/src/fsfw/osal/freertos/CountingSemaphUsingTask.h
@@ -30,7 +30,7 @@ class CountingSemaphoreUsingTask : public SemaphoreIF {
* for a maximum of #timeoutMs or until one is given back,
* for example by an ISR or another task.
* @param timeoutMs
- * @return -@c RETURN_OK on success
+ * @return -@c returnvalue::OK on success
* -@c SemaphoreIF::SEMAPHORE_TIMEOUT on timeout
*/
ReturnValue_t acquire(TimeoutType timeoutType = TimeoutType::BLOCKING,
@@ -39,7 +39,7 @@ class CountingSemaphoreUsingTask : public SemaphoreIF {
/**
* Release a semaphore, increasing the number of available counting
* semaphores up to the #maxCount value.
- * @return -@c RETURN_OK on success
+ * @return -@c returnvalue::OK on success
* -@c SemaphoreIF::SEMAPHORE_NOT_OWNED if #maxCount semaphores are
* already available.
*/
@@ -59,7 +59,7 @@ class CountingSemaphoreUsingTask : public SemaphoreIF {
/**
* Acquire with a timeout value in ticks
* @param timeoutTicks
- * @return -@c RETURN_OK on success
+ * @return -@c returnvalue::OK on success
* -@c SemaphoreIF::SEMAPHORE_TIMEOUT on timeout
*/
ReturnValue_t acquireWithTickTimeout(TimeoutType timeoutType = TimeoutType::BLOCKING,
@@ -74,7 +74,7 @@ class CountingSemaphoreUsingTask : public SemaphoreIF {
/**
* Release semaphore of task by supplying task handle
* @param taskToNotify
- * @return -@c RETURN_OK on success
+ * @return -@c returnvalue::OK on success
* -@c SemaphoreIF::SEMAPHORE_NOT_OWNED if #maxCount semaphores are
* already available.
*/
@@ -85,7 +85,7 @@ class CountingSemaphoreUsingTask : public SemaphoreIF {
* @param higherPriorityTaskWoken This will be set to pdPASS if a task with
* a higher priority was unblocked. A context switch should be requested
* from an ISR if this is the case (see TaskManagement functions)
- * @return -@c RETURN_OK on success
+ * @return -@c returnvalue::OK on success
* -@c SemaphoreIF::SEMAPHORE_NOT_OWNED if #maxCount semaphores are
* already available.
*/
diff --git a/src/fsfw/osal/freertos/FixedTimeslotTask.cpp b/src/fsfw/osal/freertos/FixedTimeslotTask.cpp
index e86636ab..a0a4ecee 100644
--- a/src/fsfw/osal/freertos/FixedTimeslotTask.cpp
+++ b/src/fsfw/osal/freertos/FixedTimeslotTask.cpp
@@ -48,7 +48,7 @@ ReturnValue_t FixedTimeslotTask::startTask() {
vTaskResume(handle);
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
[[noreturn]] void FixedTimeslotTask::taskFunctionality() {
@@ -108,7 +108,7 @@ void FixedTimeslotTask::handleMissedDeadline() {
ReturnValue_t FixedTimeslotTask::sleepFor(uint32_t ms) {
vTaskDelay(pdMS_TO_TICKS(ms));
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
TaskHandle_t FixedTimeslotTask::getTaskHandle() { return handle; }
diff --git a/src/fsfw/osal/freertos/MessageQueue.cpp b/src/fsfw/osal/freertos/MessageQueue.cpp
index d1a7f691..e449ef1e 100644
--- a/src/fsfw/osal/freertos/MessageQueue.cpp
+++ b/src/fsfw/osal/freertos/MessageQueue.cpp
@@ -48,14 +48,14 @@ ReturnValue_t MessageQueue::handleSendResult(BaseType_t result, bool ignoreFault
}
return MessageQueueIF::FULL;
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t MessageQueue::receiveMessage(MessageQueueMessageIF* message) {
BaseType_t result = xQueueReceive(handle, reinterpret_cast(message->getBuffer()), 0);
if (result == pdPASS) {
this->last = message->getSender();
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
} else {
return MessageQueueIF::EMPTY;
}
@@ -65,7 +65,7 @@ ReturnValue_t MessageQueue::flush(uint32_t* count) {
// TODO FreeRTOS does not support flushing partially
// Is always successful
xQueueReset(handle);
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
// static core function to send messages.
diff --git a/src/fsfw/osal/freertos/Mutex.cpp b/src/fsfw/osal/freertos/Mutex.cpp
index 1995e1ea..6c264dd6 100644
--- a/src/fsfw/osal/freertos/Mutex.cpp
+++ b/src/fsfw/osal/freertos/Mutex.cpp
@@ -31,7 +31,7 @@ ReturnValue_t Mutex::lockMutex(TimeoutType timeoutType, uint32_t timeoutMs) {
BaseType_t returncode = xSemaphoreTake(handle, timeout);
if (returncode == pdPASS) {
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
} else {
return MutexIF::MUTEX_TIMEOUT;
}
@@ -43,7 +43,7 @@ ReturnValue_t Mutex::unlockMutex() {
}
BaseType_t returncode = xSemaphoreGive(handle);
if (returncode == pdPASS) {
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
} else {
return MutexIF::CURR_THREAD_DOES_NOT_OWN_MUTEX;
}
diff --git a/src/fsfw/osal/freertos/PeriodicTask.cpp b/src/fsfw/osal/freertos/PeriodicTask.cpp
index 665be06c..2b6a94db 100644
--- a/src/fsfw/osal/freertos/PeriodicTask.cpp
+++ b/src/fsfw/osal/freertos/PeriodicTask.cpp
@@ -55,12 +55,12 @@ ReturnValue_t PeriodicTask::startTask() {
vTaskResume(handle);
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t PeriodicTask::sleepFor(uint32_t ms) {
vTaskDelay(pdMS_TO_TICKS(ms));
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
[[noreturn]] void PeriodicTask::taskFunctionality() {
diff --git a/src/fsfw/osal/freertos/QueueMapManager.cpp b/src/fsfw/osal/freertos/QueueMapManager.cpp
index cb3afb1c..172d9dff 100644
--- a/src/fsfw/osal/freertos/QueueMapManager.cpp
+++ b/src/fsfw/osal/freertos/QueueMapManager.cpp
@@ -34,12 +34,12 @@ ReturnValue_t QueueMapManager::addMessageQueue(QueueHandle_t queue, MessageQueue
"QueueMapManager::addMessageQueue This ID is already "
"inside the map!\n");
#endif
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
if (id != nullptr) {
*id = currentId;
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
QueueHandle_t QueueMapManager::getMessageQueue(MessageQueueId_t messageQueueId) const {
diff --git a/src/fsfw/osal/freertos/TaskFactory.cpp b/src/fsfw/osal/freertos/TaskFactory.cpp
index 7acd812f..688069cf 100644
--- a/src/fsfw/osal/freertos/TaskFactory.cpp
+++ b/src/fsfw/osal/freertos/TaskFactory.cpp
@@ -2,7 +2,7 @@
#include "fsfw/osal/freertos/FixedTimeslotTask.h"
#include "fsfw/osal/freertos/PeriodicTask.h"
-#include "fsfw/returnvalues/HasReturnvaluesIF.h"
+#include "fsfw/returnvalues/returnvalue.h"
TaskFactory* TaskFactory::factoryInstance = new TaskFactory();
@@ -31,16 +31,16 @@ ReturnValue_t TaskFactory::deleteTask(PeriodicTaskIF* task) {
if (task == nullptr) {
// delete self
vTaskDelete(nullptr);
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
} else {
// TODO not implemented
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
}
ReturnValue_t TaskFactory::delayTask(uint32_t delayMs) {
vTaskDelay(pdMS_TO_TICKS(delayMs));
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
void TaskFactory::printMissedDeadline() {
diff --git a/src/fsfw/osal/freertos/TaskManagement.h b/src/fsfw/osal/freertos/TaskManagement.h
index 825d8865..6dec15cc 100644
--- a/src/fsfw/osal/freertos/TaskManagement.h
+++ b/src/fsfw/osal/freertos/TaskManagement.h
@@ -3,7 +3,7 @@
#include
-#include "../../returnvalues/HasReturnvaluesIF.h"
+#include "../../returnvalues/returnvalue.h"
#include "FreeRTOS.h"
#include "task.h"
diff --git a/src/fsfw/osal/host/Clock.cpp b/src/fsfw/osal/host/Clock.cpp
index 19e120b3..29c6c1a6 100644
--- a/src/fsfw/osal/host/Clock.cpp
+++ b/src/fsfw/osal/host/Clock.cpp
@@ -32,7 +32,7 @@ ReturnValue_t Clock::setClock(const TimeOfDay_t* time) {
#else
sif::printWarning("Clock::setClock: Not implemented for host OSAL\n");
#endif
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t Clock::setClock(const timeval* time) {
@@ -43,7 +43,7 @@ ReturnValue_t Clock::setClock(const timeval* time) {
#else
sif::printWarning("Clock::setClock: Not implemented for host OSAL\n");
#endif
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t Clock::getClock_timeval(timeval* time) {
@@ -54,33 +54,33 @@ ReturnValue_t Clock::getClock_timeval(timeval* time) {
time->tv_sec = std::chrono::duration_cast(epoch).count();
auto fraction = now - secondsChrono;
time->tv_usec = std::chrono::duration_cast(fraction).count();
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
#elif defined(PLATFORM_UNIX)
timespec timeUnix;
int status = clock_gettime(CLOCK_REALTIME, &timeUnix);
if (status != 0) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
time->tv_sec = timeUnix.tv_sec;
time->tv_usec = timeUnix.tv_nsec / 1000.0;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
#else
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "Clock::getUptime: Not implemented for found OS!" << std::endl;
#else
sif::printWarning("Clock::getUptime: Not implemented for found OS!\n");
#endif
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
#endif
}
ReturnValue_t Clock::getClock_usecs(uint64_t* time) {
if (time == nullptr) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
using namespace std::chrono;
*time = duration_cast(system_clock::now().time_since_epoch()).count();
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
timeval Clock::getUptime() {
@@ -108,13 +108,13 @@ timeval Clock::getUptime() {
ReturnValue_t Clock::getUptime(timeval* uptime) {
*uptime = getUptime();
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t Clock::getUptime(uint32_t* uptimeMs) {
timeval uptime = getUptime();
*uptimeMs = uptime.tv_sec * 1000 + uptime.tv_usec / 1000;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t Clock::getDateAndTime(TimeOfDay_t* time) {
@@ -126,7 +126,7 @@ ReturnValue_t Clock::getDateAndTime(TimeOfDay_t* time) {
auto fraction = now - seconds;
time_t tt = SystemClock::to_time_t(now);
ReturnValue_t result = checkOrCreateClockMutex();
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
MutexGuard helper(timeMutex);
@@ -142,11 +142,11 @@ ReturnValue_t Clock::getDateAndTime(TimeOfDay_t* time) {
time->second = timeInfo->tm_sec;
auto usecond = std::chrono::duration_cast(fraction);
time->usecond = usecond.count();
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t Clock::convertTimeOfDayToTimeval(const TimeOfDay_t* from, timeval* to) {
- struct tm time_tm;
+ struct tm time_tm {};
time_tm.tm_year = from->year - 1900;
time_tm.tm_mon = from->month - 1;
@@ -162,10 +162,10 @@ ReturnValue_t Clock::convertTimeOfDayToTimeval(const TimeOfDay_t* from, timeval*
to->tv_sec = seconds;
to->tv_usec = from->usecond;
// Fails in 2038..
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t Clock::convertTimevalToJD2000(timeval time, double* JD2000) {
*JD2000 = (time.tv_sec - 946728000. + time.tv_usec / 1000000.) / 24. / 3600.;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
diff --git a/src/fsfw/osal/host/FixedTimeslotTask.cpp b/src/fsfw/osal/host/FixedTimeslotTask.cpp
index 1d10b8d8..edb2d52d 100644
--- a/src/fsfw/osal/host/FixedTimeslotTask.cpp
+++ b/src/fsfw/osal/host/FixedTimeslotTask.cpp
@@ -66,12 +66,12 @@ ReturnValue_t FixedTimeslotTask::startTask() {
std::lock_guard lock(initMutex);
initCondition.notify_one();
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t FixedTimeslotTask::sleepFor(uint32_t ms) {
std::this_thread::sleep_for(std::chrono::milliseconds(ms));
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
void FixedTimeslotTask::taskFunctionality() {
diff --git a/src/fsfw/osal/host/MessageQueue.cpp b/src/fsfw/osal/host/MessageQueue.cpp
index d0a12850..a4781cdb 100644
--- a/src/fsfw/osal/host/MessageQueue.cpp
+++ b/src/fsfw/osal/host/MessageQueue.cpp
@@ -14,7 +14,7 @@ MessageQueue::MessageQueue(size_t messageDepth, size_t maxMessageSize, MqArgs* a
messageDepth(messageDepth) {
queueLock = MutexFactory::instance()->createMutex();
auto result = QueueMapManager::instance()->addMessageQueue(this, &id);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "MessageQueue::MessageQueue: Could not be created" << std::endl;
#else
@@ -40,14 +40,14 @@ ReturnValue_t MessageQueue::receiveMessage(MessageQueueMessageIF* message) {
messageQueue.pop();
// The last partner is the first uint32_t field in the message
this->last = message->getSender();
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t MessageQueue::flush(uint32_t* count) {
*count = messageQueue.size();
// Clears the queue.
messageQueue = std::queue>();
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
// static core function to send messages.
@@ -56,20 +56,20 @@ ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo,
MessageQueueId_t sentFrom,
bool ignoreFault) {
if (message == nullptr) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
message->setSender(sentFrom);
if (message->getMessageSize() > message->getMaximumMessageSize()) {
// Actually, this should never happen or an error will be emitted
// in MessageQueueMessage.
// But I will still return a failure here.
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
- MessageQueue* targetQueue =
+ auto* targetQueue =
dynamic_cast(QueueMapManager::instance()->getMessageQueue(sendTo));
if (targetQueue == nullptr) {
if (not ignoreFault) {
- InternalErrorReporterIF* internalErrorReporter =
+ auto* internalErrorReporter =
ObjectManager::instance()->get(objects::INTERNAL_ERROR_REPORTER);
if (internalErrorReporter != nullptr) {
internalErrorReporter->queueMessageNotSent();
@@ -84,7 +84,7 @@ ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo,
message->getMaximumMessageSize());
} else {
if (not ignoreFault) {
- InternalErrorReporterIF* internalErrorReporter =
+ auto* internalErrorReporter =
ObjectManager::instance()->get(objects::INTERNAL_ERROR_REPORTER);
if (internalErrorReporter != nullptr) {
internalErrorReporter->queueMessageNotSent();
@@ -92,7 +92,7 @@ ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo,
}
return MessageQueueIF::FULL;
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t MessageQueue::lockQueue(MutexIF::TimeoutType timeoutType, dur_millis_t lockTimeout) {
diff --git a/src/fsfw/osal/host/MessageQueue.h b/src/fsfw/osal/host/MessageQueue.h
index 4020c6dc..7d60fb8e 100644
--- a/src/fsfw/osal/host/MessageQueue.h
+++ b/src/fsfw/osal/host/MessageQueue.h
@@ -68,7 +68,7 @@ class MessageQueue : public MessageQueueBase {
* @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
virtual ReturnValue_t sendMessageFrom(MessageQueueId_t sendTo, MessageQueueMessageIF* message,
@@ -111,8 +111,6 @@ class MessageQueue : public MessageQueueBase {
size_t messageDepth = 0;
MutexIF* queueLock;
-
- MessageQueueId_t defaultDestination = MessageQueueIF::NO_QUEUE;
};
#endif /* FRAMEWORK_OSAL_HOST_MESSAGEQUEUE_H_ */
diff --git a/src/fsfw/osal/host/Mutex.cpp b/src/fsfw/osal/host/Mutex.cpp
index 4b7a9582..2b67c7b5 100644
--- a/src/fsfw/osal/host/Mutex.cpp
+++ b/src/fsfw/osal/host/Mutex.cpp
@@ -7,15 +7,15 @@ Mutex::Mutex() {}
ReturnValue_t Mutex::lockMutex(TimeoutType timeoutType, uint32_t timeoutMs) {
if (timeoutType == TimeoutType::BLOCKING) {
mutex.lock();
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
} else if (timeoutType == TimeoutType::POLLING) {
if (mutex.try_lock()) {
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
} else if (timeoutType == TimeoutType::WAITING) {
auto chronoMs = std::chrono::milliseconds(timeoutMs);
if (mutex.try_lock_for(chronoMs)) {
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
}
return MutexIF::MUTEX_TIMEOUT;
@@ -23,7 +23,7 @@ ReturnValue_t Mutex::lockMutex(TimeoutType timeoutType, uint32_t timeoutMs) {
ReturnValue_t Mutex::unlockMutex() {
mutex.unlock();
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
std::timed_mutex* Mutex::getMutexHandle() { return &mutex; }
diff --git a/src/fsfw/osal/host/PeriodicTask.cpp b/src/fsfw/osal/host/PeriodicTask.cpp
index 1f18d335..e16aead0 100644
--- a/src/fsfw/osal/host/PeriodicTask.cpp
+++ b/src/fsfw/osal/host/PeriodicTask.cpp
@@ -63,12 +63,12 @@ ReturnValue_t PeriodicTask::startTask() {
std::lock_guard lock(initMutex);
initCondition.notify_one();
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t PeriodicTask::sleepFor(uint32_t ms) {
std::this_thread::sleep_for(std::chrono::milliseconds(ms));
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
void PeriodicTask::taskFunctionality() {
diff --git a/src/fsfw/osal/host/QueueFactory.cpp b/src/fsfw/osal/host/QueueFactory.cpp
index 732892ca..e2d83fd4 100644
--- a/src/fsfw/osal/host/QueueFactory.cpp
+++ b/src/fsfw/osal/host/QueueFactory.cpp
@@ -13,7 +13,6 @@ ReturnValue_t MessageQueueSenderIF::sendMessage(MessageQueueId_t sendTo,
MessageQueueMessageIF* message,
MessageQueueId_t sentFrom, bool ignoreFault) {
return MessageQueue::sendMessageFromMessageQueue(sendTo, message, sentFrom, ignoreFault);
- return HasReturnvaluesIF::RETURN_OK;
}
QueueFactory* QueueFactory::instance() {
@@ -23,9 +22,9 @@ QueueFactory* QueueFactory::instance() {
return factoryInstance;
}
-QueueFactory::QueueFactory() {}
+QueueFactory::QueueFactory() = default;
-QueueFactory::~QueueFactory() {}
+QueueFactory::~QueueFactory() = default;
MessageQueueIF* QueueFactory::createMessageQueue(uint32_t messageDepth, size_t maxMessageSize,
MqArgs* args) {
diff --git a/src/fsfw/osal/host/QueueMapManager.cpp b/src/fsfw/osal/host/QueueMapManager.cpp
index 72c70baa..d7efb0dd 100644
--- a/src/fsfw/osal/host/QueueMapManager.cpp
+++ b/src/fsfw/osal/host/QueueMapManager.cpp
@@ -39,12 +39,12 @@ ReturnValue_t QueueMapManager::addMessageQueue(MessageQueueIF* queueToInsert,
"QueueMapManager::addMessageQueue This ID is already "
"inside the map!\n");
#endif
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
if (id != nullptr) {
*id = currentId;
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
MessageQueueIF* QueueMapManager::getMessageQueue(MessageQueueId_t messageQueueId) const {
@@ -54,7 +54,7 @@ MessageQueueIF* QueueMapManager::getMessageQueue(MessageQueueId_t messageQueueId
} else {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "QueueMapManager::getQueueHandle: The ID " << messageQueueId
- << " does not exists in the map!" << std::endl;
+ << " does not exist in the map" << std::endl;
#else
sif::printWarning("QueueMapManager::getQueueHandle: The ID %d does not exist in the map!\n",
messageQueueId);
diff --git a/src/fsfw/osal/host/TaskFactory.cpp b/src/fsfw/osal/host/TaskFactory.cpp
index ec4c1554..0a27241b 100644
--- a/src/fsfw/osal/host/TaskFactory.cpp
+++ b/src/fsfw/osal/host/TaskFactory.cpp
@@ -5,7 +5,7 @@
#include "fsfw/osal/host/FixedTimeslotTask.h"
#include "fsfw/osal/host/PeriodicTask.h"
#include "fsfw/osal/host/taskHelpers.h"
-#include "fsfw/returnvalues/HasReturnvaluesIF.h"
+#include "fsfw/returnvalues/returnvalue.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
#include "fsfw/tasks/PeriodicTaskIF.h"
@@ -37,12 +37,12 @@ FixedTimeslotTaskIF* TaskFactory::createFixedTimeslotTask(
ReturnValue_t TaskFactory::deleteTask(PeriodicTaskIF* task) {
// This might block for some time!
delete task;
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
ReturnValue_t TaskFactory::delayTask(uint32_t delayMs) {
std::this_thread::sleep_for(std::chrono::milliseconds(delayMs));
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
void TaskFactory::printMissedDeadline() {
diff --git a/src/fsfw/osal/host/taskHelpers.cpp b/src/fsfw/osal/host/taskHelpers.cpp
index 432cf30c..e5a931ed 100644
--- a/src/fsfw/osal/host/taskHelpers.cpp
+++ b/src/fsfw/osal/host/taskHelpers.cpp
@@ -10,9 +10,9 @@ ReturnValue_t tasks::insertTaskName(std::thread::id threadId, const std::string&
std::lock_guard lg(nameMapLock);
auto returnPair = taskNameMap.emplace(threadId, taskName);
if (not returnPair.second) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
std::string tasks::getTaskName(std::thread::id threadId) {
diff --git a/src/fsfw/osal/host/taskHelpers.h b/src/fsfw/osal/host/taskHelpers.h
index 13a71d16..7d9ff33c 100644
--- a/src/fsfw/osal/host/taskHelpers.h
+++ b/src/fsfw/osal/host/taskHelpers.h
@@ -1,7 +1,7 @@
#ifndef FSFW_OSAL_HOST_TASKHELPERS_H_
#define FSFW_OSAL_HOST_TASKHELPERS_H_
-#include
+#include
#include
diff --git a/src/fsfw/osal/linux/BinarySemaphore.cpp b/src/fsfw/osal/linux/BinarySemaphore.cpp
index 4fb67f15..9b954d6c 100644
--- a/src/fsfw/osal/linux/BinarySemaphore.cpp
+++ b/src/fsfw/osal/linux/BinarySemaphore.cpp
@@ -43,7 +43,7 @@ ReturnValue_t BinarySemaphore::acquire(TimeoutType timeoutType, uint32_t timeout
}
}
if (result == 0) {
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
switch (errno) {
@@ -62,10 +62,10 @@ ReturnValue_t BinarySemaphore::acquire(TimeoutType timeoutType, uint32_t timeout
case (EINTR): {
// Call was interrupted by signal handler
utility::printUnixErrorGeneric(CLASS_NAME, "acquire", "EINTR");
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
default:
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
}
@@ -73,13 +73,13 @@ ReturnValue_t BinarySemaphore::release() { return BinarySemaphore::release(&this
ReturnValue_t BinarySemaphore::release(sem_t* handle) {
ReturnValue_t countResult = checkCount(handle, 1);
- if (countResult != HasReturnvaluesIF::RETURN_OK) {
+ if (countResult != returnvalue::OK) {
return countResult;
}
int result = sem_post(handle);
if (result == 0) {
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
switch (errno) {
@@ -91,10 +91,10 @@ ReturnValue_t BinarySemaphore::release(sem_t* handle) {
case (EOVERFLOW): {
// SEM_MAX_VALUE overflow. This should never happen
utility::printUnixErrorGeneric(CLASS_NAME, "release", "EOVERFLOW");
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
default:
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
}
@@ -145,9 +145,9 @@ ReturnValue_t BinarySemaphore::checkCount(sem_t* handle, uint8_t maxCount) {
// This is a config error use lightweight printf is this is called
// from an interrupt
printf("BinarySemaphore::release: Value of binary semaphore greater than 1!\n");
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
return SemaphoreIF::SEMAPHORE_NOT_OWNED;
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
diff --git a/src/fsfw/osal/linux/BinarySemaphore.h b/src/fsfw/osal/linux/BinarySemaphore.h
index f75618a6..fe2c0db0 100644
--- a/src/fsfw/osal/linux/BinarySemaphore.h
+++ b/src/fsfw/osal/linux/BinarySemaphore.h
@@ -1,7 +1,7 @@
#ifndef FRAMEWORK_OSAL_LINUX_BINARYSEMPAHORE_H_
#define FRAMEWORK_OSAL_LINUX_BINARYSEMPAHORE_H_
-#include "../../returnvalues/HasReturnvaluesIF.h"
+#include "../../returnvalues/returnvalue.h"
#include "../../tasks/SemaphoreIF.h"
extern "C" {
@@ -17,7 +17,7 @@ extern "C" {
* @author R. Mueller
* @ingroup osal
*/
-class BinarySemaphore : public SemaphoreIF, public HasReturnvaluesIF {
+class BinarySemaphore : public SemaphoreIF {
public:
static const uint8_t INTERFACE_ID = CLASS_ID::SEMAPHORE_IF;
@@ -45,7 +45,7 @@ class BinarySemaphore : public SemaphoreIF, public HasReturnvaluesIF {
* for a maximum of #timeoutMs or until the semaphore is given back,
* for example by an ISR or another task.
* @param timeoutMs
- * @return -@c RETURN_OK on success
+ * @return -@c returnvalue::OK on success
* -@c SemaphoreIF::SEMAPHORE_TIMEOUT on timeout
*/
ReturnValue_t acquire(TimeoutType timeoutType = TimeoutType::BLOCKING,
@@ -53,7 +53,7 @@ class BinarySemaphore : public SemaphoreIF, public HasReturnvaluesIF {
/**
* Release the binary semaphore.
- * @return -@c RETURN_OK on success
+ * @return -@c returnvalue::OK on success
* -@c SemaphoreIF::SEMAPHORE_NOT_OWNED if the semaphores is
* already available.
*/
diff --git a/src/fsfw/osal/linux/Clock.cpp b/src/fsfw/osal/linux/Clock.cpp
index 534e7e22..bfdcf4e2 100644
--- a/src/fsfw/osal/linux/Clock.cpp
+++ b/src/fsfw/osal/linux/Clock.cpp
@@ -2,23 +2,22 @@
#include
#include
-#include
-#include
#include
+#include
#include
#include "fsfw/ipc/MutexGuard.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
-uint32_t Clock::getTicksPerSecond(void) {
+uint32_t Clock::getTicksPerSecond() {
uint32_t ticks = sysconf(_SC_CLK_TCK);
return ticks;
}
ReturnValue_t Clock::setClock(const TimeOfDay_t* time) {
- timespec timeUnix;
- timeval timeTimeval;
+ timespec timeUnix{};
+ timeval timeTimeval{};
convertTimeOfDayToTimeval(time, &timeTimeval);
timeUnix.tv_sec = timeTimeval.tv_sec;
timeUnix.tv_nsec = (__syscall_slong_t)timeTimeval.tv_usec * 1000;
@@ -26,49 +25,49 @@ ReturnValue_t Clock::setClock(const TimeOfDay_t* time) {
int status = clock_settime(CLOCK_REALTIME, &timeUnix);
if (status != 0) {
// TODO errno
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t Clock::setClock(const timeval* time) {
- timespec timeUnix;
+ timespec timeUnix{};
timeUnix.tv_sec = time->tv_sec;
timeUnix.tv_nsec = (__syscall_slong_t)time->tv_usec * 1000;
int status = clock_settime(CLOCK_REALTIME, &timeUnix);
if (status != 0) {
// TODO errno
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t Clock::getClock_timeval(timeval* time) {
- timespec timeUnix;
+ timespec timeUnix{};
int status = clock_gettime(CLOCK_REALTIME, &timeUnix);
if (status != 0) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
time->tv_sec = timeUnix.tv_sec;
time->tv_usec = timeUnix.tv_nsec / 1000.0;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t Clock::getClock_usecs(uint64_t* time) {
- timeval timeVal;
+ timeval timeVal{};
ReturnValue_t result = getClock_timeval(&timeVal);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
- *time = (uint64_t)timeVal.tv_sec * 1e6 + timeVal.tv_usec;
+ *time = static_cast(timeVal.tv_sec) * 1e6 + timeVal.tv_usec;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
timeval Clock::getUptime() {
- timeval uptime;
+ timeval uptime{};
auto result = getUptime(&uptime);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "Clock::getUptime: Error getting uptime" << std::endl;
#endif
@@ -84,7 +83,7 @@ ReturnValue_t Clock::getUptime(timeval* uptime) {
uptime->tv_sec = uptimeSeconds;
uptime->tv_usec = uptimeSeconds * (double)1e6 - (uptime->tv_sec * 1e6);
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
// Wait for new FSFW Clock function delivering seconds uptime.
@@ -93,36 +92,36 @@ ReturnValue_t Clock::getUptime(timeval* uptime) {
// struct sysinfo sysInfo;
// int result = sysinfo(&sysInfo);
// if(result != 0){
-// return HasReturnvaluesIF::RETURN_FAILED;
+// return returnvalue::FAILED;
// }
// return sysInfo.uptime;
//}
ReturnValue_t Clock::getUptime(uint32_t* uptimeMs) {
- timeval uptime;
+ timeval uptime{};
ReturnValue_t result = getUptime(&uptime);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
*uptimeMs = uptime.tv_sec * 1e3 + uptime.tv_usec / 1e3;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t Clock::getDateAndTime(TimeOfDay_t* time) {
- timespec timeUnix;
+ timespec timeUnix{};
int status = clock_gettime(CLOCK_REALTIME, &timeUnix);
if (status != 0) {
// TODO errno
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
ReturnValue_t result = checkOrCreateClockMutex();
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
MutexGuard helper(timeMutex);
// gmtime writes its output in a global buffer which is not Thread Safe
// Therefore we have to use a Mutex here
- struct tm* timeInfo;
+ struct std::tm* timeInfo;
timeInfo = gmtime(&timeUnix.tv_sec);
time->year = timeInfo->tm_year + 1900;
time->month = timeInfo->tm_mon + 1;
@@ -132,11 +131,11 @@ ReturnValue_t Clock::getDateAndTime(TimeOfDay_t* time) {
time->second = timeInfo->tm_sec;
time->usecond = timeUnix.tv_nsec / 1000.0;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t Clock::convertTimeOfDayToTimeval(const TimeOfDay_t* from, timeval* to) {
- tm fromTm;
+ std::tm fromTm{};
// Note: Fails for years before AD
fromTm.tm_year = from->year - 1900;
fromTm.tm_mon = from->month - 1;
@@ -148,10 +147,10 @@ ReturnValue_t Clock::convertTimeOfDayToTimeval(const TimeOfDay_t* from, timeval*
to->tv_sec = timegm(&fromTm);
to->tv_usec = from->usecond;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t Clock::convertTimevalToJD2000(timeval time, double* JD2000) {
*JD2000 = (time.tv_sec - 946728000. + time.tv_usec / 1000000.) / 24. / 3600.;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
diff --git a/src/fsfw/osal/linux/CountingSemaphore.cpp b/src/fsfw/osal/linux/CountingSemaphore.cpp
index 78210996..e2b006d9 100644
--- a/src/fsfw/osal/linux/CountingSemaphore.cpp
+++ b/src/fsfw/osal/linux/CountingSemaphore.cpp
@@ -35,7 +35,7 @@ CountingSemaphore& CountingSemaphore::operator=(CountingSemaphore&& other) {
ReturnValue_t CountingSemaphore::release() {
ReturnValue_t result = checkCount(&handle, maxCount);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
return CountingSemaphore::release(&this->handle);
@@ -44,7 +44,7 @@ ReturnValue_t CountingSemaphore::release() {
ReturnValue_t CountingSemaphore::release(sem_t* handle) {
int result = sem_post(handle);
if (result == 0) {
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
switch (errno) {
@@ -61,7 +61,7 @@ ReturnValue_t CountingSemaphore::release(sem_t* handle) {
}
default:
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
}
diff --git a/src/fsfw/osal/linux/FixedTimeslotTask.cpp b/src/fsfw/osal/linux/FixedTimeslotTask.cpp
index 775acea8..34729c22 100644
--- a/src/fsfw/osal/linux/FixedTimeslotTask.cpp
+++ b/src/fsfw/osal/linux/FixedTimeslotTask.cpp
@@ -23,7 +23,7 @@ void* FixedTimeslotTask::taskEntryPoint(void* arg) {
ReturnValue_t FixedTimeslotTask::startTask() {
started = true;
posixThread.createTask(&taskEntryPoint, this);
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t FixedTimeslotTask::sleepFor(uint32_t ms) {
@@ -54,7 +54,7 @@ ReturnValue_t FixedTimeslotTask::sleepFor(uint32_t ms) {
// If the deadline was missed, the deadlineMissedFunc is called.
if (!PosixThread::delayUntil(&lastWakeTime, interval)) {
// No time left on timer -> we missed the deadline
- if(dlmFunc != nullptr){
+ if (dlmFunc != nullptr) {
dlmFunc();
}
}
diff --git a/src/fsfw/osal/linux/InternalErrorCodes.cpp b/src/fsfw/osal/linux/InternalErrorCodes.cpp
index 11913906..41472b0c 100644
--- a/src/fsfw/osal/linux/InternalErrorCodes.cpp
+++ b/src/fsfw/osal/linux/InternalErrorCodes.cpp
@@ -2,7 +2,7 @@
ReturnValue_t InternalErrorCodes::translate(uint8_t code) {
// TODO This class can be removed
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
InternalErrorCodes::InternalErrorCodes() {}
diff --git a/src/fsfw/osal/linux/MessageQueue.cpp b/src/fsfw/osal/linux/MessageQueue.cpp
index 378f4e74..b2cca3f1 100644
--- a/src/fsfw/osal/linux/MessageQueue.cpp
+++ b/src/fsfw/osal/linux/MessageQueue.cpp
@@ -54,7 +54,7 @@ ReturnValue_t MessageQueue::receiveMessage(MessageQueueMessageIF* message) {
"nullptr!"
<< std::endl;
#endif
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
if (message->getMaximumMessageSize() < maxMessageSize) {
@@ -62,7 +62,7 @@ ReturnValue_t MessageQueue::receiveMessage(MessageQueueMessageIF* message) {
sif::error << "MessageQueue::receiveMessage: Message size " << message->getMaximumMessageSize()
<< " too small to receive data!" << std::endl;
#endif
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
unsigned int messagePriority = 0;
@@ -72,9 +72,9 @@ ReturnValue_t MessageQueue::receiveMessage(MessageQueueMessageIF* message) {
this->last = message->getSender();
// Check size of incoming message.
if (message->getMessageSize() < message->getMinimumMessageSize()) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
} else if (status == 0) {
// Success but no message received
return MessageQueueIF::EMPTY;
@@ -131,9 +131,9 @@ ReturnValue_t MessageQueue::receiveMessage(MessageQueueMessageIF* message) {
}
default:
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
}
@@ -152,9 +152,9 @@ ReturnValue_t MessageQueue::flush(uint32_t* count) {
utility::printUnixErrorGeneric(CLASS_NAME, "flush", "EINVAL");
break;
default:
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
*count = attrib.mq_curmsgs;
attrib.mq_curmsgs = 0;
@@ -176,11 +176,11 @@ ReturnValue_t MessageQueue::flush(uint32_t* count) {
utility::printUnixErrorGeneric(CLASS_NAME, "flush", "EINVAL");
break;
default:
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t MessageQueue::sendMessageFrom(MessageQueueId_t sendTo, MessageQueueMessageIF* message,
@@ -200,7 +200,7 @@ ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo,
#else
sif::printError("MessageQueue::sendMessageFromMessageQueue: Message is nullptr\n");
#endif
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
message->setSender(sentFrom);
@@ -257,11 +257,11 @@ ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo,
utility::printUnixErrorGeneric(CLASS_NAME, "sendMessageFromMessageQueue", "EMSGSIZE");
break;
default:
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t MessageQueue::handleOpenError(mq_attr* attributes, uint32_t messageDepth) {
@@ -290,9 +290,9 @@ ReturnValue_t MessageQueue::handleOpenError(mq_attr* attributes, uint32_t messag
*/
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "MessageQueue::MessageQueue: Default MQ size " << defaultMqMaxMsg
- << " is too small for requested size " << messageDepth << std::endl;
+ << " is too small for requested message depth " << messageDepth << std::endl;
sif::error << "This error can be fixed by setting the maximum "
- "allowed message size higher!"
+ "allowed message depth higher"
<< std::endl;
#else
sif::printError(
@@ -320,7 +320,7 @@ ReturnValue_t MessageQueue::handleOpenError(mq_attr* attributes, uint32_t messag
if (tempId != -1) {
// Successful mq_open
this->id = tempId;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
}
break;
@@ -331,5 +331,5 @@ ReturnValue_t MessageQueue::handleOpenError(mq_attr* attributes, uint32_t messag
utility::printUnixErrorGeneric(CLASS_NAME, "MessageQueue", "Unknown");
}
}
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
diff --git a/src/fsfw/osal/linux/Mutex.cpp b/src/fsfw/osal/linux/Mutex.cpp
index 2698fb54..be7a0a85 100644
--- a/src/fsfw/osal/linux/Mutex.cpp
+++ b/src/fsfw/osal/linux/Mutex.cpp
@@ -82,9 +82,9 @@ ReturnValue_t Mutex::lockMutex(TimeoutType timeoutType, uint32_t timeoutMs) {
return CURR_THREAD_ALREADY_OWNS_MUTEX;
case 0:
// Success
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
default:
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
};
}
@@ -103,8 +103,8 @@ ReturnValue_t Mutex::unlockMutex() {
return CURR_THREAD_DOES_NOT_OWN_MUTEX;
case 0:
// Success
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
default:
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
};
}
diff --git a/src/fsfw/osal/linux/PeriodicPosixTask.cpp b/src/fsfw/osal/linux/PeriodicPosixTask.cpp
index 09b106ed..556a0367 100644
--- a/src/fsfw/osal/linux/PeriodicPosixTask.cpp
+++ b/src/fsfw/osal/linux/PeriodicPosixTask.cpp
@@ -23,11 +23,11 @@ ReturnValue_t PeriodicPosixTask::sleepFor(uint32_t ms) {
ReturnValue_t PeriodicPosixTask::startTask() {
if (isEmpty()) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
started = true;
posixThread.createTask(&taskEntryPoint, this);
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
[[noreturn]] void PeriodicPosixTask::taskFunctionality() {
diff --git a/src/fsfw/osal/linux/PosixThread.cpp b/src/fsfw/osal/linux/PosixThread.cpp
index 9fc088ae..811d58e2 100644
--- a/src/fsfw/osal/linux/PosixThread.cpp
+++ b/src/fsfw/osal/linux/PosixThread.cpp
@@ -29,16 +29,16 @@ ReturnValue_t PosixThread::sleep(uint64_t ns) {
switch (errno) {
case EINTR:
// The nanosleep() function was interrupted by a signal.
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
case EINVAL:
// The rqtp argument specified a nanosecond value less than zero or
// greater than or equal to 1000 million.
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
default:
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
void PosixThread::suspend() {
diff --git a/src/fsfw/osal/linux/PosixThread.h b/src/fsfw/osal/linux/PosixThread.h
index 78fdfa2b..add41bf6 100644
--- a/src/fsfw/osal/linux/PosixThread.h
+++ b/src/fsfw/osal/linux/PosixThread.h
@@ -7,7 +7,7 @@
#include
-#include "../../returnvalues/HasReturnvaluesIF.h"
+#include "../../returnvalues/returnvalue.h"
class PosixThread {
public:
diff --git a/src/fsfw/osal/linux/TaskFactory.cpp b/src/fsfw/osal/linux/TaskFactory.cpp
index a28e685d..bacc4311 100644
--- a/src/fsfw/osal/linux/TaskFactory.cpp
+++ b/src/fsfw/osal/linux/TaskFactory.cpp
@@ -2,7 +2,7 @@
#include "fsfw/osal/linux/FixedTimeslotTask.h"
#include "fsfw/osal/linux/PeriodicPosixTask.h"
-#include "fsfw/returnvalues/HasReturnvaluesIF.h"
+#include "fsfw/returnvalues/returnvalue.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
// TODO: Different variant than the lazy loading in QueueFactory. What's better and why?
@@ -28,7 +28,7 @@ FixedTimeslotTaskIF* TaskFactory::createFixedTimeslotTask(
ReturnValue_t TaskFactory::deleteTask(PeriodicTaskIF* task) {
// TODO not implemented
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
ReturnValue_t TaskFactory::delayTask(uint32_t delayMs) {
diff --git a/src/fsfw/osal/rtems/BinarySemaphore.cpp b/src/fsfw/osal/rtems/BinarySemaphore.cpp
index 06b0bf77..3677dd22 100644
--- a/src/fsfw/osal/rtems/BinarySemaphore.cpp
+++ b/src/fsfw/osal/rtems/BinarySemaphore.cpp
@@ -7,9 +7,9 @@ BinarySemaphore::BinarySemaphore() {}
BinarySemaphore::~BinarySemaphore() {}
ReturnValue_t BinarySemaphore::acquire(TimeoutType timeoutType, uint32_t timeoutMs) {
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
-ReturnValue_t BinarySemaphore::release() { return HasReturnvaluesIF::RETURN_OK; }
+ReturnValue_t BinarySemaphore::release() { return returnvalue::OK; }
uint8_t BinarySemaphore::getSemaphoreCounter() const { return 0; }
diff --git a/src/fsfw/osal/rtems/Clock.cpp b/src/fsfw/osal/rtems/Clock.cpp
index 831c67d4..cb7bd042 100644
--- a/src/fsfw/osal/rtems/Clock.cpp
+++ b/src/fsfw/osal/rtems/Clock.cpp
@@ -23,13 +23,13 @@ ReturnValue_t Clock::setClock(const TimeOfDay_t* time) {
rtems_status_code status = rtems_clock_set(&timeRtems);
switch (status) {
case RTEMS_SUCCESSFUL:
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
case RTEMS_INVALID_ADDRESS:
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
case RTEMS_INVALID_CLOCK:
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
default:
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
}
@@ -38,7 +38,7 @@ ReturnValue_t Clock::setClock(const timeval* time) {
newTime.tv_sec = time->tv_sec;
if (time->tv_usec < 0) {
// better returnvalue.
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
newTime.tv_nsec = time->tv_usec * TOD_NANOSECONDS_PER_MICROSECOND;
@@ -48,10 +48,10 @@ ReturnValue_t Clock::setClock(const timeval* time) {
Status_Control status = _TOD_Set(&newTime, &context);
_TOD_Unlock();
if (status == STATUS_SUCCESSFUL) {
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
// better returnvalue
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
ReturnValue_t Clock::getClock_timeval(timeval* time) {
@@ -59,11 +59,11 @@ ReturnValue_t Clock::getClock_timeval(timeval* time) {
rtems_status_code status = rtems_clock_get_tod_timeval(time);
switch (status) {
case RTEMS_SUCCESSFUL:
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
case RTEMS_NOT_DEFINED:
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
default:
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
}
@@ -77,16 +77,16 @@ ReturnValue_t Clock::getUptime(timeval* uptime) {
uptime->tv_usec = time.tv_nsec;
switch (status) {
case RTEMS_SUCCESSFUL:
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
default:
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
}
ReturnValue_t Clock::getUptime(uint32_t* uptimeMs) {
// This counter overflows after 50 days
*uptimeMs = rtems_clock_get_ticks_since_boot();
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t Clock::getClock_usecs(uint64_t* time) {
@@ -95,9 +95,9 @@ ReturnValue_t Clock::getClock_usecs(uint64_t* time) {
*time = ((uint64_t)temp_time.tv_sec * 1000000) + temp_time.tv_usec;
switch (returnValue) {
case RTEMS_SUCCESSFUL:
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
default:
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
}
@@ -118,16 +118,16 @@ ReturnValue_t Clock::getDateAndTime(TimeOfDay_t* time) {
time->usecond =
static_cast(timeRtems.ticks) / rtems_clock_get_ticks_per_second() * 1e6;
time->year = timeRtems.year;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
case RTEMS_NOT_DEFINED:
/* System date and time is not set */
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
case RTEMS_INVALID_ADDRESS:
/* time_buffer is NULL */
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
default:
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
}
@@ -143,10 +143,10 @@ ReturnValue_t Clock::convertTimeOfDayToTimeval(const TimeOfDay_t* from, timeval*
timeRtems.ticks = from->usecond * getTicksPerSecond() / 1e6;
to->tv_sec = _TOD_To_seconds(&timeRtems);
to->tv_usec = from->usecond;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t Clock::convertTimevalToJD2000(timeval time, double* JD2000) {
*JD2000 = (time.tv_sec - 946728000. + time.tv_usec / 1000000.) / 24. / 3600.;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
diff --git a/src/fsfw/osal/rtems/CpuUsage.cpp b/src/fsfw/osal/rtems/CpuUsage.cpp
index 2613a698..4ffc2271 100644
--- a/src/fsfw/osal/rtems/CpuUsage.cpp
+++ b/src/fsfw/osal/rtems/CpuUsage.cpp
@@ -86,7 +86,7 @@ ReturnValue_t CpuUsage::serialize(uint8_t** buffer, size_t* size, size_t maxSize
Endianness streamEndianness) const {
ReturnValue_t result =
SerializeAdapter::serialize(&timeSinceLastReset, buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
return SerialArrayListAdapter::serialize(&threadData, buffer, size, maxSize,
@@ -106,7 +106,7 @@ ReturnValue_t CpuUsage::deSerialize(const uint8_t** buffer, size_t* size,
Endianness streamEndianness) {
ReturnValue_t result =
SerializeAdapter::deSerialize(&timeSinceLastReset, buffer, size, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
return SerialArrayListAdapter::deSerialize(&threadData, buffer, size,
@@ -116,7 +116,7 @@ ReturnValue_t CpuUsage::deSerialize(const uint8_t** buffer, size_t* size,
ReturnValue_t CpuUsage::ThreadData::serialize(uint8_t** buffer, size_t* size, size_t maxSize,
Endianness streamEndianness) const {
ReturnValue_t result = SerializeAdapter::serialize(&id, buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
if (*size + MAX_LENGTH_OF_THREAD_NAME > maxSize) {
@@ -126,14 +126,14 @@ ReturnValue_t CpuUsage::ThreadData::serialize(uint8_t** buffer, size_t* size, si
*size += MAX_LENGTH_OF_THREAD_NAME;
*buffer += MAX_LENGTH_OF_THREAD_NAME;
result = SerializeAdapter::serialize(&timeRunning, buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::serialize(&percentUsage, buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
uint32_t CpuUsage::ThreadData::getSerializedSize() const {
@@ -150,7 +150,7 @@ uint32_t CpuUsage::ThreadData::getSerializedSize() const {
ReturnValue_t CpuUsage::ThreadData::deSerialize(const uint8_t** buffer, size_t* size,
Endianness streamEndianness) {
ReturnValue_t result = SerializeAdapter::deSerialize(&id, buffer, size, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
if (*size < MAX_LENGTH_OF_THREAD_NAME) {
@@ -159,12 +159,12 @@ ReturnValue_t CpuUsage::ThreadData::deSerialize(const uint8_t** buffer, size_t*
memcpy(name, *buffer, MAX_LENGTH_OF_THREAD_NAME);
*buffer -= MAX_LENGTH_OF_THREAD_NAME;
result = SerializeAdapter::deSerialize(&timeRunning, buffer, size, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::deSerialize(&percentUsage, buffer, size, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
diff --git a/src/fsfw/osal/rtems/FixedTimeslotTask.cpp b/src/fsfw/osal/rtems/FixedTimeslotTask.cpp
index f400c213..c1cc4460 100644
--- a/src/fsfw/osal/rtems/FixedTimeslotTask.cpp
+++ b/src/fsfw/osal/rtems/FixedTimeslotTask.cpp
@@ -6,7 +6,7 @@
#include
#include "fsfw/osal/rtems/RtemsBasic.h"
-#include "fsfw/returnvalues/HasReturnvaluesIF.h"
+#include "fsfw/returnvalues/returnvalue.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
#if FSFW_CPP_OSTREAM_ENABLED == 1
@@ -48,14 +48,14 @@ ReturnValue_t FixedTimeslotTask::startTask() {
switch (status) {
case RTEMS_SUCCESSFUL:
// ask started successfully
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
default:
/*
RTEMS_INVALID_ADDRESS - invalid task entry point
RTEMS_INVALID_ID - invalid task id
RTEMS_INCORRECT_STATE - task not in the dormant state
RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot start remote task */
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
}
diff --git a/src/fsfw/osal/rtems/InternalErrorCodes.cpp b/src/fsfw/osal/rtems/InternalErrorCodes.cpp
index 4d78186c..9e0c1ae7 100644
--- a/src/fsfw/osal/rtems/InternalErrorCodes.cpp
+++ b/src/fsfw/osal/rtems/InternalErrorCodes.cpp
@@ -50,7 +50,7 @@ ReturnValue_t InternalErrorCodes::translate(uint8_t code) {
// case INTERNAL_ERROR_UNLIMITED_AND_MAXIMUM_IS_0:
// return UNLIMITED_AND_MAXIMUM_IS_0;
default:
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
}
diff --git a/src/fsfw/osal/rtems/MessageQueue.cpp b/src/fsfw/osal/rtems/MessageQueue.cpp
index 534015dc..bae3b5e0 100644
--- a/src/fsfw/osal/rtems/MessageQueue.cpp
+++ b/src/fsfw/osal/rtems/MessageQueue.cpp
@@ -32,7 +32,7 @@ ReturnValue_t MessageQueue::receiveMessage(MessageQueueMessageIF* message) {
this->last = message->getSender();
// Check size of incoming message.
if (message->getMessageSize() < message->getMinimumMessageSize()) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
} else {
// No message was received. Keep lastPartner anyway, I might send something later.
@@ -66,7 +66,7 @@ ReturnValue_t MessageQueue::sendMessageFrom(MessageQueueId_t sendTo, MessageQueu
ReturnValue_t returnCode = convertReturnCode(result);
if (returnCode == MessageQueueIF::EMPTY) {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
return returnCode;
@@ -75,23 +75,23 @@ ReturnValue_t MessageQueue::sendMessageFrom(MessageQueueId_t sendTo, MessageQueu
ReturnValue_t MessageQueue::convertReturnCode(rtems_status_code inValue) {
switch (inValue) {
case RTEMS_SUCCESSFUL:
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
case RTEMS_INVALID_ID:
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
case RTEMS_TIMEOUT:
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
case RTEMS_OBJECT_WAS_DELETED:
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
case RTEMS_INVALID_ADDRESS:
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
case RTEMS_INVALID_SIZE:
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
case RTEMS_TOO_MANY:
return MessageQueueIF::FULL;
case RTEMS_UNSATISFIED:
return MessageQueueIF::EMPTY;
default:
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
}
diff --git a/src/fsfw/osal/rtems/Mutex.cpp b/src/fsfw/osal/rtems/Mutex.cpp
index 94f0041e..eb1a3718 100644
--- a/src/fsfw/osal/rtems/Mutex.cpp
+++ b/src/fsfw/osal/rtems/Mutex.cpp
@@ -43,7 +43,7 @@ ReturnValue_t Mutex::lockMutex(TimeoutType timeoutType = TimeoutType::BLOCKING,
switch (status) {
case RTEMS_SUCCESSFUL:
// semaphore obtained successfully
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
case RTEMS_UNSATISFIED:
// semaphore not available
return MUTEX_NOT_FOUND;
@@ -57,7 +57,7 @@ ReturnValue_t Mutex::lockMutex(TimeoutType timeoutType = TimeoutType::BLOCKING,
// invalid semaphore id
return MUTEX_INVALID_ID;
default:
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
}
@@ -66,7 +66,7 @@ ReturnValue_t Mutex::unlockMutex() {
switch (status) {
case RTEMS_SUCCESSFUL:
// semaphore obtained successfully
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
case RTEMS_NOT_OWNER_OF_RESOURCE:
// semaphore not available
return CURR_THREAD_DOES_NOT_OWN_MUTEX;
@@ -74,6 +74,6 @@ ReturnValue_t Mutex::unlockMutex() {
// invalid semaphore id
return MUTEX_INVALID_ID;
default:
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
}
diff --git a/src/fsfw/osal/rtems/PeriodicTask.cpp b/src/fsfw/osal/rtems/PeriodicTask.cpp
index cccf937f..5c397815 100644
--- a/src/fsfw/osal/rtems/PeriodicTask.cpp
+++ b/src/fsfw/osal/rtems/PeriodicTask.cpp
@@ -37,13 +37,13 @@ ReturnValue_t PeriodicTask::startTask() {
switch (status) {
case RTEMS_SUCCESSFUL:
/* Task started successfully */
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
default:
/* RTEMS_INVALID_ADDRESS - invalid task entry point
RTEMS_INVALID_ID - invalid task id
RTEMS_INCORRECT_STATE - task not in the dormant state
RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot start remote task */
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
}
diff --git a/src/fsfw/osal/rtems/QueueFactory.cpp b/src/fsfw/osal/rtems/QueueFactory.cpp
index 074ce273..1918f7bc 100644
--- a/src/fsfw/osal/rtems/QueueFactory.cpp
+++ b/src/fsfw/osal/rtems/QueueFactory.cpp
@@ -16,25 +16,25 @@ ReturnValue_t MessageQueueSenderIF::sendMessage(MessageQueueId_t sendTo,
switch (result) {
case RTEMS_SUCCESSFUL:
// message sent successfully
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
case RTEMS_INVALID_ID:
// invalid queue id
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
case RTEMS_INVALID_SIZE:
// invalid message size
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
case RTEMS_INVALID_ADDRESS:
// buffer is NULL
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
case RTEMS_UNSATISFIED:
// out of message buffers
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
case RTEMS_TOO_MANY:
// queue's limit has been reached
return MessageQueueIF::FULL;
default:
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
}
diff --git a/src/fsfw/osal/rtems/RTEMSTaskBase.cpp b/src/fsfw/osal/rtems/RTEMSTaskBase.cpp
index a306b9e2..b235f6a0 100644
--- a/src/fsfw/osal/rtems/RTEMSTaskBase.cpp
+++ b/src/fsfw/osal/rtems/RTEMSTaskBase.cpp
@@ -21,7 +21,7 @@ RTEMSTaskBase::RTEMSTaskBase(rtems_task_priority set_priority, size_t stack_size
RTEMS_FLOATING_POINT, &id);
}
ReturnValue_t result = convertReturnCode(status);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "TaskBase::TaskBase: createTask with name " << std::hex << osalName << std::dec
<< " failed with return code " << (uint32_t)status << std::endl;
@@ -42,21 +42,21 @@ ReturnValue_t RTEMSTaskBase::sleepFor(uint32_t ms) {
ReturnValue_t RTEMSTaskBase::convertReturnCode(rtems_status_code inValue) {
switch (inValue) {
case RTEMS_SUCCESSFUL:
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
case RTEMS_MP_NOT_CONFIGURED:
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
case RTEMS_INVALID_NAME:
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
case RTEMS_TOO_MANY:
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
case RTEMS_INVALID_ADDRESS:
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
case RTEMS_UNSATISFIED:
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
case RTEMS_INVALID_PRIORITY:
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
default:
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
}
diff --git a/src/fsfw/osal/rtems/RtemsBasic.h b/src/fsfw/osal/rtems/RtemsBasic.h
index 3525799c..ea97c3af 100644
--- a/src/fsfw/osal/rtems/RtemsBasic.h
+++ b/src/fsfw/osal/rtems/RtemsBasic.h
@@ -8,7 +8,7 @@
#include
-#include "fsfw/returnvalues/HasReturnvaluesIF.h"
+#include "fsfw/returnvalues/returnvalue.h"
class RtemsBasic {
public:
diff --git a/src/fsfw/osal/rtems/TaskFactory.cpp b/src/fsfw/osal/rtems/TaskFactory.cpp
index fb52eb0e..4dbd254e 100644
--- a/src/fsfw/osal/rtems/TaskFactory.cpp
+++ b/src/fsfw/osal/rtems/TaskFactory.cpp
@@ -3,7 +3,7 @@
#include "fsfw/osal/rtems/FixedTimeslotTask.h"
#include "fsfw/osal/rtems/PeriodicTask.h"
#include "fsfw/osal/rtems/RtemsBasic.h"
-#include "fsfw/returnvalues/HasReturnvaluesIF.h"
+#include "fsfw/returnvalues/returnvalue.h"
// TODO: Different variant than the lazy loading in QueueFactory. What's better and why?
TaskFactory* TaskFactory::factoryInstance = new TaskFactory();
@@ -31,13 +31,13 @@ FixedTimeslotTaskIF* TaskFactory::createFixedTimeslotTask(
ReturnValue_t TaskFactory::deleteTask(PeriodicTaskIF* task) {
// This should call the OS specific destructor
delete (dynamic_cast(task));
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
ReturnValue_t TaskFactory::delayTask(uint32_t delayMs) {
rtems_task_wake_after(RtemsBasic::convertMsToTicks(delayMs));
// Only return value is "RTEMS_SUCCESSFUL - always successful" so it has been neglected
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
void TaskFactory::printMissedDeadline() {
diff --git a/src/fsfw/osal/windows/winTaskHelpers.cpp b/src/fsfw/osal/windows/winTaskHelpers.cpp
index c863c4ca..206ee7a7 100644
--- a/src/fsfw/osal/windows/winTaskHelpers.cpp
+++ b/src/fsfw/osal/windows/winTaskHelpers.cpp
@@ -89,7 +89,7 @@ ReturnValue_t tasks::setTaskPriority(HANDLE nativeHandle, TaskPriority priority)
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "PeriodicTask: Windows SetPriorityClass failed with code " << GetLastError()
<< std::endl;
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
#endif
}
result = SetThreadPriority(reinterpret_cast(nativeHandle), nPriorityNumber);
@@ -97,8 +97,8 @@ ReturnValue_t tasks::setTaskPriority(HANDLE nativeHandle, TaskPriority priority)
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "PeriodicTask: Windows SetPriorityClass failed with code " << GetLastError()
<< std::endl;
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
#endif
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
diff --git a/src/fsfw/parameters/HasParametersIF.h b/src/fsfw/parameters/HasParametersIF.h
index 48557b4a..d586ceba 100644
--- a/src/fsfw/parameters/HasParametersIF.h
+++ b/src/fsfw/parameters/HasParametersIF.h
@@ -3,7 +3,7 @@
#include
-#include "../returnvalues/HasReturnvaluesIF.h"
+#include "../returnvalues/returnvalue.h"
#include "ParameterWrapper.h"
/**
diff --git a/src/fsfw/parameters/ParameterHelper.cpp b/src/fsfw/parameters/ParameterHelper.cpp
index 58356af5..ba0e70a4 100644
--- a/src/fsfw/parameters/ParameterHelper.cpp
+++ b/src/fsfw/parameters/ParameterHelper.cpp
@@ -10,10 +10,10 @@ ParameterHelper::~ParameterHelper() {}
ReturnValue_t ParameterHelper::handleParameterMessage(CommandMessage* message) {
if (storage == nullptr) {
// ParameterHelper was not initialized
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
- ReturnValue_t result = HasReturnvaluesIF::RETURN_FAILED;
+ ReturnValue_t result = returnvalue::FAILED;
switch (message->getCommand()) {
case ParameterMessage::CMD_PARAMETER_DUMP: {
ParameterWrapper description;
@@ -21,7 +21,7 @@ ReturnValue_t ParameterHelper::handleParameterMessage(CommandMessage* message) {
uint8_t uniqueIdentifier =
HasParametersIF::getUniqueIdentifierId(ParameterMessage::getParameterId(message));
result = owner->getParameter(domain, uniqueIdentifier, &description, &description, 0);
- if (result == HasReturnvaluesIF::RETURN_OK) {
+ if (result == returnvalue::OK) {
result = sendParameter(message->getSender(), ParameterMessage::getParameterId(message),
&description);
}
@@ -42,7 +42,7 @@ ReturnValue_t ParameterHelper::handleParameterMessage(CommandMessage* message) {
ConstStorageAccessor accessor(storeId);
result = storage->getData(storeId, accessor);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "ParameterHelper::handleParameterMessage: Getting"
<< " store data failed for load command." << std::endl;
@@ -52,19 +52,19 @@ ReturnValue_t ParameterHelper::handleParameterMessage(CommandMessage* message) {
ParameterWrapper streamWrapper;
result = streamWrapper.set(type, rows, columns, accessor.data(), accessor.size());
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
ParameterWrapper ownerWrapper;
result =
owner->getParameter(domain, uniqueIdentifier, &ownerWrapper, &streamWrapper, linearIndex);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result = ownerWrapper.copyFrom(&streamWrapper, linearIndex);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
@@ -73,14 +73,14 @@ ReturnValue_t ParameterHelper::handleParameterMessage(CommandMessage* message) {
break;
}
default:
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
rejectCommand(message->getSender(), result, message->getCommand());
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t ParameterHelper::sendParameter(MessageQueueId_t to, uint32_t id,
@@ -91,7 +91,7 @@ ReturnValue_t ParameterHelper::sendParameter(MessageQueueId_t to, uint32_t id,
store_address_t address;
ReturnValue_t result = storage->getFreeElement(&address, serializedSize, &storeElement);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
@@ -100,7 +100,7 @@ ReturnValue_t ParameterHelper::sendParameter(MessageQueueId_t to, uint32_t id,
result = description->serialize(&storeElement, &storeElementSize, serializedSize,
SerializeIF::Endianness::BIG);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
storage->deleteData(address);
return result;
}
@@ -111,7 +111,7 @@ ReturnValue_t ParameterHelper::sendParameter(MessageQueueId_t to, uint32_t id,
MessageQueueSenderIF::sendMessage(to, &reply, ownerQueueId);
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t ParameterHelper::initialize() {
@@ -121,7 +121,7 @@ ReturnValue_t ParameterHelper::initialize() {
if (storage == nullptr) {
return ObjectManagerIF::CHILD_INIT_FAILED;
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
void ParameterHelper::rejectCommand(MessageQueueId_t to, ReturnValue_t reason,
diff --git a/src/fsfw/parameters/ParameterMessage.cpp b/src/fsfw/parameters/ParameterMessage.cpp
index 9dc58365..9a7b5288 100644
--- a/src/fsfw/parameters/ParameterMessage.cpp
+++ b/src/fsfw/parameters/ParameterMessage.cpp
@@ -44,7 +44,7 @@ store_address_t ParameterMessage::getParameterLoadCommand(const CommandMessage*
*pfc = packedParamSettings >> 16 & 0xff;
*rows = packedParamSettings >> 8 & 0xff;
*columns = packedParamSettings & 0xff;
- return message->getParameter2();
+ return static_cast(message->getParameter2());
}
void ParameterMessage::clear(CommandMessage* message) {
diff --git a/src/fsfw/parameters/ParameterWrapper.cpp b/src/fsfw/parameters/ParameterWrapper.cpp
index 27552290..522a68b1 100644
--- a/src/fsfw/parameters/ParameterWrapper.cpp
+++ b/src/fsfw/parameters/ParameterWrapper.cpp
@@ -28,16 +28,16 @@ ReturnValue_t ParameterWrapper::serialize(uint8_t **buffer, size_t *size, size_t
ReturnValue_t result;
result = SerializeAdapter::serialize(&type, buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::serialize(&columns, buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::serialize(&rows, buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
@@ -91,11 +91,11 @@ template
ReturnValue_t ParameterWrapper::serializeData(uint8_t **buffer, size_t *size, size_t maxSize,
Endianness streamEndianness) const {
const T *element = (const T *)readonlyData;
- ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
+ ReturnValue_t result = returnvalue::OK;
uint16_t dataSize = columns * rows;
while (dataSize != 0) {
result = SerializeAdapter::serialize(element, buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
element++;
@@ -112,7 +112,7 @@ ReturnValue_t ParameterWrapper::deSerializeData(uint8_t startingRow, uint8_t sta
const uint8_t *fromAsStream = reinterpret_cast(from);
size_t streamSize = fromRows * fromColumns * sizeof(T);
- ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
+ ReturnValue_t result = returnvalue::OK;
for (uint8_t fromRow = 0; fromRow < fromRows; fromRow++) {
// get the start element of this row in data
@@ -122,7 +122,7 @@ ReturnValue_t ParameterWrapper::deSerializeData(uint8_t startingRow, uint8_t sta
for (uint8_t fromColumn = 0; fromColumn < fromColumns; fromColumn++) {
result = SerializeAdapter::deSerialize(dataWithDataType + fromColumn, &fromAsStream,
&streamSize, SerializeIF::Endianness::BIG);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
}
@@ -142,7 +142,7 @@ ReturnValue_t ParameterWrapper::deSerialize(const uint8_t **buffer, size_t *size
ParameterWrapper streamDescription;
ReturnValue_t result = streamDescription.set(*buffer, *size, buffer, size);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
@@ -163,24 +163,24 @@ ReturnValue_t ParameterWrapper::set(Type type, uint8_t rows, uint8_t columns, co
this->data = nullptr;
this->readonlyData = data;
pointsToStream = true;
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t ParameterWrapper::set(const uint8_t *stream, size_t streamSize,
const uint8_t **remainingStream, size_t *remainingSize) {
ReturnValue_t result =
SerializeAdapter::deSerialize(&type, &stream, &streamSize, SerializeIF::Endianness::BIG);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result =
SerializeAdapter::deSerialize(&columns, &stream, &streamSize, SerializeIF::Endianness::BIG);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::deSerialize(&rows, &stream, &streamSize, SerializeIF::Endianness::BIG);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
@@ -203,7 +203,7 @@ ReturnValue_t ParameterWrapper::set(const uint8_t *stream, size_t streamSize,
*remainingSize = streamSize;
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t ParameterWrapper::copyFrom(const ParameterWrapper *from,
@@ -265,7 +265,7 @@ ReturnValue_t ParameterWrapper::copyFrom(const ParameterWrapper *from,
uint8_t typeSize = type.getSize();
- ReturnValue_t result = HasReturnvaluesIF::RETURN_FAILED;
+ ReturnValue_t result = returnvalue::FAILED;
// copy data
if (from->pointsToStream) {
switch (type) {
diff --git a/src/fsfw/parameters/ParameterWrapper.h b/src/fsfw/parameters/ParameterWrapper.h
index 873db7b2..7767255e 100644
--- a/src/fsfw/parameters/ParameterWrapper.h
+++ b/src/fsfw/parameters/ParameterWrapper.h
@@ -4,7 +4,7 @@
#include
#include "../globalfunctions/Type.h"
-#include "../returnvalues/HasReturnvaluesIF.h"
+#include "../returnvalues/returnvalue.h"
#include "../serialize/SerializeAdapter.h"
#include "../serialize/SerializeIF.h"
@@ -58,7 +58,7 @@ class ParameterWrapper : public SerializeIF {
* @param row
* @param column
* @return
- * -@c RETURN_OK if element was retrieved successfully
+ * -@c returnvalue::OK if element was retrieved successfully
* -@c NOT_SET data has not been set yet
* -@c DATATYPE_MISSMATCH Invalid supplied type
* -@c OUT_OF_BOUNDS Invalid row and/or column.
@@ -185,7 +185,7 @@ inline ReturnValue_t ParameterWrapper::getElement(T *value, uint8_t row, uint8_t
} else {
const T *dataWithType = static_cast(readonlyData);
*value = dataWithType[row * columns + column];
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
}
diff --git a/src/fsfw/power/DummyPowerSwitcher.cpp b/src/fsfw/power/DummyPowerSwitcher.cpp
index 48ab22c6..952a5a57 100644
--- a/src/fsfw/power/DummyPowerSwitcher.cpp
+++ b/src/fsfw/power/DummyPowerSwitcher.cpp
@@ -20,28 +20,28 @@ ReturnValue_t DummyPowerSwitcher::sendSwitchCommand(power::Switch_t switchNr, Re
if (switchNr < switcherList.size()) {
switcherList[switchNr] = onOff;
}
- return RETURN_FAILED;
+ return returnvalue::FAILED;
}
ReturnValue_t DummyPowerSwitcher::sendFuseOnCommand(uint8_t fuseNr) {
if (fuseNr < fuseList.size()) {
fuseList[fuseNr] = FUSE_ON;
}
- return RETURN_FAILED;
+ return returnvalue::FAILED;
}
ReturnValue_t DummyPowerSwitcher::getSwitchState(power::Switch_t switchNr) const {
if (switchNr < switcherList.size()) {
return switcherList[switchNr];
}
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
ReturnValue_t DummyPowerSwitcher::getFuseState(uint8_t fuseNr) const {
if (fuseNr < fuseList.size()) {
return fuseList[fuseNr];
}
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
uint32_t DummyPowerSwitcher::getSwitchDelayMs(void) const { return switchDelayMs; }
diff --git a/src/fsfw/power/Fuse.cpp b/src/fsfw/power/Fuse.cpp
index 81b51c89..73b29452 100644
--- a/src/fsfw/power/Fuse.cpp
+++ b/src/fsfw/power/Fuse.cpp
@@ -32,22 +32,22 @@ void Fuse::addDevice(PowerComponentIF* switchSet) { devices.push_back(switchSet)
ReturnValue_t Fuse::initialize() {
ReturnValue_t result = SystemObject::initialize();
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result = parameterHelper.initialize();
- if (result != RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result = healthHelper.initialize();
- if (result != RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
powerIF = ObjectManager::instance()->get(powerSwitchId);
if (powerIF == NULL) {
- return RETURN_FAILED;
+ return returnvalue::FAILED;
}
- return RETURN_OK;
+ return returnvalue::OK;
}
void Fuse::calculatePowerLimits(float* low, float* high) {
@@ -66,7 +66,7 @@ ReturnValue_t Fuse::check() {
set.setValidity(false, true);
return set.commit();
}
- ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
+ ReturnValue_t result = returnvalue::OK;
checkFuseState();
calculateFusePower();
// Check if power is valid and if fuse state is off or invalid.
@@ -89,14 +89,14 @@ ReturnValue_t Fuse::check() {
ReturnValue_t Fuse::serialize(uint8_t** buffer, size_t* size, size_t maxSize,
Endianness streamEndianness) const {
- ReturnValue_t result = RETURN_FAILED;
+ ReturnValue_t result = returnvalue::FAILED;
for (DeviceList::const_iterator iter = devices.begin(); iter != devices.end(); iter++) {
result = (*iter)->serialize(buffer, size, maxSize, streamEndianness);
- if (result != RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
}
- return RETURN_OK;
+ return returnvalue::OK;
}
size_t Fuse::getSerializedSize() const {
@@ -108,21 +108,21 @@ size_t Fuse::getSerializedSize() const {
}
ReturnValue_t Fuse::deSerialize(const uint8_t** buffer, size_t* size, Endianness streamEndianness) {
- ReturnValue_t result = RETURN_FAILED;
+ ReturnValue_t result = returnvalue::FAILED;
for (DeviceList::iterator iter = devices.begin(); iter != devices.end(); iter++) {
result = (*iter)->deSerialize(buffer, size, streamEndianness);
- if (result != RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
}
- return RETURN_OK;
+ return returnvalue::OK;
}
uint8_t Fuse::getFuseId() const { return fuseId; }
void Fuse::calculateFusePower() {
ReturnValue_t result1 = currentLimit.check();
- if (result1 != HasReturnvaluesIF::RETURN_OK || !(voltage.isValid())) {
+ if (result1 != returnvalue::OK || !(voltage.isValid())) {
power.setValid(PoolVariableIF::INVALID);
return;
}
@@ -133,7 +133,7 @@ void Fuse::calculateFusePower() {
ReturnValue_t Fuse::performOperation(uint8_t opCode) {
checkCommandQueue();
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
void Fuse::reportEvents(Event event) {
@@ -157,15 +157,15 @@ void Fuse::setAllMonitorsToUnchecked() {
void Fuse::checkCommandQueue() {
CommandMessage command;
ReturnValue_t result = commandQueue->receiveMessage(&command);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return;
}
result = healthHelper.handleHealthCommand(&command);
- if (result == HasReturnvaluesIF::RETURN_OK) {
+ if (result == returnvalue::OK) {
return;
}
result = parameterHelper.handleParameterMessage(&command);
- if (result == HasReturnvaluesIF::RETURN_OK) {
+ if (result == returnvalue::OK) {
return;
}
command.setToUnknownCommand();
@@ -227,7 +227,7 @@ bool Fuse::isPowerValid() { return power.isValid(); }
ReturnValue_t Fuse::setHealth(HealthState health) {
healthHelper.setHealth(health);
- return RETURN_OK;
+ return returnvalue::OK;
}
HasHealthIF::HealthState Fuse::getHealth() { return healthHelper.getHealth(); }
@@ -238,6 +238,6 @@ ReturnValue_t Fuse::PowerMonitor::checkPower(float sample, float lowerLimit, flo
} else if (sample < lowerLimit) {
return this->monitorStateIs(MonitoringIF::BELOW_LOW_LIMIT, sample, lowerLimit);
} else {
- return this->monitorStateIs(RETURN_OK, sample, 0.0); // Within limits.
+ return this->monitorStateIs(returnvalue::OK, sample, 0.0); // Within limits.
}
}
diff --git a/src/fsfw/power/Fuse.h b/src/fsfw/power/Fuse.h
index 43896f75..e8b86cfd 100644
--- a/src/fsfw/power/Fuse.h
+++ b/src/fsfw/power/Fuse.h
@@ -7,7 +7,7 @@
#include "../devicehandlers/HealthDevice.h"
#include "../monitoring/AbsLimitMonitor.h"
#include "../parameters/ParameterHelper.h"
-#include "../returnvalues/HasReturnvaluesIF.h"
+#include "../returnvalues/returnvalue.h"
#include "PowerComponentIF.h"
#include "PowerSwitchIF.h"
namespace Factory {
@@ -16,7 +16,6 @@ void setStaticFrameworkObjectIds();
class Fuse : public SystemObject,
public HasHealthIF,
- public HasReturnvaluesIF,
public ReceivesParameterMessagesIF,
public SerializeIF {
friend void(Factory::setStaticFrameworkObjectIds)();
diff --git a/src/fsfw/power/PowerComponent.cpp b/src/fsfw/power/PowerComponent.cpp
index e4c336c7..fd780841 100644
--- a/src/fsfw/power/PowerComponent.cpp
+++ b/src/fsfw/power/PowerComponent.cpp
@@ -18,7 +18,7 @@ ReturnValue_t PowerComponent::serialize(uint8_t** buffer, size_t* size, size_t m
Endianness streamEndianness) const {
ReturnValue_t result =
SerializeAdapter::serialize(&minPower, buffer, size, maxSize, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
return SerializeAdapter::serialize(&maxPower, buffer, size, maxSize, streamEndianness);
@@ -41,7 +41,7 @@ float PowerComponent::getMax() { return maxPower; }
ReturnValue_t PowerComponent::deSerialize(const uint8_t** buffer, size_t* size,
Endianness streamEndianness) {
ReturnValue_t result = SerializeAdapter::deSerialize(&minPower, buffer, size, streamEndianness);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
return SerializeAdapter::deSerialize(&maxPower, buffer, size, streamEndianness);
@@ -64,5 +64,5 @@ ReturnValue_t PowerComponent::getParameter(uint8_t domainId, uint8_t uniqueId,
default:
return INVALID_IDENTIFIER_ID;
}
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
diff --git a/src/fsfw/power/PowerSensor.cpp b/src/fsfw/power/PowerSensor.cpp
index 08ff4724..69c9e272 100644
--- a/src/fsfw/power/PowerSensor.cpp
+++ b/src/fsfw/power/PowerSensor.cpp
@@ -22,8 +22,8 @@ PowerSensor::~PowerSensor() { QueueFactory::instance()->deleteMessageQueue(comma
ReturnValue_t PowerSensor::calculatePower() {
powerSensorSet.read();
- ReturnValue_t result1 = HasReturnvaluesIF::RETURN_FAILED;
- ReturnValue_t result2 = HasReturnvaluesIF::RETURN_FAILED;
+ ReturnValue_t result1 = returnvalue::FAILED;
+ ReturnValue_t result2 = returnvalue::FAILED;
if (healthHelper.healthTable->isHealthy(getObjectId()) && voltage.isValid() &&
current.isValid()) {
result1 = voltageLimit.doCheck(voltage.value);
@@ -33,7 +33,7 @@ ReturnValue_t PowerSensor::calculatePower() {
currentLimit.setToInvalid();
result1 = OBJECT_NOT_HEALTHY;
}
- if (result1 != HasReturnvaluesIF::RETURN_OK || result2 != HasReturnvaluesIF::RETURN_OK) {
+ if (result1 != returnvalue::OK || result2 != returnvalue::OK) {
result1 = MonitoringIF::INVALID;
power.setValid(PoolVariableIF::INVALID);
} else {
@@ -46,22 +46,22 @@ ReturnValue_t PowerSensor::calculatePower() {
ReturnValue_t PowerSensor::performOperation(uint8_t opCode) {
checkCommandQueue();
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
MessageQueueId_t PowerSensor::getCommandQueue() const { return commandQueue->getId(); }
ReturnValue_t PowerSensor::initialize() {
ReturnValue_t result = SystemObject::initialize();
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result = healthHelper.initialize();
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result = parameterHelper.initialize();
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
return result;
@@ -75,15 +75,15 @@ void PowerSensor::setAllMonitorsToUnchecked() {
void PowerSensor::checkCommandQueue() {
CommandMessage command;
ReturnValue_t result = commandQueue->receiveMessage(&command);
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return;
}
result = healthHelper.handleHealthCommand(&command);
- if (result == HasReturnvaluesIF::RETURN_OK) {
+ if (result == returnvalue::OK) {
return;
}
result = parameterHelper.handleParameterMessage(&command);
- if (result == HasReturnvaluesIF::RETURN_OK) {
+ if (result == returnvalue::OK) {
return;
}
command.setToUnknownCommand();
@@ -106,7 +106,7 @@ float PowerSensor::getPower() {
ReturnValue_t PowerSensor::setHealth(HealthState health) {
healthHelper.setHealth(health);
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
HasHealthIF::HealthState PowerSensor::getHealth() { return healthHelper.getHealth(); }
diff --git a/src/fsfw/power/PowerSwitchIF.h b/src/fsfw/power/PowerSwitchIF.h
index bc883fbc..e8c9aff4 100644
--- a/src/fsfw/power/PowerSwitchIF.h
+++ b/src/fsfw/power/PowerSwitchIF.h
@@ -2,7 +2,7 @@
#define FSFW_POWER_POWERSWITCHIF_H_
#include "../events/Event.h"
-#include "../returnvalues/HasReturnvaluesIF.h"
+#include "../returnvalues/returnvalue.h"
#include "definitions.h"
/**
*
@@ -13,14 +13,14 @@
* because they can be called asynchronosuly (const ending).
* @ingroup interfaces
*/
-class PowerSwitchIF : public HasReturnvaluesIF {
+class PowerSwitchIF {
public:
/**
* Empty dtor.
*/
virtual ~PowerSwitchIF() {}
/**
- * The Returnvalues id of this class, required by HasReturnvaluesIF
+ * The Returnvalues id of this class
*/
static const uint8_t INTERFACE_ID = CLASS_ID::POWER_SWITCH_IF;
static const ReturnValue_t SWITCH_ON = MAKE_RETURN_CODE(1);
@@ -50,7 +50,7 @@ class PowerSwitchIF : public HasReturnvaluesIF {
* @return
* - @c SWITCH_ON if the specified switch is on.
* - @c SWITCH_OFF if the specified switch is off.
- * - @c RETURN_FAILED if an error occured
+ * - @c returnvalue::FAILED if an error occured
*/
virtual ReturnValue_t getSwitchState(power::Switch_t switchNr) const = 0;
/**
@@ -59,7 +59,7 @@ class PowerSwitchIF : public HasReturnvaluesIF {
* @return
* - @c FUSE_ON if the specified fuse is on.
* - @c FUSE_OFF if the specified fuse is off.
- * - @c RETURN_FAILED if an error occured
+ * - @c returnvalue::FAILED if an error occured
*/
virtual ReturnValue_t getFuseState(uint8_t fuseNr) const = 0;
/**
diff --git a/src/fsfw/power/PowerSwitcher.cpp b/src/fsfw/power/PowerSwitcher.cpp
index 7608c6e7..77733884 100644
--- a/src/fsfw/power/PowerSwitcher.cpp
+++ b/src/fsfw/power/PowerSwitcher.cpp
@@ -24,11 +24,11 @@ ReturnValue_t PowerSwitcher::getStateOfSwitches() {
(secondSwitchState == PowerSwitchIF::SWITCH_OFF)) {
return PowerSwitchIF::SWITCH_OFF;
} else {
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
}
default:
- return HasReturnvaluesIF::RETURN_FAILED;
+ return returnvalue::FAILED;
}
}
@@ -111,18 +111,18 @@ ReturnValue_t PowerSwitcher::checkSwitchState() {
return IN_POWER_TRANSITION;
case SWITCH_IS_OFF:
if (getStateOfSwitches() == PowerSwitchIF::SWITCH_OFF) {
- return RETURN_OK;
+ return returnvalue::OK;
} else {
return SWITCH_STATE_MISMATCH;
}
case SWITCH_IS_ON:
if (getStateOfSwitches() == PowerSwitchIF::SWITCH_ON) {
- return RETURN_OK;
+ return returnvalue::OK;
} else {
return SWITCH_STATE_MISMATCH;
}
}
- return RETURN_FAILED;
+ return returnvalue::FAILED;
}
PowerSwitcher::State_t PowerSwitcher::getState() { return state; }
diff --git a/src/fsfw/power/PowerSwitcher.h b/src/fsfw/power/PowerSwitcher.h
index 279ffacf..7a38336c 100644
--- a/src/fsfw/power/PowerSwitcher.h
+++ b/src/fsfw/power/PowerSwitcher.h
@@ -2,11 +2,11 @@
#define FSFW_POWER_POWERSWITCHER_H_
#include "../objectmanager/SystemObjectIF.h"
-#include "../returnvalues/HasReturnvaluesIF.h"
+#include "../returnvalues/returnvalue.h"
#include "../timemanager/Countdown.h"
#include "PowerSwitchIF.h"
-class PowerSwitcher : public HasReturnvaluesIF {
+class PowerSwitcher {
public:
enum State_t {
WAIT_OFF,
diff --git a/src/fsfw/power/PowerSwitcherComponent.cpp b/src/fsfw/power/PowerSwitcherComponent.cpp
index 9c1ed4cf..b6b67a83 100644
--- a/src/fsfw/power/PowerSwitcherComponent.cpp
+++ b/src/fsfw/power/PowerSwitcherComponent.cpp
@@ -16,15 +16,15 @@ ReturnValue_t PowerSwitcherComponent::performOperation(uint8_t opCode) {
ReturnValue_t result;
CommandMessage command;
- for (result = queue->receiveMessage(&command); result == RETURN_OK;
+ for (result = queue->receiveMessage(&command); result == returnvalue::OK;
result = queue->receiveMessage(&command)) {
result = healthHelper.handleHealthCommand(&command);
- if (result == RETURN_OK) {
+ if (result == returnvalue::OK) {
continue;
}
result = modeHelper.handleModeCommand(&command);
- if (result == RETURN_OK) {
+ if (result == returnvalue::OK) {
continue;
}
}
@@ -37,16 +37,16 @@ ReturnValue_t PowerSwitcherComponent::performOperation(uint8_t opCode) {
setMode(MODE_ON, 0);
}
}
- return RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t PowerSwitcherComponent::initialize() {
ReturnValue_t result = modeHelper.initialize();
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
result = healthHelper.initialize();
- if (result != HasReturnvaluesIF::RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
return SystemObject::initialize();
@@ -61,7 +61,7 @@ void PowerSwitcherComponent::getMode(Mode_t *mode, Submode_t *submode) {
ReturnValue_t PowerSwitcherComponent::setHealth(HealthState health) {
healthHelper.setHealth(health);
- return RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t PowerSwitcherComponent::checkModeCommand(Mode_t mode, Submode_t submode,
@@ -70,7 +70,7 @@ ReturnValue_t PowerSwitcherComponent::checkModeCommand(Mode_t mode, Submode_t su
if (mode != MODE_ON and mode != MODE_OFF) {
return TRANS_NOT_ALLOWED;
}
- return RETURN_OK;
+ return returnvalue::OK;
}
void PowerSwitcherComponent::startTransition(Mode_t mode, Submode_t submode) {
diff --git a/src/fsfw/power/PowerSwitcherComponent.h b/src/fsfw/power/PowerSwitcherComponent.h
index a3ed640e..01689bef 100644
--- a/src/fsfw/power/PowerSwitcherComponent.h
+++ b/src/fsfw/power/PowerSwitcherComponent.h
@@ -23,7 +23,6 @@ class PowerSwitchIF;
* commanding in to MODE_ON will cause the switcher to turn the switch on.
*/
class PowerSwitcherComponent : public SystemObject,
- public HasReturnvaluesIF,
public ExecutableObjectIF,
public HasModesIF,
public HasHealthIF {
diff --git a/src/fsfw/pus/CService200ModeCommanding.cpp b/src/fsfw/pus/CService200ModeCommanding.cpp
index 41be3d13..d28df59b 100644
--- a/src/fsfw/pus/CService200ModeCommanding.cpp
+++ b/src/fsfw/pus/CService200ModeCommanding.cpp
@@ -10,8 +10,8 @@
CService200ModeCommanding::CService200ModeCommanding(object_id_t objectId, uint16_t apid,
uint8_t serviceId, uint8_t numParallelCommands,
uint16_t commandTimeoutSeconds)
- : CommandingServiceBase(objectId, apid, serviceId, numParallelCommands, commandTimeoutSeconds) {
-}
+ : CommandingServiceBase(objectId, apid, "PUS 200 Mode MGMT", serviceId, numParallelCommands,
+ commandTimeoutSeconds) {}
CService200ModeCommanding::~CService200ModeCommanding() {}
@@ -20,7 +20,7 @@ ReturnValue_t CService200ModeCommanding::isValidSubservice(uint8_t subservice) {
case (Subservice::COMMAND_MODE_COMMAND):
case (Subservice::COMMAND_MODE_READ):
case (Subservice::COMMAND_MODE_ANNCOUNCE):
- return RETURN_OK;
+ return returnvalue::OK;
default:
return AcceptsTelecommandsIF::INVALID_SUBSERVICE;
}
@@ -41,13 +41,13 @@ ReturnValue_t CService200ModeCommanding::getMessageQueueAndObject(uint8_t subser
ReturnValue_t CService200ModeCommanding::checkInterfaceAndAcquireMessageQueue(
MessageQueueId_t *messageQueueToSet, object_id_t *objectId) {
- HasModesIF *destination = ObjectManager::instance()->get(*objectId);
+ auto *destination = ObjectManager::instance()->get(*objectId);
if (destination == nullptr) {
return CommandingServiceBase::INVALID_OBJECT;
}
*messageQueueToSet = destination->getCommandQueue();
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t CService200ModeCommanding::prepareCommand(CommandMessage *message, uint8_t subservice,
@@ -56,7 +56,7 @@ ReturnValue_t CService200ModeCommanding::prepareCommand(CommandMessage *message,
ModePacket modeCommandPacket;
ReturnValue_t result =
modeCommandPacket.deSerialize(&tcData, &tcDataLen, SerializeIF::Endianness::BIG);
- if (result != RETURN_OK) {
+ if (result != returnvalue::OK) {
return result;
}
@@ -70,7 +70,7 @@ ReturnValue_t CService200ModeCommanding::handleReply(const CommandMessage *reply
CommandMessage *optionalNextCommand,
object_id_t objectId, bool *isStep) {
Command_t replyId = reply->getCommand();
- ReturnValue_t result = HasReturnvaluesIF::RETURN_FAILED;
+ ReturnValue_t result = returnvalue::FAILED;
switch (replyId) {
case (ModeMessage::REPLY_MODE_REPLY): {
result = prepareModeReply(reply, objectId);
@@ -88,7 +88,7 @@ ReturnValue_t CService200ModeCommanding::handleReply(const CommandMessage *reply
result = INVALID_REPLY;
break;
default:
- result = RETURN_FAILED;
+ result = returnvalue::FAILED;
}
return result;
}
@@ -96,16 +96,16 @@ ReturnValue_t CService200ModeCommanding::handleReply(const CommandMessage *reply
ReturnValue_t CService200ModeCommanding::prepareModeReply(const CommandMessage *reply,
object_id_t objectId) {
ModePacket modeReplyPacket(objectId, ModeMessage::getMode(reply), ModeMessage::getSubmode(reply));
- return sendTmPacket(Subservice::REPLY_MODE_REPLY, &modeReplyPacket);
+ return sendTmPacket(Subservice::REPLY_MODE_REPLY, modeReplyPacket);
}
ReturnValue_t CService200ModeCommanding::prepareWrongModeReply(const CommandMessage *reply,
object_id_t objectId) {
ModePacket wrongModeReply(objectId, ModeMessage::getMode(reply), ModeMessage::getSubmode(reply));
- ReturnValue_t result = sendTmPacket(Subservice::REPLY_WRONG_MODE_REPLY, &wrongModeReply);
- if (result == RETURN_OK) {
+ ReturnValue_t result = sendTmPacket(Subservice::REPLY_WRONG_MODE_REPLY, wrongModeReply);
+ if (result == returnvalue::OK) {
// We want to produce an error here in any case because the mode was not correct
- return RETURN_FAILED;
+ return returnvalue::FAILED;
}
return result;
}
@@ -113,10 +113,10 @@ ReturnValue_t CService200ModeCommanding::prepareWrongModeReply(const CommandMess
ReturnValue_t CService200ModeCommanding::prepareCantReachModeReply(const CommandMessage *reply,
object_id_t objectId) {
CantReachModePacket cantReachModePacket(objectId, ModeMessage::getCantReachModeReason(reply));
- ReturnValue_t result = sendTmPacket(Subservice::REPLY_CANT_REACH_MODE, &cantReachModePacket);
- if (result == RETURN_OK) {
+ ReturnValue_t result = sendTmPacket(Subservice::REPLY_CANT_REACH_MODE, cantReachModePacket);
+ if (result == returnvalue::OK) {
// We want to produce an error here in any case because the mode was not reached
- return RETURN_FAILED;
+ return returnvalue::FAILED;
}
return result;
}
diff --git a/src/fsfw/pus/CService201HealthCommanding.cpp b/src/fsfw/pus/CService201HealthCommanding.cpp
index 644e0d7c..bf21c5bd 100644
--- a/src/fsfw/pus/CService201HealthCommanding.cpp
+++ b/src/fsfw/pus/CService201HealthCommanding.cpp
@@ -10,15 +10,15 @@ CService201HealthCommanding::CService201HealthCommanding(object_id_t objectId, u
uint8_t serviceId,
uint8_t numParallelCommands,
uint16_t commandTimeoutSeconds)
- : CommandingServiceBase(objectId, apid, serviceId, numParallelCommands, commandTimeoutSeconds) {
-}
+ : CommandingServiceBase(objectId, apid, "PUS 201 Health MGMT", serviceId, numParallelCommands,
+ commandTimeoutSeconds) {}
ReturnValue_t CService201HealthCommanding::isValidSubservice(uint8_t subservice) {
switch (subservice) {
case (Subservice::COMMAND_SET_HEALTH):
case (Subservice::COMMAND_ANNOUNCE_HEALTH):
case (Subservice::COMMAND_ANNOUNCE_HEALTH_ALL):
- return RETURN_OK;
+ return returnvalue::OK;
default:
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "Invalid Subservice" << std::endl;
@@ -48,19 +48,19 @@ ReturnValue_t CService201HealthCommanding::checkInterfaceAndAcquireMessageQueue(
}
*messageQueueToSet = destination->getCommandQueue();
- return HasReturnvaluesIF::RETURN_OK;
+ return returnvalue::OK;
}
ReturnValue_t CService201HealthCommanding::prepareCommand(CommandMessage *message,
uint8_t subservice, const uint8_t *tcData,
size_t tcDataLen, uint32_t *state,
object_id_t objectId) {
- ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
+ ReturnValue_t result = returnvalue::OK;
switch (subservice) {
case (Subservice::COMMAND_SET_HEALTH): {
HealthSetCommand healthCommand;
result = healthCommand.deSerialize(&tcData, &tcDataLen, SerializeIF::Endianness::BIG);
- if (result != RETURN_OK) {
+ if (result != returnvalue::OK) {
break;
}
HealthMessage::setHealthMessage(message, HealthMessage::HEALTH_SET,
@@ -77,7 +77,7 @@ ReturnValue_t CService201HealthCommanding::prepareCommand(CommandMessage *messag
}
default: {
// Should never happen, subservice was already checked
- result = RETURN_FAILED;
+ result = returnvalue::FAILED;
}
}
return result;
@@ -102,5 +102,5 @@ ReturnValue_t CService201HealthCommanding::handleReply(const CommandMessage *rep
auto health = static_cast(HealthMessage::getHealth(reply));
auto oldHealth = static_cast(HealthMessage::getOldHealth(reply));
HealthSetReply healthSetReply(health, oldHealth);
- return sendTmPacket(Subservice::REPLY_HEALTH_SET, &healthSetReply);
+ return sendTmPacket(Subservice::REPLY_HEALTH_SET, healthSetReply);
}
diff --git a/src/fsfw/pus/Service11TelecommandScheduling.h b/src/fsfw/pus/Service11TelecommandScheduling.h
index 0fed8bca..aa958193 100644
--- a/src/fsfw/pus/Service11TelecommandScheduling.h
+++ b/src/fsfw/pus/Service11TelecommandScheduling.h
@@ -37,12 +37,10 @@ class Service11TelecommandScheduling final : public PusServiceBase {
public:
static constexpr uint8_t CLASS_ID = CLASS_ID::PUS_SERVICE_11;
- static constexpr ReturnValue_t INVALID_TYPE_TIME_WINDOW =
- HasReturnvaluesIF::makeReturnCode(CLASS_ID, 1);
- static constexpr ReturnValue_t TIMESHIFTING_NOT_POSSIBLE =
- HasReturnvaluesIF::makeReturnCode(CLASS_ID, 2);
- static constexpr ReturnValue_t INVALID_RELATIVE_TIME =
- HasReturnvaluesIF::makeReturnCode(CLASS_ID, 3);
+ static constexpr ReturnValue_t INVALID_TYPE_TIME_WINDOW = returnvalue::makeCode(CLASS_ID, 1);
+ static constexpr ReturnValue_t INVALID_TIME_WINDOW = returnvalue::makeCode(CLASS_ID, 2);
+ static constexpr ReturnValue_t TIMESHIFTING_NOT_POSSIBLE = returnvalue::makeCode(CLASS_ID, 3);
+ static constexpr ReturnValue_t INVALID_RELATIVE_TIME = returnvalue::makeCode(CLASS_ID, 4);
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PUS_SERVICE_11;
@@ -74,8 +72,7 @@ class Service11TelecommandScheduling final : public PusServiceBase {
TO_TIMETAG = 3
};
- Service11TelecommandScheduling(object_id_t objectId, uint16_t apid, uint8_t serviceId,
- AcceptsTelecommandsIF* tcRecipient,
+ Service11TelecommandScheduling(PsbParams params, AcceptsTelecommandsIF* tcRecipient,
uint16_t releaseTimeMarginSeconds = DEFAULT_RELEASE_TIME_MARGIN,
bool debugMode = false);
@@ -123,31 +120,31 @@ class Service11TelecommandScheduling final : public PusServiceBase {
ReturnValue_t handleResetCommand();
/**
* @brief Logic to be performed on an incoming TC[11,4].
- * @return RETURN_OK if successful
+ * @return returnvalue::OK if successful
*/
ReturnValue_t doInsertActivity(const uint8_t* data, size_t size);
/**
* @brief Logic to be performed on an incoming TC[11,5].
- * @return RETURN_OK if successful
+ * @return returnvalue::OK if successful
*/
ReturnValue_t doDeleteActivity(const uint8_t* data, size_t size);
/**
* @brief Logic to be performed on an incoming TC[11,6].
- * @return RETURN_OK if successful
+ * @return returnvalue::OK if successful
*/
ReturnValue_t doFilterDeleteActivity(const uint8_t* data, size_t size);
/**
* @brief Logic to be performed on an incoming TC[11,7].
- * @return RETURN_OK if successful
+ * @return returnvalue::OK if successful
*/
ReturnValue_t doTimeshiftActivity(const uint8_t* data, size_t size);
/**
* @brief Logic to be performed on an incoming TC[11,8].
- * @return RETURN_OK if successful
+ * @return returnvalue::OK if successful
*/
ReturnValue_t doFilterTimeshiftActivity(const uint8_t* data, size_t size);
@@ -159,7 +156,7 @@ class Service11TelecommandScheduling final : public PusServiceBase {
* @param data The Application data of the TC (get via getApplicationData()).
* @return requestId
*/
- uint64_t getRequestIdFromDataTC(const uint8_t* data) const;
+ [[nodiscard]] uint64_t getRequestIdFromTc() const;
/**
* @brief Extracts the Request ID from the Application Data directly, assuming it is packed
@@ -167,7 +164,7 @@ class Service11TelecommandScheduling final : public PusServiceBase {
* @param data Pointer to first byte described data
* @param dataSize Remaining size of data NOTE: non-const, this is modified by the function
* @param [out] requestId Request ID
- * @return RETURN_OK if successful
+ * @return returnvalue::OK if successful
*/
ReturnValue_t getRequestIdFromData(const uint8_t*& data, size_t& dataSize, uint64_t& requestId);
@@ -186,7 +183,7 @@ class Service11TelecommandScheduling final : public PusServiceBase {
* @param dataSize TC data size
* @param [out] itBegin Begin of filter range
* @param [out] itEnd End of filter range
- * @return RETURN_OK if successful
+ * @return returnvalue::OK if successful
*/
ReturnValue_t getMapFilterFromData(const uint8_t*& data, size_t& size, TcMapIter& itBegin,
TcMapIter& itEnd);
diff --git a/src/fsfw/pus/Service11TelecommandScheduling.tpp b/src/fsfw/pus/Service11TelecommandScheduling.tpp
index 968a59ff..9016af80 100644
--- a/src/fsfw/pus/Service11TelecommandScheduling.tpp
+++ b/src/fsfw/pus/Service11TelecommandScheduling.tpp
@@ -11,12 +11,14 @@ static constexpr auto DEF_END = SerializeIF::Endianness::BIG;
template
inline Service11TelecommandScheduling