EIVE upstream #29
@ -53,8 +53,8 @@ void EventManager::notifyListeners(EventMessage* message) {
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << std::hex << "EventManager::notifyListeners: MSG to 0x" << std::setfill('0')
|
||||
<< std::setw(8) << listener.first << " failed with result 0x"
|
||||
<< std::setw(4) << result << std::setfill(' ') << std::endl;
|
||||
<< std::setw(8) << listener.first << " failed with result 0x" << std::setw(4)
|
||||
<< result << std::setfill(' ') << std::endl;
|
||||
#else
|
||||
sif::printError("Sending message to listener 0x%08x failed with result %04x\n",
|
||||
listener.first, result);
|
||||
@ -204,9 +204,9 @@ void EventManager::printListeners() {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::info << "Event manager listener MQ IDs:" << std::setfill('0') << std::hex << std::endl;
|
||||
for (auto& listener : listenerList) {
|
||||
sif::info << "0x" << std::setw(8) << listener.first << std::endl;
|
||||
sif::info << "0x" << std::setw(8) << listener.first << std::endl;
|
||||
}
|
||||
sif::info << std::dec << std::setfill(' ');
|
||||
sif::info << std::dec << std::setfill(' ');
|
||||
#else
|
||||
sif::printInfo("Event manager listener MQ IDs:\n");
|
||||
for (auto& listener : listenerList) {
|
||||
|
@ -4,8 +4,8 @@
|
||||
#include <cstdint>
|
||||
|
||||
#include "MessageQueueIF.h"
|
||||
#include "definitions.h"
|
||||
#include "MessageQueueMessage.h"
|
||||
#include "definitions.h"
|
||||
|
||||
/**
|
||||
* Creates message queues.
|
||||
@ -24,7 +24,7 @@ class QueueFactory {
|
||||
|
||||
MessageQueueIF* createMessageQueue(uint32_t messageDepth = 3,
|
||||
size_t maxMessageSize = MessageQueueMessage::MAX_MESSAGE_SIZE,
|
||||
MqArgs* args = nullptr);
|
||||
MqArgs* args = nullptr);
|
||||
|
||||
void deleteMessageQueue(MessageQueueIF* queue);
|
||||
|
||||
|
@ -3,8 +3,10 @@
|
||||
#include <fsfw/objectmanager/SystemObjectIF.h>
|
||||
|
||||
struct MqArgs {
|
||||
object_id_t objectId = 0;
|
||||
void* args = nullptr;
|
||||
MqArgs(){};
|
||||
MqArgs(object_id_t objectId, void* args = nullptr) : objectId(objectId), args(args) {}
|
||||
object_id_t objectId = 0;
|
||||
void* args = nullptr;
|
||||
};
|
||||
|
||||
#endif /* FSFW_SRC_FSFW_IPC_DEFINITIONS_H_ */
|
||||
|
@ -55,7 +55,7 @@ class MessageQueue : public MessageQueueIF {
|
||||
*/
|
||||
MessageQueue(size_t messageDepth = 3,
|
||||
size_t maxMessageSize = MessageQueueMessage::MAX_MESSAGE_SIZE,
|
||||
MqArgs* args = nullptr);
|
||||
MqArgs* args = nullptr);
|
||||
|
||||
/** Copying message queues forbidden */
|
||||
MessageQueue(const MessageQueue&) = delete;
|
||||
|
@ -22,7 +22,8 @@ QueueFactory::QueueFactory() {}
|
||||
|
||||
QueueFactory::~QueueFactory() {}
|
||||
|
||||
MessageQueueIF* QueueFactory::createMessageQueue(uint32_t messageDepth, size_t maxMessageSize, MqArgs* args) {
|
||||
MessageQueueIF* QueueFactory::createMessageQueue(uint32_t messageDepth, size_t maxMessageSize,
|
||||
MqArgs* args) {
|
||||
return new MessageQueue(messageDepth, maxMessageSize, args);
|
||||
}
|
||||
|
||||
|
@ -7,8 +7,8 @@
|
||||
#include "fsfw/internalerror/InternalErrorReporterIF.h"
|
||||
#include "fsfw/ipc/MessageQueueIF.h"
|
||||
#include "fsfw/ipc/MessageQueueMessage.h"
|
||||
#include "fsfw/ipc/definitions.h"
|
||||
#include "fsfw/ipc/MutexIF.h"
|
||||
#include "fsfw/ipc/definitions.h"
|
||||
#include "fsfw/timemanager/Clock.h"
|
||||
|
||||
/**
|
||||
@ -56,7 +56,7 @@ class MessageQueue : public MessageQueueIF {
|
||||
*/
|
||||
MessageQueue(size_t messageDepth = 3,
|
||||
size_t maxMessageSize = MessageQueueMessage::MAX_MESSAGE_SIZE,
|
||||
MqArgs* args = nullptr);
|
||||
MqArgs* args = nullptr);
|
||||
|
||||
/** Copying message queues forbidden */
|
||||
MessageQueue(const MessageQueue&) = delete;
|
||||
|
@ -27,7 +27,8 @@ QueueFactory::QueueFactory() {}
|
||||
|
||||
QueueFactory::~QueueFactory() {}
|
||||
|
||||
MessageQueueIF* QueueFactory::createMessageQueue(uint32_t messageDepth, size_t maxMessageSize, MqArgs* args) {
|
||||
MessageQueueIF* QueueFactory::createMessageQueue(uint32_t messageDepth, size_t maxMessageSize,
|
||||
MqArgs* args) {
|
||||
// A thread-safe queue can be implemented by using a combination
|
||||
// of std::queue and std::mutex. This uses dynamic memory allocation
|
||||
// which could be alleviated by using a custom allocator, external library
|
||||
|
@ -37,6 +37,9 @@ MessageQueue::MessageQueue(uint32_t messageDepth, size_t maxMessageSize, MqArgs*
|
||||
// Successful mq_open call
|
||||
this->id = tempId;
|
||||
}
|
||||
if (args != nullptr) {
|
||||
this->mqArgs = *args;
|
||||
}
|
||||
}
|
||||
|
||||
MessageQueue::~MessageQueue() {
|
||||
|
@ -5,8 +5,8 @@
|
||||
|
||||
#include "fsfw/internalerror/InternalErrorReporterIF.h"
|
||||
#include "fsfw/ipc/MessageQueueIF.h"
|
||||
#include "fsfw/ipc/definitions.h"
|
||||
#include "fsfw/ipc/MessageQueueMessage.h"
|
||||
#include "fsfw/ipc/definitions.h"
|
||||
/**
|
||||
* @brief This class manages sending and receiving of message queue messages.
|
||||
*
|
||||
@ -44,7 +44,7 @@ class MessageQueue : public MessageQueueIF {
|
||||
*/
|
||||
MessageQueue(uint32_t messageDepth = 3,
|
||||
size_t maxMessageSize = MessageQueueMessage::MAX_MESSAGE_SIZE,
|
||||
MqArgs* args = nullptr);
|
||||
MqArgs* args = nullptr);
|
||||
/**
|
||||
* @brief The destructor deletes the formerly created message queue.
|
||||
* @details This is accomplished by using the delete call provided by the operating system.
|
||||
@ -186,6 +186,8 @@ class MessageQueue : public MessageQueueIF {
|
||||
*/
|
||||
char name[16];
|
||||
|
||||
MqArgs mqArgs = {};
|
||||
|
||||
static uint16_t queueCounter;
|
||||
const size_t maxMessageSize;
|
||||
|
||||
|
@ -28,7 +28,8 @@ QueueFactory::QueueFactory() {}
|
||||
|
||||
QueueFactory::~QueueFactory() {}
|
||||
|
||||
MessageQueueIF* QueueFactory::createMessageQueue(uint32_t messageDepth, size_t maxMessageSize, MqArgs* args) {
|
||||
MessageQueueIF* QueueFactory::createMessageQueue(uint32_t messageDepth, size_t maxMessageSize,
|
||||
MqArgs* args) {
|
||||
return new MessageQueue(messageDepth, maxMessageSize, args);
|
||||
}
|
||||
|
||||
|
@ -4,8 +4,8 @@
|
||||
#include "RtemsBasic.h"
|
||||
#include "fsfw/internalerror/InternalErrorReporterIF.h"
|
||||
#include "fsfw/ipc/MessageQueueIF.h"
|
||||
#include "fsfw/ipc/definitions.h"
|
||||
#include "fsfw/ipc/MessageQueueMessage.h"
|
||||
#include "fsfw/ipc/definitions.h"
|
||||
|
||||
/**
|
||||
* @brief This class manages sending and receiving of message queue messages.
|
||||
@ -36,7 +36,7 @@ class MessageQueue : public MessageQueueIF {
|
||||
*/
|
||||
MessageQueue(size_t message_depth = 3,
|
||||
size_t max_message_size = MessageQueueMessage::MAX_MESSAGE_SIZE,
|
||||
MqArgs* args = nullptr);
|
||||
MqArgs* args = nullptr);
|
||||
/**
|
||||
* @brief The destructor deletes the formerly created message queue.
|
||||
* @details This is accomplished by using the delete call provided by the operating system.
|
||||
|
@ -49,7 +49,8 @@ QueueFactory::QueueFactory() {}
|
||||
|
||||
QueueFactory::~QueueFactory() {}
|
||||
|
||||
MessageQueueIF* QueueFactory::createMessageQueue(uint32_t messageDepth, size_t maxMessageSize, MqArgs* args) {
|
||||
MessageQueueIF* QueueFactory::createMessageQueue(uint32_t messageDepth, size_t maxMessageSize,
|
||||
MqArgs* args) {
|
||||
return new MessageQueue(messageDepth, maxMessageSize, args);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user