aboutsummaryrefslogtreecommitdiff
path: root/framework/java/android/bluetooth/BluetoothDevice.java
diff options
context:
space:
mode:
authorNick Pelly <npelly@google.com>2009-09-08 17:40:43 -0700
committerNick Pelly <npelly@google.com>2009-09-09 10:52:18 -0700
commit8a1cd0cdce892a6bd25bc7292007fe0220b3ae10 (patch)
treef97f1762f160fe595ae28af9079e7d92cd7ef31f /framework/java/android/bluetooth/BluetoothDevice.java
parent7482a80ce3d46f9991302cc464bc6a9e5a317451 (diff)
API_CHANGE
Deprecate BluetoothError.java. I spent a lot of time experimenting with a class BluetoothError to enumerate the many error codes returned by the Bluetooth API. But at the end of the day they were never used. The vast majority of method calls only really need a true/false error value, and often not even that. Methods which do need more detailed error enumeration (for example, bonding failures) can have there own enumerated error codes. But there is no need for a common set of error codes. Also change the IPC failed warnings in BluetoothA2dp to Log.e. These indicate a very serious error. Introduce BluetoothAdapter.ERROR and BluetoothDevice.ERROR as helper sentinel values.
Diffstat (limited to 'framework/java/android/bluetooth/BluetoothDevice.java')
-rw-r--r--framework/java/android/bluetooth/BluetoothDevice.java21
1 files changed, 16 insertions, 5 deletions
diff --git a/framework/java/android/bluetooth/BluetoothDevice.java b/framework/java/android/bluetooth/BluetoothDevice.java
index 7086557a57..1ab4389b43 100644
--- a/framework/java/android/bluetooth/BluetoothDevice.java
+++ b/framework/java/android/bluetooth/BluetoothDevice.java
@@ -44,6 +44,15 @@ import java.io.UnsupportedEncodingException;
public final class BluetoothDevice implements Parcelable {
private static final String TAG = "BluetoothDevice";
+ /**
+ * Sentinel error value for this class. Guaranteed to not equal any other
+ * integer constant in this class. Provided as a convenience for functions
+ * that require a sentinel error value, for example:
+ * <p><code>Intent.getIntExtra(BluetoothAdapter.EXTRA_STATE,
+ * BluetoothAdapter.ERROR)</code>
+ */
+ public static final int ERROR = -1;
+
/** We do not have a link key for the remote device, and are therefore not
* bonded
* @hide*/
@@ -65,7 +74,9 @@ public final class BluetoothDevice implements Parcelable {
* @hide */
public static final int DEVICE_PICKER_FILTER_TYPE_TRANSFER = 2;
- //TODO: Unify these result codes in BluetoothResult or BluetoothError
+ /** A bond attempt succeeded
+ * @hide */
+ public static final int BOND_SUCCESS = 0;
/** A bond attempt failed because pins did not match, or remote device did
* not respond to pin request in time
* @hide */
@@ -252,8 +263,8 @@ public final class BluetoothDevice implements Parcelable {
* Get the bonding state of a remote device.
*
* Result is one of:
- * BluetoothError.*
* BOND_*
+ * ERROR
*
* @param address Bluetooth hardware address of the remote device to check.
* @return Result code
@@ -263,7 +274,7 @@ public final class BluetoothDevice implements Parcelable {
try {
return sService.getBondState(mAddress);
} catch (RemoteException e) {Log.e(TAG, "", e);}
- return BluetoothError.ERROR_IPC;
+ return BluetoothDevice.ERROR;
}
/**
@@ -298,7 +309,7 @@ public final class BluetoothDevice implements Parcelable {
try {
return sService.getRemoteClass(mAddress);
} catch (RemoteException e) {Log.e(TAG, "", e);}
- return BluetoothError.ERROR_IPC;
+ return BluetoothDevice.ERROR;
}
/** @hide */
@@ -314,7 +325,7 @@ public final class BluetoothDevice implements Parcelable {
try {
return sService.getRemoteServiceChannel(mAddress, uuid);
} catch (RemoteException e) {Log.e(TAG, "", e);}
- return BluetoothError.ERROR_IPC;
+ return BluetoothDevice.ERROR;
}
/** @hide */