-
- All Implemented Interfaces:
-
no.nordicsemi.android.ble.Operation
public final class WaitForReadRequest extends AwaitingRequest<DataSentCallback> implements Operation
-
-
Method Summary
Modifier and Type Method Description WaitForReadRequestsetHandler(@Nullable() Handler handler)Sets the handler that will be used to invoke callbacks. WaitForReadRequestdone(@NonNull() SuccessCallback callback)Use to set a completion callback. WaitForReadRequestfail(@NonNull() FailCallback callback)Use to set a callback that will be called in case the request has failed. WaitForReadRequestinvalid(@NonNull() InvalidRequestCallback callback)Use to set a callback that will be called in case the request was invalid, for examplecalled before the device was connected.This callback will be ignored if request was executed synchronously, in which casethe error will be returned as an exception. WaitForReadRequestbefore(@NonNull() BeforeCallback callback)Sets a callback that will be executed before the execution of this operation starts. WaitForReadRequestthen(@NonNull() AfterCallback callback)Sets a callback that will be executed when the request has been processed, no matterthe request result. WaitForReadRequestwith(@NonNull() DataSentCallback callback)Sets the value callback. WaitForReadRequesttrigger(@NonNull() Operation trigger)Sets an optional request that is suppose to trigger the notification or indication.This is to ensure that the characteristic value won't change before the callback was set. WaitForReadRequestsplit(@NonNull() DataSplitter splitter)Adds a splitter that will be used to cut given data into multiple packets.The splitter may modify each packet if necessary, i.e. WaitForReadRequestsplit(@NonNull() DataSplitter splitter, @NonNull() WriteProgressCallback callback)Adds a splitter that will be used to cut given data into multiple packets.The splitter may modify each packet if necessary, i.e. WaitForReadRequestsplit()Adds a default MTU splitter that will be used to cut given data into at-most MTU-3bytes long packets. WaitForReadRequestsplit(@NonNull() WriteProgressCallback callback)Adds a default MTU splitter that will be used to cut given data into at-most MTU-3bytes long packets. -
Methods inherited from class no.nordicsemi.android.ble.AwaitingRequest
await, trigger -
Methods inherited from class no.nordicsemi.android.ble.TimeoutableValueRequest
await, await, await, timeout, with -
Methods inherited from class no.nordicsemi.android.ble.TimeoutableRequest
await, await, cancel, enqueue, enqueue, isCancelled, setHandler, timeout -
Methods inherited from class no.nordicsemi.android.ble.Request
before, 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, setHandler, then -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
setHandler
@NonNull() WaitForReadRequest setHandler(@Nullable() Handler handler)
Sets the handler that will be used to invoke callbacks. By default, the handler set in BleManager will be used.
If set to null, the callbacks will be invoked immediately on the BLE looper.
- Parameters:
handler- The handler to invoke callbacks for this request.
-
done
@NonNull() WaitForReadRequest done(@NonNull() SuccessCallback callback)
Use to set a completion callback. The callback will be invoked when the operation hasfinished successfully unless the request was executed synchronously, in which case thiscallback will be ignored.
- Parameters:
callback- the callback.
-
fail
@NonNull() WaitForReadRequest fail(@NonNull() FailCallback callback)
Use to set a callback that will be called in case the request has failed.If the target device wasn't set before executing this request(connect was never called), the invalid will be used instead, as the BluetoothDevice is not known.
This callback will be ignored if request was executed synchronously, in which casethe error will be returned as an exception.
- Parameters:
callback- the callback.
-
invalid
@NonNull() WaitForReadRequest invalid(@NonNull() InvalidRequestCallback callback)
Use to set a callback that will be called in case the request was invalid, for examplecalled before the device was connected.This callback will be ignored if request was executed synchronously, in which casethe error will be returned as an exception.
- Parameters:
callback- the callback.
-
before
@NonNull() WaitForReadRequest before(@NonNull() BeforeCallback callback)
Sets a callback that will be executed before the execution of this operation starts.
- Parameters:
callback- the callback.
-
then
@NonNull() WaitForReadRequest then(@NonNull() AfterCallback callback)
Sets a callback that will be executed when the request has been processed, no matterthe request result.
Set done or fail if you need a callbackcalled in a specific situation.
This request will not be called if the BluetoothDevice was not set. Instead, InvalidRequestCallback will be called.
- Parameters:
callback- the callback.
-
with
@NonNull() WaitForReadRequest with(@NonNull() DataSentCallback callback)
Sets the value callback. When the request is invoked synchronously, this callback willbe ignored and the received value will be returned by the
await(...)method;- Parameters:
callback- the callback.
-
trigger
@NonNull() WaitForReadRequest trigger(@NonNull() Operation trigger)
Sets an optional request that is suppose to trigger the notification or indication.This is to ensure that the characteristic value won't change before the callback was set.
- Parameters:
trigger- the operation that triggers the notification, usually a write characteristicrequest that write some OP CODE.
-
split
@NonNull() WaitForReadRequest split(@NonNull() DataSplitter splitter)
Adds a splitter that will be used to cut given data into multiple packets.The splitter may modify each packet if necessary, i.e. add a flag indicating first packet,continuation or the last packet.
- Parameters:
splitter- an implementation of a splitter.
-
split
@NonNull() WaitForReadRequest split(@NonNull() DataSplitter splitter, @NonNull() WriteProgressCallback callback)
Adds a splitter that will be used to cut given data into multiple packets.The splitter may modify each packet if necessary, i.e. add a flag indicating first packet,continuation or the last packet.
- Parameters:
splitter- an implementation of a splitter.callback- the progress callback that will be notified each time a packet was sent.
-
split
@NonNull() WaitForReadRequest split()
Adds a default MTU splitter that will be used to cut given data into at-most MTU-3bytes long packets.
-
split
@NonNull() WaitForReadRequest split(@NonNull() WriteProgressCallback callback)
Adds a default MTU splitter that will be used to cut given data into at-most MTU-3bytes long packets.
- Parameters:
callback- the progress callback that will be notified each time a packet was sent.
-
-
-
-