Merge pull request 'additional access function for mode message' (#70) from KSat/fsfw:mueller_ModeMessageAddition into master

Getter for Can't reach mode reason. Should have been there from the beginning.
This commit is contained in:
Steffen Gaisser 2020-05-25 15:05:00 +02:00
commit cb14ec15b5
2 changed files with 5 additions and 1 deletions

View File

@ -16,6 +16,10 @@ ReturnValue_t ModeMessage::setModeMessage(CommandMessage* message, Command_t com
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
ReturnValue_t ModeMessage::getCantReachModeReason(const CommandMessage* message) {
return message->getParameter();
}
void ModeMessage::clear(CommandMessage* message) { void ModeMessage::clear(CommandMessage* message) {
message->setCommand(CommandMessage::CMD_NONE); message->setCommand(CommandMessage::CMD_NONE);
} }

View File

@ -23,7 +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_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_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 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?
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 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_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. 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 +33,7 @@ public:
static ReturnValue_t setModeMessage(CommandMessage* message, static ReturnValue_t setModeMessage(CommandMessage* message,
Command_t command, Mode_t mode, Submode_t submode); Command_t command, Mode_t mode, Submode_t submode);
static void cantReachMode(CommandMessage* message, ReturnValue_t reason); static void cantReachMode(CommandMessage* message, ReturnValue_t reason);
static ReturnValue_t getCantReachModeReason(const CommandMessage* message);
static void clear(CommandMessage* message); static void clear(CommandMessage* message);
}; };