diff options
author | JackLivio <jack@livio.io> | 2019-02-13 16:39:46 -0500 |
---|---|---|
committer | JackLivio <jack@livio.io> | 2019-02-13 16:39:46 -0500 |
commit | fe724122fa194196e65e2b3ece2d2916c0e98cc1 (patch) | |
tree | afe8a5212c490d846f391342d26ac5ad4b426a30 | |
parent | 26d4a6ac85727082682dae72d85a73d3df117fea (diff) | |
download | sdl_core-fe724122fa194196e65e2b3ece2d2916c0e98cc1.tar.gz |
Address Comments
6 files changed, 30 insertions, 19 deletions
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc index 6c69eae3b6..1a90572ecf 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc @@ -69,9 +69,10 @@ void OnAppServiceDataNotificationFromMobile::Run() { MessageHelper::PrintSmartObject(*message_); // Todo: revision make service type string. - mobile_apis::AppServiceType::eType service_type = static_cast<mobile_apis::AppServiceType::eType>( - (*message_)[strings::msg_params][strings::app_service_manifest] - [strings::service_type].asUInt()); + mobile_apis::AppServiceType::eType service_type = + static_cast<mobile_apis::AppServiceType::eType>( + (*message_)[strings::msg_params][strings::app_service_manifest] + [strings::service_type].asUInt()); ApplicationSharedPtr app = application_manager_.application(connection_key()); diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc index 052ad9751a..06f7f4b13a 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc @@ -93,16 +93,28 @@ void PublishAppServiceRequest::Run() { application_manager_.GetAppServiceManager().PublishAppService( manifest, true, connection_key()); - std::string requested_service_name = - (*message_)[strings::msg_params][strings::app_service_manifest] - [strings::service_name].asString(); + std::string requested_service_name = ""; + + if ((*message_)[strings::msg_params][strings::app_service_manifest].keyExists( + strings::service_name)) { + requested_service_name = + (*message_)[strings::msg_params][strings::app_service_manifest] + [strings::service_name].asString(); + } + // Todo: revision make service type string. - mobile_apis::AppServiceType::eType requested_service_type = static_cast<mobile_apis::AppServiceType::eType>( - (*message_)[strings::msg_params][strings::app_service_manifest] - [strings::service_type].asUInt()); - smart_objects::SmartArray* requested_handled_rpcs = - (*message_)[strings::msg_params][strings::app_service_manifest] - [strings::handled_rpcs].asArray(); + mobile_apis::AppServiceType::eType requested_service_type = + static_cast<mobile_apis::AppServiceType::eType>( + (*message_)[strings::msg_params][strings::app_service_manifest] + [strings::service_type].asUInt()); + + smart_objects::SmartArray* requested_handled_rpcs; + if ((*message_)[strings::msg_params][strings::app_service_manifest].keyExists( + strings::handled_rpcs)) { + requested_handled_rpcs = + (*message_)[strings::msg_params][strings::app_service_manifest] + [strings::handled_rpcs].asArray(); + } ApplicationSharedPtr app = application_manager_.application(connection_key()); diff --git a/src/components/application_manager/src/app_service_manager.cc b/src/components/application_manager/src/app_service_manager.cc index c52e6a12f1..5cb46f968f 100644 --- a/src/components/application_manager/src/app_service_manager.cc +++ b/src/components/application_manager/src/app_service_manager.cc @@ -106,7 +106,6 @@ std::vector<smart_objects::SmartObject> AppServiceManager::GetAllServices() { return services; } - std::pair<std::string, AppService> AppServiceManager::ActiveServiceByType( std::string service_type) { for (auto it = published_services_.begin(); it != published_services_.end(); diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc index a9f69464b7..451a9087d5 100644 --- a/src/components/application_manager/src/policies/policy_handler.cc +++ b/src/components/application_manager/src/policies/policy_handler.cc @@ -1959,9 +1959,8 @@ bool PolicyHandler::CheckAppServiceParameters( this->GetAppServiceParameters(policy_app_id, &app_service_parameters); std::string requested_service_type_str = std::string(); - smart_objects::EnumConversionHelper< - mobile_apis::AppServiceType::eType>:: - EnumToString(requested_service_type, &requested_service_type_str); + smart_objects::EnumConversionHelper<mobile_apis::AppServiceType::eType>:: + EnumToString(requested_service_type, &requested_service_type_str); if (app_service_parameters.find(requested_service_type_str) == app_service_parameters.end()) { @@ -1982,7 +1981,6 @@ bool PolicyHandler::CheckAppServiceParameters( } } - // todo handled rpcs check if (requested_handled_rpcs) { auto temp_rpcs = *(app_service_parameters[requested_service_type_str].handled_rpcs); diff --git a/src/components/policy/policy_external/src/sql_pt_representation.cc b/src/components/policy/policy_external/src/sql_pt_representation.cc index 33dc98343b..435638ddb7 100644 --- a/src/components/policy/policy_external/src/sql_pt_representation.cc +++ b/src/components/policy/policy_external/src/sql_pt_representation.cc @@ -1808,7 +1808,7 @@ bool SQLPTRepresentation::GatherAppServiceParameters( return false; } - service_type_query.Bind(2, app_id); + service_type_query.Bind(0, app_id); while (service_type_query.Next()) { const int service_type_id = service_type_query.GetInteger(0); std::string service_type = service_type_query.GetString(1); diff --git a/src/components/policy/policy_regular/src/sql_pt_representation.cc b/src/components/policy/policy_regular/src/sql_pt_representation.cc index 6905af659e..b2981759ab 100644 --- a/src/components/policy/policy_regular/src/sql_pt_representation.cc +++ b/src/components/policy/policy_regular/src/sql_pt_representation.cc @@ -1761,10 +1761,11 @@ bool SQLPTRepresentation::GatherAppServiceParameters( return false; } - service_type_query.Bind(2, app_id); + service_type_query.Bind(0, app_id); while (service_type_query.Next()) { const int service_type_id = service_type_query.GetInteger(0); std::string service_type = service_type_query.GetString(1); + LOG4CXX_WARN(logger_, "Load service type from pt: " << service_type); (*app_service_parameters)[service_type] = policy_table::AppServiceInfo(); service_name_query.Bind(0, service_type_id); |