adapted MessageQueueSenderIF function calls
This commit is contained in:
parent
5734a0a0e9
commit
dadc867d9e
@ -52,6 +52,7 @@ 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());
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,8 @@ public:
|
||||
eventmanagerQueue = eventmanager->getEventReportQueue();
|
||||
}
|
||||
}
|
||||
MessageQueueSenderIF::sendMessage(eventmanagerQueue, message, sentFrom);
|
||||
MessageQueueSenderIF::sendMessage(eventmanagerQueue, message,
|
||||
MessageQueueMessage::MAX_MESSAGE_SIZE, sentFrom);
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -70,6 +70,7 @@ 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;
|
||||
@ -90,6 +91,7 @@ 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;
|
||||
|
@ -28,6 +28,7 @@ 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;
|
||||
}
|
||||
@ -50,6 +51,7 @@ 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;
|
||||
@ -95,7 +97,7 @@ void ModeHelper::sendModeReplyMessage(Mode_t ownerMode,
|
||||
ownerMode, ownerSubmode);
|
||||
}
|
||||
MessageQueueSenderIF::sendMessage(theOneWhoCommandedAMode, &reply,
|
||||
owner->getCommandQueue());
|
||||
MessageQueueMessage::MAX_MESSAGE_SIZE, owner->getCommandQueue());
|
||||
}
|
||||
}
|
||||
|
||||
@ -109,6 +111,7 @@ 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());
|
||||
}
|
||||
}
|
||||
|
@ -105,11 +105,14 @@ void FixedTimeslotTask::taskFunctionality() {
|
||||
//The component for this slot is executed and the next one is chosen.
|
||||
this->pst.executeAndAdvance();
|
||||
if (not pst.slotFollowsImmediately()) {
|
||||
// Get the interval till execution of the next slot.
|
||||
intervalMs = this->pst.getIntervalToPreviousSlotMs();
|
||||
interval = pdMS_TO_TICKS(intervalMs);
|
||||
|
||||
/* If all operations are finished and the difference of the
|
||||
* current time minus the last wake time is larger than the
|
||||
* expected wait period, a deadline was missed. */
|
||||
if(xTaskGetTickCount() - xLastWakeTime >=
|
||||
pdMS_TO_TICKS(this->pst.getIntervalToPreviousSlotMs())) {
|
||||
if(xTaskGetTickCount() - xLastWakeTime >= interval) {
|
||||
#ifdef DEBUG
|
||||
sif::warning << "FixedTimeslotTask: " << pcTaskGetName(NULL) <<
|
||||
" missed deadline!\n" << std::flush;
|
||||
@ -117,14 +120,9 @@ void FixedTimeslotTask::taskFunctionality() {
|
||||
if(deadlineMissedFunc != nullptr) {
|
||||
this->deadlineMissedFunc();
|
||||
}
|
||||
// Continue immediately, no need to wait.
|
||||
continue;
|
||||
}
|
||||
|
||||
// we need to wait before executing the current slot
|
||||
//this gives us the time to wait:
|
||||
intervalMs = this->pst.getIntervalToPreviousSlotMs();
|
||||
interval = pdMS_TO_TICKS(intervalMs);
|
||||
// Wait for the interval. This exits immediately if a deadline was
|
||||
// missed while also updating the last wake time.
|
||||
vTaskDelayUntil(&xLastWakeTime, interval);
|
||||
}
|
||||
}
|
||||
|
@ -80,6 +80,12 @@ ReturnValue_t MessageQueue::receiveMessage(MessageQueueMessageIF* message,
|
||||
}
|
||||
|
||||
ReturnValue_t MessageQueue::receiveMessage(MessageQueueMessageIF* message) {
|
||||
if(message->getMaximumMessageSize() < maxMessageSize) {
|
||||
sif::error << "MessageQueue::receiveMessage: Message size "
|
||||
<< message->getMaximumMessageSize() <<
|
||||
" too small to receive data!" << std::endl;
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
BaseType_t result = xQueueReceive(handle,reinterpret_cast<void*>(
|
||||
message->getBuffer()), 0);
|
||||
if (result == pdPASS){
|
||||
@ -126,8 +132,10 @@ ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo,
|
||||
message->setSender(sentFrom);
|
||||
BaseType_t result;
|
||||
if(message->getMaximumMessageSize() > maxSize) {
|
||||
sif::error << "MessageQueue::sendMessageFromMessageQueue: Message size"
|
||||
"too large for queue!" << std::endl;
|
||||
sif::error << "MessageQueue::sendMessageFromMessageQueue: Message size "
|
||||
<< message->getMaximumMessageSize() << " too large for queue"
|
||||
" with max. message size " << maxSize << "!"
|
||||
<< std::endl;
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,11 @@ 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,
|
||||
sentFrom,ignoreFault);
|
||||
}
|
||||
|
@ -107,7 +107,8 @@ ReturnValue_t ParameterHelper::sendParameter(MessageQueueId_t to, uint32_t id,
|
||||
|
||||
ParameterMessage::setParameterDumpReply(&reply, id, address);
|
||||
|
||||
MessageQueueSenderIF::sendMessage(to, &reply, ownerQueueId);
|
||||
MessageQueueSenderIF::sendMessage(to, &reply,
|
||||
MessageQueueMessage::MAX_MESSAGE_SIZE, ownerQueueId);
|
||||
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
@ -129,5 +130,6 @@ void ParameterHelper::rejectCommand(MessageQueueId_t to, ReturnValue_t reason,
|
||||
MessageQueueMessage message;
|
||||
CommandMessage reply(&message);
|
||||
reply.setReplyRejected(reason, initialCommand);
|
||||
MessageQueueSenderIF::sendMessage(to, &reply, ownerQueueId);
|
||||
MessageQueueSenderIF::sendMessage(to, &reply,
|
||||
MessageQueueMessage::MAX_MESSAGE_SIZE, ownerQueueId);
|
||||
}
|
||||
|
@ -117,7 +117,8 @@ ReturnValue_t TmPacketStored::sendPacket(MessageQueueId_t destination,
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
TmTcMessage tmMessage(getStoreAddress());
|
||||
ReturnValue_t result = MessageQueueSenderIF::sendMessage(destination, &tmMessage, sentFrom);
|
||||
ReturnValue_t result = MessageQueueSenderIF::sendMessage(destination,
|
||||
&tmMessage, MessageQueueMessage::MAX_MESSAGE_SIZE, sentFrom);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
deletePacket();
|
||||
if (doErrorReporting) {
|
||||
|
Loading…
Reference in New Issue
Block a user