make event api change

This commit is contained in:
Robin Müller 2020-12-01 17:44:36 +01:00
parent f0f7388c0d
commit 606aac687b
2 changed files with 7 additions and 4 deletions

View File

@ -1,4 +1,5 @@
#include "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);
@ -8,7 +9,8 @@ EventSeverity_t getSeverity(Event event) {
return ((event >> 16) & 0xFF); return ((event >> 16) & 0xFF);
} }
Event makeEvent(EventId_t eventId, EventSeverity_t eventSeverity) { Event makeEvent(uint8_t subsystemId, uint8_t uniqueEventId,
return (eventSeverity << 16) + (eventId & 0xFFFF); EventSeverity_t eventSeverity) {
return (eventSeverity << 16) + (subsystemId * 100) + uniqueEventId;
} }
} }

View File

@ -18,9 +18,10 @@ EventId_t getEventId(Event event);
EventSeverity_t getSeverity(Event event); EventSeverity_t getSeverity(Event event);
Event makeEvent(EventId_t eventId, EventSeverity_t eventSeverity); Event makeEvent(uint8_t subsystemId, uint8_t uniqueEventId,
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;