diff options
author | Conlain Kelly <conlain.k@gmail.com> | 2018-07-19 16:28:21 -0400 |
---|---|---|
committer | Conlain Kelly <conlain.k@gmail.com> | 2018-07-19 16:28:21 -0400 |
commit | b1d49ad732781c8213b01a491074e9ab554ca126 (patch) | |
tree | 38e2e0602b03f9637ba4d541c22a006c4ca24bfb /src/components/application_manager | |
parent | 325bf4094287e4ab3cf8bd0fee43aef3e585d218 (diff) | |
download | sdl_core-b1d49ad732781c8213b01a491074e9ab554ca126.tar.gz |
more development, needs testing and performinteraction checks
Diffstat (limited to 'src/components/application_manager')
3 files changed, 33 insertions, 21 deletions
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc index 31f4deb50c..9b365b3f13 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc @@ -124,16 +124,24 @@ void CreateInteractionChoiceSetRequest::Run() { SendResponse(false, result); return; } + std::cerr << "checking choice set\n"; int vr_status = MessageHelper::CheckChoiceSet_VRCommands((*message_)[strings::msg_params][strings::choice_set]); if (vr_status == -1) { + std::cerr << "choice set has invalid MIXED set of VR parameters" << '\n'; // this is an error SendResponse(false, Result::INVALID_DATA, "Some choices don't contain VR commands."); + return; // exit now, this is a bad set } else if (vr_status == 0) { + std::cerr << "choice set has valid FULL set of VR parameters" << '\n'; + // everyone had a vr command, setup the grammar uint32_t grammar_id = application_manager_.GenerateGrammarID(); (*message_)[strings::msg_params][strings::grammar_id] = grammar_id; SendVRAddCommandRequests(app); + } else { + std::cerr << "choice set has valid EMPTY set of VR parameters" << '\n'; + } // continue on as usual app->AddChoiceSet(choice_set_id_, (*message_)[strings::msg_params]); @@ -158,7 +166,7 @@ mobile_apis::Result::eType CreateInteractionChoiceSetRequest::CheckChoiceSet( (*current_choice_set_it)[strings::choice_id].asInt()); if (!ins_res.second) { LOG4CXX_ERROR(logger_, - "Choise with ID " + "Choice with ID " << (*current_choice_set_it)[strings::choice_id].asInt() << " already exists"); return mobile_apis::Result::INVALID_ID; 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 bac700f89c..7753c16acf 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 @@ -163,18 +163,18 @@ void PerformInteractionRequest::Run() { SendResponse(false, mobile_apis::Result::INVALID_ID); return; } - if (!CheckChoiceSetList_VRCommands( - app, - choice_set_id_list_length, - msg_params[strings::interaction_choice_set_id_list])) { - LOG4CXX_ERROR(logger_, - "PerformInteraction has choice sets with " - "missing vrCommands"); - SendResponse(false, - mobile_apis::Result::INVALID_DATA, - "Some choices don't contain VR commands."); - return; - } + // if (!CheckChoiceSetList_VRCommands( + // app, + // choice_set_id_list_length, + // msg_params[strings::interaction_choice_set_id_list])) { + // LOG4CXX_ERROR(logger_, + // "PerformInteraction has choice sets with " + // "missing vrCommands"); + // SendResponse(false, + // mobile_apis::Result::INVALID_DATA, + // "Some choices don't contain VR commands."); + // return; + // } if (msg_params.keyExists(strings::vr_help)) { if (mobile_apis::Result::SUCCESS != MessageHelper::VerifyImageVrHelpItems( @@ -965,17 +965,19 @@ bool PerformInteractionRequest::CheckChoiceSetList_VRCommands( for (size_t i = 0; i < choice_set_id_list_length; ++i) { choice_set = app->FindChoiceSet(choice_set_id_list[i].asInt()); - if (!choice_set) { - LOG4CXX_ERROR( - logger_, - "Couldn't find choiceset_id = " << choice_set_id_list[i].asInt()); - return false; - } + // this should never ever happen + // if (!choice_set) { + // LOG4CXX_ERROR( + // logger_, + // "Couldn't find choiceset_id = " << choice_set_id_list[i].asInt()); + // return false; + // } int vr_status = MessageHelper::CheckChoiceSet_VRCommands(*choice_set); // if not all choices have vr commands if (vr_status != 0) { + std::cerr << "choice set has member missing vr commands\n"; return false; } } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc index 10ffbded09..d7edd303ef 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc @@ -200,8 +200,10 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnEvent_VR_UNSUPPORTED_RESOURCE) { MessageSharedPtr msg_vr = CreateFullParamsVRSO(); (*msg_vr)[strings::msg_params][strings::choice_set][0][strings::choice_id] = 10; - (*msg_vr)[strings::msg_params][strings::choice_set][0][strings::menu_name] = - "menu_name"; +(*msg_vr)[strings::msg_params][strings::choice_set][0][strings::menu_name] = + "menu_name"; +(*msg_vr)[strings::msg_params][strings::choice_set][0][strings::vr_commands][0] = + kVrCommands1; (*msg_vr)[strings::msg_params][strings::interaction_choice_set_id] = 11; utils::SharedPtr<CreateInteractionChoiceSetRequest> req_vr = CreateCommand<CreateInteractionChoiceSetRequest>(msg_vr); |