some fixes necessary to perform size check

This commit is contained in:
Robin Müller 2020-06-22 19:22:52 +02:00
parent 3b2fa978e1
commit 5734a0a0e9
8 changed files with 25 additions and 17 deletions

View File

@ -101,7 +101,8 @@ ReturnValue_t ActionHelper::reportData(MessageQueueId_t reportTo,
//TODO Service Implementation sucks at the moment
if (hideSender){
result = MessageQueueSenderIF::sendMessage(reportTo, &reply);
result = MessageQueueSenderIF::sendMessage(reportTo, &reply,
MessageQueueMessage::MAX_MESSAGE_SIZE);
} else {
result = queueToUse->sendMessage(reportTo, &reply);
}

View File

@ -117,7 +117,8 @@ 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);
status = MessageQueueSenderIF::sendMessage(tcQueueId,&message,
MessageQueueMessage::MAX_MESSAGE_SIZE);
}
return status;
}

View File

@ -15,7 +15,7 @@ public:
* Must be implemented by a subclass.
*/
static ReturnValue_t sendMessage(MessageQueueId_t sendTo,
MessageQueueMessageIF* message,
MessageQueueMessageIF* message, size_t maxMessageSize,
MessageQueueId_t sentFrom = MessageQueueMessageIF::NO_QUEUE,
bool ignoreFault=false);
private:

View File

@ -34,7 +34,8 @@ ReturnValue_t LimitViolationReporter::sendLimitViolationReport(const SerializeIF
MessageQueueMessage message;
CommandMessage report(&message);
MonitoringMessage::setLimitViolationReport(&report, storeId);
return MessageQueueSenderIF::sendMessage(reportQueue, &report);
return MessageQueueSenderIF::sendMessage(reportQueue, &report,
MessageQueueMessage::MAX_MESSAGE_SIZE);
}
ReturnValue_t LimitViolationReporter::checkClassLoaded() {

View File

@ -50,7 +50,7 @@ ReturnValue_t MessageQueue::reply(MessageQueueMessageIF* message) {
ReturnValue_t MessageQueue::sendMessageFrom(MessageQueueId_t sendTo,
MessageQueueMessageIF* message, MessageQueueId_t sentFrom,
bool ignoreFault) {
return sendMessageFromMessageQueue(sendTo, message, sentFrom,
return sendMessageFromMessageQueue(sendTo, message, maxMessageSize, sentFrom,
ignoreFault, callContext);
}
@ -121,11 +121,11 @@ bool MessageQueue::isDefaultDestinationSet() const {
// static core function to send messages.
ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo,
MessageQueueMessageIF* message, MessageQueueId_t sentFrom,
bool ignoreFault, CallContext callContext) {
MessageQueueMessageIF* message, size_t maxSize,
MessageQueueId_t sentFrom, bool ignoreFault, CallContext callContext) {
message->setSender(sentFrom);
BaseType_t result;
if(message->getMaximumMessageSize() > maxMessageSize) {
if(message->getMaximumMessageSize() > maxSize) {
sif::error << "MessageQueue::sendMessageFromMessageQueue: Message size"
"too large for queue!" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;

View File

@ -194,8 +194,9 @@ protected:
* @param context Specify whether call is made from task or from an ISR.
*/
static ReturnValue_t sendMessageFromMessageQueue(MessageQueueId_t sendTo,
MessageQueueMessageIF* message, MessageQueueId_t sentFrom = NO_QUEUE,
bool ignoreFault=false, CallContext callContext = CallContext::TASK);
MessageQueueMessageIF* message, size_t maxSize,
MessageQueueId_t sentFrom = NO_QUEUE, bool ignoreFault=false,
CallContext callContext = CallContext::TASK);
static ReturnValue_t handleSendResult(BaseType_t result, bool ignoreFault);

View File

@ -7,9 +7,9 @@ QueueFactory* QueueFactory::factoryInstance = nullptr;
ReturnValue_t MessageQueueSenderIF::sendMessage(MessageQueueId_t sendTo,
MessageQueueMessageIF* message, MessageQueueId_t sentFrom,
bool ignoreFault) {
return MessageQueue::sendMessageFromMessageQueue(sendTo,message,
MessageQueueMessageIF* message, size_t maxSize,
MessageQueueId_t sentFrom, bool ignoreFault) {
return MessageQueue::sendMessageFromMessageQueue(sendTo,message, maxSize,
sentFrom,ignoreFault);
}

View File

@ -22,7 +22,8 @@ void VerificationReporter::sendSuccessReport(uint8_t set_report_id,
current_packet->getAcknowledgeFlags(),
current_packet->getPacketId(),
current_packet->getPacketSequenceControl(), 0, set_step);
ReturnValue_t status = MessageQueueSenderIF::sendMessage(acknowledgeQueue, &message);
ReturnValue_t status = MessageQueueSenderIF::sendMessage(acknowledgeQueue,
&message, MessageQueueMessage::MAX_MESSAGE_SIZE);
if (status != HasReturnvaluesIF::RETURN_OK) {
sif::error << "VerificationReporter::sendSuccessReport: Error writing "
"to queue. Code: " << std::hex << (uint16_t) status << std::endl;
@ -37,7 +38,8 @@ 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);
ReturnValue_t status = MessageQueueSenderIF::sendMessage(acknowledgeQueue,
&message, MessageQueueMessage::MAX_MESSAGE_SIZE);
if (status != HasReturnvaluesIF::RETURN_OK) {
sif::error << "VerificationReporter::sendSuccessReport: Error writing "
"to queue. Code: " << std::hex << (uint16_t) status << std::endl;
@ -55,7 +57,8 @@ void VerificationReporter::sendFailureReport(uint8_t report_id,
current_packet->getPacketId(),
current_packet->getPacketSequenceControl(), error_code, step,
parameter1, parameter2);
ReturnValue_t status = MessageQueueSenderIF::sendMessage(acknowledgeQueue, &message);
ReturnValue_t status = MessageQueueSenderIF::sendMessage(acknowledgeQueue,
&message, MessageQueueMessage::MAX_MESSAGE_SIZE);
if (status != HasReturnvaluesIF::RETURN_OK) {
sif::error
<< "VerificationReporter::sendFailureReport Error writing to queue. Code: "
@ -72,7 +75,8 @@ 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);
ReturnValue_t status = MessageQueueSenderIF::sendMessage(acknowledgeQueue,
&message, MessageQueueMessage::MAX_MESSAGE_SIZE);
if (status != HasReturnvaluesIF::RETURN_OK) {
sif::error
<< "VerificationReporter::sendFailureReport Error writing to queue. Code: "