Index: device/bluetooth/bluetooth_profile_mac.h |
diff --git a/device/bluetooth/bluetooth_profile_mac.h b/device/bluetooth/bluetooth_profile_mac.h |
index 16c50e87c3928330fa4b4ae5b0b7fbb1cf3d3d8f..4fef25628dbaa5a78fdb33937f0da1ed8263c92c 100644 |
--- a/device/bluetooth/bluetooth_profile_mac.h |
+++ b/device/bluetooth/bluetooth_profile_mac.h |
@@ -5,20 +5,21 @@ |
#ifndef DEVICE_BLUETOOTH_BLUETOOTH_PROFILE_MAC_H_ |
#define DEVICE_BLUETOOTH_BLUETOOTH_PROFILE_MAC_H_ |
+#import <IOBluetooth/IOBluetooth.h> |
+ |
#include <string> |
#include "base/basictypes.h" |
#include "base/callback.h" |
+#include "base/mac/scoped_nsobject.h" |
#include "base/sequenced_task_runner.h" |
#include "device/bluetooth/bluetooth_profile.h" |
#include "device/bluetooth/bluetooth_socket.h" |
#include "device/bluetooth/bluetooth_uuid.h" |
-#ifdef __OBJC__ |
+@class BluetoothProfileMacHelper; |
@class IOBluetoothDevice; |
-#else |
-class IOBluetoothDevice; |
-#endif |
+@class IOBluetoothRFCOMMChannel; |
namespace device { |
@@ -29,22 +30,35 @@ class BluetoothProfileMac : public BluetoothProfile { |
virtual void SetConnectionCallback( |
const ConnectionCallback& callback) OVERRIDE; |
- // Makes an outgoing connection to |device|, calling |callback| on succes or |
- // |error_callback| on error. If successful, this method also calls |
- // |connection_callback_| before calling |callback|. |
+ // Makes an outgoing connection to |device|, calling |success_callback| on |
+ // success or |error_callback| on error. If successful, this method also calls |
+ // |connection_callback_| before calling |success_callback|. |
void Connect(IOBluetoothDevice* device, |
const base::Closure& success_callback, |
const BluetoothSocket::ErrorCompletionCallback& error_callback); |
+ // Callback that is invoked when the OS detects a new incoming RFCOMM channel |
+ // connection. |rfcomm_channel| is the newly opened channel. |
+ void OnRFCOMMChannelOpened(IOBluetoothRFCOMMChannel* rfcomm_channel); |
+ |
private: |
- friend BluetoothProfile; |
+ friend BluetoothProfile* CreateBluetoothProfileMac(const BluetoothUUID& uuid, |
+ const Options& options); |
- BluetoothProfileMac(const BluetoothUUID& uuid, const std::string& name); |
+ BluetoothProfileMac(const BluetoothUUID& uuid, const Options& options); |
virtual ~BluetoothProfileMac(); |
const BluetoothUUID uuid_; |
- const std::string name_; |
+ const uint16 rfcomm_channel_id_; |
ConnectionCallback connection_callback_; |
+ |
+ // A simple helper that registers for OS notifications and forwards them to |
+ // |this| profile. |
+ base::scoped_nsobject<BluetoothProfileMacHelper> helper_; |
+ |
+ // A handle to the service record registered in the system SDP server. |
+ // Used to eventually unregister the service. |
+ const BluetoothSDPServiceRecordHandle service_record_handle_; |
}; |
} // namespace device |