Merge branch 'development' into mueller/devicehandlers-update

This commit is contained in:
Robin Müller 2020-12-22 12:49:49 +01:00
commit a53959affa
5 changed files with 28 additions and 24 deletions

View File

@ -27,13 +27,11 @@
#define FSFW_OBJ_EVENT_TRANSLATION 0
#if FSFW_OBJ_EVENT_TRANSLATION == 1
#define FSFW_DEBUG_OUTPUT 1
//! Specify whether info events are printed too.
#define FSFW_DEBUG_INFO 1
#include <translateObjects.h>
#include <translateEvents.h>
#else
#define FSFW_DEBUG_OUTPUT 0
#endif
//! When using the newlib nano library, C99 support for stdio facilities

View File

@ -1,7 +1,7 @@
#include "EventManager.h"
#include "EventMessage.h"
#include <FSFWConfig.h>
#include <FSFWConfig.h>
#include "../serviceinterface/ServiceInterfaceStream.h"
#include "../ipc/QueueFactory.h"
#include "../ipc/MutexFactory.h"
@ -43,7 +43,7 @@ ReturnValue_t EventManager::performOperation(uint8_t opCode) {
EventMessage message;
result = eventReportQueue->receiveMessage(&message);
if (result == HasReturnvaluesIF::RETURN_OK) {
#ifdef DEBUG
#if FSFW_OBJ_EVENT_TRANSLATION == 1
printEvent(&message);
#endif
notifyListeners(&message);
@ -114,13 +114,13 @@ ReturnValue_t EventManager::unsubscribeFromEventRange(MessageQueueId_t listener,
return result;
}
#if FSFW_DEBUG_OUTPUT == 1
#if FSFW_OBJ_EVENT_TRANSLATION == 1
void EventManager::printEvent(EventMessage* message) {
const char *string = 0;
switch (message->getSeverity()) {
case severity::INFO:
#ifdef DEBUG_INFO_EVENT
#if DEBUG_INFO_EVENT == 1
string = translateObject(message->getReporter());
sif::info << "EVENT: ";
if (string != 0) {

View File

@ -1,18 +1,20 @@
#ifndef EVENTMANAGER_H_
#define EVENTMANAGER_H_
#ifndef FSFW_EVENT_EVENTMANAGER_H_
#define FSFW_EVENT_EVENTMANAGER_H_
#include "eventmatching/EventMatchTree.h"
#include "EventManagerIF.h"
#include "eventmatching/EventMatchTree.h"
#include <FSFWConfig.h>
#include "../objectmanager/SystemObject.h"
#include "../storagemanager/LocalPool.h"
#include "../tasks/ExecutableObjectIF.h"
#include "../ipc/MessageQueueIF.h"
#include "../ipc/MutexIF.h"
#include <FSFWConfig.h>
#include <map>
#if FSFW_DEBUG_OUTPUT == 1
#if FSFW_OBJ_EVENT_TRANSLATION == 1
// forward declaration, should be implemented by mission
extern const char* translateObject(object_id_t object);
extern const char* translateEvents(Event event);
@ -59,7 +61,7 @@ protected:
void notifyListeners(EventMessage *message);
#if FSFW_DEBUG_OUTPUT == 1
#if FSFW_OBJ_EVENT_TRANSLATION == 1
void printEvent(EventMessage *message);
#endif
@ -68,4 +70,4 @@ protected:
void unlockMutex();
};
#endif /* EVENTMANAGER_H_ */
#endif /* FSFW_EVENT_EVENTMANAGER_H_ */

View File

@ -1,10 +1,11 @@
#ifndef EVENTMANAGERIF_H_
#define EVENTMANAGERIF_H_
#include "eventmatching/eventmatching.h"
#include "EventMessage.h"
#include "eventmatching/eventmatching.h"
#include "../objectmanager/ObjectManagerIF.h"
#include "../ipc/MessageQueueSenderIF.h"
#include "../ipc/MessageQueueIF.h"
class EventManagerIF {
public:
@ -16,7 +17,8 @@ public:
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,
EventId_t event) = 0;
virtual ReturnValue_t subscribeToAllEventsFrom(MessageQueueId_t listener,
@ -31,18 +33,22 @@ public:
bool reporterInverted = false) = 0;
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);
triggerEvent(&message, sentFrom);
}
static void triggerEvent(EventMessage* message, MessageQueueId_t sentFrom = 0) {
static MessageQueueId_t eventmanagerQueue = 0;
if (eventmanagerQueue == 0) {
static void triggerEvent(EventMessage* message,
MessageQueueId_t sentFrom = 0) {
static MessageQueueId_t eventmanagerQueue = MessageQueueIF::NO_QUEUE;
if (eventmanagerQueue == MessageQueueIF::NO_QUEUE) {
EventManagerIF *eventmanager = objectManager->get<EventManagerIF>(
objects::EVENT_MANAGER);
if (eventmanager != NULL) {
eventmanagerQueue = eventmanager->getEventReportQueue();
if (eventmanager == nullptr) {
return;
}
eventmanagerQueue = eventmanager->getEventReportQueue();
}
MessageQueueSenderIF::sendMessage(eventmanagerQueue, message, sentFrom);
}

View File

@ -29,13 +29,11 @@
//! additional output which requires the translation files translateObjects
//! and translateEvents (and their compiles source files)
#if FSFW_OBJ_EVENT_TRANSLATION == 1
#define FSFW_DEBUG_OUTPUT 1
//! Specify whether info events are printed too.
#define FSFW_DEBUG_INFO 1
#define FSFW_DEBUG_INFO 1
#include <translateObjects.h>
#include <translateEvents.h>
#else
#define FSFW_DEBUG_OUTPUT 0
#endif
//! When using the newlib nano library, C99 support for stdio facilities