From 4d5c0a7f0876743fdb41c0990faa2cd0b913efc4 Mon Sep 17 00:00:00 2001 From: Polina Vyshnevska Date: Thu, 10 Apr 2014 10:41:26 +0300 Subject: [PATCH] Fixed OnSystemRequest --- src/components/HMI/ffw/BasicCommunicationRPC.js | 6 +++--- .../commands/hmi/on_system_request_notification.cc | 20 +++++++++++++------- src/components/policy | 2 +- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/components/HMI/ffw/BasicCommunicationRPC.js b/src/components/HMI/ffw/BasicCommunicationRPC.js index beef41b..9905a28 100644 --- a/src/components/HMI/ffw/BasicCommunicationRPC.js +++ b/src/components/HMI/ffw/BasicCommunicationRPC.js @@ -1078,7 +1078,7 @@ FFW.BasicCommunication = FFW.RPCObserver /** * Initiated by HMI. */ - OnSystemRequest: function(type, appID, fileName, utl) { + OnSystemRequest: function(type, appID, fileName, url) { Em.Logger.log("FFW.BasicCommunication.OnSystemRequest"); @@ -1089,13 +1089,13 @@ FFW.BasicCommunication = FFW.RPCObserver "method": "BasicCommunication.OnSystemRequest", "params":{ "requestType": type, - "url": ["http://127.0.0.1"], + "url": url, "fileType": "JSON", "offset": 1000, "length": 10000, "timeout": 500, "fileName": fileName ? fileName : document.location.pathname.replace("index.html", "IVSU/PROPRIETARY_REQUEST"), - "appID": SDL.SDLAppController.model ? SDL.SDLAppController.model.appID : null + "appID": appID ? appID : "default" } }; this.client.send(JSONMessage); diff --git a/src/components/application_manager/src/commands/hmi/on_system_request_notification.cc b/src/components/application_manager/src/commands/hmi/on_system_request_notification.cc index cd904aa..b0977dc 100644 --- a/src/components/application_manager/src/commands/hmi/on_system_request_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_system_request_notification.cc @@ -44,8 +44,8 @@ namespace application_manager { namespace commands { OnSystemRequestNotification::OnSystemRequestNotification( - const MessageSharedPtr& message) - : NotificationFromHMI(message) { + const MessageSharedPtr& message) + : NotificationFromHMI(message) { } OnSystemRequestNotification::~OnSystemRequestNotification() { @@ -58,7 +58,7 @@ void OnSystemRequestNotification::Run() { smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; params[strings::function_id] = - static_cast(mobile_apis::FunctionID::eType::OnSystemRequestID); + static_cast(mobile_apis::FunctionID::eType::OnSystemRequestID); std::string app_id = msg_params[strings::app_id].asString(); @@ -67,18 +67,24 @@ void OnSystemRequestNotification::Run() { int32_t selected_app_id = policy_handler->GetAppIdForSending(); if (0 == selected_app_id) { LOG4CXX_WARN(logger_, - "Can't select application to forward OnSystemRequestNotification"); + "Can't select application to forward OnSystemRequestNotification"); return; } ApplicationManagerImpl* app_mgr = ApplicationManagerImpl::instance(); ApplicationSharedPtr selected_app = app_mgr->application(selected_app_id); - if(!selected_app.valid()) { + if (!selected_app.valid()) { LOG4CXX_ERROR(logger_, "PolicyHandler selected invalid app_id"); return; } - params[strings::connection_key] = static_cast(selected_app_id); + params[strings::connection_key] = selected_app_id; } else { - params[strings::connection_key] = app_id; + ApplicationSharedPtr app = + ApplicationManagerImpl::instance()->application_by_policy_id(app_id); + if (!app.valid()) { + LOG4CXX_WARN(logger_, "Application with such id is not yet registered."); + return; + } + params[strings::connection_key] = app->app_id(); } SendNotificationToMobile(message_); diff --git a/src/components/policy b/src/components/policy index 9642144..e6453c7 160000 --- a/src/components/policy +++ b/src/components/policy @@ -1 +1 @@ -Subproject commit 96421443794ee47efcbfc808627f769f39467a05 +Subproject commit e6453c78aea88ae6463e2bc412ebbc56cf2fa8a3 -- 2.7.4