OLD | NEW |
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 "base/files/file.h" | 7 #include "base/files/file.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
10 #include "base/win/scoped_handle.h" | 10 #include "base/win/scoped_handle.h" |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 ScopedDeviceInfoSetHandle result(SetupDiGetClassDevs( | 515 ScopedDeviceInfoSetHandle result(SetupDiGetClassDevs( |
516 &BluetoothClassGUID, NULL, NULL, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE)); | 516 &BluetoothClassGUID, NULL, NULL, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE)); |
517 if (!result.IsValid()) { | 517 if (!result.IsValid()) { |
518 return HRESULT_FROM_WIN32(::GetLastError()); | 518 return HRESULT_FROM_WIN32(::GetLastError()); |
519 } | 519 } |
520 | 520 |
521 (*handle) = result.Pass(); | 521 (*handle) = result.Pass(); |
522 return S_OK; | 522 return S_OK; |
523 } | 523 } |
524 | 524 |
525 // Opens a Device Info Set that can be used to enumerate Bluetooth LE devices | |
526 // exposing a service GUID. | |
527 HRESULT OpenBluetoothLowEnergyService(const GUID& service_guid, | |
528 ScopedDeviceInfoSetHandle* handle) { | |
529 ScopedDeviceInfoSetHandle result(SetupDiGetClassDevs( | |
530 &service_guid, NULL, NULL, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE)); | |
531 if (!result.IsValid()) { | |
532 return HRESULT_FROM_WIN32(::GetLastError()); | |
533 } | |
534 | |
535 (*handle) = result.Pass(); | |
536 return S_OK; | |
537 } | |
538 | |
539 } // namespace | 525 } // namespace |
540 | 526 |
541 namespace device { | 527 namespace device { |
542 namespace win { | 528 namespace win { |
543 | 529 |
544 // static | 530 // static |
545 scoped_ptr<DeviceRegistryPropertyValue> DeviceRegistryPropertyValue::Create( | 531 scoped_ptr<DeviceRegistryPropertyValue> DeviceRegistryPropertyValue::Create( |
546 DWORD property_type, | 532 DWORD property_type, |
547 scoped_ptr<uint8_t[]> value, | 533 scoped_ptr<uint8_t[]> value, |
548 size_t value_size) { | 534 size_t value_size) { |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 | 654 |
669 bool ExtractBluetoothAddressFromDeviceInstanceIdForTesting( | 655 bool ExtractBluetoothAddressFromDeviceInstanceIdForTesting( |
670 const std::string& instance_id, | 656 const std::string& instance_id, |
671 BLUETOOTH_ADDRESS* btha, | 657 BLUETOOTH_ADDRESS* btha, |
672 std::string* error) { | 658 std::string* error) { |
673 return ExtractBluetoothAddressFromDeviceInstanceId(instance_id, btha, error); | 659 return ExtractBluetoothAddressFromDeviceInstanceId(instance_id, btha, error); |
674 } | 660 } |
675 | 661 |
676 } // namespace win | 662 } // namespace win |
677 } // namespace device | 663 } // namespace device |
OLD | NEW |