Chromium Code Reviews| Index: chrome/browser/chromeos/bluetooth/bluetooth_device.h |
| diff --git a/chrome/browser/chromeos/bluetooth/bluetooth_device.h b/chrome/browser/chromeos/bluetooth/bluetooth_device.h |
| index 85117d2918a1f2ed28f05cdb3a8bc069cc0eec25..ca371b276be821494b58051efed167c950bb5ad4 100644 |
| --- a/chrome/browser/chromeos/bluetooth/bluetooth_device.h |
| +++ b/chrome/browser/chromeos/bluetooth/bluetooth_device.h |
| @@ -12,6 +12,7 @@ |
| #include "base/basictypes.h" |
| #include "base/callback.h" |
| #include "base/memory/scoped_ptr.h" |
| +#include "base/memory/weak_ptr.h" |
| #include "base/string16.h" |
| #include "chromeos/dbus/bluetooth_agent_service_provider.h" |
| #include "chromeos/dbus/bluetooth_device_client.h" |
| @@ -20,6 +21,7 @@ |
| namespace chromeos { |
| class BluetoothAdapter; |
| +class BluetoothSocket; |
| // The BluetoothDevice class represents a remote Bluetooth device, both |
| // its properties and capabilities as discovered by a local adapter and |
| @@ -245,6 +247,13 @@ class BluetoothDevice : private BluetoothDeviceClient::Observer, |
| // have been deleted. If the request fails, |error_callback| will be called. |
| void Forget(ErrorCallback error_callback); |
| + // Attempts to open a socket to a service matching |uuid| on this device. If |
| + // the connection is successful, |callback| is called with a BluetoothSocket. |
| + // Otherwise |callback| is called with NULL. The socket is closed as soon as |
| + // all references to the BluetoothSocket are released. |
| + void ConnectToService(const std::string& service_uuid, |
| + base::Callback<void(scoped_refptr<BluetoothSocket>)> callback); |
|
keybuk
2012/04/19 01:05:40
Comment should explain ownership, that the socket
bryeung
2012/04/19 19:42:43
Done.
|
| + |
| private: |
| friend class BluetoothAdapter; |
| @@ -319,7 +328,22 @@ class BluetoothDevice : private BluetoothDeviceClient::Observer, |
| void SearchServicesForNameCallback( |
| const std::string& name, |
| base::Callback<void(bool)> result_callback, |
| - const dbus::ObjectPath &object_path, |
| + const dbus::ObjectPath& object_path, |
| + const BluetoothDeviceClient::ServiceMap& service_map, |
| + bool success); |
| + |
| + // Opens a socket to this device on the provided |channel|. |
| + scoped_refptr<BluetoothSocket> OpenSocket(const std::string& service_uuid, |
| + uint8_t channel); |
|
keybuk
2012/04/19 01:05:40
this seems RFCOMM specific (channel), L2CAP uses P
bryeung
2012/04/19 19:42:43
Yep: I was going to make it more generic when I ad
|
| + |
| + // Called by BluetoothDeviceClient when a call to DiscoverServices() that was |
| + // initated from ConnectToService completes. The |callback| is called with |
| + // true iff a connection was successfully established. The rest of the |
| + // parameters are as documented for a BluetoothDeviceClient::ServicesCallback. |
| + void ConnectToMatchingService( |
| + const std::string& service_uuid, |
| + base::Callback<void(scoped_refptr<BluetoothSocket>)> callback, |
|
keybuk
2012/04/19 01:05:40
typedef
bryeung
2012/04/19 19:42:43
Done.
|
| + const dbus::ObjectPath& object_path, |
| const BluetoothDeviceClient::ServiceMap& service_map, |
| bool success); |