diff --git a/inc/Services/Parameter.hpp b/inc/Services/Parameter.hpp index 9cf9a01583ad83c23816fb5785c7a58eece8dfc6..25922c9a8f41c2c02a179ae3154f18bdd671ce54 100644 --- a/inc/Services/Parameter.hpp +++ b/inc/Services/Parameter.hpp @@ -6,7 +6,7 @@ // Number of binary flags in every parameter. Final number TBD. #define NUM_OF_FLAGS 3 -// Maximum etl::string length in bytes +// Maximum etl::string output length in bytes #define MAX_STRING_LENGTH 5 /** * Implementation of a Parameter field, as specified in ECSS-E-ST-70-41C. @@ -20,13 +20,9 @@ * Useful type definitions * * @typedef ParamId: the unique ID of a parameter, used for searching - * @typedef ValueType: the type of the parameter's value (changing types is WIP) - * @typedef UpdatePtr: pointer to a void function, with a single ValueType* argument (return address) * @typedef Flags: container for the binary flags */ typedef uint16_t ParamId; -//typedef uint32_t ValueType; -//#typedef ; typedef etl::bitset<NUM_OF_FLAGS> Flags; /** @@ -53,6 +49,8 @@ typedef etl::bitset<NUM_OF_FLAGS> Flags; * as its update function pointer. Arguments initialValue and newPtr are optional, and have default values of * 0 and nullptr respectively. * + * @todo Update documentation + * * @public setCurrentValue(): Changes the current value of the parameter * @public getCurrentValue(): Gets the current value of the parameter * @public getPTC(), getPFC(): Returns the PFC and PTC of the parameter @@ -86,7 +84,6 @@ public: template <typename ValueType> class Parameter : public ParameterBase { void (* ptr)(ValueType*); - ValueType currentValue; public: diff --git a/src/Services/Parameter.cpp b/src/Services/Parameter.cpp index f1410d910314931e536b24b49945d3cf9dc2c9fe..ab1fa516d6e2744268a11b3008d96ecf2a5b19dc 100644 --- a/src/Services/Parameter.cpp +++ b/src/Services/Parameter.cpp @@ -10,4 +10,4 @@ uint8_t ParameterBase::getPFC() { void ParameterBase::setFlags(const char* flags) { this->flags = Flags(flags); -} \ No newline at end of file +} diff --git a/test/Services/ParameterService.cpp b/test/Services/ParameterService.cpp index 86987f9e08d469473bfd2bb9dae342bd64873aaf..eb4dd86b3c8eab81d5579b6ac75989950a21aeac 100644 --- a/test/Services/ParameterService.cpp +++ b/test/Services/ParameterService.cpp @@ -93,7 +93,10 @@ TEST_CASE("Parameter Report Subservice") { CHECK(report.readUint16() == 1); // only one parameter shall be contained CHECK(report.readUint16() == 1); // check for parameter ID - CHECK(report.readUint32() == 12); // check for value (defined when adding parameters) + uint8_t data[MAX_STRING_LENGTH]; + report.readString(data, MAX_STRING_LENGTH); + String<MAX_STRING_LENGTH> str = String<MAX_STRING_LENGTH>(data); + CHECK(str.compare("12")); // check for value as string (defined when adding parameters) ServiceTests::reset(); // clear all errors Services.reset(); // reset the services @@ -143,7 +146,11 @@ TEST_CASE("Parameter Setting Subservice") { CHECK(report.messageType == 2); CHECK(report.readUint16() == 1); // only 1 ID contained CHECK(report.readUint16() == 1); // contained ID should be ID 1 - CHECK(report.readUint32() == 3735928559); // whose value is 0xDEADBEEF + + char data[MAX_STRING_LENGTH]; + report.readString(data, MAX_STRING_LENGTH); + String<MAX_STRING_LENGTH> str = String<MAX_STRING_LENGTH>(data); + CHECK(str.compare("3735928559")); // whose value is the string 0xDEADBEEF ServiceTests::reset(); Services.reset();