diff --git a/inc/Services/LargePacketTransferService.hpp b/inc/Services/LargePacketTransferService.hpp index cbd74f8e52adb8512f8ac47f33a3cfca816711d6..5b3b276cde7489fd483c60d5bde53b4f620a72a0 100644 --- a/inc/Services/LargePacketTransferService.hpp +++ b/inc/Services/LargePacketTransferService.hpp @@ -51,7 +51,7 @@ public: const String<ECSS_MAX_FIXED_OCTET_STRING_SIZE>& string); // The three uplink functions should handle a TC request to "upload" data. Since there is not - // a createECSSTC function ready, I just return the given string. + // a composeECSS function ready, I just return the given string. // @TODO: Modify these functions properly /** * Function that handles the first part of the uplink request diff --git a/src/Platform/x86/main.cpp b/src/Platform/x86/main.cpp index 8d69e83aa9f9a6a933f3f486a0f854b4a9d4e40a..54a997bae9e74898afd18a1bab439a9549c82698 100644 --- a/src/Platform/x86/main.cpp +++ b/src/Platform/x86/main.cpp @@ -301,7 +301,6 @@ int main() { // ST[11] test TimeBasedSchedulingService timeBasedSchedulingService; - MessageParser msgParser; auto currentTime = static_cast<uint32_t>(time(nullptr)); // Get the current system time std::cout << "\n\nST[11] service is running"; std::cout << "\nCurrent time in seconds (UNIX epoch): " << currentTime << std::endl; @@ -319,10 +318,10 @@ int main() { receivedMsg.appendUint16(2); // Total number of requests receivedMsg.appendUint32(currentTime + 1556435U); - receivedMsg.appendString(msgParser.createECSSTC(testMessage1)); + receivedMsg.appendString(MessageParser::composeECSS(testMessage1)); receivedMsg.appendUint32(currentTime + 1957232U); - receivedMsg.appendString(msgParser.createECSSTC(testMessage2)); + receivedMsg.appendString(MessageParser::composeECSS(testMessage2)); timeBasedSchedulingService.insertActivities(receivedMsg); // Time shift activities diff --git a/src/Services/TimeBasedSchedulingService.cpp b/src/Services/TimeBasedSchedulingService.cpp index ddd7e8ef1d3040c3aa7c1d254765ecc00e229219..d917585ec826b9919398b461980ce03645788b4b 100644 --- a/src/Services/TimeBasedSchedulingService.cpp +++ b/src/Services/TimeBasedSchedulingService.cpp @@ -168,7 +168,7 @@ void TimeBasedSchedulingService::detailReportAllActivities(Message& request) { // todo: append sub-schedule and group ID if they are defined report.appendUint32(activity.requestReleaseTime); - report.appendString(msgParser.createECSSTC(activity.request)); + report.appendString(msgParser.composeECSS(activity.request)); } storeMessage(report); // Save the report } @@ -209,7 +209,7 @@ void TimeBasedSchedulingService::detailReportActivitiesByID(Message& request) { report.appendUint16(static_cast<uint16_t>(matchedActivities.size())); for (auto& match : matchedActivities) { report.appendUint32(match.requestReleaseTime); // todo: Replace with the time parser - report.appendString(msgParser.createECSSTC(match.request)); + report.appendString(msgParser.composeECSS(match.request)); } storeMessage(report); // Save the report } diff --git a/test/MessageParser.cpp b/test/MessageParser.cpp index d11d42ab54e4bfd796f1d726855bda45489458aa..10bd4f5f2ca3e6d2e78a63efe6fd20bc091bf762 100644 --- a/test/MessageParser.cpp +++ b/test/MessageParser.cpp @@ -21,7 +21,7 @@ TEST_CASE("TC message parsing", "[MessageParser]") { CHECK(memcmp(message.data, "hello", 5) == 0); } -TEST_CASE("TC data parsing into a message", "[MessageParser]") {} +TEST_CASE("TC string parsing into a message", "[MessageParser]") {} TEST_CASE("TM message parsing", "[MessageParser]") { MessageParser messageParser; diff --git a/test/Services/TimeBasedSchedulingService.cpp b/test/Services/TimeBasedSchedulingService.cpp index 5b72b171683d18c4f6eb992141f063dcccd7c2ae..e74ff765734bd695d8c0a8930f36158d5e2d4b20 100644 --- a/test/Services/TimeBasedSchedulingService.cpp +++ b/test/Services/TimeBasedSchedulingService.cpp @@ -33,7 +33,6 @@ namespace unit_test } // namespace unit_test Message testMessage1, testMessage2, testMessage3, testMessage4; -MessageParser msgParser; auto currentTime = static_cast<uint32_t>(time(nullptr)); // Get the current system time bool messagesPopulated = false; // Indicate whether the test messages are initialized @@ -71,19 +70,19 @@ auto activityInsertion(TimeBasedSchedulingService& timeService) { // Test activity 1 receivedMessage.appendUint32(currentTime + 1556435); - receivedMessage.appendString(msgParser.createECSSTC(testMessage1)); + receivedMessage.appendMessage(testMessage1, ECSS_TC_REQUEST_STRING_SIZE); // Test activity 2 receivedMessage.appendUint32(currentTime + 1957232); - receivedMessage.appendString(msgParser.createECSSTC(testMessage2)); + receivedMessage.appendMessage(testMessage2, ECSS_TC_REQUEST_STRING_SIZE); // Test activity 3 receivedMessage.appendUint32(currentTime + 1726435); - receivedMessage.appendString(msgParser.createECSSTC(testMessage3)); + receivedMessage.appendMessage(testMessage3, ECSS_TC_REQUEST_STRING_SIZE); // Test activity 4 receivedMessage.appendUint32(currentTime + 17248435); - receivedMessage.appendString(msgParser.createECSSTC(testMessage4)); + receivedMessage.appendMessage(testMessage4, ECSS_TC_REQUEST_STRING_SIZE); // Insert activities in the schedule. They have to be inserted sorted timeService.insertActivities(receivedMessage); @@ -276,7 +275,7 @@ TEST_CASE("TC[11,9] Detail report scheduled activities by ID", "[service][st11]" Message receivedTCPacket; uint8_t receivedDataStr[ECSS_TC_REQUEST_STRING_SIZE]; response.readString(receivedDataStr, ECSS_TC_REQUEST_STRING_SIZE); - receivedTCPacket = msgParser.parseECSSTC(receivedDataStr); + receivedTCPacket = MessageParser::parseECSSTC(receivedDataStr); if (i == 0) { REQUIRE(receivedReleaseTime == scheduledActivities.at(0)->requestReleaseTime); @@ -380,7 +379,7 @@ TEST_CASE("TC[11,16] Detail report all scheduled activities", "[service][st11]") Message receivedTCPacket; uint8_t receivedDataStr[ECSS_TC_REQUEST_STRING_SIZE]; response.readString(receivedDataStr, ECSS_TC_REQUEST_STRING_SIZE); - receivedTCPacket = msgParser.parseECSSTC(receivedDataStr); + receivedTCPacket = MessageParser::parseECSSTC(receivedDataStr); REQUIRE(receivedReleaseTime == scheduledActivities.at(i)->requestReleaseTime); REQUIRE(receivedTCPacket.bytesEqualWith(scheduledActivities.at(i)->request));