Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Side by Side Diff: device/bluetooth/bluetooth_low_energy_win.cc

Issue 2009753002: bluetooth: Make public BluetoothDevice::GetName method. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: split out name/alias Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "device/bluetooth/bluetooth_low_energy_win.h" 5 #include "device/bluetooth/bluetooth_low_energy_win.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/files/file.h" 10 #include "base/files/file.h"
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 } 460 }
461 461
462 std::unique_ptr<device::win::BluetoothLowEnergyDeviceInfo> result( 462 std::unique_ptr<device::win::BluetoothLowEnergyDeviceInfo> result(
463 new device::win::BluetoothLowEnergyDeviceInfo()); 463 new device::win::BluetoothLowEnergyDeviceInfo());
464 result->path = 464 result->path =
465 base::FilePath(std::wstring(device_interface_detail_data->DevicePath)); 465 base::FilePath(std::wstring(device_interface_detail_data->DevicePath));
466 if (!CollectBluetoothLowEnergyDeviceInstanceId( 466 if (!CollectBluetoothLowEnergyDeviceInstanceId(
467 device_info_handle, &device_info_data, result, error)) { 467 device_info_handle, &device_info_data, result, error)) {
468 return false; 468 return false;
469 } 469 }
470 if (!CollectBluetoothLowEnergyDeviceFriendlyName( 470 // Get the friendly name. If it fails it is OK to leave the
471 device_info_handle, &device_info_data, result, error)) { 471 // device_info_data.friendly_name as nullopt indicating the name not read.
472 // Only fail if not the GATT service device interface, which doesn't have a 472 CollectBluetoothLowEnergyDeviceFriendlyName(device_info_handle,
473 // friendly name. 473 &device_info_data, result, error);
474 if (device_interface_data->InterfaceClassGuid !=
475 GUID_BLUETOOTH_GATT_SERVICE_DEVICE_INTERFACE)
476 return false;
477 }
478 if (!CollectBluetoothLowEnergyDeviceAddress( 474 if (!CollectBluetoothLowEnergyDeviceAddress(
479 device_info_handle, &device_info_data, result, error)) { 475 device_info_handle, &device_info_data, result, error)) {
480 return false; 476 return false;
481 } 477 }
482 if (!CollectBluetoothLowEnergyDeviceStatus( 478 if (!CollectBluetoothLowEnergyDeviceStatus(
483 device_info_handle, &device_info_data, result, error)) { 479 device_info_handle, &device_info_data, result, error)) {
484 return false; 480 return false;
485 } 481 }
486 (*device_info) = std::move(result); 482 (*device_info) = std::move(result);
487 return true; 483 return true;
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 base::File file(service_path, base::File::FLAG_OPEN | base::File::FLAG_READ | 859 base::File file(service_path, base::File::FLAG_OPEN | base::File::FLAG_READ |
864 base::File::FLAG_WRITE); 860 base::File::FLAG_WRITE);
865 if (!file.IsValid()) 861 if (!file.IsValid())
866 return HRESULT_FROM_WIN32(ERROR_OPEN_FAILED); 862 return HRESULT_FROM_WIN32(ERROR_OPEN_FAILED);
867 return BluetoothGATTSetDescriptorValue(file.GetPlatformFile(), descriptor, 863 return BluetoothGATTSetDescriptorValue(file.GetPlatformFile(), descriptor,
868 new_value, BLUETOOTH_GATT_FLAG_NONE); 864 new_value, BLUETOOTH_GATT_FLAG_NONE);
869 } 865 }
870 866
871 } // namespace win 867 } // namespace win
872 } // namespace device 868 } // namespace device
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_low_energy_win.h ('k') | device/bluetooth/bluetooth_task_manager_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698