#143 fixed
This commit is contained in:
parent
b8c88d0ecd
commit
a37e5328d7
|
@ -305,7 +305,11 @@ import no.nordicsemi.android.dfu.internal.scanner.BootloaderScannerFactory;
|
|||
mInitPacketSizeInBytes = size;
|
||||
try {
|
||||
if (firmwareStream.markSupported()) {
|
||||
firmwareStream.reset();
|
||||
if (firmwareStream instanceof ArchiveInputStream) {
|
||||
((ArchiveInputStream) firmwareStream).fullReset();
|
||||
} else {
|
||||
firmwareStream.reset();
|
||||
}
|
||||
}
|
||||
size = firmwareStream.available();
|
||||
} catch (final Exception e) {
|
||||
|
|
|
@ -403,6 +403,23 @@ public class ArchiveInputStream extends InputStream {
|
|||
crc32.update(currentSource, 0, bytesReadFromCurrentSource);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets to the beginning of current stream.
|
||||
* If SD and BL were updated, the stream will be reset to the beginning.
|
||||
* If SD and BL were already sent and the current stream was changed to application,
|
||||
* this method will reset to the beginning of the application stream.
|
||||
*/
|
||||
public void fullReset() {
|
||||
// Reset stream to SoftDevice if SD and BL firmware were given separately
|
||||
if (softDeviceBytes != null && bootloaderBytes != null && currentSource == bootloaderBytes) {
|
||||
currentSource = softDeviceBytes;
|
||||
}
|
||||
// Reset the bytes count to 0
|
||||
bytesReadFromCurrentSource = 0;
|
||||
mark(0);
|
||||
reset();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns number of bytes read until now.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue