summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShobhitAd <adlakhshobhit@gmail.com>2018-11-13 12:07:45 -0500
committerShobhitAd <adlakhashobhit@gmail.com>2018-11-20 12:45:23 -0500
commit4391bd0909caecbf640fba21769c32f415699f18 (patch)
tree6d80523f82a5fab0b4ac0924f2b4b063b4d9202f /src
parent5d16aa31477d0835da6bcd3668f53ae0bd0d1439 (diff)
downloadsdl_core-4391bd0909caecbf640fba21769c32f415699f18.tar.gz
Getting HybridAppPreference from enum
Diffstat (limited to 'src')
-rw-r--r--src/components/application_manager/src/policies/policy_handler.cc11
-rw-r--r--src/components/smart_objects/include/smart_objects/enum_schema_item.h7
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 505f29e13b..8e74ae99b9 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"
@@ -1918,10 +1919,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<HybridAppPreference>::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<mobile_apis::HybridAppPreference::eType>
+ (msg_params[strings::hybrid_app_preference].asUInt());
+ smart_objects::EnumConversionHelper<mobile_apis::HybridAppPreference::eType>::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;
}