From e6dcdf70ef836aade7b79cbfdcdf84a04808c4d1 Mon Sep 17 00:00:00 2001 From: athatheo <vostidi@hotmail.com> Date: Tue, 26 Mar 2019 03:42:51 +0200 Subject: [PATCH] Updated ErrorType enums in ExecutionStartErrorType and changed the corresponding errors in EventActionService.cpp --- inc/ErrorHandler.hpp | 29 +++++++++++++++++++++++++++-- src/Services/EventActionService.cpp | 23 ++++++++++------------- 2 files changed, 37 insertions(+), 15 deletions(-) diff --git a/inc/ErrorHandler.hpp b/inc/ErrorHandler.hpp index 15bb4afd..c61bce43 100644 --- a/inc/ErrorHandler.hpp +++ b/inc/ErrorHandler.hpp @@ -98,8 +98,33 @@ public: */ enum ExecutionStartErrorType { UnknownExecutionStartError = 0, - FailedStartOfExecutionError = 1, - }; + /** + * In the Event Action Service, in the addEventActionDefinition function an attempt was + * made to add an existing event action + * definition + */ + EventActionAddExistingDefinitionError = 1, + /** + * In the Event Action Service, in the deleteEventActionDefinition function, an attempt + * was made to delete an event action definition that was enabled + */ + EventActionDeleteEnabledDefinitionError = 2, + /** + * In the Event Action Service, in the deleteEventActionDefinition function, an attempt + * was made to delete an unknown event action definition + */ + EventActionDeleteUnknownDefinitionError = 3, + /** + * In the Event Action Service, in the enableEventActionDefinition function, an attempt + * was made to enable an unknown event action definition + */ + EventActionEnableUnknownDefinitionError = 4, + /** + * In the Event Action Service, in the disableEventActionDefinition function, an attempt + * was made to disable an unknown event action definition + */ + EventActionDisableUnknownDefinitionError = 5, + }; /** * The error code for failed progress of execution reports, as specified in ECSS 5.3.5.2.3g diff --git a/src/Services/EventActionService.cpp b/src/Services/EventActionService.cpp index 7b85cdbb..eff76067 100644 --- a/src/Services/EventActionService.cpp +++ b/src/Services/EventActionService.cpp @@ -24,7 +24,7 @@ void EventActionService::addEventActionDefinitions(Message &message) { eventActionDefinitionMap.insert(std::make_pair(eventDefinitionID, temp)); } else { ErrorHandler::reportError(message, - ErrorHandler::ExecutionStartErrorType::FailedStartOfExecutionError); + ErrorHandler::ExecutionStartErrorType::EventActionAddExistingDefinitionError); } } } @@ -37,22 +37,20 @@ void EventActionService::deleteEventActionDefinitions(Message &message) { for (uint16_t i = 0; i < numberOfEventActionDefinitions; i++) { uint16_t applicationID = message.readEnum16(); uint16_t eventDefinitionID = message.readEnum16(); - if (eventActionDefinitionMap.find(eventDefinitionID) != eventActionDefinitionMap.end()){ + if (eventActionDefinitionMap.find(eventDefinitionID) != + eventActionDefinitionMap.end()) { // I need this to buffer the first readEnum16, since cpp check fails if I don't // use it anywhere eventActionDefinitionMap[eventDefinitionID].applicationId = applicationID; - if (eventActionDefinitionMap[eventDefinitionID].enabled == true){ + if (eventActionDefinitionMap[eventDefinitionID].enabled == true) { ErrorHandler::reportError(message, - ErrorHandler::ExecutionStartErrorType::FailedStartOfExecutionError); - std::cout << "hi"; - + ErrorHandler::ExecutionStartErrorType::EventActionDeleteEnabledDefinitionError); } else { eventActionDefinitionMap.erase(eventDefinitionID); - std::cout << "hi"; } } else { ErrorHandler::reportError(message, - ErrorHandler::ExecutionStartErrorType::FailedStartOfExecutionError); + ErrorHandler::ExecutionStartErrorType::EventActionDeleteUnknownDefinitionError); } } } @@ -86,9 +84,9 @@ void EventActionService::enableEventActionDefinitions(Message &message) { eventActionDefinitionMap[eventDefinitionID].applicationId = applicationID; eventActionDefinitionMap[eventDefinitionID].enabled = true; } else { - ErrorHandler::reportError(message, - ErrorHandler::ExecutionStartErrorType::FailedStartOfExecutionError); - } + ErrorHandler::reportError(message, + ErrorHandler::ExecutionStartErrorType::EventActionEnableUnknownDefinitionError); + } } } else { for (auto element : eventActionDefinitionMap) { @@ -117,9 +115,8 @@ void EventActionService::disableEventActionDefinitions(Message &message) { eventActionDefinitionMap[eventDefinitionID].applicationId = applicationID; eventActionDefinitionMap[eventDefinitionID].enabled = false; } else { - std::cout << "disable event action error"; ErrorHandler::reportError(message, - ErrorHandler::ExecutionStartErrorType::FailedStartOfExecutionError); + ErrorHandler::ExecutionStartErrorType::EventActionDisableUnknownDefinitionError); } } } else { -- GitLab