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 #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 |
11 #include <memory> | 11 #include <memory> |
12 | 12 |
13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/scoped_vector.h" | |
16 #include "base/optional.h" | 15 #include "base/optional.h" |
17 #include "device/bluetooth/bluetooth_export.h" | 16 #include "device/bluetooth/bluetooth_export.h" |
18 #include "device/bluetooth/bluetooth_low_energy_defs_win.h" | 17 #include "device/bluetooth/bluetooth_low_energy_defs_win.h" |
19 | 18 |
20 namespace device { | 19 namespace device { |
21 namespace win { | 20 namespace win { |
22 | 21 |
23 // | 22 // |
24 // Callback function signature for Bluetooth GATT events. This fixes a bug in | 23 // Callback function signature for Bluetooth GATT events. This fixes a bug in |
25 // this typedef in the Windows 10.0.10586 SDK which is missing the CALLBACK | 24 // this typedef in the Windows 10.0.10586 SDK which is missing the CALLBACK |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 126 |
128 // Returns true only on Windows platforms supporting Bluetooth Low Energy. | 127 // Returns true only on Windows platforms supporting Bluetooth Low Energy. |
129 virtual bool IsBluetoothLowEnergySupported(); | 128 virtual bool IsBluetoothLowEnergySupported(); |
130 | 129 |
131 // Enumerates the list of known (i.e. already paired) Bluetooth LE devices on | 130 // Enumerates the list of known (i.e. already paired) Bluetooth LE devices on |
132 // this machine. In case of error, returns false and sets |error| with an | 131 // this machine. In case of error, returns false and sets |error| with an |
133 // error message describing the problem. | 132 // error message describing the problem. |
134 // Note: This function returns an error if Bluetooth Low Energy is not | 133 // Note: This function returns an error if Bluetooth Low Energy is not |
135 // supported on this Windows platform. | 134 // supported on this Windows platform. |
136 virtual bool EnumerateKnownBluetoothLowEnergyDevices( | 135 virtual bool EnumerateKnownBluetoothLowEnergyDevices( |
137 ScopedVector<BluetoothLowEnergyDeviceInfo>* devices, | 136 std::vector<std::unique_ptr<BluetoothLowEnergyDeviceInfo>>* devices, |
138 std::string* error); | 137 std::string* error); |
139 | 138 |
140 // Enumerates the list of known Bluetooth LE GATT service devices on this | 139 // Enumerates the list of known Bluetooth LE GATT service devices on this |
141 // machine (a Bluetooth LE device usually has more than one GATT | 140 // machine (a Bluetooth LE device usually has more than one GATT |
142 // services that each of them has a device interface on the machine). In case | 141 // services that each of them has a device interface on the machine). In case |
143 // of error, returns false and sets |error| with an error message describing | 142 // of error, returns false and sets |error| with an error message describing |
144 // the problem. | 143 // the problem. |
145 // Note: This function returns an error if Bluetooth Low Energy is not | 144 // Note: This function returns an error if Bluetooth Low Energy is not |
146 // supported on this Windows platform. | 145 // supported on this Windows platform. |
147 virtual bool EnumerateKnownBluetoothLowEnergyGattServiceDevices( | 146 virtual bool EnumerateKnownBluetoothLowEnergyGattServiceDevices( |
148 ScopedVector<BluetoothLowEnergyDeviceInfo>* devices, | 147 std::vector<std::unique_ptr<BluetoothLowEnergyDeviceInfo>>* devices, |
149 std::string* error); | 148 std::string* error); |
150 | 149 |
151 // Enumerates the list of known (i.e. cached) GATT services for a given | 150 // Enumerates the list of known (i.e. cached) GATT services for a given |
152 // Bluetooth LE device |device_path| into |services|. In case of error, | 151 // Bluetooth LE device |device_path| into |services|. In case of error, |
153 // returns false and sets |error| with an error message describing the | 152 // returns false and sets |error| with an error message describing the |
154 // problem. | 153 // problem. |
155 // Note: This function returns an error if Bluetooth Low Energy is not | 154 // Note: This function returns an error if Bluetooth Low Energy is not |
156 // supported on this Windows platform. | 155 // supported on this Windows platform. |
157 virtual bool EnumerateKnownBluetoothLowEnergyServices( | 156 virtual bool EnumerateKnownBluetoothLowEnergyServices( |
158 const base::FilePath& device_path, | 157 const base::FilePath& device_path, |
159 ScopedVector<BluetoothLowEnergyServiceInfo>* services, | 158 std::vector<std::unique_ptr<BluetoothLowEnergyServiceInfo>>* services, |
160 std::string* error); | 159 std::string* error); |
161 | 160 |
162 // Reads characteristics of |service| with service device path |service_path|. | 161 // Reads characteristics of |service| with service device path |service_path|. |
163 // The result will be stored in |*out_included_characteristics| and | 162 // The result will be stored in |*out_included_characteristics| and |
164 // |*out_counts|. | 163 // |*out_counts|. |
165 virtual HRESULT ReadCharacteristicsOfAService( | 164 virtual HRESULT ReadCharacteristicsOfAService( |
166 base::FilePath& service_path, | 165 base::FilePath& service_path, |
167 const PBTH_LE_GATT_SERVICE service, | 166 const PBTH_LE_GATT_SERVICE service, |
168 std::unique_ptr<BTH_LE_GATT_CHARACTERISTIC>* out_included_characteristics, | 167 std::unique_ptr<BTH_LE_GATT_CHARACTERISTIC>* out_included_characteristics, |
169 USHORT* out_counts); | 168 USHORT* out_counts); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 | 212 |
214 protected: | 213 protected: |
215 BluetoothLowEnergyWrapper(); | 214 BluetoothLowEnergyWrapper(); |
216 virtual ~BluetoothLowEnergyWrapper(); | 215 virtual ~BluetoothLowEnergyWrapper(); |
217 }; | 216 }; |
218 | 217 |
219 } // namespace win | 218 } // namespace win |
220 } // namespace device | 219 } // namespace device |
221 | 220 |
222 #endif // DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_WIN_H_ | 221 #endif // DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_WIN_H_ |
OLD | NEW |