# Class GattDescriptor

java.lang.Object
com.codename1.bluetooth.gatt.GattDescriptor

public class GattDescriptor extends Object

A descriptor of a remote `GattCharacteristic`. Note that the Client Characteristic Configuration descriptor (`BluetoothUuid.CCCD`) is managed automatically by `GattCharacteristic.subscribe(GattNotificationListener)` -- there is no need to write it manually.

Instances are constructed by the port during service discovery; application code never creates them.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `GattDescriptor(GattCharacteristic characteristic, BluetoothUuid uuid)`
  Constructed by ports during service discovery; not application API.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `GattCharacteristic`
  `getCharacteristic()`
  The characteristic this descriptor belongs to.
  `BluetoothUuid`
  `getUuid()`
  The UUID identifying this descriptor.
  `AsyncResource<byte[]>`
  `read()`
  Reads the descriptor value.
  `String`
  `toString()`
  Returns a string representation of the object.
  `AsyncResource<Boolean>`
  `write(byte[] value)`
  Writes the descriptor value.

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### GattDescriptor

    public GattDescriptor(GattCharacteristic characteristic, BluetoothUuid uuid)
    Constructed by ports during service discovery; not application API.

- ## Method Details

  - ### getUuid

    public BluetoothUuid getUuid()
    The UUID identifying this descriptor.

  - ### getCharacteristic

    public GattCharacteristic getCharacteristic()
    The characteristic this descriptor belongs to.

  - ### read

    public AsyncResource<byte[]> read()
    Reads the descriptor value. Resolves with the raw bytes on the EDT or fails with a `BluetoothException`.

  - ### write

    public AsyncResource<Boolean> write(byte[] value)
    Writes the descriptor value. Resolves `true` on the EDT once the remote acknowledged the write.

  - ### toString

    public String toString()
    Description copied from class: `Object`
    Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method. The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of: getClass().getName() + '@' + Integer.toHexString(hashCode())
    Overrides:
      `toString` in class `Object`