WIP: somethings wrong.. #19

Closed
muellerr wants to merge 808 commits from source/master into master
18 changed files with 813 additions and 824 deletions
Showing only changes of commit e800aad979 - Show all commits

View File

@ -1,4 +1,4 @@
#include "../events/Event.h" #include "Event.h"
namespace EVENT { namespace EVENT {
EventId_t getEventId(Event event) { EventId_t getEventId(Event event) {
return (event & 0xFFFF); return (event & 0xFFFF);

View File

@ -1,10 +1,10 @@
#ifndef FRAMEWORK_EVENTS_EVENT_H_ #ifndef EVENTOBJECT_EVENT_H_
#define FRAMEWORK_EVENTS_EVENT_H_ #define EVENTOBJECT_EVENT_H_
#include <cstdint> #include <stdint.h>
#include "../events/fwSubsystemIdRanges.h" #include "fwSubsystemIdRanges.h"
//could be move to more suitable location //could be move to more suitable location
#include <subsystemIdRanges.h> #include <config/tmtc/subsystemIdRanges.h>
typedef uint16_t EventId_t; typedef uint16_t EventId_t;
typedef uint8_t EventSeverity_t; typedef uint8_t EventSeverity_t;
@ -21,7 +21,6 @@ EventSeverity_t getSeverity(Event event);
Event makeEvent(EventId_t eventId, EventSeverity_t eventSeverity); Event makeEvent(EventId_t eventId, EventSeverity_t eventSeverity);
} }
namespace SEVERITY { namespace SEVERITY {
static const EventSeverity_t INFO = 1; static const EventSeverity_t INFO = 1;
static const EventSeverity_t LOW = 2; static const EventSeverity_t LOW = 2;
@ -42,4 +41,4 @@ namespace SEVERITY {
// static const EventSeverity_t HIGH = 4; // static const EventSeverity_t HIGH = 4;
//}; //};
#endif /* FRAMEWORK_EVENTS_EVENT_H_ */ #endif /* EVENTOBJECT_EVENT_H_ */

View File

@ -1,5 +1,5 @@
#include "../events/EventManager.h" #include "EventManager.h"
#include "../events/EventMessage.h" #include "EventMessage.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"
@ -8,16 +8,13 @@
const uint16_t EventManager::POOL_SIZES[N_POOLS] = { const uint16_t EventManager::POOL_SIZES[N_POOLS] = {
sizeof(EventMatchTree::Node), sizeof(EventIdRangeMatcher), sizeof(EventMatchTree::Node), sizeof(EventIdRangeMatcher),
sizeof(ReporterRangeMatcher) }; sizeof(ReporterRangeMatcher) };
// If one checks registerListener calls, there are around 40 (to max 50) //If one checks registerListener calls, there are around 40 (to max 50) objects registering for certain events.
// 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.
// 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.
// SHOULDDO: Shouldn't this be in the config folder and passed via ctor?
const uint16_t EventManager::N_ELEMENTS[N_POOLS] = { 240, 120, 120 }; const uint16_t EventManager::N_ELEMENTS[N_POOLS] = { 240, 120, 120 };
EventManager::EventManager(object_id_t setObjectId) : EventManager::EventManager(object_id_t setObjectId) :
SystemObject(setObjectId), SystemObject(setObjectId), eventReportQueue(NULL), mutex(NULL), factoryBackend(
factoryBackend(0, POOL_SIZES, N_ELEMENTS, false, true) { 0, POOL_SIZES, N_ELEMENTS, false, true) {
mutex = MutexFactory::instance()->createMutex(); mutex = MutexFactory::instance()->createMutex();
eventReportQueue = QueueFactory::instance()->createMessageQueue( eventReportQueue = QueueFactory::instance()->createMessageQueue(
MAX_EVENTS_PER_CYCLE, EventMessage::EVENT_MESSAGE_SIZE); MAX_EVENTS_PER_CYCLE, EventMessage::EVENT_MESSAGE_SIZE);
@ -133,23 +130,16 @@ void EventManager::printEvent(EventMessage* message) {
break; break;
default: default:
string = translateObject(message->getReporter()); string = translateObject(message->getReporter());
sif::debug << "EventManager: "; sif::error << "EVENT: ";
if (string != 0) { if (string != 0) {
sif::debug << string; sif::error << string;
} else {
sif::error << "0x" << std::hex << message->getReporter() << std::dec;
} }
else { sif::error << " reported " << translateEvents(message->getEvent()) << " ("
sif::debug << "0x" << std::hex << message->getReporter() << std::dec; << std::dec << message->getEventId() << std::hex << ") P1: 0x"
} << message->getParameter1() << " P2: 0x"
sif::debug << " reported " << translateEvents(message->getEvent()) << message->getParameter2() << std::dec << std::endl;
<< " (" << std::dec << message->getEventId() << ") "
<< std::endl;
sif::debug << std::hex << "P1 Hex: 0x" << message->getParameter1()
<< ", P1 Dec: " << std::dec << message->getParameter1()
<< std::endl;
sif::debug << std::hex << "P2 Hex: 0x" << message->getParameter2()
<< ", P2 Dec: " << std::dec << message->getParameter2()
<< std::endl;
break; break;
} }

View File

@ -1,8 +1,8 @@
#ifndef EVENTMANAGER_H_ #ifndef EVENTMANAGER_H_
#define EVENTMANAGER_H_ #define EVENTMANAGER_H_
#include "../events/eventmatching/EventMatchTree.h" #include "eventmatching/EventMatchTree.h"
#include "../events/EventManagerIF.h" #include "EventManagerIF.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"
@ -36,11 +36,11 @@ public:
ReturnValue_t performOperation(uint8_t opCode); ReturnValue_t performOperation(uint8_t opCode);
protected: protected:
MessageQueueIF* eventReportQueue = nullptr; MessageQueueIF* eventReportQueue;
std::map<MessageQueueId_t, EventMatchTree> listenerList; std::map<MessageQueueId_t, EventMatchTree> listenerList;
MutexIF* mutex = nullptr; MutexIF* mutex;
static const uint8_t N_POOLS = 3; static const uint8_t N_POOLS = 3;
LocalPool<N_POOLS> factoryBackend; LocalPool<N_POOLS> factoryBackend;

View File

@ -1,8 +1,8 @@
#ifndef EVENTMANAGERIF_H_ #ifndef EVENTMANAGERIF_H_
#define EVENTMANAGERIF_H_ #define EVENTMANAGERIF_H_
#include "../events/eventmatching/eventmatching.h" #include "eventmatching/eventmatching.h"
#include "../events/EventMessage.h" #include "EventMessage.h"
#include "../objectmanager/ObjectManagerIF.h" #include "../objectmanager/ObjectManagerIF.h"
#include "../ipc/MessageQueueSenderIF.h" #include "../ipc/MessageQueueSenderIF.h"

View File

@ -1,4 +1,4 @@
#include "../events/EventMessage.h" #include "EventMessage.h"
#include <cstring> #include <cstring>
EventMessage::EventMessage() { EventMessage::EventMessage() {

View File

@ -1,7 +1,7 @@
#ifndef EVENTMESSAGE_H_ #ifndef EVENTMESSAGE_H_
#define EVENTMESSAGE_H_ #define EVENTMESSAGE_H_
#include "../events/Event.h" #include "Event.h"
#include "../ipc/MessageQueueMessage.h" #include "../ipc/MessageQueueMessage.h"
#include "../objectmanager/ObjectManagerIF.h" #include "../objectmanager/ObjectManagerIF.h"

View File

@ -1,7 +1,7 @@
#ifndef FRAMEWORK_EVENTS_EVENTREPORTINGPROXYIF_H_ #ifndef FRAMEWORK_EVENTS_EVENTREPORTINGPROXYIF_H_
#define FRAMEWORK_EVENTS_EVENTREPORTINGPROXYIF_H_ #define FRAMEWORK_EVENTS_EVENTREPORTINGPROXYIF_H_
#include "../events/Event.h" #include "Event.h"
class EventReportingProxyIF { class EventReportingProxyIF {

View File

@ -1,4 +1,4 @@
#include "../../events/eventmatching/EventIdRangeMatcher.h" #include "EventIdRangeMatcher.h"
EventIdRangeMatcher::EventIdRangeMatcher(EventId_t lower, EventId_t upper, EventIdRangeMatcher::EventIdRangeMatcher(EventId_t lower, EventId_t upper,
bool inverted) : EventRangeMatcherBase<EventId_t>(lower, upper, inverted) { bool inverted) : EventRangeMatcherBase<EventId_t>(lower, upper, inverted) {

View File

@ -1,7 +1,7 @@
#ifndef FRAMEWORK_EVENTS_EVENTMATCHING_EVENTIDRANGEMATCHER_H_ #ifndef FRAMEWORK_EVENTS_EVENTMATCHING_EVENTIDRANGEMATCHER_H_
#define FRAMEWORK_EVENTS_EVENTMATCHING_EVENTIDRANGEMATCHER_H_ #define FRAMEWORK_EVENTS_EVENTMATCHING_EVENTIDRANGEMATCHER_H_
#include "../../events/eventmatching/EventRangeMatcherBase.h" #include "EventRangeMatcherBase.h"
class EventIdRangeMatcher: public EventRangeMatcherBase<EventId_t> { class EventIdRangeMatcher: public EventRangeMatcherBase<EventId_t> {
public: public:

View File

@ -1,7 +1,7 @@
#include "../../events/eventmatching/EventIdRangeMatcher.h" #include "EventIdRangeMatcher.h"
#include "../../events/eventmatching/EventMatchTree.h" #include "EventMatchTree.h"
#include "../../events/eventmatching/ReporterRangeMatcher.h" #include "ReporterRangeMatcher.h"
#include "../../events/eventmatching/SeverityRangeMatcher.h" #include "SeverityRangeMatcher.h"
EventMatchTree::EventMatchTree(StorageManagerIF* storageBackend, EventMatchTree::EventMatchTree(StorageManagerIF* storageBackend,
bool invertedMatch) : bool invertedMatch) :

View File

@ -1,4 +1,4 @@
#include "../../events/eventmatching/ReporterRangeMatcher.h" #include "ReporterRangeMatcher.h"
ReporterRangeMatcher::ReporterRangeMatcher(object_id_t lower, object_id_t upper, ReporterRangeMatcher::ReporterRangeMatcher(object_id_t lower, object_id_t upper,
bool inverted) : EventRangeMatcherBase<object_id_t>(lower, upper, inverted) { bool inverted) : EventRangeMatcherBase<object_id_t>(lower, upper, inverted) {

View File

@ -1,7 +1,7 @@
#ifndef FRAMEWORK_EVENTS_EVENTMATCHING_REPORTERRANGEMATCHER_H_ #ifndef FRAMEWORK_EVENTS_EVENTMATCHING_REPORTERRANGEMATCHER_H_
#define FRAMEWORK_EVENTS_EVENTMATCHING_REPORTERRANGEMATCHER_H_ #define FRAMEWORK_EVENTS_EVENTMATCHING_REPORTERRANGEMATCHER_H_
#include "../../events/eventmatching/EventRangeMatcherBase.h" #include "EventRangeMatcherBase.h"
class ReporterRangeMatcher: public EventRangeMatcherBase<object_id_t> { class ReporterRangeMatcher: public EventRangeMatcherBase<object_id_t> {
public: public:

View File

@ -1,4 +1,4 @@
#include "../../events/eventmatching/SeverityRangeMatcher.h" #include "SeverityRangeMatcher.h"
#include "../../events/EventMessage.h" #include "../../events/EventMessage.h"
#include "../../serialize/SerializeAdapter.h" #include "../../serialize/SerializeAdapter.h"

View File

@ -1,7 +1,7 @@
#ifndef FRAMEWORK_EVENTS_EVENTMATCHING_SEVERITYRANGEMATCHER_H_ #ifndef FRAMEWORK_EVENTS_EVENTMATCHING_SEVERITYRANGEMATCHER_H_
#define FRAMEWORK_EVENTS_EVENTMATCHING_SEVERITYRANGEMATCHER_H_ #define FRAMEWORK_EVENTS_EVENTMATCHING_SEVERITYRANGEMATCHER_H_
#include "../../events/eventmatching/EventRangeMatcherBase.h" #include "EventRangeMatcherBase.h"
class SeverityRangeMatcher: public EventRangeMatcherBase<EventSeverity_t> { class SeverityRangeMatcher: public EventRangeMatcherBase<EventSeverity_t> {
public: public:

View File

@ -1,10 +1,10 @@
#ifndef EVENTMATCHING_H_ #ifndef EVENTMATCHING_H_
#define EVENTMATCHING_H_ #define EVENTMATCHING_H_
#include "../../events/eventmatching/EventIdRangeMatcher.h" #include "EventIdRangeMatcher.h"
#include "../../events/eventmatching/EventMatchTree.h" #include "EventMatchTree.h"
#include "../../events/eventmatching/ReporterRangeMatcher.h" #include "ReporterRangeMatcher.h"
#include "../../events/eventmatching/SeverityRangeMatcher.h" #include "SeverityRangeMatcher.h"
#endif /* EVENTMATCHING_H_ */ #endif /* EVENTMATCHING_H_ */