diff options
author | Alexander Kutsan <AKutsan@luxoft.com> | 2016-08-26 18:48:22 +0300 |
---|---|---|
committer | Alexander Kutsan <AKutsan@luxoft.com> | 2016-08-26 18:48:57 +0300 |
commit | d73e6dc8724c5799fae14efd4dcb214af74e4904 (patch) | |
tree | 9ebed8b422490c4d669e90e70783e4f5b55b65c9 /src/components/application_manager/src/commands/hmi/on_vr_command_notification.cc | |
parent | c201c11a35d360c0b96f36b103a2590bfaeb6026 (diff) | |
parent | 61ef8c42badb879216f53d240e1101b9f83a9bb7 (diff) | |
download | sdl_core-d73e6dc8724c5799fae14efd4dcb214af74e4904.tar.gz |
Merge branch 'release/4.1.0'
Diffstat (limited to 'src/components/application_manager/src/commands/hmi/on_vr_command_notification.cc')
-rw-r--r-- | src/components/application_manager/src/commands/hmi/on_vr_command_notification.cc | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/components/application_manager/src/commands/hmi/on_vr_command_notification.cc b/src/components/application_manager/src/commands/hmi/on_vr_command_notification.cc index f8f9b4dfad..c609e2dc0a 100644 --- a/src/components/application_manager/src/commands/hmi/on_vr_command_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_vr_command_notification.cc @@ -31,9 +31,11 @@ */ #include "application_manager/commands/hmi/on_vr_command_notification.h" -#include "application_manager/application_manager_impl.h" + +#include "application_manager/policies/policy_handler.h" #include "application_manager/message_helper.h" -#include "config_profile/profile.h" +#include "application_manager/state_controller.h" + #include "interfaces/MOBILE_API.h" #include "interfaces/HMI_API.h" #include "application_manager/event_engine/event.h" @@ -43,29 +45,28 @@ namespace application_manager { namespace commands { OnVRCommandNotification::OnVRCommandNotification( - const MessageSharedPtr& message) - : NotificationFromHMI(message) { -} + const MessageSharedPtr& message, ApplicationManager& application_manager) + : NotificationFromHMI(message, application_manager) {} -OnVRCommandNotification::~OnVRCommandNotification() { -} +OnVRCommandNotification::~OnVRCommandNotification() {} void OnVRCommandNotification::Run() { LOG4CXX_AUTO_TRACE(logger_); - - ApplicationSharedPtr active_app = ApplicationManagerImpl::instance() - ->active_application(); - const uint32_t cmd_id = (*message_)[strings::msg_params][strings::cmd_id] - .asUInt(); - uint32_t max_cmd_id = profile::Profile::instance()->max_cmd_id(); + const uint32_t cmd_id = + (*message_)[strings::msg_params][strings::cmd_id].asUInt(); + uint32_t max_cmd_id = application_manager_.get_settings().max_cmd_id(); // Check if this is one of standart VR commands (i.e. "Help") if (cmd_id > max_cmd_id + 1) { LOG4CXX_INFO(logger_, "Switched App"); const uint32_t app_id = cmd_id - max_cmd_id; - ApplicationManagerImpl::instance()->SetState<true>(app_id, - mobile_apis::HMILevel::HMI_FULL - ); + ApplicationSharedPtr app = application_manager_.application(app_id); + if (app) { + application_manager_.state_controller().SetRegularState( + app, mobile_apis::HMILevel::HMI_FULL, true); + } else { + LOG4CXX_ERROR(logger_, "Unable to find appication " << app_id); + } return; } @@ -73,9 +74,9 @@ void OnVRCommandNotification::Run() { if (cmd_id == max_cmd_id + 1) { return; } - const uint32_t app_id = (*message_)[strings::msg_params][strings::app_id] - .asUInt(); - ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(app_id); + const uint32_t app_id = + (*message_)[strings::msg_params][strings::app_id].asUInt(); + ApplicationSharedPtr app = application_manager_.application(app_id); if (!app) { LOG4CXX_ERROR(logger_, "NULL pointer"); return; @@ -87,7 +88,7 @@ void OnVRCommandNotification::Run() { if (0 != app->is_perform_interaction_active()) { event_engine::Event event(hmi_apis::FunctionID::VR_OnCommand); event.set_smart_object(*message_); - event.raise(); + event.raise(application_manager_.event_dispatcher()); } else { (*message_)[strings::params][strings::function_id] = static_cast<int32_t>(mobile_apis::FunctionID::eType::OnCommandID); @@ -101,4 +102,3 @@ void OnVRCommandNotification::Run() { } // namespace commands } // namespace application_manager - |