Summary
I use RxAndroidBle as the BLE communication framework in my project. I receive the data from the notification after writing in the following way:
public Observable<byte[]> requestCharacteristic(UUID notificationUuid, UUID writeUuid, byte[] writeData) {
return Observable.zip(
connectionObservable.concatMap(rxConnection -> rxConnection.setupNotification(notificationUuid))
.concatMap(rxConnection -> rxConnection).first(),
connectionObservable.concatMap(rxConnection -> rxConnection.writeCharacteristic(writeUuid, writeData)),
(responseBytes, writeBytes) -> { return responseBytes; }
);
}
Question
Because the BLE device needs to guarantee the synchronization request by the mobile phone, the request must be completed after the request execution is completed. I am not familiar with RX. How can I do the FIFO way to execute the above code?