Merge remote-tracking branch 'upstream/mueller/master' into source/develop
This commit is contained in:
commit
442b9370ae
@ -156,11 +156,11 @@ void EventManager::printUtility(sif::OutputTypes printType, EventMessage *messag
|
|||||||
sif::info << "0x" << std::hex << std::setw(8) << std::setfill('0') <<
|
sif::info << "0x" << std::hex << std::setw(8) << std::setfill('0') <<
|
||||||
message->getReporter() << std::setfill(' ') << std::dec;
|
message->getReporter() << std::setfill(' ') << std::dec;
|
||||||
}
|
}
|
||||||
sif::info << " report event with ID " << message->getEventId() << std::endl;
|
sif::info << " reported event with ID " << message->getEventId() << std::endl;
|
||||||
sif::info << std::hex << "P1 Hex: 0x" << message->getParameter1() <<
|
sif::debug << translateEvents(message->getEvent()) << " | " <<std::hex << "P1 Hex: 0x" <<
|
||||||
" | P1 Dec: " << std::dec << message->getParameter1() << std::hex <<
|
message->getParameter1() << " | P1 Dec: " << std::dec << message->getParameter1() <<
|
||||||
" | P2 Hex: 0x" << message->getParameter2() << " | P2 Dec: " << std::dec <<
|
std::hex << " | P2 Hex: 0x" << message->getParameter2() << " | P2 Dec: " <<
|
||||||
message->getParameter2() << std::endl;
|
std::dec << message->getParameter2() << std::endl;
|
||||||
#else
|
#else
|
||||||
if (string != 0) {
|
if (string != 0) {
|
||||||
sif::printInfo("Event Manager: %s reported event with ID %d\n", string,
|
sif::printInfo("Event Manager: %s reported event with ID %d\n", string,
|
||||||
@ -186,11 +186,11 @@ void EventManager::printUtility(sif::OutputTypes printType, EventMessage *messag
|
|||||||
sif::debug << "0x" << std::hex << std::setw(8) << std::setfill('0') <<
|
sif::debug << "0x" << std::hex << std::setw(8) << std::setfill('0') <<
|
||||||
message->getReporter() << std::setfill(' ') << std::dec;
|
message->getReporter() << std::setfill(' ') << std::dec;
|
||||||
}
|
}
|
||||||
sif::debug << " report event with ID " << message->getEventId() << std::endl;
|
sif::debug << " reported event with ID " << message->getEventId() << std::endl;
|
||||||
sif::debug << std::hex << "P1 Hex: 0x" << message->getParameter1() <<
|
sif::debug << translateEvents(message->getEvent()) << " | " <<std::hex << "P1 Hex: 0x" <<
|
||||||
" | P1 Dec: " << std::dec << message->getParameter1() << std::hex <<
|
message->getParameter1() << " | P1 Dec: " << std::dec << message->getParameter1() <<
|
||||||
" | P2 Hex: 0x" << message->getParameter2() << " | P2 Dec: " << std::dec <<
|
std::hex << " | P2 Hex: 0x" << message->getParameter2() << " | P2 Dec: " <<
|
||||||
message->getParameter2() << std::endl;
|
std::dec << message->getParameter2() << std::endl;
|
||||||
#else
|
#else
|
||||||
if (string != 0) {
|
if (string != 0) {
|
||||||
sif::printDebug("Event Manager: %s reported event with ID %d\n", string,
|
sif::printDebug("Event Manager: %s reported event with ID %d\n", string,
|
||||||
|
@ -12,8 +12,7 @@
|
|||||||
|
|
||||||
MessageQueue::MessageQueue(uint32_t messageDepth, size_t maxMessageSize):
|
MessageQueue::MessageQueue(uint32_t messageDepth, size_t maxMessageSize):
|
||||||
id(MessageQueueIF::NO_QUEUE),lastPartner(MessageQueueIF::NO_QUEUE),
|
id(MessageQueueIF::NO_QUEUE),lastPartner(MessageQueueIF::NO_QUEUE),
|
||||||
defaultDestination(MessageQueueIF::NO_QUEUE),
|
defaultDestination(MessageQueueIF::NO_QUEUE), maxMessageSize(maxMessageSize) {
|
||||||
maxMessageSize(maxMessageSize) {
|
|
||||||
//debug << "MessageQueue::MessageQueue: Creating a queue" << std::endl;
|
//debug << "MessageQueue::MessageQueue: Creating a queue" << std::endl;
|
||||||
mq_attr attributes;
|
mq_attr attributes;
|
||||||
this->id = 0;
|
this->id = 0;
|
||||||
@ -91,7 +90,6 @@ ReturnValue_t MessageQueue::handleError(mq_attr* attributes,
|
|||||||
sif::error << "This error can be fixed by setting the maximum "
|
sif::error << "This error can be fixed by setting the maximum "
|
||||||
"allowed message size higher!" << std::endl;
|
"allowed message size higher!" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -204,14 +202,11 @@ ReturnValue_t MessageQueue::receiveMessage(MessageQueueMessageIF* message) {
|
|||||||
//O_NONBLOCK or MQ_NONBLOCK was set and there are no messages
|
//O_NONBLOCK or MQ_NONBLOCK was set and there are no messages
|
||||||
//currently on the specified queue.
|
//currently on the specified queue.
|
||||||
return MessageQueueIF::EMPTY;
|
return MessageQueueIF::EMPTY;
|
||||||
case EBADF:
|
case EBADF: {
|
||||||
//mqdes doesn't represent a valid queue open for reading.
|
//mqdes doesn't represent a valid queue open for reading.
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
return handleRecvError("EBADF");
|
||||||
sif::error << "MessageQueue::receive: configuration error "
|
}
|
||||||
<< strerror(errno) << std::endl;
|
case EINVAL: {
|
||||||
#endif
|
|
||||||
/*NO BREAK*/
|
|
||||||
case EINVAL:
|
|
||||||
/*
|
/*
|
||||||
* This value indicates one of the following:
|
* This value indicates one of the following:
|
||||||
* - The pointer to the buffer for storing the received message,
|
* - The pointer to the buffer for storing the received message,
|
||||||
@ -221,12 +216,9 @@ ReturnValue_t MessageQueue::receiveMessage(MessageQueueMessageIF* message) {
|
|||||||
* queue, and the QNX extended option MQ_READBUF_DYNAMIC hasn't
|
* queue, and the QNX extended option MQ_READBUF_DYNAMIC hasn't
|
||||||
* been set in the queue's mq_flags.
|
* been set in the queue's mq_flags.
|
||||||
*/
|
*/
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
return handleRecvError("EINVAL");
|
||||||
sif::error << "MessageQueue::receive: configuration error "
|
}
|
||||||
<< strerror(errno) << std::endl;
|
case EMSGSIZE: {
|
||||||
#endif
|
|
||||||
/*NO BREAK*/
|
|
||||||
case EMSGSIZE:
|
|
||||||
/*
|
/*
|
||||||
* This value indicates one of the following:
|
* This value indicates one of the following:
|
||||||
* - the QNX extended option MQ_READBUF_DYNAMIC hasn't been set,
|
* - the QNX extended option MQ_READBUF_DYNAMIC hasn't been set,
|
||||||
@ -236,13 +228,18 @@ ReturnValue_t MessageQueue::receiveMessage(MessageQueueMessageIF* message) {
|
|||||||
* given msg_len is too short for the message that would have
|
* given msg_len is too short for the message that would have
|
||||||
* been received.
|
* been received.
|
||||||
*/
|
*/
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
return handleRecvError("EMSGSIZE");
|
||||||
sif::error << "MessageQueue::receive: configuration error "
|
}
|
||||||
<< strerror(errno) << std::endl;
|
|
||||||
#endif
|
case EINTR: {
|
||||||
/*NO BREAK*/
|
|
||||||
case EINTR:
|
|
||||||
//The operation was interrupted by a signal.
|
//The operation was interrupted by a signal.
|
||||||
|
return handleRecvError("EINTR");
|
||||||
|
}
|
||||||
|
case ETIMEDOUT: {
|
||||||
|
//The operation was interrupted by a signal.
|
||||||
|
return handleRecvError("ETIMEDOUT");
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
@ -406,3 +403,17 @@ ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo,
|
|||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ReturnValue_t MessageQueue::handleRecvError(const char * const failString) {
|
||||||
|
if(failString == nullptr) {
|
||||||
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
|
}
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "MessageQueue::receiveMessage: " << failString << " error "
|
||||||
|
<< strerror(errno) << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printError("MessageQueue::receiveMessage: %s error %s\n", failString,
|
||||||
|
strerror(errno));
|
||||||
|
#endif
|
||||||
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
|
}
|
||||||
|
@ -182,6 +182,7 @@ private:
|
|||||||
const size_t maxMessageSize;
|
const size_t maxMessageSize;
|
||||||
|
|
||||||
ReturnValue_t handleError(mq_attr* attributes, uint32_t messageDepth);
|
ReturnValue_t handleError(mq_attr* attributes, uint32_t messageDepth);
|
||||||
|
ReturnValue_t handleRecvError(const char* const failString);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* FSFW_OSAL_LINUX_MESSAGEQUEUE_H_ */
|
#endif /* FSFW_OSAL_LINUX_MESSAGEQUEUE_H_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user