Skip to content
Snippets Groups Projects
Commit fd2c0b69 authored by athatheocsd's avatar athatheocsd
Browse files

Added disabling of report generation

parent d292309e
No related branches found
No related tags found
No related merge requests found
......@@ -20,14 +20,18 @@ private:
static const uint16_t numberOfEvents = 7;
std::bitset<numberOfEvents> stateOfEvents;
public:
// Variables that count the event occurrences per severity level
// Variables that count the event reports per severity level
uint16_t lowSeverityReportsCount;
uint16_t mediumSeverityReportCount;
uint16_t highSeverityReportCount;
// Variables that count the event occurences per severity level
uint16_t lowSeverityEventCount;
uint16_t mediumSeverityEventCount;
uint16_t highSeverityEventCount;
uint16_t disabledEventsCount;
uint16_t lastInformativeEventReportID;
uint16_t lastLowSeverityReportID;
uint16_t lastMediumSeverityReportID;
uint16_t lastHighSeverityReportID;
......@@ -39,7 +43,9 @@ public:
mediumSeverityReportCount = 0;
highSeverityReportCount = 0;
disabledEventsCount = 0;
lastInformativeEventReportID = -1;
lowSeverityEventCount = 0;
mediumSeverityEventCount = 0;
highSeverityEventCount = 0;
lastLowSeverityReportID = -1;
lastMediumSeverityReportID = -1;
lastHighSeverityReportID = -1;
......
......@@ -9,50 +9,60 @@
void EventReportService::informativeEventReport(Event eventID, const uint8_t *data,
uint8_t length) {
// TM[5,1]
Message report = createTM(1);
report.appendEnum16(eventID);
report.appendString(length, data);
lastInformativeEventReportID = static_cast<uint16_t >(eventID);
if (stateOfEvents[static_cast<uint16_t> (eventID)] == 1){
Message report = createTM(1);
report.appendEnum16(eventID);
report.appendString(length, data);
storeMessage(report);
storeMessage(report);
}
}
void
EventReportService::lowSeverityAnomalyReport(Event eventID, const uint8_t *data,
uint8_t length) {
lowSeverityEventCount++;
// TM[5,2]
lowSeverityReportsCount++;
Message report = createTM(2);
report.appendEnum16(eventID);
report.appendString(length, data);
lastLowSeverityReportID = static_cast<uint16_t >(eventID);
if (stateOfEvents[static_cast<uint16_t> (eventID)] == 1) {
lowSeverityReportsCount++;
Message report = createTM(2);
report.appendEnum16(eventID);
report.appendString(length, data);
lastLowSeverityReportID = static_cast<uint16_t >(eventID);
storeMessage(report);
storeMessage(report);
}
}
void EventReportService::mediumSeverityAnomalyReport(Event eventID,
const uint8_t *data, uint8_t length) {
mediumSeverityEventCount++;
// TM[5,3]
mediumSeverityReportCount++;
Message report = createTM(3);
report.appendEnum16(eventID);
report.appendString(length, data);
lastMediumSeverityReportID = static_cast<uint16_t >(eventID);
if (stateOfEvents[static_cast<uint16_t> (eventID)] == 1) {
mediumSeverityReportCount++;
Message report = createTM(3);
report.appendEnum16(eventID);
report.appendString(length, data);
lastMediumSeverityReportID = static_cast<uint16_t >(eventID);
storeMessage(report);
storeMessage(report);
}
}
void
EventReportService::highSeverityAnomalyReport(Event eventID, const uint8_t *data,
uint8_t length) {
highSeverityEventCount++;
// TM[5,4]
highSeverityReportCount++;
Message report = createTM(4);
report.appendEnum16(eventID);
report.appendString(length, data);
lastHighSeverityReportID = static_cast<uint16_t >(eventID);
if (stateOfEvents[static_cast<uint16_t> (eventID)] == 1) {
highSeverityReportCount++;
Message report = createTM(4);
report.appendEnum16(eventID);
report.appendString(length, data);
lastHighSeverityReportID = static_cast<uint16_t >(eventID);
storeMessage(report);
storeMessage(report);
}
}
void EventReportService::enableReportGeneration(uint16_t length, Event *eventID) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment