diff options
author | Jakub Pawlowski <jpawlowski@google.com> | 2016-03-01 18:50:27 -0800 |
---|---|---|
committer | Jakub Pawlowski <jpawlowski@google.com> | 2016-03-18 12:57:33 -0700 |
commit | c9ba8c7ed1ab4271ef4cd84cac0032d13eb46513 (patch) | |
tree | 6a31a941bf6b55a2bdb8a245eabba532b4c5a0e2 /framework/java/android/bluetooth/BluetoothGattDescriptor.java | |
parent | f3793ce8b299495b3124c3854a7490fbf9d5cc96 (diff) |
Change how services are passed up to the stack
Right now we pass all services, characteristics and descriptors one by one.
This patch changes that - now we pass whole GATT database at once.
Bug: 27455533
Change-Id: Ie42cd80072538e411904b9c9b011a978f26158b9
Diffstat (limited to 'framework/java/android/bluetooth/BluetoothGattDescriptor.java')
-rw-r--r-- | framework/java/android/bluetooth/BluetoothGattDescriptor.java | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/framework/java/android/bluetooth/BluetoothGattDescriptor.java b/framework/java/android/bluetooth/BluetoothGattDescriptor.java index 5f525dc609..28317c4960 100644 --- a/framework/java/android/bluetooth/BluetoothGattDescriptor.java +++ b/framework/java/android/bluetooth/BluetoothGattDescriptor.java @@ -16,6 +16,9 @@ package android.bluetooth; +import android.os.Parcel; +import android.os.Parcelable; +import android.os.ParcelUuid; import java.util.UUID; /** @@ -25,7 +28,7 @@ import java.util.UUID; * characteristic, {@link BluetoothGattCharacteristic}. They can be used to describe * the characteristic's features or to control certain behaviours of the characteristic. */ -public class BluetoothGattDescriptor { +public class BluetoothGattDescriptor implements Parcelable { /** * Value used to enable notification for a client configuration descriptor @@ -138,6 +141,13 @@ public class BluetoothGattDescriptor { initDescriptor(characteristic, uuid, instance, permissions); } + /** + * @hide + */ + public BluetoothGattDescriptor(UUID uuid, int instance, int permissions) { + initDescriptor(null, uuid, instance, permissions); + } + private void initDescriptor(BluetoothGattCharacteristic characteristic, UUID uuid, int instance, int permissions) { mCharacteristic = characteristic; @@ -147,6 +157,36 @@ public class BluetoothGattDescriptor { } /** + * @hide + */ + public int describeContents() { + return 0; + } + + public void writeToParcel(Parcel out, int flags) { + out.writeParcelable(new ParcelUuid(mUuid), 0); + out.writeInt(mInstance); + out.writeInt(mPermissions); + } + + public static final Parcelable.Creator<BluetoothGattDescriptor> CREATOR + = new Parcelable.Creator<BluetoothGattDescriptor>() { + public BluetoothGattDescriptor createFromParcel(Parcel in) { + return new BluetoothGattDescriptor(in); + } + + public BluetoothGattDescriptor[] newArray(int size) { + return new BluetoothGattDescriptor[size]; + } + }; + + private BluetoothGattDescriptor(Parcel in) { + mUuid = ((ParcelUuid)in.readParcelable(null)).getUuid(); + mInstance = in.readInt(); + mPermissions = in.readInt(); + } + + /** * Returns the characteristic this descriptor belongs to. * @return The characteristic. */ |