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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 | 296 |
296 // Attempts to open a socket to a service matching |uuid| on this device. If | 297 // Attempts to open a socket to a service matching |uuid| on this device. If |
297 // the connection is successful, |callback| is called with a BluetoothSocket. | 298 // the connection is successful, |callback| is called with a BluetoothSocket. |
298 // Otherwise |callback| is called with NULL. The socket is closed as soon as | 299 // Otherwise |callback| is called with NULL. The socket is closed as soon as |
299 // all references to the BluetoothSocket are released. Note that the | 300 // all references to the BluetoothSocket are released. Note that the |
300 // BluetoothSocket object can outlive both this BluetoothDevice and the | 301 // BluetoothSocket object can outlive both this BluetoothDevice and the |
301 // BluetoothAdapter for this device. | 302 // BluetoothAdapter for this device. |
302 virtual void ConnectToService(const std::string& service_uuid, | 303 virtual void ConnectToService(const std::string& service_uuid, |
303 const SocketCallback& callback) = 0; | 304 const SocketCallback& callback) = 0; |
304 | 305 |
| 306 // Attempts to initiate an outgoing connection to this device for the profile |
| 307 // identified by |profile|, on success the profile's connection callback |
| 308 // wil be called; on failure |error_callback| will be called. |
| 309 virtual void ConnectToProfile(BluetoothProfile* profile, |
| 310 const ErrorCallback& error_callback) = 0; |
| 311 |
305 // Sets the Out Of Band pairing data for this device to |data|. Exactly one | 312 // Sets the Out Of Band pairing data for this device to |data|. Exactly one |
306 // of |callback| or |error_callback| will be run. | 313 // of |callback| or |error_callback| will be run. |
307 virtual void SetOutOfBandPairingData( | 314 virtual void SetOutOfBandPairingData( |
308 const BluetoothOutOfBandPairingData& data, | 315 const BluetoothOutOfBandPairingData& data, |
309 const base::Closure& callback, | 316 const base::Closure& callback, |
310 const ErrorCallback& error_callback) = 0; | 317 const ErrorCallback& error_callback) = 0; |
311 | 318 |
312 // Clears the Out Of Band pairing data for this device. Exactly one of | 319 // Clears the Out Of Band pairing data for this device. Exactly one of |
313 // |callback| or |error_callback| will be run. | 320 // |callback| or |error_callback| will be run. |
314 virtual void ClearOutOfBandPairingData( | 321 virtual void ClearOutOfBandPairingData( |
(...skipping 11 matching lines...) Expand all Loading... |
326 | 333 |
327 private: | 334 private: |
328 // Returns a localized string containing the device's bluetooth address and | 335 // Returns a localized string containing the device's bluetooth address and |
329 // a device type for display when |name_| is empty. | 336 // a device type for display when |name_| is empty. |
330 string16 GetAddressWithLocalizedDeviceTypeName() const; | 337 string16 GetAddressWithLocalizedDeviceTypeName() const; |
331 }; | 338 }; |
332 | 339 |
333 } // namespace device | 340 } // namespace device |
334 | 341 |
335 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ | 342 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ |
OLD | NEW |