From 5af46f7bd36305d267bbcec4315f53b2908f4cc9 Mon Sep 17 00:00:00 2001 From: Aleksander Nowakowski Date: Mon, 28 Nov 2022 15:20:07 +0100 Subject: [PATCH] Don't verify write without response operations --- .../java/no/nordicsemi/android/ble/WriteRequest.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ble/src/main/java/no/nordicsemi/android/ble/WriteRequest.java b/ble/src/main/java/no/nordicsemi/android/ble/WriteRequest.java index 5c426b5b..b1c00017 100644 --- a/ble/src/main/java/no/nordicsemi/android/ble/WriteRequest.java +++ b/ble/src/main/java/no/nordicsemi/android/ble/WriteRequest.java @@ -275,7 +275,7 @@ boolean notifyPacketSent(@NonNull final BluetoothDevice device, @Nullable final handler.post(() -> { if (progressCallback != null) { try { - progressCallback.onPacketSent(device, data, count); + progressCallback.onPacketSent(device, currentChunk, count); } catch (final Throwable t) { Log.e(TAG, "Exception in Progress callback", t); } @@ -293,7 +293,13 @@ boolean notifyPacketSent(@NonNull final BluetoothDevice device, @Nullable final } }); } - return Arrays.equals(data, currentChunk); + if (writeType == BluetoothGattCharacteristic.WRITE_TYPE_DEFAULT) { + // Compare the data received with the data sent. + return Arrays.equals(data, currentChunk); + } else { + // Don't check the data when using Write Without Response. + return true; + } } /**