#143 fixed
This commit is contained in:
parent
b8c88d0ecd
commit
a37e5328d7
|
@ -305,8 +305,12 @@ import no.nordicsemi.android.dfu.internal.scanner.BootloaderScannerFactory;
|
||||||
mInitPacketSizeInBytes = size;
|
mInitPacketSizeInBytes = size;
|
||||||
try {
|
try {
|
||||||
if (firmwareStream.markSupported()) {
|
if (firmwareStream.markSupported()) {
|
||||||
|
if (firmwareStream instanceof ArchiveInputStream) {
|
||||||
|
((ArchiveInputStream) firmwareStream).fullReset();
|
||||||
|
} else {
|
||||||
firmwareStream.reset();
|
firmwareStream.reset();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
size = firmwareStream.available();
|
size = firmwareStream.available();
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
size = 0;
|
size = 0;
|
||||||
|
|
|
@ -403,6 +403,23 @@ public class ArchiveInputStream extends InputStream {
|
||||||
crc32.update(currentSource, 0, bytesReadFromCurrentSource);
|
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.
|
* Returns number of bytes read until now.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue