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

Unified Diff: device/bluetooth/bluetooth_socket_mac.h

Issue 243963002: Implement Bluetooth server socket support for RFCOMM on Mac. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Short url Created 6 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
« no previous file with comments | « device/bluetooth/bluetooth_profile_mac.mm ('k') | device/bluetooth/bluetooth_socket_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/bluetooth_socket_mac.h
diff --git a/device/bluetooth/bluetooth_socket_mac.h b/device/bluetooth/bluetooth_socket_mac.h
index 40e0fb85c3c5df7a481d68eb1c3f8b41015b8c8c..6c46bb0b34b57c7cc4fe13b79bdab1aa67029554 100644
--- a/device/bluetooth/bluetooth_socket_mac.h
+++ b/device/bluetooth/bluetooth_socket_mac.h
@@ -32,14 +32,23 @@ class BluetoothServiceRecord;
// Implements the BluetoothSocket class for the Mac OS X platform.
class BluetoothSocketMac : public BluetoothSocket {
public:
- static scoped_refptr<BluetoothSocketMac> CreateBluetoothSocket(
- IOBluetoothSDPServiceRecord* record);
-
- // Connects to the peer device and calls |success_callback| when the
- // connection has been established successfully. If an error occurs, calls
- // |error_callback| with a system error message.
- void Connect(const base::Closure& success_callback,
- const ErrorCompletionCallback& error_callback);
+ typedef base::Callback<void(scoped_refptr<BluetoothSocket>)>
+ ConnectSuccessCallback;
+
+ // Creates a client socket and connects it to the Bluetooth service |record|.
+ // Calls |success_callback|, passing in the created socket, on success.
+ // Calls |error_callback| on failure.
+ static void Connect(IOBluetoothSDPServiceRecord* record,
+ const ConnectSuccessCallback& success_callback,
+ const ErrorCompletionCallback& error_callback);
+
+ // Creates a server socket to wrap the |rfcomm_channel|, which should be an
+ // incoming channel in the process of being opened.
+ // Calls |success_callback|, passing in the created socket, on success.
+ // Calls |error_callback| on failure.
+ static void AcceptConnection(IOBluetoothRFCOMMChannel* rfcomm_channel,
+ const ConnectSuccessCallback& success_callback,
+ const ErrorCompletionCallback& error_callback);
// BluetoothSocket:
virtual void Close() OVERRIDE;
@@ -64,12 +73,7 @@ class BluetoothSocketMac : public BluetoothSocket {
void* refcon,
IOReturn status);
- protected:
- virtual ~BluetoothSocketMac();
-
private:
- BluetoothSocketMac(IOBluetoothSDPServiceRecord* record);
-
struct SendRequest {
SendRequest();
~SendRequest();
@@ -95,16 +99,32 @@ class BluetoothSocketMac : public BluetoothSocket {
ErrorCompletionCallback error_callback;
};
+ BluetoothSocketMac();
+ virtual ~BluetoothSocketMac();
+
void ReleaseChannel();
+ // Connects to the peer device corresponding to |record| and calls
+ // |success_callback| when the connection has been established
+ // successfully. If an error occurs, calls |error_callback| with a system
+ // error message.
+ void ConnectImpl(IOBluetoothSDPServiceRecord* record,
+ const ConnectSuccessCallback& success_callback,
+ const ErrorCompletionCallback& error_callback);
+
+ // Accepts a connection from a peer device. The connection is represented as
+ // the |rfcomm_channel|, which should be an incoming channel in the process of
+ // being opened. Calls |success_callback|, passing in |this|, on success.
+ // Calls |error_callback| on failure.
+ void AcceptConnectionImpl(IOBluetoothRFCOMMChannel* rfcomm_channel,
+ const ConnectSuccessCallback& success_callback,
+ const ErrorCompletionCallback& error_callback);
+
bool connecting() const { return connect_callbacks_; }
// Used to verify that all methods are called on the same thread.
base::ThreadChecker thread_checker_;
- // The Bluetooth Service definition.
- base::scoped_nsobject<IOBluetoothSDPServiceRecord> record_;
-
// The RFCOMM channel delegate.
base::scoped_nsobject<BluetoothRFCOMMChannelDelegate> delegate_;
« no previous file with comments | « device/bluetooth/bluetooth_profile_mac.mm ('k') | device/bluetooth/bluetooth_socket_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698