diff options
Diffstat (limited to 'src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc')
-rw-r--r-- | src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc | 44 |
1 files changed, 35 insertions, 9 deletions
diff --git a/src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc b/src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc index b151990289..d5767690d7 100644 --- a/src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc +++ b/src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc @@ -111,6 +111,7 @@ void AlertManeuverRequest::Run() { } pending_requests_.Add(hmi_apis::FunctionID::Navigation_AlertManeuver); + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation); SendHMIRequest( hmi_apis::FunctionID::Navigation_AlertManeuver, &msg_params, true); @@ -123,6 +124,7 @@ void AlertManeuverRequest::Run() { msg_params[hmi_request::speak_type] = hmi_apis::Common_MethodName::ALERT_MANEUVER; + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); SendHMIRequest(hmi_apis::FunctionID::TTS_Speak, &msg_params, true); } } @@ -134,6 +136,7 @@ void AlertManeuverRequest::on_event(const event_engine::Event& event) { switch (event_id) { case hmi_apis::FunctionID::Navigation_AlertManeuver: { LOG4CXX_INFO(logger_, "Received Navigation_AlertManeuver event"); + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation); pending_requests_.Remove(event_id); navi_alert_maneuver_result_code_ = static_cast<hmi_apis::Common_Result::eType>( @@ -143,6 +146,7 @@ void AlertManeuverRequest::on_event(const event_engine::Event& event) { } case hmi_apis::FunctionID::TTS_Speak: { LOG4CXX_INFO(logger_, "Received TTS_Speak event"); + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); pending_requests_.Remove(event_id); tts_speak_result_code_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); @@ -191,10 +195,13 @@ bool AlertManeuverRequest::PrepareResponseParameters( application_manager::commands::ResponseInfo navigation_alert_info( navi_alert_maneuver_result_code_, - HmiInterfaces::HMI_INTERFACE_Navigation); + HmiInterfaces::HMI_INTERFACE_Navigation, + application_manager_); application_manager::commands::ResponseInfo tts_alert_info( - tts_speak_result_code_, HmiInterfaces::HMI_INTERFACE_TTS); + tts_speak_result_code_, + HmiInterfaces::HMI_INTERFACE_TTS, + application_manager_); const bool result = PrepareResultForMobileResponse(navigation_alert_info, tts_alert_info); @@ -216,23 +223,42 @@ bool AlertManeuverRequest::PrepareResponseParameters( bool AlertManeuverRequest::IsWhiteSpaceExist() { LOG4CXX_AUTO_TRACE(logger_); - const char* str = NULL; + using smart_objects::SmartArray; if ((*message_)[strings::msg_params].keyExists(strings::tts_chunks)) { - const smart_objects::SmartArray* tc_array = + const SmartArray* tts_chunks_arr = (*message_)[strings::msg_params][strings::tts_chunks].asArray(); - smart_objects::SmartArray::const_iterator it_tc = tc_array->begin(); - smart_objects::SmartArray::const_iterator it_tc_end = tc_array->end(); + SmartArray::const_iterator it_tts_chunk = tts_chunks_arr->begin(); - for (; it_tc != it_tc_end; ++it_tc) { - str = (*it_tc)[strings::text].asCharArray(); - if (strlen(str) && !CheckSyntax(str)) { + for (; it_tts_chunk != tts_chunks_arr->end(); ++it_tts_chunk) { + const char* tts_chunk_text = (*it_tts_chunk)[strings::text].asCharArray(); + if (strlen(tts_chunk_text) && !CheckSyntax(tts_chunk_text)) { LOG4CXX_ERROR(logger_, "Invalid tts_chunks syntax check failed"); return true; } } } + if ((*message_)[strings::msg_params].keyExists(strings::soft_buttons)) { + DCHECK_OR_RETURN( + (*message_)[strings::msg_params][strings::soft_buttons].getType() == + smart_objects::SmartType_Array, + true); + const smart_objects::SmartArray* soft_button_array = + (*message_)[strings::msg_params][strings::soft_buttons].asArray(); + + SmartArray::const_iterator it_soft_button = soft_button_array->begin(); + + for (; it_soft_button != soft_button_array->end(); ++it_soft_button) { + const char* soft_button_text = + (*it_soft_button)[strings::text].asCharArray(); + if (!CheckSyntax(soft_button_text)) { + LOG4CXX_ERROR(logger_, "Invalid soft_buttons syntax check failed"); + return true; + } + } + } + return false; } |