bluetooth_device: Add methods for pairing and connection

Now that bluetooth_device_xmlrpc_server provides the methods to pair
legacy device and to connect/disconnect device, add those methods to
bluetooth_device layer so autotest server can use those methods to
control bluetooth adapter on Cros device.

BUG=chromium:476860
TEST=not used yet

Change-Id: I82347a17fc19a3c93010e25b9d505f3f94db4b43
Reviewed-on: https://chromium-review.googlesource.com/273148
Reviewed-by: Kalin Stoyanov <kalin@chromium.org>
Commit-Queue: Cheng-Yi Chiang <cychiang@chromium.org>
Tested-by: Cheng-Yi Chiang <cychiang@chromium.org>
diff --git a/server/cros/bluetooth/bluetooth_device.py b/server/cros/bluetooth/bluetooth_device.py
index b7d319b..e322714 100644
--- a/server/cros/bluetooth/bluetooth_device.py
+++ b/server/cros/bluetooth/bluetooth_device.py
@@ -233,6 +233,48 @@
         return self._proxy.register_profile(path, uuid, options)
 
 
+    def pair_legacy_device(self, address, pin, timeout):
+        """Pairs a device with a given pin code.
+
+        Registers an agent who handles pin code request and
+        pairs a device with known pin code.
+
+        @param address: Address of the device to pair.
+        @param pin: The pin code of the device to pair.
+        @param timeout: The timeout in seconds for pairing.
+
+        @returns: True on success. False otherwise.
+
+        """
+        return self._proxy.pair_legacy_device(address, pin, timeout)
+
+
+    def connect_device(self, address):
+        """Connects a device.
+
+        Connects a device if it is not connected.
+
+        @param address: Address of the device to connect.
+
+        @returns: True on success. False otherwise.
+
+        """
+        return self._proxy.connect_device(address)
+
+
+    def disconnect_device(self, address):
+        """Disconnects a device.
+
+        Disconnects a device if it is connected.
+
+        @param address: Address of the device to disconnect.
+
+        @returns: True on success. False otherwise.
+
+        """
+        return self._proxy.disconnect_device(address)
+
+
     def close(self):
         """Tear down state associated with the client."""
         # Turn off the discoverable flag since it may affect future tests.