From 8fa4f3b498916b89552394d25f9482ce4b06de5a Mon Sep 17 00:00:00 2001 From: "Andrey Oleynik (GitHub)" Date: Thu, 21 Sep 2017 17:40:49 +0300 Subject: Adds descriptions, removes unused code --- .../include/application_manager/application_impl.h | 1 - .../application_manager/application_manager_impl.h | 31 ++++++++++++++++++-- .../application_manager/commands/command_impl.h | 12 ++++---- .../mobile/register_app_interface_request.h | 11 +++++--- .../include/application_manager/hmi_state.h | 17 +++++++++++ .../application_manager/src/application_impl.cc | 1 - .../src/application_manager_impl.cc | 27 ++++++++++++++++-- .../connection_handler/connection_handler_impl.h | 12 ++++++-- .../src/connection_handler_impl.cc | 13 --------- .../application_manager/application_manager.h | 7 +++++ .../connection_handler/connection_handler.h | 2 -- .../connection_handler_observer.h | 10 +++++++ .../connection_handler/mock_connection_handler.h | 1 - .../transport_manager/mock_transport_manager.h | 1 - .../transport_manager/transport_adapter/device.h | 8 ------ .../transport_adapter/transport_adapter.h | 33 ++++++++++------------ .../include/transport_manager/transport_manager.h | 2 -- .../transport_manager/transport_manager_listener.h | 5 +--- .../transport_manager_listener_empty.h | 8 ++---- .../transport_adapter/transport_adapter_impl.h | 12 ++++++++ .../transport_adapter/transport_adapter_listener.h | 5 ++++ .../transport_adapter_listener_impl.h | 5 ++++ .../transport_manager/transport_manager_impl.h | 26 +++++++++++++++-- .../transport_adapter/transport_adapter_impl.cc | 2 -- .../src/transport_manager_impl.cc | 7 ----- .../transport_manager/src/usb/usb_aoa_adapter.cc | 2 +- 26 files changed, 174 insertions(+), 87 deletions(-) diff --git a/src/components/application_manager/include/application_manager/application_impl.h b/src/components/application_manager/include/application_manager/application_impl.h index 3c5353dfa2..e0e3d317e3 100644 --- a/src/components/application_manager/include/application_manager/application_impl.h +++ b/src/components/application_manager/include/application_manager/application_impl.h @@ -458,7 +458,6 @@ class ApplicationImpl : public virtual Application, uint32_t delete_file_in_none_count_; uint32_t list_files_in_none_count_; std::string app_icon_path_; - connection_handler::DeviceHandle device_; const std::string mac_address_; connection_handler::DeviceHandle device_id_; std::string bundle_id_; 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 0e676f5f55..754a2bfa43 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 @@ -501,7 +501,7 @@ class ApplicationManagerImpl */ void SetAllAppsAllowed(const bool allowed) OVERRIDE; - /** + /** * @brief CreateRegularState create regular HMI state for application * @param app Application * @param hmi_level of returned state @@ -853,10 +853,23 @@ class ApplicationManagerImpl void OnFindNewApplicationsRequest() OVERRIDE; void RemoveDevice( const connection_handler::DeviceHandle& device_handle) OVERRIDE; + + /** + * @brief OnDeviceSwitchingStart is invoked on device transport switching + * start (e.g. from Bluetooth to USB) and creates waiting list of applications + * expected to be re-registered after switching is complete + * @param device_uid UID of device being switched + */ void OnDeviceSwitchingStart(const std::string& device_uid) FINAL; + /** + * @brief OnDeviceSwitchFinish is invoked on device trasport switching end + * i.e. timeout for switching is expired, unregisters applications from + * waiting list which haven't been re-registered and clears the waiting list + * @param device_uid UID of device being switched + */ void OnDeviceSwitchFinish(const std::string& device_uid) FINAL; - + DEPRECATED bool OnServiceStartedCallback( const connection_handler::DeviceHandle& device_handle, const int32_t& session_key, @@ -1232,6 +1245,13 @@ class ApplicationManagerImpl bool IsAppsQueriedFrom( const connection_handler::DeviceHandle handle) const OVERRIDE; + /** + * @brief IsAppInReconnectMode check if application belongs to session + * affected by transport switching at the moment by checking internal + * waiting list prepared on switching start + * @param policy_app_id Application id + * @return True if application is in the waiting list, otherwise - false + */ bool IsAppInReconnectMode(const std::string& policy_app_id) const FINAL; bool IsStopping() const OVERRIDE { @@ -1434,7 +1454,8 @@ class ApplicationManagerImpl * @param service_type Type of service to start * @return True on success, false on fail */ - DEPRECATED bool StartNaviService(uint32_t app_id, + // DEPRECATED + bool StartNaviService(uint32_t app_id, protocol_handler::ServiceType service_type); /** @@ -1671,6 +1692,10 @@ class ApplicationManagerImpl std::auto_ptr app_launch_dto_; std::auto_ptr app_launch_ctrl_; + /** + * @brief ReregisterWaitList is list of applications expected to be + * re-registered after transport switching is complete + */ typedef std::vector ReregisterWaitList; ReregisterWaitList reregister_wait_list_; 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 7cab97d423..32e50fe4f1 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 @@ -142,16 +142,16 @@ class CommandImpl : public Command { protected: /** - * @brief Parse smartObject and replace mobile app Id by HMI app ID - * - * @param message Smartobject to be parsed + * @brief Parses mobile message and replaces mobile app id with HMI app id + * @param message Message to replace its ids + * @return True if replacement succeeded, otherwise - false */ bool ReplaceMobileByHMIAppId(smart_objects::SmartObject& message); /** - * @brief Parse smartObject and replace HMI app ID by mobile app Id - * - * @param message Smartobject to be parsed + * @brief Parses message from HMI and replaces HMI app id with mobile app id + * @param message Message to replace its ids + * @return True if replacement succeeded, otherwise - false */ bool ReplaceHMIByMobileAppId(smart_objects::SmartObject& message); 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 369fd68868..938981f382 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 @@ -78,13 +78,16 @@ class RegisterAppInterfaceRequest : public CommandRequestImpl { virtual void Run(); private: + /** + * @brief The AppicationType enum defines whether application is newly + * registered or existing and being switched over another transport + */ enum class AppicationType { kNewApplication, kSwitchedApplication }; /** - * @brief Sends RegisterAppInterface response to mobile - * - *@param application_impl application - * + * @brief Prepares and sends RegisterAppInterface response to mobile + * considering application type + * @param app_type Type of application **/ void SendRegisterAppInterfaceResponseToMobile(AppicationType app_type); diff --git a/src/components/application_manager/include/application_manager/hmi_state.h b/src/components/application_manager/include/application_manager/hmi_state.h index 89c72370a5..16d6d2c271 100644 --- a/src/components/application_manager/include/application_manager/hmi_state.h +++ b/src/components/application_manager/include/application_manager/hmi_state.h @@ -71,8 +71,20 @@ class HmiState { STATE_ID_EMBEDDED_NAVI }; + /** + * @brief HmiState constructor + * @param app Application pointer + * @param app_mngr Application manager + */ HmiState(utils::SharedPtr app, const ApplicationManager& app_mngr); + + /** + * @brief HmiState constructor + * @param app Application pointer + * @param app_mngr Application manager + * @param state_id HMI state to assign + */ HmiState(utils::SharedPtr app, const ApplicationManager& app_mngr, StateID state_id); @@ -195,6 +207,11 @@ class HmiState { */ bool is_voice_communication_app() const; + /** + * @brief is_mobile_projection_app checks if application of 'projection' + * HMI type + * @return True if application is of 'projection' HMI type, otherwise - false + */ bool is_mobile_projection_app() const; private: diff --git a/src/components/application_manager/src/application_impl.cc b/src/components/application_manager/src/application_impl.cc index 21847ffa1d..467d606f06 100644 --- a/src/components/application_manager/src/application_impl.cc +++ b/src/components/application_manager/src/application_impl.cc @@ -117,7 +117,6 @@ ApplicationImpl::ApplicationImpl( , put_file_in_none_count_(0) , delete_file_in_none_count_(0) , list_files_in_none_count_(0) - , device_(0) , mac_address_(mac_address) , device_id_(device_id) , usage_report_(mobile_app_id, statistics_manager) diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index 65da6ed87e..20083702d4 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -98,6 +98,12 @@ DeviceTypes devicesType = { std::make_pair(std::string("WIFI"), hmi_apis::Common_TransportType::WIFI)}; } +/** + * @brief device_id_comparator is predicate to compare application device id + * @param device_id Device id to compare with + * @param app Application pointer + * @return True if device id of application matches to device id passed + */ bool device_id_comparator(const std::string& device_id, ApplicationSharedPtr app) { LOG4CXX_DEBUG(logger_, @@ -107,6 +113,13 @@ bool device_id_comparator(const std::string& device_id, return device_id == app->mac_address(); } +/** + * @brief policy_app_id_comparator is predicate to compare policy application + * ids + * @param policy_app_id Policy id of application + * @param app Application pointer + * @return True if policy id of application matches to policy id passed + */ bool policy_app_id_comparator(const std::string& policy_app_id, ApplicationSharedPtr app) { DCHECK_OR_RETURN(app, false); @@ -1516,6 +1529,17 @@ void ApplicationManagerImpl::OnServiceEndedCallback( << type << " with reason " << close_reason << " in session 0x" << std::hex << session_key); + auto app = application(static_cast(session_key)); + if (!app) { + return; + } + + if (IsAppInReconnectMode(app->policy_app_id())) { + LOG4CXX_DEBUG(logger_, + "Application is in reconnection list and won't be closed."); + return; + } + if (type == kRpc) { LOG4CXX_INFO(logger_, "Remove application."); /* In case it was unexpected disconnect or some special case @@ -3681,7 +3705,6 @@ bool ApplicationManagerImpl::IsApplicationForbidden( return forbidden_applications.find(name) != forbidden_applications.end(); } -// TODO: check its usage bool ApplicationManagerImpl::IsAppInReconnectMode( const std::string& policy_app_id) const { LOG4CXX_AUTO_TRACE(logger_); @@ -4014,8 +4037,6 @@ void ApplicationManagerImpl::ProcessReconnection( EraseAppFromReconnectionList(application); - connection_handler().OnDeviceConnectionSwitched(device_mac); - SwitchApplication(application, connection_key, new_device_id); // Update connection type for existed device. diff --git a/src/components/connection_handler/include/connection_handler/connection_handler_impl.h b/src/components/connection_handler/include/connection_handler/connection_handler_impl.h index 6638b6f9f7..d0e34a99b9 100644 --- a/src/components/connection_handler/include/connection_handler/connection_handler_impl.h +++ b/src/components/connection_handler/include/connection_handler/connection_handler_impl.h @@ -137,13 +137,21 @@ class ConnectionHandlerImpl void OnDeviceRemoved( const transport_manager::DeviceInfo& device_info) OVERRIDE; + /** + * @brief OnDeviceSwitchingStart notifies listeners on device transport + * switching start + * @param device_uid the id of the device which has to be switched. + */ void OnDeviceSwitchingStart(const std::string& device_uid) FINAL; + /** + * @brief OnDeviceSwitchFinish notifies listeners on device transport + * switching completion + * @param device_uid the id for the device which is fails to reconnect. + */ void OnDeviceSwitchFinish( const transport_manager::DeviceUID& device_uid) FINAL; - void OnDeviceConnectionSwitched(const std::string& device_mac) FINAL; - void OnScanDevicesFinished() OVERRIDE; void OnScanDevicesFailed( const transport_manager::SearchDeviceError& error) OVERRIDE; diff --git a/src/components/connection_handler/src/connection_handler_impl.cc b/src/components/connection_handler/src/connection_handler_impl.cc index bba901e16d..b7baf614a0 100644 --- a/src/components/connection_handler/src/connection_handler_impl.cc +++ b/src/components/connection_handler/src/connection_handler_impl.cc @@ -913,19 +913,6 @@ void ConnectionHandlerImpl::RunAppOnDevice(const std::string& device_mac, LOG4CXX_WARN(logger_, "No apps found on device " << device_mac); } -void ConnectionHandlerImpl::OnDeviceConnectionSwitched( - const std::string& device_mac) { - LOG4CXX_AUTO_TRACE(logger_); - auto device_it = device_list_.begin(); - for (; device_it != device_list_.end(); ++device_it) { - const connection_handler::Device& device = device_it->second; - if (device.mac_address() == device_mac) { - transport_manager_.OnDeviceConnectionSwitched(device.device_handle()); - return; - } - } -} - void ConnectionHandlerImpl::ConnectToAllDevices() { for (DeviceMap::iterator i = device_list_.begin(); i != device_list_.end(); ++i) { diff --git a/src/components/include/application_manager/application_manager.h b/src/components/include/application_manager/application_manager.h index e0c3414bce..f137208757 100644 --- a/src/components/include/application_manager/application_manager.h +++ b/src/components/include/application_manager/application_manager.h @@ -545,6 +545,13 @@ class ApplicationManager { virtual bool IsApplicationForbidden( uint32_t connection_key, const std::string& policy_app_id) const = 0; + /** + * @brief IsAppInReconnectMode check if application belongs to session + * affected by transport switching at the moment + * @param policy_app_id Application id + * @return True if application is registered within session being switched, + * otherwise - false + */ virtual bool IsAppInReconnectMode(const std::string& policy_app_id) const = 0; virtual resumption::ResumeCtrl& resume_controller() = 0; diff --git a/src/components/include/connection_handler/connection_handler.h b/src/components/include/connection_handler/connection_handler.h index 678f8e8fab..7b86cd43dc 100644 --- a/src/components/include/connection_handler/connection_handler.h +++ b/src/components/include/connection_handler/connection_handler.h @@ -80,8 +80,6 @@ class ConnectionHandler { virtual void RunAppOnDevice(const std::string& device_handle, const std::string& bundle_id) const = 0; - virtual void OnDeviceConnectionSwitched(const std::string& device_mac) = 0; - virtual void ConnectToAllDevices() = 0; /** diff --git a/src/components/include/connection_handler/connection_handler_observer.h b/src/components/include/connection_handler/connection_handler_observer.h index f06c72bd7b..ac57b93589 100644 --- a/src/components/include/connection_handler/connection_handler_observer.h +++ b/src/components/include/connection_handler/connection_handler_observer.h @@ -124,8 +124,18 @@ class ConnectionHandlerObserver { const protocol_handler::ServiceType& type, const connection_handler::CloseSessionReason& close_reason) = 0; + /** + * @brief OnDeviceSwitchingStart is invoked on device transport switching + * start (e.g. from Bluetooth to USB) + * @param device_uid UID of device being switched + */ virtual void OnDeviceSwitchingStart(const std::string& device_uid) = 0; + /** + * @brief OnDeviceSwitchFinish is invoked on device trasport switching end + * i.e. timeout for switching is expired + * @param device_uid UID of device being switched + */ virtual void OnDeviceSwitchFinish(const std::string& device_uid) = 0; #ifdef ENABLE_SECURITY diff --git a/src/components/include/test/connection_handler/mock_connection_handler.h b/src/components/include/test/connection_handler/mock_connection_handler.h index b9c1fdea9b..5cb5f471b5 100644 --- a/src/components/include/test/connection_handler/mock_connection_handler.h +++ b/src/components/include/test/connection_handler/mock_connection_handler.h @@ -61,7 +61,6 @@ class MockConnectionHandler : public connection_handler::ConnectionHandler { void(connection_handler::DeviceHandle device_handle)); MOCK_CONST_METHOD2(RunAppOnDevice, void(const std::string&, const std::string&)); - MOCK_METHOD1(OnDeviceConnectionSwitched, void(const std::string& device_mac)); MOCK_METHOD0(ConnectToAllDevices, void()); MOCK_METHOD1(CloseRevokedConnection, void(uint32_t connection_key)); MOCK_METHOD1(CloseConnection, void(ConnectionHandle connection_handle)); diff --git a/src/components/include/test/transport_manager/mock_transport_manager.h b/src/components/include/test/transport_manager/mock_transport_manager.h index cc94c60f6f..cc8bd5ab85 100644 --- a/src/components/include/test/transport_manager/mock_transport_manager.h +++ b/src/components/include/test/transport_manager/mock_transport_manager.h @@ -74,7 +74,6 @@ class MockTransportManager : public ::transport_manager::TransportManager, MOCK_CONST_METHOD1(Visibility, int(const bool&)); MOCK_METHOD1(SetTelemetryObserver, void(transport_manager::TMTelemetryObserver* observer)); - MOCK_METHOD1(OnDeviceConnectionSwitched, void(const DeviceHandle handle)); }; } // namespace transport_manager_test diff --git a/src/components/include/transport_manager/transport_adapter/device.h b/src/components/include/transport_manager/transport_adapter/device.h index c0e97e6a98..3adb6cd2e6 100644 --- a/src/components/include/transport_manager/transport_adapter/device.h +++ b/src/components/include/transport_manager/transport_adapter/device.h @@ -86,14 +86,6 @@ class Device { UNUSED(bundle_id); } - /** - * @brief Init allows to initialize device. - * Currently overloadded only for iAP devices. - */ - virtual bool Init() { - return true; - } - virtual void Stop() {} inline const DeviceUID& unique_device_id() const { diff --git a/src/components/include/transport_manager/transport_adapter/transport_adapter.h b/src/components/include/transport_manager/transport_adapter/transport_adapter.h index 6f2ef7b62e..cd097b698d 100644 --- a/src/components/include/transport_manager/transport_adapter/transport_adapter.h +++ b/src/components/include/transport_manager/transport_adapter/transport_adapter.h @@ -56,19 +56,11 @@ namespace transport_adapter { class TransportAdapterListener; -// TODO(EZamakhov): cahnge to DeviceUID -// typedef std::string DeviceType; - -enum DeviceType { - AOA, - PASA_AOA, - BLUETOOTH, - PASA_BLUETOOTH, - IOS_BT, - IOS_USB, - TCP, - UNKNOWN -}; +/** + * @brief The DeviceType enum defines types based on available transport + * adapters + */ +enum DeviceType { AOA, BLUETOOTH, IOS_BT, IOS_USB, TCP, UNKNOWN }; typedef std::map DeviceTypes; @@ -288,13 +280,18 @@ class TransportAdapter { virtual std::string DeviceName(const DeviceUID& device_id) const = 0; /** - * @brief StopDevice Allows to stop all activity on devices without - * removing one from device list - * - * @param device_id unique device identifier that has to be stopped. - */ + * @brief StopDevice Stop all activity on device without removing it from + * devices list + * @param device_id unique device identifier that has to be stopped. + */ virtual void StopDevice(const DeviceUID& device_id) const = 0; + /** + * @brief DeviceSwitched is triggered for adapter to proceed with possible + * further switching steps required on device side. E.g. to notify device + * on end of switching so it can disconnect transport being switched from. + * @param device_handle Device id to notify on event + */ virtual void DeviceSwitched(const DeviceUID& device_handle) = 0; #ifdef TELEMETRY_MONITOR diff --git a/src/components/include/transport_manager/transport_manager.h b/src/components/include/transport_manager/transport_manager.h index 9b8388107f..0847886c46 100644 --- a/src/components/include/transport_manager/transport_manager.h +++ b/src/components/include/transport_manager/transport_manager.h @@ -132,8 +132,6 @@ class TransportManager { virtual void RunAppOnDevice(const DeviceHandle device_handle, const std::string& bundle_id) = 0; - virtual void OnDeviceConnectionSwitched(const DeviceHandle handle) = 0; - /** * @brief Post event in the event queue. * diff --git a/src/components/include/transport_manager/transport_manager_listener.h b/src/components/include/transport_manager/transport_manager_listener.h index 2ed75e397c..1f1503bbe0 100644 --- a/src/components/include/transport_manager/transport_manager_listener.h +++ b/src/components/include/transport_manager/transport_manager_listener.h @@ -71,9 +71,7 @@ class TransportManagerListener { /** * @brief OnDeviceSwitchingStart allows to notify listener that device is - *going - * to switch its connection. - * + * going to switch its connection. * @param device_uid the id of the device which has to be switched. */ virtual void OnDeviceSwitchingStart(const DeviceUID& device_uid) = 0; @@ -81,7 +79,6 @@ class TransportManagerListener { /** * @brief OnDeviceSwitchFinish notifies listener that device reconnection * fails due to some reason. - * * @param device_uid the id for the device which is fails to reconnect. */ virtual void OnDeviceSwitchFinish(const DeviceUID& device_uid) = 0; diff --git a/src/components/include/transport_manager/transport_manager_listener_empty.h b/src/components/include/transport_manager/transport_manager_listener_empty.h index e248b27341..a87c5cb690 100644 --- a/src/components/include/transport_manager/transport_manager_listener_empty.h +++ b/src/components/include/transport_manager/transport_manager_listener_empty.h @@ -69,17 +69,15 @@ class TransportManagerListenerEmpty : public TransportManagerListener { void OnDeviceRemoved(const DeviceInfo& device_info) OVERRIDE {} /** - * @brief OnDeviceSwitching allows to notify listener that device is going - * to switch its connection. - * + * @brief OnDeviceSwitchingStart allows to notify listener that device is + * going to switch its connection. This default implementation does nothing. * @param device_uid the id of the device which has to be switched. */ void OnDeviceSwitchingStart(const DeviceUID& device_uid) OVERRIDE {} /** * @brief OnDeviceSwitchFinish notifies listener that device reconnection - * fails due to some reason. - * + * fails due to some reason. This default implementation does nothing. * @param device_uid the id for the device which is fails to reconnect. */ void OnDeviceSwitchFinish(const DeviceUID& device_uid) OVERRIDE {} diff --git a/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_impl.h b/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_impl.h index 8d1b96bbfd..e4d70d5b07 100644 --- a/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_impl.h +++ b/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_impl.h @@ -408,8 +408,20 @@ class TransportAdapterImpl : public TransportAdapter, */ std::string DeviceName(const DeviceUID& device_id) const OVERRIDE; + /** + * @brief StopDevice looks for specific device in devices list and calls + * Stop() interface of that device + * @param device_id unique device identifier that has to be stopped. + */ void StopDevice(const DeviceUID& device_id) const FINAL; + /** + * @brief DeviceSwitched is triggered for adapter to proceed with possible + * further switching steps required on device side. E.g. to notify device + * on end of switching so it can disconnect transport being switched from. + * This is default implemenation does nothing. Must be overloaded if needed. + * @param device_handle Device id to notify on event + */ void DeviceSwitched(const DeviceUID& device_handle) FINAL; /** diff --git a/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener.h b/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener.h index 3ac664fa29..8cc812fc4d 100644 --- a/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener.h +++ b/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener.h @@ -84,6 +84,11 @@ class TransportAdapterListener { virtual void OnDeviceListUpdated( const TransportAdapter* transport_adapter) = 0; + /** + * @brief OnDeviceAdded is triggered by transport adapter on new device + * coming + * @param device_uid Device id of new device + */ virtual void OnDeviceAdded(DeviceUID device_uid) = 0; /** diff --git a/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener_impl.h b/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener_impl.h index 5018549b86..4977547f97 100644 --- a/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener_impl.h +++ b/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener_impl.h @@ -85,6 +85,11 @@ class TransportAdapterListenerImpl */ virtual void OnDeviceListUpdated(const TransportAdapter* adapter); + /** + * @brief OnDeviceAdded is triggered by transport adapter on new device + * coming and sends ON_DEVICE_ADDED event to transport manager + * @param device_uid Device id of new device + */ virtual void OnDeviceAdded(DeviceUID device_uid); virtual void OnFindNewApplicationsRequest(const TransportAdapter* adapter); diff --git a/src/components/transport_manager/include/transport_manager/transport_manager_impl.h b/src/components/transport_manager/include/transport_manager/transport_manager_impl.h index ea0392cf0c..4c8e36b745 100644 --- a/src/components/transport_manager/include/transport_manager/transport_manager_impl.h +++ b/src/components/transport_manager/include/transport_manager/transport_manager_impl.h @@ -196,8 +196,6 @@ class TransportManagerImpl void RunAppOnDevice(const DeviceHandle device_handle, const std::string& bundle_id) OVERRIDE; - void OnDeviceConnectionSwitched(const DeviceHandle handle) FINAL; - /** * @brief Post event in the event queue. * @@ -447,6 +445,18 @@ class TransportManagerImpl ConnectionInternal* GetActiveConnection(const DeviceUID& device, const ApplicationHandle& application); + /** + * @brief TryDeviceSwitch in case USB device is connected and there is + * appropriate Bluetooth device with same UUID stops Bluetooth device and + * initiates switching sequence for upper layers. Also starts timer to wait + * for sequence to complete. + * @param ta Transport adapter having device to try switching sequence + * @param value Value from device-to-adapter container having all the data + * required + * At the moment implementation implies only IAP2-Bluetooth to IAP2-USB + * switching + * @return True if sequence has been successfully initiated, otherwise - false + */ bool TryDeviceSwitch(TransportAdapter* ta, DeviceToAdapterMap::iterator value); @@ -465,12 +475,22 @@ class TransportManagerImpl unsigned int frame_size, unsigned char** frame); + /** + * @brief OnDeviceAdded processes new device detected by specific transport + * adapter + * @param ta Pointer to transport adapter + */ void OnDeviceAdded(TransportAdapter* ta); void OnDeviceListUpdated(TransportAdapter* ta); void DisconnectAllDevices(); void TerminateAllAdapters(); int InitAllAdapters(); static Connection convert(const ConnectionInternal& p); + + /** + * @brief ReconnectionTimeout notifies upper layers on switching sequence + * timeout expiration + */ void ReconnectionTimeout(); /** @@ -482,4 +502,4 @@ class TransportManagerImpl void UpdateDeviceMapping(TransportAdapter* ta); }; // class TransportManagerImpl } // namespace transport_manager -#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_MANAGER_IMPL_H_ \ No newline at end of file +#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_MANAGER_IMPL_H_ diff --git a/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc b/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc index e0f5c0da6d..4513597400 100644 --- a/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc +++ b/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc @@ -47,11 +47,9 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") namespace { DeviceTypes devicesType = { std::make_pair(DeviceType::AOA, std::string("USB_AOA")), - std::make_pair(DeviceType::PASA_AOA, std::string("USB_AOA")), std::make_pair(DeviceType::IOS_USB, std::string("USB_IOS")), std::make_pair(DeviceType::IOS_BT, std::string("IOS_BLUETOOTH")), std::make_pair(DeviceType::BLUETOOTH, std::string("BLUETOOTH")), - std::make_pair(DeviceType::PASA_BLUETOOTH, std::string("BLUETOOTH")), std::make_pair(DeviceType::TCP, std::string("WIFI"))}; } diff --git a/src/components/transport_manager/src/transport_manager_impl.cc b/src/components/transport_manager/src/transport_manager_impl.cc index 01baaef8df..8c5259f811 100644 --- a/src/components/transport_manager/src/transport_manager_impl.cc +++ b/src/components/transport_manager/src/transport_manager_impl.cc @@ -379,13 +379,6 @@ void TransportManagerImpl::RunAppOnDevice(const DeviceHandle device_handle, return; } -void TransportManagerImpl::OnDeviceConnectionSwitched( - const DeviceHandle handle) { - LOG4CXX_AUTO_TRACE(logger_); - UNUSED(handle); - // At the moment does nothing -} - int TransportManagerImpl::ReceiveEventFromDevice( const TransportAdapterEvent& event) { LOG4CXX_TRACE(logger_, "enter. TransportAdapterEvent: " << &event); diff --git a/src/components/transport_manager/src/usb/usb_aoa_adapter.cc b/src/components/transport_manager/src/usb/usb_aoa_adapter.cc index 3462b557ce..b7faf1ef6b 100644 --- a/src/components/transport_manager/src/usb/usb_aoa_adapter.cc +++ b/src/components/transport_manager/src/usb/usb_aoa_adapter.cc @@ -60,7 +60,7 @@ UsbAoaAdapter::UsbAoaAdapter(resumption::LastState& last_state, UsbAoaAdapter::~UsbAoaAdapter() {} DeviceType UsbAoaAdapter::GetDeviceType() const { - return PASA_AOA; + return AOA; } bool UsbAoaAdapter::IsInitialised() const { -- cgit v1.2.1