public final class ConnectionPriorityRequest extends SimpleValueRequest<ConnectionPriorityCallback> implements Operation
| Modifier and Type | Field and Description |
|---|---|
static int |
CONNECTION_PRIORITY_BALANCED
Connection parameter update - Use the connection parameters recommended by the
Bluetooth SIG.
|
static int |
CONNECTION_PRIORITY_HIGH
Connection parameter update - Request a high priority, low latency connection.
|
static int |
CONNECTION_PRIORITY_LOW_POWER
Connection parameter update - Request low power, reduced data rate connection parameters.
|
handler, requestHandler| Modifier and Type | Method and Description |
|---|---|
<E extends ConnectionPriorityCallback> |
await(java.lang.Class<E> responseClass)
Synchronously waits until the request is done.
|
<E extends ConnectionPriorityCallback> |
await(E response)
Synchronously waits until the request is done.
|
ConnectionPriorityRequest |
before(BeforeCallback callback)
Sets a callback that will be executed before the execution of this operation starts.
|
ConnectionPriorityRequest |
done(SuccessCallback callback)
Use to set a completion callback.
|
ConnectionPriorityRequest |
fail(FailCallback callback)
Use to set a callback that will be called in case the request has failed.
|
ConnectionPriorityRequest |
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.
|
ConnectionPriorityRequest |
setHandler(android.os.Handler handler)
Sets the handler that will be used to invoke callbacks.
|
ConnectionPriorityRequest |
with(ConnectionPriorityCallback callback)
Sets the value callback.
|
awaitcreateBond, 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, removeBondpublic static final int CONNECTION_PRIORITY_BALANCED
Interval: 30 - 50 ms, latency: 0, supervision timeout: 20 sec.
public static final int CONNECTION_PRIORITY_HIGH
CONNECTION_PRIORITY_BALANCED connection parameters
to reduce energy use.
Interval: 11.25 - 15 ms (Android 6+) or 7.5 - 10 ms (Android 4.3 - 5.1), latency: 0, supervision timeout: 20 sec.
public static final int CONNECTION_PRIORITY_LOW_POWER
Interval: 100 - 125 ms, latency: 2, supervision timeout: 20 sec.
@NonNull public ConnectionPriorityRequest setHandler(@NonNull android.os.Handler handler)
RequestBleManager will be used.setHandler in class Requesthandler - The handler to invoke callbacks for this request.@NonNull public ConnectionPriorityRequest done(@NonNull SuccessCallback callback)
Request@NonNull public ConnectionPriorityRequest 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 ConnectionPriorityRequest invalid(@NonNull InvalidRequestCallback callback)
Request@NonNull public ConnectionPriorityRequest before(@NonNull BeforeCallback callback)
Request@NonNull public ConnectionPriorityRequest with(@NonNull ConnectionPriorityCallback callback)
SimpleValueRequestawait(...) method;with in class SimpleValueRequest<ConnectionPriorityCallback>callback - the callback.@NonNull public <E extends ConnectionPriorityCallback> E await(@NonNull java.lang.Class<E> responseClass) throws RequestFailedException, DeviceDisconnectedException, BluetoothDisabledException, InvalidRequestException
SimpleValueRequest
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.
await in class SimpleValueRequest<ConnectionPriorityCallback>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.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).SimpleValueRequest.await(Object)@NonNull public <E extends ConnectionPriorityCallback> E await(@NonNull E response) throws RequestFailedException, DeviceDisconnectedException, BluetoothDisabledException, InvalidRequestException
SimpleValueRequest
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.
await in class SimpleValueRequest<ConnectionPriorityCallback>E - a response class.response - the response object.RequestFailedException - thrown when the BLE request finished with status other
than BluetoothGatt.GATT_SUCCESS.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).SimpleValueRequest.await(Class)