make event func changed

This commit is contained in:
Robin Müller 2020-09-25 19:01:59 +02:00
parent a65745d037
commit cf28c9ff9d
2 changed files with 7 additions and 4 deletions

View File

@ -1,4 +1,5 @@
#include "Event.h"
namespace EVENT {
EventId_t getEventId(Event event) {
return (event & 0xFFFF);
@ -8,7 +9,8 @@ EventSeverity_t getSeverity(Event event) {
return ((event >> 16) & 0xFF);
}
Event makeEvent(EventId_t eventId, EventSeverity_t eventSeverity) {
return (eventSeverity << 16) + (eventId & 0xFFFF);
Event makeEvent(uint8_t subsystemId, uint8_t uniqueEventId,
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);
Event makeEvent(EventId_t eventId, EventSeverity_t eventSeverity);
Event makeEvent(uint8_t subsystemId, uint8_t uniqueEventId,
EventSeverity_t eventSeverity);
}
namespace SEVERITY {
static const EventSeverity_t INFO = 1;
static const EventSeverity_t LOW = 2;