public final class ReadRequest extends SimpleValueRequest<DataReceivedCallback> implements Operation
handler, requestHandler| Modifier and Type | Method and Description |
|---|---|
<E extends ProfileReadResponse> |
awaitValid(java.lang.Class<E> responseClass)
Same as
SimpleValueRequest.await(Class), but if the response class extends
ProfileReadResponse and the received response is not valid
(ProfileReadResponse.isValid() returns false), this method will
throw an exception. |
<E extends ProfileReadResponse> |
awaitValid(E response)
Same as
SimpleValueRequest.await(Object), but if the response class extends
ProfileReadResponse and the received response is not valid
(ProfileReadResponse.isValid() returns false), this method will
throw an exception. |
ReadRequest |
before(BeforeCallback callback)
Sets a callback that will be executed before the execution of this operation starts.
|
ReadRequest |
done(SuccessCallback callback)
Use to set a completion callback.
|
ReadRequest |
fail(FailCallback callback)
Use to set a callback that will be called in case the request has failed.
|
ReadRequest |
filter(DataFilter filter)
Sets a filter which allows to skip some incoming data.
|
ReadRequest |
invalid(InvalidRequestCallback callback)
Use to set a callback that will be called in case the request was invalid, for example
called before the device was connected.
|
ReadRequest |
merge(DataMerger merger)
Adds a merger that will be used to merge multiple packets into a single Data.
|
ReadRequest |
merge(DataMerger merger,
ReadProgressCallback callback)
Adds a merger that will be used to merge multiple packets into a single Data.
|
ReadRequest |
setHandler(android.os.Handler handler)
Sets the handler that will be used to invoke callbacks.
|
ReadRequest |
with(DataReceivedCallback callback)
Sets the value callback.
|
await, awaitawaitcreateBond, enqueue, 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 ReadRequest setHandler(@NonNull android.os.Handler handler)
RequestBleManager will be used.setHandler in class Requesthandler - The handler to invoke callbacks for this request.@NonNull public ReadRequest done(@NonNull SuccessCallback callback)
Request@NonNull public ReadRequest fail(@NonNull FailCallback callback)
RequestBleManager.connect(BluetoothDevice) was never called), the
Request.invalid(InvalidRequestCallback) will be used instead, as the
BluetoothDevice is not known.
This callback will be ignored if request was executed synchronously, in which case the error will be returned as an exception.
@NonNull public ReadRequest invalid(@NonNull InvalidRequestCallback callback)
Request@NonNull public ReadRequest before(@NonNull BeforeCallback callback)
Request@NonNull public ReadRequest with(@NonNull DataReceivedCallback callback)
SimpleValueRequestawait(...) method;with in class SimpleValueRequest<DataReceivedCallback>callback - the callback.@NonNull public ReadRequest filter(@NonNull DataFilter filter)
filter - the data filter.@NonNull public ReadRequest merge(@NonNull DataMerger merger)
@NonNull public ReadRequest merge(@NonNull DataMerger merger, @NonNull ReadProgressCallback callback)
@NonNull public <E extends ProfileReadResponse> E awaitValid(@NonNull java.lang.Class<E> responseClass) throws RequestFailedException, InvalidDataException, DeviceDisconnectedException, BluetoothDisabledException, InvalidRequestException
SimpleValueRequest.await(Class), but if the response class extends
ProfileReadResponse and the received response is not valid
(ProfileReadResponse.isValid() returns false), this method will
throw an exception.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 has been disabled.InvalidDataException - thrown when the received data were not valid (that is when
ReadResponse.onDataReceived(BluetoothDevice, Data)
failed to parse the data correctly and called
ProfileReadResponse.onInvalidDataReceived(BluetoothDevice, Data)).InvalidRequestException - thrown when the request was called before the device was
connected at least once (unknown device).@NonNull public <E extends ProfileReadResponse> E awaitValid(@NonNull E response) throws RequestFailedException, InvalidDataException, DeviceDisconnectedException, BluetoothDisabledException, InvalidRequestException
SimpleValueRequest.await(Object), but if the response class extends
ProfileReadResponse and the received response is not valid
(ProfileReadResponse.isValid() returns false), this method will
throw an exception.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 has been disabled.InvalidDataException - thrown when the received data were not valid (that is when
ReadResponse.onDataReceived(BluetoothDevice, Data)
failed to parse the data correctly and called
ProfileReadResponse.onInvalidDataReceived(BluetoothDevice, Data)).InvalidRequestException - thrown when the request was called before the device was
connected at least once (unknown device).