-
- All Implemented Interfaces:
-
com.polidea.rxandroidble2.RxBleConnection.LongWriteOperationBuilder
public final class LongWriteOperationBuilderImpl implements RxBleConnection.LongWriteOperationBuilder
-
-
Field Summary
Fields Modifier and Type Field Description RxBleConnection.WriteOperationAckStrategywriteOperationAckStrategyRxBleConnection.WriteOperationRetryStrategywriteOperationRetryStrategyArray<byte>bytes
-
Method Summary
Modifier and Type Method Description RxBleConnection.LongWriteOperationBuildersetWriteOperationAckStrategy(@NonNull() RxBleConnection.WriteOperationAckStrategy writeOperationAckStrategy)Setter for a strategy used to mark batch write completed. RxBleConnection.LongWriteOperationBuildersetWriteOperationRetryStrategy(@NonNull() RxBleConnection.WriteOperationRetryStrategy writeOperationRetryStrategy)Setter for a retry strategy in case something goes wrong when writing data. RxBleConnection.LongWriteOperationBuildersetBytes(@NonNull() Array<byte> bytes)Setter for a byte array to writeThis function MUST be called prior to build RxBleConnection.LongWriteOperationBuildersetCharacteristicUuid(@NonNull() UUID uuid)Setter for a UUID of the BluetoothGattCharacteristic to write toThis function or setCharacteristic MUST be called prior to build RxBleConnection.LongWriteOperationBuildersetCharacteristic(@NonNull() BluetoothGattCharacteristic bluetoothGattCharacteristic)Setter for a BluetoothGattCharacteristic to write toThis function or setCharacteristicUuid MUST be called prior to build RxBleConnection.LongWriteOperationBuildersetMaxBatchSize(int maxBatchSize)Setter for a maximum size of a byte array that may be write at onceIf this is not specified - the default value of the connection's MTU is used Observable<Array<byte>>build()Build function for the long write -
Methods inherited from class com.polidea.rxandroidble2.RxBleConnection.LongWriteOperationBuilder
setCharacteristicUuid, setMaxBatchSize, setWriteOperationAckStrategy, setWriteOperationRetryStrategy -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
setWriteOperationAckStrategy
RxBleConnection.LongWriteOperationBuilder setWriteOperationAckStrategy(@NonNull() RxBleConnection.WriteOperationAckStrategy writeOperationAckStrategy)
Setter for a strategy used to mark batch write completed. Only after previous batch has finished, the next (if any left) can bewritten.If this is not specified - the next batch of bytes is written right after the previous one has finished.A bytes batch is a part (slice) of the original byte array to write. Imagine a byte array of {0, 1, 2, 3, 4} where the maximumnumber of bytes that may be transmitted at once is 2. Then the original byte array will be transmitted in three batches: {0, 1}, {2, 3}, {4}It is expected that the Observable returned from the writeOperationAckStrategy will emit exactly the same events as the source,however you may delay them at your pace.
- Parameters:
writeOperationAckStrategy- the function that acknowledges writing of the batch of bytes.
-
setWriteOperationRetryStrategy
RxBleConnection.LongWriteOperationBuilder setWriteOperationRetryStrategy(@NonNull() RxBleConnection.WriteOperationRetryStrategy writeOperationRetryStrategy)
Setter for a retry strategy in case something goes wrong when writing data. If any BleException is raised,a WriteOperationRetryStrategy.LongWriteFailure object is emitted. WriteOperationRetryStrategy.LongWriteFailure contains both the BleException and the batch numberfor which the write request failed. The WriteOperationRetryStrategy.LongWriteFailure emitted by thewriteOperationRetryStrategy will be used to retry the specified batch number write request.If this is not specified - if batch write fails, the long write operation is stopped and whole operation is interrupted.It is expected that the Observable returned from the writeOperationRetryStrategy will emit exactly the same events as the source,however you may delay them at your pace.
- Parameters:
writeOperationRetryStrategy- the retry strategy
-
setBytes
RxBleConnection.LongWriteOperationBuilder setBytes(@NonNull() Array<byte> bytes)
Setter for a byte array to writeThis function MUST be called prior to build
- Parameters:
bytes- the bytes to write
-
setCharacteristicUuid
RxBleConnection.LongWriteOperationBuilder setCharacteristicUuid(@NonNull() UUID uuid)
Setter for a UUID of the BluetoothGattCharacteristic to write toThis function or setCharacteristic MUST be called prior to build
- Parameters:
uuid- the UUID
-
setCharacteristic
RxBleConnection.LongWriteOperationBuilder setCharacteristic(@NonNull() BluetoothGattCharacteristic bluetoothGattCharacteristic)
Setter for a BluetoothGattCharacteristic to write toThis function or setCharacteristicUuid MUST be called prior to build
- Parameters:
bluetoothGattCharacteristic- the BluetoothGattCharacteristic
-
setMaxBatchSize
RxBleConnection.LongWriteOperationBuilder setMaxBatchSize(int maxBatchSize)
Setter for a maximum size of a byte array that may be write at onceIf this is not specified - the default value of the connection's MTU is used
- Parameters:
maxBatchSize- the maximum size of a byte array to write at once
-
-
-
-