summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Boltovskiy <dboltovskyi@luxoft.com>2020-12-28 10:36:57 -0500
committerDmitriy Boltovskiy <dboltovskyi@luxoft.com>2020-12-28 10:36:57 -0500
commit3c72def2f5aac979c5ee28aeabd0c167fdaf5fae (patch)
treeecaa4184fc7ba3b15a652df1d034c630d831537f
parent683106fcbd64b73d375a18ddbaf1bb993f5ff733 (diff)
parent218aee15ea7d37dbca773e09cb391d0d229886d6 (diff)
downloadsdl_core-3c72def2f5aac979c5ee28aeabd0c167fdaf5fae.tar.gz
Merge remote-tracking branch 'smart/develop' into feature/sdl_0255_enhance_bodyInformation_vehicle_data
-rw-r--r--src/appMain/sdl_preloaded_pt.json3
-rw-r--r--src/components/application_manager/include/application_manager/app_service_manager.h7
-rw-r--r--src/components/application_manager/include/application_manager/application_manager_impl.h40
-rw-r--r--src/components/application_manager/include/application_manager/policies/policy_handler.h3
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_app_extension.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_way_point_change_notification_from_mobile.h75
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_interaction_request.h7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_way_points_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_way_points_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_way_point_change_notification.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_request.cc3
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc14
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_way_point_change_notification.cc1
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_way_point_change_notification_from_mobile.cc90
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc79
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_request.cc34
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_request.cc16
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_request.cc35
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc5
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/waypoints_pending_resumption_handler.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/CMakeLists.txt1
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc17
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_way_point_change_notification_test.cc1
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_way_points_request_test.cc7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_way_points_request_test.cc9
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/on_vehicle_data_notification.cc25
-rw-r--r--src/components/application_manager/src/app_service_manager.cc19
-rw-r--r--src/components/application_manager/src/application_manager_impl.cc74
-rw-r--r--src/components/application_manager/src/helpers/application_helper.cc8
-rw-r--r--src/components/application_manager/src/policies/policy_handler.cc21
-rw-r--r--src/components/application_manager/src/resumption/resumption_data_processor_impl.cc7
-rw-r--r--src/components/application_manager/test/application_helper_test.cc6
-rw-r--r--src/components/application_manager/test/application_manager_impl_test.cc12
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_app_service_manager.h1
-rw-r--r--src/components/application_manager/test/policy_handler_test.cc6
-rw-r--r--src/components/application_manager/test/resumption/resume_ctrl_test.cc6
-rw-r--r--src/components/include/application_manager/application_manager.h43
-rw-r--r--src/components/include/test/application_manager/mock_application_manager.h17
-rw-r--r--src/components/policy/policy_external/src/cache_manager.cc28
-rw-r--r--src/components/policy/policy_regular/src/cache_manager.cc3
-rw-r--r--src/components/utils/src/convert_utils.cc1
42 files changed, 566 insertions, 193 deletions
diff --git a/src/appMain/sdl_preloaded_pt.json b/src/appMain/sdl_preloaded_pt.json
index 78965b705b..7561d4e629 100644
--- a/src/appMain/sdl_preloaded_pt.json
+++ b/src/appMain/sdl_preloaded_pt.json
@@ -854,8 +854,7 @@
"hmi_levels": [
"FULL",
"LIMITED",
- "BACKGROUND",
- "NONE"
+ "BACKGROUND"
]
},
"UnpublishAppService": {
diff --git a/src/components/application_manager/include/application_manager/app_service_manager.h b/src/components/application_manager/include/application_manager/app_service_manager.h
index d26598c1e9..94606909c6 100644
--- a/src/components/application_manager/include/application_manager/app_service_manager.h
+++ b/src/components/application_manager/include/application_manager/app_service_manager.h
@@ -215,6 +215,13 @@ class AppServiceManager {
smart_objects::SmartObject& out_params);
/**
+ * @brief Retrieve the active service for handling waypoints if available
+ * @return The active NAVIGATION service if it handles waypoints, nullptr
+ * otherwise
+ */
+ virtual AppService* FindWayPointsHandler();
+
+ /**
* @brief Get the RPCPassingHandler tied to this object
* @return The RPCPassingHandler tied to this object
*/
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 bda1e5f49e..cb3be5fec6 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
@@ -286,32 +286,22 @@ class ApplicationManagerImpl
*/
bool IsAppSubscribedForWayPoints(Application& app) const OVERRIDE;
- void SaveWayPointsMessage(
- smart_objects::SmartObjectSPtr way_points_message) OVERRIDE;
+ void SaveWayPointsMessage(smart_objects::SmartObjectSPtr way_points_message,
+ uint32_t app_id = 0) OVERRIDE;
- /**
- * @brief Subscribe Application for way points
- * @param Application id
- */
- void SubscribeAppForWayPoints(uint32_t app_id) OVERRIDE;
+ void SubscribeAppForWayPoints(uint32_t app_id,
+ bool response_from_hmi = true) OVERRIDE;
- /**
- * @brief Subscribe Application for way points
- * @param Application pointer
- */
- void SubscribeAppForWayPoints(ApplicationSharedPtr app) OVERRIDE;
+ void SubscribeAppForWayPoints(ApplicationSharedPtr app,
+ bool response_from_hmi = true) OVERRIDE;
- /**
- * @brief Unsubscribe Application for way points
- * @param Application id
- */
- void UnsubscribeAppFromWayPoints(uint32_t app_id) OVERRIDE;
+ void UnsubscribeAppFromWayPoints(uint32_t app_id,
+ bool response_from_hmi = true) OVERRIDE;
- /**
- * @brief Unsubscribe Application for way points
- * @param Application pointer
- */
- void UnsubscribeAppFromWayPoints(ApplicationSharedPtr app) OVERRIDE;
+ void UnsubscribeAppFromWayPoints(ApplicationSharedPtr app,
+ bool response_from_hmi = true) OVERRIDE;
+
+ bool IsSubscribedToHMIWayPoints() const OVERRIDE;
/**
* @brief Is Any Application is subscribed for way points
@@ -1562,7 +1552,11 @@ class ApplicationManagerImpl
*/
std::set<uint32_t> subscribed_way_points_apps_list_;
- smart_objects::SmartObjectSPtr way_points_data_;
+ bool subscribed_to_hmi_way_points_;
+
+ smart_objects::SmartObjectSPtr hmi_way_points_data_;
+
+ std::map<uint32_t, smart_objects::SmartObject> mobile_way_points_data_;
/**
* @brief Map contains applications which
diff --git a/src/components/application_manager/include/application_manager/policies/policy_handler.h b/src/components/application_manager/include/application_manager/policies/policy_handler.h
index c123bcc764..61b228d4f8 100644
--- a/src/components/application_manager/include/application_manager/policies/policy_handler.h
+++ b/src/components/application_manager/include/application_manager/policies/policy_handler.h
@@ -812,6 +812,9 @@ class PolicyHandler : public PolicyHandlerInterface,
*/
void LinkAppsToDevice();
+ void SetHeartBeatTimeout(const std::string& policy_app_id,
+ const uint32_t app_id);
+
typedef std::vector<application_manager::ApplicationSharedPtr> Applications;
/**
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_app_extension.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_app_extension.cc
index 3bfad3095b..b9d87d74b1 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_app_extension.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_app_extension.cc
@@ -198,15 +198,13 @@ void RCAppExtension::RevertResumption(
const auto module_subscriptions =
ConvertSmartObjectToModuleCollection(resumption_data);
- for (auto& module : module_subscriptions) {
- SDL_LOG_TRACE("Requested to unsubscribe module_type "
- << module.first << "module_id: " << module.second);
- }
std::set<rc_rpc_plugin::ModuleUid> to_be_unsubscribed;
const auto app_id = application_.app_id();
auto no_apps_subscribed = [app_id,
this](const rc_rpc_plugin::ModuleUid& module) {
+ SDL_LOG_TRACE("Requested to unsubscribe module_type "
+ << module.first << "module_id: " << module.second);
if (plugin_.IsOtherAppsSubscribed(module, app_id)) {
SDL_LOG_DEBUG("Some other app except " << app_id
<< " is already subscribed to "
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_way_point_change_notification_from_mobile.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_way_point_change_notification_from_mobile.h
new file mode 100644
index 0000000000..2ad9a4c0af
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_way_point_change_notification_from_mobile.h
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2018, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_WAY_POINT_CHANGE_NOTIFICATION_FROM_MOBILE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_WAY_POINT_CHANGE_NOTIFICATION_FROM_MOBILE_H_
+
+#include "application_manager/commands/command_notification_from_mobile_impl.h"
+#include "utils/macro.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+class OnWayPointChangeNotificationFromMobile
+ : public app_mngr::commands::CommandNotificationFromMobileImpl {
+ public:
+ /**
+ * @brief OnWayPointChangeNotificationFromMobile class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ OnWayPointChangeNotificationFromMobile(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler);
+
+ /**
+ * @brief OnWayPointChangeNotificationFromMobile class destructor
+ **/
+ virtual ~OnWayPointChangeNotificationFromMobile();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run() OVERRIDE;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(OnWayPointChangeNotificationFromMobile);
+};
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_WAY_POINT_CHANGE_NOTIFICATION_FROM_MOBILE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_interaction_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_interaction_request.h
index 52a0ad4dc1..9d14b248b6 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_interaction_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_interaction_request.h
@@ -128,15 +128,13 @@ class PerformInteractionRequest
* @return true if send response to mobile application otherwise
* return false.
*/
- bool ProcessVRResponse(const smart_objects::SmartObject& message,
- smart_objects::SmartObject& msg_params);
+ bool ProcessVRResponse(const smart_objects::SmartObject& message);
/**
* @brief Sends PerformInteraction response to mobile side
* @param message which should send to mobile side
*/
- void ProcessUIResponse(const smart_objects::SmartObject& message,
- smart_objects::SmartObject& msg_params);
+ void ProcessUIResponse(const smart_objects::SmartObject& message);
/*
* @brief Sends UI PerformInteraction request to HMI
@@ -279,6 +277,7 @@ class PerformInteractionRequest
mobile_apis::InteractionMode::eType interaction_mode_;
std::int32_t ui_choice_id_received_;
std::int32_t vr_choice_id_received_;
+ std::string ui_text_entry_received_;
bool ui_response_received_;
bool vr_response_received_;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_way_points_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_way_points_request.h
index 8b88a1c884..69154d7669 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_way_points_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_way_points_request.h
@@ -76,6 +76,8 @@ class SubscribeWayPointsRequest
*/
bool Init() FINAL;
+ void onTimeOut() FINAL;
+
private:
DISALLOW_COPY_AND_ASSIGN(SubscribeWayPointsRequest);
};
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_way_points_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_way_points_request.h
index e83e9b7509..c4357d7529 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_way_points_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_way_points_request.h
@@ -75,6 +75,8 @@ class UnsubscribeWayPointsRequest
*/
bool Init() FINAL;
+ void onTimeOut() FINAL;
+
private:
DISALLOW_COPY_AND_ASSIGN(UnsubscribeWayPointsRequest);
};
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_way_point_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_way_point_change_notification.cc
index 2440e918b7..02c2ccf31b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_way_point_change_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_way_point_change_notification.cc
@@ -32,6 +32,8 @@
#include "sdl_rpc_plugin/commands/hmi/on_navi_way_point_change_notification.h"
+#include "application_manager/app_service_manager.h"
+
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -56,8 +58,12 @@ void OnNaviWayPointChangeNotification::Run() {
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
static_cast<int32_t>(mobile_apis::FunctionID::OnWayPointChangeID);
+ application_manager_.SaveWayPointsMessage(message_, 0);
- SendNotificationToMobile(message_);
+ if (application_manager_.GetAppServiceManager().FindWayPointsHandler() ==
+ nullptr) {
+ SendNotificationToMobile(message_);
+ }
}
} // namespace commands
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_request.cc
index 47b3a87d52..c2172d5180 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_request.cc
@@ -236,7 +236,8 @@ bool AlertManeuverRequest::PrepareResponseParameters(
application_manager_.hmi_interfaces().GetInterfaceState(
HmiInterfaces::HMI_INTERFACE_TTS)))) {
result_code = mobile_apis::Result::WARNINGS;
- return_info = std::string("Unsupported phoneme type sent in a prompt");
+ return_info = app_mngr::commands::MergeInfos(
+ navigation_alert_info, info_navi_, tts_alert_info, info_tts_);
return result;
}
result_code =
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc
index cfd3106f4d..9f04541b46 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc
@@ -213,19 +213,10 @@ bool AlertRequest::PrepareResponseParameters(
bool result = PrepareResultForMobileResponse(ui_alert_info, tts_alert_info);
- /* result=false if UI interface is ok and TTS interface = UNSUPPORTED_RESOURCE
- * and sdl receive TTS.IsReady=true or SDL doesn't receive responce for
- * TTS.IsReady.
- */
- if (result && ui_alert_info.is_ok && tts_alert_info.is_unsupported_resource &&
- HmiInterfaces::STATE_NOT_AVAILABLE != tts_alert_info.interface_state) {
- result = false;
- }
result_code = mobile_apis::Result::WARNINGS;
if ((ui_alert_info.is_ok || ui_alert_info.is_not_used) &&
tts_alert_info.is_unsupported_resource &&
HmiInterfaces::STATE_AVAILABLE == tts_alert_info.interface_state) {
- tts_response_info_ = "Unsupported phoneme type sent in a prompt";
info = app_mngr::commands::MergeInfos(
ui_alert_info, ui_response_info_, tts_alert_info, tts_response_info_);
return result;
@@ -234,7 +225,10 @@ bool AlertRequest::PrepareResponseParameters(
info = app_mngr::commands::MergeInfos(
ui_alert_info, ui_response_info_, tts_alert_info, tts_response_info_);
// Mobile Alert request is successful when UI_Alert is successful
- if (is_ui_alert_sent_ && !ui_alert_info.is_ok) {
+ bool has_unsupported_data =
+ ui_alert_info.is_unsupported_resource &&
+ HmiInterfaces::STATE_NOT_AVAILABLE != ui_alert_info.interface_state;
+ if (is_ui_alert_sent_ && !ui_alert_info.is_ok && !has_unsupported_data) {
return false;
}
return result;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_way_point_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_way_point_change_notification.cc
index 33413f805d..4aa0d9c630 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_way_point_change_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_way_point_change_notification.cc
@@ -67,7 +67,6 @@ void OnWayPointChangeNotification::Run() {
(*message_)[strings::params][strings::connection_key] = *app_id;
SendNotification();
}
- application_manager_.SaveWayPointsMessage(message_);
}
} // namespace commands
} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_way_point_change_notification_from_mobile.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_way_point_change_notification_from_mobile.cc
new file mode 100644
index 0000000000..ad1b0c7ef7
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_way_point_change_notification_from_mobile.cc
@@ -0,0 +1,90 @@
+/*
+ Copyright (c) 2020, Ford Motor Company
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "sdl_rpc_plugin/commands/mobile/on_way_point_change_notification_from_mobile.h"
+
+#include "application_manager/app_service_manager.h"
+#include "application_manager/message.h"
+#include "application_manager/message_helper.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+SDL_CREATE_LOG_VARIABLE("Commands")
+
+OnWayPointChangeNotificationFromMobile::OnWayPointChangeNotificationFromMobile(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandNotificationFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+OnWayPointChangeNotificationFromMobile::
+ ~OnWayPointChangeNotificationFromMobile() {}
+
+void OnWayPointChangeNotificationFromMobile::Run() {
+ SDL_LOG_AUTO_TRACE();
+
+ (*message_)[strings::params][strings::message_type] =
+ static_cast<int32_t>(application_manager::MessageType::kNotification);
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
+
+ if (app.use_count() == 0) {
+ SDL_LOG_ERROR(
+ "OnWayPointChangeNotificationFromMobile application doesn't exist");
+ return;
+ }
+
+ auto service =
+ application_manager_.GetAppServiceManager().FindWayPointsHandler();
+ if (!service || !service->mobile_service ||
+ service->connection_key != connection_key()) {
+ SDL_LOG_ERROR("Application is not active NAVIGATION ASP");
+ return;
+ }
+
+ application_manager_.SaveWayPointsMessage(message_, connection_key());
+
+ (*message_)[strings::params][strings::message_type] =
+ static_cast<int32_t>(application_manager::MessageType::kNotification);
+ rpc_service_.ManageMobileCommand(message_, SOURCE_SDL);
+}
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc
index 5918c05f2d..0accdd1e76 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc
@@ -224,20 +224,17 @@ PerformAudioPassThruRequest::PrepareResponseParameters() {
HmiInterfaces::HMI_INTERFACE_TTS,
application_manager_);
- // Note(dtrunov): According to requirment "WARNINGS, success:true on getting
- // UNSUPPORTED_RESOURCE for "ttsChunks"
+ response_params_.success =
+ PrepareResultForMobileResponse(ui_perform_info, tts_perform_info);
if (ui_perform_info.is_ok && tts_perform_info.is_unsupported_resource &&
HmiInterfaces::STATE_AVAILABLE == tts_perform_info.interface_state) {
response_params_.result_code = mobile_apis::Result::WARNINGS;
- tts_info_ = "Unsupported phoneme type sent in a prompt";
response_params_.info = app_mngr::commands::MergeInfos(
ui_perform_info, ui_info_, tts_perform_info, tts_info_);
response_params_.success = true;
return response_params_;
}
- response_params_.success =
- PrepareResultForMobileResponse(ui_perform_info, tts_perform_info);
if (IsResultCodeUnsupported(ui_perform_info, tts_perform_info)) {
response_params_.result_code = mobile_apis::Result::UNSUPPORTED_RESOURCE;
} else {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc
index a3269847a1..5d3b203afe 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc
@@ -253,7 +253,7 @@ void PerformInteractionRequest::on_event(const event_engine::Event& event) {
ui_result_code_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asUInt());
GetInfo(message, ui_info_);
- ProcessUIResponse(event.smart_object(), response_msg_params);
+ ProcessUIResponse(event.smart_object());
break;
}
case hmi_apis::FunctionID::VR_PerformInteraction: {
@@ -265,7 +265,7 @@ void PerformInteractionRequest::on_event(const event_engine::Event& event) {
vr_result_code_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asUInt());
GetInfo(message, vr_info_);
- if (ProcessVRResponse(event.smart_object(), response_msg_params)) {
+ if (ProcessVRResponse(event.smart_object())) {
return;
}
break;
@@ -328,8 +328,7 @@ void PerformInteractionRequest::onTimeOut() {
}
bool PerformInteractionRequest::ProcessVRResponse(
- const smart_objects::SmartObject& message,
- smart_objects::SmartObject& msg_params) {
+ const smart_objects::SmartObject& message) {
SDL_LOG_AUTO_TRACE();
using namespace hmi_apis;
using namespace mobile_apis;
@@ -343,9 +342,6 @@ bool PerformInteractionRequest::ProcessVRResponse(
return false;
}
- msg_params[strings::trigger_source] =
- static_cast<int32_t>(TriggerSource::TS_VR);
-
const bool is_vr_aborted_timeout = Compare<Common_Result::eType, EQ, ONE>(
vr_result_code_, Common_Result::ABORTED, Common_Result::TIMED_OUT);
@@ -403,8 +399,7 @@ bool PerformInteractionRequest::ProcessVRResponse(
}
void PerformInteractionRequest::ProcessUIResponse(
- const smart_objects::SmartObject& message,
- smart_objects::SmartObject& msg_params) {
+ const smart_objects::SmartObject& message) {
SDL_LOG_AUTO_TRACE();
using namespace helpers;
using namespace smart_objects;
@@ -436,38 +431,30 @@ void PerformInteractionRequest::ProcessUIResponse(
ui_result_code_, hmi_apis::Common_Result::UNSUPPORTED_RESOURCE);
if (result) {
+ const smart_objects::SmartObject& hmi_msg_params =
+ message[strings::msg_params];
if (is_pi_unsupported) {
ui_result_code_ = hmi_apis::Common_Result::UNSUPPORTED_RESOURCE;
ui_info_ = message[strings::msg_params][strings::info].asString();
- } else {
- if (message.keyExists(strings::msg_params)) {
- msg_params = message[strings::msg_params];
- }
- if (is_pi_warning) {
- ui_result_code_ = hmi_apis::Common_Result::WARNINGS;
- ui_info_ = message[strings::msg_params][strings::info].asString();
- }
+ } else if (is_pi_warning) {
+ ui_result_code_ = hmi_apis::Common_Result::WARNINGS;
+ ui_info_ = message[strings::msg_params][strings::info].asString();
}
// result code must be GENERIC_ERROR in case wrong choice_id
- if (msg_params.keyExists(strings::choice_id)) {
+ if (hmi_msg_params.keyExists(strings::choice_id)) {
const std::int32_t ui_choice_id =
- static_cast<std::int32_t>(msg_params[strings::choice_id].asInt());
+ static_cast<std::int32_t>(hmi_msg_params[strings::choice_id].asInt());
if (!CheckChoiceIDFromResponse(app, ui_choice_id)) {
ui_result_code_ = hmi_apis::Common_Result::GENERIC_ERROR;
ui_info_ = "Wrong choiceID was received from HMI";
} else {
ui_choice_id_received_ = ui_choice_id;
- msg_params[strings::trigger_source] =
- mobile_apis::TriggerSource::TS_MENU;
- }
- } else if (msg_params.keyExists(strings::manual_text_entry)) {
- msg_params[strings::trigger_source] =
- mobile_apis::TriggerSource::TS_KEYBOARD;
- if (msg_params[strings::manual_text_entry].empty()) {
- msg_params.erase(strings::manual_text_entry);
}
+ } else if (hmi_msg_params.keyExists(strings::manual_text_entry)) {
+ ui_text_entry_received_ =
+ hmi_msg_params[strings::manual_text_entry].asString();
}
}
}
@@ -1124,7 +1111,8 @@ PerformInteractionRequest::PrepareResultCodeForResponse(
if (INVALID_CHOICE_ID != vr_choice_id_received_) {
return mobile_vr_result_code;
}
- if (INVALID_CHOICE_ID != ui_choice_id_received_) {
+ if (INVALID_CHOICE_ID != ui_choice_id_received_ ||
+ !ui_text_entry_received_.empty()) {
return mobile_ui_result_code;
}
@@ -1135,14 +1123,29 @@ PerformInteractionRequest::PrepareResultCodeForResponse(
bool PerformInteractionRequest::PrepareResultForMobileResponse(
app_mngr::commands::ResponseInfo& ui_response,
app_mngr::commands::ResponseInfo& vr_response) const {
+ bool vr_choice_received = INVALID_CHOICE_ID != vr_choice_id_received_;
+ bool ui_choice_received = INVALID_CHOICE_ID != ui_choice_id_received_ ||
+ !ui_text_entry_received_.empty();
+
+ bool vr_response_success =
+ vr_response.is_ok ||
+ (vr_response.is_unsupported_resource &&
+ vr_response.interface_state != HmiInterfaces::STATE_NOT_AVAILABLE &&
+ vr_choice_received);
+ bool ui_response_success =
+ ui_response.is_ok ||
+ (ui_response.is_unsupported_resource &&
+ ui_response.interface_state != HmiInterfaces::STATE_NOT_AVAILABLE &&
+ ui_choice_received);
+
if (mobile_apis::InteractionMode::VR_ONLY == interaction_mode_) {
- return vr_response.is_ok;
+ return vr_response_success;
}
if (mobile_apis::InteractionMode::MANUAL_ONLY == interaction_mode_) {
- return ui_response.is_ok;
+ return ui_response_success;
}
- return (vr_response.is_ok || ui_response.is_ok);
+ return (vr_response_success || ui_response_success);
}
bool PerformInteractionRequest::SetChoiceIdToResponseMsgParams(
@@ -1151,25 +1154,37 @@ bool PerformInteractionRequest::SetChoiceIdToResponseMsgParams(
const bool ui_choice_id_valid = INVALID_CHOICE_ID != ui_choice_id_received_;
const bool vr_choice_id_valid = INVALID_CHOICE_ID != vr_choice_id_received_;
-
if (ui_choice_id_valid && vr_choice_id_valid &&
ui_choice_id_received_ != vr_choice_id_received_) {
return false;
}
+ if (!ui_text_entry_received_.empty()) {
+ msg_param[strings::trigger_source] =
+ mobile_apis::TriggerSource::TS_KEYBOARD;
+ msg_param[strings::manual_text_entry] = ui_text_entry_received_;
+ return true;
+ }
+
switch (interaction_mode_) {
case mobile_apis::InteractionMode::eType::MANUAL_ONLY:
if (ui_choice_id_valid) {
+ msg_param[strings::trigger_source] =
+ mobile_apis::TriggerSource::TS_MENU;
msg_param[strings::choice_id] = ui_choice_id_received_;
}
case mobile_apis::InteractionMode::eType::VR_ONLY:
if (vr_choice_id_valid) {
+ msg_param[strings::trigger_source] = mobile_apis::TriggerSource::TS_VR;
msg_param[strings::choice_id] = vr_choice_id_received_;
}
default:
if (ui_choice_id_valid) {
+ msg_param[strings::trigger_source] =
+ mobile_apis::TriggerSource::TS_MENU;
msg_param[strings::choice_id] = ui_choice_id_received_;
} else if (vr_choice_id_valid) {
+ msg_param[strings::trigger_source] = mobile_apis::TriggerSource::TS_VR;
msg_param[strings::choice_id] = vr_choice_id_received_;
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_request.cc
index 6e8ad05a74..11cbdac14a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_request.cc
@@ -31,6 +31,8 @@
*/
#include "sdl_rpc_plugin/commands/mobile/subscribe_way_points_request.h"
+
+#include "application_manager/app_service_manager.h"
#include "application_manager/application_manager.h"
#include "application_manager/message_helper.h"
@@ -72,8 +74,8 @@ void SubscribeWayPointsRequest::Run() {
return;
}
- if (application_manager_.IsAnyAppSubscribedForWayPoints()) {
- application_manager_.SubscribeAppForWayPoints(app);
+ if (application_manager_.IsSubscribedToHMIWayPoints()) {
+ application_manager_.SubscribeAppForWayPoints(app, false);
SendResponse(true, mobile_apis::Result::SUCCESS);
return;
}
@@ -91,15 +93,20 @@ void SubscribeWayPointsRequest::on_event(const event_engine::Event& event) {
case hmi_apis::FunctionID::Navigation_SubscribeWayPoints: {
SDL_LOG_INFO("Received Navigation_SubscribeWayPoints event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation);
- const hmi_apis::Common_Result::eType result_code =
+ hmi_apis::Common_Result::eType result_code =
static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
std::string response_info;
GetInfo(message, response_info);
- const bool result = PrepareResultForMobileResponse(
+ bool result = PrepareResultForMobileResponse(
result_code, HmiInterfaces::HMI_INTERFACE_Navigation);
if (result) {
- application_manager_.SubscribeAppForWayPoints(app);
+ application_manager_.SubscribeAppForWayPoints(app, true);
+ } else if (application_manager_.GetAppServiceManager()
+ .FindWayPointsHandler() != nullptr) {
+ application_manager_.SubscribeAppForWayPoints(app, false);
+ result = true;
+ result_code = hmi_apis::Common_Result::WARNINGS;
}
SendResponse(result,
MessageHelper::HMIToMobileResult(result_code),
@@ -114,6 +121,23 @@ void SubscribeWayPointsRequest::on_event(const event_engine::Event& event) {
}
}
+void SubscribeWayPointsRequest::onTimeOut() {
+ SDL_LOG_AUTO_TRACE();
+ if (application_manager_.GetAppServiceManager().FindWayPointsHandler() !=
+ nullptr) {
+ ApplicationSharedPtr app =
+ application_manager_.application(connection_key());
+ application_manager_.SubscribeAppForWayPoints(app, false);
+ SendResponse(true,
+ mobile_apis::Result::WARNINGS,
+ "HMI request timeout expired, waypoints are available through "
+ "NAVIGATION service");
+ } else {
+ SendResponse(
+ false, mobile_apis::Result::GENERIC_ERROR, "Request timeout expired");
+ }
+}
+
bool SubscribeWayPointsRequest::Init() {
hash_update_mode_ = HashUpdateMode::kDoHashUpdate;
return true;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_request.cc
index 327315b372..1a54f7f106 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_request.cc
@@ -206,20 +206,10 @@ bool SubtleAlertRequest::PrepareResponseParameters(
bool result =
PrepareResultForMobileResponse(ui_subtle_alert_info, tts_alert_info);
- /* result=false if UI interface is ok and TTS interface = UNSUPPORTED_RESOURCE
- * and sdl receive TTS.IsReady=true or SDL doesn't receive response for
- * TTS.IsReady.
- */
- if (result && ui_subtle_alert_info.is_ok &&
- tts_alert_info.is_unsupported_resource &&
- HmiInterfaces::STATE_NOT_AVAILABLE != tts_alert_info.interface_state) {
- result = false;
- }
result_code = mobile_apis::Result::WARNINGS;
if ((ui_subtle_alert_info.is_ok || ui_subtle_alert_info.is_not_used) &&
tts_alert_info.is_unsupported_resource &&
HmiInterfaces::STATE_AVAILABLE == tts_alert_info.interface_state) {
- tts_response_info_ = "Unsupported phoneme type sent in a prompt";
info = app_mngr::commands::MergeInfos(ui_subtle_alert_info,
ui_response_info_,
tts_alert_info,
@@ -244,7 +234,11 @@ bool SubtleAlertRequest::PrepareResponseParameters(
tts_alert_info,
tts_response_info_);
// Mobile Alert request is successful when UI_SubtleAlert is successful
- if (is_ui_subtle_alert_sent_ && !ui_subtle_alert_info.is_ok) {
+ bool has_unsupported_data = ui_subtle_alert_info.is_unsupported_resource &&
+ HmiInterfaces::STATE_NOT_AVAILABLE !=
+ ui_subtle_alert_info.interface_state;
+ if (is_ui_subtle_alert_sent_ && !ui_subtle_alert_info.is_ok &&
+ !has_unsupported_data) {
return false;
}
return result;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_request.cc
index 545a36def8..7aa6e2b40a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_request.cc
@@ -31,6 +31,8 @@
*/
#include "sdl_rpc_plugin/commands/mobile/unsubscribe_way_points_request.h"
+
+#include "application_manager/app_service_manager.h"
#include "application_manager/application_manager.h"
#include "application_manager/message_helper.h"
@@ -75,9 +77,10 @@ void UnsubscribeWayPointsRequest::Run() {
std::set<uint32_t> subscribed_apps =
application_manager_.GetAppsSubscribedForWayPoints();
- if (subscribed_apps.size() > 1) {
+ if (subscribed_apps.size() > 1 ||
+ !application_manager_.IsSubscribedToHMIWayPoints()) {
// More than 1 subscribed app, don't send HMI unsubscribe request
- application_manager_.UnsubscribeAppFromWayPoints(app);
+ application_manager_.UnsubscribeAppFromWayPoints(app, false);
SendResponse(true, mobile_apis::Result::SUCCESS, NULL);
return;
} else {
@@ -96,15 +99,20 @@ void UnsubscribeWayPointsRequest::on_event(const event_engine::Event& event) {
case hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints: {
SDL_LOG_INFO("Received Navigation_UnsubscribeWayPoints event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation);
- const hmi_apis::Common_Result::eType result_code =
+ hmi_apis::Common_Result::eType result_code =
static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
std::string response_info;
GetInfo(message, response_info);
- const bool result = PrepareResultForMobileResponse(
+ bool result = PrepareResultForMobileResponse(
result_code, HmiInterfaces::HMI_INTERFACE_Navigation);
if (result) {
- application_manager_.UnsubscribeAppFromWayPoints(app);
+ application_manager_.UnsubscribeAppFromWayPoints(app, true);
+ } else if (application_manager_.GetAppServiceManager()
+ .FindWayPointsHandler() != nullptr) {
+ application_manager_.UnsubscribeAppFromWayPoints(app, false);
+ result = true;
+ result_code = hmi_apis::Common_Result::WARNINGS;
}
SendResponse(result,
MessageHelper::HMIToMobileResult(result_code),
@@ -119,6 +127,23 @@ void UnsubscribeWayPointsRequest::on_event(const event_engine::Event& event) {
}
}
+void UnsubscribeWayPointsRequest::onTimeOut() {
+ SDL_LOG_AUTO_TRACE();
+ if (application_manager_.GetAppServiceManager().FindWayPointsHandler() !=
+ nullptr) {
+ ApplicationSharedPtr app =
+ application_manager_.application(connection_key());
+ application_manager_.UnsubscribeAppFromWayPoints(app, false);
+ SendResponse(true,
+ mobile_apis::Result::WARNINGS,
+ "HMI request timeout expired, waypoints are available through "
+ "NAVIGATION service");
+ } else {
+ SendResponse(
+ false, mobile_apis::Result::GENERIC_ERROR, "Request timeout expired");
+ }
+}
+
bool UnsubscribeWayPointsRequest::Init() {
hash_update_mode_ = HashUpdateMode::kDoHashUpdate;
return true;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc
index d2f1325c82..9809a11a81 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc
@@ -96,6 +96,7 @@
#include "sdl_rpc_plugin/commands/mobile/on_update_file_notification.h"
#include "sdl_rpc_plugin/commands/mobile/on_update_sub_menu_notification.h"
#include "sdl_rpc_plugin/commands/mobile/on_way_point_change_notification.h"
+#include "sdl_rpc_plugin/commands/mobile/on_way_point_change_notification_from_mobile.h"
#include "sdl_rpc_plugin/commands/mobile/perform_audio_pass_thru_request.h"
#include "sdl_rpc_plugin/commands/mobile/perform_audio_pass_thru_response.h"
#include "sdl_rpc_plugin/commands/mobile/perform_interaction_request.h"
@@ -491,6 +492,10 @@ CommandCreator& MobileCommandFactory::get_notification_from_mobile_creator(
case mobile_apis::FunctionID::OnHMIStatusID: {
return factory.GetCreator<commands::OnHMIStatusNotificationFromMobile>();
}
+ case mobile_apis::FunctionID::OnWayPointChangeID: {
+ return factory
+ .GetCreator<commands::OnWayPointChangeNotificationFromMobile>();
+ }
default: {}
}
return factory.GetCreator<InvalidCommand>();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/waypoints_pending_resumption_handler.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/waypoints_pending_resumption_handler.cc
index 7aa6dd5273..af6c7f3c1d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/waypoints_pending_resumption_handler.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/waypoints_pending_resumption_handler.cc
@@ -86,7 +86,7 @@ void WayPointsPendingResumptionHandler::HandleResumptionSubscriptionRequest(
SDL_LOG_DEBUG(
"Subscription to waypoint already exist, no need to send "
"request to HMI");
- application_manager_.SubscribeAppForWayPoints(app.app_id());
+ application_manager_.SubscribeAppForWayPoints(app.app_id(), false);
return;
}
@@ -154,10 +154,10 @@ void WayPointsPendingResumptionHandler::on_event(
}
const smart_objects::SmartObject& response = event.smart_object();
- const uint32_t corr_id = event.smart_object_correlation_id();
SDL_LOG_TRACE("Received event with function id: "
- << event.id() << " and correlation id: " << corr_id);
+ << event.id() << " and correlation id: "
+ << event.smart_object_correlation_id());
auto current_pending = pending_requests_.front();
pending_requests_.pop_front();
@@ -170,7 +170,7 @@ void WayPointsPendingResumptionHandler::on_event(
if (resumption::IsResponseSuccessful(response)) {
SDL_LOG_DEBUG("Resumption of waypoints is successful");
- application_manager_.SubscribeAppForWayPoints(app);
+ application_manager_.SubscribeAppForWayPoints(app, true);
}
ProcessNextPendingResumption();
}
@@ -195,7 +195,7 @@ void WayPointsPendingResumptionHandler::ProcessNextPendingResumption() {
auto pending_copy = pending;
pending_requests_.pop_front();
auto app = application_manager_.application(pending_copy.app_id_);
- application_manager_.SubscribeAppForWayPoints(app);
+ application_manager_.SubscribeAppForWayPoints(app, false);
RaiseFakeSuccessfulResponse(pending_copy.corr_id_);
ProcessNextPendingResumption();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/CMakeLists.txt b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/CMakeLists.txt
index b21ab9dca8..b5bb139377 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/CMakeLists.txt
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/CMakeLists.txt
@@ -24,6 +24,7 @@ file(GLOB SOURCES
set(LIBRARIES
sdl_rpc_plugin_static
+ Resumption
gmock
)
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc
index 400481f506..5487da51a3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc
@@ -92,6 +92,7 @@
#include "utils/signals.h"
#include "application_manager/hmi_capabilities_impl.h"
+#include "application_manager/mock_app_service_manager.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_event_dispatcher.h"
@@ -106,6 +107,8 @@
#include "connection_handler/mock_connection_handler.h"
#include "connection_handler/mock_connection_handler_settings.h"
#include "protocol_handler/mock_session_observer.h"
+#include "resumption/last_state_wrapper_impl.h"
+#include "resumption/mock_last_state.h"
#include "smart_objects/smart_object.h"
#include "test/application_manager/mock_application_manager_settings.h"
#include "transport_manager/mock_transport_manager.h"
@@ -127,6 +130,7 @@ using ::test::components::application_manager_test::MockApplication;
using ::test::components::application_manager_test::MockApplicationManager;
using ::test::components::application_manager_test::
MockApplicationManagerSettings;
+using ::test::components::application_manager_test::MockAppServiceManager;
using ::test::components::event_engine_test::MockEventDispatcher;
using ::testing::_;
using ::testing::InSequence;
@@ -216,7 +220,11 @@ class HMICommandsNotificationsTest
HMICommandsNotificationsTest()
: applications_lock_(std::make_shared<sync_primitives::Lock>())
, applications_(application_set_, applications_lock_)
- , app_ptr_(NULL) {}
+ , app_ptr_(NULL)
+ , mock_last_state_(std::make_shared<resumption_test::MockLastState>())
+ , last_state_wrapper_(std::make_shared<resumption::LastStateWrapperImpl>(
+ mock_last_state_))
+ , mock_app_service_manager_(app_mngr_, last_state_wrapper_) {}
~HMICommandsNotificationsTest() {
// Fix DataAccessor release and WinQt crash
@@ -244,6 +252,9 @@ class HMICommandsNotificationsTest
MockConnectionHandler mock_connection_handler_;
MockSessionObserver mock_session_observer_;
+ std::shared_ptr<resumption_test::MockLastState> mock_last_state_;
+ resumption::LastStateWrapperPtr last_state_wrapper_;
+ MockAppServiceManager mock_app_service_manager_;
void InitCommand(const uint32_t& default_timeout) OVERRIDE {
app_ = ConfigureApp(&app_ptr_, kAppId_, NOT_MEDIA, NOT_NAVI, NOT_VC);
@@ -256,6 +267,8 @@ class HMICommandsNotificationsTest
ON_CALL(app_mngr_, application_by_hmi_app(_)).WillByDefault(Return(app_));
ON_CALL(*app_ptr_, app_id()).WillByDefault(Return(kAppId_));
ON_CALL(app_mngr_, application(kConnectionKey)).WillByDefault(Return(app_));
+ ON_CALL(app_mngr_, GetAppServiceManager())
+ .WillByDefault(ReturnRef(mock_app_service_manager_));
ON_CALL(app_mngr_, connection_handler())
.WillByDefault(ReturnRef(mock_connection_handler_));
}
@@ -428,6 +441,8 @@ TEST_F(HMICommandsNotificationsTest,
MessageSharedPtr message = CreateMessage();
std::shared_ptr<Command> command =
CreateCommand<OnNaviWayPointChangeNotification>(message);
+ EXPECT_CALL(mock_app_service_manager_, FindWayPointsHandler())
+ .WillOnce(Return(nullptr));
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(_, Command::CommandSource::SOURCE_SDL));
command->Run();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_way_point_change_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_way_point_change_notification_test.cc
index ec401ae2a8..dc6f07f525 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_way_point_change_notification_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_way_point_change_notification_test.cc
@@ -139,7 +139,6 @@ TEST_F(OnWayPointChangeNotificationTest,
.WillOnce(Return(apps_subscribed_for_way_points));
EXPECT_CALL(mock_rpc_service_,
SendMessageToMobile(CheckMessageData(kApp1Id), _));
- EXPECT_CALL(app_mngr_, SaveWayPointsMessage(message_));
command_->Run();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_way_points_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_way_points_request_test.cc
index 528f8a0700..44c5a7a3dd 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_way_points_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_way_points_request_test.cc
@@ -73,13 +73,12 @@ TEST_F(SubscribeWayPointsRequestTest, Run_SUCCESS) {
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
ON_CALL(app_mngr_, IsAppSubscribedForWayPoints(Ref(*app)))
.WillByDefault(Return(false));
- ON_CALL(app_mngr_, IsAnyAppSubscribedForWayPoints())
- .WillByDefault(Return(true));
+ ON_CALL(app_mngr_, IsSubscribedToHMIWayPoints()).WillByDefault(Return(true));
{
InSequence dummy;
EXPECT_CALL(app_mngr_,
- SubscribeAppForWayPoints(A<am::ApplicationSharedPtr>()));
+ SubscribeAppForWayPoints(A<am::ApplicationSharedPtr>(), false));
EXPECT_CALL(*app, UpdateHash());
}
@@ -112,7 +111,7 @@ TEST_F(SubscribeWayPointsRequestTest, OnEvent_SUCCESS) {
{
InSequence dummy;
EXPECT_CALL(app_mngr_,
- SubscribeAppForWayPoints(A<am::ApplicationSharedPtr>()));
+ SubscribeAppForWayPoints(A<am::ApplicationSharedPtr>(), true));
EXPECT_CALL(mock_message_helper_, HMIToMobileResult(result_code))
.WillOnce(Return(mobile_apis::Result::SUCCESS));
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_way_points_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_way_points_request_test.cc
index ec4d2420d6..9a6ff4d14e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_way_points_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_way_points_request_test.cc
@@ -123,6 +123,8 @@ TEST_F(UnsubscribeWayPointsRequestTest, Run_AppSubscribedForWayPoints_SUCCESS) {
EXPECT_CALL(app_mngr_, GetAppsSubscribedForWayPoints())
.WillOnce(Return(subscribed_apps));
+ EXPECT_CALL(app_mngr_, IsSubscribedToHMIWayPoints()).WillOnce(Return(true));
+
EXPECT_CALL(mock_rpc_service_,
ManageHMICommand(
HMIResultCodeIs(
@@ -156,9 +158,10 @@ TEST_F(UnsubscribeWayPointsRequestTest,
Event event(hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints);
event.set_smart_object(*event_msg);
- EXPECT_CALL(app_mngr_,
- UnsubscribeAppFromWayPoints(
- ::testing::Matcher<am::ApplicationSharedPtr>(mock_app)));
+ EXPECT_CALL(
+ app_mngr_,
+ UnsubscribeAppFromWayPoints(
+ ::testing::Matcher<am::ApplicationSharedPtr>(mock_app), true));
EXPECT_CALL(
mock_rpc_service_,
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/on_vehicle_data_notification.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/on_vehicle_data_notification.cc
index 1799d7068c..60dea0a24b 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/on_vehicle_data_notification.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/on_vehicle_data_notification.cc
@@ -112,15 +112,22 @@ void OnVehicleDataNotification::Run() {
mobile_api::FunctionID::OnVehicleDataID),
appSO[idx].enumerate(),
&params_permissions);
-
- for (const auto& param : appSO[idx].enumerate()) {
- const auto& allowed_params = params_permissions.allowed_params;
- auto param_allowed = allowed_params.find(param);
- if (allowed_params.end() == param_allowed) {
- SDL_LOG_DEBUG("Param " << param << " is not allowed by policy for app "
- << notify_apps[idx]->app_id()
- << ". It will be ignored.");
- appSO[idx].erase(param);
+ if (params_permissions.allowed_params.empty() &&
+ params_permissions.disallowed_params.empty() &&
+ params_permissions.undefined_params.empty()) {
+ SDL_LOG_DEBUG(
+ "No parameter permissions provided, all params are allowed");
+ } else {
+ for (const auto& param : appSO[idx].enumerate()) {
+ const auto& allowed_params = params_permissions.allowed_params;
+ auto param_allowed = allowed_params.find(param);
+ if (allowed_params.end() == param_allowed) {
+ SDL_LOG_DEBUG("Param " << param
+ << " is not allowed by policy for app "
+ << notify_apps[idx]->app_id()
+ << ". It will be ignored.");
+ appSO[idx].erase(param);
+ }
}
}
diff --git a/src/components/application_manager/src/app_service_manager.cc b/src/components/application_manager/src/app_service_manager.cc
index 9b31d57ca0..4955c792c2 100644
--- a/src/components/application_manager/src/app_service_manager.cc
+++ b/src/components/application_manager/src/app_service_manager.cc
@@ -617,6 +617,25 @@ bool AppServiceManager::UpdateNavigationCapabilities(
return true;
}
+AppService* AppServiceManager::FindWayPointsHandler() {
+ auto service = ActiveServiceForType(
+ EnumToString(mobile_apis::AppServiceType::NAVIGATION));
+ if (!service || !service->mobile_service ||
+ !service->record[strings::service_manifest].keyExists(
+ strings::handled_rpcs)) {
+ return nullptr;
+ }
+
+ smart_objects::SmartObject& handled_rpcs =
+ service->record[strings::service_manifest][strings::handled_rpcs];
+ for (size_t i = 0; i < handled_rpcs.length(); ++i) {
+ if (handled_rpcs[i].asInt() == mobile_apis::FunctionID::GetWayPointsID) {
+ return service;
+ }
+ }
+ return nullptr;
+}
+
void AppServiceManager::AppServiceUpdated(
const smart_objects::SmartObject& service_record,
const mobile_apis::ServiceUpdateReason::eType update_reason,
diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc
index 94fd85d3d8..6418f47458 100644
--- a/src/components/application_manager/src/application_manager_impl.cc
+++ b/src/components/application_manager/src/application_manager_impl.cc
@@ -162,6 +162,7 @@ ApplicationManagerImpl::ApplicationManagerImpl(
std::make_shared<sync_primitives::RecursiveLock>())
, apps_to_register_list_lock_ptr_(std::make_shared<sync_primitives::Lock>())
, reregister_wait_list_lock_ptr_(std::make_shared<sync_primitives::Lock>())
+ , subscribed_to_hmi_way_points_(false)
, audio_pass_thru_active_(false)
, audio_pass_thru_app_id_(0)
, driver_distraction_state_(hmi_apis::Common_DriverDistractionState::DD_OFF)
@@ -673,6 +674,8 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication(
static_cast<protocol_handler::MajorProtocolVersion>(
message[strings::params][strings::protocol_version].asInt());
application->set_protocol_version(protocol_version);
+ connection_handler_->BindProtocolVersionWithSession(connection_key,
+ protocol_version);
// Keep HMI add id in case app is present in "waiting for registration" list
apps_to_register_list_lock_ptr_->Acquire();
@@ -1720,11 +1723,11 @@ void ApplicationManagerImpl::SwitchApplication(ApplicationSharedPtr app,
bool is_subscribed_to_way_points = IsAppSubscribedForWayPoints(*app);
if (is_subscribed_to_way_points) {
- UnsubscribeAppFromWayPoints(app);
+ UnsubscribeAppFromWayPoints(app, false);
}
SwitchApplicationParameters(app, connection_key, device_id, mac_address);
if (is_subscribed_to_way_points) {
- SubscribeAppForWayPoints(app);
+ SubscribeAppForWayPoints(app, false);
}
// Normally this is done during registration, however since switched apps are
@@ -3250,7 +3253,7 @@ void ApplicationManagerImpl::UnregisterApplication(
}
if (IsAppSubscribedForWayPoints(app_id)) {
- UnsubscribeAppFromWayPoints(app_id);
+ UnsubscribeAppFromWayPoints(app_id, true);
if (!IsAnyAppSubscribedForWayPoints()) {
SDL_LOG_DEBUG("Send UnsubscribeWayPoints");
auto request = MessageHelper::CreateUnsubscribeWayPointsRequest(
@@ -4714,42 +4717,69 @@ bool ApplicationManagerImpl::IsAppSubscribedForWayPoints(
return IsAppSubscribedForWayPoints(app.app_id());
}
-void ApplicationManagerImpl::SubscribeAppForWayPoints(uint32_t app_id) {
+void ApplicationManagerImpl::SubscribeAppForWayPoints(uint32_t app_id,
+ bool response_from_hmi) {
SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_);
SDL_LOG_DEBUG("Subscribing " << app_id);
subscribed_way_points_apps_list_.insert(app_id);
+ if (response_from_hmi) {
+ subscribed_to_hmi_way_points_ = true;
+ }
SDL_LOG_DEBUG("There are applications subscribed: "
<< subscribed_way_points_apps_list_.size());
- if (way_points_data_) {
- smart_objects::SmartObjectSPtr way_point_notification_ =
- std::make_shared<smart_objects::SmartObject>(*way_points_data_);
- (*way_point_notification_)[strings::params][strings::connection_key] =
+ if (GetAppServiceManager().FindWayPointsHandler() != nullptr) {
+ auto service = GetAppServiceManager().ActiveServiceForType(
+ EnumToString(mobile_apis::AppServiceType::NAVIGATION));
+ auto it = mobile_way_points_data_.find(service->connection_key);
+ if (mobile_way_points_data_.end() == it) {
+ SDL_LOG_DEBUG("No waypoint data provided by app service provider yet");
+ return;
+ }
+ smart_objects::SmartObjectSPtr way_point_notification =
+ std::make_shared<smart_objects::SmartObject>(it->second);
+ (*way_point_notification)[strings::params][strings::connection_key] =
+ app_id;
+ GetRPCService().SendMessageToMobile(way_point_notification);
+ } else if (hmi_way_points_data_) {
+ smart_objects::SmartObjectSPtr way_point_notification =
+ std::make_shared<smart_objects::SmartObject>(*hmi_way_points_data_);
+ (*way_point_notification)[strings::params][strings::connection_key] =
app_id;
- GetRPCService().SendMessageToMobile(way_point_notification_);
+ GetRPCService().SendMessageToMobile(way_point_notification);
}
}
-void ApplicationManagerImpl::SubscribeAppForWayPoints(
- ApplicationSharedPtr app) {
- SubscribeAppForWayPoints(app->app_id());
+void ApplicationManagerImpl::SubscribeAppForWayPoints(ApplicationSharedPtr app,
+ bool response_from_hmi) {
+ SubscribeAppForWayPoints(app->app_id(), response_from_hmi);
}
-void ApplicationManagerImpl::UnsubscribeAppFromWayPoints(uint32_t app_id) {
+void ApplicationManagerImpl::UnsubscribeAppFromWayPoints(
+ uint32_t app_id, bool response_from_hmi) {
SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_);
SDL_LOG_DEBUG("Unsubscribing " << app_id);
subscribed_way_points_apps_list_.erase(app_id);
+ if (response_from_hmi) {
+ subscribed_to_hmi_way_points_ = false;
+ }
SDL_LOG_DEBUG("There are applications subscribed: "
<< subscribed_way_points_apps_list_.size());
if (subscribed_way_points_apps_list_.empty()) {
- way_points_data_.reset();
+ hmi_way_points_data_.reset();
+ mobile_way_points_data_.clear();
}
}
void ApplicationManagerImpl::UnsubscribeAppFromWayPoints(
- ApplicationSharedPtr app) {
- UnsubscribeAppFromWayPoints(app->app_id());
+ ApplicationSharedPtr app, bool response_from_hmi) {
+ UnsubscribeAppFromWayPoints(app->app_id(), response_from_hmi);
+}
+
+bool ApplicationManagerImpl::IsSubscribedToHMIWayPoints() const {
+ SDL_LOG_AUTO_TRACE();
+ return subscribed_to_hmi_way_points_;
}
bool ApplicationManagerImpl::IsAnyAppSubscribedForWayPoints() const {
@@ -4761,9 +4791,17 @@ bool ApplicationManagerImpl::IsAnyAppSubscribedForWayPoints() const {
}
void ApplicationManagerImpl::SaveWayPointsMessage(
- std::shared_ptr<smart_objects::SmartObject> way_points_message) {
+ std::shared_ptr<smart_objects::SmartObject> way_points_message,
+ uint32_t app_id) {
sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_);
- way_points_data_ = way_points_message;
+ // Notification from HMI
+ if (0 == app_id) {
+ hmi_way_points_data_ = way_points_message;
+ }
+ // Notification from app service provider
+ else {
+ mobile_way_points_data_[app_id] = *way_points_message;
+ }
}
const std::set<uint32_t> ApplicationManagerImpl::GetAppsSubscribedForWayPoints()
diff --git a/src/components/application_manager/src/helpers/application_helper.cc b/src/components/application_manager/src/helpers/application_helper.cc
index 488ee4aca0..c9a0d87aed 100644
--- a/src/components/application_manager/src/helpers/application_helper.cc
+++ b/src/components/application_manager/src/helpers/application_helper.cc
@@ -9,12 +9,16 @@ namespace {
using namespace application_manager;
void DeleteWayPoints(ApplicationSharedPtr app,
ApplicationManager& app_manager) {
- app_manager.UnsubscribeAppFromWayPoints(app);
- if (!app_manager.IsAnyAppSubscribedForWayPoints()) {
+ std::set<uint32_t> subscribed_apps =
+ app_manager.GetAppsSubscribedForWayPoints();
+ bool send_unsubscribe =
+ subscribed_apps.size() <= 1 && app_manager.IsSubscribedToHMIWayPoints();
+ if (send_unsubscribe) {
auto request = MessageHelper::CreateUnsubscribeWayPointsRequest(
app_manager.GetNextHMICorrelationID());
app_manager.GetRPCService().ManageHMICommand(request);
}
+ app_manager.UnsubscribeAppFromWayPoints(app, send_unsubscribe);
}
void DeleteCommands(ApplicationSharedPtr app, ApplicationManager& app_manager) {
diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc
index b61a75d7de..cb9b7df3e1 100644
--- a/src/components/application_manager/src/policies/policy_handler.cc
+++ b/src/components/application_manager/src/policies/policy_handler.cc
@@ -600,6 +600,10 @@ void PolicyHandler::OnDeviceConsentChanged(const std::string& device_id,
policy_manager->SendNotificationOnPermissionsUpdated(device_id,
policy_app_id);
+
+ if (policy_manager->IsPredataPolicy(policy_app_id) && !is_allowed) {
+ SetHeartBeatTimeout(policy_app_id, (*it_app_list)->app_id());
+ }
}
}
}
@@ -767,6 +771,23 @@ void PolicyHandler::OnAppPermissionConsentInternal(
#endif
}
+void PolicyHandler::SetHeartBeatTimeout(const std::string& policy_app_id,
+ const uint32_t app_id) {
+ SDL_LOG_AUTO_TRACE();
+
+ const std::shared_ptr<PolicyManager> policy_manager = LoadPolicyManager();
+ POLICY_LIB_CHECK_VOID(policy_manager);
+
+ const uint32_t timeout = policy_manager->HeartBeatTimeout(policy_app_id);
+ if (0 != timeout) {
+ SDL_LOG_DEBUG("SetHeartBeatTimeout for " << app_id << " is " << timeout);
+ application_manager_.connection_handler().SetHeartBeatTimeout(app_id,
+ timeout);
+ } else {
+ SDL_LOG_DEBUG("SetHeartBeatTimeout for " << app_id << " ignored");
+ }
+}
+
void policy::PolicyHandler::SetDaysAfterEpoch() {
const auto policy_manager = LoadPolicyManager();
POLICY_LIB_CHECK_VOID(policy_manager);
diff --git a/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc b/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc
index 792e7f97ea..17980ae5ad 100644
--- a/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc
+++ b/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc
@@ -1079,8 +1079,6 @@ void ResumptionDataProcessorImpl::CheckCreateWindowResponse(
const smart_objects::SmartObject& request,
const smart_objects::SmartObject& response) const {
SDL_LOG_AUTO_TRACE();
- const auto correlation_id =
- response[strings::params][strings::correlation_id].asInt();
const auto& msg_params = request[strings::msg_params];
const auto app_id = msg_params[strings::app_id].asInt();
@@ -1093,8 +1091,9 @@ void ResumptionDataProcessorImpl::CheckCreateWindowResponse(
const auto window_id = msg_params[strings::window_id].asInt();
if (!IsResponseSuccessful(response)) {
- SDL_LOG_ERROR("UI_CreateWindow for correlation id: " << correlation_id
- << " has failed");
+ SDL_LOG_ERROR("UI_CreateWindow for correlation id: "
+ << response[strings::params][strings::correlation_id].asInt()
+ << " has failed");
auto& builder = application->display_capabilities_builder();
builder.ResetDisplayCapabilities();
return;
diff --git a/src/components/application_manager/test/application_helper_test.cc b/src/components/application_manager/test/application_helper_test.cc
index 4c451ab072..1633b9d29b 100644
--- a/src/components/application_manager/test/application_helper_test.cc
+++ b/src/components/application_manager/test/application_helper_test.cc
@@ -209,9 +209,6 @@ TEST_F(ApplicationHelperTest, RecallApplicationData_ExpectAppDataReset) {
EXPECT_TRUE(NULL != file_ptr);
EXPECT_TRUE(file_ptr->file_name == filename);
- EXPECT_CALL(*mock_message_helper_, CreateUnsubscribeWayPointsRequest(_))
- .WillOnce(Return(std::make_shared<smart_objects::SmartObject>()));
-
EXPECT_CALL(*mock_message_helper_, CreateDeleteUICommandRequest(_, _, _))
.WillOnce(Return(std::make_shared<smart_objects::SmartObject>()));
@@ -261,9 +258,6 @@ TEST_F(ApplicationHelperTest, RecallApplicationData_ExpectHMICleanupRequests) {
app_impl_->AddChoiceSet(choice_set_id, cmd[strings::msg_params]);
app_impl_->SubscribeToButton(mobile_apis::ButtonName::AC);
- EXPECT_CALL(*mock_message_helper_, CreateUnsubscribeWayPointsRequest(_))
- .WillOnce(Return(std::make_shared<smart_objects::SmartObject>()));
-
EXPECT_CALL(*mock_message_helper_, CreateDeleteUICommandRequest(_, _, _))
.WillOnce(Return(std::make_shared<smart_objects::SmartObject>()));
diff --git a/src/components/application_manager/test/application_manager_impl_test.cc b/src/components/application_manager/test/application_manager_impl_test.cc
index cf8aadb080..ab49e93e77 100644
--- a/src/components/application_manager/test/application_manager_impl_test.cc
+++ b/src/components/application_manager/test/application_manager_impl_test.cc
@@ -499,16 +499,16 @@ TEST_F(ApplicationManagerImplTest, ProcessQueryApp_ExpectSuccess) {
TEST_F(ApplicationManagerImplTest,
SubscribeAppForWayPoints_ExpectSubscriptionApp) {
auto app_ptr = std::static_pointer_cast<am::Application>(mock_app_ptr_);
- app_manager_impl_->SubscribeAppForWayPoints(app_ptr);
+ app_manager_impl_->SubscribeAppForWayPoints(app_ptr, true);
EXPECT_TRUE(app_manager_impl_->IsAppSubscribedForWayPoints(*app_ptr));
}
TEST_F(ApplicationManagerImplTest,
- UnsubscribeAppForWayPoints_ExpectUnsubscriptionApp) {
+ UnsubscribeAppFromWayPoints_ExpectUnsubscriptionApp) {
auto app_ptr = std::static_pointer_cast<am::Application>(mock_app_ptr_);
- app_manager_impl_->SubscribeAppForWayPoints(app_ptr);
+ app_manager_impl_->SubscribeAppForWayPoints(app_ptr, true);
EXPECT_TRUE(app_manager_impl_->IsAppSubscribedForWayPoints(*app_ptr));
- app_manager_impl_->UnsubscribeAppFromWayPoints(app_ptr);
+ app_manager_impl_->UnsubscribeAppFromWayPoints(app_ptr, true);
EXPECT_FALSE(app_manager_impl_->IsAppSubscribedForWayPoints(*app_ptr));
const std::set<uint32_t> result =
app_manager_impl_->GetAppsSubscribedForWayPoints();
@@ -520,7 +520,7 @@ TEST_F(
IsAnyAppSubscribedForWayPoints_SubcribeAppForWayPoints_ExpectCorrectResult) {
EXPECT_FALSE(app_manager_impl_->IsAnyAppSubscribedForWayPoints());
auto app_ptr = std::static_pointer_cast<am::Application>(mock_app_ptr_);
- app_manager_impl_->SubscribeAppForWayPoints(app_ptr);
+ app_manager_impl_->SubscribeAppForWayPoints(app_ptr, true);
EXPECT_TRUE(app_manager_impl_->IsAnyAppSubscribedForWayPoints());
}
@@ -528,7 +528,7 @@ TEST_F(
ApplicationManagerImplTest,
GetAppsSubscribedForWayPoints_SubcribeAppForWayPoints_ExpectCorrectResult) {
auto app_ptr = std::static_pointer_cast<am::Application>(mock_app_ptr_);
- app_manager_impl_->SubscribeAppForWayPoints(app_ptr);
+ app_manager_impl_->SubscribeAppForWayPoints(app_ptr, true);
std::set<uint32_t> result =
app_manager_impl_->GetAppsSubscribedForWayPoints();
EXPECT_EQ(1u, result.size());
diff --git a/src/components/application_manager/test/include/application_manager/mock_app_service_manager.h b/src/components/application_manager/test/include/application_manager/mock_app_service_manager.h
index 60d2f90297..e3a47f412a 100644
--- a/src/components/application_manager/test/include/application_manager/mock_app_service_manager.h
+++ b/src/components/application_manager/test/include/application_manager/mock_app_service_manager.h
@@ -87,6 +87,7 @@ class MockAppServiceManager : public application_manager::AppServiceManager {
const bool service_published));
MOCK_METHOD1(UpdateNavigationCapabilities,
bool(smart_objects::SmartObject& out_params));
+ MOCK_METHOD0(FindWayPointsHandler, application_manager::AppService*());
MOCK_METHOD0(GetRPCPassingHandler, application_manager::RPCPassingHandler&());
};
diff --git a/src/components/application_manager/test/policy_handler_test.cc b/src/components/application_manager/test/policy_handler_test.cc
index 39ad034d6f..a66cff1727 100644
--- a/src/components/application_manager/test/policy_handler_test.cc
+++ b/src/components/application_manager/test/policy_handler_test.cc
@@ -1915,7 +1915,7 @@ TEST_F(PolicyHandlerTest, OnDeviceConsentChanged_ConsentAllowed) {
EXPECT_CALL(*mock_app_, policy_app_id()).WillOnce(Return(kPolicyAppId_));
EXPECT_CALL(*mock_policy_manager_, IsPredataPolicy(kPolicyAppId_))
- .WillOnce(Return(true));
+ .WillRepeatedly(Return(true));
EXPECT_CALL(
*mock_policy_manager_,
@@ -1944,7 +1944,7 @@ TEST_F(PolicyHandlerTest, OnDeviceConsentChanged_ConsentNotAllowed) {
EXPECT_CALL(*mock_app_, policy_app_id()).WillOnce(Return(kPolicyAppId_));
EXPECT_CALL(*mock_policy_manager_, IsPredataPolicy(kPolicyAppId_))
- .WillOnce(Return(true));
+ .WillRepeatedly(Return(true));
EXPECT_CALL(*mock_policy_manager_,
ReactOnUserDevConsentForApp(handle, kPolicyAppId_, is_allowed))
@@ -1976,7 +1976,7 @@ TEST_F(PolicyHandlerTest, OnDeviceConsentChanged_PredatePolicyNotAllowed) {
// App does not have predate policy
EXPECT_CALL(*mock_policy_manager_, IsPredataPolicy(kPolicyAppId_))
- .WillOnce(Return(false));
+ .WillRepeatedly(Return(false));
EXPECT_CALL(
*mock_policy_manager_,
diff --git a/src/components/application_manager/test/resumption/resume_ctrl_test.cc b/src/components/application_manager/test/resumption/resume_ctrl_test.cc
index 8d228240d2..a265b2b341 100644
--- a/src/components/application_manager/test/resumption/resume_ctrl_test.cc
+++ b/src/components/application_manager/test/resumption/resume_ctrl_test.cc
@@ -685,9 +685,9 @@ TEST_F(ResumeCtrlTest,
extensions.insert(extensions.begin(), mock_app_extension_);
EXPECT_CALL(*mock_app_, Extensions()).WillOnce(ReturnRef(extensions));
- EXPECT_CALL(
- mock_app_mngr_,
- SubscribeAppForWayPoints(A<application_manager::ApplicationSharedPtr>()));
+ EXPECT_CALL(mock_app_mngr_,
+ SubscribeAppForWayPoints(
+ A<application_manager::ApplicationSharedPtr>(), true));
const mobile_apis::HMILevel::eType hmi_test_level =
mobile_apis::HMILevel::HMI_FULL;
ON_CALL(mock_app_mngr_, GetDefaultHmiLevel(const_app_))
diff --git a/src/components/include/application_manager/application_manager.h b/src/components/include/application_manager/application_manager.h
index 67f23956be..a0a19fc678 100644
--- a/src/components/include/application_manager/application_manager.h
+++ b/src/components/include/application_manager/application_manager.h
@@ -345,7 +345,7 @@ class ApplicationManager {
/**
* @brief Checks if Application is subscribed for way points
- * @param Application id
+ * @param app_id Application id
* @return true if Application is subscribed for way points
* otherwise false
*/
@@ -353,7 +353,7 @@ class ApplicationManager {
/**
* @brief Checks if Application is subscribed for way points
- * @param Application reference
+ * @param app Application reference
* @return true if Application is subscribed for way points
* otherwise false
*/
@@ -361,27 +361,45 @@ class ApplicationManager {
/**
* @brief Subscribe Application for way points
- * @param Application id
+ * @param app_id Application id
+ * @param response_from_hmi True if a successful HMI response was received
+ * when subscribing
*/
- virtual void SubscribeAppForWayPoints(uint32_t id) = 0;
+ virtual void SubscribeAppForWayPoints(uint32_t app_id,
+ bool response_from_hmi = true) = 0;
/**
* @brief Subscribe Application for way points
- * @param Application pointer
+ * @param app Application pointer
+ * @param response_from_hmi True if a successful HMI response was received
+ * when subscribing
*/
- virtual void SubscribeAppForWayPoints(ApplicationSharedPtr app) = 0;
+ virtual void SubscribeAppForWayPoints(ApplicationSharedPtr app,
+ bool response_from_hmi = true) = 0;
/**
* @brief Unsubscribe Application for way points
- * @param Application id
+ * @param app_id Application id
+ * @param response_from_hmi True if a successful HMI response was received
+ * when unsubscribing
*/
- virtual void UnsubscribeAppFromWayPoints(uint32_t app_id) = 0;
+ virtual void UnsubscribeAppFromWayPoints(uint32_t app_id,
+ bool response_from_hmi = true) = 0;
/**
* @brief Unsubscribe Application for way points
- * @param Application pointer
+ * @param app Application pointer
+ * @param response_from_hmi True if a successful HMI response was received
+ * when unsubscribing
+ */
+ virtual void UnsubscribeAppFromWayPoints(ApplicationSharedPtr app,
+ bool response_from_hmi = true) = 0;
+
+ /**
+ * @brief Is SDL Core subscribed to HMI waypoints
+ * @return true if SDL Core is subscribed to HMI waypoints, otherwise false
*/
- virtual void UnsubscribeAppFromWayPoints(ApplicationSharedPtr app) = 0;
+ virtual bool IsSubscribedToHMIWayPoints() const = 0;
/**
* @brief Is Any Application is subscribed for way points
@@ -392,9 +410,12 @@ class ApplicationManager {
/**
* @brief Save message after OnWayPointsChangeNotification reception
* @param way_points_message pointer to the smartobject
+ * @param app_id the app ID of the provider sending the way points update or 0
+ * if the HMI is the provider
*/
virtual void SaveWayPointsMessage(
- smart_objects::SmartObjectSPtr way_points_message) = 0;
+ smart_objects::SmartObjectSPtr way_points_message,
+ uint32_t app_id = 0) = 0;
/**
* @brief Get subscribed for way points
diff --git a/src/components/include/test/application_manager/mock_application_manager.h b/src/components/include/test/application_manager/mock_application_manager.h
index ee5d7f315a..eb76f44457 100644
--- a/src/components/include/test/application_manager/mock_application_manager.h
+++ b/src/components/include/test/application_manager/mock_application_manager.h
@@ -351,16 +351,17 @@ class MockApplicationManager : public application_manager::ApplicationManager {
MOCK_CONST_METHOD1(IsAppSubscribedForWayPoints, bool(uint32_t));
MOCK_CONST_METHOD1(IsAppSubscribedForWayPoints,
bool(application_manager::Application& app));
- MOCK_METHOD1(SubscribeAppForWayPoints, void(uint32_t));
- MOCK_METHOD1(SubscribeAppForWayPoints,
- void(application_manager::ApplicationSharedPtr));
- MOCK_METHOD1(UnsubscribeAppFromWayPoints, void(uint32_t));
- MOCK_METHOD1(UnsubscribeAppFromWayPoints,
- void(application_manager::ApplicationSharedPtr));
+ MOCK_METHOD2(SubscribeAppForWayPoints, void(uint32_t, bool));
+ MOCK_METHOD2(SubscribeAppForWayPoints,
+ void(application_manager::ApplicationSharedPtr, bool));
+ MOCK_METHOD2(UnsubscribeAppFromWayPoints, void(uint32_t, bool));
+ MOCK_METHOD2(UnsubscribeAppFromWayPoints,
+ void(application_manager::ApplicationSharedPtr, bool));
+ MOCK_CONST_METHOD0(IsSubscribedToHMIWayPoints, bool());
MOCK_CONST_METHOD0(IsAnyAppSubscribedForWayPoints, bool());
MOCK_CONST_METHOD0(GetAppsSubscribedForWayPoints, const std::set<uint32_t>());
- MOCK_METHOD1(SaveWayPointsMessage,
- void(std::shared_ptr<smart_objects::SmartObject>));
+ MOCK_METHOD2(SaveWayPointsMessage,
+ void(std::shared_ptr<smart_objects::SmartObject>, uint32_t));
MOCK_CONST_METHOD1(
WaitingApplicationByID,
application_manager::ApplicationConstSharedPtr(const uint32_t));
diff --git a/src/components/policy/policy_external/src/cache_manager.cc b/src/components/policy/policy_external/src/cache_manager.cc
index 81a5518cb8..783a622b2e 100644
--- a/src/components/policy/policy_external/src/cache_manager.cc
+++ b/src/components/policy/policy_external/src/cache_manager.cc
@@ -348,17 +348,20 @@ bool CacheManager::CanAppKeepContext(const std::string& app_id) const {
bool result = false;
if (kDeviceId == app_id) {
result = pt_->policy_table.app_policies_section.device.keep_context;
- } else if (IsApplicationRepresented(app_id)) {
+ } else if (IsApplicationRepresented(app_id) &&
+ !IsApplicationRevoked(app_id)) {
result = pt_->policy_table.app_policies_section.apps[app_id].keep_context;
}
return result;
}
uint32_t CacheManager::HeartBeatTimeout(const std::string& app_id) const {
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK(0);
sync_primitives::AutoLock auto_lock(cache_lock_);
uint32_t result = 0;
if (!IsApplicationRepresented(app_id)) {
+ SDL_LOG_WARN("Application " << app_id << " is not represented");
return result;
}
@@ -368,6 +371,7 @@ uint32_t CacheManager::HeartBeatTimeout(const std::string& app_id) const {
result = *(app.heart_beat_timeout_ms);
}
+ SDL_LOG_DEBUG("HB timer for app " << app_id << " is " << result);
return result;
}
@@ -407,7 +411,8 @@ bool CacheManager::CanAppStealFocus(const std::string& app_id) const {
bool result = false;
if (kDeviceId == app_id) {
result = pt_->policy_table.app_policies_section.device.steal_focus;
- } else if (IsApplicationRepresented(app_id)) {
+ } else if (IsApplicationRepresented(app_id) &&
+ !IsApplicationRevoked(app_id)) {
result = pt_->policy_table.app_policies_section.apps[app_id].steal_focus;
}
return result;
@@ -422,7 +427,8 @@ bool CacheManager::GetDefaultHMI(const std::string& app_id,
if (kDeviceId == app_id) {
default_hmi = EnumToJsonString(
pt_->policy_table.app_policies_section.device.default_hmi);
- } else if (IsApplicationRepresented(app_id)) {
+ } else if (IsApplicationRepresented(app_id) &&
+ !IsApplicationRevoked(app_id)) {
default_hmi = EnumToJsonString(
pt_->policy_table.app_policies_section.apps[app_id].default_hmi);
}
@@ -671,6 +677,7 @@ void CacheManager::ProcessUpdate(
const policy_table::ApplicationPolicies::const_iterator
initial_policy_iter) {
using namespace policy;
+ using rpc::policy_table_interface_base::ApplicationParams;
using rpc::policy_table_interface_base::RequestTypes;
const RequestTypes& new_request_types =
*(initial_policy_iter->second.RequestType);
@@ -678,6 +685,14 @@ void CacheManager::ProcessUpdate(
const std::string& app_id = initial_policy_iter->first;
bool update_request_types = true;
+ ApplicationParams& params =
+ pt_->policy_table.app_policies_section.apps[app_id];
+ if (kPreDataConsentId == app_id) {
+ *(params.heart_beat_timeout_ms) =
+ *(initial_policy_iter->second.heart_beat_timeout_ms);
+ SDL_LOG_INFO("heart_beat_timeout_ms in predata = "
+ << *(params.heart_beat_timeout_ms));
+ }
if (app_id == kDefaultId || app_id == kPreDataConsentId) {
if (new_request_types.is_omitted()) {
SDL_LOG_INFO("Application " << app_id
@@ -1820,7 +1835,8 @@ bool CacheManager::GetPriority(const std::string& policy_app_id,
policy_table::ApplicationPolicies::const_iterator policy_iter =
policies.find(policy_app_id);
- const bool app_id_exists = policies.end() != policy_iter;
+ const bool app_id_exists =
+ policies.end() != policy_iter && !IsApplicationRevoked(policy_app_id);
if (app_id_exists) {
priority = EnumToJsonString((*policy_iter).second.priority);
}
@@ -2524,6 +2540,10 @@ bool policy::CacheManager::SetIsPredata(const std::string& app_id) {
if (IsApplicationRepresented(app_id)) {
pt_->policy_table.app_policies_section.apps[app_id].set_to_string(
kPreDataConsentId);
+
+ pt_->policy_table.app_policies_section.apps[app_id].heart_beat_timeout_ms =
+ pt_->policy_table.app_policies_section.apps[kPreDataConsentId]
+ .heart_beat_timeout_ms;
}
return true;
diff --git a/src/components/policy/policy_regular/src/cache_manager.cc b/src/components/policy/policy_regular/src/cache_manager.cc
index 8f98996687..d53ec4d18a 100644
--- a/src/components/policy/policy_regular/src/cache_manager.cc
+++ b/src/components/policy/policy_regular/src/cache_manager.cc
@@ -1128,7 +1128,8 @@ bool CacheManager::GetPriority(const std::string& policy_app_id,
policy_table::ApplicationPolicies::const_iterator policy_iter =
policies.find(policy_app_id);
- const bool app_id_exists = policies.end() != policy_iter;
+ const bool app_id_exists =
+ policies.end() != policy_iter && !IsApplicationRevoked(policy_app_id);
if (app_id_exists) {
priority = EnumToJsonString((*policy_iter).second.priority);
}
diff --git a/src/components/utils/src/convert_utils.cc b/src/components/utils/src/convert_utils.cc
index 83f2c37651..cbe0ffde19 100644
--- a/src/components/utils/src/convert_utils.cc
+++ b/src/components/utils/src/convert_utils.cc
@@ -34,6 +34,7 @@
#include <stdint.h>
#include <algorithm>
#include <limits>
+#include <locale>
#include "utils/macro.h"
long long int utils::ConvertInt64ToLongLongInt(const int64_t value) {