diff options
Diffstat (limited to 'src/components/include')
25 files changed, 313 insertions, 24 deletions
diff --git a/src/components/include/application_manager/application_manager.h b/src/components/include/application_manager/application_manager.h index 0888e1fc90..39fc3c7ae6 100644 --- a/src/components/include/application_manager/application_manager.h +++ b/src/components/include/application_manager/application_manager.h @@ -322,6 +322,19 @@ class ApplicationManager { virtual mobile_api::HMILevel::eType GetDefaultHmiLevel( ApplicationConstSharedPtr application) const = 0; + + /** + * @brief Checks if required transport for resumption is available + * + * The required transport can be configured through smartDeviceLink.ini file. + * + * @param application an instance of the app to check + * @return true if the app is connected through one of the required + * transports, false otherwise + */ + virtual bool CheckResumptionRequiredTransportAvailable( + ApplicationConstSharedPtr application) const = 0; + /** * @brief hmi_capabilities return capabilities of hmi * @return capabilities of hmi diff --git a/src/components/include/application_manager/application_manager_settings.h b/src/components/include/application_manager/application_manager_settings.h index e745a831c6..8f9d7496c8 100644 --- a/src/components/include/application_manager/application_manager_settings.h +++ b/src/components/include/application_manager/application_manager_settings.h @@ -38,6 +38,8 @@ #include <stdint.h> #include <string> +#include <map> +#include <vector> namespace application_manager { class ApplicationManagerSettings : public RequestControlerSettings, @@ -87,6 +89,13 @@ class ApplicationManagerSettings : public RequestControlerSettings, virtual const uint32_t& app_resuming_timeout() const = 0; virtual uint16_t attempts_to_open_resumption_db() const = 0; virtual uint16_t open_attempt_timeout_ms_resumption_db() const = 0; + virtual const std::map<std::string, std::vector<std::string> >& + transport_required_for_resumption_map() const = 0; + virtual const std::string& navigation_lowbandwidth_resumption_level() + const = 0; + virtual const std::string& projection_lowbandwidth_resumption_level() + const = 0; + virtual const std::string& media_lowbandwidth_resumption_level() const = 0; virtual void set_config_file_name(const std::string& fileName) = 0; virtual const std::pair<uint32_t, int32_t>& start_stream_retry_amount() const = 0; diff --git a/src/components/include/connection_handler/connection_handler.h b/src/components/include/connection_handler/connection_handler.h index 352f886aed..bfaacf5fc1 100644 --- a/src/components/include/connection_handler/connection_handler.h +++ b/src/components/include/connection_handler/connection_handler.h @@ -40,6 +40,7 @@ #include "connection_handler/connection.h" #include "connection_handler/devices_discovery_starter.h" #include "utils/macro.h" +#include "utils/data_accessor.h" /** * \namespace connection_handler @@ -51,6 +52,14 @@ enum CloseSessionReason { kCommon = 0, kFlood, kMalformed, kUnauthorizedApp }; class ConnectionHandlerObserver; +// The SessionConnectionMap keeps track of the primary and secondary transports +// associated with a session ID +typedef struct { + transport_manager::ConnectionUID primary_transport; + transport_manager::ConnectionUID secondary_transport; +} SessionTransports; +typedef std::map<uint8_t, SessionTransports> SessionConnectionMap; + /** * \class ConnectionHandler * \brief SmartDeviceLink ConnectionHandler interface class @@ -202,6 +211,43 @@ class ConnectionHandler { virtual DevicesDiscoveryStarter& get_device_discovery_starter() = 0; /** + * \brief Add a session. This is meant to be called from Connection class. + * \param primary_transport_id the primary connection ID to associate with the + * newly created session + * \return new session id, or 0 if failed + **/ + virtual uint32_t AddSession( + const transport_manager::ConnectionUID primary_transport_id) = 0; + + /** + * \brief Remove a session. This is meant to be called from Connection class. + * \param session_id ID of the session to remove + * \return true if successful, false otherwise + **/ + virtual bool RemoveSession(uint8_t session_id) = 0; + + virtual DataAccessor<SessionConnectionMap> session_connection_map() = 0; + + /** + * \brief Associate a secondary transport ID with a session + * \param session_id the session ID + * \param connection_id the new secondary connection ID to associate with the + * session + * \return the SessionTransports (newly) associated with the session + **/ + virtual SessionTransports SetSecondaryTransportID( + uint8_t session_id, + transport_manager::ConnectionUID secondary_transport_id) = 0; + + /** + * \brief Retrieve the session transports associated with a session + * \param session_id the session ID + * \return the SessionTransports associated with the session + **/ + virtual const SessionTransports GetSessionTransports( + uint8_t session_id) const = 0; + + /** * \brief Invoked when observer's OnServiceStartedCallback is completed * \param session_key the key of started session passed to * OnServiceStartedCallback(). @@ -217,6 +263,28 @@ class ConnectionHandler { bool result, std::vector<std::string>& rejected_params) = 0; + /** + * \brief Called when secondary transport with given session ID is established + * \param primary_connection_handle Set to identifier of primary connection + * \param secondary_connection_handle Identifier of secondary connection + * \param session_id session ID taken from Register Secondary Transport frame + * \return true if successful + **/ + virtual bool OnSecondaryTransportStarted( + transport_manager::ConnectionUID& primary_connection_handle, + const transport_manager::ConnectionUID secondary_connection_handle, + const uint8_t session_id) = 0; + + /** + * \brief Called when secondary transport shuts down + * \param primary_connection_handle Identifier of primary connection + * \param secondary_connection_handle Identifier of secondary connection + * transport + **/ + virtual void OnSecondaryTransportEnded( + const transport_manager::ConnectionUID primary_connection_handle, + const transport_manager::ConnectionUID secondary_connection_handle) = 0; + protected: /** * \brief Destructor diff --git a/src/components/include/connection_handler/connection_handler_observer.h b/src/components/include/connection_handler/connection_handler_observer.h index b4c04c17c9..2f4ee94449 100644 --- a/src/components/include/connection_handler/connection_handler_observer.h +++ b/src/components/include/connection_handler/connection_handler_observer.h @@ -157,6 +157,23 @@ class ConnectionHandlerObserver { virtual security_manager::SSLContext::HandshakeContext GetHandshakeContext( uint32_t key) const = 0; #endif // ENABLE_SECURITY + + /** + * \brief Called when secondary transport for a particular app is started. + * \param device_handle Device identifier on which the secondary transport is + * started. + * \param session_key session ID representing the app + */ + virtual void OnSecondaryTransportStartedCallback( + const connection_handler::DeviceHandle device_handle, + const int32_t session_key) = 0; + + /** + * \brief Called when secondary transport for a particular app is terminated. + * \param session_key session ID representing the app + */ + virtual void OnSecondaryTransportEndedCallback(const int32_t session_key) = 0; + protected: /** * \brief Destructor diff --git a/src/components/include/protocol/bson_object_keys.h b/src/components/include/protocol/bson_object_keys.h index 6f80aeec2b..56bd5cebd6 100644 --- a/src/components/include/protocol/bson_object_keys.h +++ b/src/components/include/protocol/bson_object_keys.h @@ -42,6 +42,12 @@ extern const char* height; extern const char* width; extern const char* video_protocol; extern const char* video_codec; +extern const char* secondary_transports; +extern const char* audio_service_transports; +extern const char* video_service_transports; +extern const char* tcp_ip_address; +extern const char* tcp_port; +extern const char* reason; } // namespace strings diff --git a/src/components/include/protocol/common.h b/src/components/include/protocol/common.h index 00d57a9bf5..1c95020a96 100644 --- a/src/components/include/protocol/common.h +++ b/src/components/include/protocol/common.h @@ -167,6 +167,22 @@ enum { */ FRAME_DATA_END_SERVICE_NACK = 0x06, /** + *\brief Register Secondary Transport frame + */ + FRAME_DATA_REGISTER_SECONDARY_TRANSPORT = 0x07, + /** + *\brief Register Secondary Transport acknowledgement frame + */ + FRAME_DATA_REGISTER_SECONDARY_TRANSPORT_ACK = 0x08, + /** + *\brief Register Secondary Transport not acknowledgement frame + */ + FRAME_DATA_REGISTER_SECONDARY_TRANSPORT_NACK = 0x09, + /** + *\brief Transport Event Update frame + */ + FRAME_DATA_TRANSPORT_EVENT_UPDATE = 0xFD, + /** *\brief Service data ACK frame */ FRAME_DATA_SERVICE_DATA_ACK = 0xFE, diff --git a/src/components/include/protocol_handler/protocol_handler.h b/src/components/include/protocol_handler/protocol_handler.h index 1da8d61e52..bb79964b12 100644 --- a/src/components/include/protocol_handler/protocol_handler.h +++ b/src/components/include/protocol_handler/protocol_handler.h @@ -100,7 +100,15 @@ class ProtocolHandler { */ virtual void SendEndSession(int32_t connection_id, uint8_t session_id) = 0; - virtual void SendEndService(int32_t connection_id, + /** + * \brief Sends ending session to mobile application + * \param primary_connection_id Identifier of connection within which + * service exists + * \param connection_id Identifier of the actual transport for the service + * \param session_id ID of session to be ended + */ + virtual void SendEndService(int32_t primary_connection_id, + int32_t connection_id, uint8_t session_id, uint8_t service_type) = 0; diff --git a/src/components/include/protocol_handler/protocol_handler_settings.h b/src/components/include/protocol_handler/protocol_handler_settings.h index e1107cb2a9..c4f9bb6420 100644 --- a/src/components/include/protocol_handler/protocol_handler_settings.h +++ b/src/components/include/protocol_handler/protocol_handler_settings.h @@ -51,6 +51,28 @@ class ProtocolHandlerSettings { */ virtual const std::vector<int>& force_unprotected_service() const = 0; #endif // ENABLE_SECURITY + + /** + * @brief Returns true multiple transports is enabled + */ + virtual const bool multiple_transports_enabled() const = 0; + + /** + * @brief Returns list of secondary transports available + * for the named primary transport + */ + virtual const std::vector<std::string>& secondary_transports_for_bluetooth() + const = 0; + virtual const std::vector<std::string>& secondary_transports_for_usb() + const = 0; + virtual const std::vector<std::string>& secondary_transports_for_wifi() + const = 0; + + /** + * @brief Returns list of allowed transports for the named service + */ + virtual const std::vector<std::string>& audio_service_transports() const = 0; + virtual const std::vector<std::string>& video_service_transports() const = 0; }; } // namespace protocol_handler #endif // SRC_COMPONENTS_INCLUDE_PROTOCOL_HANDLER_PROTOCOL_HANDLER_SETTINGS_H_ diff --git a/src/components/include/protocol_handler/session_observer.h b/src/components/include/protocol_handler/session_observer.h index 7a5dcf287c..d50b1e694e 100644 --- a/src/components/include/protocol_handler/session_observer.h +++ b/src/components/include/protocol_handler/session_observer.h @@ -59,6 +59,7 @@ enum { HASH_ID_NOT_SUPPORTED = 0, HASH_ID_WRONG = 0xFFFF0000 }; * @brief Struct with data containing attributes of starting session **/ struct SessionContext { + transport_manager::ConnectionUID primary_connection_id_; transport_manager::ConnectionUID connection_id_; uint8_t initial_session_id_; uint8_t new_session_id_; @@ -71,7 +72,8 @@ struct SessionContext { * @brief Constructor */ SessionContext() - : connection_id_(0) + : primary_connection_id_(0) + , connection_id_(0) , initial_session_id_(0) , new_session_id_(0) , service_type_(protocol_handler::kInvalidServiceType) @@ -81,6 +83,8 @@ struct SessionContext { /** * @brief Constructor + * @param primary_connection_id Connection identifier of the primary + * connection in which the session is started * @param connection_id_ Connection identifier within which session is * started. * @param session_id Session ID specified to OnSessionStartedCallback() @@ -91,13 +95,15 @@ struct SessionContext { * @param is_protected Whether service will be protected * @param is_new_service Whether service was already established **/ - SessionContext(transport_manager::ConnectionUID connection_id, + SessionContext(transport_manager::ConnectionUID primary_connection_id, + transport_manager::ConnectionUID connection_id, uint8_t session_id, uint8_t new_session_id, protocol_handler::ServiceType service_type, uint32_t hash_id, const bool is_protected) - : connection_id_(connection_id) + : primary_connection_id_(primary_connection_id) + , connection_id_(connection_id) , initial_session_id_(session_id) , new_session_id_(new_session_id) , service_type_(service_type) @@ -205,6 +211,24 @@ class SessionObserver { virtual void OnMalformedMessageCallback(const uint32_t& connection_key) = 0; /** + * @brief Converts connection handle to transport type string used in + * smartDeviceLink.ini file, e.g. "TCP_WIFI" + * @param connection_handle A connection identifier + * @return string representation of the transport of the device + */ + virtual const std::string TransportTypeProfileStringFromConnHandle( + transport_manager::ConnectionUID connection_handle) const = 0; + + /** + * @brief Converts device handle to transport type string used in + * smartDeviceLink.ini file, e.g. "TCP_WIFI" + * @param device_handle A device handle + * @return string representation of the transport of the device + */ + virtual const std::string TransportTypeProfileStringFromDeviceHandle( + transport_manager::DeviceHandle device_handle) const = 0; + + /** * \brief Creates unique identifier of session (can be used as hash) * from given connection identifier * within which session exists and session number. diff --git a/src/components/include/test/application_manager/mock_application_manager.h b/src/components/include/test/application_manager/mock_application_manager.h index 09957dbde0..0bb759fc1f 100644 --- a/src/components/include/test/application_manager/mock_application_manager.h +++ b/src/components/include/test/application_manager/mock_application_manager.h @@ -131,6 +131,9 @@ class MockApplicationManager : public application_manager::ApplicationManager { MOCK_METHOD0(hmi_capabilities, application_manager::HMICapabilities&()); MOCK_CONST_METHOD0(hmi_capabilities, const application_manager::HMICapabilities&()); + MOCK_CONST_METHOD1( + CheckResumptionRequiredTransportAvailable, + bool(application_manager::ApplicationConstSharedPtr application)); MOCK_METHOD2(ProcessQueryApp, void(const smart_objects::SmartObject& sm_object, const uint32_t connection_key)); diff --git a/src/components/include/test/application_manager/mock_application_manager_settings.h b/src/components/include/test/application_manager/mock_application_manager_settings.h index 25cf994566..735539156a 100644 --- a/src/components/include/test/application_manager/mock_application_manager_settings.h +++ b/src/components/include/test/application_manager/mock_application_manager_settings.h @@ -95,6 +95,13 @@ class MockApplicationManagerSettings MOCK_CONST_METHOD0(app_resuming_timeout, const uint32_t&()); MOCK_CONST_METHOD0(attempts_to_open_resumption_db, uint16_t()); MOCK_CONST_METHOD0(open_attempt_timeout_ms_resumption_db, uint16_t()); + MOCK_CONST_METHOD0(transport_required_for_resumption_map, + std::map<std::string, std::vector<std::string> >&()); + MOCK_CONST_METHOD0(navigation_lowbandwidth_resumption_level, + const std::string&()); + MOCK_CONST_METHOD0(projection_lowbandwidth_resumption_level, + const std::string&()); + MOCK_CONST_METHOD0(media_lowbandwidth_resumption_level, const std::string&()); MOCK_METHOD1(set_config_file_name, void(const std::string& fileName)); // The following line won't really compile, as the return // type has multiple template arguments. To fix it, use a 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 f1416c999e..2de3a0f9a7 100644 --- a/src/components/include/test/connection_handler/mock_connection_handler.h +++ b/src/components/include/test/connection_handler/mock_connection_handler.h @@ -51,6 +51,7 @@ using connection_handler::ConnectionHandle; using connection_handler::DeviceHandle; using connection_handler::CloseSessionReason; using connection_handler::DevicesDiscoveryStarter; +using connection_handler::SessionTransports; class MockConnectionHandler : public connection_handler::ConnectionHandler { public: @@ -84,13 +85,6 @@ class MockConnectionHandler : public connection_handler::ConnectionHandler { void(uint32_t connection_key, uint8_t session_id)); MOCK_METHOD2(BindProtocolVersionWithSession, void(uint32_t connection_key, uint8_t protocol_version)); - - // DEPRECATED - MOCK_CONST_METHOD4(GetDataOnSessionKey, - int32_t(uint32_t key, - uint32_t* app_id, - std::list<int32_t>* sessions_list, - uint32_t* device_id)); MOCK_CONST_METHOD4(GetDataOnSessionKey, int32_t(uint32_t key, uint32_t* app_id, @@ -103,10 +97,31 @@ class MockConnectionHandler : public connection_handler::ConnectionHandler { MOCK_METHOD0(get_device_discovery_starter, DevicesDiscoveryStarter&()); MOCK_CONST_METHOD1(GetConnectedDevicesMAC, void(std::vector<std::string>& macs)); + MOCK_METHOD1( + AddSession, + uint32_t(const transport_manager::ConnectionUID primary_transport_id)); + MOCK_METHOD1(RemoveSession, bool(uint8_t session_id)); + MOCK_METHOD0(session_connection_map, + DataAccessor<connection_handler::SessionConnectionMap>()); + MOCK_METHOD2(SetSecondaryTransportID, + SessionTransports( + uint8_t session_id, + transport_manager::ConnectionUID secondary_transport_id)); + MOCK_CONST_METHOD1(GetSessionTransports, + const SessionTransports(uint8_t session_id)); MOCK_METHOD3(NotifyServiceStartedResult, void(uint32_t session_key, bool result, std::vector<std::string>& rejected_params)); + MOCK_METHOD3( + OnSecondaryTransportStarted, + bool(transport_manager::ConnectionUID& primary_connection_handle, + const transport_manager::ConnectionUID secondary_connection_handle, + const uint8_t session_id)); + MOCK_METHOD2( + OnSecondaryTransportEnded, + void(const transport_manager::ConnectionUID primary_connection_handle, + const transport_manager::ConnectionUID secondary_connection_handle)); }; } // namespace connection_handler_test diff --git a/src/components/include/test/connection_handler/mock_connection_handler_observer.h b/src/components/include/test/connection_handler/mock_connection_handler_observer.h index a96498028d..ede08a9a4a 100644 --- a/src/components/include/test/connection_handler/mock_connection_handler_observer.h +++ b/src/components/include/test/connection_handler/mock_connection_handler_observer.h @@ -74,6 +74,11 @@ class MockConnectionHandlerObserver const connection_handler::Device& device_to)); MOCK_METHOD1(OnDeviceSwitchingFinish, void(const std::string& device_uid)); MOCK_CONST_METHOD1(CheckAppIsNavi, bool(const uint32_t app_id)); + MOCK_METHOD2(OnSecondaryTransportStartedCallback, + void(const connection_handler::DeviceHandle device_handle, + const int32_t session_key)); + MOCK_METHOD1(OnSecondaryTransportEndedCallback, + void(const int32_t session_key)); }; } // namespace connection_handler_test diff --git a/src/components/include/test/protocol_handler/mock_protocol_handler.h b/src/components/include/test/protocol_handler/mock_protocol_handler.h index e667911944..13c0264cb8 100644 --- a/src/components/include/test/protocol_handler/mock_protocol_handler.h +++ b/src/components/include/test/protocol_handler/mock_protocol_handler.h @@ -55,8 +55,9 @@ class MockProtocolHandler : public ::protocol_handler::ProtocolHandler { void(uint32_t connection_key, int32_t number_of_frames)); MOCK_METHOD2(SendHeartBeat, void(int32_t connection_id, uint8_t session_id)); MOCK_METHOD2(SendEndSession, void(int32_t connection_id, uint8_t session_id)); - MOCK_METHOD3(SendEndService, - void(int32_t connection_id, + MOCK_METHOD4(SendEndService, + void(int32_t primary_connection_id, + int32_t connection_id, uint8_t session_id, uint8_t service_type)); MOCK_CONST_METHOD0(get_settings, diff --git a/src/components/include/test/protocol_handler/mock_protocol_handler_settings.h b/src/components/include/test/protocol_handler/mock_protocol_handler_settings.h index 8ddeded889..2ed9c47e9d 100644 --- a/src/components/include/test/protocol_handler/mock_protocol_handler_settings.h +++ b/src/components/include/test/protocol_handler/mock_protocol_handler_settings.h @@ -60,6 +60,17 @@ class MockProtocolHandlerSettings MOCK_CONST_METHOD0(force_protected_service, const std::vector<int>&()); MOCK_CONST_METHOD0(force_unprotected_service, const std::vector<int>&()); #endif + MOCK_CONST_METHOD0(multiple_transports_enabled, const bool()); + MOCK_CONST_METHOD0(secondary_transports_for_bluetooth, + const std::vector<std::string>&()); + MOCK_CONST_METHOD0(secondary_transports_for_usb, + const std::vector<std::string>&()); + MOCK_CONST_METHOD0(secondary_transports_for_wifi, + const std::vector<std::string>&()); + MOCK_CONST_METHOD0(audio_service_transports, + const std::vector<std::string>&()); + MOCK_CONST_METHOD0(video_service_transports, + const std::vector<std::string>&()); }; } // namespace protocol_handler_test diff --git a/src/components/include/test/protocol_handler/mock_session_observer.h b/src/components/include/test/protocol_handler/mock_session_observer.h index ae32f35948..c0612ce137 100644 --- a/src/components/include/test/protocol_handler/mock_session_observer.h +++ b/src/components/include/test/protocol_handler/mock_session_observer.h @@ -76,6 +76,12 @@ class MockSessionObserver : public ::protocol_handler::SessionObserver { void(const uint32_t& connection_key)); MOCK_METHOD1(OnMalformedMessageCallback, void(const uint32_t& connection_key)); + MOCK_CONST_METHOD1( + TransportTypeProfileStringFromConnHandle, + const std::string(transport_manager::ConnectionUID connection_handle)); + MOCK_CONST_METHOD1( + TransportTypeProfileStringFromDeviceHandle, + const std::string(transport_manager::DeviceHandle device_handle)); MOCK_CONST_METHOD2( KeyFromPair, uint32_t(transport_manager::ConnectionUID connection_handle, @@ -89,11 +95,6 @@ class MockSessionObserver : public ::protocol_handler::SessionObserver { uint32_t* app_id, std::list<int32_t>* sessions_list, transport_manager::DeviceHandle* device_id)); - DEPRECATED MOCK_CONST_METHOD4(GetDataOnSessionKey, - int32_t(uint32_t key, - uint32_t* app_id, - std::list<int32_t>* sessions_list, - uint32_t* device_id)); MOCK_CONST_METHOD5(GetDataOnDeviceID, int32_t(transport_manager::DeviceHandle device_handle, diff --git a/src/components/include/test/transport_manager/mock_transport_manager_listener.h b/src/components/include/test/transport_manager/mock_transport_manager_listener.h index f4c4fdcf68..133dabe732 100644 --- a/src/components/include/test/transport_manager/mock_transport_manager_listener.h +++ b/src/components/include/test/transport_manager/mock_transport_manager_listener.h @@ -85,6 +85,8 @@ class MockTransportManagerListener : public TransportManagerListener { void(const DeviceUID& device_uid_from, const DeviceUID& device_uid_to)); MOCK_METHOD1(OnDeviceSwitchingFinish, void(const DeviceUID& device_uid)); + MOCK_METHOD1(OnTransportConfigUpdated, + void(const std::map<std::string, std::string>& configs)); }; } // namespace transport_manager_test diff --git a/src/components/include/test/transport_manager/mock_transport_manager_settings.h b/src/components/include/test/transport_manager/mock_transport_manager_settings.h index 88112df003..3e7c8f36f7 100644 --- a/src/components/include/test/transport_manager/mock_transport_manager_settings.h +++ b/src/components/include/test/transport_manager/mock_transport_manager_settings.h @@ -61,6 +61,8 @@ class MockTransportManagerSettings MOCK_CONST_METHOD0(iap_hub_connection_wait_timeout, uint32_t()); MOCK_CONST_METHOD0(app_transport_change_timer, uint32_t()); MOCK_CONST_METHOD0(app_transport_change_timer_addition, uint32_t()); + MOCK_CONST_METHOD0(transport_manager_tcp_adapter_network_interface, + std::string&()); }; } // namespace transport_manager_test diff --git a/src/components/include/test/transport_manager/transport_adapter/mock_transport_adapter.h b/src/components/include/test/transport_manager/transport_adapter/mock_transport_adapter.h index c37c41d4f8..eff0abdcd3 100644 --- a/src/components/include/test/transport_manager/transport_adapter/mock_transport_adapter.h +++ b/src/components/include/test/transport_manager/transport_adapter/mock_transport_adapter.h @@ -103,6 +103,8 @@ class MockTransportAdapter void(const ::transport_manager::DeviceUID& device_handle)); MOCK_CONST_METHOD0(GetSwitchableDevices, transport_manager::SwitchableDevices()); + MOCK_CONST_METHOD0(GetTransportConfiguration, + transport_manager::transport_adapter::TransportConfig()); #ifdef TELEMETRY_MONITOR MOCK_METHOD0(GetTelemetryObserver, ::transport_manager::TMTelemetryObserver*()); 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 7f6d347535..c00adb33b8 100644 --- a/src/components/include/transport_manager/transport_adapter/transport_adapter.h +++ b/src/components/include/transport_manager/transport_adapter/transport_adapter.h @@ -5,6 +5,9 @@ * Copyright (c) 2016, Ford Motor Company * All rights reserved. * + * Copyright (c) 2018 Xevo Inc. + * All rights reserved. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * @@ -16,7 +19,7 @@ * disclaimer in the documentation and/or other materials provided with the * distribution. * - * Neither the name of the Ford Motor Company nor the names of its contributors + * Neither the name of the copyright holders nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -70,6 +73,9 @@ enum DeviceType { IOS_BT, IOS_USB, TCP, + IOS_USB_HOST_MODE, + IOS_USB_DEVICE_MODE, + IOS_CARPLAY_WIRELESS, // running on iAP over Carplay wireless transport UNKNOWN }; @@ -86,6 +92,18 @@ typedef std::map<DeviceUID, DeviceSptr> DeviceMap; */ typedef std::list<TransportAdapterListener*> TransportAdapterListenerList; +/** + * @brief Type definition for transport's configuration information + */ +typedef std::map<std::string, std::string> TransportConfig; + +/** + * @brief TransportConfig keys + */ +extern const char* tc_enabled; +extern const char* tc_tcp_port; +extern const char* tc_tcp_ip_address; + class TransportAdapter { public: /** @@ -312,6 +330,12 @@ class TransportAdapter { virtual void DeviceSwitched(const DeviceUID& device_handle) = 0; virtual SwitchableDevices GetSwitchableDevices() const = 0; + + /** + * @brief Returns the transport's configuration information + */ + virtual TransportConfig GetTransportConfiguration() const = 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 18f4ccb2d1..5d55960943 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 @@ -2,6 +2,9 @@ * Copyright (c) 2013, Ford Motor Company * All rights reserved. * + * Copyright (c) 2018 Xevo Inc. + * All rights reserved. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * @@ -13,7 +16,7 @@ * disclaimer in the documentation and/or other materials provided with the * distribution. * - * Neither the name of the Ford Motor Company nor the names of its contributors + * Neither the name of the copyright holders nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -57,7 +60,8 @@ enum class EventTypeEnum { ON_RECEIVED_FAIL, ON_COMMUNICATION_ERROR, ON_UNEXPECTED_DISCONNECT, - ON_TRANSPORT_SWITCH_REQUESTED + ON_TRANSPORT_SWITCH_REQUESTED, + ON_TRANSPORT_CONFIG_UPDATED }; class TransportAdapterEvent { diff --git a/src/components/include/transport_manager/transport_manager_listener.h b/src/components/include/transport_manager/transport_manager_listener.h index d336eade45..0d02bfd8c7 100644 --- a/src/components/include/transport_manager/transport_manager_listener.h +++ b/src/components/include/transport_manager/transport_manager_listener.h @@ -2,6 +2,9 @@ * Copyright (c) 2014, Ford Motor Company * All rights reserved. * + * Copyright (c) 2018 Xevo Inc. + * All rights reserved. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * @@ -13,7 +16,7 @@ * disclaimer in the documentation and/or other materials provided with the * distribution. * - * Neither the name of the Ford Motor Company nor the names of its contributors + * Neither the name of the copyright holders nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -33,6 +36,7 @@ #ifndef SRC_COMPONENTS_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_MANAGER_LISTENER_H_ #define SRC_COMPONENTS_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_MANAGER_LISTENER_H_ +#include <map> #include <vector> #include "transport_manager/common.h" #include "transport_manager/info.h" @@ -193,6 +197,14 @@ class TransportManagerListener { virtual void OnTMMessageSendFailed( const DataSendError& error, const ::protocol_handler::RawMessagePtr message) = 0; + + /** + * @brief Notifies that configuration of a transport has been updated. + * + * @param configs pairs of key and value that represent configuration. + */ + virtual void OnTransportConfigUpdated( + const std::map<std::string, std::string>& configs) = 0; }; } // namespace transport_manager #endif // SRC_COMPONENTS_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_MANAGER_LISTENER_H_ 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 ca6c573a06..a255256290 100644 --- a/src/components/include/transport_manager/transport_manager_listener_empty.h +++ b/src/components/include/transport_manager/transport_manager_listener_empty.h @@ -2,6 +2,9 @@ * Copyright (c) 2014, Ford Motor Company * All rights reserved. * + * Copyright (c) 2018 Xevo Inc. + * All rights reserved. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * @@ -13,7 +16,7 @@ * disclaimer in the documentation and/or other materials provided with the * distribution. * - * Neither the name of the Ford Motor Company nor the names of its contributors + * Neither the name of the copyright holders nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -187,6 +190,14 @@ class TransportManagerListenerEmpty : public TransportManagerListener { void OnTMMessageSendFailed( const DataSendError& error, const ::protocol_handler::RawMessagePtr message) OVERRIDE {} + + /** + * @brief Notifies that configuration of a transport has been updated. + * + * @param configs pairs of key and value that represent configuration. + */ + void OnTransportConfigUpdated( + const std::map<std::string, std::string>& configs) OVERRIDE {} }; } // namespace transport_manager #endif // SRC_COMPONENTS_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_MANAGER_LISTENER_EMPTY_H_ diff --git a/src/components/include/transport_manager/transport_manager_settings.h b/src/components/include/transport_manager/transport_manager_settings.h index feb3fa2c02..3912bbe747 100644 --- a/src/components/include/transport_manager/transport_manager_settings.h +++ b/src/components/include/transport_manager/transport_manager_settings.h @@ -63,6 +63,12 @@ class TransportManagerSettings : public TransportManagerMMESettings { * the transport change timeout value. */ virtual uint32_t app_transport_change_timer_addition() const = 0; + + /** + * @brief Returns the network interface name for TCP transport adapter + */ + virtual const std::string& transport_manager_tcp_adapter_network_interface() + const = 0; }; } // namespace transport_manager #endif // SRC_COMPONENTS_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_MANAGER_SETTINGS_H_ diff --git a/src/components/include/utils/data_accessor.h b/src/components/include/utils/data_accessor.h index 645886592c..6d0fb0ed68 100644 --- a/src/components/include/utils/data_accessor.h +++ b/src/components/include/utils/data_accessor.h @@ -36,7 +36,7 @@ #include "utils/lock.h" #include "utils/shared_ptr.h" -// This class is for thread-safe access to data +// This class is for thread-safe const access to data template <class T> class DataAccessor { public: |