summaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
authorAndriy Byzhynar <abyzhynar@luxoft.com>2019-07-10 19:08:31 +0300
committerAndriy Byzhynar (GitHub) <AByzhynar@luxoft.com>2019-08-20 21:17:13 +0300
commit721b317ff9859b6a340c2ab7bb43c39ef72311e2 (patch)
tree35dd75871dc18be78cc69c91529736c9278351b1 /src/components
parent6e904b19cbc4abc6cd5a5d8049783a4ba42d446c (diff)
downloadsdl_core-721b317ff9859b6a340c2ab7bb43c39ef72311e2.tar.gz
Update OnHMIStatus notification
Diffstat (limited to 'src/components')
-rw-r--r--src/components/application_manager/include/application_manager/application_manager_impl.h3
-rw-r--r--src/components/application_manager/include/application_manager/message_helper.h7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc12
-rw-r--r--src/components/application_manager/src/application_manager_impl.cc33
-rw-r--r--src/components/application_manager/src/message_helper/message_helper.cc16
-rw-r--r--src/components/application_manager/src/policies/policy_handler.cc10
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_message_helper.h5
-rw-r--r--src/components/application_manager/test/mock_message_helper.cc5
-rw-r--r--src/components/include/application_manager/application_manager.h9
10 files changed, 40 insertions, 66 deletions
diff --git a/src/components/application_manager/include/application_manager/application_manager_impl.h b/src/components/application_manager/include/application_manager/application_manager_impl.h
index 9b26d7b599..711e9b424f 100644
--- a/src/components/application_manager/include/application_manager/application_manager_impl.h
+++ b/src/components/application_manager/include/application_manager/application_manager_impl.h
@@ -203,9 +203,6 @@ class ApplicationManagerImpl
mobile_apis::HMILevel::eType from,
mobile_apis::HMILevel::eType to) OVERRIDE;
- void SendHMIStatusNotification(
- const std::shared_ptr<Application> app) OVERRIDE;
-
void SendDriverDistractionState(ApplicationSharedPtr application);
void SendGetIconUrlNotifications(const uint32_t connection_key,
diff --git a/src/components/application_manager/include/application_manager/message_helper.h b/src/components/application_manager/include/application_manager/message_helper.h
index 98992a20d5..ab94d69083 100644
--- a/src/components/application_manager/include/application_manager/message_helper.h
+++ b/src/components/application_manager/include/application_manager/message_helper.h
@@ -864,10 +864,13 @@ class MessageHelper {
/**
* @brief Sends HMI status notification to mobile
- * @param application_impl application with changed HMI status
+ * @param application application with changed HMI status
+ * @param window_id id of affected window
+ * @param application_manager reference to application manager
**/
static void SendHMIStatusNotification(
- const Application& application_impl,
+ ApplicationSharedPtr application,
+ const WindowID window_id,
ApplicationManager& application_manager);
/**
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h
index c894b355d6..c55dcb65fc 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h
@@ -126,7 +126,7 @@ class RegisterAppInterfaceRequest
*
* @param app application with changed HMI status
* @param resumption If true, resumption-related parameters will be sent to
- *the HMI
+ * the HMI
* @param need_restore_vr If resumption is true, whether or not VR commands
*should be resumed
**/
@@ -207,8 +207,8 @@ class RegisterAppInterfaceRequest
void SendSubscribeCustomButtonNotification();
/**
- * @brief IsApplicationSwitched checks whether application is switched from
- * another transport. If application id is found, but not in reconnection
+ * @brief IsApplicationSwitched checks whether application is switched
+ * from another transport. If application id is found, but not in reconnection
* list, returns 'already registered' code. Otherwise - proceed with
* switching.
* @return True if application is detected as switched, otherwise false.
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc
index 26bfbf3399..a772e24513 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc
@@ -1346,13 +1346,12 @@ void RegisterAppInterfaceRequest::CheckResponseVehicleTypeParam(
void RegisterAppInterfaceRequest::SendSubscribeCustomButtonNotification() {
using namespace smart_objects;
- using namespace hmi_apis;
-
SmartObject msg_params = SmartObject(SmartType_Map);
msg_params[strings::app_id] = connection_key();
- msg_params[strings::name] = Common_ButtonName::CUSTOM_BUTTON;
+ msg_params[strings::name] = hmi_apis::Common_ButtonName::CUSTOM_BUTTON;
msg_params[strings::is_suscribed] = true;
- CreateHMINotification(FunctionID::Buttons_OnButtonSubscription, msg_params);
+ CreateHMINotification(hmi_apis::FunctionID::Buttons_OnButtonSubscription,
+ msg_params);
}
bool RegisterAppInterfaceRequest::IsApplicationSwitched() {
@@ -1397,7 +1396,10 @@ bool RegisterAppInterfaceRequest::IsApplicationSwitched() {
application_manager_.ProcessReconnection(app, connection_key());
SendRegisterAppInterfaceResponseToMobile(app_type);
- application_manager_.SendHMIStatusNotification(app);
+ MessageHelper::SendHMIStatusNotification(
+ app,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ application_manager_);
application_manager_.OnApplicationSwitched(app);
diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc
index 7814b58a35..4cc8fdceda 100644
--- a/src/components/application_manager/src/application_manager_impl.cc
+++ b/src/components/application_manager/src/application_manager_impl.cc
@@ -3390,39 +3390,6 @@ void ApplicationManagerImpl::ProcessApp(const uint32_t app_id,
}
}
-void ApplicationManagerImpl::SendHMIStatusNotification(
- const std::shared_ptr<Application> app) {
- LOG4CXX_AUTO_TRACE(logger_);
- DCHECK_OR_RETURN_VOID(app);
- smart_objects::SmartObjectSPtr notification =
- std::make_shared<smart_objects::SmartObject>();
- smart_objects::SmartObject& message = *notification;
-
- message[strings::params][strings::function_id] =
- static_cast<int32_t>(mobile_api::FunctionID::OnHMIStatusID);
-
- message[strings::params][strings::message_type] =
- static_cast<int32_t>(application_manager::MessageType::kNotification);
-
- message[strings::params][strings::connection_key] =
- static_cast<int32_t>(app->app_id());
-
- message[strings::msg_params][strings::hmi_level] =
- static_cast<int32_t>(app->hmi_level());
-
- message[strings::msg_params][strings::audio_streaming_state] =
- static_cast<int32_t>(app->audio_streaming_state());
-
- message[strings::msg_params][strings::video_streaming_state] =
- static_cast<int32_t>(app->video_streaming_state());
-
- message[strings::msg_params][strings::system_context] =
- static_cast<int32_t>(app->system_context());
-
- rpc_service_->ManageMobileCommand(notification,
- commands::Command::SOURCE_SDL);
-}
-
void ApplicationManagerImpl::ClearTimerPool() {
LOG4CXX_AUTO_TRACE(logger_);
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 7512eb2e67..97948d9a8c 100644
--- a/src/components/application_manager/src/message_helper/message_helper.cc
+++ b/src/components/application_manager/src/message_helper/message_helper.cc
@@ -772,7 +772,8 @@ hmi_apis::Common_Result::eType MessageHelper::MobileToHMIResult(
}
void MessageHelper::SendHMIStatusNotification(
- const Application& application_impl,
+ ApplicationSharedPtr application,
+ const WindowID window_id,
ApplicationManager& application_manager) {
LOG4CXX_AUTO_TRACE(logger_);
smart_objects::SmartObjectSPtr notification =
@@ -790,16 +791,21 @@ void MessageHelper::SendHMIStatusNotification(
static_cast<int32_t>(application_manager::MessageType::kNotification);
message[strings::params][strings::connection_key] =
- static_cast<int32_t>(application_impl.app_id());
+ static_cast<int32_t>(application->app_id());
+
+ message[strings::msg_params][strings::window_id] = window_id;
message[strings::msg_params][strings::hmi_level] =
- static_cast<int32_t>(application_impl.hmi_level());
+ static_cast<int32_t>(application->hmi_level(window_id));
message[strings::msg_params][strings::audio_streaming_state] =
- static_cast<int32_t>(application_impl.audio_streaming_state());
+ static_cast<int32_t>(application->audio_streaming_state());
+
+ message[strings::msg_params][strings::video_streaming_state] =
+ static_cast<int32_t>(application->video_streaming_state());
message[strings::msg_params][strings::system_context] =
- static_cast<int32_t>(application_impl.system_context());
+ static_cast<int32_t>(application->system_context(window_id));
application_manager.GetRPCService().ManageMobileCommand(
notification, commands::Command::SOURCE_SDL);
diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc
index 3db438380a..b4a96f73e7 100644
--- a/src/components/application_manager/src/policies/policy_handler.cc
+++ b/src/components/application_manager/src/policies/policy_handler.cc
@@ -2295,7 +2295,10 @@ void PolicyHandler::UpdateHMILevel(ApplicationSharedPtr app,
// Set application hmi level
application_manager_.ChangeAppsHMILevel(app->app_id(), level);
// If hmi Level is full, it will be seted after ActivateApp response
- MessageHelper::SendHMIStatusNotification(*app, application_manager_);
+ MessageHelper::SendHMIStatusNotification(
+ app,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ application_manager_);
}
}
}
@@ -2338,7 +2341,10 @@ void PolicyHandler::OnUpdateHMIStatus(const std::string& device_id,
<< app->app_id() << " to default hmi level " << level);
// Set application hmi level
application_manager_.ChangeAppsHMILevel(app->app_id(), level);
- MessageHelper::SendHMIStatusNotification(*app, application_manager_);
+ MessageHelper::SendHMIStatusNotification(
+ app,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ application_manager_);
}
bool PolicyHandler::GetModuleTypes(const std::string& policy_app_id,
diff --git a/src/components/application_manager/test/include/application_manager/mock_message_helper.h b/src/components/application_manager/test/include/application_manager/mock_message_helper.h
index 29afd36e52..8287e77a6f 100644
--- a/src/components/application_manager/test/include/application_manager/mock_message_helper.h
+++ b/src/components/application_manager/test/include/application_manager/mock_message_helper.h
@@ -128,8 +128,9 @@ class MockMessageHelper {
MOCK_METHOD2(CreateMessageForHMI,
smart_objects::SmartObjectSPtr(hmi_apis::messageType::eType,
const uint32_t));
- MOCK_METHOD2(SendHMIStatusNotification,
- void(const Application& application_impl,
+ MOCK_METHOD3(SendHMIStatusNotification,
+ void(ApplicationSharedPtr application,
+ const WindowID window_id,
ApplicationManager& application_manager));
MOCK_METHOD4(SendPolicyUpdate,
void(const std::string& file_path,
diff --git a/src/components/application_manager/test/mock_message_helper.cc b/src/components/application_manager/test/mock_message_helper.cc
index 3284224237..ce022f956b 100644
--- a/src/components/application_manager/test/mock_message_helper.cc
+++ b/src/components/application_manager/test/mock_message_helper.cc
@@ -258,10 +258,11 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateMessageForHMI(
}
void MessageHelper::SendHMIStatusNotification(
- const Application& application_impl,
+ ApplicationSharedPtr application,
+ const WindowID window_id,
ApplicationManager& application_manager) {
MockMessageHelper::message_helper_mock()->SendHMIStatusNotification(
- application_impl, application_manager);
+ application, window_id, application_manager);
}
void MessageHelper::SendUpdateSDLResponse(const std::string& result,
diff --git a/src/components/include/application_manager/application_manager.h b/src/components/include/application_manager/application_manager.h
index e03fdcfb94..022c46615e 100644
--- a/src/components/include/application_manager/application_manager.h
+++ b/src/components/include/application_manager/application_manager.h
@@ -281,15 +281,6 @@ class ApplicationManager {
mobile_apis::HMILevel::eType to) = 0;
/**
- * @brief Sends HMI status notification to mobile
- *
- * @param application_impl application with changed HMI status
- *
- **/
- virtual void SendHMIStatusNotification(
- const std::shared_ptr<Application> app) = 0;
-
- /**
* @brief Checks if driver distraction state is valid, creates message
* which is sent to the application if allowed, otherwise it is added
* to a list of postponed messages.