OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_DEVICE_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_vector.h" | 12 #include "base/memory/scoped_vector.h" |
13 #include "base/string16.h" | 13 #include "base/string16.h" |
14 | 14 |
15 namespace device { | 15 namespace device { |
16 | 16 |
| 17 class BluetoothProfile; |
17 class BluetoothServiceRecord; | 18 class BluetoothServiceRecord; |
18 class BluetoothSocket; | 19 class BluetoothSocket; |
19 | 20 |
20 struct BluetoothOutOfBandPairingData; | 21 struct BluetoothOutOfBandPairingData; |
21 | 22 |
22 // BluetoothDevice represents a remote Bluetooth device, both its properties and | 23 // BluetoothDevice represents a remote Bluetooth device, both its properties and |
23 // capabilities as discovered by a local adapter and actions that may be | 24 // capabilities as discovered by a local adapter and actions that may be |
24 // performed on the remove device such as pairing, connection and disconnection. | 25 // performed on the remove device such as pairing, connection and disconnection. |
25 // | 26 // |
26 // The class is instantiated and managed by the BluetoothAdapter class | 27 // The class is instantiated and managed by the BluetoothAdapter class |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 | 292 |
292 // Attempts to open a socket to a service matching |uuid| on this device. If | 293 // Attempts to open a socket to a service matching |uuid| on this device. If |
293 // the connection is successful, |callback| is called with a BluetoothSocket. | 294 // the connection is successful, |callback| is called with a BluetoothSocket. |
294 // Otherwise |callback| is called with NULL. The socket is closed as soon as | 295 // Otherwise |callback| is called with NULL. The socket is closed as soon as |
295 // all references to the BluetoothSocket are released. Note that the | 296 // all references to the BluetoothSocket are released. Note that the |
296 // BluetoothSocket object can outlive both this BluetoothDevice and the | 297 // BluetoothSocket object can outlive both this BluetoothDevice and the |
297 // BluetoothAdapter for this device. | 298 // BluetoothAdapter for this device. |
298 virtual void ConnectToService(const std::string& service_uuid, | 299 virtual void ConnectToService(const std::string& service_uuid, |
299 const SocketCallback& callback) = 0; | 300 const SocketCallback& callback) = 0; |
300 | 301 |
| 302 // Attempts to initiate an outgoing connection to this device for the profile |
| 303 // identified by |profile|, on success the profile's connection callback |
| 304 // wil be called; on failure |error_callback| will be called. |
| 305 virtual void ConnectToProfile(BluetoothProfile* profile, |
| 306 const ErrorCallback& error_callback) = 0; |
| 307 |
301 // Sets the Out Of Band pairing data for this device to |data|. Exactly one | 308 // Sets the Out Of Band pairing data for this device to |data|. Exactly one |
302 // of |callback| or |error_callback| will be run. | 309 // of |callback| or |error_callback| will be run. |
303 virtual void SetOutOfBandPairingData( | 310 virtual void SetOutOfBandPairingData( |
304 const BluetoothOutOfBandPairingData& data, | 311 const BluetoothOutOfBandPairingData& data, |
305 const base::Closure& callback, | 312 const base::Closure& callback, |
306 const ErrorCallback& error_callback) = 0; | 313 const ErrorCallback& error_callback) = 0; |
307 | 314 |
308 // Clears the Out Of Band pairing data for this device. Exactly one of | 315 // Clears the Out Of Band pairing data for this device. Exactly one of |
309 // |callback| or |error_callback| will be run. | 316 // |callback| or |error_callback| will be run. |
310 virtual void ClearOutOfBandPairingData( | 317 virtual void ClearOutOfBandPairingData( |
(...skipping 11 matching lines...) Expand all Loading... |
322 | 329 |
323 private: | 330 private: |
324 // Returns a localized string containing the device's bluetooth address and | 331 // Returns a localized string containing the device's bluetooth address and |
325 // a device type for display when |name_| is empty. | 332 // a device type for display when |name_| is empty. |
326 string16 GetAddressWithLocalizedDeviceTypeName() const; | 333 string16 GetAddressWithLocalizedDeviceTypeName() const; |
327 }; | 334 }; |
328 | 335 |
329 } // namespace device | 336 } // namespace device |
330 | 337 |
331 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ | 338 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ |
OLD | NEW |