summaryrefslogtreecommitdiff
path: root/src/components/application_manager/src/commands/hmi/on_vr_language_change_notification.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/application_manager/src/commands/hmi/on_vr_language_change_notification.cc')
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vr_language_change_notification.cc41
1 files changed, 20 insertions, 21 deletions
diff --git a/src/components/application_manager/src/commands/hmi/on_vr_language_change_notification.cc b/src/components/application_manager/src/commands/hmi/on_vr_language_change_notification.cc
index 9a146c19e7..bbdb55cde6 100644
--- a/src/components/application_manager/src/commands/hmi/on_vr_language_change_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_vr_language_change_notification.cc
@@ -31,8 +31,9 @@
*/
#include "application_manager/commands/hmi/on_vr_language_change_notification.h"
-#include "application_manager/application_manager_impl.h"
+
#include "application_manager/application_impl.h"
+#include "application_manager/state_controller.h"
#include "application_manager/message_helper.h"
#include "interfaces/MOBILE_API.h"
@@ -41,18 +42,15 @@ namespace application_manager {
namespace commands {
OnVRLanguageChangeNotification::OnVRLanguageChangeNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
-OnVRLanguageChangeNotification::~OnVRLanguageChangeNotification() {
-}
+OnVRLanguageChangeNotification::~OnVRLanguageChangeNotification() {}
void OnVRLanguageChangeNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- HMICapabilities& hmi_capabilities =
- ApplicationManagerImpl::instance()->hmi_capabilities();
+ HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities();
hmi_capabilities.set_active_vr_language(
static_cast<hmi_apis::Common_Language::eType>(
@@ -64,23 +62,25 @@ void OnVRLanguageChangeNotification::Run() {
(*message_)[strings::params][strings::function_id] =
static_cast<int32_t>(mobile_apis::FunctionID::OnLanguageChangeID);
- ApplicationManagerImpl::ApplicationListAccessor accessor;
+ const ApplicationSet& accessor =
+ application_manager_.applications().GetData();
- ApplicationManagerImpl::ApplictionSetIt it = accessor.begin();
+ ApplicationSetConstIt it = accessor.begin();
for (; accessor.end() != it;) {
ApplicationSharedPtr app = *it++;
(*message_)[strings::params][strings::connection_key] = app->app_id();
SendNotificationToMobile(message_);
- if (static_cast<int32_t>(app->language())
- != (*message_)[strings::msg_params][strings::language].asInt()) {
-
- ApplicationManagerImpl::instance()->SetState<false>(app->app_id(),
- mobile_api::HMILevel::HMI_NONE);
-
- MessageHelper::SendOnAppInterfaceUnregisteredNotificationToMobile(
- app->app_id(),
- mobile_api::AppInterfaceUnregisteredReason::LANGUAGE_CHANGE);
- ApplicationManagerImpl::instance()->UnregisterApplication(
+ if (static_cast<int32_t>(app->language()) !=
+ (*message_)[strings::msg_params][strings::language].asInt()) {
+ application_manager_.state_controller().SetRegularState(
+ app, mobile_api::HMILevel::HMI_NONE, false);
+
+ application_manager_.ManageMobileCommand(
+ MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile(
+ app->app_id(),
+ mobile_api::AppInterfaceUnregisteredReason::LANGUAGE_CHANGE),
+ commands::Command::ORIGIN_SDL);
+ application_manager_.UnregisterApplication(
app->app_id(), mobile_apis::Result::SUCCESS, false);
}
}
@@ -89,4 +89,3 @@ void OnVRLanguageChangeNotification::Run() {
} // namespace commands
} // namespace application_manager
-