# Class GattReadRequest

java.lang.Object
com.codename1.bluetooth.le.server.GattReadRequest

public abstract class GattReadRequest extends Object
A read request from a connected central, delivered to `GattServerListener.characteristicReadRequest(GattReadRequest)` or `GattServerListener.descriptorReadRequest(GattReadRequest)`. Answer promptly with [#respond(byte[])] or `reject(GattStatus)` -- centrals time out unanswered requests.

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `GattReadRequest(BleCentral central, GattLocalCharacteristic characteristic, GattLocalDescriptor descriptor, int offset)`
  Constructed by ports; not application API.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `BleCentral`
  `getCentral()`
  The central issuing the request.
  `GattLocalCharacteristic`
  `getCharacteristic()`
  The requested characteristic, or `null` for a descriptor read.
  `GattLocalDescriptor`
  `getDescriptor()`
  The requested descriptor, or `null` for a characteristic read.
  `int`
  `getOffset()`
  The read offset for long reads; `0` for plain reads.
  `abstract void`
  `reject(GattStatus status)`
  Rejects the request with the given ATT status.
  `abstract void`
  `respond(byte[] value)`
  Sends the value to the central.

  ### Methods inherited from class Object

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

- ## Constructor Details

  - ### GattReadRequest

    protected GattReadRequest(BleCentral central, GattLocalCharacteristic characteristic, GattLocalDescriptor descriptor, int offset)
    Constructed by ports; not application API.

- ## Method Details

  - ### getCentral

    public BleCentral getCentral()
    The central issuing the request.

  - ### getCharacteristic

    public GattLocalCharacteristic getCharacteristic()
    The requested characteristic, or `null` for a descriptor read.

  - ### getDescriptor

    public GattLocalDescriptor getDescriptor()
    The requested descriptor, or `null` for a characteristic read.

  - ### getOffset

    public int getOffset()
    The read offset for long reads; `0` for plain reads.

  - ### respond

    public abstract void respond(byte[] value)
    Sends the value to the central. May be called from any thread; call exactly once per request.

  - ### reject

    public abstract void reject(GattStatus status)
    Rejects the request with the given ATT status.