public abstract class TimeoutableValueRequest<T> extends TimeoutableRequest
callback or
can't have timeout for any other reason. This class defines the TimeoutableRequest.await() methods.timeouthandler, 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(java.lang.Class<E> responseClass,
long timeout)
Deprecated.
Use
timeout(long) and await(Class) instead. |
<E extends T> |
await(E response)
Synchronously waits until the request is done.
|
<E extends T> |
await(E response,
long timeout)
Deprecated.
Use
timeout(long) and #await(E) instead. |
TimeoutableValueRequest<T> |
timeout(long timeout)
Sets the operation timeout.
|
TimeoutableValueRequest<T> |
with(T callback)
Sets the value callback.
|
await, await, enqueue, enqueue, setHandlerbefore, createBond, done, 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@NonNull public TimeoutableValueRequest<T> timeout(long timeout)
TimeoutableRequestFailCallback.REASON_TIMEOUT.timeout in class TimeoutableRequesttimeout - the request timeout in milliseconds, 0 to disable timeout.@NonNull public TimeoutableValueRequest<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, java.lang.InterruptedException
When the timeout, set with timeout(long) occurs, the InterruptedException
will be thrown.
Callbacks set using Request.done(SuccessCallback) and Request.fail(FailCallback) and
#with(E) 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.InterruptedException - thrown if the timeout occurred before the request has
finished.java.lang.IllegalStateException - thrown when you try to call this method from the main
(UI) thread, or when the trigger was already enqueued.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).@NonNull public <E extends T> E await(@NonNull java.lang.Class<E> responseClass) throws RequestFailedException, DeviceDisconnectedException, BluetoothDisabledException, InvalidRequestException, java.lang.InterruptedException
Callbacks set using Request.done(SuccessCallback) and Request.fail(FailCallback) and
#with(T) 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.InterruptedException - thrown if the timeout occurred before the request has
finished.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)@NonNull @Deprecated public <E extends T> E await(@NonNull java.lang.Class<E> responseClass, long timeout) throws RequestFailedException, java.lang.InterruptedException, DeviceDisconnectedException, BluetoothDisabledException, InvalidRequestException
timeout(long) and await(Class) instead.InterruptedException will be thrown.
Callbacks set using Request.done(SuccessCallback), Request.fail(FailCallback) and
#with(E) will be ignored.
This method may not be called from the main (UI) thread.
E - a response class that extends T.responseClass - the response class. This class will be instantiate, therefore it has
to have a default constructor.timeout - optional timeout in milliseconds. This value will override one set
in timeout(long).RequestFailedException - thrown when the BLE request finished with status other
than BluetoothGatt.GATT_SUCCESS.java.lang.InterruptedException - thrown if the timeout occurred before the request has
finished.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).@NonNull @Deprecated public <E extends T> E await(@NonNull E response, long timeout) throws RequestFailedException, java.lang.InterruptedException, DeviceDisconnectedException, BluetoothDisabledException, InvalidRequestException
timeout(long) and #await(E) instead.InterruptedException will be thrown.
Callbacks set using Request.done(SuccessCallback), Request.fail(FailCallback) and
#with(E) will be ignored.
This method may not be called from the main (UI) thread.
E - a response class that extends T.response - the response object.timeout - optional timeout in milliseconds.RequestFailedException - thrown when the BLE request finished with status other
than BluetoothGatt.GATT_SUCCESS.java.lang.InterruptedException - thrown if the timeout occurred before the request has
finished.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).