From 8e8305da3c0f0cc72855416f2f846a5f932c38ca Mon Sep 17 00:00:00 2001 From: AKalinich-Luxoft Date: Fri, 27 Jul 2018 19:14:46 +0300 Subject: Fix defects found after ATF testing Apply feature for AddSubMenu RPC Fixed PI request does not resend choiceId Fixed wrong RPC creation in mobile factory --- .../src/commands/mobile/add_sub_menu_request.cc | 7 +--- .../commands/mobile/perform_interaction_request.cc | 48 ++++++++++++---------- .../sdl_rpc_plugin/src/mobile_command_factory.cc | 6 +-- 3 files changed, 31 insertions(+), 30 deletions(-) diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_request.cc index 3dcc414f9e..183b445326 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_request.cc @@ -76,7 +76,7 @@ void AddSubMenuRequest::Run() { verification_result = MessageHelper::VerifyImage( received_msg_params[strings::menu_icon], app, application_manager_); - if (mobile_apis::Result::SUCCESS != verification_result) { + if (mobile_apis::Result::INVALID_DATA == verification_result) { LOG4CXX_ERROR( logger_, "MessageHelper::VerifyImage return " << verification_result); SendResponse(false, verification_result); @@ -117,10 +117,7 @@ void AddSubMenuRequest::Run() { msg_params[strings::menu_params][strings::menu_name] = received_msg_params[strings::menu_name]; msg_params[strings::app_id] = app->app_id(); - - if (mobile_apis::Result::SUCCESS == verification_result) { - msg_params[strings::menu_icon] = received_msg_params[strings::menu_icon]; - } + msg_params[strings::menu_icon] = received_msg_params[strings::menu_icon]; StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); SendHMIRequest(hmi_apis::FunctionID::UI_AddSubMenu, &msg_params, true); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc index 76dd30525a..ec06f0bb31 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc @@ -343,27 +343,31 @@ bool PerformInteractionRequest::ProcessVRResponse( return false; } - if (Common_Result::SUCCESS == vr_result_code_ && - InteractionMode::MANUAL_ONLY == interaction_mode_) { - LOG4CXX_DEBUG(logger_, - "VR response SUCCESS in MANUAL_ONLY mode " - << "Wait for UI response"); - // in case MANUAL_ONLY mode VR.PI SUCCESS just return - return false; - } - const SmartObject& hmi_msg_params = message[strings::msg_params]; if (hmi_msg_params.keyExists(strings::choice_id)) { - const int choise_id = hmi_msg_params[strings::choice_id].asInt(); - if (!CheckChoiceIDFromResponse(app, choise_id)) { + const int choice_id = hmi_msg_params[strings::choice_id].asInt(); + if (!CheckChoiceIDFromResponse(app, choice_id)) { LOG4CXX_ERROR(logger_, "Wrong choiceID was received from HMI"); TerminatePerformInteraction(); SendResponse( false, Result::GENERIC_ERROR, "Wrong choiceID was received from HMI"); return true; } - msg_params[strings::choice_id] = choise_id; + msg_params[strings::choice_id] = choice_id; + } + + const bool is_vr_result_success = Compare( + vr_result_code_, Common_Result::SUCCESS, Common_Result::WARNINGS); + + if (is_vr_result_success && + InteractionMode::MANUAL_ONLY == interaction_mode_) { + LOG4CXX_DEBUG(logger_, + "VR response is successfull in MANUAL_ONLY mode " + << "Wait for UI response"); + // in case MANUAL_ONLY mode VR.PI SUCCESS just return + return false; } + return false; } @@ -401,19 +405,19 @@ void PerformInteractionRequest::ProcessUIResponse( ui_result_code_, hmi_apis::Common_Result::UNSUPPORTED_RESOURCE); if (result) { - if (is_pi_warning) { - ui_result_code_ = hmi_apis::Common_Result::WARNINGS; - ui_info_ = message[strings::msg_params][strings::info].asString(); - if (message.keyExists(strings::params) && - message[strings::params].keyExists(strings::data)) { - msg_params = message[strings::params][strings::data]; - } - } else if (is_pi_unsupported) { + if (is_pi_unsupported) { ui_result_code_ = hmi_apis::Common_Result::UNSUPPORTED_RESOURCE; ui_info_ = message[strings::msg_params][strings::info].asString(); - } else if (message.keyExists(strings::msg_params)) { - msg_params = message[strings::msg_params]; + } else { + if (message.keyExists(strings::msg_params)) { + msg_params = message[strings::msg_params]; + } + if (is_pi_warning) { + ui_result_code_ = hmi_apis::Common_Result::WARNINGS; + ui_info_ = message[strings::msg_params][strings::info].asString(); + } } + // result code must be GENERIC_ERROR in case wrong choice_id if (msg_params.keyExists(strings::choice_id)) { if (!CheckChoiceIDFromResponse(app, diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc index 3d7e2f6437..4251eeadc9 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc @@ -263,7 +263,7 @@ CommandCreator& MobileCommandFactory::get_creator_factory( } case mobile_apis::FunctionID::GetWayPointsID: { return mobile_api::messageType::request == message_type - ? factory.GetCreator() + ? factory.GetCreator() : factory.GetCreator(); } case mobile_apis::FunctionID::SubscribeWayPointsID: { @@ -273,8 +273,8 @@ CommandCreator& MobileCommandFactory::get_creator_factory( } case mobile_apis::FunctionID::UnsubscribeWayPointsID: { return mobile_api::messageType::request == message_type - ? factory.GetCreator() - : factory.GetCreator(); + ? factory.GetCreator() + : factory.GetCreator(); } case mobile_apis::FunctionID::GetSystemCapabilityID: { return mobile_api::messageType::request == message_type -- cgit v1.2.1