# Class GattWriteRequest

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

public abstract class GattWriteRequest extends Object
A write request from a connected central, delivered to `GattServerListener.characteristicWriteRequest(GattWriteRequest)` or `GattServerListener.descriptorWriteRequest(GattWriteRequest)`. When `isResponseRequired()` answer promptly with `respond()` or `reject(GattStatus)`.

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `GattWriteRequest(BleCentral central, GattLocalCharacteristic characteristic, GattLocalDescriptor descriptor, byte[] value, int offset, boolean responseRequired)`
  Constructed by ports; not application API.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `BleCentral`
  `getCentral()`
  The central issuing the request.
  `GattLocalCharacteristic`
  `getCharacteristic()`
  The written characteristic, or `null` for a descriptor write.
  `GattLocalDescriptor`
  `getDescriptor()`
  The written descriptor, or `null` for a characteristic write.
  `int`
  `getOffset()`
  The write offset for long writes; `0` for plain writes.
  `byte[]`
  `getValue()`
  The written bytes.
  `boolean`
  `isResponseRequired()`
  `true` when the central expects an acknowledgement (`respond()` or `reject(GattStatus)`); `false` for write-without-response.
  `abstract void`
  `reject(GattStatus status)`
  Rejects the write with the given ATT status.
  `abstract void`
  `respond()`
  Acknowledges the write.

  ### Methods inherited from class Object

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

- ## Constructor Details

  - ### GattWriteRequest

    protected GattWriteRequest(BleCentral central, GattLocalCharacteristic characteristic, GattLocalDescriptor descriptor, byte[] value, int offset, boolean responseRequired)
    Constructed by ports; not application API.

- ## Method Details

  - ### getCentral

    public BleCentral getCentral()
    The central issuing the request.

  - ### getCharacteristic

    public GattLocalCharacteristic getCharacteristic()
    The written characteristic, or `null` for a descriptor write.

  - ### getDescriptor

    public GattLocalDescriptor getDescriptor()
    The written descriptor, or `null` for a characteristic write.

  - ### getValue

    public byte[] getValue()
    The written bytes.

  - ### getOffset

    public int getOffset()
    The write offset for long writes; `0` for plain writes.

  - ### isResponseRequired

    public boolean isResponseRequired()
    `true` when the central expects an acknowledgement (`respond()` or `reject(GattStatus)`); `false` for write-without-response.

  - ### respond

    public abstract void respond()
    Acknowledges the write. May be called from any thread; call exactly once when `isResponseRequired()`.

  - ### reject

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