diff --git a/inc/Services/RequestVerificationService.hpp b/inc/Services/RequestVerificationService.hpp index 8584e188449aeb4efebb9b7f2f286cefbae164b1..e6b5e8120c6571864dddf3ac5d6b341d16889a90 100644 --- a/inc/Services/RequestVerificationService.hpp +++ b/inc/Services/RequestVerificationService.hpp @@ -1,5 +1,5 @@ -#ifndef ECSS_SERVICES_REQUSTVERIFICATIONSERVICE_HPP -#define ECSS_SERVICES_REQUSTVERIFICATIONSERVICE_HPP +#ifndef ECSS_SERVICES_REQEUSTVERIFICATIONSERVICE_HPP +#define ECSS_SERVICES_REQUESTVERIFICATIONSERVICE_HPP #include "Service.hpp" @@ -18,39 +18,39 @@ public: * TM[1,1] successful acceptance verification report */ void successAcceptanceVerification(uint8_t packetType, bool secondaryHeaderFlag, - uint16_t APID, uint8_t seqFlag, uint16_t packetSeqCount); + uint16_t apid, uint8_t seqFlag, uint16_t packetSeqCount); /** * TM[1,2] failed acceptance verification report */ void failAcceptanceVerification(uint8_t packetType, bool secondaryHeaderFlag, - uint16_t APID, uint8_t seqFlag, uint16_t packetSeqCount, - uint16_t code); + uint16_t apid, uint8_t seqFlag, uint16_t packetSeqCount, + uint16_t errorCode); /** * TM[1,7] successful completion of execution verification report */ void successExecutionVerification(uint8_t packetType, bool secondaryHeaderFlag, - uint16_t APID, uint8_t seqFlag, uint16_t packetSeqCount); + uint16_t apid, uint8_t seqFlag, uint16_t packetSeqCount); /** * TM[1,8] failed completion of execution verification report */ void failExecutionVerification(uint8_t packetType, bool secondaryHeaderFlag, - uint16_t APID, uint8_t seqFlag, uint16_t packetSeqCount, - uint16_t code); + uint16_t apid, uint8_t seqFlag, uint16_t packetSeqCount, + uint16_t errorCode); /** * TM[1,10] failed routing verification report */ void failRoutingVerification(uint8_t packetType, bool secondaryHeaderFlag, - uint16_t APID, uint8_t seqFlag, uint16_t packetSeqCount, - uint16_t code); + uint16_t apid, uint8_t seqFlag, uint16_t packetSeqCount, + uint16_t errorCode); }; -#endif //ECSS_SERVICES_REQUSTVERIFICATIONSERVICE_HPP +#endif //ECSS_SERVICES_REQUESTVERIFICATIONSERVICE_HPP diff --git a/src/Services/RequestVerificationService.cpp b/src/Services/RequestVerificationService.cpp index 5c0e41361f14af9e9c2bafb6d1332bbf49e797f0..0416fd1fe9f4ffed2226d0fbc1a54a494d731387 100644 --- a/src/Services/RequestVerificationService.cpp +++ b/src/Services/RequestVerificationService.cpp @@ -2,20 +2,20 @@ void RequestVerificationService::successAcceptanceVerification(uint8_t packetType, bool secondaryHeaderFlag, - uint16_t APID, uint8_t seqFlag, + uint16_t apid, uint8_t seqFlag, uint16_t packetSeqCount) { // TM[1,1] successful acceptance verification report - assert(packetType <= 1); - assert(APID <= 1024); - assert(seqFlag <= 2); - assert(packetSeqCount <= 8192); + assert(packetType < 2); + assert(apid < 2048); + assert(seqFlag < 4); + assert(packetSeqCount < 16384); Message report = createTM(1); - report.appendBits(3, ECSS_PUS_VERSION); //packet version number + report.appendBits(3, ECSS_PUS_VERSION); // packet version number report.appendBits(1, packetType); report.appendBits(1, static_cast<uint16_t >(secondaryHeaderFlag)); - report.appendBits(11, APID); + report.appendBits(11, apid); report.appendBits(2, seqFlag); report.appendBits(14, packetSeqCount); @@ -25,45 +25,45 @@ void RequestVerificationService::successAcceptanceVerification(uint8_t packetTyp void RequestVerificationService::failAcceptanceVerification(uint8_t packetType, bool secondaryHeaderFlag, - uint16_t APID, uint8_t seqFlag, + uint16_t apid, uint8_t seqFlag, uint16_t packetSeqCount, - uint16_t code) { + uint16_t errorCode) { // TM[1,2] failed acceptance verification report - assert(packetType <= 1); - assert(APID <= 1024); - assert(seqFlag <= 2); - assert(packetSeqCount <= 8192); + assert(packetType < 2); + assert(apid < 2048); + assert(seqFlag < 4); + assert(packetSeqCount < 16384); Message report = createTM(2); - report.appendBits(3, ECSS_PUS_VERSION); //packet version number + report.appendBits(3, ECSS_PUS_VERSION); // packet version number report.appendBits(1, packetType); report.appendBits(1, static_cast<uint16_t >(secondaryHeaderFlag)); - report.appendBits(11, APID); + report.appendBits(11, apid); report.appendBits(2, seqFlag); report.appendBits(14, packetSeqCount); - report.appendUint16(code); + report.appendUint16(errorCode); storeMessage(report); } void RequestVerificationService::successExecutionVerification(uint8_t packetType, bool secondaryHeaderFlag, - uint16_t APID, uint8_t seqFlag, + uint16_t apid, uint8_t seqFlag, uint16_t packetSeqCount) { // TM[1,7] successful completion of execution verification report - assert(packetType <= 1); - assert(APID <= 1024); - assert(seqFlag <= 2); - assert(packetSeqCount <= 8192); + assert(packetType < 2); + assert(apid < 2048); + assert(seqFlag < 4); + assert(packetSeqCount < 16384); Message report = createTM(7); - report.appendBits(3, ECSS_PUS_VERSION); //packet version number + report.appendBits(3, ECSS_PUS_VERSION); // packet version number report.appendBits(1, packetType); report.appendBits(1, static_cast<uint16_t >(secondaryHeaderFlag)); - report.appendBits(11, APID); + report.appendBits(11, apid); report.appendBits(2, seqFlag); report.appendBits(14, packetSeqCount); @@ -73,25 +73,25 @@ void RequestVerificationService::successExecutionVerification(uint8_t packetType void RequestVerificationService::failExecutionVerification(uint8_t packetType, bool secondaryHeaderFlag, - uint16_t APID, uint8_t seqFlag, + uint16_t apid, uint8_t seqFlag, uint16_t packetSeqCount, - uint16_t code) { + uint16_t errorCode) { // TM[1,8] failed completion of execution verification report - assert(packetType <= 1); - assert(APID <= 1024); - assert(seqFlag <= 2); - assert(packetSeqCount <= 8192); + assert(packetType < 2); + assert(apid < 2048); + assert(seqFlag < 4); + assert(packetSeqCount < 16384); Message report = createTM(8); - report.appendBits(3, ECSS_PUS_VERSION); //packet version number + report.appendBits(3, ECSS_PUS_VERSION); // packet version number report.appendBits(1, packetType); report.appendBits(1, static_cast<uint16_t >(secondaryHeaderFlag)); - report.appendBits(11, APID); + report.appendBits(11, apid); report.appendBits(2, seqFlag); report.appendBits(14, packetSeqCount); - report.appendUint16(code); + report.appendUint16(errorCode); storeMessage(report); } @@ -99,25 +99,25 @@ RequestVerificationService::failExecutionVerification(uint8_t packetType, void RequestVerificationService::failRoutingVerification(uint8_t packetType, bool secondaryHeaderFlag, - uint16_t APID, uint8_t seqFlag, + uint16_t apid, uint8_t seqFlag, uint16_t packetSeqCount, - uint16_t code) { + uint16_t errorCode) { // TM[1,10] failed routing verification report - assert(packetType <= 1); - assert(APID <= 1024); - assert(seqFlag <= 2); - assert(packetSeqCount <= 8192); + assert(packetType < 2); + assert(apid < 2048); + assert(seqFlag < 4); + assert(packetSeqCount < 16384); Message report = createTM(10); - report.appendBits(3, ECSS_PUS_VERSION); //packet version number + report.appendBits(3, ECSS_PUS_VERSION); // packet version number report.appendBits(1, packetType); report.appendBits(1, static_cast<uint16_t >(secondaryHeaderFlag)); - report.appendBits(11, APID); + report.appendBits(11, apid); report.appendBits(2, seqFlag); report.appendBits(14, packetSeqCount); - report.appendUint16(code); + report.appendUint16(errorCode); storeMessage(report); } diff --git a/src/main.cpp b/src/main.cpp index 70d5030de4314a1f4068e2772aa1ce7082419147..67362d560377ce54d40fdc04d2637148928ddc39 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -20,7 +20,7 @@ int main() { std::cout << "Word: " << string << " " << packet.readBits(15) << packet.readBits(1) << std::endl; std::cout << packet.readFloat() << " " << std::dec << packet.readSint32() << std::endl; - /* + // ST[17] test TestService testService; Message receivedPacket = Message(17, 1, Message::TC, 1); @@ -28,7 +28,6 @@ int main() { receivedPacket = Message(17, 3, Message::TC, 1); receivedPacket.appendUint16(7); testService.onBoardConnection(receivedPacket); - */ // ST[01] test // parameters take random values and works as expected