summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShobhit Adlakha <adlakhashobhit@gmail.com>2019-04-09 11:12:13 -0400
committerShobhit Adlakha <adlakhashobhit@gmail.com>2019-04-09 11:12:13 -0400
commitd2f9c5c74c31f9996c6ec3c7191255ecff6330d3 (patch)
treefca178eebd968bba81d846a208fa8f117997e314
parent5c454894c6c429c1de3eaaf7621a70d1da691930 (diff)
downloadsdl_core-fix/as_gasd_unknown_service_type.tar.gz
Addressed review commentsfix/as_gasd_unknown_service_type
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc22
-rw-r--r--src/components/application_manager/src/commands/command_request_impl.cc15
-rw-r--r--src/components/application_manager/src/commands/request_from_hmi.cc7
3 files changed, 26 insertions, 18 deletions
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc
index 1588845274..6499b08c28 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc
@@ -63,15 +63,11 @@ void ASPerformAppServiceInteractionRequestFromHMI::Run() {
application_manager_.get_settings().hmi_origin_id();
if (!msg_params.keyExists(strings::origin_app)) {
if (hmi_origin_id.empty()) {
- smart_objects::SmartObject response_params;
- response_params[strings::info] =
- "No HMI origin ID to use for interaction passthrough";
- SendResponse(
- false,
+ SendErrorResponse(
correlation_id(),
hmi_apis::FunctionID::AppService_PerformAppServiceInteraction,
hmi_apis::Common_Result::INVALID_DATA,
- &response_params,
+ "No HMI origin ID to use for interaction passthrough",
application_manager::commands::Command::SOURCE_SDL_TO_HMI);
return;
}
@@ -82,14 +78,12 @@ void ASPerformAppServiceInteractionRequestFromHMI::Run() {
auto service =
application_manager_.GetAppServiceManager().FindServiceByID(service_id);
if (!service) {
- smart_objects::SmartObject response_params;
- response_params[strings::info] = "The requested service ID does not exist";
- SendResponse(false,
- correlation_id(),
- hmi_apis::FunctionID::AppService_PerformAppServiceInteraction,
- hmi_apis::Common_Result::INVALID_ID,
- &response_params,
- application_manager::commands::Command::SOURCE_SDL_TO_HMI);
+ SendErrorResponse(
+ correlation_id(),
+ hmi_apis::FunctionID::AppService_PerformAppServiceInteraction,
+ hmi_apis::Common_Result::INVALID_ID,
+ "The requested service ID does not exist",
+ application_manager::commands::Command::SOURCE_SDL_TO_HMI);
return;
}
diff --git a/src/components/application_manager/src/commands/command_request_impl.cc b/src/components/application_manager/src/commands/command_request_impl.cc
index 2d875db387..f67fde22a0 100644
--- a/src/components/application_manager/src/commands/command_request_impl.cc
+++ b/src/components/application_manager/src/commands/command_request_impl.cc
@@ -432,16 +432,27 @@ void CommandRequestImpl::SendProviderRequest(
LOG4CXX_AUTO_TRACE(logger_);
bool hmi_destination = false;
ApplicationSharedPtr app;
+ // Default error code and error message
+ std::string error_msg = "No app service provider available";
+ mobile_apis::Result::eType error_code =
+ mobile_apis::Result::DATA_NOT_AVAILABLE;
+
if ((*msg)[strings::msg_params].keyExists(strings::service_type)) {
std::string service_type =
(*msg)[strings::msg_params][strings::service_type].asString();
application_manager_.GetAppServiceManager().GetProviderByType(
service_type, true, app, hmi_destination);
+ error_msg = "No app service provider with serviceType: " + service_type +
+ " is available";
+ error_code = mobile_apis::Result::DATA_NOT_AVAILABLE;
} else if ((*msg)[strings::msg_params].keyExists(strings::service_id)) {
std::string service_id =
(*msg)[strings::msg_params][strings::service_id].asString();
application_manager_.GetAppServiceManager().GetProviderByID(
service_id, true, app, hmi_destination);
+ error_msg = "No app service provider with serviceId: " + service_id +
+ " is available";
+ error_code = mobile_apis::Result::INVALID_ID;
}
if (hmi_destination) {
@@ -454,9 +465,7 @@ void CommandRequestImpl::SendProviderRequest(
if (!app) {
LOG4CXX_DEBUG(logger_, "Invalid App Provider pointer");
- SendResponse(false,
- mobile_apis::Result::DATA_NOT_AVAILABLE,
- "No app service provider available");
+ SendResponse(false, error_code, error_msg.c_str());
return;
}
diff --git a/src/components/application_manager/src/commands/request_from_hmi.cc b/src/components/application_manager/src/commands/request_from_hmi.cc
index 07fc8d52f4..873d9a844f 100644
--- a/src/components/application_manager/src/commands/request_from_hmi.cc
+++ b/src/components/application_manager/src/commands/request_from_hmi.cc
@@ -173,7 +173,10 @@ void RequestFromHMI::SendProviderRequest(
LOG4CXX_AUTO_TRACE(logger_);
bool hmi_destination = false;
ApplicationSharedPtr app;
+ // Default error code and error message
std::string error_msg = "No app service provider available";
+ hmi_apis::Common_Result::eType error_code =
+ hmi_apis::Common_Result::DATA_NOT_AVAILABLE;
if ((*msg)[strings::msg_params].keyExists(strings::service_type)) {
std::string service_type =
@@ -182,6 +185,7 @@ void RequestFromHMI::SendProviderRequest(
service_type, false, app, hmi_destination);
error_msg = "No app service provider with serviceType: " + service_type +
" is available";
+ error_code = hmi_apis::Common_Result::DATA_NOT_AVAILABLE;
} else if ((*msg)[strings::msg_params].keyExists(strings::service_id)) {
std::string service_id =
(*msg)[strings::msg_params][strings::service_id].asString();
@@ -189,6 +193,7 @@ void RequestFromHMI::SendProviderRequest(
service_id, false, app, hmi_destination);
error_msg = "No app service provider with serviceId: " + service_id +
" is available";
+ error_code = hmi_apis::Common_Result::INVALID_ID;
}
if (hmi_destination) {
@@ -204,7 +209,7 @@ void RequestFromHMI::SendProviderRequest(
LOG4CXX_DEBUG(logger_, "Invalid App Provider pointer");
SendErrorResponse(correlation_id(),
static_cast<hmi_apis::FunctionID::eType>(function_id()),
- hmi_apis::Common_Result::DATA_NOT_AVAILABLE,
+ error_code,
error_msg,
commands::Command::CommandSource::SOURCE_SDL_TO_HMI);
return;