diff options
9 files changed, 37 insertions, 96 deletions
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 2e3c73f20e..edd47f15d5 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 @@ -275,11 +275,11 @@ class ConnectionHandlerImpl void OnMalformedMessageCallback(const uint32_t& connection_key) OVERRIDE; /** - * \brief Returns the device type associated with the connection handle + * \brief Returns the connection type associated with the connection handle * \param connection_handle Handle of the connection being queried - * \return Device Type + * \return Connection Type */ - transport_manager::transport_adapter::DeviceType device_type( + std::string connection_type( transport_manager::ConnectionUID connection_handle) const OVERRIDE; /** diff --git a/src/components/connection_handler/include/connection_handler/device.h b/src/components/connection_handler/include/connection_handler/device.h index c2fb955f55..26376c1d8d 100644 --- a/src/components/connection_handler/include/connection_handler/device.h +++ b/src/components/connection_handler/include/connection_handler/device.h @@ -37,7 +37,6 @@ #include <map> #include <vector> #include "transport_manager/common.h" -#include "transport_manager/transport_adapter/transport_adapter.h" /** * \namespace connection_handler @@ -63,8 +62,7 @@ class Device { Device(DeviceHandle device_handle, const std::string& user_friendly_name, const std::string& mac_address = "", - const std::string& connection_type = "", - transport_manager::transport_adapter::DeviceType device_type = transport_manager::transport_adapter::DeviceType::UNKNOWN); + const std::string& connection_type = ""); /** * \brief Returns device handle @@ -90,12 +88,6 @@ class Device { */ std::string connection_type() const; - /** - * @brief The type of device. - * @return device type - */ - transport_manager::transport_adapter::DeviceType device_type() const; - private: /** * \brief Uniq device handle. @@ -116,11 +108,6 @@ class Device { * \brief The type of connection used by device. */ std::string connection_type_; - - /** - * \brief The DeviceType associated with the device - */ - transport_manager::transport_adapter::DeviceType device_type_; }; /** diff --git a/src/components/connection_handler/src/connection_handler_impl.cc b/src/components/connection_handler/src/connection_handler_impl.cc index 5245c935bd..1a2dd0f76c 100644 --- a/src/components/connection_handler/src/connection_handler_impl.cc +++ b/src/components/connection_handler/src/connection_handler_impl.cc @@ -144,8 +144,7 @@ void ConnectionHandlerImpl::OnDeviceAdded( Device device(handle, device_info.name(), device_info.mac_address(), - device_info.connection_type(), - device_info.device_type()); + device_info.connection_type()); auto result = device_list_.insert(std::make_pair(handle, device)); @@ -817,11 +816,11 @@ void ConnectionHandlerImpl::OnSecondaryTransportEnded( } } -transport_manager::transport_adapter::DeviceType ConnectionHandlerImpl::device_type( +std::string ConnectionHandlerImpl::connection_type( transport_manager::ConnectionUID connection_handle) const { LOG4CXX_AUTO_TRACE(logger_); - - transport_manager::transport_adapter::DeviceType device_type = transport_manager::transport_adapter::DeviceType::UNKNOWN; + + std::string connection_type; sync_primitives::AutoReadLock lock(connection_list_lock_); ConnectionList::const_iterator it = @@ -835,11 +834,11 @@ transport_manager::transport_adapter::DeviceType ConnectionHandlerImpl::device_t if (device_list_.end() == it) { LOG4CXX_ERROR(logger_, "Device not found!"); } else { - device_type = it->second.device_type(); + connection_type = it->second.connection_type(); } } - return device_type; + return connection_type; } uint32_t ConnectionHandlerImpl::KeyFromPair( diff --git a/src/components/connection_handler/src/device.cc b/src/components/connection_handler/src/device.cc index 6512848205..0ecb439172 100644 --- a/src/components/connection_handler/src/device.cc +++ b/src/components/connection_handler/src/device.cc @@ -48,13 +48,11 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "ConnectionHandler") Device::Device(DeviceHandle device_handle, const std::string& user_friendly_name, const std::string& mac_address, - const std::string& connection_type, - transport_manager::transport_adapter::DeviceType device_type) + const std::string& connection_type) : device_handle_(device_handle) , user_friendly_name_(user_friendly_name) , mac_address_(mac_address) - , connection_type_(connection_type) - , device_type_(device_type) { + , connection_type_(connection_type) { mac_address_ = encryption::MakeHash(mac_address); LOG4CXX_DEBUG(logger_, "Device: MAC address - " << mac_address << ", hash - " @@ -77,8 +75,4 @@ std::string Device::connection_type() const { return connection_type_; } -transport_manager::transport_adapter::DeviceType Device::device_type() const { - return device_type_; -} - } // namespace connection_handler diff --git a/src/components/include/protocol_handler/session_observer.h b/src/components/include/protocol_handler/session_observer.h index e6b7b33d14..848aa525a4 100644 --- a/src/components/include/protocol_handler/session_observer.h +++ b/src/components/include/protocol_handler/session_observer.h @@ -253,11 +253,11 @@ class SessionObserver { virtual void OnMalformedMessageCallback(const uint32_t& connection_key) = 0; /** - * \brief Returns the device type associated with the connection handle + * \brief Returns the connection type associated with the connection handle * \param connection_handle Handle of the connection being queried - * \return Device Type + * \return Connection Type */ - virtual transport_manager::transport_adapter::DeviceType device_type( + virtual std::string connection_type( transport_manager::ConnectionUID connection_handle) const = 0; /** diff --git a/src/components/include/transport_manager/info.h b/src/components/include/transport_manager/info.h index 96759bf208..fb06b39045 100644 --- a/src/components/include/transport_manager/info.h +++ b/src/components/include/transport_manager/info.h @@ -38,7 +38,6 @@ #include <string> #include "transport_manager/common.h" -#include "transport_manager/transport_adapter/transport_adapter.h" /** * @brief transport_manager name space @@ -101,49 +100,22 @@ class DeviceInfo : public Info { */ ConnectionType connection_type_; - /** - * @brief The type of the device. - */ - transport_manager::transport_adapter::DeviceType device_type_; - public: /** * @brief Constructor. * * @param device_handle Handle of device. * @param mac_address MAC address of device. - * @param connection_type Connection Type string * @param name Name of device. */ - DEPRECATED DeviceInfo(DeviceHandle device_handle, - std::string mac_address, - std::string name, - const ConnectionType& connection_type) - : Info(name) - , mac_address_(mac_address) - , device_handle_(device_handle) - , connection_type_(connection_type) - , device_type_(transport_manager::transport_adapter::DeviceType::UNKNOWN) {} - - /** - * @brief Constructor. - * - * @param device_handle Handle of device. - * @param mac_address MAC address of device. - * @param name Name of device. - * @param connection_type Connection Type string - * @param device_type Device Type of the Device - */ DeviceInfo(DeviceHandle device_handle, std::string mac_address, std::string name, - const ConnectionType& connection_type, - transport_manager::transport_adapter::DeviceType device_type) + const ConnectionType& connection_type) : Info(name) , mac_address_(mac_address) , device_handle_(device_handle) - , connection_type_(connection_type) - , device_type_(device_type) {} + , connection_type_(connection_type) {} /** * @brief Return mac_address. @@ -168,14 +140,6 @@ class DeviceInfo : public Info { } /** - * @brief Return device_type_. - * @return - */ - transport_manager::transport_adapter::DeviceType device_type() const { - return device_type_; - } - - /** * @brief Overloaded operator "==". */ friend bool operator==(const DeviceInfo& first, const DeviceInfo& second); diff --git a/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h b/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h index 13d7ddb8a9..1637194ec7 100644 --- a/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h +++ b/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h @@ -148,7 +148,7 @@ struct TransportDescription { bool android_transport_; }; -typedef std::map<transport_manager::transport_adapter::DeviceType, TransportDescription> +typedef std::map<std::string, TransportDescription> TransportTypes; } // namespace impl @@ -673,7 +673,7 @@ class ProtocolHandlerImpl */ uint8_t SupportedSDLProtocolVersion() const; - const impl::TransportDescription GetTransportTypeFromDeviceType(transport_manager::transport_adapter::DeviceType device_type) const; + const impl::TransportDescription GetTransportTypeFromConnectionType(std::string& device_type) const; const bool parseSecondaryTransportConfiguration(const ConnectionID connection_id, std::vector<std::string>& secondaryTransports, diff --git a/src/components/protocol_handler/src/protocol_handler_impl.cc b/src/components/protocol_handler/src/protocol_handler_impl.cc index 574f3b09e2..9bf43994f9 100644 --- a/src/components/protocol_handler/src/protocol_handler_impl.cc +++ b/src/components/protocol_handler/src/protocol_handler_impl.cc @@ -2306,33 +2306,33 @@ uint8_t ProtocolHandlerImpl::SupportedSDLProtocolVersion() const { } impl::TransportTypes transportTypes = { - std::make_pair(transport_manager::transport_adapter::AOA, + std::make_pair(std::string("USB_AOA"), impl::TransportDescription("USB", false, true)), - std::make_pair(transport_manager::transport_adapter::BLUETOOTH, + std::make_pair(std::string("BLUETOOTH"), impl::TransportDescription("Bluetooth", false, true)), - std::make_pair(transport_manager::transport_adapter::IOS_BT, + std::make_pair(std::string("BLUETOOTH_IOS"), impl::TransportDescription("Bluetooth", true, false)), - std::make_pair(transport_manager::transport_adapter::IOS_USB, + std::make_pair(std::string("USB_IOS"), impl::TransportDescription("USB", true, false)), - std::make_pair(transport_manager::transport_adapter::TCP, + std::make_pair(std::string("WIFI"), impl::TransportDescription("WiFi", true, true)), - std::make_pair(transport_manager::transport_adapter::IOS_USB_HOST_MODE, + std::make_pair(std::string("USB_IOS_HOST_MODE"), impl::TransportDescription("USB", true, false)), - std::make_pair(transport_manager::transport_adapter::IOS_USB_DEVICE_MODE, + std::make_pair(std::string("USB_IOS_DEVICE_MODE"), impl::TransportDescription("USB", true, false)), - std::make_pair(transport_manager::transport_adapter::IOS_CARPLAY_WIRELESS, + std::make_pair(std::string("IOS_CARPLAY_WIRELESS"), impl::TransportDescription("WiFi", true, false)) }; const impl::TransportDescription -ProtocolHandlerImpl::GetTransportTypeFromDeviceType( - transport_manager::transport_adapter::DeviceType device_type) const { +ProtocolHandlerImpl::GetTransportTypeFromConnectionType( + std::string& connection_type) const { impl::TransportDescription result = impl::TransportDescription("", false, false); - impl::TransportTypes::const_iterator it = transportTypes.find(device_type); + impl::TransportTypes::const_iterator it = transportTypes.find(connection_type); if (it != transportTypes.end()) { result = it->second; } else { - LOG4CXX_ERROR(logger_, "Unknown device type " << device_type); + LOG4CXX_ERROR(logger_, "Unknown device type " << connection_type); } return result; @@ -2349,8 +2349,8 @@ const bool ProtocolHandlerImpl::parseSecondaryTransportConfiguration( // First discover what the connection type of the primary transport is // and look up the allowed secondary transports for that primary transport - transport_manager::transport_adapter::DeviceType device_type = session_observer_.device_type(connection_id); - const impl::TransportDescription td = GetTransportTypeFromDeviceType(device_type); + std::string connection_type = session_observer_.connection_type(connection_id); + const impl::TransportDescription td = GetTransportTypeFromConnectionType(connection_type); if (td.transport_type_ == "USB") { secondary_transport_types = settings_.secondary_transports_for_usb(); } else if (td.transport_type_ == "Bluetooth") { diff --git a/src/components/transport_manager/src/transport_manager_impl.cc b/src/components/transport_manager/src/transport_manager_impl.cc index d5031d0cc9..764accf7fe 100644 --- a/src/components/transport_manager/src/transport_manager_impl.cc +++ b/src/components/transport_manager/src/transport_manager_impl.cc @@ -590,7 +590,7 @@ void TransportManagerImpl::UpdateDeviceList(TransportAdapter* ta) { DeviceHandle device_handle = converter_.UidToHandle(*it, ta->GetConnectionType()); DeviceInfo info( - device_handle, *it, ta->DeviceName(*it), ta->GetConnectionType(), ta->GetDeviceType()); + device_handle, *it, ta->DeviceName(*it), ta->GetConnectionType()); device_list_.push_back(std::make_pair(ta, info)); new_devices.insert(info); } @@ -895,8 +895,7 @@ bool TransportManagerImpl::UpdateDeviceMapping( DeviceInfo info(device_handle, device_uid, ta->DeviceName(device_uid), - ta->GetConnectionType(), - ta->GetDeviceType()); + ta->GetConnectionType()); RaiseEvent(&TransportManagerListener::OnDeviceFound, info); } @@ -970,8 +969,7 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) { DeviceInfo(device_handle, event.device_uid, event.transport_adapter->DeviceName(event.device_uid), - event.transport_adapter->GetConnectionType(), - event.transport_adapter->GetDeviceType()), + event.transport_adapter->GetConnectionType()), connection_id_counter_); LOG4CXX_DEBUG(logger_, "event_type = ON_CONNECT_DONE"); break; @@ -984,8 +982,7 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) { event.transport_adapter->GetConnectionType()), event.device_uid, event.transport_adapter->DeviceName(event.device_uid), - event.transport_adapter->GetConnectionType(), - event.transport_adapter->GetDeviceType()), + event.transport_adapter->GetConnectionType()), ConnectError()); LOG4CXX_DEBUG(logger_, "event_type = ON_CONNECT_FAIL"); break; |