-
public interface RxBleConnection.LongWriteOperationBuilderThe interface of a CharacteristicLongWriteOperation builder.
-
-
Method Summary
Modifier and Type Method Description abstract RxBleConnection.LongWriteOperationBuildersetBytes(@NonNull() Array<byte> bytes)Setter for a byte array to writeThis function MUST be called prior to build abstract RxBleConnection.LongWriteOperationBuildersetCharacteristicUuid(@NonNull() UUID uuid)Setter for a UUID of the BluetoothGattCharacteristic to write toThis function or setCharacteristic MUST be called prior to build abstract RxBleConnection.LongWriteOperationBuildersetCharacteristic(@NonNull() BluetoothGattCharacteristic bluetoothGattCharacteristic)Setter for a BluetoothGattCharacteristic to write toThis function or setCharacteristicUuid MUST be called prior to build abstract 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 abstract RxBleConnection.LongWriteOperationBuildersetWriteOperationRetryStrategy(@NonNull() RxBleConnection.WriteOperationRetryStrategy writeOperationRetryStrategy)Setter for a retry strategy in case something goes wrong when writing data. abstract RxBleConnection.LongWriteOperationBuildersetWriteOperationAckStrategy(@NonNull() RxBleConnection.WriteOperationAckStrategy writeOperationAckStrategy)Setter for a strategy used to mark batch write completed. abstract Observable<Array<byte>>build()Build function for the long write -
-
Method Detail
-
setBytes
abstract 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
abstract 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
abstract 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
abstract 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
-
setWriteOperationRetryStrategy
abstract 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
-
setWriteOperationAckStrategy
abstract 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.
-
-
-
-