deleted command messge base

This commit is contained in:
Robin Müller 2020-06-24 00:30:32 +02:00
parent 3bf29a7315
commit c7c49b4239
6 changed files with 5 additions and 151 deletions

View File

@ -1,86 +0,0 @@
//#include <framework/ipc/CommandMessageBase.h>
//#include <framework/ipc/CommandMessageCleaner.h>
//#include <cstring>
//
//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);
//}

View File

@ -1,60 +0,0 @@
#ifndef FRAMEWORK_IPC_COMMANDMESSAGEBASE_H_
#define FRAMEWORK_IPC_COMMANDMESSAGEBASE_H_
#include <framework/ipc/CommandMessageIF.h>
#include <framework/ipc/MessageQueueMessage.h>
/**
* @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_ */

View File

@ -8,7 +8,7 @@
#define MAKE_COMMAND_ID( number ) ((MESSAGE_ID << 8) + (number)) #define MAKE_COMMAND_ID( number ) ((MESSAGE_ID << 8) + (number))
typedef uint16_t Command_t; typedef uint16_t Command_t;
class CommandMessageIF: virtual public MessageQueueMessageIF { class CommandMessageIF {
public: public:
/** /**
* Header consists of sender ID and command ID. * Header consists of sender ID and command ID.

View File

@ -23,7 +23,7 @@
* receive messages from other tasks. * receive messages from other tasks.
* @ingroup message_queue * @ingroup message_queue
*/ */
class MessageQueueMessage: virtual public MessageQueueMessageIF { class MessageQueueMessage: public MessageQueueMessageIF {
public: public:
/** /**
* @brief The class is initialized empty with this constructor. * @brief The class is initialized empty with this constructor.

View File

@ -146,8 +146,8 @@ void CommandingServiceBase::handleCommandMessage(CommandMessage* reply) {
} }
void CommandingServiceBase::handleReplyHandlerResult(ReturnValue_t result, void CommandingServiceBase::handleReplyHandlerResult(ReturnValue_t result,
CommandMapIter iter, CommandMessageIF* nextCommand, CommandMapIter iter, CommandMessage* nextCommand,
CommandMessageIF* reply, bool& isStep) { CommandMessage* reply, bool& isStep) {
iter->command = nextCommand->getCommand(); iter->command = nextCommand->getCommand();
// In case a new command is to be sent immediately, this is performed here. // In case a new command is to be sent immediately, this is performed here.

View File

@ -312,7 +312,7 @@ private:
void handleCommandMessage(CommandMessage* reply); void handleCommandMessage(CommandMessage* reply);
void handleReplyHandlerResult(ReturnValue_t result, CommandMapIter iter, void handleReplyHandlerResult(ReturnValue_t result, CommandMapIter iter,
CommandMessageIF* nextCommand,CommandMessageIF* reply, bool& isStep); CommandMessage* nextCommand, CommandMessage* reply, bool& isStep);
void checkTimeout(); void checkTimeout();
}; };