public abstract class GattReadRequest

  1. Object
  2. GattReadRequest
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.

Constructors

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

Methods

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

Inherited methods

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.