Merge branch 'development' into mueller/timeman-update
This commit is contained in:
commit
ea289be29e
@ -27,13 +27,11 @@
|
|||||||
#define FSFW_OBJ_EVENT_TRANSLATION 0
|
#define FSFW_OBJ_EVENT_TRANSLATION 0
|
||||||
|
|
||||||
#if FSFW_OBJ_EVENT_TRANSLATION == 1
|
#if FSFW_OBJ_EVENT_TRANSLATION == 1
|
||||||
#define FSFW_DEBUG_OUTPUT 1
|
|
||||||
//! Specify whether info events are printed too.
|
//! Specify whether info events are printed too.
|
||||||
#define FSFW_DEBUG_INFO 1
|
#define FSFW_DEBUG_INFO 1
|
||||||
#include <translateObjects.h>
|
#include <translateObjects.h>
|
||||||
#include <translateEvents.h>
|
#include <translateEvents.h>
|
||||||
#else
|
#else
|
||||||
#define FSFW_DEBUG_OUTPUT 0
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//! When using the newlib nano library, C99 support for stdio facilities
|
//! When using the newlib nano library, C99 support for stdio facilities
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "EventManager.h"
|
#include "EventManager.h"
|
||||||
#include "EventMessage.h"
|
#include "EventMessage.h"
|
||||||
#include <FSFWConfig.h>
|
|
||||||
|
|
||||||
|
#include <FSFWConfig.h>
|
||||||
#include "../serviceinterface/ServiceInterfaceStream.h"
|
#include "../serviceinterface/ServiceInterfaceStream.h"
|
||||||
#include "../ipc/QueueFactory.h"
|
#include "../ipc/QueueFactory.h"
|
||||||
#include "../ipc/MutexFactory.h"
|
#include "../ipc/MutexFactory.h"
|
||||||
@ -43,7 +43,7 @@ ReturnValue_t EventManager::performOperation(uint8_t opCode) {
|
|||||||
EventMessage message;
|
EventMessage message;
|
||||||
result = eventReportQueue->receiveMessage(&message);
|
result = eventReportQueue->receiveMessage(&message);
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
#ifdef DEBUG
|
#if FSFW_OBJ_EVENT_TRANSLATION == 1
|
||||||
printEvent(&message);
|
printEvent(&message);
|
||||||
#endif
|
#endif
|
||||||
notifyListeners(&message);
|
notifyListeners(&message);
|
||||||
@ -114,13 +114,13 @@ ReturnValue_t EventManager::unsubscribeFromEventRange(MessageQueueId_t listener,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if FSFW_DEBUG_OUTPUT == 1
|
#if FSFW_OBJ_EVENT_TRANSLATION == 1
|
||||||
|
|
||||||
void EventManager::printEvent(EventMessage* message) {
|
void EventManager::printEvent(EventMessage* message) {
|
||||||
const char *string = 0;
|
const char *string = 0;
|
||||||
switch (message->getSeverity()) {
|
switch (message->getSeverity()) {
|
||||||
case severity::INFO:
|
case severity::INFO:
|
||||||
#ifdef DEBUG_INFO_EVENT
|
#if DEBUG_INFO_EVENT == 1
|
||||||
string = translateObject(message->getReporter());
|
string = translateObject(message->getReporter());
|
||||||
sif::info << "EVENT: ";
|
sif::info << "EVENT: ";
|
||||||
if (string != 0) {
|
if (string != 0) {
|
||||||
|
@ -1,18 +1,20 @@
|
|||||||
#ifndef EVENTMANAGER_H_
|
#ifndef FSFW_EVENT_EVENTMANAGER_H_
|
||||||
#define EVENTMANAGER_H_
|
#define FSFW_EVENT_EVENTMANAGER_H_
|
||||||
|
|
||||||
#include "eventmatching/EventMatchTree.h"
|
|
||||||
#include "EventManagerIF.h"
|
#include "EventManagerIF.h"
|
||||||
|
#include "eventmatching/EventMatchTree.h"
|
||||||
|
|
||||||
|
#include <FSFWConfig.h>
|
||||||
|
|
||||||
#include "../objectmanager/SystemObject.h"
|
#include "../objectmanager/SystemObject.h"
|
||||||
#include "../storagemanager/LocalPool.h"
|
#include "../storagemanager/LocalPool.h"
|
||||||
#include "../tasks/ExecutableObjectIF.h"
|
#include "../tasks/ExecutableObjectIF.h"
|
||||||
#include "../ipc/MessageQueueIF.h"
|
#include "../ipc/MessageQueueIF.h"
|
||||||
#include "../ipc/MutexIF.h"
|
#include "../ipc/MutexIF.h"
|
||||||
#include <FSFWConfig.h>
|
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#if FSFW_DEBUG_OUTPUT == 1
|
#if FSFW_OBJ_EVENT_TRANSLATION == 1
|
||||||
// forward declaration, should be implemented by mission
|
// forward declaration, should be implemented by mission
|
||||||
extern const char* translateObject(object_id_t object);
|
extern const char* translateObject(object_id_t object);
|
||||||
extern const char* translateEvents(Event event);
|
extern const char* translateEvents(Event event);
|
||||||
@ -59,7 +61,7 @@ protected:
|
|||||||
|
|
||||||
void notifyListeners(EventMessage *message);
|
void notifyListeners(EventMessage *message);
|
||||||
|
|
||||||
#if FSFW_DEBUG_OUTPUT == 1
|
#if FSFW_OBJ_EVENT_TRANSLATION == 1
|
||||||
void printEvent(EventMessage *message);
|
void printEvent(EventMessage *message);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -68,4 +70,4 @@ protected:
|
|||||||
void unlockMutex();
|
void unlockMutex();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* EVENTMANAGER_H_ */
|
#endif /* FSFW_EVENT_EVENTMANAGER_H_ */
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
#ifndef EVENTMANAGERIF_H_
|
#ifndef EVENTMANAGERIF_H_
|
||||||
#define EVENTMANAGERIF_H_
|
#define EVENTMANAGERIF_H_
|
||||||
|
|
||||||
#include "eventmatching/eventmatching.h"
|
|
||||||
#include "EventMessage.h"
|
#include "EventMessage.h"
|
||||||
|
#include "eventmatching/eventmatching.h"
|
||||||
#include "../objectmanager/ObjectManagerIF.h"
|
#include "../objectmanager/ObjectManagerIF.h"
|
||||||
#include "../ipc/MessageQueueSenderIF.h"
|
#include "../ipc/MessageQueueSenderIF.h"
|
||||||
|
#include "../ipc/MessageQueueIF.h"
|
||||||
|
|
||||||
class EventManagerIF {
|
class EventManagerIF {
|
||||||
public:
|
public:
|
||||||
@ -16,7 +17,8 @@ public:
|
|||||||
|
|
||||||
virtual MessageQueueId_t getEventReportQueue() = 0;
|
virtual MessageQueueId_t getEventReportQueue() = 0;
|
||||||
|
|
||||||
virtual ReturnValue_t registerListener(MessageQueueId_t listener, bool forwardAllButSelected = false) = 0;
|
virtual ReturnValue_t registerListener(MessageQueueId_t listener,
|
||||||
|
bool forwardAllButSelected = false) = 0;
|
||||||
virtual ReturnValue_t subscribeToEvent(MessageQueueId_t listener,
|
virtual ReturnValue_t subscribeToEvent(MessageQueueId_t listener,
|
||||||
EventId_t event) = 0;
|
EventId_t event) = 0;
|
||||||
virtual ReturnValue_t subscribeToAllEventsFrom(MessageQueueId_t listener,
|
virtual ReturnValue_t subscribeToAllEventsFrom(MessageQueueId_t listener,
|
||||||
@ -31,18 +33,22 @@ public:
|
|||||||
bool reporterInverted = false) = 0;
|
bool reporterInverted = false) = 0;
|
||||||
|
|
||||||
static void triggerEvent(object_id_t reportingObject, Event event,
|
static void triggerEvent(object_id_t reportingObject, Event event,
|
||||||
uint32_t parameter1 = 0, uint32_t parameter2 = 0, MessageQueueId_t sentFrom = 0) {
|
uint32_t parameter1 = 0, uint32_t parameter2 = 0,
|
||||||
|
MessageQueueId_t sentFrom = 0) {
|
||||||
EventMessage message(event, reportingObject, parameter1, parameter2);
|
EventMessage message(event, reportingObject, parameter1, parameter2);
|
||||||
triggerEvent(&message, sentFrom);
|
triggerEvent(&message, sentFrom);
|
||||||
}
|
}
|
||||||
static void triggerEvent(EventMessage* message, MessageQueueId_t sentFrom = 0) {
|
|
||||||
static MessageQueueId_t eventmanagerQueue = 0;
|
static void triggerEvent(EventMessage* message,
|
||||||
if (eventmanagerQueue == 0) {
|
MessageQueueId_t sentFrom = 0) {
|
||||||
|
static MessageQueueId_t eventmanagerQueue = MessageQueueIF::NO_QUEUE;
|
||||||
|
if (eventmanagerQueue == MessageQueueIF::NO_QUEUE) {
|
||||||
EventManagerIF *eventmanager = objectManager->get<EventManagerIF>(
|
EventManagerIF *eventmanager = objectManager->get<EventManagerIF>(
|
||||||
objects::EVENT_MANAGER);
|
objects::EVENT_MANAGER);
|
||||||
if (eventmanager != NULL) {
|
if (eventmanager == nullptr) {
|
||||||
eventmanagerQueue = eventmanager->getEventReportQueue();
|
return;
|
||||||
}
|
}
|
||||||
|
eventmanagerQueue = eventmanager->getEventReportQueue();
|
||||||
}
|
}
|
||||||
MessageQueueSenderIF::sendMessage(eventmanagerQueue, message, sentFrom);
|
MessageQueueSenderIF::sendMessage(eventmanagerQueue, message, sentFrom);
|
||||||
}
|
}
|
||||||
|
@ -29,13 +29,11 @@
|
|||||||
//! additional output which requires the translation files translateObjects
|
//! additional output which requires the translation files translateObjects
|
||||||
//! and translateEvents (and their compiles source files)
|
//! and translateEvents (and their compiles source files)
|
||||||
#if FSFW_OBJ_EVENT_TRANSLATION == 1
|
#if FSFW_OBJ_EVENT_TRANSLATION == 1
|
||||||
#define FSFW_DEBUG_OUTPUT 1
|
|
||||||
//! Specify whether info events are printed too.
|
//! Specify whether info events are printed too.
|
||||||
#define FSFW_DEBUG_INFO 1
|
#define FSFW_DEBUG_INFO 1
|
||||||
#include <translateObjects.h>
|
#include <translateObjects.h>
|
||||||
#include <translateEvents.h>
|
#include <translateEvents.h>
|
||||||
#else
|
#else
|
||||||
#define FSFW_DEBUG_OUTPUT 0
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//! When using the newlib nano library, C99 support for stdio facilities
|
//! When using the newlib nano library, C99 support for stdio facilities
|
||||||
|
Loading…
Reference in New Issue
Block a user