public abstract class SimpleValueRequest<T> extends SimpleRequest
callback or
can't have timeout for any other reason. This class defines the SimpleRequest.await() methods.handler, requestHandler| Modifier and Type | Method and Description |
|---|---|
<E extends T> |
await(java.lang.Class<E> responseClass)
Synchronously waits until the request is done.
|
<E extends T> |
await(E response)
Synchronously waits until the request is done.
|
SimpleValueRequest<T> |
with(T callback)
Sets the value callback.
|
awaitbefore, createBond, done, enqueue, fail, invalid, newConnectionPriorityRequest, newDisableBatteryLevelNotificationsRequest, newDisableIndicationsRequest, newDisableNotificationsRequest, newEnableBatteryLevelNotificationsRequest, newEnableIndicationsRequest, newEnableNotificationsRequest, newMtuRequest, newReadBatteryLevelRequest, newReadPhyRequest, newReadRequest, newReadRequest, newReadRssiRequest, newRefreshCacheRequest, newSetPreferredPhyRequest, newSleepRequest, newWaitForIndicationRequest, newWaitForNotificationRequest, newWriteRequest, newWriteRequest, newWriteRequest, newWriteRequest, newWriteRequest, newWriteRequest, removeBond, setHandler@NonNull public SimpleValueRequest<T> with(@NonNull T callback)
await(...) method;callback - the callback.@NonNull public <E extends T> E await(@NonNull E response) throws RequestFailedException, DeviceDisconnectedException, BluetoothDisabledException, InvalidRequestException
Callbacks set using Request.before(BeforeCallback), Request.done(SuccessCallback) and
Request.fail(FailCallback) will be ignored.
This method may not be called from the main (UI) thread.
E - a response class.response - the response object.RequestFailedException - thrown when the BLE request finished with status other
than BluetoothGatt.GATT_SUCCESS.java.lang.IllegalStateException - thrown when you try to call this method from the main
(UI) thread.DeviceDisconnectedException - thrown when the device disconnected before the request
was completed.BluetoothDisabledException - thrown when the Bluetooth adapter is disabled.InvalidRequestException - thrown when the request was called before the device was
connected at least once (unknown device).await(Class)@NonNull public <E extends T> E await(@NonNull java.lang.Class<E> responseClass) throws RequestFailedException, DeviceDisconnectedException, BluetoothDisabledException, InvalidRequestException
Callbacks set using Request.before(BeforeCallback), Request.done(SuccessCallback) and
Request.fail(FailCallback) will be ignored.
This method may not be called from the main (UI) thread.
responseClass - the response class. This class will be instantiate, therefore it has
to have a default constructor.RequestFailedException - thrown when the BLE request finished with status other
than BluetoothGatt.GATT_SUCCESS.java.lang.IllegalStateException - thrown when you try to call this method from the main
(UI) thread.java.lang.IllegalArgumentException - thrown when the response class could not be instantiated.DeviceDisconnectedException - thrown when the device disconnected before the request
was completed.BluetoothDisabledException - thrown when the Bluetooth adapter is disabled.InvalidRequestException - thrown when the request was called before the device was
connected at least once (unknown device).await(Object)