From 95e9859ccccc4a131d1d68767fa6cd6d9a18658a Mon Sep 17 00:00:00 2001 From: "keybuk@google.com" Date: Mon, 4 Jun 2012 18:39:44 +0000 Subject: 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 --- .../browser/chromeos/bluetooth/bluetooth_device.h | 40 +++++++++++++++------- 1 file changed, 28 insertions(+), 12 deletions(-) (limited to '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 8892bce..cd46b7f 100644 --- a/chrome/browser/chromeos/bluetooth/bluetooth_device.h +++ b/chrome/browser/chromeos/bluetooth/bluetooth_device.h @@ -284,12 +284,19 @@ class BluetoothDevice : private BluetoothDeviceClient::Observer, bool update_state); // Called by BluetoothAdapterClient when a call to CreateDevice() or - // CreatePairedDevice() to provide the new object path for the remote - // device in |device_path| and |success| which indicates whether or not - // the request succeeded. |error_callback| is the callback provided to + // CreatePairedDevice() succeeds, provides the new object path for the remote + // device in |device_path|. |error_callback| is the callback provided to // Connect(). void ConnectCallback(ErrorCallback error_callback, - const dbus::ObjectPath& device_path, bool success); + const dbus::ObjectPath& device_path); + + // Called by BluetoothAdapterClient when a call to CreateDevice() or + // CreatePairedDevice() fails with the error named |error_name| and + // optional message |error_message|, |error_callback| is the callback + // provided to Connect(). + void ConnectErrorCallback(ErrorCallback error_callback, + const std::string& error_name, + const std::string& error_message); // Called by BluetoothProperty when the call to Set() for the Trusted // property completes. |success| indicates whether or not the request @@ -311,14 +318,23 @@ class BluetoothDevice : private BluetoothDeviceClient::Observer, const dbus::ObjectPath& device_path, const std::string& xml_data, bool success); - // Called by BluetoothInputClient when the call to Connect() completes. - // |success| indicates whether or not the request succeed, |error_callback| - // is the callback provided to ConnectApplications(), |interface_name| - // specifies the interface being connect and |device_path| the remote - // object path. - void OnConnect(ErrorCallback error_callback, - const std::string& interface_name, - const dbus::ObjectPath& device_path, bool success); + // Called by BluetoothInputClient when the call to Connect() succeeds. + // |error_callback| is the callback provided to ConnectApplications(), + // |interface_name| specifies the interface being connected and + // |device_path| the remote object path. + void OnConnect(const std::string& interface_name, + const dbus::ObjectPath& device_path); + + // Called by BluetoothInputClient when the call to Connect() fails. + // |error_callback| is the callback provided to ConnectApplications(), + // |interface_name| specifies the interface being connected, + // |device_path| the remote object path, + // |error_name| the error name and |error_message| the optional message. + void OnConnectError(ErrorCallback error_callback, + const std::string& interface_name, + const dbus::ObjectPath& device_path, + const std::string& error_name, + const std::string& error_message); // Called by BluetoothDeviceClient when a call to Disconnect() completes, // |success| indicates whether or not the request succeeded, |error_callback| -- cgit v1.1