summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordtrunov <dtrunov@luxoft.com>2016-10-07 12:48:57 +0300
committerdtrunov <dtrunov@luxoft.com>2016-10-07 12:48:57 +0300
commitd2cd9c8a0925458be800b1e65bb2873430169383 (patch)
tree441da32dee9f3f25e62bd791e299980a6dffd45a
parenta1c6b5d52941a7e5d932f0b9acdd89eca283c3c1 (diff)
downloadsdl_core-d2cd9c8a0925458be800b1e65bb2873430169383.tar.gz
Fix problem with incorrect result
Fix problem with incorrect result when HMI respond wiht successfull result code Closes bug [APPLINK-28491](https://adc.luxoft.com/jira/browse/APPLINK-28491)
-rw-r--r--src/components/application_manager/src/commands/command_request_impl.cc5
-rw-r--r--src/components/application_manager/src/commands/mobile/diagnostic_message_request.cc20
-rw-r--r--src/components/application_manager/src/commands/mobile/get_dtcs_request.cc20
-rw-r--r--src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc31
-rw-r--r--src/components/application_manager/src/commands/mobile/read_did_request.cc21
-rw-r--r--src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc22
-rw-r--r--src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_request.cc27
7 files changed, 93 insertions, 53 deletions
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 609180197c..70b4ba558a 100644
--- a/src/components/application_manager/src/commands/command_request_impl.cc
+++ b/src/components/application_manager/src/commands/command_request_impl.cc
@@ -68,7 +68,10 @@ const std::string CreateInfoForUnsupportedResult(
case (HmiInterfaces::InterfaceID::HMI_INTERFACE_Navigation): {
return "Navi is not supported by system";
}
- default:
+ case (HmiInterfaces::InterfaceID::HMI_INTERFACE_VehicleInfo): {
+ return "VehicleInfo is not supported by system";
+ }
+ default:
#ifdef ENABLE_LOG
CREATE_LOGGERPTR_LOCAL(logger, "Commands");
LOG4CXX_WARN(logger,
diff --git a/src/components/application_manager/src/commands/mobile/diagnostic_message_request.cc b/src/components/application_manager/src/commands/mobile/diagnostic_message_request.cc
index 5252ea0e33..ad4e6b438e 100644
--- a/src/components/application_manager/src/commands/mobile/diagnostic_message_request.cc
+++ b/src/components/application_manager/src/commands/mobile/diagnostic_message_request.cc
@@ -37,6 +37,7 @@
#include "application_manager/application_impl.h"
#include "interfaces/HMI_API.h"
+#include "application_manager/message_helper.h"
namespace application_manager {
@@ -93,13 +94,20 @@ void DiagnosticMessageRequest::on_event(const event_engine::Event& event) {
switch (event.id()) {
case hmi_apis::FunctionID::VehicleInfo_DiagnosticMessage: {
- mobile_apis::Result::eType result_code =
- static_cast<mobile_apis::Result::eType>(
+ hmi_apis::Common_Result::eType result_code =
+ static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
-
- bool result = mobile_apis::Result::SUCCESS == result_code;
-
- SendResponse(result, result_code, NULL, &(message[strings::msg_params]));
+ const bool result = PrepareResultForMobileResponse(
+ result_code, HmiInterfaces::HMI_INTERFACE_VehicleInfo);
+ std::string response_info;
+ GetInfo(HmiInterfaces::InterfaceID::HMI_INTERFACE_VehicleInfo,
+ result_code,
+ message,
+ response_info);
+ SendResponse(result,
+ MessageHelper::HMIToMobileResult(result_code),
+ response_info.empty()?NULL:response_info.c_str(),
+ &(message[strings::msg_params]));
break;
}
default: {
diff --git a/src/components/application_manager/src/commands/mobile/get_dtcs_request.cc b/src/components/application_manager/src/commands/mobile/get_dtcs_request.cc
index 80bc89f853..69e51627fd 100644
--- a/src/components/application_manager/src/commands/mobile/get_dtcs_request.cc
+++ b/src/components/application_manager/src/commands/mobile/get_dtcs_request.cc
@@ -35,6 +35,7 @@
#include "application_manager/application_impl.h"
#include "interfaces/HMI_API.h"
+#include "application_manager/message_helper.h"
namespace application_manager {
@@ -80,13 +81,22 @@ void GetDTCsRequest::on_event(const event_engine::Event& event) {
switch (event.id()) {
case hmi_apis::FunctionID::VehicleInfo_GetDTCs: {
- mobile_apis::Result::eType result_code =
- static_cast<mobile_apis::Result::eType>(
+ hmi_apis::Common_Result::eType result_code =
+ static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
- bool result = mobile_apis::Result::SUCCESS == result_code;
-
- SendResponse(result, result_code, NULL, &(message[strings::msg_params]));
+ const bool result = PrepareResultForMobileResponse(
+ result_code, HmiInterfaces::HMI_INTERFACE_VehicleInfo);
+ std::string response_info;
+ GetInfo(HmiInterfaces::InterfaceID::HMI_INTERFACE_VehicleInfo,
+ result_code,
+ message,
+ response_info);
+
+ SendResponse(result,
+ MessageHelper::HMIToMobileResult(result_code),
+ response_info.empty()?NULL:response_info.c_str(),
+ &(message[strings::msg_params]));
break;
}
default: {
diff --git a/src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc b/src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc
index 330cbdef30..24dd39908a 100644
--- a/src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc
+++ b/src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc
@@ -266,27 +266,30 @@ void GetVehicleDataRequest::on_event(const event_engine::Event& event) {
switch (event.id()) {
case hmi_apis::FunctionID::VehicleInfo_GetVehicleData: {
- mobile_apis::Result::eType result_code =
- static_cast<mobile_apis::Result::eType>(
+ hmi_apis::Common_Result::eType result_code =
+ static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
- bool result = false;
- if (mobile_apis::Result::SUCCESS == result_code ||
- (hmi_apis::Common_Result::DATA_NOT_AVAILABLE ==
- static_cast<hmi_apis::Common_Result::eType>(result_code) &&
- message[strings::msg_params].length() > 1)) {
- result = true;
- }
- const char* info = NULL;
- std::string error_message;
+ bool result = PrepareResultForMobileResponse(
+ result_code, HmiInterfaces::HMI_INTERFACE_VehicleInfo);
+ std::string response_info;
+ GetInfo(HmiInterfaces::InterfaceID::HMI_INTERFACE_VehicleInfo,
+ result_code,
+ message,
+ response_info);
+ result = result || ((hmi_apis::Common_Result::DATA_NOT_AVAILABLE ==
+ result_code) && (message[strings::msg_params].length() > 1));
+
if (true ==
message[strings::msg_params].keyExists(hmi_response::method)) {
message[strings::msg_params].erase(hmi_response::method);
}
if (true == message[strings::params].keyExists(strings::error_msg)) {
- error_message = message[strings::params][strings::error_msg].asString();
- info = error_message.c_str();
+ response_info = message[strings::params][strings::error_msg].asString();
}
- SendResponse(result, result_code, info, &(message[strings::msg_params]));
+ SendResponse(result,
+ MessageHelper::HMIToMobileResult(result_code),
+ response_info.empty()?NULL:response_info.c_str(),
+ &(message[strings::msg_params]));
break;
}
default: {
diff --git a/src/components/application_manager/src/commands/mobile/read_did_request.cc b/src/components/application_manager/src/commands/mobile/read_did_request.cc
index 18482b5b63..ab26798f23 100644
--- a/src/components/application_manager/src/commands/mobile/read_did_request.cc
+++ b/src/components/application_manager/src/commands/mobile/read_did_request.cc
@@ -36,6 +36,7 @@
#include "application_manager/application_impl.h"
#include "interfaces/MOBILE_API.h"
#include "interfaces/HMI_API.h"
+#include "application_manager/message_helper.h"
namespace application_manager {
@@ -96,13 +97,21 @@ void ReadDIDRequest::on_event(const event_engine::Event& event) {
switch (event.id()) {
case hmi_apis::FunctionID::VehicleInfo_ReadDID: {
- mobile_apis::Result::eType result_code =
- static_cast<mobile_apis::Result::eType>(
+ hmi_apis::Common_Result::eType result_code =
+ static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
-
- bool result = mobile_apis::Result::SUCCESS == result_code;
-
- SendResponse(result, result_code, NULL, &(message[strings::msg_params]));
+ const bool result = PrepareResultForMobileResponse(
+ result_code, HmiInterfaces::HMI_INTERFACE_VehicleInfo);
+ std::string response_info;
+ GetInfo(HmiInterfaces::InterfaceID::HMI_INTERFACE_VehicleInfo,
+ result_code,
+ message,
+ response_info);
+
+ SendResponse(result,
+ MessageHelper::HMIToMobileResult(result_code),
+ response_info.empty()?NULL:response_info.c_str(),
+ &(message[strings::msg_params]));
break;
}
default: {
diff --git a/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc b/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc
index 485c5d0009..02c5b6a129 100644
--- a/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc
+++ b/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc
@@ -325,27 +325,28 @@ void SubscribeVehicleDataRequest::on_event(const event_engine::Event& event) {
}
}
#else
+
hmi_apis::Common_Result::eType hmi_result =
static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
-
- const bool is_result_no_error =
- Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
+ std::string response_info;
+ GetInfo(HmiInterfaces::InterfaceID::HMI_INTERFACE_VehicleInfo,
hmi_result,
- hmi_apis::Common_Result::SUCCESS,
- hmi_apis::Common_Result::WARNINGS);
+ message,
+ response_info);
+ const bool result = PrepareResultForMobileResponse(
+ hmi_result, HmiInterfaces::HMI_INTERFACE_VehicleInfo);
bool is_succeeded =
- is_result_no_error || !vi_already_subscribed_by_another_apps_.empty();
+ result || !vi_already_subscribed_by_another_apps_.empty();
mobile_apis::Result::eType result_code =
MessageHelper::HMIToMobileResult(hmi_result);
- const char* return_info = NULL;
if (is_succeeded) {
if (!vi_already_subscribed_by_this_app_.empty()) {
result_code = mobile_apis::Result::IGNORED;
- return_info = "Already subscribed on some provided VehicleData.";
+ response_info = "Already subscribed on some provided VehicleData.";
}
}
@@ -358,7 +359,10 @@ void SubscribeVehicleDataRequest::on_event(const event_engine::Event& event) {
}
SendResponse(
- is_succeeded, result_code, return_info, &(message[strings::msg_params]));
+ is_succeeded,
+ result_code,
+ response_info.empty()?NULL:response_info.c_str(),
+ &(message[strings::msg_params]));
if (is_succeeded) {
app->UpdateHash();
diff --git a/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_request.cc b/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_request.cc
index 4fcc04c7be..4131f60bae 100644
--- a/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_request.cc
+++ b/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_request.cc
@@ -315,21 +315,21 @@ void UnsubscribeVehicleDataRequest::on_event(const event_engine::Event& event) {
hmi_apis::Common_Result::eType hmi_result =
static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
-
- bool is_succeeded = Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
- hmi_result,
- hmi_apis::Common_Result::SUCCESS,
- hmi_apis::Common_Result::WARNINGS);
+ std::string response_info;
+ GetInfo(HmiInterfaces::InterfaceID::HMI_INTERFACE_VehicleInfo,
+ hmi_result,
+ message,
+ response_info);
+ const bool result = PrepareResultForMobileResponse(
+ hmi_result, HmiInterfaces::HMI_INTERFACE_VehicleInfo);
mobile_apis::Result::eType result_code =
MessageHelper::HMIToMobileResult(hmi_result);
- const char* return_info = NULL;
-
- if (is_succeeded) {
+ if (result) {
if (vi_already_unsubscribed_by_this_app_.size()) {
result_code = mobile_apis::Result::IGNORED;
- return_info = "Some provided VehicleData was not subscribed.";
+ response_info = "Some provided VehicleData was not subscribed.";
}
}
@@ -339,12 +339,15 @@ void UnsubscribeVehicleDataRequest::on_event(const event_engine::Event& event) {
const_cast<smart_objects::SmartObject&>(message[strings::msg_params]));
}
- if (is_succeeded) {
+ if (result) {
SetAllowedToTerminate(false);
}
SendResponse(
- is_succeeded, result_code, return_info, &(message[strings::msg_params]));
- if (is_succeeded) {
+ result,
+ result_code,
+ response_info.empty()?NULL:response_info.c_str(),
+ &(message[strings::msg_params]));
+ if (result) {
UpdateHash();
}
#endif // #ifdef HMI_DBUS_API