From a1c800e09eaf5391711bdf4b91770673dcb10c3e Mon Sep 17 00:00:00 2001
From: athatheocsd <athatheo@csd.auth.gr>
Date: Thu, 27 Dec 2018 02:03:53 +0200
Subject: [PATCH] Updated EventReportService to be connected with
 EventActionService

---
 inc/Services/EventReportService.hpp |  1 +
 src/Services/EventReportService.cpp | 10 +++++++++-
 test/MessageParser.cpp              |  4 ++++
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/inc/Services/EventReportService.hpp b/inc/Services/EventReportService.hpp
index 5d17779b..3b2c2bdd 100644
--- a/inc/Services/EventReportService.hpp
+++ b/inc/Services/EventReportService.hpp
@@ -2,6 +2,7 @@
 #define ECSS_SERVICES_EVENTREPORTSERVICE_HPP
 
 #include "Service.hpp"
+#include <Services/EventActionService.hpp> // Not sure if this is needed here or just in .cpp file
 #include <bitset>
 /**
  * Implementation of ST[05] event reporting service
diff --git a/src/Services/EventReportService.cpp b/src/Services/EventReportService.cpp
index f0326119..8190f87f 100644
--- a/src/Services/EventReportService.cpp
+++ b/src/Services/EventReportService.cpp
@@ -1,5 +1,5 @@
 #include <Services/EventReportService.hpp>
-#include "Services/EventReportService.hpp"
+#include <Services/EventActionService.hpp>
 #include "Message.hpp"
 
 /**
@@ -14,6 +14,8 @@ void EventReportService::informativeEventReport(Event eventID, String<64> data)
 		report.appendString(data);
 
 		storeMessage(report);
+		EventActionService eventActionService;
+		eventActionService.executeAction(eventID);
 	}
 }
 
@@ -29,6 +31,8 @@ EventReportService::lowSeverityAnomalyReport(Event eventID, String<64> data) {
 		lastLowSeverityReportID = static_cast<uint16_t >(eventID);
 
 		storeMessage(report);
+		EventActionService eventActionService;
+		eventActionService.executeAction(eventID);
 	}
 }
 
@@ -43,6 +47,8 @@ void EventReportService::mediumSeverityAnomalyReport(Event eventID, String<64> d
 		lastMediumSeverityReportID = static_cast<uint16_t >(eventID);
 
 		storeMessage(report);
+		EventActionService eventActionService;
+		eventActionService.executeAction(eventID);
 	}
 }
 
@@ -58,6 +64,8 @@ EventReportService::highSeverityAnomalyReport(Event eventID, String<64> data) {
 		lastHighSeverityReportID = static_cast<uint16_t >(eventID);
 
 		storeMessage(report);
+		EventActionService eventActionService;
+		eventActionService.executeAction(eventID);
 	}
 }
 
diff --git a/test/MessageParser.cpp b/test/MessageParser.cpp
index 25265d55..d06d7c25 100644
--- a/test/MessageParser.cpp
+++ b/test/MessageParser.cpp
@@ -78,3 +78,7 @@ TEST_CASE("TC message parsing", "[MessageParser]") {
 	CHECK(message.messageType == 31);
 	CHECK(memcmp(message.data, "hello", 5) == 0);
 }
+
+TEST_CASE("TC data parsing into a message", "[MessageParser]") {
+
+}
-- 
GitLab