From ee2c21f2c780ee89c76e62adcd955df489c6626e Mon Sep 17 00:00:00 2001
From: kpetridis <petridkon@gmail.com>
Date: Sat, 23 Apr 2022 21:02:22 +0300
Subject: [PATCH] Changed documentation

---
 inc/Helpers/AllMessageTypes.hpp               |   3 +
 inc/Helpers/ForwardControlConfiguration.hpp   | 104 +++---------------
 .../RealTimeForwardingControlService.hpp      |  86 +--------------
 .../RealTimeForwardingControlService.cpp      |  32 ------
 test/Services/RealTimeForwardingControl.cpp   |   1 -
 5 files changed, 19 insertions(+), 207 deletions(-)

diff --git a/inc/Helpers/AllMessageTypes.hpp b/inc/Helpers/AllMessageTypes.hpp
index 33c6941d..2a49215f 100644
--- a/inc/Helpers/AllMessageTypes.hpp
+++ b/inc/Helpers/AllMessageTypes.hpp
@@ -13,6 +13,9 @@
 #include "Services/EventActionService.hpp"
 #include "Services/ParameterService.hpp"
 
+/**
+ * Class holding all the message types for every service type.
+ */
 class AllMessageTypes {
 public:
 	etl::vector<uint8_t, 15> st01Messages = {RequestVerificationService::MessageType::FailedAcceptanceReport,
diff --git a/inc/Helpers/ForwardControlConfiguration.hpp b/inc/Helpers/ForwardControlConfiguration.hpp
index 00656cbe..b41bf2b2 100644
--- a/inc/Helpers/ForwardControlConfiguration.hpp
+++ b/inc/Helpers/ForwardControlConfiguration.hpp
@@ -8,37 +8,18 @@
 #include "Helpers/Parameter.hpp"
 
 /**
- * Contains all the necessary configuration types, for the ST[14] 'Real Time Forwarding Control Service'.
+ * This file implements the Real Time Forward Control configuration, which includes three separate
+ * configurations, Application Process configuration, Housekeeping configuration and Event Report configuration.
+ *
  * @author Konstantinos Petridis <petridkon@gmail.com>
  */
-namespace ForwardControlConfiguration
-{
+
 /**
- * The Application Process configuration. Its architecture is based on a 3-level hierarchy, where the first level
- * is the Application process definitions. Each Application Process definition contains a list of Service Type
- * definitions (level 2) and each Service Type definition contains a list of the Report Type definitions (level 3).
- *
- * 					Applications	[][][]
- * 									 /
- * 			Service types		[][][][][][]
- * 									/
- * 							[][][][][]		Report types
+ * The Application Process configuration. It's basically a map, storing a vector of report type definitions for each
+ * pair of (applicationID, serviceType).
  */
-class ApplicationProcess {
+class ApplicationProcessConfiguration {
 public:
-	/**
-	 * Boolean values for each service type of an application process. True indicates that the service type is not
-	 * empty of report types.
-	 */
-	typedef etl::map<uint8_t, bool, ECSSMaxServiceTypeDefinitions> reportsNotEmpty;
-
-	/**
-	 * Translates the absence of report types, in a service type definition. It specifies whether the 'empty' means that
-	 * it has not been filled yet (so we proceed to add new report types) or it is empty because we block every
-	 * report type for the service.
-	 */
-	etl::map<uint8_t, reportsNotEmpty, ECSSMaxControlledApplicationProcesses> notEmpty;
-
 	/**
 	 * Vector containing the Report Type definitions. Each definition has its unique name of type uint8. For
 	 * example, a Report Type definition could be 'ReportHousekeepingStructures'.
@@ -49,76 +30,17 @@ public:
 	 * This is the key for the application process configuration map. It contains a pair with the applicationID and
 	 * the serviceType.
 	 */
-	typedef std::pair<uint8_t, uint8_t> key;
-
-	//	/**
-	//	 * Map containing the Service Type definitions. Each Service Type definition is accessed via its key-name, of
-	//type
-	//	 * uint8, for example '20' for the  Parameter Management service. Each Service Type definition, contains the
-	//	 * list of its own Report Type definitions.
-	//	 */
-	//	typedef etl::map<uint8_t, reportTypeDefinitions, ECSSMaxServiceTypeDefinitions> serviceTypeDefinitions;
+	typedef std::pair<uint8_t, uint8_t> appServiceKey;
 
 	/**
-	 * Map containing the Application Process definitions. Each application has its own ID. The ID is used as a
-	 * key to provide access to the list of Service Type definitions, included by the application.
+	 * Map containing the Application Process definitions. Each application has its own ID. The combination of the
+	 * application ID and the service type is used as a key to provide access to the list of report type definitions.
 	 */
-	etl::map<key, reportTypeDefinitions, ECSSMaxControlledApplicationProcesses * ECSSMaxServiceTypeDefinitions>
+	etl::map<appServiceKey, reportTypeDefinitions,
+	         ECSSMaxControlledApplicationProcesses * ECSSMaxServiceTypeDefinitions>
 	    definitions;
 
-	ApplicationProcess() = default;
+	ApplicationProcessConfiguration() = default;
 };
 
-/**
- * The Housekeeping Parameter Report configuration. Its architecture is based on a 2-level hierarchy, where the
- * first level is the Application process definitions. Each application process definition contains a list of
- * Housekeeping structure IDs (level 2).
- *
- * 					Applications	[][][]
- * 									 /
- * 								[][][][][][]	Housekeeping structure IDs
- */
-class HousekeepingParameterReport {
-public:
-	/**
-	 * Vector containing the Housekeeping structure IDs.
-	 */
-	typedef etl::vector<uint8_t, ECSSMaxHousekeepingStructures> housekeepingStructureIds;
-
-	/**
-	 * Map containing the Housekeeping definitions (application processes). Each application has its own ID. The ID is
-	 * used as a key to provide access to the list of the Housekeeping structure IDs.
-	 */
-	typedef etl::map<uint8_t, housekeepingStructureIds, ECSSMaxControlledApplicationProcesses> definitions;
-
-	HousekeepingParameterReport() = default;
-};
-
-/**
- * The Housekeeping Parameter Report configuration. Its architecture is based on a 2-level hierarchy, where the
- * first level is the Application process definitions. Each application process definition contains a list of
- * Event Definition IDs (level 2).
- *
- * 					Applications	[][][]
- * 									 /
- * 								[][][][][][]	Event Definition IDs
- */
-class EventReportBlocking {
-public:
-	/**
-	 * Vector containing the Event Definition IDs.
-	 */
-	typedef etl::vector<uint8_t, ECSSMaxEventDefinitionIDs> eventDefinitionIds;
-
-	/**
-	 * Map containing the Event Report Blocking definitions (applications). Each application has its own ID. The ID is
-	 * used as a key to provide access to the list of the Event Definitions.
-	 */
-	typedef etl::map<uint8_t, eventDefinitionIds, ECSSMaxControlledApplicationProcesses> definitions;
-
-	EventReportBlocking() = default;
-};
-
-} // namespace ForwardControlConfiguration
-
 #endif
diff --git a/inc/Services/RealTimeForwardingControlService.hpp b/inc/Services/RealTimeForwardingControlService.hpp
index 58e0b30a..2d35cbf3 100644
--- a/inc/Services/RealTimeForwardingControlService.hpp
+++ b/inc/Services/RealTimeForwardingControlService.hpp
@@ -23,23 +23,13 @@ public:
 
 	enum MessageType : uint8_t {
 		AddReportTypesToAppProcessConfiguration = 1,
-		DeleteReportTypesFromAppProcessConfiguration = 2,
-		ReportAppProcessConfigurationContent = 3,
-		AppProcessConfigurationContentReport = 4,
-		AddStructuresToHousekeepingConfiguration = 5,
-		DeleteStructuresFromHousekeepingConfiguration = 6,
-		ReportHousekeepingConfigurationContent = 7,
-		HousekeepingConfigurationContentReport = 8,
-		DeleteEventDefinitionsFromEventReportConfiguration = 13,
-		AddEventDefinitionsToEventReportConfiguration = 14,
-		ReportEventReportConfigurationContent = 15,
-		EventReportConfigurationContentReport = 16,
 	};
 
 	RealTimeForwardingControlService() = default;
 
 	/**
 	 * All the message types of every service type.
+	 * todo: needs to be updated after the implementation of the remaining ecss services.
 	 */
 	AllMessageTypes allMessageTypes;
 
@@ -52,18 +42,7 @@ public:
 	 * The Application Process configuration, containing all the application process, service type and message type
 	 * definitions.
 	 */
-	ForwardControlConfiguration::ApplicationProcess applicationProcessConfiguration;
-
-	/**
-	 * The Housekeeping Parameter Report configuration, containing all the housekeeping parameter report type
-	 * definitions and the housekeeping report structure IDs.
-	 */
-	ForwardControlConfiguration::HousekeepingParameterReport housekeepingConfiguration;
-
-	/**
-	 * The Event Report Blocking configuration, containing all the event report blocking and event definitions IDs.
-	 */
-	ForwardControlConfiguration::EventReportBlocking eventReportBlockingConfiguration;
+	ApplicationProcessConfiguration applicationProcessConfiguration;
 
 private:
 	/**
@@ -74,7 +53,7 @@ private:
 	/**
 	 * Adds all report types of the specified service type, to the application process configuration.
 	 */
-	 void addAllReportsOfService(uint8_t applicationID, uint8_t serviceType);
+	void addAllReportsOfService(uint8_t applicationID, uint8_t serviceType);
 
 	/**
 	 * Counts the number of service types, stored for the specified application process.
@@ -150,65 +129,6 @@ public:
 	 */
 	void addReportTypesToAppProcessConfiguration(Message& request);
 
-	/**
-	 * TC[14,2] 'Delete report types from the application process forward control configuration'.
-	 */
-	void deleteReportTypesFromAppProcessConfiguration(Message& request);
-
-	/**
-	 * Receives a TC[14,3] 'Report the application process forward control configuration content' message and
-	 * performs the necessary error checking.
-	 */
-	void reportAppProcessConfigurationContent(Message& request);
-
-	/**
-	 * Creates and stores a TM[14,4] 'Application process forward control configuration content report' message.
-	 */
-	void appProcessConfigurationContentReport();
-
-	/**
-	 * TC[14,5] 'Add structure identifiers to the housekeeping parameter report forward control configuration'.
-	 */
-	void addStructuresToHousekeepingConfiguration(Message& request);
-
-	/**
-	 * TC[14,6] 'Delete structure identifiers from the housekeeping parameter report forward control configuration'.
-	 */
-	void deleteStructuresFromHousekeepingConfiguration(Message& request);
-
-	/**
-	 * Receives a TC[14,7] 'Report the housekeeping parameter report forward control configuration content' message and
-	 * performs the necessary error checking.
-	 */
-	void reportHousekeepingConfigurationContent(Message& request);
-
-	/**
-	 * Creates and stores a TM[14,8] 'Housekeeping parameter report forward control configuration content report'
-	 * message.
-	 */
-	void housekeepingConfigurationContentReport();
-
-	/**
-	 * TC[14,13] 'Delete event definition identifiers from the event report blocking forward control configuration'.
-	 */
-	void deleteEventDefinitionsFromEventReportConfiguration(Message& request);
-
-	/**
-	 * TC[14,14] 'Add event definition identifiers to the event report blocking forward control configuration'.
-	 */
-	void addEventDefinitionsToEventReportConfiguration(Message& request);
-
-	/**
-	 * Receives a TC[14,15] 'Report the event report blocking forward control configuration content' message and
-	 * performs the necessary error checking.
-	 */
-	void reportEventReportConfigurationContent(Message& request);
-
-	/**
-	 * Creates and stores a TM[14,16] 'Event report blocking forward control configuration content report' message.
-	 */
-	void eventReportConfigurationContentReport();
-
 	/**
 	 * It is responsible to call the suitable function that executes a TC packet. The source of that packet
 	 * is the ground station.
diff --git a/src/Services/RealTimeForwardingControlService.cpp b/src/Services/RealTimeForwardingControlService.cpp
index 55c1971e..1d67a2f5 100644
--- a/src/Services/RealTimeForwardingControlService.cpp
+++ b/src/Services/RealTimeForwardingControlService.cpp
@@ -119,15 +119,12 @@ bool RealTimeForwardingControlService::reportExistsInAppProcessConfiguration(uin
 void RealTimeForwardingControlService::addReportTypesToAppProcessConfiguration(Message& request) {
 	request.assertTC(ServiceType, MessageType::AddReportTypesToAppProcessConfiguration);
 	uint8_t numOfApplications = request.readUint8();
-	//	std::cout << static_cast<int>(numOfApplications) << "\n";
 
 	for (uint8_t i = 0; i < numOfApplications; i++) {
 		uint8_t applicationID = request.readUint8();
 		uint8_t numOfServices = request.readUint8();
-		//		std::cout << "app= " << static_cast<int>(applicationID) << "\n";
 
 		if (not checkApplicationOfAppProcessConfig(request, applicationID, numOfServices)) {
-			//			std::cout << "err1\n";
 			continue;
 		}
 
@@ -140,11 +137,8 @@ void RealTimeForwardingControlService::addReportTypesToAppProcessConfiguration(M
 			// todo: check if service type is valid.
 			uint8_t serviceType = request.readUint8();
 			uint8_t numOfMessages = request.readUint8();
-			//			std::cout << "serv= " << static_cast<int>(serviceType) << "\n";
-			//			std::cout << "size= " << static_cast<int>(countServicesOfApplication(applicationID)) << "\n";
 
 			if (not checkService(request, applicationID, serviceType, numOfMessages)) {
-				//				std::cout << "err2\n";
 				continue;
 			}
 
@@ -155,10 +149,8 @@ void RealTimeForwardingControlService::addReportTypesToAppProcessConfiguration(M
 
 			for (uint8_t k = 0; k < numOfMessages; k++) {
 				uint8_t messageType = request.readUint8();
-				//				std::cout << "mess= " << static_cast<int>(messageType) << "\n";
 
 				if (not checkMessage(request, applicationID, serviceType, messageType)) {
-					//					std::cout << "err3\n";
 					continue;
 				}
 				// todo: check if message type is valid.
@@ -174,29 +166,5 @@ void RealTimeForwardingControlService::execute(Message& message) {
 		case AddReportTypesToAppProcessConfiguration:
 			addReportTypesToAppProcessConfiguration(message);
 			break;
-			//		case DeleteReportTypesFromAppProcessConfiguration:
-			//			deleteReportTypesFromAppProcessConfiguration(message);
-			//			break;
-			//		case ReportAppProcessConfigurationContent:
-			//			reportAppProcessConfigurationContent(message);
-			//			break;
-			//		case AddStructuresToHousekeepingConfiguration:
-			//			addStructuresToHousekeepingConfiguration(message);
-			//			break;
-			//		case DeleteStructuresFromHousekeepingConfiguration:
-			//			deleteStructuresFromHousekeepingConfiguration(message);
-			//			break;
-			//		case ReportHousekeepingConfigurationContent:
-			//			reportHousekeepingConfigurationContent(message);
-			//			break;
-			//		case AddEventDefinitionsToEventReportConfiguration:
-			//			addEventDefinitionsToEventReportConfiguration(message);
-			//			break;
-			//		case DeleteEventDefinitionsFromEventReportConfiguration:
-			//			deleteEventDefinitionsFromEventReportConfiguration(message);
-			//			break;
-			//		case ReportEventReportConfigurationContent:
-			//			reportEventReportConfigurationContent(message);
-			//			break;
 	}
 }
diff --git a/test/Services/RealTimeForwardingControl.cpp b/test/Services/RealTimeForwardingControl.cpp
index 35e25859..194fd9ca 100644
--- a/test/Services/RealTimeForwardingControl.cpp
+++ b/test/Services/RealTimeForwardingControl.cpp
@@ -235,7 +235,6 @@ TEST_CASE("Add report types to the Application Process Configuration") {
 		CHECK(ServiceTests::count() == 1);
 		CHECK(ServiceTests::countThrownErrors(ErrorHandler::ExecutionStartErrorType::NotControlledApplication) == 1);
 		REQUIRE(realTimeForwarding.applicationProcessConfiguration.definitions.empty());
-		REQUIRE(realTimeForwarding.applicationProcessConfiguration.notEmpty[applicationID].empty());
 
 		resetAppProcessConfiguration();
 		ServiceTests::reset();
-- 
GitLab