Added in API level 18

BluetoothGattDescriptor

open class BluetoothGattDescriptor : Parcelable
kotlin.Any
   ↳ 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
static Int

Descriptor read permission

static Int

Descriptor permission: Allow encrypted read operations

static Int

Descriptor permission: Allow reading with person-in-the-middle protection

static Int

Descriptor write permission

static Int

Descriptor permission: Allow encrypted writes

static Int

Descriptor permission: Allow encrypted writes with person-in-the-middle protection

static Int

Descriptor permission: Allow signed write operations

static Int

Descriptor permission: Allow signed write operations with person-in-the-middle protection

Inherited constants
Public constructors
BluetoothGattDescriptor(uuid: UUID!, permissions: Int)

Create a new BluetoothGattDescriptor.

Public methods
open Int

open BluetoothGattCharacteristic!

Returns the characteristic this descriptor belongs to.

open Int

Returns the permissions for this descriptor.

open UUID!

Returns the UUID of this descriptor.

open ByteArray!

Returns the stored value for this descriptor

open Boolean

Updates the locally stored value of this descriptor.

open Unit
writeToParcel(out: Parcel, flags: Int)

Properties
static Parcelable.Creator<BluetoothGattDescriptor!>

static ByteArray!

Value used to disable notifications or indicatinos

static ByteArray!

Value used to enable indication for a client configuration descriptor

static ByteArray!

Value used to enable notification for a client configuration descriptor

Constants

PERMISSION_READ

Added in API level 18
static val PERMISSION_READ: Int

Descriptor read permission

Value: 1

PERMISSION_READ_ENCRYPTED

Added in API level 18
static val PERMISSION_READ_ENCRYPTED: Int

Descriptor permission: Allow encrypted read operations

Value: 2

PERMISSION_READ_ENCRYPTED_MITM

Added in API level 18
static val PERMISSION_READ_ENCRYPTED_MITM: Int

Descriptor permission: Allow reading with person-in-the-middle protection

Value: 4

PERMISSION_WRITE

Added in API level 18
static val PERMISSION_WRITE: Int

Descriptor write permission

Value: 16

PERMISSION_WRITE_ENCRYPTED

Added in API level 18
static val PERMISSION_WRITE_ENCRYPTED: Int

Descriptor permission: Allow encrypted writes

Value: 32

PERMISSION_WRITE_ENCRYPTED_MITM

Added in API level 18
static val PERMISSION_WRITE_ENCRYPTED_MITM: Int

Descriptor permission: Allow encrypted writes with person-in-the-middle protection

Value: 64

PERMISSION_WRITE_SIGNED

Added in API level 18
static val PERMISSION_WRITE_SIGNED: Int

Descriptor permission: Allow signed write operations

Value: 128

PERMISSION_WRITE_SIGNED_MITM

Added in API level 18
static val PERMISSION_WRITE_SIGNED_MITM: Int

Descriptor permission: Allow signed write operations with person-in-the-middle protection

Value: 256

Public constructors

BluetoothGattDescriptor

Added in API level 18
BluetoothGattDescriptor(
    uuid: UUID!,
    permissions: Int)

Create a new BluetoothGattDescriptor.

Parameters
uuid UUID!: The UUID for this descriptor
permissions Int: Permissions for this descriptor

Public methods

describeContents

Added in API level 24
open fun describeContents(): Int
Return
Int a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR

getCharacteristic

Added in API level 18
open fun getCharacteristic(): BluetoothGattCharacteristic!

Returns the characteristic this descriptor belongs to.

Return
BluetoothGattCharacteristic! The characteristic.

getPermissions

Added in API level 18
open fun getPermissions(): Int

Returns the permissions for this descriptor.

Return
Int Permissions of this descriptor

getUuid

Added in API level 18
open fun getUuid(): UUID!

Returns the UUID of this descriptor.

Return
UUID! UUID of this descriptor

getValue

Added in API level 18
Deprecated in API level 33
open fun getValue(): ByteArray!

Deprecated: 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 android.bluetooth.BluetoothGatt#readDescriptor. The cached value of the descriptor is updated as a result of a descriptor read operation.

Return
ByteArray! Cached value of the descriptor

setValue

Added in API level 18
Deprecated in API level 33
open fun setValue(value: ByteArray!): Boolean

Deprecated: Pass the descriptor value directly into android.bluetooth.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 android.bluetooth.BluetoothGatt#writeDescriptor to send the value to the remote device.

Parameters
value ByteArray!: New value for this descriptor
Return
Boolean true if the locally stored value has been set, false if the requested value could not be stored locally.

writeToParcel

Added in API level 24
open fun writeToParcel(
    out: Parcel,
    flags: Int
): Unit
Parameters
dest 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_WRITE_RETURN_VALUE. Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES

Properties

CREATOR

Added in API level 24
static val CREATOR: Parcelable.Creator<BluetoothGattDescriptor!>

DISABLE_NOTIFICATION_VALUE

Added in API level 18
static val DISABLE_NOTIFICATION_VALUE: ByteArray!

Value used to disable notifications or indicatinos

ENABLE_INDICATION_VALUE

Added in API level 18
static val ENABLE_INDICATION_VALUE: ByteArray!

Value used to enable indication for a client configuration descriptor

ENABLE_NOTIFICATION_VALUE

Added in API level 18
static val ENABLE_NOTIFICATION_VALUE: ByteArray!

Value used to enable notification for a client configuration descriptor