From bb640f87580da53b3cef3a3804f7a0df4add26ab Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 13 May 2022 18:15:15 +0200 Subject: [PATCH] some ctors --- src/fsfw/devicehandlers/DeviceHandlerBase.h | 5 +++-- src/fsfw/devicehandlers/DhbCfgHelpers.h | 23 +++++++++++++-------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/fsfw/devicehandlers/DeviceHandlerBase.h b/src/fsfw/devicehandlers/DeviceHandlerBase.h index 3174fb0b..254d7db8 100644 --- a/src/fsfw/devicehandlers/DeviceHandlerBase.h +++ b/src/fsfw/devicehandlers/DeviceHandlerBase.h @@ -8,7 +8,6 @@ #include "DeviceHandlerIF.h" #include "DeviceHandlerThermalSet.h" #include "DhbCfgHelpers.h" - #include "fsfw/action/ActionHelper.h" #include "fsfw/action/HasActionsIF.h" #include "fsfw/datapool/PoolVariableIF.h" @@ -490,7 +489,9 @@ class DeviceHandlerBase : public DeviceHandlerIF, * @return - @c RETURN_OK when the command was successfully inserted, * - @c RETURN_FAILED else. */ - ReturnValue_t insertInCommandMap(CmdCfg cfg); + ReturnValue_t insertInCommandMap( + DeviceCommandId_t deviceCommand, bool useAlternativeReply = false, + DeviceCommandId_t alternativeReplyId = DeviceHandlerIF::NO_COMMAND_ID); /** * Enables a periodic reply for a given command. It sets to delay cycles to the specified diff --git a/src/fsfw/devicehandlers/DhbCfgHelpers.h b/src/fsfw/devicehandlers/DhbCfgHelpers.h index 8301db16..fd838297 100644 --- a/src/fsfw/devicehandlers/DhbCfgHelpers.h +++ b/src/fsfw/devicehandlers/DhbCfgHelpers.h @@ -6,8 +6,8 @@ * combination */ struct CfgBase { -public: - explicit CfgBase(DeviceCommandId_t cmdAndOrReplyId): cmdAndOrReplyId(cmdAndOrReplyId) {}; + public: + explicit CfgBase(DeviceCommandId_t cmdAndOrReplyId) : cmdAndOrReplyId(cmdAndOrReplyId){}; DeviceCommandId_t cmdAndOrReplyId; }; @@ -15,8 +15,8 @@ public: * @brief Configuration class for commands */ struct CmdCfg { -public: - explicit CmdCfg(DeviceCommandId_t cmdId): baseCfg(cmdId) {}; + public: + explicit CmdCfg(DeviceCommandId_t cmdId) : baseCfg(cmdId){}; CfgBase baseCfg; //! This can be used if a command can trigger multiple replies @@ -27,9 +27,14 @@ public: * @brief Configuration class for replies */ struct ReplyCfg { -public: - ReplyCfg(DeviceCommandId_t replyId, uint16_t maxDelayCycles); - ReplyCfg(DeviceCommandId_t replyId, uint16_t maxDelayCycles); + public: + ReplyCfg(DeviceCommandId_t replyId, uint16_t maxDelayCycles) + : baseCfg(replyId), maxDelayCycles(maxDelayCycles){}; + ReplyCfg(DeviceCommandId_t replyId, uint16_t maxDelayCycles, LocalPoolDataSetBase* set) + : ReplyCfg(replyId, maxDelayCycles) { + dataSet = set; + }; + CfgBase baseCfg; //! A data set can be mapped to a reply ID. This allows to omit the #getDataSetHandle //! override in a user device handler as this pointer will be passed as long as the device @@ -58,8 +63,8 @@ public: * @brief Configuration class for commands and replies */ struct CmdReplyCfg { -public: - CmdReplyCfg(CmdCfg cmdCfg, ReplyCfg replyCfg): cmdCfg(cmdCfg), replyCfg(replyCfg) {} + public: + CmdReplyCfg(CmdCfg cmdCfg, ReplyCfg replyCfg) : cmdCfg(cmdCfg), replyCfg(replyCfg) {} CmdCfg cmdCfg; ReplyCfg replyCfg; };