summaryrefslogtreecommitdiff
path: root/src/components/application_manager/src/commands/request_to_hmi.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/application_manager/src/commands/request_to_hmi.cc')
-rw-r--r--src/components/application_manager/src/commands/request_to_hmi.cc34
1 files changed, 8 insertions, 26 deletions
diff --git a/src/components/application_manager/src/commands/request_to_hmi.cc b/src/components/application_manager/src/commands/request_to_hmi.cc
index 35ac71c8bd..3c411b1605 100644
--- a/src/components/application_manager/src/commands/request_to_hmi.cc
+++ b/src/components/application_manager/src/commands/request_to_hmi.cc
@@ -80,26 +80,6 @@ bool CheckAvailabilityHMIInterfaces(ApplicationManager& application_manager,
return HmiInterfaces::STATE_NOT_AVAILABLE != state;
}
-bool IsResponseCodeSuccess(
- const smart_objects::SmartObject& response_from_hmi) {
- auto response_code = static_cast<hmi_apis::Common_Result::eType>(
- response_from_hmi[strings::params][hmi_response::code].asInt());
-
- using helpers::Compare;
- using helpers::EQ;
- using helpers::ONE;
-
- const bool is_result_success =
- Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
- response_code,
- hmi_apis::Common_Result::SUCCESS,
- hmi_apis::Common_Result::WARNINGS,
- hmi_apis::Common_Result::WRONG_LANGUAGE,
- hmi_apis::Common_Result::RETRY,
- hmi_apis::Common_Result::SAVED);
- return is_result_success;
-}
-
bool ChangeInterfaceState(ApplicationManager& application_manager,
const smart_objects::SmartObject& response_from_hmi,
HmiInterfaces::InterfaceID interface) {
@@ -113,12 +93,14 @@ bool ChangeInterfaceState(ApplicationManager& application_manager,
return false;
}
- // Process response with result
- if (response_from_hmi[strings::params].keyExists(hmi_response::code) &&
- !IsResponseCodeSuccess(response_from_hmi)) {
- application_manager.hmi_interfaces().SetInterfaceState(
- interface, HmiInterfaces::STATE_NOT_AVAILABLE);
- return false;
+ if (response_from_hmi[strings::params].keyExists(hmi_response::code)) {
+ auto response_code = static_cast<hmi_apis::Common_Result::eType>(
+ response_from_hmi[strings::params][hmi_response::code].asInt());
+ if (!IsHMIResultSuccess(response_code)) {
+ application_manager.hmi_interfaces().SetInterfaceState(
+ interface, HmiInterfaces::STATE_NOT_AVAILABLE);
+ return false;
+ }
}
application_manager.hmi_interfaces().SetInterfaceState(