diff --git a/action/ActionHelper.cpp b/action/ActionHelper.cpp index 026df4e1..0df5f2d4 100644 --- a/action/ActionHelper.cpp +++ b/action/ActionHelper.cpp @@ -101,8 +101,7 @@ ReturnValue_t ActionHelper::reportData(MessageQueueId_t reportTo, //TODO Service Implementation sucks at the moment if (hideSender){ - result = MessageQueueSenderIF::sendMessage(reportTo, &reply, - MessageQueueMessage::MAX_MESSAGE_SIZE); + result = MessageQueueSenderIF::sendMessage(reportTo, &reply); } else { result = queueToUse->sendMessage(reportTo, &reply); } diff --git a/datalinklayer/MapPacketExtraction.cpp b/datalinklayer/MapPacketExtraction.cpp index 87b46556..4ea45e89 100644 --- a/datalinklayer/MapPacketExtraction.cpp +++ b/datalinklayer/MapPacketExtraction.cpp @@ -117,8 +117,7 @@ ReturnValue_t MapPacketExtraction::sendCompletePacket(uint8_t* data, ReturnValue_t status = this->packetStore->addData(&store_id, data, size); if (status == RETURN_OK) { TmTcMessage message(store_id); - status = MessageQueueSenderIF::sendMessage(tcQueueId,&message, - MessageQueueMessage::MAX_MESSAGE_SIZE); + status = MessageQueueSenderIF::sendMessage(tcQueueId,&message); } return status; } diff --git a/events/EventManager.cpp b/events/EventManager.cpp index a5d14569..04be6f68 100644 --- a/events/EventManager.cpp +++ b/events/EventManager.cpp @@ -52,7 +52,6 @@ void EventManager::notifyListeners(EventMessage* message) { for (auto iter = listenerList.begin(); iter != listenerList.end(); ++iter) { if (iter->second.match(message)) { MessageQueueSenderIF::sendMessage(iter->first, message, - MessageQueueMessage::MAX_MESSAGE_SIZE, message->getSender()); } } diff --git a/events/EventManagerIF.h b/events/EventManagerIF.h index 053e320b..bc0de432 100644 --- a/events/EventManagerIF.h +++ b/events/EventManagerIF.h @@ -44,8 +44,7 @@ public: eventmanagerQueue = eventmanager->getEventReportQueue(); } } - MessageQueueSenderIF::sendMessage(eventmanagerQueue, message, - MessageQueueMessage::MAX_MESSAGE_SIZE, sentFrom); + MessageQueueSenderIF::sendMessage(eventmanagerQueue, message, sentFrom); } }; diff --git a/health/HealthHelper.cpp b/health/HealthHelper.cpp index 935bf5e3..0b3bffcb 100644 --- a/health/HealthHelper.cpp +++ b/health/HealthHelper.cpp @@ -70,7 +70,6 @@ void HealthHelper::informParent(HasHealthIF::HealthState health, HealthMessage::setHealthMessage(&information, HealthMessage::HEALTH_INFO, health, oldHealth); if (MessageQueueSenderIF::sendMessage(parentQueue, &information, - MessageQueueMessage::MAX_MESSAGE_SIZE, owner->getCommandQueue()) != HasReturnvaluesIF::RETURN_OK) { sif::debug << "HealthHelper::informParent: sending health reply failed." << std::endl; @@ -91,7 +90,6 @@ void HealthHelper::handleSetHealthCommand(CommandMessage* command) { reply.setReplyRejected(result, command->getCommand()); } if (MessageQueueSenderIF::sendMessage(command->getSender(), &reply, - MessageQueueMessage::MAX_MESSAGE_SIZE, owner->getCommandQueue()) != HasReturnvaluesIF::RETURN_OK) { sif::debug << "HealthHelper::handleHealthCommand: sending health " "reply failed." << std::endl; diff --git a/housekeeping/HousekeepingMessage.cpp b/housekeeping/HousekeepingMessage.cpp index d7efd703..f425d16e 100644 --- a/housekeeping/HousekeepingMessage.cpp +++ b/housekeeping/HousekeepingMessage.cpp @@ -3,13 +3,13 @@ HousekeepingMessage::HousekeepingMessage(MessageQueueMessageIF* message): CommandMessageBase(message) { - if(message->getMaximumMessageSize() < HK_MESSAGE_SIZE) { + if(message->getMessageSize() < HK_MESSAGE_SIZE) { sif::error << "HousekeepingMessage::HousekeepingMessage: Passed " "message buffer can not hold minimum " << HK_MESSAGE_SIZE << " bytes!" << std::endl; return; } - message->setMessageSize(HK_MESSAGE_SIZE); + //message->setMessageSize(HK_MESSAGE_SIZE); } HousekeepingMessage::~HousekeepingMessage() {} @@ -38,9 +38,9 @@ void HousekeepingMessage::setHkDiagnosticsMessage(sid_t sid, setParameter(storeId.raw); } -size_t HousekeepingMessage::getMinimumMessageSize() const { - return HK_MESSAGE_SIZE; -} +//size_t HousekeepingMessage::getMinimumMessageSize() const { +// return HK_MESSAGE_SIZE; +//} sid_t HousekeepingMessage::getSid() const { sid_t sid; diff --git a/housekeeping/HousekeepingMessage.h b/housekeeping/HousekeepingMessage.h index c6a33c83..f568a418 100644 --- a/housekeeping/HousekeepingMessage.h +++ b/housekeeping/HousekeepingMessage.h @@ -104,7 +104,7 @@ public: //! to distinguish between diagnostics and regular HK packets sid_t getHkReportMessage(store_address_t * storeIdToSet) const; - virtual size_t getMinimumMessageSize() const override; + //virtual size_t getMinimumMessageSize() const override; virtual void clear() override; private: diff --git a/ipc/CommandMessage.cpp b/ipc/CommandMessage.cpp index 9a8a82f2..11355e38 100644 --- a/ipc/CommandMessage.cpp +++ b/ipc/CommandMessage.cpp @@ -9,14 +9,14 @@ CommandMessage::CommandMessage(MessageQueueMessageIF* receiverMessage): " message!" << std::endl; return; } - if(receiverMessage->getMaximumMessageSize() < - getMinimumMessageSize()) { - sif::error << "CommandMessage::ComandMessage: Passed message buffer" - " can not hold minimum "<< getMinimumMessageSize() - << " bytes!" << std::endl; - return; - } - internalMessage->setMessageSize(getMinimumMessageSize()); +// if(receiverMessage->getMessageSize() < +// getMinimumMessageSize()) { +// sif::error << "CommandMessage::ComandMessage: Passed message buffer" +// " can not hold minimum "<< getMinimumMessageSize() +// << " bytes!" << std::endl; +// return; +// } +// internalMessage->setMessageSize(getMinimumMessageSize()); } CommandMessage::CommandMessage(MessageQueueMessageIF* messageToSet, @@ -49,9 +49,9 @@ void CommandMessage::setParameter2(uint32_t parameter2) { sizeof(parameter2)); } -size_t CommandMessage::getMinimumMessageSize() const { - return MINIMUM_COMMAND_MESSAGE_SIZE; -} +//size_t CommandMessage::getMinimumMessageSize() const { +// return MINIMUM_COMMAND_MESSAGE_SIZE; +//} bool CommandMessage::isClearedCommandMessage() { return getCommand() == CMD_NONE; diff --git a/ipc/CommandMessage.h b/ipc/CommandMessage.h index a09494c6..ae4016b0 100644 --- a/ipc/CommandMessage.h +++ b/ipc/CommandMessage.h @@ -54,7 +54,7 @@ public: virtual ~CommandMessage() {} /** MessageQueueMessageIF functions used for minimum size check. */ - size_t getMinimumMessageSize() const override; + //size_t getMinimumMessageSize() const override; /** * Get the first parameter of the message diff --git a/ipc/CommandMessageBase.cpp b/ipc/CommandMessageBase.cpp index 80f9d378..ea50f4ea 100644 --- a/ipc/CommandMessageBase.cpp +++ b/ipc/CommandMessageBase.cpp @@ -47,25 +47,21 @@ const uint8_t* CommandMessageBase::getData() const { return internalMessage->getData() + sizeof(Command_t); } -void CommandMessageBase::setMessageSize(size_t messageSize) { - internalMessage->setMessageSize(messageSize); -} +//void CommandMessageBase::setMessageSize(size_t messageSize) { +// //internalMessage->setMessageSize(messageSize); +//} size_t CommandMessageBase::getMessageSize() const { return internalMessage->getMessageSize(); } -size_t CommandMessageBase::getMaximumMessageSize() const { - return internalMessage->getMaximumMessageSize(); -} - MessageQueueMessageIF* CommandMessageBase::getInternalMessage() const { return internalMessage; } -size_t CommandMessageBase::getMinimumMessageSize() const { - return MINIMUM_COMMAND_MESSAGE_BASE_SIZE; -} +//size_t CommandMessageBase::getMinimumMessageSize() const { +// return MINIMUM_COMMAND_MESSAGE_BASE_SIZE; +//} void CommandMessageBase::setReplyRejected(ReturnValue_t reason, Command_t initialCommand) { diff --git a/ipc/CommandMessageBase.h b/ipc/CommandMessageBase.h index b237b68f..1ee1b970 100644 --- a/ipc/CommandMessageBase.h +++ b/ipc/CommandMessageBase.h @@ -63,15 +63,8 @@ public: virtual MessageQueueId_t getSender() const override; virtual uint8_t * getData() override; virtual const uint8_t* getData() const override; - virtual void setMessageSize(size_t messageSize) override; virtual size_t getMessageSize() const override; - //! This depends on the maximum message size of the passed internal message. - virtual size_t getMaximumMessageSize() const override; - - //! Return the constant minimum message size. - virtual size_t getMinimumMessageSize() const override; - /** * A command message can be rejected and needs to offer a function * to set a rejected reply diff --git a/ipc/MessageQueueMessage.cpp b/ipc/MessageQueueMessage.cpp index b173f2c4..f3665074 100644 --- a/ipc/MessageQueueMessage.cpp +++ b/ipc/MessageQueueMessage.cpp @@ -51,9 +51,9 @@ void MessageQueueMessage::setSender(MessageQueueId_t setId) { memcpy(this->internalBuffer, &setId, sizeof(MessageQueueId_t)); } -size_t MessageQueueMessage::getMinimumMessageSize() const { - return this->HEADER_SIZE; -} +//size_t MessageQueueMessage::getMinimumMessageSize() const { +// return this->HEADER_SIZE; +//} void MessageQueueMessage::print() { sif::debug << "MessageQueueMessage has size: " << this->messageSize << @@ -69,13 +69,9 @@ void MessageQueueMessage::clear() { } size_t MessageQueueMessage::getMessageSize() const { - return this->messageSize; -} - -size_t MessageQueueMessage::getMaximumMessageSize() const { return this->MAX_MESSAGE_SIZE; } -void MessageQueueMessage::setMessageSize(size_t messageSize) { - this->messageSize = messageSize; -} +//void MessageQueueMessage::setMessageSize(size_t messageSize) { +// this->messageSize = messageSize; +//} diff --git a/ipc/MessageQueueMessage.h b/ipc/MessageQueueMessage.h index 8716df54..a994c323 100644 --- a/ipc/MessageQueueMessage.h +++ b/ipc/MessageQueueMessage.h @@ -139,20 +139,8 @@ public: * The message queue id that identifies the sending message queue. */ void setSender(MessageQueueId_t setId) override; - /** - * @brief This helper function is used by the MessageQueue class to check - * the size of an incoming message. - * @details - * The method must be overwritten by child classes if size - * checks shall be more strict. - * @return The default implementation returns HEADER_SIZE. - */ - virtual size_t getMinimumMessageSize() const override; virtual size_t getMessageSize() const override; - virtual void setMessageSize(size_t messageSize) override; - - virtual size_t getMaximumMessageSize() const override; /** * @brief This is a debug method that prints the content diff --git a/ipc/MessageQueueMessageIF.h b/ipc/MessageQueueMessageIF.h index f34cab98..19c69bfb 100644 --- a/ipc/MessageQueueMessageIF.h +++ b/ipc/MessageQueueMessageIF.h @@ -68,23 +68,11 @@ public: virtual uint8_t* getData() = 0; /** - * @brief This helper function is used by the MessageQueue class to - * check the size of an incoming message. - */ - virtual size_t getMinimumMessageSize() const = 0; - - /** - * Get message size of current message implementation. + * Get constant message size of current message implementation. * @return */ virtual size_t getMessageSize() const = 0; - virtual void setMessageSize(size_t messageSize) = 0; - /** - * Get maximum allowed size of current message implementation. - * @return - */ - virtual size_t getMaximumMessageSize() const = 0; }; diff --git a/ipc/MessageQueueSenderIF.h b/ipc/MessageQueueSenderIF.h index 8bc14948..e4b9670e 100644 --- a/ipc/MessageQueueSenderIF.h +++ b/ipc/MessageQueueSenderIF.h @@ -10,17 +10,16 @@ public: virtual ~MessageQueueSenderIF() {} /** - * Allows sending messages without actually "owing" a message queue. + * Allows sending messages without actually "owning" a message queue. * Not sure whether this is actually a good idea. */ static ReturnValue_t sendMessage(MessageQueueId_t sendTo, - MessageQueueMessageIF* message, size_t maxMessageSize, + MessageQueueMessageIF* message, MessageQueueId_t sentFrom = MessageQueueMessageIF::NO_QUEUE, - bool ignoreFault=false); + bool ignoreFault = false); private: MessageQueueSenderIF() {} }; - #endif /* FRAMEWORK_IPC_MESSAGEQUEUESENDERIF_H_ */ diff --git a/modes/ModeHelper.cpp b/modes/ModeHelper.cpp index f636c0bf..59a6d974 100644 --- a/modes/ModeHelper.cpp +++ b/modes/ModeHelper.cpp @@ -28,7 +28,6 @@ ReturnValue_t ModeHelper::handleModeCommand(CommandMessage* command) { if (result != HasReturnvaluesIF::RETURN_OK) { ModeMessage::cantReachMode(&reply, result); MessageQueueSenderIF::sendMessage(command->getSender(), &reply, - MessageQueueMessage::MAX_MESSAGE_SIZE, owner->getCommandQueue()); break; } @@ -51,7 +50,6 @@ ReturnValue_t ModeHelper::handleModeCommand(CommandMessage* command) { ModeMessage::setModeMessage(&reply, ModeMessage::REPLY_MODE_REPLY, mode, submode); MessageQueueSenderIF::sendMessage(command->getSender(), &reply, - MessageQueueMessage::MAX_MESSAGE_SIZE, owner->getCommandQueue()); } break; @@ -97,7 +95,7 @@ void ModeHelper::sendModeReplyMessage(Mode_t ownerMode, ownerMode, ownerSubmode); } MessageQueueSenderIF::sendMessage(theOneWhoCommandedAMode, &reply, - MessageQueueMessage::MAX_MESSAGE_SIZE, owner->getCommandQueue()); + owner->getCommandQueue()); } } @@ -111,7 +109,6 @@ void ModeHelper::sendModeInfoMessage(Mode_t ownerMode, ModeMessage::setModeMessage(&reply, ModeMessage::REPLY_MODE_INFO, ownerMode, ownerSubmode); MessageQueueSenderIF::sendMessage(parentQueueId, &reply, - MessageQueueMessage::MAX_MESSAGE_SIZE, owner->getCommandQueue()); } } diff --git a/monitoring/LimitViolationReporter.cpp b/monitoring/LimitViolationReporter.cpp index c6e2b5db..1378d754 100644 --- a/monitoring/LimitViolationReporter.cpp +++ b/monitoring/LimitViolationReporter.cpp @@ -34,8 +34,7 @@ ReturnValue_t LimitViolationReporter::sendLimitViolationReport(const SerializeIF MessageQueueMessage message; CommandMessage report(&message); MonitoringMessage::setLimitViolationReport(&report, storeId); - return MessageQueueSenderIF::sendMessage(reportQueue, &report, - MessageQueueMessage::MAX_MESSAGE_SIZE); + return MessageQueueSenderIF::sendMessage(reportQueue, &report); } ReturnValue_t LimitViolationReporter::checkClassLoaded() { diff --git a/osal/FreeRTOS/MessageQueue.cpp b/osal/FreeRTOS/MessageQueue.cpp index c9adf229..464a4f16 100644 --- a/osal/FreeRTOS/MessageQueue.cpp +++ b/osal/FreeRTOS/MessageQueue.cpp @@ -50,8 +50,8 @@ ReturnValue_t MessageQueue::reply(MessageQueueMessageIF* message) { ReturnValue_t MessageQueue::sendMessageFrom(MessageQueueId_t sendTo, MessageQueueMessageIF* message, MessageQueueId_t sentFrom, bool ignoreFault) { - return sendMessageFromMessageQueue(sendTo, message, maxMessageSize, sentFrom, - ignoreFault, callContext); + return sendMessageFromMessageQueue(sendTo, message, sentFrom, ignoreFault, + callContext); } @@ -80,9 +80,9 @@ ReturnValue_t MessageQueue::receiveMessage(MessageQueueMessageIF* message, } ReturnValue_t MessageQueue::receiveMessage(MessageQueueMessageIF* message) { - if(message->getMaximumMessageSize() < maxMessageSize) { + if(message->getMessageSize() < maxMessageSize) { sif::error << "MessageQueue::receiveMessage: Message size " - << message->getMaximumMessageSize() << + << message->getMessageSize() << " too small to receive data!" << std::endl; return HasReturnvaluesIF::RETURN_FAILED; } @@ -127,17 +127,10 @@ bool MessageQueue::isDefaultDestinationSet() const { // static core function to send messages. ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo, - MessageQueueMessageIF* message, size_t maxSize, - MessageQueueId_t sentFrom, bool ignoreFault, CallContext callContext) { + MessageQueueMessageIF* message, MessageQueueId_t sentFrom, + bool ignoreFault, CallContext callContext) { message->setSender(sentFrom); BaseType_t result; - if(message->getMaximumMessageSize() > maxSize) { - sif::error << "MessageQueue::sendMessageFromMessageQueue: Message size " - << message->getMaximumMessageSize() << " too large for queue" - " with max. message size " << maxSize << "!" - << std::endl; - return HasReturnvaluesIF::RETURN_FAILED; - } if(callContext == CallContext::TASK) { result = xQueueSendToBack(reinterpret_cast(sendTo), diff --git a/osal/FreeRTOS/MessageQueue.h b/osal/FreeRTOS/MessageQueue.h index e87e884f..b7e52bb3 100644 --- a/osal/FreeRTOS/MessageQueue.h +++ b/osal/FreeRTOS/MessageQueue.h @@ -194,9 +194,8 @@ protected: * @param context Specify whether call is made from task or from an ISR. */ static ReturnValue_t sendMessageFromMessageQueue(MessageQueueId_t sendTo, - MessageQueueMessageIF* message, size_t maxSize, - MessageQueueId_t sentFrom = NO_QUEUE, bool ignoreFault=false, - CallContext callContext = CallContext::TASK); + MessageQueueMessageIF* message, MessageQueueId_t sentFrom = NO_QUEUE, + bool ignoreFault=false, CallContext callContext = CallContext::TASK); static ReturnValue_t handleSendResult(BaseType_t result, bool ignoreFault); diff --git a/osal/FreeRTOS/QueueFactory.cpp b/osal/FreeRTOS/QueueFactory.cpp index d754b2b9..beb4969b 100644 --- a/osal/FreeRTOS/QueueFactory.cpp +++ b/osal/FreeRTOS/QueueFactory.cpp @@ -7,14 +7,9 @@ QueueFactory* QueueFactory::factoryInstance = nullptr; ReturnValue_t MessageQueueSenderIF::sendMessage(MessageQueueId_t sendTo, - MessageQueueMessageIF* message, size_t maxSize, - MessageQueueId_t sentFrom, bool ignoreFault) { - if(maxSize == 0) { - sif::error << "MessageQueueSenderIF::sendMessage: Max Size is 0!" - << std::endl; - return HasReturnvaluesIF::RETURN_FAILED; - } - return MessageQueue::sendMessageFromMessageQueue(sendTo,message, maxSize, + MessageQueueMessageIF* message, MessageQueueId_t sentFrom, + bool ignoreFault) { + return MessageQueue::sendMessageFromMessageQueue(sendTo,message, sentFrom,ignoreFault); } diff --git a/parameters/ParameterHelper.cpp b/parameters/ParameterHelper.cpp index 68ff5ab0..8b91020f 100644 --- a/parameters/ParameterHelper.cpp +++ b/parameters/ParameterHelper.cpp @@ -107,8 +107,7 @@ ReturnValue_t ParameterHelper::sendParameter(MessageQueueId_t to, uint32_t id, ParameterMessage::setParameterDumpReply(&reply, id, address); - MessageQueueSenderIF::sendMessage(to, &reply, - MessageQueueMessage::MAX_MESSAGE_SIZE, ownerQueueId); + MessageQueueSenderIF::sendMessage(to, &reply, ownerQueueId); return HasReturnvaluesIF::RETURN_OK; } @@ -130,6 +129,5 @@ void ParameterHelper::rejectCommand(MessageQueueId_t to, ReturnValue_t reason, MessageQueueMessage message; CommandMessage reply(&message); reply.setReplyRejected(reason, initialCommand); - MessageQueueSenderIF::sendMessage(to, &reply, - MessageQueueMessage::MAX_MESSAGE_SIZE, ownerQueueId); + MessageQueueSenderIF::sendMessage(to, &reply, ownerQueueId); } diff --git a/tmtcpacket/pus/TmPacketStored.cpp b/tmtcpacket/pus/TmPacketStored.cpp index d589db8d..c0ff874b 100644 --- a/tmtcpacket/pus/TmPacketStored.cpp +++ b/tmtcpacket/pus/TmPacketStored.cpp @@ -118,7 +118,7 @@ ReturnValue_t TmPacketStored::sendPacket(MessageQueueId_t destination, } TmTcMessage tmMessage(getStoreAddress()); ReturnValue_t result = MessageQueueSenderIF::sendMessage(destination, - &tmMessage, MessageQueueMessage::MAX_MESSAGE_SIZE, sentFrom); + &tmMessage, sentFrom); if (result != HasReturnvaluesIF::RETURN_OK) { deletePacket(); if (doErrorReporting) { diff --git a/tmtcservices/VerificationReporter.cpp b/tmtcservices/VerificationReporter.cpp index a54c1f8d..bcb4756c 100644 --- a/tmtcservices/VerificationReporter.cpp +++ b/tmtcservices/VerificationReporter.cpp @@ -23,7 +23,7 @@ void VerificationReporter::sendSuccessReport(uint8_t set_report_id, current_packet->getPacketId(), current_packet->getPacketSequenceControl(), 0, set_step); ReturnValue_t status = MessageQueueSenderIF::sendMessage(acknowledgeQueue, - &message, MessageQueueMessage::MAX_MESSAGE_SIZE); + &message); if (status != HasReturnvaluesIF::RETURN_OK) { sif::error << "VerificationReporter::sendSuccessReport: Error writing " "to queue. Code: " << std::hex << (uint16_t) status << std::endl; @@ -39,7 +39,7 @@ void VerificationReporter::sendSuccessReport(uint8_t set_report_id, PusVerificationMessage message(set_report_id, ackFlags, tcPacketId, tcSequenceControl, 0, set_step); ReturnValue_t status = MessageQueueSenderIF::sendMessage(acknowledgeQueue, - &message, MessageQueueMessage::MAX_MESSAGE_SIZE); + &message); if (status != HasReturnvaluesIF::RETURN_OK) { sif::error << "VerificationReporter::sendSuccessReport: Error writing " "to queue. Code: " << std::hex << (uint16_t) status << std::endl; @@ -58,7 +58,7 @@ void VerificationReporter::sendFailureReport(uint8_t report_id, current_packet->getPacketSequenceControl(), error_code, step, parameter1, parameter2); ReturnValue_t status = MessageQueueSenderIF::sendMessage(acknowledgeQueue, - &message, MessageQueueMessage::MAX_MESSAGE_SIZE); + &message); if (status != HasReturnvaluesIF::RETURN_OK) { sif::error << "VerificationReporter::sendFailureReport Error writing to queue. Code: " @@ -76,7 +76,7 @@ void VerificationReporter::sendFailureReport(uint8_t report_id, PusVerificationMessage message(report_id, ackFlags, tcPacketId, tcSequenceControl, error_code, step, parameter1, parameter2); ReturnValue_t status = MessageQueueSenderIF::sendMessage(acknowledgeQueue, - &message, MessageQueueMessage::MAX_MESSAGE_SIZE); + &message); if (status != HasReturnvaluesIF::RETURN_OK) { sif::error << "VerificationReporter::sendFailureReport Error writing to queue. Code: "