From a047f3f3ece2e5ec9ea27b211b0dbc2774db40ee Mon Sep 17 00:00:00 2001 From: Grigoris Pavlakis <grigpavl@ece.auth.gr> Date: Mon, 12 Aug 2019 00:53:56 +0300 Subject: [PATCH] Add getters for PTC and PFC sub-fields --- inc/Services/Parameter.hpp | 1 + src/Services/Parameter.cpp | 11 ++++++++++- src/Services/ParameterService.cpp | 29 ++--------------------------- 3 files changed, 13 insertions(+), 28 deletions(-) diff --git a/inc/Services/Parameter.hpp b/inc/Services/Parameter.hpp index 99bb6f15..6301f3ae 100644 --- a/inc/Services/Parameter.hpp +++ b/inc/Services/Parameter.hpp @@ -67,6 +67,7 @@ class Parameter { ValueType getCurrentValue(); uint8_t getPTC(); + uint8_t getPFC(); }; diff --git a/src/Services/Parameter.cpp b/src/Services/Parameter.cpp index 4c15b2f7..e50d3fd8 100644 --- a/src/Services/Parameter.cpp +++ b/src/Services/Parameter.cpp @@ -24,4 +24,13 @@ void Parameter::setCurrentValue(ValueType newVal) { ValueType Parameter::getCurrentValue() { return currentValue; -} \ No newline at end of file +} + +uint8_t Parameter::getPTC() { + return ptc; +} + +uint8_t Parameter::getPFC() { + return pfc; +} + diff --git a/src/Services/ParameterService.cpp b/src/Services/ParameterService.cpp index 762af1bb..86dbbcb1 100644 --- a/src/Services/ParameterService.cpp +++ b/src/Services/ParameterService.cpp @@ -1,35 +1,10 @@ #include "Services/ParameterService.hpp" #include "Services/Parameter.hpp" -ParameterService::ParameterService() { +ParameterService::ParameterService() { + // test addings addNewParameter(3, 14); addNewParameter(3, 14); - -// // Test code, setting up some of the parameter fields -// -// time_t currTime = time(nullptr); -// struct tm* today = localtime(&currTime); -// -// Parameter test1, test2; -// -// test1.currentValue = today->tm_hour; // the current hour -// test1.ptc = 3; // unsigned int -// test1.pfc = 14; // 32 bits -// -// test2.currentValue = today->tm_min; // the current minute -// test2.ptc = 3; // unsigned int -// test2.pfc = 14; // 32 bits -// -// // MAKE SURE THE IDS ARE UNIQUE WHEN INSERTING! -// /** -// * @todo: Make a separate insert() function for parameter insertion to protect from blunders -// * if needed to -// */ -// -// paramsList.insert(std::make_pair(0, test1)); -// paramsList.insert(std::make_pair(1, test2)); -// -//#endif } bool ParameterService::addNewParameter(uint8_t ptc, uint8_t pfc, uint32_t initialValue, UpdatePtr ptr) { -- GitLab