I'm doing a long write operation, sending 16 byte batches at a time. I'd like to have a progress bar show the progress of the long write to the user, so I need some sort of callback for each time a batch has been written.
From the documentation, it looked like setWriteOperationAckStrategy
does this. However, when running the following code, I only end up seeing one message output to the log. What am I doing wrong here?
subscription = connection.flatMap(rxBleConnection -> rxBleConnection.createNewLongWriteBuilder()
.setCharacteristicUuid(uuid)
.setBytes(bytes)
.setMaxBatchSize(16)
.setWriteOperationAckStrategy(new RxBleConnection.WriteOperationAckStrategy() {
@Override
public Observable<Boolean> call(Observable<Boolean> booleanObservable) {
Log.d("TEST", "batch written");
return booleanObservable;
}
})
.build()