From 1dfbfbc3e952b8c8a737743795c80df93f230ca0 Mon Sep 17 00:00:00 2001
From: Grigoris Pavlakis <grigpavl@ece.auth.gr>
Date: Sun, 25 Nov 2018 01:27:37 +0200
Subject: [PATCH] Change reportParameterIds so it uses storeMessage instead of
 returning. Breaks tests though, need to update them

---
 inc/Services/ParameterService.hpp | 2 +-
 src/Services/ParameterService.cpp | 4 ++--
 src/main.cpp                      | 5 +++--
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/inc/Services/ParameterService.hpp b/inc/Services/ParameterService.hpp
index 43987f7c..c0a16ba7 100644
--- a/inc/Services/ParameterService.hpp
+++ b/inc/Services/ParameterService.hpp
@@ -47,7 +47,7 @@ private:
 public:
 	ParameterService();
 
-	Message reportParameterIds(Message paramIds);
+	void reportParameterIds(Message paramIds);
 
 	void setParameterIds(Message newParamValues);
 
diff --git a/src/Services/ParameterService.cpp b/src/Services/ParameterService.cpp
index 3329d685..0d98eb00 100644
--- a/src/Services/ParameterService.cpp
+++ b/src/Services/ParameterService.cpp
@@ -32,7 +32,7 @@ ParameterService::ParameterService() {
 #endif
 }
 
-Message ParameterService::reportParameterIds(Message paramIds) {
+void ParameterService::reportParameterIds(Message paramIds) {
 
 	/**
 	 * This function receives a TC[20, 1] packet and returns a TM[20, 2] packet
@@ -79,7 +79,7 @@ Message ParameterService::reportParameterIds(Message paramIds) {
 		}
 	}
 
-	return reqParam;
+	storeMessage(reqParam);
 }
 
 void ParameterService::setParameterIds(Message newParamValues) {
diff --git a/src/main.cpp b/src/main.cpp
index 0cfdc6a1..62eb4031 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -30,7 +30,7 @@ int main() {
 	receivedPacket.appendUint16(7);
 	testService.onBoardConnection(receivedPacket);
 
-	/*
+
 	//ST[20] test
 	ParameterService paramService;
 
@@ -39,8 +39,9 @@ int main() {
 	sentPacket.appendUint16(2);  //number of contained IDs
 	sentPacket.appendUint16(0);  //first ID
 	sentPacket.appendUint16(1);  //second ID
-	Message returnedPacket = paramService.reportParameterIds(sentPacket);
+	paramService.reportParameterIds(sentPacket);
 
+	/*
 	uint16_t numOfIds = returnedPacket.readUint16();
 
 	std::cout << std::endl << "Number of contained configs: " << numOfIds << std::endl;
-- 
GitLab