diff options
author | JackLivio <jack@livio.io> | 2019-07-17 13:47:09 -0400 |
---|---|---|
committer | JackLivio <jack@livio.io> | 2019-07-17 13:47:09 -0400 |
commit | 1e3a86da29ece1e05543b7facb470f7e6f4a63eb (patch) | |
tree | bac0ced0092de66734f94da57525a0594c12734a /src/components/application_manager/rpc_plugins | |
parent | 9fae63bfa8fb8dae78b21e768c28efcdbf11bbe0 (diff) | |
download | sdl_core-1e3a86da29ece1e05543b7facb470f7e6f4a63eb.tar.gz |
Address some comments
Diffstat (limited to 'src/components/application_manager/rpc_plugins')
2 files changed, 23 insertions, 0 deletions
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_request.cc index 7e7757a3d4..8e117fcc70 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_request.cc @@ -60,6 +60,18 @@ void ASUnpublishAppServiceRequest::Run() { std::string service_id = (*message_)[strings::msg_params][strings::service_id].asString(); + auto service = + application_manager_.GetAppServiceManager().FindServiceByID(service_id); + if (service->mobile_service) { + SendErrorResponse( + (*message_)[strings::params][strings::correlation_id].asUInt(), + hmi_apis::FunctionID::AppService_UnpublishAppService, + hmi_apis::Common_Result::REJECTED, + "Invalid Service ID", + application_manager::commands::Command::SOURCE_SDL_TO_HMI); + return; + } + bool ret = application_manager_.GetAppServiceManager().UnpublishAppService( service_id); diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_request.cc index 453de1d15f..1bdfd4d8e1 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_request.cc @@ -61,6 +61,17 @@ void UnpublishAppServiceRequest::Run() { std::string service_id = (*message_)[strings::msg_params][strings::service_id].asString(); + auto service = + application_manager_.GetAppServiceManager().FindServiceByID(service_id); + + if (service->connection_key != connection_key()) { + SendResponse( + false, + mobile_apis::Result::INVALID_ID, + "The app service with that requested service ID does not exist"); + return; + } + bool ret = application_manager_.GetAppServiceManager().UnpublishAppService( service_id); |