summaryrefslogtreecommitdiffstats
path: root/core/java/android/bluetooth
diff options
context:
space:
mode:
authorJaikumar Ganesh <jaikumar@google.com>2009-09-18 11:32:54 -0700
committerJaikumar Ganesh <jaikumar@google.com>2009-09-19 11:29:24 -0700
commit1caa6d111eff6814760ec156b14adc29aa3aae6c (patch)
tree387141a3a427623b218b43318640185c885339f8 /core/java/android/bluetooth
parent074c11c1649a097ba1beae719069f8d4a2dd43e3 (diff)
downloadframeworks_base-1caa6d111eff6814760ec156b14adc29aa3aae6c.zip
frameworks_base-1caa6d111eff6814760ec156b14adc29aa3aae6c.tar.gz
frameworks_base-1caa6d111eff6814760ec156b14adc29aa3aae6c.tar.bz2
Add new API for fetching UUIDs using SDP.
Add new API which clients can use to force an SDP query. The result is broadcast using an intent having the UUIDs. The intent is broadcast after a timeout, in case of an error. This timeout is greater than the page timeout. Change-Id: I61e6db4c05b34c42f679a66987e37e2063a793b6
Diffstat (limited to 'core/java/android/bluetooth')
-rw-r--r--core/java/android/bluetooth/BluetoothDevice.java45
-rw-r--r--core/java/android/bluetooth/IBluetooth.aidl1
2 files changed, 46 insertions, 0 deletions
diff --git a/core/java/android/bluetooth/BluetoothDevice.java b/core/java/android/bluetooth/BluetoothDevice.java
index f81ba73..b52a822 100644
--- a/core/java/android/bluetooth/BluetoothDevice.java
+++ b/core/java/android/bluetooth/BluetoothDevice.java
@@ -28,6 +28,7 @@ import android.util.Log;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
+import java.util.UUID;
/**
* Represents a remote Bluetooth device.
@@ -226,6 +227,20 @@ public final class BluetoothDevice implements Parcelable {
public static final String EXTRA_PASSKEY = "android.bluetooth.device.extra.PASSKEY";
/**
+ * Broadcast Action: This intent is used to broadcast the {@link UUID}
+ * wrapped as a {@link ParcelUuid} of the remote device after it has been
+ * fetched. This intent is sent only when the UUIDs of the remote device
+ * are requested to be fetched using Service Discovery Protocol
+ * <p> Always contains the extra field {@link #EXTRA_DEVICE}
+ * <p> Always contains the extra filed {@link #EXTRA_UUID}
+ * <p>Requires {@link android.Manifest.permission#BLUETOOTH} to receive.
+ * @hide
+ */
+ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
+ public static final String ACTION_UUID =
+ "android.bleutooth.device.action.UUID";
+
+ /**
* Broadcast Action: Indicates a failure to retrieve the name of a remote
* device.
* <p>Always contains the extra field {@link #EXTRA_DEVICE}.
@@ -292,6 +307,15 @@ public final class BluetoothDevice implements Parcelable {
* @hide */
public static final int PAIRING_VARIANT_DISPLAY_PASSKEY = 4;
+ /**
+ * Used as an extra field in {@link #ACTION_UUID} intents,
+ * Contains the {@link ParcelUuid}s of the remote device which is a parcelable
+ * version of {@link UUID}.
+ * @hide
+ */
+ public static final String EXTRA_UUID = "android.bluetooth.device.extra.UUID";
+
+
private static IBluetooth sService; /* Guarenteed constant after first object constructed */
private final String mAddress;
@@ -507,6 +531,27 @@ public final class BluetoothDevice implements Parcelable {
return null;
}
+ /**
+ * Perform a SDP query on the remote device to get the UUIDs
+ * supported. This API is asynchronous and an Intent is sent,
+ * with the UUIDs supported by the remote end. If there is an error
+ * in getting the SDP records or if the process takes a long time,
+ * an Intent is sent with the UUIDs that is currently present in the
+ * cache. Clients should use the {@link getUuids} to get UUIDs
+ * is SDP is not to be performed.
+ *
+ * @return False if the sanity check fails, True if the process
+ * of initiating an ACL connection to the remote device
+ * was started.
+ * @hide
+ */
+ public boolean fetchUuidsWithSdp() {
+ try {
+ return sService.fetchRemoteUuidsWithSdp(mAddress);
+ } catch (RemoteException e) {Log.e(TAG, "", e);}
+ return false;
+ }
+
/** @hide */
public int getServiceChannel(ParcelUuid uuid) {
try {
diff --git a/core/java/android/bluetooth/IBluetooth.aidl b/core/java/android/bluetooth/IBluetooth.aidl
index 04c8ec9..203a61d 100644
--- a/core/java/android/bluetooth/IBluetooth.aidl
+++ b/core/java/android/bluetooth/IBluetooth.aidl
@@ -53,6 +53,7 @@ interface IBluetooth
String getRemoteName(in String address);
int getRemoteClass(in String address);
ParcelUuid[] getRemoteUuids(in String address);
+ boolean fetchRemoteUuidsWithSdp(in String address);
int getRemoteServiceChannel(in String address,in ParcelUuid uuid);
boolean setPin(in String address, in byte[] pin);