-
public interface RxBleCustomOperation<T>Represents a custom operation that will be enqueued for future execution within the client instance.
-
-
Method Summary
Modifier and Type Method Description abstract Observable<T>asObservable(BluetoothGatt bluetoothGatt, RxBleGattCallback rxBleGattCallback, Scheduler scheduler)Return an observable that implement a custom operation using low-level Android BLE API. -
-
Method Detail
-
asObservable
@NonNull() abstract Observable<T> asObservable(BluetoothGatt bluetoothGatt, RxBleGattCallback rxBleGattCallback, Scheduler scheduler)
Return an observable that implement a custom operation using low-level Android BLE API.
The Observable returned by this method will be subscribed to by the ConnectionOperationQueue when it determines that the custom operation should be the next to be run.
The method receives everything needed to access the low-level Android BLE API objects mainly the BluetoothGatt to interact with Android BLE GATT operations and RxBleGattCallback to be notified when GATT operations completes.
Every event emitted by the returned Observable will be forwarded to the observablereturned by queue
As the implementer, your contract is to return an Observable that completes at somepoint in time. When the returned observable terminates, either via the onComplete or onError callback, the ConnectionOperationQueue queue's lock is released so thatqueue operations can continue.
You must ensure the returned Observable do terminate either via
{@code onCompleted}or{@code onError(Throwable)}. Otherwise, the internal queue orchestrator will wait forever foryour Observable to complete and the it will not continue to process queued operations.- Parameters:
bluetoothGatt- The Android API GATT instancerxBleGattCallback- The internal Rx ready bluetooth gatt callback to be notified of GATT operationsscheduler- The ClientOperationQueue scheduler used to asObservable operation
-
-
-
-