Index: device/bluetooth/bluetooth_adapter_chromeos.h |
diff --git a/device/bluetooth/bluetooth_adapter_chromeos.h b/device/bluetooth/bluetooth_adapter_chromeos.h |
index 0bcd6f741fe3e52368fa1ce2f421971f3a3d8057..8df5aa746d8be2e7f28ac5961bd9ffdeabd28589 100644 |
--- a/device/bluetooth/bluetooth_adapter_chromeos.h |
+++ b/device/bluetooth/bluetooth_adapter_chromeos.h |
@@ -5,6 +5,7 @@ |
#ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ |
#define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ |
+#include <map> |
#include <queue> |
#include <string> |
@@ -14,6 +15,8 @@ |
#include "chromeos/dbus/bluetooth_agent_service_provider.h" |
#include "chromeos/dbus/bluetooth_device_client.h" |
#include "chromeos/dbus/bluetooth_input_client.h" |
+#include "chromeos/dbus/bluetooth_profile_manager_client.h" |
+#include "chromeos/dbus/bluetooth_profile_service_provider.h" |
#include "dbus/object_path.h" |
#include "device/bluetooth/bluetooth_adapter.h" |
#include "device/bluetooth/bluetooth_device.h" |
@@ -26,6 +29,7 @@ class BluetoothSocketThread; |
namespace chromeos { |
class BluetoothChromeOSTest; |
+class BluetoothAdapterProfileChromeOS; |
class BluetoothDeviceChromeOS; |
class BluetoothPairingChromeOS; |
class BluetoothRemoteGattCharacteristicChromeOS; |
@@ -41,6 +45,9 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS |
public chromeos::BluetoothInputClient::Observer, |
public chromeos::BluetoothAgentServiceProvider::Delegate { |
public: |
+ typedef base::Callback<void(const std::string& error_message)> |
+ ErrorCompletionCallback; |
+ |
static base::WeakPtr<BluetoothAdapter> CreateAdapter(); |
// BluetoothAdapter: |
@@ -111,6 +118,22 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS |
// Returns the object path of the adapter. |
const dbus::ObjectPath& object_path() const { return object_path_; } |
+ // Uses (creating if necessary) a profile on the adapter for a custom service. |
+ // Returns the associated profile object. When the profile is successfully |
armansito
2015/01/21 01:44:47
I would add a note here that the returned object i
Marie Janssen
2015/01/22 21:55:32
Done.
|
+ // created, |success_callback| will be called. On failure, |error_callback| |
+ // will be |
+ // called. |
armansito
2015/01/21 01:44:47
nit: "// will be called." instead of having "// ca
Marie Janssen
2015/01/22 21:55:32
Done.
|
+ BluetoothAdapterProfileChromeOS* UseProfile( |
armansito
2015/01/21 01:44:47
Well we are returning the profile here but technic
Marie Janssen
2015/01/22 21:55:32
Done.
|
+ const device::BluetoothUUID& uuid, |
+ const dbus::ObjectPath& device_path, |
armansito
2015/01/21 01:44:47
Will local (listening) services also use this func
Marie Janssen
2015/01/22 21:55:32
Yes. Empty string for |device_path| is a listening
|
+ const BluetoothProfileManagerClient::Options* options, |
armansito
2015/01/21 01:44:47
Should |options| be passed by const reference inst
Marie Janssen
2015/01/22 21:55:32
Using a pointer is because of consistency with pre
|
+ BluetoothProfileServiceProvider::Delegate* delegate, |
+ const base::Closure& success_callback, |
+ const ErrorCompletionCallback& error_callback); |
+ |
+ // Releases the profile associated with |uuid| |
+ void ReleaseProfile(const device::BluetoothUUID& uuid); |
+ |
protected: |
// BluetoothAdapter: |
virtual void RemovePairingDelegateInternal( |
@@ -235,6 +258,21 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS |
const std::string& error_name, |
const std::string& error_message); |
+ // Called by dbus:: on completion of the D-Bus method to register a profile. |
+ void OnRegisterProfile(const device::BluetoothUUID& uuid, |
+ const dbus::ObjectPath& device_path, |
+ BluetoothProfileServiceProvider::Delegate* delegate, |
+ const base::Closure& success_callback, |
+ const ErrorCompletionCallback& error_callback); |
+ bool SetProfileDelegate(const device::BluetoothUUID& uuid, |
+ const dbus::ObjectPath& device_path, |
+ BluetoothProfileServiceProvider::Delegate* delegate, |
+ const base::Closure& success_callback, |
+ const ErrorCompletionCallback& error_callback); |
+ void OnRegisterProfileError(const ErrorCompletionCallback& error_callback, |
+ const std::string& error_name, |
+ const std::string& error_message); |
+ |
// Processes the queued discovery requests. For each DiscoveryCallbackPair in |
// the queue, this method will try to add a new discovery session. This method |
// is called whenever a pending D-Bus call to start or stop discovery has |
@@ -272,6 +310,9 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS |
scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; |
scoped_refptr<device::BluetoothSocketThread> socket_thread_; |
+ // The profiles we have registered with the bluetooth daemon. |
+ std::map<device::BluetoothUUID, BluetoothAdapterProfileChromeOS*> profiles_; |
+ |
// Note: This should remain the last member so it'll be destroyed and |
// invalidate its weak pointers before any other members are destroyed. |
base::WeakPtrFactory<BluetoothAdapterChromeOS> weak_ptr_factory_; |