public class ServiceDiscoveryOperation extends SingleResponseOperation<RxBleDeviceServices>
| Modifier and Type | Method and Description |
|---|---|
protected <any> |
getCallback(RxBleGattCallback rxBleGattCallback)
A function that should return
Observable derived from the passed RxBleGattCallback. |
protected boolean |
startOperation(android.bluetooth.BluetoothGatt bluetoothGatt)
A function that should call the passed
BluetoothGatt and return `true` if the call has succeeded. |
protected <any> |
timeoutFallbackProcedure(android.bluetooth.BluetoothGatt bluetoothGatt,
RxBleGattCallback rxBleGattCallback,
Scheduler timeoutScheduler)
Sometimes it happens that the
BluetoothGatt will receive all BluetoothGattService's,
BluetoothGattCharacteristic's and BluetoothGattDescriptor
but it won't receive the final callback that the service discovery was completed. |
java.lang.String |
toString() |
protectedRun, provideExceptioncompareTo, definedPriority, runprotected <any> getCallback(RxBleGattCallback rxBleGattCallback)
SingleResponseOperationObservable derived from the passed RxBleGattCallback.
The returned Observable will be automatically unsubscribed after the first emission.
The returned Observable is a subject to Observable#timeout(long, TimeUnit, Scheduler, io.reactivex.ObservableSource)
and by default it will throw BleGattCallbackTimeoutException. This behaviour can be overridden by overriding
SingleResponseOperation.timeoutFallbackProcedure(BluetoothGatt, RxBleGattCallback, Scheduler).getCallback in class SingleResponseOperation<RxBleDeviceServices>rxBleGattCallback - the RxBleGattCallback to useprotected boolean startOperation(android.bluetooth.BluetoothGatt bluetoothGatt)
SingleResponseOperationBluetoothGatt and return `true` if the call has succeeded.startOperation in class SingleResponseOperation<RxBleDeviceServices>bluetoothGatt - the BluetoothGatt to useprotected <any> timeoutFallbackProcedure(android.bluetooth.BluetoothGatt bluetoothGatt,
RxBleGattCallback rxBleGattCallback,
Scheduler timeoutScheduler)
BluetoothGatt will receive all BluetoothGattService's,
BluetoothGattCharacteristic's and BluetoothGattDescriptor
but it won't receive the final callback that the service discovery was completed. This is a potential workaround.
There is a change in Android 7.0.0_r1 where all data is received at once - in this situation returned services size will be always 0 https://android.googlesource.com/platform/frameworks/base/+/android-7.0.0_r1/core/java/android/bluetooth/BluetoothGatt.java#206 https://android.googlesource.com/platform/frameworks/base/+/android-6.0.1_r72/core/java/android/bluetooth/BluetoothGatt.java#205
timeoutFallbackProcedure in class SingleResponseOperation<RxBleDeviceServices>bluetoothGatt - the BluetoothGatt to userxBleGattCallback - the RxBleGattCallback to usetimeoutScheduler - the Scheduler for timeout to useRxBleDeviceServices or TimeoutExceptionpublic java.lang.String toString()
toString in class SingleResponseOperation<RxBleDeviceServices>