public abstract class GattWriteRequest
- Object
- GattWriteRequest
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).Constructors
Methods
public BleCentral getCentral() | The central issuing the request. |
public GattLocalCharacteristic getCharacteristic() | The written characteristic, or null for a descriptor write. |
public GattLocalDescriptor getDescriptor() | The written descriptor, or null for a characteristic write. |
public byte[] getValue() | The written bytes. |
public int getOffset() | The write offset for long writes; 0 for plain writes. |
public boolean isResponseRequired() | true when the central expects an acknowledgement (respond() or reject(GattStatus)); false for write-without-response. |
public abstract void respond() | Acknowledges the write. |
public abstract void reject(GattStatus status) | Rejects the write with the given ATT status. |
Inherited methods
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.