ASTP 1.1.0 Merge Development in Master #441

Merged
gaisser merged 265 commits from development into master 2021-06-29 14:11:46 +02:00
Showing only changes of commit e961f3f038 - Show all commits

View File

@ -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,15 +90,14 @@ 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;
} }
case(EEXIST): { case(EEXIST): {
// An error occured during open // An error occured during open
// We need to distinguish if it is caused by an already created queue // We need to distinguish if it is caused by an already created queue
//There's another queue with the same name // There's another queue with the same name
//We unlink the other queue // We unlink the other queue
int status = mq_unlink(name); int status = mq_unlink(name);
if (status != 0) { if (status != 0) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
@ -204,14 +202,15 @@ 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 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "MessageQueue::receive: configuration error " sif::error << "MessageQueue::receive: configuration error "
<< strerror(errno) << std::endl; << strerror(errno) << std::endl;
#endif #endif
/*NO BREAK*/ return HasReturnvaluesIF::RETURN_FAILED;
case EINVAL: }
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,
@ -222,11 +221,12 @@ ReturnValue_t MessageQueue::receiveMessage(MessageQueueMessageIF* message) {
* been set in the queue's mq_flags. * been set in the queue's mq_flags.
*/ */
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "MessageQueue::receive: configuration error " sif::error << "MessageQueue::receive: EINVAL error "
<< strerror(errno) << std::endl; << strerror(errno) << std::endl;
#endif #endif
/*NO BREAK*/ return HasReturnvaluesIF::RETURN_FAILED;
case EMSGSIZE: }
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,
@ -237,12 +237,29 @@ ReturnValue_t MessageQueue::receiveMessage(MessageQueueMessageIF* message) {
* been received. * been received.
*/ */
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "MessageQueue::receive: configuration error " sif::error << "MessageQueue::receive: EMSGSIZE error "
<< strerror(errno) << std::endl; << strerror(errno) << std::endl;
#endif #endif
/*NO BREAK*/ return HasReturnvaluesIF::RETURN_FAILED;
case EINTR: }
case EINTR: {
//The operation was interrupted by a signal. //The operation was interrupted by a signal.
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "MessageQueue::receiveMessage: EINTR error " << strerror(errno) <<
std::endl;
#endif
return HasReturnvaluesIF::RETURN_FAILED;
}
case ETIMEDOUT: {
//The operation was interrupted by a signal.
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "MessageQueue::receiveMessage: ETIMEDOUT error " << strerror(errno) <<
std::endl;
#endif
return HasReturnvaluesIF::RETURN_FAILED;
}
default: default:
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;