diff options
Diffstat (limited to 'src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc')
-rw-r--r-- | src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc | 70 |
1 files changed, 39 insertions, 31 deletions
diff --git a/src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc b/src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc index f6dc53f592..7472324ed9 100644 --- a/src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc +++ b/src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc @@ -240,34 +240,34 @@ void ResetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { - case hmi_apis::FunctionID::UI_SetGlobalProperties: { - LOG4CXX_INFO(logger_, "Received UI_SetGlobalProperties event"); - is_ui_received_ = true; - ui_result_ = static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - break; - } - case hmi_apis::FunctionID::TTS_SetGlobalProperties: { - LOG4CXX_INFO(logger_, "Received TTS_SetGlobalProperties event"); - is_tts_received_ = true; - tts_result_ = static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - break; - } - default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); - return; - } + case hmi_apis::FunctionID::UI_SetGlobalProperties: { + LOG4CXX_INFO(logger_, "Received UI_SetGlobalProperties event"); + is_ui_received_ = true; + ui_result_ = static_cast<hmi_apis::Common_Result::eType>( + message[strings::params][hmi_response::code].asInt()); + break; + } + case hmi_apis::FunctionID::TTS_SetGlobalProperties: { + LOG4CXX_INFO(logger_, "Received TTS_SetGlobalProperties event"); + is_tts_received_ = true; + tts_result_ = static_cast<hmi_apis::Common_Result::eType>( + message[strings::params][hmi_response::code].asInt()); + break; + } + default: { + LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + return; + } } if (!IsPendingResponseExist()) { bool result = ((hmi_apis::Common_Result::SUCCESS == ui_result_) - && (hmi_apis::Common_Result::SUCCESS == tts_result_ || - hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == tts_result_)) - || ((hmi_apis::Common_Result::SUCCESS == ui_result_) - && (hmi_apis::Common_Result::INVALID_ENUM == tts_result_)) - || ((hmi_apis::Common_Result::INVALID_ENUM == ui_result_) - && (hmi_apis::Common_Result::SUCCESS == tts_result_)); + && (hmi_apis::Common_Result::SUCCESS == tts_result_ || + hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == tts_result_)) + || ((hmi_apis::Common_Result::SUCCESS == ui_result_) + && (hmi_apis::Common_Result::INVALID_ENUM == tts_result_)) + || ((hmi_apis::Common_Result::INVALID_ENUM == ui_result_) + && (hmi_apis::Common_Result::SUCCESS == tts_result_)); mobile_apis::Result::eType result_code; const char* return_info = NULL; @@ -278,25 +278,33 @@ void ResetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { return_info = std::string("Unsupported phoneme type sent in a prompt").c_str(); } else { result_code = static_cast<mobile_apis::Result::eType>( - std::max(ui_result_, tts_result_)); + std::max(ui_result_, tts_result_)); } } else { result_code = static_cast<mobile_apis::Result::eType>( - std::max(ui_result_, tts_result_)); + std::max(ui_result_, tts_result_)); } + SendResponse(result, static_cast<mobile_apis::Result::eType>(result_code), + return_info, &(message[strings::msg_params])); + ApplicationSharedPtr application = ApplicationManagerImpl::instance()->application(connection_key()); - if (application) { - SendResponse(result, static_cast<mobile_apis::Result::eType>(result_code), - return_info, &(message[strings::msg_params])); + + if (!application) { + LOG4CXX_DEBUG(logger_, "NULL pointer"); + return; + } + + if (result) { application->UpdateHash(); - } else { - LOG4CXX_WARN(logger_, "unable to find application: " << connection_key()); } + } else { + LOG4CXX_WARN(logger_, "unable to find application: " << connection_key()); } } + bool ResetGlobalPropertiesRequest::IsPendingResponseExist() { return is_ui_send_ != is_ui_received_ || is_tts_send_ != is_tts_received_; } |