BluetoothGattDescriptor
public
class
BluetoothGattDescriptor
extends Object
implements
Parcelable
java.lang.Object | |
↳ | android.bluetooth.BluetoothGattDescriptor |
Represents a Bluetooth GATT Descriptor
GATT Descriptors contain additional information and attributes of a GATT characteristic,
BluetoothGattCharacteristic
. They can be used to describe the characteristic's features
or to control certain behaviours of the characteristic.
Summary
Constants | |
---|---|
int |
PERMISSION_READ
Descriptor read permission |
int |
PERMISSION_READ_ENCRYPTED
Descriptor permission: Allow encrypted read operations |
int |
PERMISSION_READ_ENCRYPTED_MITM
Descriptor permission: Allow reading with person-in-the-middle protection |
int |
PERMISSION_WRITE
Descriptor write permission |
int |
PERMISSION_WRITE_ENCRYPTED
Descriptor permission: Allow encrypted writes |
int |
PERMISSION_WRITE_ENCRYPTED_MITM
Descriptor permission: Allow encrypted writes with person-in-the-middle protection |
int |
PERMISSION_WRITE_SIGNED
Descriptor permission: Allow signed write operations |
int |
PERMISSION_WRITE_SIGNED_MITM
Descriptor permission: Allow signed write operations with person-in-the-middle protection |
Inherited constants |
---|
Fields | |
---|---|
public
static
final
Creator<BluetoothGattDescriptor> |
CREATOR
|
public
static
final
byte[] |
DISABLE_NOTIFICATION_VALUE
Value used to disable notifications or indicatinos |
public
static
final
byte[] |
ENABLE_INDICATION_VALUE
Value used to enable indication for a client configuration descriptor |
public
static
final
byte[] |
ENABLE_NOTIFICATION_VALUE
Value used to enable notification for a client configuration descriptor |
Public constructors | |
---|---|
BluetoothGattDescriptor(UUID uuid, int permissions)
Create a new BluetoothGattDescriptor. |
Public methods | |
---|---|
int
|
describeContents()
Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
BluetoothGattCharacteristic
|
getCharacteristic()
Returns the characteristic this descriptor belongs to. |
int
|
getPermissions()
Returns the permissions for this descriptor. |
UUID
|
getUuid()
Returns the UUID of this descriptor. |
byte[]
|
getValue()
This method was deprecated
in API level 33.
Use |
boolean
|
setValue(byte[] value)
This method was deprecated
in API level 33.
Pass the descriptor value directly into |
void
|
writeToParcel(Parcel out, int flags)
Flatten this object in to a Parcel. |
Inherited methods | |
---|---|
Constants
PERMISSION_READ
public static final int PERMISSION_READ
Descriptor read permission
Constant Value: 1 (0x00000001)
PERMISSION_READ_ENCRYPTED
public static final int PERMISSION_READ_ENCRYPTED
Descriptor permission: Allow encrypted read operations
Constant Value: 2 (0x00000002)
PERMISSION_READ_ENCRYPTED_MITM
public static final int PERMISSION_READ_ENCRYPTED_MITM
Descriptor permission: Allow reading with person-in-the-middle protection
Constant Value: 4 (0x00000004)
PERMISSION_WRITE
public static final int PERMISSION_WRITE
Descriptor write permission
Constant Value: 16 (0x00000010)
PERMISSION_WRITE_ENCRYPTED
public static final int PERMISSION_WRITE_ENCRYPTED
Descriptor permission: Allow encrypted writes
Constant Value: 32 (0x00000020)
PERMISSION_WRITE_ENCRYPTED_MITM
public static final int PERMISSION_WRITE_ENCRYPTED_MITM
Descriptor permission: Allow encrypted writes with person-in-the-middle protection
Constant Value: 64 (0x00000040)
PERMISSION_WRITE_SIGNED
public static final int PERMISSION_WRITE_SIGNED
Descriptor permission: Allow signed write operations
Constant Value: 128 (0x00000080)
PERMISSION_WRITE_SIGNED_MITM
public static final int PERMISSION_WRITE_SIGNED_MITM
Descriptor permission: Allow signed write operations with person-in-the-middle protection
Constant Value: 256 (0x00000100)
Fields
DISABLE_NOTIFICATION_VALUE
public static final byte[] DISABLE_NOTIFICATION_VALUE
Value used to disable notifications or indicatinos
ENABLE_INDICATION_VALUE
public static final byte[] ENABLE_INDICATION_VALUE
Value used to enable indication for a client configuration descriptor
ENABLE_NOTIFICATION_VALUE
public static final byte[] ENABLE_NOTIFICATION_VALUE
Value used to enable notification for a client configuration descriptor
Public constructors
BluetoothGattDescriptor
public BluetoothGattDescriptor (UUID uuid, int permissions)
Create a new BluetoothGattDescriptor.
Parameters | |
---|---|
uuid |
UUID : The UUID for this descriptor |
permissions |
int : Permissions for this descriptor |
Public methods
describeContents
public int describeContents ()
Describe the kinds of special objects contained in this Parcelable
instance's marshaled representation. For example, if the object will
include a file descriptor in the output of writeToParcel(android.os.Parcel, int)
,
the return value of this method must include the
CONTENTS_FILE_DESCRIPTOR
bit.
Returns | |
---|---|
int |
a bitmask indicating the set of special object types marshaled
by this Parcelable object instance.
Value is either 0 or CONTENTS_FILE_DESCRIPTOR |
getCharacteristic
public BluetoothGattCharacteristic getCharacteristic ()
Returns the characteristic this descriptor belongs to.
Returns | |
---|---|
BluetoothGattCharacteristic |
The characteristic. |
getPermissions
public int getPermissions ()
Returns the permissions for this descriptor.
Returns | |
---|---|
int |
Permissions of this descriptor |
getUuid
public UUID getUuid ()
Returns the UUID of this descriptor.
Returns | |
---|---|
UUID |
UUID of this descriptor |
getValue
public byte[] getValue ()
This method was deprecated
in API level 33.
Use BluetoothGatt.readDescriptor(BluetoothGattDescriptor)
instead
Returns the stored value for this descriptor
This function returns the stored value for this descriptor as retrieved by calling BluetoothGatt.readDescriptor(BluetoothGattDescriptor)
. The cached value of the descriptor is updated as a result of a
descriptor read operation.
Returns | |
---|---|
byte[] |
Cached value of the descriptor |
setValue
public boolean setValue (byte[] value)
This method was deprecated
in API level 33.
Pass the descriptor value directly into BluetoothGatt.writeDescriptor(android.bluetooth.BluetoothGattDescriptor, byte[])
Updates the locally stored value of this descriptor.
This function modifies the locally stored cached value of this descriptor. To send the
value to the remote device, call BluetoothGatt.writeDescriptor
to send the value to
the remote device.
Parameters | |
---|---|
value |
byte : New value for this descriptor |
Returns | |
---|---|
boolean |
true if the locally stored value has been set, false if the requested value could not be stored locally. |
writeToParcel
public void writeToParcel (Parcel out, int flags)
Flatten this object in to a Parcel.
Parameters | |
---|---|
out |
Parcel : The Parcel in which the object should be written.
This value cannot be null . |
flags |
int : Additional flags about how the object should be written.
May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE .
Value is either 0 or a combination of Parcelable.PARCELABLE_WRITE_RETURN_VALUE , and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |