From d8bda5ad6f4f82d5203e27f18a2fc25f05d7a323 Mon Sep 17 00:00:00 2001 From: ShobhitAd Date: Tue, 13 Nov 2018 12:07:45 -0500 Subject: Getting HybridAppPreference from enum --- .../application_manager/src/policies/policy_handler.cc | 11 +++++++---- .../smart_objects/include/smart_objects/enum_schema_item.h | 7 +++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc index cc62d9f6f8..44f83ab097 100644 --- a/src/components/application_manager/src/policies/policy_handler.cc +++ b/src/components/application_manager/src/policies/policy_handler.cc @@ -54,6 +54,7 @@ #include "interfaces/MOBILE_API.h" #include "utils/file_system.h" #include "utils/scope_guard.h" +#include "smart_objects/enum_schema_item.h" #include "utils/helpers.h" #include "policy/policy_manager.h" @@ -1913,10 +1914,12 @@ void PolicyHandler::OnSetCloudAppProperties( policy_app_id, msg_params[strings::cloud_transport_type].asString()); } if (msg_params.keyExists(strings::hybrid_app_preference)) { - // const std::string hybrid_app_preference = - // EnumConversionHelper::EnumToString(msg_params[strings::hybrid_app_preference]); - // policy_manager_->SetHybridAppPreference( - // policy_app_id, hybrid_app_preference); + std::string hybrid_app_preference; + + mobile_apis::HybridAppPreference::eType value = static_cast + (msg_params[strings::hybrid_app_preference].asUInt()); + smart_objects::EnumConversionHelper::EnumToString(value, &hybrid_app_preference); + policy_manager_->SetHybridAppPreference(policy_app_id, hybrid_app_preference); } } diff --git a/src/components/smart_objects/include/smart_objects/enum_schema_item.h b/src/components/smart_objects/include/smart_objects/enum_schema_item.h index cbba5bd7cd..942b491927 100644 --- a/src/components/smart_objects/include/smart_objects/enum_schema_item.h +++ b/src/components/smart_objects/include/smart_objects/enum_schema_item.h @@ -220,11 +220,10 @@ class EnumConversionHelper { static bool EnumToString(const EnumType value, std::string* str) { const char* cstr; - if (EnumToCString(value, &cstr)) { - return false; - } - if (str) { + bool success = EnumToCString(value, &cstr); + if (success && str) { *str = cstr; + return true; } return false; } -- cgit v1.2.1