summaryrefslogtreecommitdiff
path: root/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_request.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_request.cc')
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_request.cc35
1 files changed, 30 insertions, 5 deletions
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;