diff options
author | Dmitriy Boltovskiy <dboltovskyi@luxoft.com> | 2020-12-16 10:48:33 -0500 |
---|---|---|
committer | Dmitriy Boltovskiy <dboltovskyi@luxoft.com> | 2020-12-16 10:48:33 -0500 |
commit | 2097cabea6062fd2071b7d0ecd6c5779364be806 (patch) | |
tree | 39181d259053c941a1a3ca03a01ca2a886133ad8 /src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_request.cc | |
parent | 6ef9cfb61065b10785ad4fc37f0b0b0463f86fb7 (diff) | |
parent | 04ced64614e550490e1eae4b866d5d70092a5450 (diff) | |
download | sdl_core-2097cabea6062fd2071b7d0ecd6c5779364be806.tar.gz |
Merge remote-tracking branch 'smart/develop' into fix/sdl_does_not_unsubscribe_from_subbuttons_after_receiving_responsefix/sdl_does_not_unsubscribe_from_subbuttons_after_receiving_response
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.cc | 35 |
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; |