2020-08-28 17:44:10 +02:00
|
|
|
#ifndef EVENTOBJECT_EVENT_H_
|
|
|
|
#define EVENTOBJECT_EVENT_H_
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include "fwSubsystemIdRanges.h"
|
2020-12-08 14:34:56 +01:00
|
|
|
// could be moved to more suitable location
|
2020-11-08 15:20:51 +01:00
|
|
|
#include <events/subsystemIdRanges.h>
|
2020-08-28 17:44:10 +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;
|
|
|
|
|
2020-12-08 14:34:56 +01:00
|
|
|
namespace event {
|
2020-08-28 17:44:10 +02:00
|
|
|
|
2020-12-08 14:34:56 +01:00
|
|
|
constexpr EventId_t getEventId(Event event) {
|
|
|
|
return (event & 0xFFFF);
|
|
|
|
}
|
|
|
|
|
|
|
|
constexpr EventSeverity_t getSeverity(Event event) {
|
|
|
|
return ((event >> 16) & 0xFF);
|
|
|
|
}
|
2020-08-28 17:44:10 +02:00
|
|
|
|
2020-12-08 14:34:56 +01:00
|
|
|
constexpr Event makeEvent(uint8_t subsystemId, uint8_t uniqueEventId,
|
|
|
|
EventSeverity_t eventSeverity) {
|
|
|
|
return (eventSeverity << 16) + (subsystemId * 100) + uniqueEventId;
|
2020-08-28 17:44:10 +02:00
|
|
|
}
|
2020-09-25 19:01:59 +02:00
|
|
|
|
2020-08-28 17:44:10 +02:00
|
|
|
}
|
|
|
|
|
2020-12-08 14:34:56 +01:00
|
|
|
namespace severity {
|
|
|
|
static constexpr EventSeverity_t INFO = 1;
|
|
|
|
static constexpr EventSeverity_t LOW = 2;
|
|
|
|
static constexpr EventSeverity_t MEDIUM = 3;
|
|
|
|
static constexpr EventSeverity_t HIGH = 4;
|
|
|
|
}
|
2020-08-28 17:44:10 +02:00
|
|
|
|
|
|
|
#endif /* EVENTOBJECT_EVENT_H_ */
|