Merge pull request #254 from NordicSemiconductor/pull/247
Modifications to #247
This commit is contained in:
commit
e720d006c9
|
@ -627,6 +627,13 @@ public abstract class DfuBaseService extends IntentService implements DfuProgres
|
||||||
* Thrown when device had to be paired before the DFU process was started.
|
* Thrown when device had to be paired before the DFU process was started.
|
||||||
*/
|
*/
|
||||||
public static final int ERROR_DEVICE_NOT_BONDED = ERROR_MASK | 0x0E;
|
public static final int ERROR_DEVICE_NOT_BONDED = ERROR_MASK | 0x0E;
|
||||||
|
/**
|
||||||
|
* Thrown when the DFU library lost track of what is going on. Reported number of bytes is
|
||||||
|
* not equal to the number of bytes sent and due to some other events the library cannot recover.
|
||||||
|
* <p>
|
||||||
|
* Check https://github.com/NordicSemiconductor/Android-DFU-Library/issues/229
|
||||||
|
*/
|
||||||
|
public static final int ERROR_PROGRESS_LOST = ERROR_MASK | 0x0F;
|
||||||
/**
|
/**
|
||||||
* Flag set when the DFU target returned a DFU error. Look for DFU specification to get error
|
* Flag set when the DFU target returned a DFU error. Look for DFU specification to get error
|
||||||
* codes. The error code is binary OR-ed with one of: {@link #ERROR_REMOTE_TYPE_LEGACY},
|
* codes. The error code is binary OR-ed with one of: {@link #ERROR_REMOTE_TYPE_LEGACY},
|
||||||
|
|
|
@ -653,6 +653,12 @@ class SecureDfuImpl extends BaseCustomDfuImpl {
|
||||||
loge("Error while reading firmware stream", e);
|
loge("Error while reading firmware stream", e);
|
||||||
mService.terminateConnection(gatt, DfuBaseService.ERROR_FILE_IO_EXCEPTION);
|
mService.terminateConnection(gatt, DfuBaseService.ERROR_FILE_IO_EXCEPTION);
|
||||||
return;
|
return;
|
||||||
|
} catch (final Throwable tr) {
|
||||||
|
// crash fix
|
||||||
|
// Check https://github.com/NordicSemiconductor/Android-DFU-Library/issues/229
|
||||||
|
loge("Progress lost. Bytes sent: " + mProgressInfo.getBytesSent(), tr);
|
||||||
|
mService.terminateConnection(gatt, DfuBaseService.ERROR_PROGRESS_LOST);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
// To decrease the chance of loosing data next time let's set PRN to 1.
|
// To decrease the chance of loosing data next time let's set PRN to 1.
|
||||||
// This will make the update very long, but perhaps it will succeed.
|
// This will make the update very long, but perhaps it will succeed.
|
||||||
|
|
Loading…
Reference in New Issue