diff --git a/inc/ErrorHandler.hpp b/inc/ErrorHandler.hpp index df687ad47b7799db340bf4a7884e38340e0ca373..781bc299a26e61765787c54bf760c4e183bce813 100644 --- a/inc/ErrorHandler.hpp +++ b/inc/ErrorHandler.hpp @@ -89,14 +89,35 @@ public: UnacceptableMessage = 5, }; + /** + * The error code for failed start of execution reports, as specified in ECSS 5.3.5.2.3g + * + * Note: Numbers are kept in code explicitly, so that there is no uncertainty when something + * changes. + */ + enum StartExecutionErrorType { + UnknownStartExecutionError = 0, + }; + + /** + * The error code for failed progress of execution reports, as specified in ECSS 5.3.5.2.3g + * + * Note: Numbers are kept in code explicitly, so that there is no uncertainty when something + * changes. + */ + enum ProgressExecutionErrorType { + UnknownProgressExecutionError = 0, + }; + + /** * The error code for failed completion of execution reports, as specified in ECSS 5.3.5.2.3g * * Note: Numbers are kept in code explicitly, so that there is no uncertainty when something * changes. */ - enum ExecutionErrorType { - UnknownExecutionError = 0, + enum CompletionExecutionErrorType { + UnknownCompletionExecutionError = 0, /** * Checksum comparison failed */ diff --git a/inc/Services/RequestVerificationService.hpp b/inc/Services/RequestVerificationService.hpp index 6fef8a641083ed9fa2c435375eb89f327b7b473d..a1a62922fb68ac9b5aec68e5beb90ef2eaa85db6 100644 --- a/inc/Services/RequestVerificationService.hpp +++ b/inc/Services/RequestVerificationService.hpp @@ -57,7 +57,8 @@ public: * The data is actually some data members of Message that contain the basic info * of the telecommand packet that its start of execution has failed */ - void failStartExecutionVerification(const Message &request, ErrorHandler::ExecutionErrorType + void failStartExecutionVerification(const Message &request, + ErrorHandler::StartExecutionErrorType errorCode); /** @@ -77,7 +78,7 @@ public: * of the telecommand packet that its progress of execution has failed */ void failProgressExecutionVerification(const Message &request, - ErrorHandler::ExecutionErrorType errorCode); + ErrorHandler::ProgressExecutionErrorType errorCode); /** * TM[1,7] successful completion of execution verification report @@ -96,7 +97,7 @@ public: * telecommand packet that failed to be executed completely */ void failCompletionExecutionVerification(const Message &request, - ErrorHandler::ExecutionErrorType errorCode); + ErrorHandler::CompletionExecutionErrorType errorCode); /** * TM[1,10] failed routing verification report diff --git a/src/ErrorHandler.cpp b/src/ErrorHandler.cpp index 1cb8e686a9caf74a2140e6b4753d1efd86fa3fd4..b17123f153289e599caac5196c767491db4506c7 100644 --- a/src/ErrorHandler.cpp +++ b/src/ErrorHandler.cpp @@ -15,7 +15,21 @@ void ErrorHandler::reportError(const Message &message, AcceptanceErrorType error } template<> -void ErrorHandler::reportError(const Message &message, ExecutionErrorType errorCode) { +void ErrorHandler::reportError(const Message &message, StartExecutionErrorType errorCode) { + requestVerificationService.failStartExecutionVerification(message, errorCode); + + logError(message, errorCode); +} + +template<> +void ErrorHandler::reportError(const Message &message, ProgressExecutionErrorType errorCode) { + requestVerificationService.failProgressExecutionVerification(message, errorCode); + + logError(message, errorCode); +} + +template<> +void ErrorHandler::reportError(const Message &message, CompletionExecutionErrorType errorCode) { requestVerificationService.failCompletionExecutionVerification(message, errorCode); logError(message, errorCode); diff --git a/src/Services/RequestVerificationService.cpp b/src/Services/RequestVerificationService.cpp index 3a2ed7b774d09c029e42791ca173d76a1167bf10..dcc6b107596b2d7f804b9d4de70126bd7dc43673 100644 --- a/src/Services/RequestVerificationService.cpp +++ b/src/Services/RequestVerificationService.cpp @@ -50,7 +50,7 @@ void RequestVerificationService::successStartExecutionVerification(const Message } void RequestVerificationService::failStartExecutionVerification(const Message &request, - ErrorHandler::ExecutionErrorType errorCode) { + ErrorHandler::StartExecutionErrorType errorCode) { // TM[1,4] failed start of execution verification report Message report = createTM(4); @@ -82,7 +82,7 @@ void RequestVerificationService::successProgressExecutionVerification(const Mess } void RequestVerificationService::failProgressExecutionVerification(const Message &request, - ErrorHandler::ExecutionErrorType errorCode) { + ErrorHandler::ProgressExecutionErrorType errorCode) { // TM[1,6] failed progress of execution verification report Message report = createTM(6); @@ -115,7 +115,7 @@ void RequestVerificationService::successCompletionExecutionVerification(const Me void RequestVerificationService::failCompletionExecutionVerification(const Message &request, - ErrorHandler::ExecutionErrorType errorCode) { + ErrorHandler::CompletionExecutionErrorType errorCode) { // TM[1,8] failed completion of execution verification report Message report = createTM(8); diff --git a/src/main.cpp b/src/main.cpp index 1b395c00b2bde8f78c4511bb776fd6458d533779..4201d756874abc1bd78c81f0de16dbf4e4c4ce36 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -123,19 +123,22 @@ int main() { reqVerifService.successStartExecutionVerification(receivedMessage); receivedMessage = Message(1, 4, Message::TC, 3); - reqVerifService.failStartExecutionVerification(receivedMessage, ErrorHandler::UnknownExecutionError); + reqVerifService.failStartExecutionVerification(receivedMessage, + ErrorHandler::UnknownStartExecutionError); receivedMessage = Message(1, 5, Message::TC, 3); reqVerifService.successProgressExecutionVerification(receivedMessage); receivedMessage = Message(1, 6, Message::TC, 3); - reqVerifService.failProgressExecutionVerification(receivedMessage, ErrorHandler::UnknownExecutionError); + reqVerifService.failProgressExecutionVerification(receivedMessage, + ErrorHandler::UnknownProgressExecutionError); receivedMessage = Message(1, 7, Message::TC, 3); reqVerifService.successCompletionExecutionVerification(receivedMessage); receivedMessage = Message(1, 8, Message::TC, 3); - reqVerifService.failCompletionExecutionVerification(receivedMessage, ErrorHandler::UnknownExecutionError); + reqVerifService.failCompletionExecutionVerification(receivedMessage, + ErrorHandler::UnknownCompletionExecutionError); receivedMessage = Message(1, 10, Message::TC, 3); reqVerifService.failRoutingVerification(receivedMessage, ErrorHandler::UnknownRoutingError);