From bd8b1a3e4c255d76c660e8f98b6bd202bc60f184 Mon Sep 17 00:00:00 2001
From: Dimitrios Stoupis <dimitris.apple@gmail.com>
Date: Sun, 17 Mar 2019 21:11:03 +0000
Subject: [PATCH] Renamed and added some definitions

---
 inc/ECSS_Definitions.hpp                    | 11 +++++++++++
 inc/MessageParser.hpp                       |  4 ++--
 inc/Services/EventActionService.hpp         |  1 -
 inc/Services/TimeBasedSchedulingService.hpp | 10 +++-------
 src/MessageParser.cpp                       | 14 +++++++-------
 src/Services/EventActionService.cpp         |  6 +++---
 6 files changed, 26 insertions(+), 20 deletions(-)

diff --git a/inc/ECSS_Definitions.hpp b/inc/ECSS_Definitions.hpp
index 3a2eeedb..98c2a1ff 100644
--- a/inc/ECSS_Definitions.hpp
+++ b/inc/ECSS_Definitions.hpp
@@ -15,4 +15,15 @@
 // 9.3.1a.1.e
 #define ECSS_SEQUENCE_FLAGS 0x3
 
+#define ECSS_MAX_REQUEST_COUNT 20 // todo: Needs to be defined
+
+#define ECSS_TC_REQUEST_STRING_SIZE 64
+
+#define ECSS_MAX_NUMBER_OF_TIME_SCHED_ACTIVITIES    10 // todo: Define the maximum number of activities
+
+#define ECSS_TIME_MARGIN_FOR_ACTIVATION  60 // todo: Define the time margin for the command activation
+
+#define ECSS_MAX_DELTA_OF_RELEASE_TIME   60 // todo: Define the maximum delta between the specified
+// release time and the actual release time
+
 #endif //ECSS_SERVICES_ECSS_DEFINITIONS_H
diff --git a/inc/MessageParser.hpp b/inc/MessageParser.hpp
index b064ae2d..678c1eec 100644
--- a/inc/MessageParser.hpp
+++ b/inc/MessageParser.hpp
@@ -48,11 +48,11 @@ public:
 	 * this great analysis:
 	 * stackoverflow.com/questions/15078638/can-i-turn-unsigned-char-into-char-and-vice-versa
 	 */
-	Message parseRequestTC(String<ECSS_EVENT_SERVICE_STRING_SIZE> data);
+	Message parseRequestTC(String<ECSS_TC_REQUEST_STRING_SIZE> data);
 
 	Message parseRequestTC(uint8_t* data);
 
-	String<ECSS_EVENT_SERVICE_STRING_SIZE> convertTCToStr(Message& message);
+	String<ECSS_TC_REQUEST_STRING_SIZE> convertTCToStr(Message& message);
 
 private:
 	/**
diff --git a/inc/Services/EventActionService.hpp b/inc/Services/EventActionService.hpp
index 338a6734..3b561617 100644
--- a/inc/Services/EventActionService.hpp
+++ b/inc/Services/EventActionService.hpp
@@ -1,7 +1,6 @@
 #ifndef ECSS_SERVICES_EVENTACTIONSERVICE_HPP
 #define ECSS_SERVICES_EVENTACTIONSERVICE_HPP
 
-#define ECSS_EVENT_SERVICE_STRING_SIZE 64
 
 #define ECSS_EVENT_ACTION_STRUCT_ARRAY_SIZE 256
 
diff --git a/inc/Services/TimeBasedSchedulingService.hpp b/inc/Services/TimeBasedSchedulingService.hpp
index a4373c82..1aedc676 100644
--- a/inc/Services/TimeBasedSchedulingService.hpp
+++ b/inc/Services/TimeBasedSchedulingService.hpp
@@ -15,10 +15,6 @@
 #define GROUPS_ENABLED          0
 #define SUB_SCHEDULES_ENABLED   0
 
-#define MAX_NUMBER_OF_ACTIVITIES    10 // todo: Define the maximum number of activities
-#define TIME_MARGIN_FOR_ACTIVATION  60 // todo: Define the time margin for the command activation
-#define MAX_DELTA_OF_RELEASE_TIME   60 // todo: Define the maximum delta between the specified
-// release time and the actual release time
 
 namespace unit_test {
 	struct Tester;
@@ -55,7 +51,7 @@ private:
 	};
 
 	// Scheduled activity definitions
-	etl::vector<ScheduledActivity, MAX_NUMBER_OF_ACTIVITIES> scheduledActivities;
+	etl::vector<ScheduledActivity, ECSS_MAX_NUMBER_OF_TIME_SCHED_ACTIVITIES> scheduledActivities;
 
 	// Enable tester access to private members
 	friend struct ::unit_test::Tester;
@@ -120,7 +116,7 @@ public:
 	 * 			TM[11,10] response
 	 * @param request Provide the received message as a parameter
 	 */
-	void detailReporActivitiesByID(Message &request);
+	void detailReportActivitiesByID(Message &request);
 
 	/**
 	 * TC[11,12] summary-report activities identified by request identifier
@@ -129,7 +125,7 @@ public:
 	 * 			TM[11,13] response
 	 * @param request Provide the received message as a parameter
 	 */
-	void summaryReporActivitiesByID(Message &request);
+	void summaryReportActivitiesByID(Message &request);
 
 	/**
 	 * TC[11,5] delete time-based scheduled activities identified by a request identifier
diff --git a/src/MessageParser.cpp b/src/MessageParser.cpp
index eb0de4ec..141fcc7e 100644
--- a/src/MessageParser.cpp
+++ b/src/MessageParser.cpp
@@ -76,29 +76,29 @@ void MessageParser::parseTC(const uint8_t *data, uint16_t length, Message &messa
 	message.dataSize = length;
 }
 
-Message MessageParser::parseRequestTC(String<ECSS_EVENT_SERVICE_STRING_SIZE> data) {
+Message MessageParser::parseRequestTC(String<ECSS_TC_REQUEST_STRING_SIZE> data) {
 	Message message;
 	auto *dataInt = reinterpret_cast<uint8_t *>(data.data());
 	message.packetType = Message::TC;
-	parseTC(dataInt, ECSS_EVENT_SERVICE_STRING_SIZE, message);
+	parseTC(dataInt, ECSS_TC_REQUEST_STRING_SIZE, message);
 	return message;
 }
 
 Message MessageParser::parseRequestTC(uint8_t* data) {
 	Message message;
 	message.packetType = Message::TC;
-	parseTC(data, ECSS_EVENT_SERVICE_STRING_SIZE, message);
+	parseTC(data, ECSS_TC_REQUEST_STRING_SIZE, message);
 	return message;
 }
 
-String<ECSS_EVENT_SERVICE_STRING_SIZE> MessageParser::convertTCToStr(Message &message) {
-	uint8_t tempString[ECSS_EVENT_SERVICE_STRING_SIZE] = {0};
+String<ECSS_TC_REQUEST_STRING_SIZE> MessageParser::convertTCToStr(Message &message) {
+	uint8_t tempString[ECSS_TC_REQUEST_STRING_SIZE] = {0};
 
 	tempString[0] = ECSS_PUS_VERSION << 4; // Assign the pusVersion = 2
 	tempString[1] = message.serviceType;
 	tempString[2] = message.messageType;
-	memcpy(tempString + 5, message.data, ECSS_EVENT_SERVICE_STRING_SIZE - 5);
-	String<ECSS_EVENT_SERVICE_STRING_SIZE> dataString(tempString);
+	memcpy(tempString + 5, message.data, ECSS_TC_REQUEST_STRING_SIZE - 5);
+	String<ECSS_TC_REQUEST_STRING_SIZE> dataString(tempString);
 
 	return dataString;
 }
diff --git a/src/Services/EventActionService.cpp b/src/Services/EventActionService.cpp
index 3340fed7..5b81540a 100644
--- a/src/Services/EventActionService.cpp
+++ b/src/Services/EventActionService.cpp
@@ -35,13 +35,13 @@ void EventActionService::addEventActionDefinitions(Message message) {
 				eventActionDefinitionArray[index].enabled = true;
 				eventActionDefinitionArray[index].applicationId = applicationID;
 				eventActionDefinitionArray[index].eventDefinitionID = eventDefinitionID;
-				if (message.dataSize - 4 > ECSS_EVENT_SERVICE_STRING_SIZE) {
+				if (message.dataSize - 4 > ECSS_TC_REQUEST_STRING_SIZE) {
 					ErrorHandler::reportInternalError(
 						ErrorHandler::InternalErrorType::MessageTooLarge);
 				} else {
-					char data[ECSS_EVENT_SERVICE_STRING_SIZE];
+					char data[ECSS_TC_REQUEST_STRING_SIZE];
 					message.readString(data, message.dataSize - 4);
-					eventActionDefinitionArray[index].request = String<ECSS_EVENT_SERVICE_STRING_SIZE>(
+					eventActionDefinitionArray[index].request = String<ECSS_TC_REQUEST_STRING_SIZE>(
 						data);
 				}
 			}
-- 
GitLab