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 COMPONENTS_PROXIMITY_AUTH_BLUETOOTH_UTIL_H | 5 #ifndef COMPONENTS_PROXIMITY_AUTH_BLUETOOTH_UTIL_H |
6 #define COMPONENTS_PROXIMITY_AUTH_BLUETOOTH_UTIL_H | 6 #define COMPONENTS_PROXIMITY_AUTH_BLUETOOTH_UTIL_H |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
11 #include "device/bluetooth/bluetooth_device.h" | 11 #include "device/bluetooth/bluetooth_device.h" |
12 | 12 |
13 namespace device { | 13 namespace device { |
14 class BluetoothUUID; | 14 class BluetoothUUID; |
15 } | 15 } |
16 | 16 |
17 namespace proximity_auth { | 17 namespace proximity_auth { |
18 namespace bluetooth_util { | 18 namespace bluetooth_util { |
19 | 19 |
20 typedef base::Callback<void(const std::string& error_message)> ErrorCallback; | 20 typedef base::Callback<void(const std::string& error_message)> ErrorCallback; |
21 | 21 |
22 // Connects to the SDP service on the Bluetooth device with the given | 22 // Connects to the SDP service on the Bluetooth device with the given |
23 // |device_address|, if possible. Calls the |callback| on success, or the | 23 // |device_address|, if possible. Calls the |callback| on success, or the |
24 // |error_callback| with an error message on failure. Because this can be an | 24 // |error_callback| with an error message on failure. Because this can be an |
25 // expensive operation, the work will be run on the provided |task_runner|, | 25 // expensive operation, the work will be run on the provided |task_runner|, |
26 // which should correspond to a background thread. | 26 // which should correspond to a background thread. |
27 void SeekDeviceByAddress( | 27 void SeekDeviceByAddress(const std::string& device_address, |
28 const std::string& device_address, | 28 const base::Closure& callback, |
29 const base::Closure& callback, | 29 const ErrorCallback& error_callback, |
30 const ErrorCallback& error_callback, | 30 base::TaskRunner* task_runner); |
31 base::TaskRunner* task_runner); | |
32 | 31 |
33 void ConnectToServiceInsecurely( | 32 void ConnectToServiceInsecurely( |
34 device::BluetoothDevice* device, | 33 device::BluetoothDevice* device, |
35 const device::BluetoothUUID& uuid, | 34 const device::BluetoothUUID& uuid, |
36 const device::BluetoothDevice::ConnectToServiceCallback& callback, | 35 const device::BluetoothDevice::ConnectToServiceCallback& callback, |
37 const device::BluetoothDevice::ConnectToServiceErrorCallback& | 36 const device::BluetoothDevice::ConnectToServiceErrorCallback& |
38 error_callback); | 37 error_callback); |
39 | 38 |
40 } // namespace bluetooth_util | 39 } // namespace bluetooth_util |
41 } // namespace proximity_auth | 40 } // namespace proximity_auth |
42 | 41 |
43 #endif // COMPONENTS_PROXIMITY_AUTH_BLUETOOTH_UTIL_H | 42 #endif // COMPONENTS_PROXIMITY_AUTH_BLUETOOTH_UTIL_H |
OLD | NEW |