summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChrisB-Elektrobit <chris.boguslawski@elektrobit.com>2017-08-14 14:52:21 -0400
committerChrisB-Elektrobit <chris.boguslawski@elektrobit.com>2017-08-14 14:52:21 -0400
commit66569e1fe7adda31381d806652148384894f16c1 (patch)
tree78d210c8e2e740df214852596ce321b214a11d23
parent5f53669ead7fb8de513bb2ec18e119a27e1f91de (diff)
downloadsdl_core-66569e1fe7adda31381d806652148384894f16c1.tar.gz
- adding warning result code and info message to ShowResponse to handle
the case where metadata tags are provided without a corresponding mainField entry.
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/show_request.h3
-rw-r--r--src/components/application_manager/src/commands/mobile/show_request.cc22
2 files changed, 21 insertions, 4 deletions
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/show_request.h b/src/components/application_manager/include/application_manager/commands/mobile/show_request.h
index 7e07be1c9a..a10997bacd 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/show_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/show_request.h
@@ -86,6 +86,9 @@ class ShowRequest : public CommandRequestImpl {
int32_t field_index,
smart_objects::SmartObject& msg_params);
+ mobile_apis::Result::eType core_result_code_;
+ std::string core_response_info_;
+
DISALLOW_COPY_AND_ASSIGN(ShowRequest);
};
diff --git a/src/components/application_manager/src/commands/mobile/show_request.cc b/src/components/application_manager/src/commands/mobile/show_request.cc
index 8f51afa9b6..00cdc2a603 100644
--- a/src/components/application_manager/src/commands/mobile/show_request.cc
+++ b/src/components/application_manager/src/commands/mobile/show_request.cc
@@ -45,7 +45,8 @@ namespace commands {
ShowRequest::ShowRequest(const MessageSharedPtr& message,
ApplicationManager& application_manager)
- : CommandRequestImpl(message, application_manager) {}
+ : CommandRequestImpl(message, application_manager)
+ , core_result_code_(mobile_apis::Result::INVALID_ENUM) {}
ShowRequest::~ShowRequest() {}
@@ -69,8 +70,14 @@ void ShowRequest::HandleMetadata(const char* field_id,
}
} else {
LOG4CXX_INFO(logger_,
- "metadata tag provided with no item for " << field_id
- << ", ignoring");
+ "metadata tag provided with no item for "
+ << field_id << ", ignoring with warning");
+ // tag provided with no item, ignore with warning
+ if (mobile_apis::Result::INVALID_ENUM == core_result_code_) {
+ core_result_code_ = mobile_apis::Result::IGNORED;
+ core_response_info_ =
+ "Metadata tag was provided for a field with no data.";
+ }
}
} else {
LOG4CXX_INFO(logger_,
@@ -284,8 +291,15 @@ void ShowRequest::on_event(const event_engine::Event& event) {
response_info =
message[strings::params][hmi_response::message].asString();
}
+ mobile_apis::Result::eType converted_result_code =
+ MessageHelper::HMIToMobileResult(result_code);
+ if (mobile_apis::Result::SUCCESS == converted_result_code &&
+ mobile_apis::Result::INVALID_ENUM != core_result_code_) {
+ converted_result_code = core_result_code_;
+ response_info = core_response_info_;
+ }
SendResponse(result,
- MessageHelper::HMIToMobileResult(result_code),
+ converted_result_code,
response_info.empty() ? NULL : response_info.c_str(),
&(message[strings::msg_params]));
break;