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) {
|
for (auto iter = listenerList.begin(); iter != listenerList.end(); ++iter) {
|
||||||
if (iter->second.match(message)) {
|
if (iter->second.match(message)) {
|
||||||
MessageQueueSenderIF::sendMessage(iter->first, message,
|
MessageQueueSenderIF::sendMessage(iter->first, message,
|
||||||
|
MessageQueueMessage::MAX_MESSAGE_SIZE,
|
||||||
message->getSender());
|
message->getSender());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,8 @@ public:
|
|||||||
eventmanagerQueue = eventmanager->getEventReportQueue();
|
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,
|
HealthMessage::setHealthMessage(&information, HealthMessage::HEALTH_INFO,
|
||||||
health, oldHealth);
|
health, oldHealth);
|
||||||
if (MessageQueueSenderIF::sendMessage(parentQueue, &information,
|
if (MessageQueueSenderIF::sendMessage(parentQueue, &information,
|
||||||
|
MessageQueueMessage::MAX_MESSAGE_SIZE,
|
||||||
owner->getCommandQueue()) != HasReturnvaluesIF::RETURN_OK) {
|
owner->getCommandQueue()) != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::debug << "HealthHelper::informParent: sending health reply failed."
|
sif::debug << "HealthHelper::informParent: sending health reply failed."
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
@ -90,6 +91,7 @@ void HealthHelper::handleSetHealthCommand(CommandMessage* command) {
|
|||||||
reply.setReplyRejected(result, command->getCommand());
|
reply.setReplyRejected(result, command->getCommand());
|
||||||
}
|
}
|
||||||
if (MessageQueueSenderIF::sendMessage(command->getSender(), &reply,
|
if (MessageQueueSenderIF::sendMessage(command->getSender(), &reply,
|
||||||
|
MessageQueueMessage::MAX_MESSAGE_SIZE,
|
||||||
owner->getCommandQueue()) != HasReturnvaluesIF::RETURN_OK) {
|
owner->getCommandQueue()) != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::debug << "HealthHelper::handleHealthCommand: sending health "
|
sif::debug << "HealthHelper::handleHealthCommand: sending health "
|
||||||
"reply failed." << std::endl;
|
"reply failed." << std::endl;
|
||||||
|
@ -28,6 +28,7 @@ ReturnValue_t ModeHelper::handleModeCommand(CommandMessage* command) {
|
|||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
ModeMessage::cantReachMode(&reply, result);
|
ModeMessage::cantReachMode(&reply, result);
|
||||||
MessageQueueSenderIF::sendMessage(command->getSender(), &reply,
|
MessageQueueSenderIF::sendMessage(command->getSender(), &reply,
|
||||||
|
MessageQueueMessage::MAX_MESSAGE_SIZE,
|
||||||
owner->getCommandQueue());
|
owner->getCommandQueue());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -50,6 +51,7 @@ ReturnValue_t ModeHelper::handleModeCommand(CommandMessage* command) {
|
|||||||
ModeMessage::setModeMessage(&reply, ModeMessage::REPLY_MODE_REPLY, mode,
|
ModeMessage::setModeMessage(&reply, ModeMessage::REPLY_MODE_REPLY, mode,
|
||||||
submode);
|
submode);
|
||||||
MessageQueueSenderIF::sendMessage(command->getSender(), &reply,
|
MessageQueueSenderIF::sendMessage(command->getSender(), &reply,
|
||||||
|
MessageQueueMessage::MAX_MESSAGE_SIZE,
|
||||||
owner->getCommandQueue());
|
owner->getCommandQueue());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -95,7 +97,7 @@ void ModeHelper::sendModeReplyMessage(Mode_t ownerMode,
|
|||||||
ownerMode, ownerSubmode);
|
ownerMode, ownerSubmode);
|
||||||
}
|
}
|
||||||
MessageQueueSenderIF::sendMessage(theOneWhoCommandedAMode, &reply,
|
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,
|
ModeMessage::setModeMessage(&reply, ModeMessage::REPLY_MODE_INFO,
|
||||||
ownerMode, ownerSubmode);
|
ownerMode, ownerSubmode);
|
||||||
MessageQueueSenderIF::sendMessage(parentQueueId, &reply,
|
MessageQueueSenderIF::sendMessage(parentQueueId, &reply,
|
||||||
|
MessageQueueMessage::MAX_MESSAGE_SIZE,
|
||||||
owner->getCommandQueue());
|
owner->getCommandQueue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -105,11 +105,14 @@ void FixedTimeslotTask::taskFunctionality() {
|
|||||||
//The component for this slot is executed and the next one is chosen.
|
//The component for this slot is executed and the next one is chosen.
|
||||||
this->pst.executeAndAdvance();
|
this->pst.executeAndAdvance();
|
||||||
if (not pst.slotFollowsImmediately()) {
|
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
|
/* If all operations are finished and the difference of the
|
||||||
* current time minus the last wake time is larger than the
|
* current time minus the last wake time is larger than the
|
||||||
* expected wait period, a deadline was missed. */
|
* expected wait period, a deadline was missed. */
|
||||||
if(xTaskGetTickCount() - xLastWakeTime >=
|
if(xTaskGetTickCount() - xLastWakeTime >= interval) {
|
||||||
pdMS_TO_TICKS(this->pst.getIntervalToPreviousSlotMs())) {
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
sif::warning << "FixedTimeslotTask: " << pcTaskGetName(NULL) <<
|
sif::warning << "FixedTimeslotTask: " << pcTaskGetName(NULL) <<
|
||||||
" missed deadline!\n" << std::flush;
|
" missed deadline!\n" << std::flush;
|
||||||
@ -117,14 +120,9 @@ void FixedTimeslotTask::taskFunctionality() {
|
|||||||
if(deadlineMissedFunc != nullptr) {
|
if(deadlineMissedFunc != nullptr) {
|
||||||
this->deadlineMissedFunc();
|
this->deadlineMissedFunc();
|
||||||
}
|
}
|
||||||
// Continue immediately, no need to wait.
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
// Wait for the interval. This exits immediately if a deadline was
|
||||||
// we need to wait before executing the current slot
|
// missed while also updating the last wake time.
|
||||||
//this gives us the time to wait:
|
|
||||||
intervalMs = this->pst.getIntervalToPreviousSlotMs();
|
|
||||||
interval = pdMS_TO_TICKS(intervalMs);
|
|
||||||
vTaskDelayUntil(&xLastWakeTime, interval);
|
vTaskDelayUntil(&xLastWakeTime, interval);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -80,6 +80,12 @@ ReturnValue_t MessageQueue::receiveMessage(MessageQueueMessageIF* message,
|
|||||||
}
|
}
|
||||||
|
|
||||||
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*>(
|
BaseType_t result = xQueueReceive(handle,reinterpret_cast<void*>(
|
||||||
message->getBuffer()), 0);
|
message->getBuffer()), 0);
|
||||||
if (result == pdPASS){
|
if (result == pdPASS){
|
||||||
@ -126,8 +132,10 @@ ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo,
|
|||||||
message->setSender(sentFrom);
|
message->setSender(sentFrom);
|
||||||
BaseType_t result;
|
BaseType_t result;
|
||||||
if(message->getMaximumMessageSize() > maxSize) {
|
if(message->getMaximumMessageSize() > maxSize) {
|
||||||
sif::error << "MessageQueue::sendMessageFromMessageQueue: Message size"
|
sif::error << "MessageQueue::sendMessageFromMessageQueue: Message size "
|
||||||
"too large for queue!" << std::endl;
|
<< message->getMaximumMessageSize() << " too large for queue"
|
||||||
|
" with max. message size " << maxSize << "!"
|
||||||
|
<< std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,11 @@ QueueFactory* QueueFactory::factoryInstance = nullptr;
|
|||||||
ReturnValue_t MessageQueueSenderIF::sendMessage(MessageQueueId_t sendTo,
|
ReturnValue_t MessageQueueSenderIF::sendMessage(MessageQueueId_t sendTo,
|
||||||
MessageQueueMessageIF* message, size_t maxSize,
|
MessageQueueMessageIF* message, size_t maxSize,
|
||||||
MessageQueueId_t sentFrom, bool ignoreFault) {
|
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,
|
return MessageQueue::sendMessageFromMessageQueue(sendTo,message, maxSize,
|
||||||
sentFrom,ignoreFault);
|
sentFrom,ignoreFault);
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,8 @@ ReturnValue_t ParameterHelper::sendParameter(MessageQueueId_t to, uint32_t id,
|
|||||||
|
|
||||||
ParameterMessage::setParameterDumpReply(&reply, id, address);
|
ParameterMessage::setParameterDumpReply(&reply, id, address);
|
||||||
|
|
||||||
MessageQueueSenderIF::sendMessage(to, &reply, ownerQueueId);
|
MessageQueueSenderIF::sendMessage(to, &reply,
|
||||||
|
MessageQueueMessage::MAX_MESSAGE_SIZE, ownerQueueId);
|
||||||
|
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
@ -129,5 +130,6 @@ void ParameterHelper::rejectCommand(MessageQueueId_t to, ReturnValue_t reason,
|
|||||||
MessageQueueMessage message;
|
MessageQueueMessage message;
|
||||||
CommandMessage reply(&message);
|
CommandMessage reply(&message);
|
||||||
reply.setReplyRejected(reason, initialCommand);
|
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;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
TmTcMessage tmMessage(getStoreAddress());
|
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) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
deletePacket();
|
deletePacket();
|
||||||
if (doErrorReporting) {
|
if (doErrorReporting) {
|
||||||
|
Loading…
Reference in New Issue
Block a user