From 6ea9cc3a743563fb02edb1cc044296d0ea141e5c Mon Sep 17 00:00:00 2001
From: athatheocsd <athatheo@csd.auth.gr>
Date: Mon, 3 Dec 2018 04:51:37 +0200
Subject: [PATCH] Probably basic function of [5,5]-[5,8] completed. I'll have
 to check when !(sleepy).

---
 inc/Services/EventReportService.hpp |  4 ++--
 src/Services/EventReportService.cpp | 20 ++++++++++++++++++--
 2 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/inc/Services/EventReportService.hpp b/inc/Services/EventReportService.hpp
index 9682b491..8a2f2bd2 100644
--- a/inc/Services/EventReportService.hpp
+++ b/inc/Services/EventReportService.hpp
@@ -16,7 +16,7 @@
 #define ECSS_EVENTS_BITS 16
 
 class EventReportService : public Service {
-public:
+private:
 	static const uint8_t numberOfEvents = 7;
 	std::bitset<numberOfEvents> stateOfEvents;
 public:
@@ -124,7 +124,7 @@ public:
 
 	/**
 	 * TC[5,7] request to report the disabled event definitions
-	 *
+	 * Note: No arguments, according to the standard.
 	 */
 	void requestListOfDisabledEvents();
 
diff --git a/src/Services/EventReportService.cpp b/src/Services/EventReportService.cpp
index 4db2cca4..40772172 100644
--- a/src/Services/EventReportService.cpp
+++ b/src/Services/EventReportService.cpp
@@ -1,9 +1,10 @@
 #include <Services/EventReportService.hpp>
 #include "Services/EventReportService.hpp"
 #include "Message.hpp"
+
 /**
  *
- * @todo: this code is error prone, depending on parameters given, add fail safes
+ * @todo: this code is error prone, depending on parameters given, add fail safes (probably?)
  */
 void EventReportService::informativeEventReport(Event eventID, const uint8_t *data,
                                                 uint8_t length) {
@@ -55,15 +56,30 @@ void EventReportService::enableReportGeneration(uint8_t length, Event *eventID)
 }
 
 void EventReportService::disableReportGeneration(uint8_t length, Event *eventID) {
+	// TC[5,6]
 	for (uint8_t i = 0; i < length; i++) {
 		stateOfEvents[static_cast<uint8_t> (eventID[i])] = 0;
 	}
 }
 
 void EventReportService::requestListOfDisabledEvents() {
-
+	// TC[5,7]
+	// I think this is all that is needed here.
+	listOfDisabledEventsReport();
 }
 
 void EventReportService::listOfDisabledEventsReport() {
+	// TC[5,8]
+	Message report = createTM(8);
 
+	// Any chance we'll have more than uint8_t (>255 events) ? This will produce an error!
+	uint8_t numberOfDisabledEvents = stateOfEvents.size() - stateOfEvents.any();
+	report.appendByte(numberOfDisabledEvents);
+	for (uint8_t i = 0; i < numberOfDisabledEvents; i++) {
+		if (stateOfEvents[i] == 0) {
+			report.appendEnum8(i);
+		}
+	}
+
+	storeMessage(report);
 }
-- 
GitLab