From a6791129fb1cfcd5dad96e4987b1c2664aafb61e Mon Sep 17 00:00:00 2001 From: "Andrey Oleynik (GitHub)" Date: Tue, 19 Sep 2017 16:51:35 +0300 Subject: Adds main logic and related bugfixes for transport switching --- .../include/application_manager/commands/command_impl.h | 4 ++-- .../commands/hmi/on_app_unregistered_notification.h | 14 ++++++++++++-- .../commands/mobile/register_app_interface_request.h | 15 +++++++++++++-- 3 files changed, 27 insertions(+), 6 deletions(-) (limited to 'src/components/application_manager/include/application_manager/commands') diff --git a/src/components/application_manager/include/application_manager/commands/command_impl.h b/src/components/application_manager/include/application_manager/commands/command_impl.h index 66456dfdb1..7cab97d423 100644 --- a/src/components/application_manager/include/application_manager/commands/command_impl.h +++ b/src/components/application_manager/include/application_manager/commands/command_impl.h @@ -146,14 +146,14 @@ class CommandImpl : public Command { * * @param message Smartobject to be parsed */ - void ReplaceMobileByHMIAppId(smart_objects::SmartObject& message); + bool ReplaceMobileByHMIAppId(smart_objects::SmartObject& message); /** * @brief Parse smartObject and replace HMI app ID by mobile app Id * * @param message Smartobject to be parsed */ - void ReplaceHMIByMobileAppId(smart_objects::SmartObject& message); + bool ReplaceHMIByMobileAppId(smart_objects::SmartObject& message); MessageSharedPtr message_; uint32_t default_timeout_; diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_app_unregistered_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_app_unregistered_notification.h index 980e558d6f..f49dac071f 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_app_unregistered_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_app_unregistered_notification.h @@ -55,12 +55,22 @@ class OnAppUnregisteredNotification : public NotificationToHMI { /** * @brief OnAppUnregisteredNotification class destructor **/ - virtual ~OnAppUnregisteredNotification(); + ~OnAppUnregisteredNotification() FINAL; + + /** + * @brief Init overrides and skips replacement of app id with hmi id since + * 1) at the moment this notification is being sent there is no application + * registered in application manager + * 2) hmi id is already used whenever this message is being constructed, so + * its already there + * @return True in any case + */ + bool Init() FINAL; /** * @brief Execute command **/ - virtual void Run(); + virtual void Run() FINAL; private: DISALLOW_COPY_AND_ASSIGN(OnAppUnregisteredNotification); diff --git a/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h b/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h index cc3d5b685c..369fd68868 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h @@ -77,15 +77,17 @@ class RegisterAppInterfaceRequest : public CommandRequestImpl { **/ virtual void Run(); + private: + enum class AppicationType { kNewApplication, kSwitchedApplication }; + /** * @brief Sends RegisterAppInterface response to mobile * *@param application_impl application * **/ - void SendRegisterAppInterfaceResponseToMobile(); + void SendRegisterAppInterfaceResponseToMobile(AppicationType app_type); - private: smart_objects::SmartObjectSPtr GetLockScreenIconUrlNotification( const uint32_t connection_key, ApplicationSharedPtr app); @@ -184,6 +186,15 @@ class RegisterAppInterfaceRequest : public CommandRequestImpl { */ void SendSubscribeCustomButtonNotification(); + /** + * @brief IsApplicationSwitched checks whether application is switched from + * another transport. If application id is found, but not in reconnection + * list, returns 'already registered' code. Otherwise - proceed with + * switching. + * @return True if application is detected as switched, otherwise false. + */ + bool IsApplicationSwitched(); + private: std::string response_info_; mobile_apis::Result::eType result_checking_app_hmi_type_; -- cgit v1.2.1