summaryrefslogtreecommitdiffstats
path: root/chromeos/dbus/bluetooth_adapter_client.h
diff options
context:
space:
mode:
authorkeybuk@google.com <keybuk@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-04 18:39:44 +0000
committerkeybuk@google.com <keybuk@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-04 18:39:44 +0000
commit95e9859ccccc4a131d1d68767fa6cd6d9a18658a (patch)
tree3a75d9acf6a9122d2a40a5383c9d73dbfc26da81 /chromeos/dbus/bluetooth_adapter_client.h
parent9c02fa0e4d7a8126f4901c8d28b0d2468a3e2fa5 (diff)
downloadchromium_src-95e9859ccccc4a131d1d68767fa6cd6d9a18658a.zip
chromium_src-95e9859ccccc4a131d1d68767fa6cd6d9a18658a.tar.gz
chromium_src-95e9859ccccc4a131d1d68767fa6cd6d9a18658a.tar.bz2
bluetooth: obtain D-Bus error for select methods
For the CreateDevice, CreatePairedDevice and Connect methods use CallMethodWithErrorCallback rather than CallMethod so that we obtain richer error information from the BlueZ service. BUG=chromium-os:27902 TEST=make chrome Change-Id: If801d834604e4c2142c20169603bc527bde09403 Review URL: https://chromiumcodereview.appspot.com/10409062 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@140334 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos/dbus/bluetooth_adapter_client.h')
-rw-r--r--chromeos/dbus/bluetooth_adapter_client.h38
1 files changed, 30 insertions, 8 deletions
diff --git a/chromeos/dbus/bluetooth_adapter_client.h b/chromeos/dbus/bluetooth_adapter_client.h
index 6e59429..52c8692 100644
--- a/chromeos/dbus/bluetooth_adapter_client.h
+++ b/chromeos/dbus/bluetooth_adapter_client.h
@@ -171,14 +171,30 @@ class CHROMEOS_EXPORT BluetoothAdapterClient {
const std::string& address,
const DeviceCallback& callback) = 0;
+ // The CreateDeviceCallback is used for the CreateDevice and
+ // CreatePairedDevice adapter methods that return a dbus object path for
+ // a remote device on success. It receives a single argument, the
+ // |object_path| of the device returned by the method.
+ typedef base::Callback<void(const dbus::ObjectPath&)> CreateDeviceCallback;
+
+ // The CreateDeviceErrorCallback is used for the CreateDevice and
+ // CreatePairedDevices adapter methods to indicate failure. It receives
+ // two arguments, the name of the error in |error_name| and an optional
+ // message in |error_message|.
+ typedef base::Callback<void(const std::string& error_name,
+ const std::string& error_message)>
+ CreateDeviceErrorCallback;
+
// Creates a new dbus object from the adapter with object path |object_path|
// to the remote device with address |address|, connecting to it and
// retrieving all SDP records. After a successful call, the device is known
// and appear's in the adapter's |devices| interface. This is a low-security
// connection which may not be accepted by the device.
- virtual void CreateDevice(const dbus::ObjectPath& object_path,
- const std::string& address,
- const DeviceCallback& callback) = 0;
+ virtual void CreateDevice(
+ const dbus::ObjectPath& object_path,
+ const std::string& address,
+ const CreateDeviceCallback& callback,
+ const CreateDeviceErrorCallback& error_callback) = 0;
// Creates a new dbus object from the adapter with object path |object_path|
// to the remote device with address |address|, connecting to it, retrieving
@@ -189,11 +205,13 @@ class CHROMEOS_EXPORT BluetoothAdapterClient {
// must be specified to negotiate the pairing, |capability| specifies the
// input and display capabilities of that agent and should be one of the
// constants declared in the bluetooth_agent:: namespace.
- virtual void CreatePairedDevice(const dbus::ObjectPath& object_path,
- const std::string& address,
- const dbus::ObjectPath& agent_path,
- const std::string& capability,
- const DeviceCallback& callback) = 0;
+ virtual void CreatePairedDevice(
+ const dbus::ObjectPath& object_path,
+ const std::string& address,
+ const dbus::ObjectPath& agent_path,
+ const std::string& capability,
+ const CreateDeviceCallback& callback,
+ const CreateDeviceErrorCallback& error_callback) = 0;
// Cancels the currently in progress call to CreateDevice() or
// CreatePairedDevice() on the adapter with object path |object_path|
@@ -232,6 +250,10 @@ class CHROMEOS_EXPORT BluetoothAdapterClient {
dbus::Bus* bus,
BluetoothManagerClient* manager_client);
+ // Constants used to indicate exceptional error conditions.
+ static const char kNoResponseError[];
+ static const char kBadResponseError[];
+
protected:
BluetoothAdapterClient();