summaryrefslogtreecommitdiffstats
path: root/core/java/android/bluetooth/BluetoothUuid.java
diff options
context:
space:
mode:
authorBill Yi <byi@google.com>2014-04-29 16:07:29 -0700
committerBill Yi <byi@google.com>2014-04-29 16:07:29 -0700
commit293513a59d36cd96a3e474dde5981380d372d8c9 (patch)
tree4268c9994be194a7f4fccdecd089af58516d0953 /core/java/android/bluetooth/BluetoothUuid.java
parent1866e5dc8bb04b58a67e54f66cb4ec22e878667d (diff)
parent0b62467b142b61ee1e449ba958ba37dfd961ef56 (diff)
downloadframeworks_base-293513a59d36cd96a3e474dde5981380d372d8c9.zip
frameworks_base-293513a59d36cd96a3e474dde5981380d372d8c9.tar.gz
frameworks_base-293513a59d36cd96a3e474dde5981380d372d8c9.tar.bz2
Merge commit '0b62467b142b61ee1e449ba958ba37dfd961ef56' into HEAD
Diffstat (limited to 'core/java/android/bluetooth/BluetoothUuid.java')
-rw-r--r--core/java/android/bluetooth/BluetoothUuid.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/core/java/android/bluetooth/BluetoothUuid.java b/core/java/android/bluetooth/BluetoothUuid.java
index abdf949..4b28516 100644
--- a/core/java/android/bluetooth/BluetoothUuid.java
+++ b/core/java/android/bluetooth/BluetoothUuid.java
@@ -73,6 +73,9 @@ public final class BluetoothUuid {
public static final ParcelUuid MAS =
ParcelUuid.fromString("00001132-0000-1000-8000-00805F9B34FB");
+ public static final ParcelUuid BASE_UUID =
+ ParcelUuid.fromString("00000000-0000-1000-8000-00805F9B34FB");
+
public static final ParcelUuid[] RESERVED_UUIDS = {
AudioSink, AudioSource, AdvAudioDist, HSP, Handsfree, AvrcpController, AvrcpTarget,
@@ -211,4 +214,17 @@ public final class BluetoothUuid {
long value = (uuid.getMostSignificantBits() & 0x0000FFFF00000000L) >>> 32;
return (int)value;
}
+
+ /**
+ * Check whether the given parcelUuid can be converted to 16 bit bluetooth uuid.
+ * @param parcelUuid
+ * @return true if the parcelUuid can be converted to 16 bit uuid, false otherwise.
+ */
+ public static boolean isShortUuid(ParcelUuid parcelUuid) {
+ UUID uuid = parcelUuid.getUuid();
+ if (uuid.getLeastSignificantBits() != BASE_UUID.getUuid().getLeastSignificantBits()) {
+ return false;
+ }
+ return ((uuid.getMostSignificantBits() & 0xFFFF0000FFFFFFFFL) == 0x1000L);
+ }
}