From 3947da329ed0b78cccbc6ebfc98f7b51d08ec838 Mon Sep 17 00:00:00 2001
From: Grigoris Pavlakis <grigpavl@ece.auth.gr>
Date: Fri, 13 Mar 2020 23:58:07 +0200
Subject: [PATCH] Remove all code and documentation references to flags

---
 inc/ECSS_Definitions.hpp           |  5 -----
 inc/Services/Parameter.hpp         | 18 +-----------------
 inc/Services/ParameterService.hpp  |  3 +--
 src/Services/Parameter.cpp         |  4 ----
 src/Services/ParameterService.cpp  |  3 +--
 test/Services/ParameterService.cpp |  2 +-
 6 files changed, 4 insertions(+), 31 deletions(-)

diff --git a/inc/ECSS_Definitions.hpp b/inc/ECSS_Definitions.hpp
index 882052bc..8c3df99f 100644
--- a/inc/ECSS_Definitions.hpp
+++ b/inc/ECSS_Definitions.hpp
@@ -146,11 +146,6 @@
  */
 #define ECSS_ST_20_MAX_PARAMETERS 5
 
-/**
- * @brief (TEMPORARY) Length of the flags bitset for each \ref Parameter of ST[20]
- */
-#define ECSS_ST_20_NUMBER_OF_FLAGS 3
-
 /**
  * @brief Maximum etl::string output length in bytes for each \ref Parameter of ST[20]
  */
diff --git a/inc/Services/Parameter.hpp b/inc/Services/Parameter.hpp
index 83d37177..6505500b 100644
--- a/inc/Services/Parameter.hpp
+++ b/inc/Services/Parameter.hpp
@@ -1,7 +1,6 @@
 #ifndef ECSS_SERVICES_PARAMETER_HPP
 #define ECSS_SERVICES_PARAMETER_HPP
 
-#include "etl/bitset.h"
 #include "etl/String.hpp"
 #include "ECSS_Definitions.hpp"
 
@@ -17,10 +16,8 @@
  * Useful type definitions
  *
  * @typedef ParamId: the unique ID of a parameter, used for searching
- * @typedef Flags: container for the binary flags
  */
 typedef uint16_t ParamId;
-typedef etl::bitset<ECSS_ST_20_NUMBER_OF_FLAGS> Flags;
 
 /**
  * Parameter class - Breakdown of fields
@@ -30,13 +27,6 @@ typedef etl::bitset<ECSS_ST_20_NUMBER_OF_FLAGS> Flags;
  *
  * @todo: Find a way to store arbitrary types in currentValue
  *
- * Additional features (not included in standard):
- * @private flags: Various binary flags (number and meaning TBD).
- * @warning Current flag meanings (starting from LSB, big-endian):
- * Index 0: update with priority
- * Index 1: manual update available
- * Index 2: automatic update available
- *
  *
  * Methods:
  * @public Parameter(uint32_t initialValue = 0, UpdatePtr newPtr = nullptr):
@@ -52,18 +42,14 @@ class ParameterBase {
 protected:
 	uint8_t sizeInBytes;
 	void* valuePtr;
-	Flags flags;
 public:
-	void setFlags(const char* flags);
 
 	virtual String<ECSS_ST_20_MAX_STRING_LENGTH> getValueAsString() = 0;
 
 	template <typename ValueType>
 	void setCurrentValue(ValueType newVal) {
 		// set the value only if the parameter can be updated manually
-		if (flags[1]) {
-			*reinterpret_cast<ValueType*>(valuePtr) = newVal;
-		}
+		*reinterpret_cast<ValueType*>(valuePtr) = newVal;
 	}
 };
 
@@ -77,8 +63,6 @@ public:
 		ptr = newPtr;
 		sizeInBytes = sizeof(initialValue);
 		valuePtr = static_cast<void*>(&currentValue);
-		// see Parameter.hpp for explanation on flags
-		// by default: no update priority, manual and automatic update available
 
 		if (ptr != nullptr) {
 			(*ptr)(&currentValue);  // call the update function for the initial value
diff --git a/inc/Services/ParameterService.hpp b/inc/Services/ParameterService.hpp
index 1dd0b356..e2f4be64 100644
--- a/inc/Services/ParameterService.hpp
+++ b/inc/Services/ParameterService.hpp
@@ -41,9 +41,8 @@ public:
 	 * exists already.
 	 * @param id: the desired ID for this parameter
 	 * @param param: the parameter field to be included
-	 * @param flags: the flags to be set for this field (see Parameter.hpp)
 	 */
-	void addNewParameter(uint16_t id, ParameterBase* param, const char* flags = "110");
+	void addNewParameter(uint16_t id, ParameterBase* param);
 
 	/**
 	 * This function receives a TC[20, 1] packet and returns a TM[20, 2] packet
diff --git a/src/Services/Parameter.cpp b/src/Services/Parameter.cpp
index b1b57eba..526f4d6e 100644
--- a/src/Services/Parameter.cpp
+++ b/src/Services/Parameter.cpp
@@ -1,5 +1 @@
 #include "Services/Parameter.hpp"
-
-void ParameterBase::setFlags(const char* flags) {
-	this->flags = Flags(flags);
-}
diff --git a/src/Services/ParameterService.cpp b/src/Services/ParameterService.cpp
index 58635406..a20b5b80 100644
--- a/src/Services/ParameterService.cpp
+++ b/src/Services/ParameterService.cpp
@@ -10,13 +10,12 @@ ParameterService::ParameterService() {
 //	addNewParameter(3, 14);
 }
 
-void ParameterService::addNewParameter(uint16_t id, ParameterBase* param, const char* flags) {
+void ParameterService::addNewParameter(uint16_t id, ParameterBase* param) {
 	if (paramsList.full()) {
 		ErrorHandler::reportInternalError(ErrorHandler::InternalErrorType::MapFull);
 	}
 	else {
 		if (paramsList.find(id) == paramsList.end()) {
-			param->setFlags(flags);
 			paramsList.insert(std::make_pair(id, param));
 		}
 		else {
diff --git a/test/Services/ParameterService.cpp b/test/Services/ParameterService.cpp
index 56630a5a..16b3ae32 100644
--- a/test/Services/ParameterService.cpp
+++ b/test/Services/ParameterService.cpp
@@ -158,7 +158,7 @@ TEST_CASE("Parameter Setting Subservice") {
 
 	SECTION("Attempt to set parameter with no manual update availability") {
 		Parameter<int> param1 = Parameter<int>(12);
-		pserv.addNewParameter(1, static_cast<ParameterBase*>(&param1), "100");
+		pserv.addNewParameter(1, static_cast<ParameterBase*>(&param1));
 
 		Message setRequest = Message(20, 3, Message::TC, 1);
 		setRequest.appendUint16(1);
-- 
GitLab