equalization complete

This commit is contained in:
Robin Müller 2020-09-26 14:58:53 +02:00
parent 9d4c2b90f3
commit 6d2266f7d0
5 changed files with 32 additions and 43 deletions

View File

@ -1,18 +1,11 @@
/**
* @file HasModesIF.h
* @brief This file defines the HasModesIF class.
* @date 20.06.2013
* @author baetz
*/
#ifndef HASMODESIF_H_
#define HASMODESIF_H_
#ifndef FSFW_MODES_HASMODESIF_H_
#define FSFW_MODES_HASMODESIF_H_
#include "ModeHelper.h"
#include "ModeMessage.h"
#include "../events/Event.h"
#include "../modes/ModeHelper.h"
#include "../modes/ModeMessage.h"
#include "../returnvalues/HasReturnvaluesIF.h"
#include <stdint.h>
#include <cstdint>
class HasModesIF {
@ -37,10 +30,11 @@ public:
static const Mode_t MODE_ON = 1; //!< The device is powered and ready to perform operations. In this mode, no commands are sent by the device handler itself, but direct commands van be commanded and will be interpreted
static const Mode_t MODE_OFF = 0; //!< The device is powered off. The only command accepted in this mode is a mode change to on.
static const Submode_t SUBMODE_NONE = 0; //!< To avoid checks against magic number "0".
virtual ~HasModesIF() {
}
virtual ~HasModesIF() {}
virtual MessageQueueId_t getCommandQueue() const = 0;
virtual void getMode(Mode_t *mode, Submode_t *submode) = 0;
protected:
virtual ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
uint32_t *msToReachTheMode) {
@ -54,4 +48,4 @@ protected:
virtual void announceMode(bool recursive) {}
};
#endif /* HASMODESIF_H_ */
#endif /*FSFW_MODES_HASMODESIF_H_ */

View File

@ -1,6 +1,7 @@
#include "HasModesIF.h"
#include "ModeHelper.h"
#include "../ipc/MessageQueueSenderIF.h"
#include "../modes/HasModesIF.h"
#include "../modes/ModeHelper.h"
#include "../serviceinterface/ServiceInterfaceStream.h"
ModeHelper::ModeHelper(HasModesIF *owner) :
@ -26,7 +27,7 @@ ReturnValue_t ModeHelper::handleModeCommand(CommandMessage* command) {
uint32_t timeout;
ReturnValue_t result = owner->checkModeCommand(mode, submode, &timeout);
if (result != HasReturnvaluesIF::RETURN_OK) {
ModeMessage::cantReachMode(&reply, result);
ModeMessage::setCantReachMode(&reply, result);
MessageQueueSenderIF::sendMessage(command->getSender(), &reply,
owner->getCommandQueue());
break;

View File

@ -1,8 +1,8 @@
#ifndef MODEHELPER_H_
#define MODEHELPER_H_
#ifndef FSFW_MODES_MODEHELPER_H_
#define FSFW_MODES_MODEHELPER_H_
#include "ModeMessage.h"
#include "../ipc/MessageQueueIF.h"
#include "../modes/ModeMessage.h"
#include "../returnvalues/HasReturnvaluesIF.h"
#include "../timemanager/Countdown.h"
@ -20,14 +20,14 @@ public:
ReturnValue_t handleModeCommand(CommandMessage *message);
/**
*
* @param parentQueue the Queue id of the parent object. Set to 0 if no parent present
* @param parentQueue the Queue id of the parent object.
* Set to 0 if no parent present
*/
void setParentQueue(MessageQueueId_t parentQueueId);
ReturnValue_t initialize(MessageQueueId_t parentQueueId);
ReturnValue_t initialize(void); //void is there to stop eclipse CODAN from falsely reporting an error
ReturnValue_t initialize(void);
void modeChanged(Mode_t mode, Submode_t submode);
@ -50,4 +50,4 @@ private:
void sendModeInfoMessage(Mode_t ownerMode, Submode_t ownerSubmode);
};
#endif /* MODEHELPER_H_ */
#endif /* FSFW_MODES_MODEHELPER_H_ */

View File

@ -1,4 +1,4 @@
#include "../modes/ModeMessage.h"
#include "ModeMessage.h"
Mode_t ModeMessage::getMode(const CommandMessage* message) {
return message->getParameter();
@ -8,12 +8,11 @@ Submode_t ModeMessage::getSubmode(const CommandMessage* message) {
return message->getParameter2();
}
ReturnValue_t ModeMessage::setModeMessage(CommandMessage* message, Command_t command,
Mode_t mode, Submode_t submode) {
void ModeMessage::setModeMessage(CommandMessage* message,
Command_t command, Mode_t mode, Submode_t submode) {
message->setCommand( command );
message->setParameter( mode );
message->setParameter2( submode );
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t ModeMessage::getCantReachModeReason(const CommandMessage* message) {
@ -24,7 +23,8 @@ void ModeMessage::clear(CommandMessage* message) {
message->setCommand(CommandMessage::CMD_NONE);
}
void ModeMessage::cantReachMode(CommandMessage* message, ReturnValue_t reason) {
void ModeMessage::setCantReachMode(CommandMessage* message,
ReturnValue_t reason) {
message->setCommand(REPLY_CANT_REACH_MODE);
message->setParameter(reason);
message->setParameter2(0);

View File

@ -1,12 +1,5 @@
/**
* @file ModeMessage.h
* @brief This file defines the ModeMessage class.
* @date 17.07.2013
* @author baetz
*/
#ifndef MODEMESSAGE_H_
#define MODEMESSAGE_H_
#ifndef FSFW_MODES_MODEMESSAGE_H_
#define FSFW_MODES_MODEMESSAGE_H_
#include "../ipc/CommandMessage.h"
@ -30,11 +23,12 @@ public:
static Mode_t getMode(const CommandMessage* message);
static Submode_t getSubmode(const CommandMessage* message);
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 setModeMessage(CommandMessage* message,
Command_t command, Mode_t mode, Submode_t submode);
static void setCantReachMode(CommandMessage* message, ReturnValue_t reason);
static void clear(CommandMessage* message);
};
#endif /* MODEMESSAGE_H_ */
#endif /* FSFW_MODES_MODEMESSAGE_H_ */