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

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

Issue 1690133002: Implement BluetoothRemoteGattServiceWin and related unit tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments and split out of included GATT services Created 4 years, 9 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 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_WIN_H_ 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_WIN_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_WIN_H_ 6 #define DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_WIN_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 uint32_t AsUint32() const; 67 uint32_t AsUint32() const;
68 68
69 private: 69 private:
70 DEVPROPTYPE property_type_; 70 DEVPROPTYPE property_type_;
71 scoped_ptr<uint8_t[]> value_; 71 scoped_ptr<uint8_t[]> value_;
72 size_t value_size_; 72 size_t value_size_;
73 73
74 DISALLOW_COPY_AND_ASSIGN(DevicePropertyValue); 74 DISALLOW_COPY_AND_ASSIGN(DevicePropertyValue);
75 }; 75 };
76 76
77 // Returns true only on Windows platforms supporting Bluetooth Low Energy.
78 bool DEVICE_BLUETOOTH_EXPORT IsBluetoothLowEnergySupported();
79
80 struct DEVICE_BLUETOOTH_EXPORT BluetoothLowEnergyServiceInfo { 77 struct DEVICE_BLUETOOTH_EXPORT BluetoothLowEnergyServiceInfo {
81 BluetoothLowEnergyServiceInfo(); 78 BluetoothLowEnergyServiceInfo();
82 ~BluetoothLowEnergyServiceInfo(); 79 ~BluetoothLowEnergyServiceInfo();
83 80
84 BTH_LE_UUID uuid; 81 BTH_LE_UUID uuid;
85 // Attribute handle uniquely identifies this service on the device. 82 // Attribute handle uniquely identifies this service on the device.
86 USHORT attribute_handle = 0; 83 USHORT attribute_handle = 0;
87 }; 84 };
88 85
89 struct DEVICE_BLUETOOTH_EXPORT BluetoothLowEnergyDeviceInfo { 86 struct DEVICE_BLUETOOTH_EXPORT BluetoothLowEnergyDeviceInfo {
(...skipping 16 matching lines...) Expand all
106 std::string* error); 103 std::string* error);
107 104
108 // Wraps Windows APIs used to access Bluetooth Low Energy devices, providing an 105 // Wraps Windows APIs used to access Bluetooth Low Energy devices, providing an
109 // interface that can be replaced with fakes in tests. 106 // interface that can be replaced with fakes in tests.
110 class DEVICE_BLUETOOTH_EXPORT BluetoothLowEnergyWrapper { 107 class DEVICE_BLUETOOTH_EXPORT BluetoothLowEnergyWrapper {
111 public: 108 public:
112 static BluetoothLowEnergyWrapper* GetInstance(); 109 static BluetoothLowEnergyWrapper* GetInstance();
113 static void DeleteInstance(); 110 static void DeleteInstance();
114 static void SetInstanceForTest(BluetoothLowEnergyWrapper* instance); 111 static void SetInstanceForTest(BluetoothLowEnergyWrapper* instance);
115 112
113 // Returns true only on Windows platforms supporting Bluetooth Low Energy.
114 virtual bool IsBluetoothLowEnergySupported();
115
116 // Enumerates the list of known (i.e. already paired) Bluetooth LE devices on 116 // Enumerates the list of known (i.e. already paired) Bluetooth LE devices on
117 // this machine. In case of error, returns false and sets |error| with an 117 // this machine. In case of error, returns false and sets |error| with an
118 // error message describing the problem. 118 // error message describing the problem.
119 // Note: This function returns an error if Bluetooth Low Energy is not 119 // Note: This function returns an error if Bluetooth Low Energy is not
120 // supported on this Windows platform. 120 // supported on this Windows platform.
121 virtual bool EnumerateKnownBluetoothLowEnergyDevices( 121 virtual bool EnumerateKnownBluetoothLowEnergyDevices(
122 ScopedVector<BluetoothLowEnergyDeviceInfo>* devices, 122 ScopedVector<BluetoothLowEnergyDeviceInfo>* devices,
123 std::string* error); 123 std::string* error);
124 124
125 // Enumerates the list of known Bluetooth LE GATT service devices on this 125 // Enumerates the list of known Bluetooth LE GATT service devices on this
(...skipping 11 matching lines...) Expand all
137 // Bluetooth LE device |device_path| into |services|. In case of error, 137 // Bluetooth LE device |device_path| into |services|. In case of error,
138 // returns false and sets |error| with an error message describing the 138 // returns false and sets |error| with an error message describing the
139 // problem. 139 // problem.
140 // Note: This function returns an error if Bluetooth Low Energy is not 140 // Note: This function returns an error if Bluetooth Low Energy is not
141 // supported on this Windows platform. 141 // supported on this Windows platform.
142 virtual bool EnumerateKnownBluetoothLowEnergyServices( 142 virtual bool EnumerateKnownBluetoothLowEnergyServices(
143 const base::FilePath& device_path, 143 const base::FilePath& device_path,
144 ScopedVector<BluetoothLowEnergyServiceInfo>* services, 144 ScopedVector<BluetoothLowEnergyServiceInfo>* services,
145 std::string* error); 145 std::string* error);
146 146
147 // Reads characteristics of |service| with service device path |service_path|.
148 // The result will be stored in |*out_included_characteristics| and
149 // |*out_counts|.
150 virtual HRESULT ReadCharacteristicsOfAService(
151 base::FilePath& service_path,
152 const PBTH_LE_GATT_SERVICE service,
153 scoped_ptr<BTH_LE_GATT_CHARACTERISTIC>* out_included_characteristics,
154 USHORT* out_counts);
155
147 protected: 156 protected:
148 BluetoothLowEnergyWrapper(); 157 BluetoothLowEnergyWrapper();
149 virtual ~BluetoothLowEnergyWrapper(); 158 virtual ~BluetoothLowEnergyWrapper();
150 }; 159 };
151 160
152 } // namespace win 161 } // namespace win
153 } // namespace device 162 } // namespace device
154 163
155 #endif // DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_WIN_H_ 164 #endif // DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698