diff options
author | Andrey Oleynik (GitHub) <aoleynik@luxoft.com> | 2017-09-19 16:51:35 +0300 |
---|---|---|
committer | Andriy Byzhynar <AByzhynar@luxoft.com> | 2018-01-18 11:26:30 +0200 |
commit | a6791129fb1cfcd5dad96e4987b1c2664aafb61e (patch) | |
tree | 82d991edadfd29485946fd07c0f31174c97b0e17 /src/components/include | |
parent | e8911d03dde016a29b01fe80533bc6ac56531678 (diff) | |
download | sdl_core-a6791129fb1cfcd5dad96e4987b1c2664aafb61e.tar.gz |
Adds main logic and related bugfixes for transport switching
Diffstat (limited to 'src/components/include')
12 files changed, 126 insertions, 22 deletions
diff --git a/src/components/include/application_manager/application_manager.h b/src/components/include/application_manager/application_manager.h index 15a9f39348..e0c3414bce 100644 --- a/src/components/include/application_manager/application_manager.h +++ b/src/components/include/application_manager/application_manager.h @@ -313,6 +313,17 @@ class ApplicationManager { virtual void ProcessQueryApp(const smart_objects::SmartObject& sm_object, const uint32_t connection_key) = 0; + /** + * @brief ProcessReconnection handles reconnection flow for application on + * transport switch + * @param application Pointer to switched application, must be validated + * before passing + * @param connection_key Connection key from registration request of switched + * application + */ + virtual void ProcessReconnection(ApplicationSharedPtr application, + const uint32_t connection_key) = 0; + virtual bool is_attenuated_supported() const = 0; /** @@ -534,6 +545,8 @@ class ApplicationManager { virtual bool IsApplicationForbidden( uint32_t connection_key, const std::string& policy_app_id) const = 0; + virtual bool IsAppInReconnectMode(const std::string& policy_app_id) const = 0; + virtual resumption::ResumeCtrl& resume_controller() = 0; /** @@ -594,14 +607,14 @@ class ApplicationManager { /** * @brief CreateRegularState create regular HMI state for application - * @param app_id + * @param app Application * @param hmi_level of returned state * @param audio_state of returned state * @param system_context of returned state * @return new regular HMI state */ virtual HmiStatePtr CreateRegularState( - uint32_t app_id, + utils::SharedPtr<Application> app, mobile_apis::HMILevel::eType hmi_level, mobile_apis::AudioStreamingState::eType audio_state, mobile_apis::SystemContext::eType system_context) const = 0; diff --git a/src/components/include/connection_handler/connection_handler.h b/src/components/include/connection_handler/connection_handler.h index c70861b5f6..678f8e8fab 100644 --- a/src/components/include/connection_handler/connection_handler.h +++ b/src/components/include/connection_handler/connection_handler.h @@ -80,6 +80,8 @@ 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; /** @@ -168,18 +170,6 @@ class ConnectionHandler { uint8_t protocol_version) = 0; /** - * \brief information about given Connection Key. - * \param key Unique key used by other components as session identifier - * \param app_id Returned: ApplicationID - * \param sessions_list Returned: List of session keys - * \param device_id Returned: DeviceID - * \return int32_t -1 in case of error or 0 in case of success - */ - virtual int32_t GetDataOnSessionKey(uint32_t key, - uint32_t* app_id, - std::list<int32_t>* sessions_list, - uint32_t* device_id) const = 0; - /** * @brief GetConnectedDevicesMAC allows to obtain MAC adresses for all * currently connected devices. * diff --git a/src/components/include/connection_handler/connection_handler_observer.h b/src/components/include/connection_handler/connection_handler_observer.h index 6bfc78af24..f06c72bd7b 100644 --- a/src/components/include/connection_handler/connection_handler_observer.h +++ b/src/components/include/connection_handler/connection_handler_observer.h @@ -33,6 +33,7 @@ #ifndef SRC_COMPONENTS_INCLUDE_CONNECTION_HANDLER_CONNECTION_HANDLER_OBSERVER_H_ #define SRC_COMPONENTS_INCLUDE_CONNECTION_HANDLER_CONNECTION_HANDLER_OBSERVER_H_ +#include <string> #include "connection_handler/device.h" #include "connection_handler/connection.h" #include "connection_handler/connection_handler.h" @@ -123,6 +124,10 @@ class ConnectionHandlerObserver { const protocol_handler::ServiceType& type, const connection_handler::CloseSessionReason& close_reason) = 0; + virtual void OnDeviceSwitchingStart(const std::string& device_uid) = 0; + + virtual void OnDeviceSwitchFinish(const std::string& device_uid) = 0; + #ifdef ENABLE_SECURITY virtual security_manager::SSLContext::HandshakeContext GetHandshakeContext( uint32_t key) const = 0; diff --git a/src/components/include/protocol_handler/session_observer.h b/src/components/include/protocol_handler/session_observer.h index 7ac7a84d6d..e84172524a 100644 --- a/src/components/include/protocol_handler/session_observer.h +++ b/src/components/include/protocol_handler/session_observer.h @@ -183,10 +183,11 @@ class SessionObserver { * \param device_id Returned: DeviceID * \return int32_t -1 in case of error or 0 in case of success */ - virtual int32_t GetDataOnSessionKey(uint32_t key, - uint32_t* app_id, - std::list<int32_t>* sessions_list, - uint32_t* device_id) const = 0; + virtual int32_t GetDataOnSessionKey( + uint32_t key, + uint32_t* app_id, + std::list<int32_t>* sessions_list, + transport_manager::DeviceHandle* device_id) const = 0; /** * \brief information about device diff --git a/src/components/include/transport_manager/common.h b/src/components/include/transport_manager/common.h index c1fc51dc8a..833a35602a 100644 --- a/src/components/include/transport_manager/common.h +++ b/src/components/include/transport_manager/common.h @@ -58,7 +58,7 @@ enum { /** * @brief Type definition for variable that hold handle of device. */ -typedef unsigned int DeviceHandle; +typedef size_t DeviceHandle; /** * @brief Type definition for variable that hold connection unique identifier. diff --git a/src/components/include/transport_manager/transport_adapter/device.h b/src/components/include/transport_manager/transport_adapter/device.h index 3adb6cd2e6..c0e97e6a98 100644 --- a/src/components/include/transport_manager/transport_adapter/device.h +++ b/src/components/include/transport_manager/transport_adapter/device.h @@ -86,6 +86,14 @@ 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 ee726ff1d3..6f2ef7b62e 100644 --- a/src/components/include/transport_manager/transport_adapter/transport_adapter.h +++ b/src/components/include/transport_manager/transport_adapter/transport_adapter.h @@ -59,7 +59,16 @@ class TransportAdapterListener; // TODO(EZamakhov): cahnge to DeviceUID // typedef std::string DeviceType; -enum DeviceType { AOA, PASA_AOA, BLUETOOTH, PASA_BLUETOOTH, MME, TCP, UNKNOWN }; +enum DeviceType { + AOA, + PASA_AOA, + BLUETOOTH, + PASA_BLUETOOTH, + IOS_BT, + IOS_USB, + TCP, + UNKNOWN +}; typedef std::map<DeviceType, std::string> DeviceTypes; @@ -278,6 +287,16 @@ 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. + */ + virtual void StopDevice(const DeviceUID& device_id) const = 0; + + virtual void DeviceSwitched(const DeviceUID& device_handle) = 0; + #ifdef TELEMETRY_MONITOR /** * @brief Return Time metric observer diff --git a/src/components/include/transport_manager/transport_adapter/transport_adapter_event.h b/src/components/include/transport_manager/transport_adapter/transport_adapter_event.h index 7879a136b2..8221ecf10b 100644 --- a/src/components/include/transport_manager/transport_adapter/transport_adapter_event.h +++ b/src/components/include/transport_manager/transport_adapter/transport_adapter_event.h @@ -39,6 +39,27 @@ namespace transport_manager { +/** + * @enum Available types of events. + */ +enum class EventTypeEnum { + ON_SEARCH_DONE = 0, + ON_SEARCH_FAIL, + ON_DEVICE_LIST_UPDATED, + ON_DEVICE_ADDED, + ON_FIND_NEW_APPLICATIONS_REQUEST, + ON_CONNECT_DONE, + ON_CONNECT_FAIL, + ON_DISCONNECT_DONE, + ON_DISCONNECT_FAIL, + ON_SEND_DONE, + ON_SEND_FAIL, + ON_RECEIVED_DONE, + ON_RECEIVED_FAIL, + ON_COMMUNICATION_ERROR, + ON_UNEXPECTED_DISCONNECT +}; + class TransportAdapterEvent { public: TransportAdapterEvent() {} @@ -52,7 +73,7 @@ class TransportAdapterEvent { * @param data Smart pointer to the raw message. * @param error Error class that contains details of this error situation. */ - TransportAdapterEvent(int type, + TransportAdapterEvent(EventTypeEnum type, transport_adapter::TransportAdapter* adapter, const DeviceUID& device_handle, const ApplicationHandle& application_id, @@ -67,7 +88,7 @@ class TransportAdapterEvent { /** * @brief Value that describe event type. */ - int event_type; + EventTypeEnum event_type; /** * @brief Handle of application */ diff --git a/src/components/include/transport_manager/transport_manager.h b/src/components/include/transport_manager/transport_manager.h index 0847886c46..9b8388107f 100644 --- a/src/components/include/transport_manager/transport_manager.h +++ b/src/components/include/transport_manager/transport_manager.h @@ -132,6 +132,8 @@ 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 e9f49e3152..2ed75e397c 100644 --- a/src/components/include/transport_manager/transport_manager_listener.h +++ b/src/components/include/transport_manager/transport_manager_listener.h @@ -70,6 +70,23 @@ class TransportManagerListener { virtual void OnDeviceRemoved(const DeviceInfo& device_info) = 0; /** + * @brief OnDeviceSwitchingStart allows to notify listener that device is + *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; + + /** + * @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; + + /** * @brief Reaction to the event, when scanning of devices is finished. */ virtual void OnScanDevicesFinished() = 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 c5eb0be37c..e248b27341 100644 --- a/src/components/include/transport_manager/transport_manager_listener_empty.h +++ b/src/components/include/transport_manager/transport_manager_listener_empty.h @@ -69,6 +69,22 @@ 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. + * + * @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. + * + * @param device_uid the id for the device which is fails to reconnect. + */ + void OnDeviceSwitchFinish(const DeviceUID& device_uid) OVERRIDE {} + + /** * @brief Reaction to the event, when scanning of devices is finished. */ void OnScanDevicesFinished() OVERRIDE {} diff --git a/src/components/include/transport_manager/transport_manager_settings.h b/src/components/include/transport_manager/transport_manager_settings.h index f33c5344e0..feb3fa2c02 100644 --- a/src/components/include/transport_manager/transport_manager_settings.h +++ b/src/components/include/transport_manager/transport_manager_settings.h @@ -51,6 +51,18 @@ class TransportManagerSettings : public TransportManagerMMESettings { * @brief Returns port for TCP transport adapter */ virtual uint16_t transport_manager_tcp_adapter_port() const = 0; + + /** + * @brief Returns the millisecond count before timeout + * for transport change feature occures. + */ + virtual uint32_t app_transport_change_timer() const = 0; + + /** + * @brief Returns the millisecond count as addition to + * the transport change timeout value. + */ + virtual uint32_t app_transport_change_timer_addition() const = 0; }; } // namespace transport_manager #endif // SRC_COMPONENTS_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_MANAGER_SETTINGS_H_ |