From f2945f873fd1908f572650913f41a3175bf8c451 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Fri, 8 May 2020 14:17:27 +0200 Subject: [PATCH 1/2] additional access function for mode message --- modes/ModeMessage.cpp | 4 ++++ modes/ModeMessage.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/modes/ModeMessage.cpp b/modes/ModeMessage.cpp index 62fea7e4..1d3baad5 100644 --- a/modes/ModeMessage.cpp +++ b/modes/ModeMessage.cpp @@ -16,6 +16,10 @@ ReturnValue_t ModeMessage::setModeMessage(CommandMessage* message, Command_t com return HasReturnvaluesIF::RETURN_OK; } +ReturnValue_t ModeMessage::getCantReachModeReason(const CommandMessage* message) { + return message->getParameter(); +} + void ModeMessage::clear(CommandMessage* message) { message->setCommand(CommandMessage::CMD_NONE); } diff --git a/modes/ModeMessage.h b/modes/ModeMessage.h index fad34726..0a72aee0 100644 --- a/modes/ModeMessage.h +++ b/modes/ModeMessage.h @@ -24,6 +24,7 @@ public: static const Command_t REPLY_MODE_INFO = MAKE_COMMAND_ID(0x03); //!> Unrequested info about the current mode (used for composites to inform their container of a changed mode) static const Command_t REPLY_CANT_REACH_MODE = MAKE_COMMAND_ID(0x04); //!> Reply in case a mode command can't be executed. Par1: returnCode, Par2: 0 //SHOULDDO is there a way we can transmit a returnvalue when responding that the mode is wrong, so we can give a nice failure code when commanded by PUS? + // shouldn't that possible with parameter 2 when submode only takes 1 byte? static const Command_t REPLY_WRONG_MODE_REPLY = MAKE_COMMAND_ID(0x05);//!> Reply to a CMD_MODE_COMMAND, indicating that a mode was commanded and a transition started but was aborted; the parameters contain the mode that was reached static const Command_t CMD_MODE_READ = MAKE_COMMAND_ID(0x06);//!> Command to read the current mode and reply with a REPLY_MODE_REPLY static const Command_t CMD_MODE_ANNOUNCE = MAKE_COMMAND_ID(0x07);//!> Command to trigger an ModeInfo Event. This command does NOT have a reply. @@ -34,6 +35,7 @@ public: static ReturnValue_t setModeMessage(CommandMessage* message, Command_t command, Mode_t mode, Submode_t submode); static void cantReachMode(CommandMessage* message, ReturnValue_t reason); + static ReturnValue_t getCantReachModeReason(const CommandMessage* message); static void clear(CommandMessage* message); }; From 50fd86edc1a9d35e681eb730f2e838733a24254d Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Mon, 25 May 2020 15:03:31 +0200 Subject: [PATCH 2/2] removed shoulddo, issue will be created --- modes/ModeMessage.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/modes/ModeMessage.h b/modes/ModeMessage.h index 0a72aee0..f72fdeec 100644 --- a/modes/ModeMessage.h +++ b/modes/ModeMessage.h @@ -23,8 +23,6 @@ public: static const Command_t REPLY_MODE_REPLY = MAKE_COMMAND_ID(0x02);//!> Reply to a CMD_MODE_COMMAND or CMD_MODE_READ static const Command_t REPLY_MODE_INFO = MAKE_COMMAND_ID(0x03); //!> Unrequested info about the current mode (used for composites to inform their container of a changed mode) static const Command_t REPLY_CANT_REACH_MODE = MAKE_COMMAND_ID(0x04); //!> Reply in case a mode command can't be executed. Par1: returnCode, Par2: 0 - //SHOULDDO is there a way we can transmit a returnvalue when responding that the mode is wrong, so we can give a nice failure code when commanded by PUS? - // shouldn't that possible with parameter 2 when submode only takes 1 byte? static const Command_t REPLY_WRONG_MODE_REPLY = MAKE_COMMAND_ID(0x05);//!> Reply to a CMD_MODE_COMMAND, indicating that a mode was commanded and a transition started but was aborted; the parameters contain the mode that was reached static const Command_t CMD_MODE_READ = MAKE_COMMAND_ID(0x06);//!> Command to read the current mode and reply with a REPLY_MODE_REPLY static const Command_t CMD_MODE_ANNOUNCE = MAKE_COMMAND_ID(0x07);//!> Command to trigger an ModeInfo Event. This command does NOT have a reply.