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
3 // found in the LICENSE file.
5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_WIN_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_WIN_H_
10 // #include <bthledef.h>
12 // bthledef.h from Win8 SDK has a couple of issues when used in a Win32 app:
13 // * line 420: usage of "pragma pop" instead of "pragma warning(pop)"
14 // * line 349: no CALLBACK modifier in the definition of
15 // PFNBLUETOOTH_GATT_EVENT_CALLBACK.
17 // So, we duplicate the definitions we need and prevent the build from including
18 // the content of bthledef.h.
19 #ifndef __BTHLEDEF_H__
20 #define __BTHLEDEF_H__
23 // Bluetooth LE device interface GUID
25 // {781aee18-7733-4ce4-adb0-91f41c67b592}
26 DEFINE_GUID(GUID_BLUETOOTHLE_DEVICE_INTERFACE
,
39 #endif // __BTHLEDEF_H__
40 #include <bluetoothapis.h>
42 #include "base/files/file_path.h"
43 #include "base/memory/scoped_vector.h"
44 #include "base/win/scoped_handle.h"
49 // Returns true only on Windows platforms supporting Bluetooth Low Energy.
50 bool IsBluetoothLowEnergySupported();
52 struct BluetoothLowEnergyDeviceInfo
{
53 BluetoothLowEnergyDeviceInfo() { address
.ullLong
= BLUETOOTH_NULL_ADDRESS
; }
57 std::string friendly_name
;
58 BLUETOOTH_ADDRESS address
;
61 // Enumerates the list of known (i.e. already paired) Bluetooth LE devices on
62 // this machine. In case of error, returns false and sets |error| with an error
63 // message describing the problem.
64 // Note: This function returns an error if Bluetooth Low Energy is not supported
65 // on this Windows platform.
66 bool EnumerateKnownBluetoothLowEnergyDevices(
67 ScopedVector
<BluetoothLowEnergyDeviceInfo
>* devices
,
70 bool ExtractBluetoothAddressFromDeviceInstanceIdForTesting(
71 const std::string
& instance_id
,
72 BLUETOOTH_ADDRESS
* btha
,
78 #endif // DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_WIN_H_