From a7266d39019b886dfb70176fa2c20ac8437439d8 Mon Sep 17 00:00:00 2001 From: Jaikumar Ganesh Date: Thu, 26 May 2011 13:56:40 -0700 Subject: Refactor Bluetooth Profile. Move connect / disconnect / set and get priority functions down the interface as they are not generic enough for all profiles. Change-Id: I2656e1bdbc8046c53bb0dfbd9172f5f10b57aa7d --- framework/java/android/bluetooth/BluetoothPan.java | 61 ++++++++++++++-------- 1 file changed, 38 insertions(+), 23 deletions(-) (limited to 'framework/java/android/bluetooth/BluetoothPan.java') diff --git a/framework/java/android/bluetooth/BluetoothPan.java b/framework/java/android/bluetooth/BluetoothPan.java index 9ffed26f4a..7490f9ee86 100644 --- a/framework/java/android/bluetooth/BluetoothPan.java +++ b/framework/java/android/bluetooth/BluetoothPan.java @@ -140,7 +140,21 @@ public final class BluetoothPan implements BluetoothProfile { } /** - * {@inheritDoc} + * Initiate connection to a profile of the remote bluetooth device. + * + *

This API returns false in scenarios like the profile on the + * device is already connected or Bluetooth is not turned on. + * When this API returns true, it is guaranteed that + * connection state intent for the profile will be broadcasted with + * the state. Users can get the connection state of the profile + * from this intent. + * + *

Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN} + * permission. + * + * @param device Remote Bluetooth Device + * @return false on immediate error, + * true otherwise * @hide */ public boolean connect(BluetoothDevice device) { @@ -159,7 +173,29 @@ public final class BluetoothPan implements BluetoothProfile { } /** - * {@inheritDoc} + * Initiate disconnection from a profile + * + *

This API will return false in scenarios like the profile on the + * Bluetooth device is not in connected state etc. When this API returns, + * true, it is guaranteed that the connection state change + * intent will be broadcasted with the state. Users can get the + * disconnection state of the profile from this intent. + * + *

If the disconnection is initiated by a remote device, the state + * will transition from {@link #STATE_CONNECTED} to + * {@link #STATE_DISCONNECTED}. If the disconnect is initiated by the + * host (local) device the state will transition from + * {@link #STATE_CONNECTED} to state {@link #STATE_DISCONNECTING} to + * state {@link #STATE_DISCONNECTED}. The transition to + * {@link #STATE_DISCONNECTING} can be used to distinguish between the + * two scenarios. + * + *

Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN} + * permission. + * + * @param device Remote Bluetooth Device + * @return false on immediate error, + * true otherwise * @hide */ public boolean disconnect(BluetoothDevice device) { @@ -229,27 +265,6 @@ public final class BluetoothPan implements BluetoothProfile { return BluetoothProfile.STATE_DISCONNECTED; } - /** - * {@inheritDoc} - * @hide - */ - public boolean setPriority(BluetoothDevice device, int priority) { - // Priorities are not supported for PAN devices - since we don't - // auto connect. - return false; - } - - /** - * {@inheritDoc} - * @hide - */ - public int getPriority(BluetoothDevice device) { - if (DBG) log("getPriority(" + device + ")"); - // Priorities are not supported for PAN devices - since we don't - // auto connect. - return BluetoothProfile.PRIORITY_ON; - } - public void setBluetoothTethering(boolean value) { if (DBG) log("setBluetoothTethering(" + value + ")"); try { -- cgit v1.2.3