From c7c49b4239fe42f4c4da47eba686c41ff687cf17 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Wed, 24 Jun 2020 00:30:32 +0200 Subject: [PATCH] deleted command messge base --- ipc/CommandMessageBase.cpp | 86 -------------------------- ipc/CommandMessageBase.h | 60 ------------------ ipc/CommandMessageIF.h | 2 +- ipc/MessageQueueMessage.h | 2 +- tmtcservices/CommandingServiceBase.cpp | 4 +- tmtcservices/CommandingServiceBase.h | 2 +- 6 files changed, 5 insertions(+), 151 deletions(-) delete mode 100644 ipc/CommandMessageBase.cpp delete mode 100644 ipc/CommandMessageBase.h diff --git a/ipc/CommandMessageBase.cpp b/ipc/CommandMessageBase.cpp deleted file mode 100644 index 745e6c5f..00000000 --- a/ipc/CommandMessageBase.cpp +++ /dev/null @@ -1,86 +0,0 @@ -//#include -//#include -//#include -// -//CommandMessageBase::CommandMessageBase(MessageQueueMessageIF *message): -// internalMessage(message) { -//} -// -//Command_t CommandMessageBase::getCommand() const { -// Command_t command; -// std::memcpy(&command, internalMessage->getData(), sizeof(Command_t)); -// return command; -//} -// -//void CommandMessageBase::setCommand(Command_t command) { -// std::memcpy(internalMessage->getData(), &command, sizeof(Command_t)); -//} -// -//uint8_t CommandMessageBase::getMessageType() const { -// // first byte of command ID. -// return getCommand() >> 8 & 0xff; -//} -// -//MessageQueueId_t CommandMessageBase::getSender() const { -// return internalMessage->getSender(); -//} -// -//uint8_t* CommandMessageBase::getBuffer() { -// return internalMessage->getBuffer(); -//} -// -//void CommandMessageBase::setSender(MessageQueueId_t setId) { -// internalMessage->setSender(setId); -//} -// -//const uint8_t* CommandMessageBase::getBuffer() const { -// return internalMessage->getBuffer(); -//} -// -//// Header includes command ID. -//uint8_t* CommandMessageBase::getData() { -// return internalMessage->getData() + sizeof(Command_t); -//} -// -//// Header includes command ID. -//const uint8_t* CommandMessageBase::getData() const { -// return internalMessage->getData() + sizeof(Command_t); -//} -// -////void CommandMessageBase::setMessageSize(size_t messageSize) { -//// //internalMessage->setMessageSize(messageSize); -////} -// -//size_t CommandMessageBase::getMessageSize() const { -// return internalMessage->getMessageSize(); -//} -// -//MessageQueueMessageIF* CommandMessageBase::getInternalMessage() const { -// return internalMessage; -//} -// -////size_t CommandMessageBase::getMinimumMessageSize() const { -//// return MINIMUM_COMMAND_MESSAGE_BASE_SIZE; -////} -// -//void CommandMessageBase::setReplyRejected(ReturnValue_t reason, -// Command_t initialCommand) { -// std::memcpy(getData(), &reason, sizeof(reason)); -// std::memcpy(getData() + sizeof(reason), &initialCommand, -// sizeof(initialCommand)); -//} -// -//ReturnValue_t CommandMessageBase::getReplyRejectedReason( -// Command_t *initialCommand) const { -// ReturnValue_t reason = HasReturnvaluesIF::RETURN_FAILED; -// std::memcpy(&reason, getData(), sizeof(reason)); -// if(initialCommand != nullptr) { -// std::memcpy(initialCommand, getData() + sizeof(reason), -// sizeof(Command_t)); -// } -// return reason; -//} -// -//void CommandMessageBase::clear() { -// CommandMessageCleaner::clearCommandMessage(this); -//} diff --git a/ipc/CommandMessageBase.h b/ipc/CommandMessageBase.h deleted file mode 100644 index 59795114..00000000 --- a/ipc/CommandMessageBase.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef FRAMEWORK_IPC_COMMANDMESSAGEBASE_H_ -#define FRAMEWORK_IPC_COMMANDMESSAGEBASE_H_ -#include -#include - -/** - * @brief Base implementation of a generic command message, which has - * a Command_t ID and message type ID in the header in addition - * to the sender message queue ID. - * @details - * This is the base implementation serves as a base for other command messages - * and which implements most functions required for MessageQueueMessageIF. - * The only functions which have to be supplied by a specific command message - * impelementations are the size related functions which are used for - * size checks: - * - * 1. getMinimumMessageSize() - * - * The maximum message size generally depends on the buffer size of the passed - * internal message. - * Don't forget to set the message size of the passed message in the concrete - * commandmessage implementation! - */ -class CommandMessageBase: public CommandMessageIF { -public: - - - CommandMessageBase(MessageQueueMessageIF* message); - - - -// /* -// * MessageQueueMessageIF functions, which generally just call the -// * respective functions of the internal message queue message. -// */ -// virtual uint8_t * getBuffer() override; -// virtual const uint8_t * getBuffer() const override; -// virtual void setSender(MessageQueueId_t setId) override; -// virtual MessageQueueId_t getSender() const override; -// virtual uint8_t * getData() override; -// virtual const uint8_t* getData() const override; -// virtual size_t getMessageSize() const override; - - - //virtual MessageQueueMessageIF* getInternalMessage() const override; - - -protected: - /** - * @brief Pointer to the message containing the data. - * @details - * The command message does not actually own the memory containing a - * message, it just oprates on it via a pointer to a message queue message. - */ - MessageQueueMessageIF* internalMessage = nullptr; -}; - - - -#endif /* FRAMEWORK_IPC_COMMANDMESSAGEBASE_H_ */ diff --git a/ipc/CommandMessageIF.h b/ipc/CommandMessageIF.h index ca050c32..2cb6324e 100644 --- a/ipc/CommandMessageIF.h +++ b/ipc/CommandMessageIF.h @@ -8,7 +8,7 @@ #define MAKE_COMMAND_ID( number ) ((MESSAGE_ID << 8) + (number)) typedef uint16_t Command_t; -class CommandMessageIF: virtual public MessageQueueMessageIF { +class CommandMessageIF { public: /** * Header consists of sender ID and command ID. diff --git a/ipc/MessageQueueMessage.h b/ipc/MessageQueueMessage.h index c4e82a94..3d5d4283 100644 --- a/ipc/MessageQueueMessage.h +++ b/ipc/MessageQueueMessage.h @@ -23,7 +23,7 @@ * receive messages from other tasks. * @ingroup message_queue */ -class MessageQueueMessage: virtual public MessageQueueMessageIF { +class MessageQueueMessage: public MessageQueueMessageIF { public: /** * @brief The class is initialized empty with this constructor. diff --git a/tmtcservices/CommandingServiceBase.cpp b/tmtcservices/CommandingServiceBase.cpp index bd6fa5b5..acf66389 100644 --- a/tmtcservices/CommandingServiceBase.cpp +++ b/tmtcservices/CommandingServiceBase.cpp @@ -146,8 +146,8 @@ void CommandingServiceBase::handleCommandMessage(CommandMessage* reply) { } void CommandingServiceBase::handleReplyHandlerResult(ReturnValue_t result, - CommandMapIter iter, CommandMessageIF* nextCommand, - CommandMessageIF* reply, bool& isStep) { + CommandMapIter iter, CommandMessage* nextCommand, + CommandMessage* reply, bool& isStep) { iter->command = nextCommand->getCommand(); // In case a new command is to be sent immediately, this is performed here. diff --git a/tmtcservices/CommandingServiceBase.h b/tmtcservices/CommandingServiceBase.h index 54a0dc7a..8806bd52 100644 --- a/tmtcservices/CommandingServiceBase.h +++ b/tmtcservices/CommandingServiceBase.h @@ -312,7 +312,7 @@ private: void handleCommandMessage(CommandMessage* reply); void handleReplyHandlerResult(ReturnValue_t result, CommandMapIter iter, - CommandMessageIF* nextCommand,CommandMessageIF* reply, bool& isStep); + CommandMessage* nextCommand, CommandMessage* reply, bool& isStep); void checkTimeout(); };