event update
This commit is contained in:
parent
e06b15cb9c
commit
57853ba566
@ -1,7 +1,5 @@
|
||||
#include "EventManager.h"
|
||||
#include "EventMessage.h"
|
||||
#include <FSFWConfig.h>
|
||||
|
||||
#include "../serviceinterface/ServiceInterfaceStream.h"
|
||||
#include "../ipc/QueueFactory.h"
|
||||
#include "../ipc/MutexFactory.h"
|
||||
@ -11,6 +9,7 @@
|
||||
// objects registering for certain events.
|
||||
// Each listener requires 1 or 2 EventIdMatcher and 1 or 2 ReportRangeMatcher.
|
||||
// So a good guess is 75 to a max of 100 pools required for each, which fits well.
|
||||
// This should be configurable..
|
||||
const LocalPool::LocalPoolConfig EventManager::poolConfig = {
|
||||
{fsfwconfig::FSFW_EVENTMGMR_MATCHTREE_NODES,
|
||||
sizeof(EventMatchTree::Node)},
|
||||
@ -43,7 +42,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);
|
||||
@ -119,8 +118,8 @@ ReturnValue_t EventManager::unsubscribeFromEventRange(MessageQueueId_t listener,
|
||||
void EventManager::printEvent(EventMessage* message) {
|
||||
const char *string = 0;
|
||||
switch (message->getSeverity()) {
|
||||
case severity::INFO:
|
||||
#ifdef DEBUG_INFO_EVENT
|
||||
case SEVERITY::INFO:
|
||||
#if DEBUG_INFO_EVENT == 1
|
||||
string = translateObject(message->getReporter());
|
||||
sif::info << "EVENT: ";
|
||||
if (string != 0) {
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user