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

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: Merge TOT 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 CollectBluetoothLowEnergyDeviceFriendlyName(device_info_handle,
471 device_info_handle, &device_info_data, result, error)) { 471 &device_info_data, result, error);
472 // Only fail if not the GATT service device interface, which doesn't have a
473 // friendly name.
474 if (device_interface_data->InterfaceClassGuid !=
ortuno 2016/07/14 21:11:41 Hmm this would mean that we no longer fail if we c
scheib 2016/07/16 00:21:36 Acknowledged, would be great to know if we'd alway
475 GUID_BLUETOOTH_GATT_SERVICE_DEVICE_INTERFACE)
476 return false;
477 }
478 if (!CollectBluetoothLowEnergyDeviceAddress( 472 if (!CollectBluetoothLowEnergyDeviceAddress(
479 device_info_handle, &device_info_data, result, error)) { 473 device_info_handle, &device_info_data, result, error)) {
480 return false; 474 return false;
481 } 475 }
482 if (!CollectBluetoothLowEnergyDeviceStatus( 476 if (!CollectBluetoothLowEnergyDeviceStatus(
483 device_info_handle, &device_info_data, result, error)) { 477 device_info_handle, &device_info_data, result, error)) {
484 return false; 478 return false;
485 } 479 }
486 (*device_info) = std::move(result); 480 (*device_info) = std::move(result);
487 return true; 481 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 | 857 base::File file(service_path, base::File::FLAG_OPEN | base::File::FLAG_READ |
864 base::File::FLAG_WRITE); 858 base::File::FLAG_WRITE);
865 if (!file.IsValid()) 859 if (!file.IsValid())
866 return HRESULT_FROM_WIN32(ERROR_OPEN_FAILED); 860 return HRESULT_FROM_WIN32(ERROR_OPEN_FAILED);
867 return BluetoothGATTSetDescriptorValue(file.GetPlatformFile(), descriptor, 861 return BluetoothGATTSetDescriptorValue(file.GetPlatformFile(), descriptor,
868 new_value, BLUETOOTH_GATT_FLAG_NONE); 862 new_value, BLUETOOTH_GATT_FLAG_NONE);
869 } 863 }
870 864
871 } // namespace win 865 } // namespace win
872 } // namespace device 866 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698