Index: device/bluetooth/bluetooth_low_energy_win.h |
diff --git a/device/bluetooth/bluetooth_low_energy_win.h b/device/bluetooth/bluetooth_low_energy_win.h |
index 52347cece15299a289ca9b141cd3a2339c09c181..9abdf34fef63c9d44e544f7e262f197d4ba359d9 100644 |
--- a/device/bluetooth/bluetooth_low_energy_win.h |
+++ b/device/bluetooth/bluetooth_low_energy_win.h |
@@ -12,7 +12,6 @@ |
#include "base/macros.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/memory/scoped_vector.h" |
-#include "base/win/scoped_handle.h" |
#include "device/bluetooth/bluetooth_export.h" |
#include "device/bluetooth/bluetooth_low_energy_defs_win.h" |
@@ -100,42 +99,56 @@ struct BluetoothLowEnergyDeviceInfo { |
bool connected; |
}; |
-// Enumerates the list of known (i.e. already paired) Bluetooth LE devices on |
-// this machine. In case of error, returns false and sets |error| with an error |
-// message describing the problem. |
-// Note: This function returns an error if Bluetooth Low Energy is not supported |
-// on this Windows platform. |
-bool EnumerateKnownBluetoothLowEnergyDevices( |
- ScopedVector<BluetoothLowEnergyDeviceInfo>* devices, |
- std::string* error); |
- |
-// Enumerates the list of known Bluetooth LE GATT service devices on this |
-// machine (a Bluetooth LE device usually has more than one GATT |
-// services that each of them has a device interface on the machine). In case |
-// of error, returns false and sets |error| with an error message describing the |
-// problem. |
-// Note: This function returns an error if Bluetooth Low Energy is not supported |
-// on this Windows platform. |
-bool EnumerateKnownBluetoothLowEnergyGattServiceDevices( |
- ScopedVector<BluetoothLowEnergyDeviceInfo>* devices, |
- std::string* error); |
- |
-// Enumerates the list of known (i.e. cached) GATT services for a given |
-// Bluetooth LE device |device_path| into |services|. In case of error, returns |
-// false and sets |error| with an error message describing the problem. Note: |
-// This function returns an error if Bluetooth Low Energy is not supported on |
-// this Windows platform. |
-bool EnumerateKnownBluetoothLowEnergyServices( |
- const base::FilePath& device_path, |
- ScopedVector<BluetoothLowEnergyServiceInfo>* services, |
- std::string* error); |
- |
bool DEVICE_BLUETOOTH_EXPORT |
ExtractBluetoothAddressFromDeviceInstanceIdForTesting( |
const std::string& instance_id, |
BLUETOOTH_ADDRESS* btha, |
std::string* error); |
+// Wraps Windows APIs used to access Bluetooth Low Energy devices, providing an |
+// interface that can be replaced with fakes in tests. |
+class DEVICE_BLUETOOTH_EXPORT BluetoothLowEnergyWrapper { |
+ public: |
+ static BluetoothLowEnergyWrapper* GetInstance(); |
+ static void DeleteInstance(); |
+ static void SetInstanceForTest(BluetoothLowEnergyWrapper* instance); |
+ |
+ // Enumerates the list of known (i.e. already paired) Bluetooth LE devices on |
+ // this machine. In case of error, returns false and sets |error| with an |
+ // error message describing the problem. |
+ // Note: This function returns an error if Bluetooth Low Energy is not |
+ // supported on this Windows platform. |
+ virtual bool EnumerateKnownBluetoothLowEnergyDevices( |
+ ScopedVector<BluetoothLowEnergyDeviceInfo>* devices, |
+ std::string* error); |
+ |
+ // Enumerates the list of known Bluetooth LE GATT service devices on this |
+ // machine (a Bluetooth LE device usually has more than one GATT |
+ // services that each of them has a device interface on the machine). In case |
+ // of error, returns false and sets |error| with an error message describing |
+ // the problem. |
+ // Note: This function returns an error if Bluetooth Low Energy is not |
+ // supported on this Windows platform. |
+ virtual bool EnumerateKnownBluetoothLowEnergyGattServiceDevices( |
+ ScopedVector<BluetoothLowEnergyDeviceInfo>* devices, |
+ std::string* error); |
+ |
+ // Enumerates the list of known (i.e. cached) GATT services for a given |
+ // Bluetooth LE device |device_path| into |services|. In case of error, |
+ // returns false and sets |error| with an error message describing the |
+ // problem. |
+ // Note: This function returns an error if Bluetooth Low Energy is not |
+ // supported on this Windows platform. |
+ virtual bool EnumerateKnownBluetoothLowEnergyServices( |
+ const base::FilePath& device_path, |
+ ScopedVector<BluetoothLowEnergyServiceInfo>* services, |
+ std::string* error); |
+ |
+ protected: |
+ BluetoothLowEnergyWrapper(); |
+ virtual ~BluetoothLowEnergyWrapper(); |
+}; |
+ |
} // namespace win |
} // namespace device |