summaryrefslogtreecommitdiff
path: root/src/components/application_manager/src/message_helper/message_helper.cc
diff options
context:
space:
mode:
authorAndrey Oleynik <AOleynik@luxoft.com>2016-01-17 20:47:09 +0200
committerHerasym Oleh <oolleehh@gmail.com>2016-02-02 18:15:49 +0200
commitd29adf0dbd563856fe737ce83eeff06455d73969 (patch)
treee6c50a3e2ea7d4fb71414b915972501dfe6bbe8c /src/components/application_manager/src/message_helper/message_helper.cc
parentf8b1723720344b4440f8503f9330b327e6e8a754 (diff)
downloadsdl_core-d29adf0dbd563856fe737ce83eeff06455d73969.tar.gz
Adds methods for conversion of HMI <---> Mobile languages
Implements: APPLINK-20560 Conflicts: src/components/application_manager/include/application_manager/message_helper.h
Diffstat (limited to 'src/components/application_manager/src/message_helper/message_helper.cc')
-rw-r--r--src/components/application_manager/src/message_helper/message_helper.cc40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/components/application_manager/src/message_helper/message_helper.cc b/src/components/application_manager/src/message_helper/message_helper.cc
index 53caa73823..eb47467eb8 100644
--- a/src/components/application_manager/src/message_helper/message_helper.cc
+++ b/src/components/application_manager/src/message_helper/message_helper.cc
@@ -219,6 +219,46 @@ hmi_apis::Common_Language::eType MessageHelper::CommonLanguageFromString(
return hmi_apis::Common_Language::INVALID_ENUM;
}
+std::string MessageHelper::MobileLanguageToString(
+ mobile_apis::Language::eType language) {
+ using namespace NsSmartDeviceLink::NsSmartObjects;
+ const char* str = 0;
+ if (EnumConversionHelper<mobile_apis::Language::eType>::EnumToCString(
+ language, &str)) {
+ return str ? str : "";
+ }
+ return std::string();
+}
+
+mobile_apis::Language::eType MessageHelper::MobileLanguageFromString(
+ const std::string& language) {
+ using namespace NsSmartDeviceLink::NsSmartObjects;
+ mobile_apis::Language::eType value;
+ if (EnumConversionHelper<mobile_apis::Language::eType>::StringToEnum(
+ language, &value)) {
+ return value;
+ }
+ return mobile_apis::Language::INVALID_ENUM;
+}
+
+hmi_apis::Common_Language::eType MessageHelper::MobileToCommonLanguage(
+ const mobile_apis::Language::eType language) {
+ const std::string result = MobileLanguageToString(language);
+ if (result.empty()) {
+ return hmi_apis::Common_Language::INVALID_ENUM;
+ }
+ return CommonLanguageFromString(result);
+}
+
+mobile_apis::Language::eType MessageHelper::CommonToMobileLanguage(
+ const hmi_apis::Common_Language::eType language) {
+ const std::string result = CommonLanguageToString(language);
+ if (result.empty()) {
+ return mobile_api::Language::INVALID_ENUM;
+ }
+ return MobileLanguageFromString(result);
+}
+
uint32_t MessageHelper::GetAppCommandLimit(const std::string& policy_app_id) {
std::string priority;
policy::PolicyHandler::instance()->GetPriority(policy_app_id, &priority);