Index: chromeos/dbus/experimental_bluetooth_agent_service_provider.h |
diff --git a/chromeos/dbus/bluetooth_agent_service_provider.h b/chromeos/dbus/experimental_bluetooth_agent_service_provider.h |
similarity index 75% |
copy from chromeos/dbus/bluetooth_agent_service_provider.h |
copy to chromeos/dbus/experimental_bluetooth_agent_service_provider.h |
index fbf4dacccf69a69cc9594dc18456c299e2426aab..414c8dbc35b76b8ee9c28ba8b71e32ea7e9a6c16 100644 |
--- a/chromeos/dbus/bluetooth_agent_service_provider.h |
+++ b/chromeos/dbus/experimental_bluetooth_agent_service_provider.h |
@@ -1,9 +1,9 @@ |
-// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef CHROMEOS_DBUS_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_ |
-#define CHROMEOS_DBUS_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_ |
+#ifndef CHROMEOS_DBUS_EXPERIMENTAL_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_ |
+#define CHROMEOS_DBUS_EXPERIMENTAL_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_ |
#include <string> |
@@ -15,16 +15,19 @@ |
namespace chromeos { |
-// BluetoothAgentServiceProvider is used to provide a D-Bus object that BlueZ |
-// can communicate with during a remote device pairing request. |
+// ExperimentalBluetoothAgentServiceProvider is used to provide a D-Bus object |
+// that BlueZ can communicate with during a remote device pairing request. |
// |
// Instantiate with a chosen D-Bus object path and delegate object, and pass |
// the D-Bus object path as the |agent_path| argument to the |
-// chromeos::BluetoothAdapterClient::CreatePairedDevice() method. Calls made |
-// to the agent by the Bluetooth daemon will be passed on to your Delegate |
-// object for handling, and responses returned using the callbacks supplied |
-// to those methods. |
-class CHROMEOS_EXPORT BluetoothAgentServiceProvider { |
+// chromeos::ExperimentalBluetoothAgentManagerClient::RegisterAgent() method. |
+// |
+// After initiating the pairing process with a device, using the |
+// chromeos::ExperimentalBluetoothDeviceClient::Pair() method, the Bluetooth |
+// daemon will make calls to this agent object and they will be passed on to |
+// your Delegate object for handling. Responses should be returned using the |
+// callbacks supplied to those methods. |
+class CHROMEOS_EXPORT ExperimentalBluetoothAgentServiceProvider { |
public: |
// Interface for reacting to agent requests. |
class Delegate { |
@@ -42,17 +45,6 @@ class CHROMEOS_EXPORT BluetoothAgentServiceProvider { |
CANCELLED |
}; |
- // Possible values for the |mode| parameter of the ConfirmModeChange() |
- // method. Off indicates that the adapter is to be turned off, connectable |
- // indicates that the adapter is to be turned on and accept incoming |
- // connections, and discoverable indicates the adapter is to be turned |
- // on and discoverable by remote devices. |
- enum Mode { |
- OFF, |
- CONNECTABLE, |
- DISCOVERABLE |
- }; |
- |
// The PinCodeCallback is used for the RequestPinCode() method, it should |
// be called with two arguments, the |status| of the request (success, |
// rejected or cancelled) and the |pincode| requested. |
@@ -84,18 +76,6 @@ class CHROMEOS_EXPORT BluetoothAgentServiceProvider { |
virtual void RequestPinCode(const dbus::ObjectPath& device_path, |
const PinCodeCallback& callback) = 0; |
- // This method will be called when the Bluetooth daemon requires a |
- // Passkey for authentication of the device with object path |device_path|, |
- // the agent should obtain the passkey from the user (a numeric in the |
- // range 0-999999) and call |callback| to provide it, or indicate |
- // rejection or cancellation of the request. |
- // |
- // Passkeys are generally required for Bluetooth 2.1 and later devices |
- // which cannot provide input or display on their own, and don't accept |
- // passkey-less pairing. |
- virtual void RequestPasskey(const dbus::ObjectPath& device_path, |
- const PasskeyCallback& callback) = 0; |
- |
// This method will be called when the Bluetooth daemon requires that the |
// user enter the PIN code |pincode| into the device with object path |
// |device_path| so that it may be authenticated. The Cancel() method |
@@ -108,6 +88,18 @@ class CHROMEOS_EXPORT BluetoothAgentServiceProvider { |
virtual void DisplayPinCode(const dbus::ObjectPath& device_path, |
const std::string& pincode) = 0; |
+ // This method will be called when the Bluetooth daemon requires a |
+ // Passkey for authentication of the device with object path |device_path|, |
+ // the agent should obtain the passkey from the user (a numeric in the |
+ // range 0-999999) and call |callback| to provide it, or indicate |
+ // rejection or cancellation of the request. |
+ // |
+ // Passkeys are generally required for Bluetooth 2.1 and later devices |
+ // which cannot provide input or display on their own, and don't accept |
+ // passkey-less pairing. |
+ virtual void RequestPasskey(const dbus::ObjectPath& device_path, |
+ const PasskeyCallback& callback) = 0; |
+ |
// This method will be called when the Bluetooth daemon requires that the |
// user enter the Passkey |passkey| into the device with object path |
// |device_path| so that it may be authenticated. The Cancel() method |
@@ -118,8 +110,11 @@ class CHROMEOS_EXPORT BluetoothAgentServiceProvider { |
// but not display, such as keyboards. The Passkey is a numeric in the |
// range 0-999999 and should be always presented zero-padded to six |
// digits. |
+ // |
+ // As the user enters the passkey onto the device, |entered| will be |
+ // updated to reflect the number of digits entered so far. |
virtual void DisplayPasskey(const dbus::ObjectPath& device_path, |
- uint32 passkey) = 0; |
+ uint32 passkey, int16 entered) = 0; |
// This method will be called when the Bluetooth daemon requires that the |
// user confirm that the Passkey |passkey| is displayed on the screen |
@@ -136,43 +131,46 @@ class CHROMEOS_EXPORT BluetoothAgentServiceProvider { |
uint32 passkey, |
const ConfirmationCallback& callback) = 0; |
+ // This method will be called when the Bluetooth daemon requires |
+ // authorization of an incoming pairing attempt from the device with object |
+ // path |device_path| that would have otherwised triggered the just-works |
+ // pairing model. |
+ // |
+ // The agent should confirm the incoming pairing with the user and call |
+ // |callback| to provide their response (success, rejected or cancelled). |
+ virtual void RequestAuthorization(const dbus::ObjectPath& device_path, |
+ const ConfirmationCallback& callback) = 0; |
+ |
// This method will be called when the Bluetooth daemon requires that the |
// user confirm that the device with object path |object_path| is |
// authorized to connect to the service with UUID |uuid|. The agent should |
// confirm with the user and call |callback| to provide their response |
// (success, rejected or cancelled). |
- virtual void Authorize(const dbus::ObjectPath& device_path, |
- const std::string& uuid, |
- const ConfirmationCallback& callback) = 0; |
- |
- // This method will be called when the Bluetooth daemon requires that the |
- // user confirm that the device adapter may switch to mode |mode|. The |
- // agent should confirm with the user and call |callback| to provide |
- // their response (success, rejected or cancelled). |
- virtual void ConfirmModeChange(Mode mode, |
- const ConfirmationCallback& callback) = 0; |
+ virtual void AuthorizeService(const dbus::ObjectPath& device_path, |
+ const std::string& uuid, |
+ const ConfirmationCallback& callback) = 0; |
// This method will be called by the Bluetooth daemon to indicate that |
// the request failed before a reply was returned from the device. |
virtual void Cancel() = 0; |
}; |
- virtual ~BluetoothAgentServiceProvider(); |
+ virtual ~ExperimentalBluetoothAgentServiceProvider(); |
// Creates the instance where |bus| is the D-Bus bus connection to export |
// the object onto, |object_path| is the object path that it should have |
// and |delegate| is the object to which all method calls will be passed |
// and responses generated from. |
- static BluetoothAgentServiceProvider* Create( |
+ static ExperimentalBluetoothAgentServiceProvider* Create( |
dbus::Bus* bus, const dbus::ObjectPath& object_path, Delegate* delegate); |
protected: |
- BluetoothAgentServiceProvider(); |
+ ExperimentalBluetoothAgentServiceProvider(); |
private: |
- DISALLOW_COPY_AND_ASSIGN(BluetoothAgentServiceProvider); |
+ DISALLOW_COPY_AND_ASSIGN(ExperimentalBluetoothAgentServiceProvider); |
}; |
} // namespace chromeos |
-#endif // CHROMEOS_DBUS_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_ |
+#endif // CHROMEOS_DBUS_EXPERIMENTAL_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_ |