APPLINK-6609. OnSystemInfoChanged info saving to policy table was added.
authorAndrey Oleynik <AOleynik@luxoft.com>
Wed, 9 Apr 2014 09:13:16 +0000 (12:13 +0300)
committerJustin Dickow <jjdickow@gmail.com>
Wed, 9 Jul 2014 18:08:16 +0000 (14:08 -0400)
src/components/application_manager/include/application_manager/policies/policy_handler.h
src/components/application_manager/src/hmi_command_factory.cc
src/components/application_manager/src/message_helper.cc
src/components/application_manager/src/policies/policy_handler.cc
src/components/hmi_message_handler/src/messagebroker_adapter.cc
src/components/policy

index 83382b8..93cc880 100644 (file)
@@ -172,6 +172,12 @@ class PolicyHandler : public utils::Singleton<PolicyHandler>,
   void OnCurrentDeviceIdUpdateRequired(const std::string& policy_app_id);
 
   /**
+   * @brief Set parameters from OnSystemInfoChanged to policy table
+   * @param language System language
+   */
+  void OnSystemInfoChanged(const std::string& language);
+
+  /**
    * Adds statistics info
    * @param type type of info
    */
index 14ad5aa..cc1ce09 100644 (file)
@@ -68,6 +68,7 @@
 #include "application_manager/commands/hmi/on_exit_application_notification.h"
 #include "application_manager/commands/hmi/on_put_file_notification.h"
 #include "application_manager/commands/hmi/on_ignition_cycle_over_notification.h"
+#include "application_manager/commands/hmi/on_system_info_changed_notification.h"
 #include "application_manager/commands/hmi/close_popup_request.h"
 #include "application_manager/commands/hmi/close_popup_response.h"
 #include "application_manager/commands/hmi/button_get_capabilities_request.h"
@@ -1057,6 +1058,10 @@ CommandSharedPtr HMICommandFactory::CreateCommand(
       command.reset(new commands::OnIgnitionCycleOverNotification(message));
       break;
     }
+    case hmi_apis::FunctionID::BasicCommunication_OnSystemInfoChanged: {
+      command.reset(new commands::OnSystemInfoChangedNotification(message));
+      break;
+    }
     case hmi_apis::FunctionID::BasicCommunication_PlayTone: {
       command.reset(new commands::OnPlayToneNotification(message));
       break;
index d8b692d..929c320 100644 (file)
@@ -67,7 +67,7 @@ hmi_apis::Common_Language::eType ToCommonLanguage(
   return hmi_apis::Common_Language::eType(lang_val);
 }
 
-}
+} // namespase
 
 namespace application_manager {
 
@@ -169,6 +169,62 @@ namespace {
 }
 #endif // #ifdef HMI_DBUS_API
 
+std::string MessageHelper::CommonLanguageToString(
+    hmi_apis::Common_Language::eType language) {
+  switch (language) {
+  case hmi_apis::Common_Language::EN_US:
+    return "en-us";
+  case hmi_apis::Common_Language::ES_MX:
+    return "es-mx";
+  case hmi_apis::Common_Language::FR_CA:
+    return "fr-ca";
+  case hmi_apis::Common_Language::DE_DE:
+    return "de-de";
+  case hmi_apis::Common_Language::ES_ES:
+    return "es-es";
+  case hmi_apis::Common_Language::EN_GB:
+    return "en-gb";
+  case hmi_apis::Common_Language::RU_RU:
+    return "ru-ru";
+  case hmi_apis::Common_Language::TR_TR:
+    return "tr-tr";
+  case hmi_apis::Common_Language::PL_PL:
+    return "pl-pl";
+  case hmi_apis::Common_Language::FR_FR:
+    return "fr-fr";
+  case hmi_apis::Common_Language::IT_IT:
+    return "it-it";
+  case hmi_apis::Common_Language::SV_SE:
+    return "sv-se";
+  case hmi_apis::Common_Language::PT_PT:
+    return "pt-pt";
+  case hmi_apis::Common_Language::NL_NL:
+    return "nl-nl";
+  case hmi_apis::Common_Language::EN_AU:
+    return "en-au";
+  case hmi_apis::Common_Language::ZH_CN:
+    return "zh-cn";
+  case hmi_apis::Common_Language::ZH_TW:
+    return "zh-tw";
+  case hmi_apis::Common_Language::JA_JP:
+    return "ja-jp";
+  case hmi_apis::Common_Language::AR_SA:
+    return "as-sa";
+  case hmi_apis::Common_Language::KO_KR:
+    return "ko-kr";
+  case hmi_apis::Common_Language::PT_BR:
+    return "pt-br";
+  case hmi_apis::Common_Language::CS_CZ:
+    return "cs-cz";
+  case hmi_apis::Common_Language::DA_DK:
+    return "da-dk";
+  case hmi_apis::Common_Language::NO_NO:
+    return "no-no";
+  default:
+    return "";
+  }
+}
+
 void MessageHelper::SendHMIStatusNotification(
     const Application& application_impl) {
   smart_objects::SmartObject* notification = new smart_objects::SmartObject;
index 66ab2aa..a8a2d32 100644 (file)
@@ -318,6 +318,11 @@ void PolicyHandler::OnCurrentDeviceIdUpdateRequired(
   policy_manager_->UpdateCurrentDeviceId(device_param.device_mac_address);
 }
 
+void PolicyHandler::OnSystemInfoChanged(const std::string& language) {
+  LOG4CXX_INFO(logger_, "OnSystemInfoChanged");
+  policy_manager_->SetSystemLanguage(language);
+}
+
 void PolicyHandler::OnAppRevoked(const std::string& policy_app_id) {
   LOG4CXX_INFO(logger_, "OnAppRevoked");
   if (!policy_manager_) {
index 410852f..5b395ef 100644 (file)
@@ -124,6 +124,7 @@ void MessageBrokerAdapter::SubscribeTo() {
   MessageBrokerController::subscribeTo("VR.Stopped");
   MessageBrokerController::subscribeTo("BasicCommunication.OnSystemRequest");
   MessageBrokerController::subscribeTo("BasicCommunication.OnIgnitionCycleOver");
+  MessageBrokerController::subscribeTo("BasicCommunication.OnSystemInfoChanged");
   MessageBrokerController::subscribeTo("SDL.OnAppPermissionConsent");
   MessageBrokerController::subscribeTo("SDL.OnAllowSDLFunctionality");
 
index 2cbcce5..dcb8e5a 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 2cbcce5076e817009906a60de69474fc43352460
+Subproject commit dcb8e5a81ee4dbd771f5c3142a5c60132e12f608