public class GattDescriptor

  1. Object
  2. GattDescriptor

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.

Constructors

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

Methods

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

Inherited methods

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()
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())