diff options
Diffstat (limited to 'src/components/application_manager/src')
4 files changed, 14 insertions, 9 deletions
diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index b8ba76541..6ffa7e233 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -542,14 +542,20 @@ mobile_api::HMILevel::eType ApplicationManagerImpl::IsHmiLevelFullAllowed( return result; } -void ApplicationManagerImpl::ConnectToDevice(uint32_t id) { +void ApplicationManagerImpl::ConnectToDevice(const std::string& device_mac) { // TODO(VS): Call function from ConnectionHandler if (!connection_handler_) { LOG4CXX_WARN(logger_, "Connection handler is not set."); return; } - connection_handler_->ConnectToDevice(id); + connection_handler::DeviceHandle handle; + if (!connection_handler_->GetDeviceID(device_mac, &handle) ) { + LOG4CXX_ERROR(logger_, "Attempt to connect to invalid device with mac:" + << device_mac ); + return; + } + connection_handler_->ConnectToDevice(handle); } void ApplicationManagerImpl::OnHMIStartedCooperation() { diff --git a/src/components/application_manager/src/commands/hmi/on_device_chosen_notification.cc b/src/components/application_manager/src/commands/hmi/on_device_chosen_notification.cc index 5d73c7b80..441538bee 100644 --- a/src/components/application_manager/src/commands/hmi/on_device_chosen_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_device_chosen_notification.cc @@ -50,7 +50,7 @@ void OnDeviceChosenNotification::Run() { if ((*message_)[strings::msg_params].keyExists(strings::device_info)) { ApplicationManagerImpl::instance()->ConnectToDevice( (*message_)[strings::msg_params][strings::device_info][strings::id] - .asInt()); + .asString()); } } diff --git a/src/components/application_manager/src/commands/hmi/on_device_state_changed_notification.cc b/src/components/application_manager/src/commands/hmi/on_device_state_changed_notification.cc index fbb2bcfe9..b41eb6b86 100644 --- a/src/components/application_manager/src/commands/hmi/on_device_state_changed_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_device_state_changed_notification.cc @@ -95,8 +95,7 @@ void OnDeviceStateChangedNotification::Run() { .asString(); if (device_id.empty()) { if ((*message_)[strings::msg_params].keyExists("deviceId")) { - device_id = MessageHelper::GetDeviceMacAddressForHandle( - (*message_)[strings::msg_params]["deviceId"]["id"].asInt()); + device_id = (*message_)[strings::msg_params]["deviceId"]["id"].asString(); } } else { // Policy uses hashed MAC address as device_id diff --git a/src/components/application_manager/src/message_helper.cc b/src/components/application_manager/src/message_helper.cc index 2fd6d9f74..11bd6afda 100644 --- a/src/components/application_manager/src/message_helper.cc +++ b/src/components/application_manager/src/message_helper.cc @@ -335,7 +335,7 @@ void MessageHelper::SendOnAppRegisteredNotificationToHMI( << application_impl.device()); } device_info[strings::name] = device_name; - device_info[strings::id] = application_impl.device(); + device_info[strings::id] = mac_address; const policy::DeviceConsent device_consent = policy::PolicyHandler::instance()->GetUserConsentForDevice(mac_address); @@ -1320,7 +1320,7 @@ bool MessageHelper::CreateHMIApplicationStruct(ApplicationConstSharedPtr app, output[strings::device_info] = smart_objects::SmartObject(smart_objects::SmartType_Map); output[strings::device_info][strings::name] = device_name; - output[strings::device_info][strings::id] = app->device(); + output[strings::device_info][strings::id] = mac_address; const policy::DeviceConsent device_consent = policy::PolicyHandler::instance()->GetUserConsentForDevice(mac_address); output[strings::device_info][strings::isSDLAllowed] = @@ -1537,7 +1537,7 @@ void MessageHelper::SendSDLActivateAppResponse(policy::AppPermissions& permissio (*message)[strings::msg_params]["device"]["name"] = permissions.deviceInfo .device_name; (*message)[strings::msg_params]["device"]["id"] = permissions.deviceInfo - .device_handle; + .device_mac_address; } (*message)[strings::msg_params]["isAppRevoked"] = permissions.appRevoked; @@ -1577,7 +1577,7 @@ void MessageHelper::SendOnSDLConsentNeeded( (*message)[strings::params][strings::message_type] = MessageType::kNotification; - (*message)[strings::msg_params]["device"]["id"] = device_info.device_handle; + (*message)[strings::msg_params]["device"]["id"] = device_info.device_mac_address; (*message)[strings::msg_params]["device"]["name"] = device_info.device_name; ApplicationManagerImpl::instance()->ManageHMICommand(message); |