Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1055)

Unified Diff: chrome/browser/chromeos/bluetooth/bluetooth_device.h

Issue 10007008: Add support for creating bluetooth RFCOMM sockets. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: adding disconnect Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 97203faca158d01704a3b72f258dcf7c18f75ac9..1ff58838548a961f4a9f77e2d2e52ecb55ed012d 100644
--- a/chrome/browser/chromeos/bluetooth/bluetooth_device.h
+++ b/chrome/browser/chromeos/bluetooth/bluetooth_device.h
@@ -6,12 +6,14 @@
#define CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_DEVICE_H_
#pragma once
+#include <map>
#include <string>
#include <vector>
#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 "chrome/browser/chromeos/dbus/bluetooth_agent_service_provider.h"
#include "chrome/browser/chromeos/dbus/bluetooth_device_client.h"
@@ -20,6 +22,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
@@ -238,6 +241,12 @@ class BluetoothDevice : private BluetoothDeviceClient::Observer,
// have been deleted. If the request fails, |error_callback| will be called.
void Forget(ErrorCallback error_callback);
+ // Opens a socket to this device for the given service.
+ base::WeakPtr<BluetoothSocket> OpenSocket(const std::string &service_uuid);
keybuk 2012/04/16 22:25:36 nit "& " not " &" Should this be a weak ptr or a
+
+ // Close the socket with the given id.
+ void CloseSocket(int socket_id);
keybuk 2012/04/16 22:25:36 If BluetoothSocket were refcounted, we could encap
+
private:
friend class BluetoothAdapter;
@@ -433,6 +442,9 @@ class BluetoothDevice : private BluetoothDeviceClient::Observer,
BluetoothAdapter* adapter,
const BluetoothDeviceClient::Properties* properties);
+ // Close all open sockets from this device.
+ void CloseAllSockets();
+
// Weak pointer factory for generating 'this' pointers that might live longer
// than we do.
base::WeakPtrFactory<BluetoothDevice> weak_ptr_factory_;
@@ -478,6 +490,9 @@ class BluetoothDevice : private BluetoothDeviceClient::Observer,
PasskeyCallback passkey_callback_;
ConfirmationCallback confirmation_callback_;
+ typedef std::map<int, BluetoothSocket*> SocketMap;
+ SocketMap socket_map_;
keybuk 2012/04/16 22:25:36 What's the int here? the fd?
+
DISALLOW_COPY_AND_ASSIGN(BluetoothDevice);
};

Powered by Google App Engine
This is Rietveld 408576698