reverted some changes

This commit is contained in:
Robin Müller 2020-06-23 21:03:22 +02:00
parent 56455a5fa2
commit 905c1a92e3
23 changed files with 57 additions and 122 deletions

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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());
}
}

View File

@ -44,8 +44,7 @@ public:
eventmanagerQueue = eventmanager->getEventReportQueue();
}
}
MessageQueueSenderIF::sendMessage(eventmanagerQueue, message,
MessageQueueMessage::MAX_MESSAGE_SIZE, sentFrom);
MessageQueueSenderIF::sendMessage(eventmanagerQueue, message, sentFrom);
}
};

View File

@ -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;

View File

@ -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;

View File

@ -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:

View File

@ -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;

View File

@ -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

View File

@ -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) {

View File

@ -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

View File

@ -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;
//}

View File

@ -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

View File

@ -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;
};

View File

@ -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_ */

View File

@ -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());
}
}

View File

@ -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() {

View File

@ -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<QueueHandle_t>(sendTo),

View File

@ -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);

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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) {

View File

@ -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: "