diff options
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. */ |