-
- All Implemented Interfaces:
-
no.nordicsemi.android.ble.Operation
public final class ConnectionPriorityRequest extends SimpleValueRequest<ConnectionParametersUpdatedCallback> implements Operation
-
-
Field Summary
Fields Modifier and Type Field Description public final static intCONNECTION_PRIORITY_BALANCEDpublic final static intCONNECTION_PRIORITY_HIGHpublic final static intCONNECTION_PRIORITY_LOW_POWER
-
Method Summary
Modifier and Type Method Description ConnectionPriorityRequestsetHandler(@Nullable() Handler handler)Sets the handler that will be used to invoke callbacks. ConnectionPriorityRequestdone(@NonNull() SuccessCallback callback)Use to set a completion callback. ConnectionPriorityRequestfail(@NonNull() FailCallback callback)Use to set a callback that will be called in case the request has failed. ConnectionPriorityRequestinvalid(@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. ConnectionPriorityRequestbefore(@NonNull() BeforeCallback callback)Sets a callback that will be executed before the execution of this operation starts. ConnectionPriorityRequestthen(@NonNull() AfterCallback callback)Sets a callback that will be executed when the request has been processed, no matterthe request result. ConnectionPriorityRequestwith(@NonNull() ConnectionPriorityCallback callback)Sets the value callback. ConnectionPriorityRequestwith(@NonNull() ConnectionParametersUpdatedCallback callback)Sets the value callback. <E extends ConnectionParametersUpdatedCallback> Eawait(@NonNull() Class<E> responseClass)Synchronously waits until the request is done. <E extends ConnectionParametersUpdatedCallback> Eawait(@NonNull() E response)Synchronously waits until the request is done. -
Methods inherited from class no.nordicsemi.android.ble.SimpleValueRequest
with -
Methods inherited from class no.nordicsemi.android.ble.SimpleRequest
await -
Methods inherited from class no.nordicsemi.android.ble.Request
before, 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, then -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
setHandler
@NonNull() ConnectionPriorityRequest 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() ConnectionPriorityRequest 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() ConnectionPriorityRequest 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() ConnectionPriorityRequest 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() ConnectionPriorityRequest before(@NonNull() BeforeCallback callback)
Sets a callback that will be executed before the execution of this operation starts.
- Parameters:
callback- the callback.
-
then
@NonNull() ConnectionPriorityRequest 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
@RequiresApi(value = Build.VERSION_CODES.O)@NonNull()@Deprecated() ConnectionPriorityRequest with(@NonNull() ConnectionPriorityCallback 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.
-
with
@RequiresApi(value = Build.VERSION_CODES.O)@NonNull() ConnectionPriorityRequest with(@NonNull() ConnectionParametersUpdatedCallback 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.
-
await
@RequiresApi(value = Build.VERSION_CODES.O)@NonNull() <E extends ConnectionParametersUpdatedCallback> E await(@NonNull() Class<E> responseClass)
Synchronously waits until the request is done.
Callbacks set using before, done and fail will be ignored.
This method may not be called from the main (UI) thread.
- Parameters:
responseClass- the response class.
-
await
@RequiresApi(value = Build.VERSION_CODES.O)@NonNull() <E extends ConnectionParametersUpdatedCallback> E await(@NonNull() E response)
Synchronously waits until the request is done. The given response object will be filledwith the request response.
Callbacks set using before, done and fail will be ignored.
This method may not be called from the main (UI) thread.
- Parameters:
response- the response object.
-
-
-
-