2016-06-15 23:48:41 +02:00
|
|
|
#ifndef EVENTOBJECT_EVENT_H_
|
|
|
|
#define EVENTOBJECT_EVENT_H_
|
|
|
|
|
|
|
|
#include <stdint.h>
|
2020-08-13 20:53:35 +02:00
|
|
|
#include "fwSubsystemIdRanges.h"
|
2018-07-12 16:29:32 +02:00
|
|
|
//could be move to more suitable location
|
2020-09-26 14:13:20 +02:00
|
|
|
#include <subsystemIdRanges.h>
|
2016-06-15 23:48:41 +02:00
|
|
|
|
|
|
|
typedef uint16_t EventId_t;
|
|
|
|
typedef uint8_t EventSeverity_t;
|
|
|
|
|
|
|
|
#define MAKE_EVENT(id, severity) (((severity)<<16)+(SUBSYSTEM_ID*100)+(id))
|
|
|
|
|
|
|
|
typedef uint32_t Event;
|
|
|
|
|
|
|
|
namespace EVENT {
|
|
|
|
EventId_t getEventId(Event event);
|
|
|
|
|
|
|
|
EventSeverity_t getSeverity(Event event);
|
|
|
|
|
|
|
|
Event makeEvent(EventId_t eventId, EventSeverity_t eventSeverity);
|
|
|
|
|
|
|
|
}
|
|
|
|
namespace SEVERITY {
|
|
|
|
static const EventSeverity_t INFO = 1;
|
|
|
|
static const EventSeverity_t LOW = 2;
|
|
|
|
static const EventSeverity_t MEDIUM = 3;
|
|
|
|
static const EventSeverity_t HIGH = 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Unfortunately, this does not work nicely because of the inability to define static classes in headers.
|
|
|
|
//struct Event {
|
|
|
|
// Event(uint8_t domain, uint8_t counter, EventSeverity_t severity) :
|
|
|
|
// id(domain*100+counter), severity(severity) {
|
|
|
|
// }
|
|
|
|
// EventId_t id;
|
|
|
|
// EventSeverity_t severity;
|
|
|
|
// static const EventSeverity_t INFO = 1;
|
|
|
|
// static const EventSeverity_t LOW = 2;
|
|
|
|
// static const EventSeverity_t MEDIUM = 3;
|
|
|
|
// static const EventSeverity_t HIGH = 4;
|
|
|
|
//};
|
|
|
|
|
|
|
|
#endif /* EVENTOBJECT_EVENT_H_ */
|