Merge branch 'development' into meier/dhbReplyTimeout
fsfw/fsfw/pipeline/pr-development This commit looks good Details

This commit is contained in:
Jakob Meier 2022-07-14 09:01:28 +02:00
commit e8b8fff0b5
22 changed files with 107 additions and 118 deletions

View File

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

View File

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

View File

@ -19,12 +19,6 @@ 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 - Bump C++ required version to C++17. Every project which uses the FSFW and every modern
compiler supports it compiler supports it
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/622 PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/622
- 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. - New CMake option `FSFW_HAL_LINUX_ADD_LIBGPIOD` to specifically exclude `gpiod` code.
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/572 PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/572
- HAL Devicehandlers: Periodic printout is run-time configurable now - HAL Devicehandlers: Periodic printout is run-time configurable now
@ -120,6 +114,8 @@ https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/593
## Additions ## 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 - Added options for CI/CD builds: `FSFW_CICD_BUILD`. This allows the source code to know
whether it is running in CI/CD whether it is running in CI/CD
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/623 PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/623

View File

@ -67,6 +67,7 @@ endif()
set(FSFW_SOURCES_DIR "${CMAKE_SOURCE_DIR}/src/fsfw") set(FSFW_SOURCES_DIR "${CMAKE_SOURCE_DIR}/src/fsfw")
set(FSFW_ETL_LIB_NAME etl) set(FSFW_ETL_LIB_NAME etl)
set(FSFW_ETL_LINK_TARGET etl::etl)
set(FSFW_ETL_LIB_MAJOR_VERSION set(FSFW_ETL_LIB_MAJOR_VERSION
20 20
CACHE STRING "ETL library major version requirement") CACHE STRING "ETL library major version requirement")
@ -447,8 +448,8 @@ target_include_directories(
target_compile_options(${LIB_FSFW_NAME} PRIVATE ${FSFW_WARNING_FLAGS} target_compile_options(${LIB_FSFW_NAME} PRIVATE ${FSFW_WARNING_FLAGS}
${COMPILER_FLAGS}) ${COMPILER_FLAGS})
target_link_libraries(${LIB_FSFW_NAME} PRIVATE ${FSFW_ETL_LINK_TARGET} target_link_libraries(${LIB_FSFW_NAME} PRIVATE ${FSFW_ADDITIONAL_LINK_LIBS})
${FSFW_ADDITIONAL_LINK_LIBS}) target_link_libraries(${LIB_FSFW_NAME} PUBLIC ${FSFW_ETL_LINK_TARGET})
string( string(
CONCAT CONCAT

View File

@ -12,3 +12,9 @@ RUN git clone https://github.com/catchorg/Catch2.git && \
git checkout v3.0.0-preview5 && \ git checkout v3.0.0-preview5 && \
cmake -Bbuild -H. -DBUILD_TESTING=OFF && \ cmake -Bbuild -H. -DBUILD_TESTING=OFF && \
cmake --build build/ --target install 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/

View File

@ -3,7 +3,7 @@ pipeline {
BUILDDIR = 'build-tests' BUILDDIR = 'build-tests'
} }
agent { agent {
docker { image 'fsfw-ci:d2'} docker { image 'fsfw-ci:d3'}
} }
stages { stages {
stage('Clean') { stage('Clean') {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -7,24 +7,26 @@
#include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface/ServiceInterface.h"
template <typename T> template <typename T>
PoolEntry<T>::PoolEntry(std::initializer_list<T> initValue, bool setValid) PoolEntry<T>::PoolEntry(uint8_t len, bool setValid) : length(len), valid(setValid) {
: length(static_cast<uint8_t>(initValue.size())), valid(setValid) { this->address = new T[this->length]();
this->address = new T[this->length]; std::memset(this->address, 0, this->getByteSize());
if (initValue.size() == 0) { }
std::memset(this->address, 0, this->getByteSize());
} else { template <typename T>
std::copy(initValue.begin(), initValue.end(), this->address); PoolEntry<T>::PoolEntry(std::initializer_list<T> initValues, bool setValid)
: length(static_cast<uint8_t>(initValues.size())), valid(setValid) {
this->address = new T[this->length]();
if (initValues.size() > 0) {
std::copy(initValues.begin(), initValues.end(), this->address);
} }
} }
template <typename T> template <typename T>
PoolEntry<T>::PoolEntry(T* initValue, uint8_t setLength, bool setValid) PoolEntry<T>::PoolEntry(const T* initValue, uint8_t setLength, bool setValid)
: length(setLength), valid(setValid) { : length(setLength), valid(setValid) {
this->address = new T[this->length]; this->address = new T[this->length]();
if (initValue != nullptr) { if (initValue != nullptr) {
std::memcpy(this->address, initValue, this->getByteSize()); std::memcpy(this->address, initValue, this->getByteSize());
} else {
std::memset(this->address, 0, this->getByteSize());
} }
} }

View File

@ -33,6 +33,9 @@ class PoolEntry : public PoolEntryIF {
"instead! The ECSS standard defines a boolean as a one bit " "instead! The ECSS standard defines a boolean as a one bit "
"field. Therefore it is preferred to store a boolean as an " "field. Therefore it is preferred to store a boolean as an "
"uint8_t"); "uint8_t");
PoolEntry(uint8_t len = 1, bool setValid = false);
/** /**
* @brief In the classe's constructor, space is allocated on the heap and * @brief In the classe's constructor, space is allocated on the heap and
* potential initialization values are copied to that space. * potential initialization values are copied to that space.
@ -49,7 +52,7 @@ class PoolEntry : public PoolEntryIF {
* @param setValid * @param setValid
* Sets the initialization flag. It is invalid by default. * Sets the initialization flag. It is invalid by default.
*/ */
PoolEntry(std::initializer_list<T> initValue = {0}, bool setValid = false); PoolEntry(std::initializer_list<T> initValue, bool setValid = false);
/** /**
* @brief In the classe's constructor, space is allocated on the heap and * @brief In the classe's constructor, space is allocated on the heap and
@ -62,7 +65,7 @@ class PoolEntry : public PoolEntryIF {
* @param setValid * @param setValid
* Sets the initialization flag. It is invalid by default. * Sets the initialization flag. It is invalid by default.
*/ */
PoolEntry(T* initValue, uint8_t setLength = 1, bool setValid = false); PoolEntry(const T* initValue, uint8_t setLength = 1, bool setValid = false);
//! Explicitely deleted copy ctor, copying is not allowed. //! Explicitely deleted copy ctor, copying is not allowed.
PoolEntry(const PoolEntry&) = delete; PoolEntry(const PoolEntry&) = delete;

View File

@ -290,10 +290,9 @@ ReturnValue_t MessageQueue::handleOpenError(mq_attr* attributes, uint32_t messag
*/ */
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "MessageQueue::MessageQueue: Default MQ size " << defaultMqMaxMsg 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 " sif::error << "This error can be fixed by setting the maximum "
"allowed message size higher!" "allowed message depth higher" << std::endl;
<< std::endl;
#else #else
sif::printError( sif::printError(
"MessageQueue::MessageQueue: Default MQ size %d is too small for" "MessageQueue::MessageQueue: Default MQ size %d is too small for"