diff options
author | Alexandr Galiuzov <agaliuzov@luxoft.com> | 2015-04-28 13:09:18 -0700 |
---|---|---|
committer | Dmitriy Klimenko <dklimenko@luxoft.com> | 2015-04-30 20:17:18 -0700 |
commit | 9ccee5b9946fb245dd0e42850068725e126bc0fe (patch) | |
tree | 3b42fdfbf6a0823bdfa429f509fe68f1d8f8c981 /src/components | |
parent | c7f93c4b8bd0fdbffe28aaf86969506468b7be3a (diff) | |
download | sdl_core-9ccee5b9946fb245dd0e42850068725e126bc0fe.tar.gz |
APPLINK-12266: OnAppRegistered: SDL must provide the transport type information; Build fix
Diffstat (limited to 'src/components')
10 files changed, 49 insertions, 18 deletions
diff --git a/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc index d93f2910f1..1a81cbf995 100644 --- a/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc +++ b/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc @@ -265,7 +265,7 @@ void RegisterAppInterfaceRequest::Run() { application_manager::MessageHelper::GetDeviceInfoForHandle(handle, &dev_params); policy::DeviceInfo device_info; - device_info.connection_type = dev_params.device_connection_type; + device_info.AdoptDeviceType(dev_params.device_connection_type); if (msg_params.keyExists(strings::device_info)) { FillDeviceInfo(&device_info); } diff --git a/src/components/application_manager/src/message_helper.cc b/src/components/application_manager/src/message_helper.cc index dbd533f76b..3327f75eda 100644 --- a/src/components/application_manager/src/message_helper.cc +++ b/src/components/application_manager/src/message_helper.cc @@ -52,6 +52,7 @@ #include "smart_objects/enum_schema_item.h" #include "utils/file_system.h" #include "utils/macro.h" +#include "utils/make_shared.h" #include "utils/logger.h" #include "formatters/formatter_json_rpc.h" @@ -311,7 +312,7 @@ void MessageHelper::SendOnAppRegisteredNotificationToHMI( std::string priority; policy::PolicyHandler::instance()->GetPriority( - application_impl.policy_app_id(), &priority); + application_impl.mobile_app_id(), &priority); if (!priority.empty()) { msg_params[strings::priority] = GetPriorityCode(priority); } @@ -320,7 +321,7 @@ void MessageHelper::SendOnAppRegisteredNotificationToHMI( smart_objects::SmartObject& application = msg_params[strings::application]; application[strings::app_name] = application_impl.name(); application[strings::app_id] = application_impl.app_id(); - application[strings::policy_app_id] = application_impl.policy_app_id(); + application[hmi_response::policy_app_id] = application_impl.mobile_app_id(); application[strings::icon] = application_impl.app_icon_path(); const smart_objects::SmartObject* ngn_media_screen_name = @@ -342,7 +343,7 @@ void MessageHelper::SendOnAppRegisteredNotificationToHMI( if (application_impl.IsRegistered()) { std::vector<std::string> request_types = policy::PolicyHandler::instance()->GetAppRequestTypes( - application_impl.policy_app_id()); + application_impl.mobile_app_id()); application[strings::request_type] = SmartObject(SmartType_Array); smart_objects::SmartObject& request_array = application[strings::request_type]; @@ -1261,7 +1262,7 @@ bool MessageHelper::CreateHMIApplicationStruct(ApplicationConstSharedPtr app, output[strings::app_id] = app->hmi_app_id(); output[strings::hmi_display_language_desired] = app->ui_language(); output[strings::is_media_application] = app->is_media_application(); - output[strings::policy_app_id] = app->policy_app_id(); + output[hmi_response::policy_app_id] = app->mobile_app_id(); if (ngn_media_screen_name) { output[strings::ngn_media_screen_app_name] = ngn_media_screen_name->asString(); 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 b73333e535..9a820f4cf9 100644 --- a/src/components/include/transport_manager/transport_adapter/transport_adapter.h +++ b/src/components/include/transport_manager/transport_adapter/transport_adapter.h @@ -57,7 +57,20 @@ namespace transport_adapter { class TransportAdapterListener; // TODO(EZamakhov): cahnge to DeviceUID -typedef std::string DeviceType; +//typedef std::string DeviceType; + +enum DeviceType { + AOA, + PASA_AOA, + BLUETOOTH, + PASA_BLUETOOTH, + MME, + TCP, + UNKNOWN +}; + +typedef std::map<DeviceType, std::string> DeviceTypes; + /** * @brief Type definition of container(map) that holds device unique *identifier(key value) and smart pointer to the device(mapped value). diff --git a/src/components/policy/src/policy/include/policy/policy_types.h b/src/components/policy/src/policy/include/policy/policy_types.h index 61d06db5ba..e3919ff8a2 100644 --- a/src/components/policy/src/policy/include/policy/policy_types.h +++ b/src/components/policy/src/policy/include/policy/policy_types.h @@ -38,7 +38,7 @@ #include <map> #include <set> #include "utils/shared_ptr.h" - +#include "utils/helpers.h" namespace policy { // TODO(PV): specify errors @@ -177,6 +177,16 @@ struct DeviceInfo { std::string carrier; uint32_t max_number_rfcom_ports; std::string connection_type; + + void AdoptDeviceType(const std::string& deviceType) { + connection_type = "USB_serial_number"; + using namespace helpers; + if (Compare<std::string, EQ, ONE> (deviceType, + "BLUETOOTH", + "WIFI")) { + connection_type.assign("BTMAC"); + } + } }; /** diff --git a/src/components/policy/test/include/mock_cache_manager.h b/src/components/policy/test/include/mock_cache_manager.h index e1189b8d04..0494eae4f4 100644 --- a/src/components/policy/test/include/mock_cache_manager.h +++ b/src/components/policy/test/include/mock_cache_manager.h @@ -74,6 +74,8 @@ class MockCacheManagerInterface : public CacheManagerInterface { std::vector<UserFriendlyMessage>(const std::vector<std::string>& msg_codes, const std::string& language)); MOCK_METHOD2(GetServiceUrls, void(const std::string& service_type, EndpointUrls& end_points)); + MOCK_CONST_METHOD0(GetLockScreenIconUrl, + std::string()); MOCK_METHOD1(GetNotificationsNumber, int(const std::string& priority)); MOCK_METHOD2(GetPriority, diff --git a/src/components/transport_manager/src/bluetooth/bluetooth_transport_adapter.cc b/src/components/transport_manager/src/bluetooth/bluetooth_transport_adapter.cc index 4d02e60896..966c0f9b76 100644 --- a/src/components/transport_manager/src/bluetooth/bluetooth_transport_adapter.cc +++ b/src/components/transport_manager/src/bluetooth/bluetooth_transport_adapter.cc @@ -65,7 +65,7 @@ BluetoothTransportAdapter::BluetoothTransportAdapter() } DeviceType BluetoothTransportAdapter::GetDeviceType() const { - return "sdl-bluetooth"; + return BLUETOOTH; } void BluetoothTransportAdapter::Store() const { diff --git a/src/components/transport_manager/src/tcp/tcp_transport_adapter.cc b/src/components/transport_manager/src/tcp/tcp_transport_adapter.cc index ade69cba69..21a3506da4 100644 --- a/src/components/transport_manager/src/tcp/tcp_transport_adapter.cc +++ b/src/components/transport_manager/src/tcp/tcp_transport_adapter.cc @@ -71,7 +71,7 @@ TcpTransportAdapter::~TcpTransportAdapter() { } DeviceType TcpTransportAdapter::GetDeviceType() const { - return "sdl-tcp"; + return TCP; } void TcpTransportAdapter::Store() const { 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 d45143a900..170cb7b734 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 @@ -43,6 +43,16 @@ namespace transport_manager { namespace transport_adapter { CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +namespace { +DeviceTypes devicesType = { + std::make_pair(AOA, std::string("USB")), + std::make_pair(PASA_AOA, std::string("USB")), + std::make_pair(MME, std::string("USB")), + std::make_pair(BLUETOOTH, std::string("BLUETOOTH")), + std::make_pair(PASA_BLUETOOTH, std::string("BLUETOOTH")), + std::make_pair(TCP, std::string("WIFI")) +}; +} TransportAdapterImpl::TransportAdapterImpl( DeviceScanner* device_scanner, @@ -757,12 +767,7 @@ std::string TransportAdapterImpl::DeviceName(const DeviceUID& device_id) const { } std::string TransportAdapterImpl::GetConnectionType() const { - const std::string deviceType = GetDeviceType(); - std::string result("USB_serial_number"); - if ("sdl-tcp" == deviceType || "sdl-bluetooth" == deviceType) { - result.assign("BTMAC"); - } - return result; + return devicesType[GetDeviceType()]; } #ifdef TIME_TESTER 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 b3ebb104dc..6363fb7bf9 100644 --- a/src/components/transport_manager/src/usb/usb_aoa_adapter.cc +++ b/src/components/transport_manager/src/usb/usb_aoa_adapter.cc @@ -56,7 +56,7 @@ UsbAoaAdapter::UsbAoaAdapter() UsbAoaAdapter::~UsbAoaAdapter() {} DeviceType UsbAoaAdapter::GetDeviceType() const { - return "sdl-usb-aoa"; + return PASA_AOA; } bool UsbAoaAdapter::IsInitialised() const { diff --git a/src/components/transport_manager/test/tcp_transport_adapter_test.cc b/src/components/transport_manager/test/tcp_transport_adapter_test.cc index 13bf838ec0..c91736b9f4 100644 --- a/src/components/transport_manager/test/tcp_transport_adapter_test.cc +++ b/src/components/transport_manager/test/tcp_transport_adapter_test.cc @@ -51,8 +51,8 @@ TEST(TcpAdapterBasicTest, GetDeviceType_Return_sdltcp) { //arrange TransportAdapter* transport_adapter = new TcpTransportAdapter(12345); - //assert - EXPECT_EQ("sdl-tcp", transport_adapter->GetDeviceType()); + // Assert + EXPECT_EQ(TCP, transport_adapter->GetDeviceType()); delete transport_adapter; } |