FileDocCategorySizeDatePackage
BluetoothGattDescriptor.javaAPI DocAndroid 5.1 API6693Thu Mar 12 22:22:10 GMT 2015android.bluetooth

BluetoothGattDescriptor

public class BluetoothGattDescriptor extends Object
Represents a Bluetooth GATT Descriptor

GATT Descriptors contain additional information and attributes of a GATT characteristic, {@link BluetoothGattCharacteristic}. They can be used to describe the characteristic's features or to control certain behaviours of the characteristic.

Fields Summary
public static final byte[]
ENABLE_NOTIFICATION_VALUE
Value used to enable notification for a client configuration descriptor
public static final byte[]
ENABLE_INDICATION_VALUE
Value used to enable indication for a client configuration descriptor
public static final byte[]
DISABLE_NOTIFICATION_VALUE
Value used to disable notifications or indicatinos
public static final int
PERMISSION_READ
Descriptor read permission
public static final int
PERMISSION_READ_ENCRYPTED
Descriptor permission: Allow encrypted read operations
public static final int
PERMISSION_READ_ENCRYPTED_MITM
Descriptor permission: Allow reading with man-in-the-middle protection
public static final int
PERMISSION_WRITE
Descriptor write permission
public static final int
PERMISSION_WRITE_ENCRYPTED
Descriptor permission: Allow encrypted writes
public static final int
PERMISSION_WRITE_ENCRYPTED_MITM
Descriptor permission: Allow encrypted writes with man-in-the-middle protection
public static final int
PERMISSION_WRITE_SIGNED
Descriptor permission: Allow signed write operations
public static final int
PERMISSION_WRITE_SIGNED_MITM
Descriptor permission: Allow signed write operations with man-in-the-middle protection
protected UUID
mUuid
The UUID of this descriptor.
protected int
mInstance
Instance ID for this descriptor.
protected int
mPermissions
Permissions for this descriptor
protected BluetoothGattCharacteristic
mCharacteristic
Back-reference to the characteristic this descriptor belongs to.
protected byte[]
mValue
The value for this descriptor.
Constructors Summary
public BluetoothGattDescriptor(UUID uuid, int permissions)
Create a new BluetoothGattDescriptor.

Requires {@link android.Manifest.permission#BLUETOOTH} permission.

param
uuid The UUID for this descriptor
param
permissions Permissions for this descriptor


                              
         
        initDescriptor(null, uuid, 0, permissions);
    
BluetoothGattDescriptor(BluetoothGattCharacteristic characteristic, UUID uuid, int instance, int permissions)
Create a new BluetoothGattDescriptor.

Requires {@link android.Manifest.permission#BLUETOOTH} permission.

param
characteristic The characteristic this descriptor belongs to
param
uuid The UUID for this descriptor
param
permissions Permissions for this descriptor

        initDescriptor(characteristic, uuid, instance, permissions);
    
Methods Summary
public BluetoothGattCharacteristicgetCharacteristic()
Returns the characteristic this descriptor belongs to.

return
The characteristic.

        return mCharacteristic;
    
public intgetInstanceId()
Returns the instance ID for this descriptor.

If a remote device offers multiple descriptors with the same UUID, the instance ID is used to distuinguish between descriptors.

Requires {@link android.Manifest.permission#BLUETOOTH} permission.

return
Instance ID of this descriptor
hide

        return mInstance;
    
public intgetPermissions()
Returns the permissions for this descriptor.

return
Permissions of this descriptor

        return mPermissions;
    
public java.util.UUIDgetUuid()
Returns the UUID of this descriptor.

return
UUID of this descriptor

        return mUuid;
    
public byte[]getValue()
Returns the stored value for this descriptor

This function returns the stored value for this descriptor as retrieved by calling {@link BluetoothGatt#readDescriptor}. The cached value of the descriptor is updated as a result of a descriptor read operation.

return
Cached value of the descriptor

        return mValue;
    
private voidinitDescriptor(BluetoothGattCharacteristic characteristic, java.util.UUID uuid, int instance, int permissions)

        mCharacteristic = characteristic;
        mUuid = uuid;
        mInstance = instance;
        mPermissions = permissions;
    
voidsetCharacteristic(BluetoothGattCharacteristic characteristic)
Set the back-reference to the associated characteristic

hide

        mCharacteristic = characteristic;
    
public booleansetValue(byte[] value)
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 {@link BluetoothGatt#writeDescriptor} to send the value to the remote device.

param
value New value for this descriptor
return
true if the locally stored value has been set, false if the requested value could not be stored locally.

        mValue = value;
        return true;