Clean up log messages, match code convention
Use single space after commas and between assignments.
This commit is contained in:
parent
18bdda9a37
commit
671ef3f000
|
@ -514,16 +514,18 @@ import no.nordicsemi.android.error.SecureDfuError;
|
||||||
// Increment iterator
|
// Increment iterator
|
||||||
currentChunk++;
|
currentChunk++;
|
||||||
attempt = 1;
|
attempt = 1;
|
||||||
|
//Mark this location after completion of successful transfer. In the event of a CRC retry on the next packet we will restart from this point.
|
||||||
mFirmwareStream.mark(0);
|
mFirmwareStream.mark(0);
|
||||||
} else {
|
} else {
|
||||||
|
String crcFailMessage = String.format(Locale.US, "CRC does not match! Expected %08X but found %08X.", crc, checksum.CRC32);
|
||||||
if (attempt < MAX_ATTEMPTS) {
|
if (attempt < MAX_ATTEMPTS) {
|
||||||
attempt++;
|
attempt++;
|
||||||
logi(String.format(Locale.US,"CRC does not match! Expected %08X Retrying...(%d/%d)",crc,attempt,MAX_ATTEMPTS));
|
crcFailMessage += String.format(Locale.US, " Retrying...(%d/%d)", attempt, MAX_ATTEMPTS);
|
||||||
mService.sendLogBroadcast(DfuBaseService.LOG_LEVEL_WARNING, "CRC does not match! Retrying...(" + attempt + "/" + MAX_ATTEMPTS + ")");
|
logi(crcFailMessage);
|
||||||
|
mService.sendLogBroadcast(DfuBaseService.LOG_LEVEL_WARNING, crcFailMessage);
|
||||||
try {
|
try {
|
||||||
|
// Reset the CRC and file pointer back to the previous mark() point after completion of the last successful packet.
|
||||||
mFirmwareStream.reset();
|
mFirmwareStream.reset();
|
||||||
final int crcAfterReset = (int) (((ArchiveInputStream) mFirmwareStream).getCrc32() & 0xFFFFFFFFL);
|
|
||||||
logi(String.format(Locale.US,"CRC after reset is %08X",crcAfterReset));
|
|
||||||
mProgressInfo.setBytesSent(checksum.offset - info.maxSize);
|
mProgressInfo.setBytesSent(checksum.offset - info.maxSize);
|
||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
loge("Error while resetting the firmware stream", e);
|
loge("Error while resetting the firmware stream", e);
|
||||||
|
@ -531,8 +533,8 @@ import no.nordicsemi.android.error.SecureDfuError;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
loge(String.format("CRC does not match! Expected %08X",crc));
|
loge(crcFailMessage);
|
||||||
mService.sendLogBroadcast(DfuBaseService.LOG_LEVEL_ERROR, "CRC does not match!");
|
mService.sendLogBroadcast(DfuBaseService.LOG_LEVEL_ERROR, crcFailMessage);
|
||||||
mService.terminateConnection(gatt, DfuBaseService.ERROR_CRC_ERROR);
|
mService.terminateConnection(gatt, DfuBaseService.ERROR_CRC_ERROR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue