From 095225e6d51c2a6b53dee4f0b9ea6d5ca0030de6 Mon Sep 17 00:00:00 2001 From: thodkatz <thodkatz@gmail.com> Date: Thu, 29 Nov 2018 21:04:55 +0200 Subject: [PATCH] Update some files --- inc/ECSS_Definitions.hpp | 3 + inc/Services/RequestVerificationService.hpp | 29 ++--- src/Services/RequestVerificationService.cpp | 66 +++++------ src/main.cpp | 34 +----- test/Services/RequestVerificationService.cpp | 110 +++++++------------ 5 files changed, 86 insertions(+), 156 deletions(-) diff --git a/inc/ECSS_Definitions.hpp b/inc/ECSS_Definitions.hpp index 1db5923d..2b5ff9fd 100644 --- a/inc/ECSS_Definitions.hpp +++ b/inc/ECSS_Definitions.hpp @@ -6,6 +6,9 @@ #define ECSS_MAX_STRING_SIZE 256 +//7.4.1 +#define ECSS_PACKET_VERSION 0 + // 7.4.4.1c #define ECSS_PUS_VERSION 2 diff --git a/inc/Services/RequestVerificationService.hpp b/inc/Services/RequestVerificationService.hpp index 695c939f..e3828ac7 100644 --- a/inc/Services/RequestVerificationService.hpp +++ b/inc/Services/RequestVerificationService.hpp @@ -24,11 +24,9 @@ public: * TM[1,1] successful acceptance verification report * * Take a Message& reference as argument, that contains the necessary data to send the report. - * The data field(data[]) of this contains the basic info of the telecommand packet that - * accepted successfully and the format is defined from the standard + * The data is actually some class variables of Message that contain the basic info of the + * telecommand packet that accepted successfully and the format is defined from the standard * - * @todo The values of the data types that the data field(data[]) is consisted have - * determined limits so when the assign will happen should be treated with attention */ void successAcceptanceVerification(Message &request); @@ -36,11 +34,9 @@ public: * TM[1,2] failed acceptance verification report * * Take a Message& reference as argument, that contains the necessary data to send the report. - * The data field(data[]) of this contains the basic info of the telecommand packet that fail - * to be accepted and the format is defined from the standard + * The data is actually some class variables of Message that contain the basic info of the + * telecommand packet that fail to be accepted and the format is defined from the standard * - * @todo The values of the data types that the data field(data[]) is consisted have - * determined limits so when the declaration will happen should be treated with attention */ void failAcceptanceVerification(Message &request); @@ -49,11 +45,9 @@ public: * TM[1,7] successful completion of execution verification report * * Take a Message& reference as argument, that contains the necessary data to send the report. - * The data field(data[]) of this contains the basic info of the telecommand packet that - * executed successfully and the format is defined from the standard + * The data is actually some class variables of Message that contain the basic info of the + * telecommand packet that executed successfully and the format is defined from the standard * - * @todo The values of the data types that the data field(data[]) is consisted have - * determined limits so when the declaration will happen should be treated with attention */ void successExecutionVerification(Message &request); @@ -61,8 +55,9 @@ public: * TM[1,8] failed completion of execution verification report * * Take a Message& reference as argument, that contains the necessary data to send the report. - * The data field(data[]) of this contains the basic info of the telecommand packet that fail - * to be executed and the format is defined from the standard + * The data is actually some class variables of Message that contain the basic info of the + * telecommand packet that fail to be executed and the format is defined from the standard + * */ void failExecutionVerification(Message &request); @@ -70,11 +65,9 @@ public: * TM[1,10] failed routing verification report * * Take a Message& reference as argument, that contains the necessary data to send the report. - * The data field(data[]) of this contains the basic info of the telecommand packet that fail - * the routing and the format is defined from the standard + * The data is actually some class variables of Message that contain the basic info of the + * telecommand packet that fail the routing and the format is defined from the standard * - * @todo The values of the data types that the data field(data[]) is consisted have - * determined limits so when the declaration will happen should be treated with attention */ void failRoutingVerification(Message &request); diff --git a/src/Services/RequestVerificationService.cpp b/src/Services/RequestVerificationService.cpp index 23ff6877..28cc3404 100644 --- a/src/Services/RequestVerificationService.cpp +++ b/src/Services/RequestVerificationService.cpp @@ -6,12 +6,12 @@ void RequestVerificationService::successAcceptanceVerification(Message &request) Message report = createTM(1); - report.appendEnumerated(3, request.readEnumerated(3)); // packet version number - report.appendEnumerated(1, request.readEnumerated(1)); // packet type - report.appendBits(1, request.readBits(1)); // secondary header flag - report.appendEnumerated(11, request.readEnumerated(11)); // application process ID - report.appendEnumerated(2, request.readEnumerated(2)); // sequence flags - report.appendBits(14, request.readBits(14)); // packet sequence count + report.appendEnumerated(3, ECSS_PACKET_VERSION); // packet version number + report.appendEnumerated(1, request.packetType); // packet type + report.appendBits(1, 0); // secondary header flag(not implemented) + report.appendEnumerated(11, request.applicationId); // application process ID + report.appendEnumerated(2, 0); // sequence flags(not implemented) + report.appendBits(14, 0); // packet sequence count(not implemented) storeMessage(report); } @@ -22,13 +22,13 @@ RequestVerificationService::failAcceptanceVerification(Message &request) { Message report = createTM(2); - report.appendEnumerated(3, request.readEnumerated(3)); // packet version number - report.appendEnumerated(1, request.readEnumerated(1)); // packet type - report.appendBits(1, request.readBits(1)); // secondary header flag - report.appendEnumerated(11, request.readEnumerated(11)); // application process ID - report.appendEnumerated(2, request.readEnumerated(2)); // sequence flags - report.appendBits(14, request.readBits(14)); // packet sequence count - report.appendEnum16(request.readEnum16()); // error code + report.appendEnumerated(3, ECSS_PACKET_VERSION); // packet version number + report.appendEnumerated(1, request.packetType); // packet type + report.appendBits(1, 0); // secondary header flag(not implemented) + report.appendEnumerated(11, request.applicationId); // application process ID + report.appendEnumerated(2, 0); // sequence flags(not implemented) + report.appendBits(14, 0); // packet sequence count(not implemented) + report.appendEnum16(0); // error code(not implemented) storeMessage(report); } @@ -38,12 +38,12 @@ void RequestVerificationService::successExecutionVerification(Message &request) Message report = createTM(7); - report.appendEnumerated(3, request.readEnumerated(3)); // packet version number - report.appendEnumerated(1, request.readEnumerated(1)); // packet type - report.appendBits(1, request.readBits(1)); // secondary header flag - report.appendEnumerated(11, request.readEnumerated(11)); // application process ID - report.appendEnumerated(2, request.readEnumerated(2)); // sequence flags - report.appendBits(14, request.readBits(14)); // packet sequence count + report.appendEnumerated(3, ECSS_PACKET_VERSION); // packet version number + report.appendEnumerated(1, request.packetType); // packet type + report.appendBits(1, 0); // secondary header flag(not implemented) + report.appendEnumerated(11, request.applicationId); // application process ID + report.appendEnumerated(2, 0); // sequence flags(not implemented) + report.appendBits(14, 0); // packet sequence count(not implemented) storeMessage(report); } @@ -54,13 +54,13 @@ RequestVerificationService::failExecutionVerification(Message &request) { Message report = createTM(8); - report.appendEnumerated(3, request.readEnumerated(3)); // packet version number - report.appendEnumerated(1, request.readEnumerated(1)); // packet type - report.appendBits(1, request.readBits(1)); // secondary header flag - report.appendEnumerated(11, request.readEnumerated(11)); // application process ID - report.appendEnumerated(2, request.readEnumerated(2)); // sequence flags - report.appendBits(14, request.readBits(14)); // packet sequence count - report.appendEnum16(request.readEnum16()); // error code + report.appendEnumerated(3, ECSS_PACKET_VERSION); // packet version number + report.appendEnumerated(1, request.packetType); // packet type + report.appendBits(1, 0); // secondary header flag(not implemented) + report.appendEnumerated(11, request.applicationId); // application process ID + report.appendEnumerated(2, 0); // sequence flags(not implemented) + report.appendBits(14, 0); // packet sequence count(not implemented) + report.appendEnum16(0); // error code(not implemented) storeMessage(report); } @@ -71,13 +71,13 @@ RequestVerificationService::failRoutingVerification(Message &request) { Message report = createTM(10); - report.appendEnumerated(3, request.readEnumerated(3)); // packet version number - report.appendEnumerated(1, request.readEnumerated(1)); // packet type - report.appendBits(1, request.readBits(1)); // secondary header flag - report.appendEnumerated(11, request.readEnumerated(11)); // application process ID - report.appendEnumerated(2, request.readEnumerated(2)); // sequence flags - report.appendBits(14, request.readBits(14)); // packet sequence count - report.appendEnum16(request.readEnum16()); // error code + report.appendEnumerated(3, ECSS_PACKET_VERSION); // packet version number + report.appendEnumerated(1, request.packetType); // packet type + report.appendBits(1, 0); // secondary header flag(not implemented) + report.appendEnumerated(11, request.applicationId); // application process ID + report.appendEnumerated(2, 0); // sequence flags(not implemented) + report.appendBits(14, 0); // packet sequence count(not implemented) + report.appendEnum16(0); // error code(not implemented) storeMessage(report); } diff --git a/src/main.cpp b/src/main.cpp index 98937684..856da839 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -91,52 +91,20 @@ int main() { // ST[01] test RequestVerificationService reqVerifService; + Message receivedMessage = Message(1, 1, Message::TC, 3); - receivedMessage.appendEnumerated(3, ECSS_PUS_VERSION); // packet version number - receivedMessage.appendEnumerated(1, Message::TC); // packet type - receivedMessage.appendBits(1, static_cast<uint8_t >(true)); // secondary header flag - receivedMessage.appendEnumerated(11, 2); // application process ID(dummy value) - receivedMessage.appendEnumerated(2, 3); // sequence Flags - receivedMessage.appendBits(14, 10); // packet sequence count(dummy value) reqVerifService.successAcceptanceVerification(receivedMessage); receivedMessage = Message(1, 2, Message::TC, 3); - receivedMessage.appendEnumerated(3, ECSS_PUS_VERSION); // packet version number - receivedMessage.appendEnumerated(1, Message::TC); // packet type - receivedMessage.appendBits(1, static_cast<uint8_t >(true)); // secondary header flag - receivedMessage.appendEnumerated(11, 2); // application process ID(dummy value) - receivedMessage.appendEnumerated(2, 3); // sequence Flags - receivedMessage.appendBits(14, 10); // packet sequence count(dummy value) - receivedMessage.appendEnum16(5); // error code(dummy value) reqVerifService.failAcceptanceVerification(receivedMessage); receivedMessage = Message(1, 7, Message::TC, 3); - receivedMessage.appendEnumerated(3, ECSS_PUS_VERSION); // packet version number - receivedMessage.appendEnumerated(1, Message::TC); // packet type - receivedMessage.appendBits(1, static_cast<uint8_t >(true)); // secondary header flag - receivedMessage.appendEnumerated(11, 2); // application process ID(dummy value) - receivedMessage.appendEnumerated(2, 3); // sequence Flags - receivedMessage.appendBits(14, 10); // packet sequence count(dummy value) reqVerifService.successExecutionVerification(receivedMessage); receivedMessage = Message(1, 8, Message::TC, 3); - receivedMessage.appendEnumerated(3, ECSS_PUS_VERSION); // packet version number - receivedMessage.appendEnumerated(1, Message::TC); // packet type - receivedMessage.appendBits(1, static_cast<uint8_t >(true)); // secondary header flag - receivedMessage.appendEnumerated(11, 2); // application process ID(dummy value) - receivedMessage.appendEnumerated(2, 3); // sequence Flags - receivedMessage.appendBits(14, 10); // packet sequence count(dummy value) - receivedMessage.appendEnum16(6); // error code(dummy value) reqVerifService.failExecutionVerification(receivedMessage); receivedMessage = Message(1, 10, Message::TC, 3); - receivedMessage.appendEnumerated(3, ECSS_PUS_VERSION); // packet version number - receivedMessage.appendEnumerated(1, Message::TC); // packet type - receivedMessage.appendBits(1, static_cast<uint8_t >(true)); // secondary header flag - receivedMessage.appendEnumerated(11, 2); // application process ID(dummy value) - receivedMessage.appendEnumerated(2, 3); // sequence Flags - receivedMessage.appendBits(14, 10); // packet sequence count(dummy value) - receivedMessage.appendEnum16(7); // error code(dummy value) reqVerifService.failRoutingVerification(receivedMessage); return 0; } diff --git a/test/Services/RequestVerificationService.cpp b/test/Services/RequestVerificationService.cpp index 2c27fbd3..18f46817 100644 --- a/test/Services/RequestVerificationService.cpp +++ b/test/Services/RequestVerificationService.cpp @@ -7,12 +7,6 @@ TEST_CASE("TM[1,1]", "[service][st01]") { RequestVerificationService reqVerifService; Message receivedMessage = Message(1, 1, Message::TC, 3); - receivedMessage.appendEnumerated(3, ECSS_PUS_VERSION); // packet version number - receivedMessage.appendEnumerated(1, Message::TC); // packet type - receivedMessage.appendBits(1, static_cast<uint8_t >(true)); // secondary header flag - receivedMessage.appendEnumerated(11, 2); // application process ID - receivedMessage.appendEnumerated(2, 3); // sequence Flags - receivedMessage.appendBits(14, 10); // packet sequence count reqVerifService.successAcceptanceVerification(receivedMessage); REQUIRE(ServiceTests::hasOneMessage()); @@ -20,29 +14,22 @@ TEST_CASE("TM[1,1]", "[service][st01]") { // Checks for the data-members of the object response CHECK(response.serviceType == 1); CHECK(response.messageType == 1); - CHECK(response.packetType == 0); // packet type(TM = 0, TC = 1) + CHECK(response.packetType == Message::TM); // packet type CHECK(response.applicationId == 0); REQUIRE(response.dataSize == 4); // dataSize is the number of bytes of data array // Check for the value that is stored in <<data>> array(data-member of object response) - CHECK(response.readEnumerated(3) == 2); // packet version number - CHECK(response.readEnumerated(1) == 1); // packet type - CHECK(response.readBits(1) == true); // secondary header flag - CHECK(response.readEnumerated(11) == 2); // application process ID - CHECK(response.readEnumerated(2) == 3); // sequence flags - CHECK(response.readBits(14) == 10); // packet sequence count + CHECK(response.readEnumerated(3) == ECSS_PACKET_VERSION); // packet version number + CHECK(response.readEnumerated(1) == Message::TC); // packet type + CHECK(response.readBits(1) == 0); // secondary header flag + CHECK(response.readEnumerated(11) == 3); // application process ID + CHECK(response.readEnumerated(2) == 0); // sequence flags + CHECK(response.readBits(14) == 0); // packet sequence count } TEST_CASE("TM[1,2]", "[service][st01]") { RequestVerificationService reqVerifService; Message receivedMessage = Message(1, 2, Message::TC, 3); - receivedMessage.appendEnumerated(3, ECSS_PUS_VERSION); // packet version number - receivedMessage.appendEnumerated(1, Message::TC); // packet type - receivedMessage.appendBits(1, static_cast<uint8_t >(true)); // secondary header flag - receivedMessage.appendEnumerated(11, 2); // application process ID - receivedMessage.appendEnumerated(2, 3); // sequence Flags - receivedMessage.appendBits(14, 10); // packet sequence count - receivedMessage.appendEnum16(5); // error code reqVerifService.failAcceptanceVerification(receivedMessage); REQUIRE(ServiceTests::hasOneMessage()); @@ -50,29 +37,23 @@ TEST_CASE("TM[1,2]", "[service][st01]") { // Checks for the data-members of the object response CHECK(response.serviceType == 1); CHECK(response.messageType == 2); - CHECK(response.packetType == 0); // packet type(TM = 0, TC = 1) + CHECK(response.packetType == Message::TM); // packet type CHECK(response.applicationId == 0); REQUIRE(response.dataSize == 6); // dataSize is the number of bytes of data array // Check for the value that is stored in <<data>> array(data-member of object response) - CHECK(response.readEnumerated(3) == 2); // packet version number - CHECK(response.readEnumerated(1) == 1); // packet type - CHECK(response.readBits(1) == true); // secondary header flag - CHECK(response.readEnumerated(11) == 2); // application process ID - CHECK(response.readEnumerated(2) == 3); // sequence flags - CHECK(response.readBits(14) == 10); // packet sequence count - CHECK(response.readEnum16() == 5); // error code + CHECK(response.readEnumerated(3) == ECSS_PACKET_VERSION); // packet version number + CHECK(response.readEnumerated(1) == Message::TC); // packet type + CHECK(response.readBits(1) == 0); // secondary header flag + CHECK(response.readEnumerated(11) == 3); // application process ID + CHECK(response.readEnumerated(2) == 0); // sequence flags + CHECK(response.readBits(14) == 0); // packet sequence count + CHECK(response.readEnum16() == 0); // error code } TEST_CASE("TM[1,7]", "[service][st01]") { RequestVerificationService reqVerifService; Message receivedMessage = Message(1, 7, Message::TC, 3); - receivedMessage.appendEnumerated(3, ECSS_PUS_VERSION); // packet version number - receivedMessage.appendEnumerated(1, Message::TC); // packet type - receivedMessage.appendBits(1, static_cast<uint8_t >(true)); // secondary header flag - receivedMessage.appendEnumerated(11, 2); // application process ID - receivedMessage.appendEnumerated(2, 3); // sequence Flags - receivedMessage.appendBits(14, 10); // packet sequence count reqVerifService.successExecutionVerification(receivedMessage); REQUIRE(ServiceTests::hasOneMessage()); @@ -80,60 +61,45 @@ TEST_CASE("TM[1,7]", "[service][st01]") { // Checks for the data-members of the object response CHECK(response.serviceType == 1); CHECK(response.messageType == 7); - CHECK(response.packetType == 0); // packet type(TM = 0, TC = 1) + CHECK(response.packetType == Message::TM); // packet type CHECK(response.applicationId == 0); REQUIRE(response.dataSize == 4); // dataSize is the number of bytes of data array // Check for the value that is stored in <<data>> array(data-member of object response) - CHECK(response.readEnumerated(3) == 2); // packet version number - CHECK(response.readEnumerated(1) == 1); // packet type - CHECK(response.readBits(1) == true); // secondary header flag - CHECK(response.readEnumerated(11) == 2); // application process ID - CHECK(response.readEnumerated(2) == 3); // sequence flags - CHECK(response.readBits(14) == 10); // packet sequence count + CHECK(response.readEnumerated(3) == ECSS_PACKET_VERSION); // packet version number + CHECK(response.readEnumerated(1) == Message::TC); // packet type + CHECK(response.readBits(1) == 0); // secondary header flag + CHECK(response.readEnumerated(11) == 3); // application process ID + CHECK(response.readEnumerated(2) == 0); // sequence flags + CHECK(response.readBits(14) == 0); // packet sequence count } TEST_CASE("TM[1,8]", "[service][st01]") { RequestVerificationService reqVerifService; Message receivedMessage = Message(1, 8, Message::TC, 3); - receivedMessage.appendEnumerated(3, ECSS_PUS_VERSION); // packet version number - receivedMessage.appendEnumerated(1, Message::TC); // packet type - receivedMessage.appendBits(1, static_cast<uint8_t >(true)); // secondary header flag - receivedMessage.appendEnumerated(11, 2); // application process ID - receivedMessage.appendEnumerated(2, 3); // sequence Flags - receivedMessage.appendBits(14, 10); // packet sequence count - receivedMessage.appendEnum16(6); // error code reqVerifService.failExecutionVerification(receivedMessage); REQUIRE(ServiceTests::hasOneMessage()); Message response = ServiceTests::get(0); - // Checks for the data-members of the object response CHECK(response.serviceType == 1); CHECK(response.messageType == 8); - CHECK(response.packetType == 0); // packet type(TM = 0, TC = 1) + CHECK(response.packetType == Message::TM); // packet type CHECK(response.applicationId == 0); REQUIRE(response.dataSize == 6); // dataSize is the number of bytes of data array // Check for the value that is stored in <<data>> array(data-member of object response) - CHECK(response.readEnumerated(3) == 2); // packet version number - CHECK(response.readEnumerated(1) == 1); // packet type - CHECK(response.readBits(1) == true); // secondary header flag - CHECK(response.readEnumerated(11) == 2); // application process ID - CHECK(response.readEnumerated(2) == 3); // sequence flags - CHECK(response.readBits(14) == 10); // packet sequence count - CHECK(response.readEnum16() == 6); // error code + CHECK(response.readEnumerated(3) == ECSS_PACKET_VERSION); // packet version number + CHECK(response.readEnumerated(1) == Message::TC); // packet type + CHECK(response.readBits(1) == 0); // secondary header flag + CHECK(response.readEnumerated(11) == 3); // application process ID + CHECK(response.readEnumerated(2) == 0); // sequence flags + CHECK(response.readBits(14) == 0); // packet sequence count + CHECK(response.readEnum16() == 0); // error code } TEST_CASE("TM[1,10]", "[service][st01]") { RequestVerificationService reqVerifService; Message receivedMessage = Message(1, 10, Message::TC, 3); - receivedMessage.appendEnumerated(3, ECSS_PUS_VERSION); // packet version number - receivedMessage.appendEnumerated(1, Message::TC); // packet type - receivedMessage.appendBits(1, static_cast<uint8_t >(true)); // secondary header flag - receivedMessage.appendEnumerated(11, 2); // application process ID - receivedMessage.appendEnumerated(2, 3); // sequence Flags - receivedMessage.appendBits(14, 10); // packet sequence count - receivedMessage.appendEnum16(7); // error code reqVerifService.failRoutingVerification(receivedMessage); REQUIRE(ServiceTests::hasOneMessage()); @@ -141,15 +107,15 @@ TEST_CASE("TM[1,10]", "[service][st01]") { // Checks for the data-members of the object response CHECK(response.serviceType == 1); CHECK(response.messageType == 10); - CHECK(response.packetType == 0); // packet type(TM = 0, TC = 1) + CHECK(response.packetType == Message::TM); // packet type CHECK(response.applicationId == 0); REQUIRE(response.dataSize == 6); // dataSize is the number of bytes of data array // Check for the value that is stored in <<data>> array(data-member of object response) - CHECK(response.readEnumerated(3) == 2); // packet version number - CHECK(response.readEnumerated(1) == 1); // packet type - CHECK(response.readBits(1) == true); // secondary header flag - CHECK(response.readEnumerated(11) == 2); // application process ID - CHECK(response.readEnumerated(2) == 3); // sequence flags - CHECK(response.readBits(14) == 10); // packet sequence count - CHECK(response.readEnum16() == 7); // error code + CHECK(response.readEnumerated(3) == ECSS_PACKET_VERSION); // packet version number + CHECK(response.readEnumerated(1) == Message::TC); // packet type + CHECK(response.readBits(1) == 0); // secondary header flag + CHECK(response.readEnumerated(11) == 3); // application process ID + CHECK(response.readEnumerated(2) == 0); // sequence flags + CHECK(response.readBits(14) == 0); // packet sequence count + CHECK(response.readEnum16() == 0); // error code } -- GitLab