From 7ab20d7dc514ec3f8af34b7fcdc06b41be041a1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=AD=E5=B0=8F=E5=87=A4?= Date: Thu, 11 Nov 2021 13:15:06 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=AD=E6=96=AD?= =?UTF-8?q?=E5=8D=87=E7=BA=A7=E5=90=8E=EF=BC=8C=E6=81=A2=E5=A4=8D=E5=8D=87?= =?UTF-8?q?=E7=BA=A7=E5=8F=AF=E8=83=BD=E5=8D=A1=E4=BD=8F=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E7=BB=A7=E7=BB=AD=E7=9A=84=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 详情: https://github.com/NordicSemiconductor/Android-DFU-Library/issues/252 --- dfu/src/main/java/no/nordicsemi/android/dfu/SecureDfuImpl.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dfu/src/main/java/no/nordicsemi/android/dfu/SecureDfuImpl.java b/dfu/src/main/java/no/nordicsemi/android/dfu/SecureDfuImpl.java index 2f738274..5a13ece6 100644 --- a/dfu/src/main/java/no/nordicsemi/android/dfu/SecureDfuImpl.java +++ b/dfu/src/main/java/no/nordicsemi/android/dfu/SecureDfuImpl.java @@ -565,6 +565,8 @@ private void sendFirmware(final BluetoothGatt gatt) throws RemoteDfuException, throw e; } mService.sendLogBroadcast(DfuBaseService.LOG_LEVEL_APPLICATION, "Data object already executed"); + // 到这里应该将错误标记清除,后续的流程才能正常执行。 + mRemoteErrorOccurred = false; } } else { resumeSendingData = true; From 4b1ef3ad9f717db8654d755ff554ad1489b6f084 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=AD=E5=B0=8F=E5=87=A4?= Date: Thu, 11 Nov 2021 13:27:31 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20DFU=20PROGRESS=20LOST?= =?UTF-8?q?=20=E9=94=99=E8=AF=AF=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 这个错误主要是在恢复DFU时,传输Object数据的时候,一次传输超过了 ObjectSize 大小,导致info.maxSize - bytesLost 变成了负数。 现在算是彻底解决了问题: https://github.com/NordicSemiconductor/Android-DFU-Library/issues/229 --- .../java/no/nordicsemi/android/dfu/BaseCustomDfuImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dfu/src/main/java/no/nordicsemi/android/dfu/BaseCustomDfuImpl.java b/dfu/src/main/java/no/nordicsemi/android/dfu/BaseCustomDfuImpl.java index a5808764..1b2d5ff6 100644 --- a/dfu/src/main/java/no/nordicsemi/android/dfu/BaseCustomDfuImpl.java +++ b/dfu/src/main/java/no/nordicsemi/android/dfu/BaseCustomDfuImpl.java @@ -373,8 +373,11 @@ void uploadFirmwareImage(final BluetoothGattCharacteristic packetCharacteristic) mFirmwareUploadInProgress = true; mPacketsSentSinceNotification = 0; - final byte[] buffer = mBuffer; try { + final int available = mProgressInfo.getAvailableObjectSizeIsBytes(); + byte[] buffer = mBuffer; + if (available < buffer.length) + buffer = new byte[available]; final int size = mFirmwareStream.read(buffer); mService.sendLogBroadcast(DfuBaseService.LOG_LEVEL_VERBOSE, "Sending firmware to characteristic " + packetCharacteristic.getUuid() + "..."); From 25c01187186a7e196e4ba086b361d33f068e2549 Mon Sep 17 00:00:00 2001 From: Aleksander Nowakowski Date: Wed, 8 Dec 2021 15:50:10 +0100 Subject: [PATCH 3/3] Translation to English --- dfu/src/main/java/no/nordicsemi/android/dfu/SecureDfuImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dfu/src/main/java/no/nordicsemi/android/dfu/SecureDfuImpl.java b/dfu/src/main/java/no/nordicsemi/android/dfu/SecureDfuImpl.java index 5a13ece6..5465699f 100644 --- a/dfu/src/main/java/no/nordicsemi/android/dfu/SecureDfuImpl.java +++ b/dfu/src/main/java/no/nordicsemi/android/dfu/SecureDfuImpl.java @@ -565,7 +565,7 @@ private void sendFirmware(final BluetoothGatt gatt) throws RemoteDfuException, throw e; } mService.sendLogBroadcast(DfuBaseService.LOG_LEVEL_APPLICATION, "Data object already executed"); - // 到这里应该将错误标记清除,后续的流程才能正常执行。 + // At this point, the error flag should be cleared, and the subsequent process can be executed normally. mRemoteErrorOccurred = false; } } else {