From f9939303ec1130a10434b8309b431606ec0d216a Mon Sep 17 00:00:00 2001
From: thodkatz <thodkatz@gmail.com>
Date: Fri, 3 May 2019 16:05:33 +0300
Subject: [PATCH] Keep consistent the declaration of the execute functions in
 all child classes and change the scope of the execute function in the
 MemoryManagementService

---
 inc/Services/EventActionService.hpp      |  2 +-
 inc/Services/EventReportService.hpp      |  2 +-
 inc/Services/MemoryManagementService.hpp | 18 +++++++++---------
 src/MessageParser.cpp                    |  2 +-
 src/Services/EventActionService.cpp      |  2 +-
 src/Services/EventReportService.cpp      |  2 +-
 src/Services/MemoryManagementService.cpp |  8 ++++----
 7 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/inc/Services/EventActionService.hpp b/inc/Services/EventActionService.hpp
index c8052e0e..3ff36eb5 100644
--- a/inc/Services/EventActionService.hpp
+++ b/inc/Services/EventActionService.hpp
@@ -124,7 +124,7 @@ public:
 	 * @note This function is called from the main execute() that is defined in the file MessageParser.hpp
 	 * @param message Contains the necessary parameters to call the suitable subservice
 	 */
-	void execute(const Message& message);
+	void execute(Message& message);
 };
 
 #endif // ECSS_SERVICES_EVENTACTIONSERVICE_HPP
diff --git a/inc/Services/EventReportService.hpp b/inc/Services/EventReportService.hpp
index 6aea19a5..d1eac70f 100644
--- a/inc/Services/EventReportService.hpp
+++ b/inc/Services/EventReportService.hpp
@@ -183,7 +183,7 @@ public:
 	 * @note This function is called from the main execute() that is defined in the file MessageParser.hpp
 	 * @param param Contains the necessary parameters to call the suitable subservice
 	 */
-	void execute(const Message& message);
+	void execute(Message& message);
 };
 
 #endif // ECSS_SERVICES_EVENTREPORTSERVICE_HPP
diff --git a/inc/Services/MemoryManagementService.hpp b/inc/Services/MemoryManagementService.hpp
index 82b6454c..f61ebad7 100644
--- a/inc/Services/MemoryManagementService.hpp
+++ b/inc/Services/MemoryManagementService.hpp
@@ -70,17 +70,17 @@ public:
 		 * @todo Only allow aligned memory address to be start addresses
 		 */
 		void checkRawData(Message &request);
-
-		/**
-		 * It is responsible to call the suitable function that executes a telecommand packet. The source of that packet
-		 * is the ground station.
-		 *
-		 * @note This function is called from the main execute() that is defined in the file MessageParser.hpp
-		 * @param param Contains the necessary parameters to call the suitable subservice
-		 */
-		void execute(Message& message);
 	} rawDataMemorySubservice;
 
+	/**
+	 * It is responsible to call the suitable function that executes a telecommand packet. The source of that packet
+	 * is the ground station.
+	 *
+	 * @note This function is called from the main execute() that is defined in the file MessageParser.hpp
+	 * @param param Contains the necessary parameters to call the suitable subservice
+	 */
+	void execute(Message& message);
+
 private:
 	/**
 	 * Check whether the provided address is valid or not, based on the defined limit values
diff --git a/src/MessageParser.cpp b/src/MessageParser.cpp
index f0cbe00f..29300cdb 100644
--- a/src/MessageParser.cpp
+++ b/src/MessageParser.cpp
@@ -12,7 +12,7 @@ void MessageParser::execute(Message& message) {
 			Services.eventReport.execute(message); // ST[05]
 			break;
 		case 6:
-			Services.memoryManagement.rawDataMemorySubservice.execute(message); // ST[06]
+			Services.memoryManagement.execute(message); // ST[06]
 			break;
 		case 8:
 			Services.functionManagement.execute(message); // ST[08]
diff --git a/src/Services/EventActionService.cpp b/src/Services/EventActionService.cpp
index 8844e695..3d34d298 100644
--- a/src/Services/EventActionService.cpp
+++ b/src/Services/EventActionService.cpp
@@ -190,7 +190,7 @@ void EventActionService::executeAction(uint16_t eventID) {
 	}
 }
 
-void EventActionService::execute(const Message& message) {
+void EventActionService::execute(Message& message) {
 	switch (message.messageType) {
 		case 1:
 			addEventActionDefinitions(message); // TC[19,1]
diff --git a/src/Services/EventReportService.cpp b/src/Services/EventReportService.cpp
index 3e3a24fe..cbf8ee72 100644
--- a/src/Services/EventReportService.cpp
+++ b/src/Services/EventReportService.cpp
@@ -129,7 +129,7 @@ void EventReportService::listOfDisabledEventsReport() {
 	storeMessage(report);
 }
 
-void EventReportService::execute(const Message& message) {
+void EventReportService::execute(Message& message) {
 	switch (message.messageType) {
 		case 5: enableReportGeneration(message); // TC[5,5]
 			break;
diff --git a/src/Services/MemoryManagementService.cpp b/src/Services/MemoryManagementService.cpp
index 4afae414..d592da57 100644
--- a/src/Services/MemoryManagementService.cpp
+++ b/src/Services/MemoryManagementService.cpp
@@ -221,16 +221,16 @@ inline bool MemoryManagementService::dataValidator(const uint8_t* data, uint16_t
 	return (checksum == CRCHelper::calculateCRC(data, length));
 }
 
-void MemoryManagementService::RawDataMemoryManagement::execute(Message& message) {
+void MemoryManagementService::execute(Message& message) {
 	switch (message.messageType) {
 		case 2:
-			loadRawData(message); // TC[6,2]
+			rawDataMemorySubservice.loadRawData(message); // TC[6,2]
 			break;
 		case 5:
-			dumpRawData(message); // TC[6,5]
+			rawDataMemorySubservice.dumpRawData(message); // TC[6,5]
 			break;
 		case 9:
-			checkRawData(message); // TC[6,9]
+			rawDataMemorySubservice.checkRawData(message); // TC[6,9]
 			break;
 		default:
 			ErrorHandler::reportInternalError(ErrorHandler::OtherMessageType);
-- 
GitLab