diff --git a/inc/Services/ParameterService.hpp b/inc/Services/ParameterService.hpp index 3365dc824524a1a6467d485f386c29f94e105e82..c331ae2743d7ffbd4e137d043889515f491d0372 100644 --- a/inc/Services/ParameterService.hpp +++ b/inc/Services/ParameterService.hpp @@ -35,7 +35,6 @@ struct Parameter { * for parameter reporting and modification. * * @todo Ensure that the parameter list is sorted by ID - * @todo Convert reportParameterIds() to void when storeMessage() stores and doesn't print */ class ParameterService : public Service { @@ -56,11 +55,11 @@ public: * **for the parameters specified in the carried valid IDs**. * * No sophisticated error checking for now, just whether the package is of the correct type - * and whether the requested IDs are valid, ignoring the invalid ones. + * and whether the requested IDs are valid, ignoring the invalid ones. If no IDs are correct, + * the returned message shall be empty. * * @param paramId: a valid TC[20, 1] packet carrying the requested parameter IDs - * @return A TM[20, 2] packet containing the valid parameter IDs and their settings. - * @return Empty TM[20, 2] packet on wrong type. + * @return None (messages are stored using storeMessage()) * * @todo Generate failure notifs where needed when ST[01] is ready * @@ -70,7 +69,7 @@ public: * * Everything apart from the setting data is uint16 (setting data are uint32 for now) */ - Message reportParameterIds(Message paramIds); + void reportParameterIds(Message paramIds); /** * This function receives a TC[20, 3] message and after checking whether its type is correct, diff --git a/src/Services/ParameterService.cpp b/src/Services/ParameterService.cpp index 8deebbc4807e0f8c341489c1137b86625cb7f60f..bf19881992e6265b8254ae0c09bc118a665a780f 100644 --- a/src/Services/ParameterService.cpp +++ b/src/Services/ParameterService.cpp @@ -28,7 +28,7 @@ ParameterService::ParameterService() { #endif } -Message ParameterService::reportParameterIds(Message paramIds) { +void ParameterService::reportParameterIds(Message paramIds) { Message reqParam(20, 2, Message::TM, 1); // empty TM[20, 2] parameter report message if (paramIds.packetType == Message::TC && paramIds.serviceType == 20 && @@ -50,7 +50,6 @@ Message ParameterService::reportParameterIds(Message paramIds) { } storeMessage(reqParam); - return reqParam; // this has to stay for now because no other way for testing } void ParameterService::setParameterIds(Message newParamValues) { diff --git a/test/Services/ParameterService.cpp b/test/Services/ParameterService.cpp index 43038dbe2730585baca1c536541302a1472b69b2..30c18adc5d315711a6d7956a94703a90ac65ad9e 100644 --- a/test/Services/ParameterService.cpp +++ b/test/Services/ParameterService.cpp @@ -1,6 +1,7 @@ #include "catch2/catch.hpp" #include "Services/ParameterService.hpp" #include "Message.hpp" +#include "ServiceTests.hpp" #define CATCH_CONFIG_MAIN @@ -19,7 +20,8 @@ TEST_CASE("Parameter Report Subservice") { request.appendUint16(34672); // faulty ID in this context request.appendUint16(3); // valid - report = pserv.reportParameterIds(request); + pserv.reportParameterIds(request); + report = ServiceTests::get(0); request.resetRead(); uint16_t repIdCount = report.readUint16(); @@ -33,7 +35,9 @@ TEST_CASE("Parameter Report Subservice") { SECTION("Wrong Message Type Handling Test") { Message falseRequest(15, 3, Message::TM, 1); //a totally wrong message - Message response = pserv.reportParameterIds(falseRequest); + + pserv.reportParameterIds(falseRequest); + Message response = ServiceTests::get(0); CHECK(response.messageType == 2); CHECK(response.serviceType == 20); CHECK(response.packetType == Message::TM);