Lint errors fixed
This commit is contained in:
parent
f62a4b45af
commit
a2707cd31b
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/../../nRFMasterControlPanel" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
|
||||
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/../../nRFToolbox" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="android-gradle" name="Android-Gradle">
|
||||
<configuration>
|
||||
|
|
|
@ -422,7 +422,7 @@ public abstract class DfuBaseService extends IntentService {
|
|||
*/
|
||||
private int mPacketsBeforeNotification = 10;
|
||||
|
||||
private byte[] mBuffer = new byte[MAX_PACKET_SIZE];
|
||||
private final byte[] mBuffer = new byte[MAX_PACKET_SIZE];
|
||||
private InputStream mInputStream;
|
||||
/**
|
||||
* Size of BIN content of all hex files that are going to be transmitted.
|
||||
|
|
|
@ -33,16 +33,15 @@ public class HexInputStream extends FilterInputStream {
|
|||
private int size;
|
||||
private int lastAddress;
|
||||
private int available, bytesRead;
|
||||
private int MBRsize;
|
||||
private final int MBRSize;
|
||||
|
||||
/**
|
||||
* Creates the HEX Input Stream. The constructor calculates the size of the BIN content which is available through {@link #sizeInBytes()}. If HEX file is invalid then the bin size is 0.
|
||||
*
|
||||
* @param in
|
||||
* the input stream to read from
|
||||
* @param trim
|
||||
* if <code>true</code> the bin data will be trimmed. All data from addresses < 0x1000 will be skipped. In the Soft Device 7.0.0 it's MBR space and this HEX fragment should not be
|
||||
* transmitted. However, other DFU implementations (f.e. without Soft Device) may require uploading the whole file.
|
||||
* @param mbrSize
|
||||
* The MBR (Master Boot Record) size in bytes. Data with addresses below than number will be trimmed and not transferred to DFU target.
|
||||
* @throws HexFileValidationException
|
||||
* if HEX file is invalid. F.e. there is no semicolon (':') on the beginning of each line.
|
||||
* @throws java.io.IOException
|
||||
|
@ -54,7 +53,7 @@ public class HexInputStream extends FilterInputStream {
|
|||
this.localPos = LINE_LENGTH; // we are at the end of the local buffer, new one must be obtained
|
||||
this.size = localBuf.length;
|
||||
this.lastAddress = 0;
|
||||
this.MBRsize = mbrSize;
|
||||
this.MBRSize = mbrSize;
|
||||
|
||||
this.available = calculateBinSize(mbrSize);
|
||||
}
|
||||
|
@ -65,7 +64,7 @@ public class HexInputStream extends FilterInputStream {
|
|||
this.localPos = LINE_LENGTH; // we are at the end of the local buffer, new one must be obtained
|
||||
this.size = localBuf.length;
|
||||
this.lastAddress = 0;
|
||||
this.MBRsize = mbrSize;
|
||||
this.MBRSize = mbrSize;
|
||||
|
||||
this.available = calculateBinSize(mbrSize);
|
||||
}
|
||||
|
@ -77,7 +76,7 @@ public class HexInputStream extends FilterInputStream {
|
|||
|
||||
int b, lineSize, offset, type;
|
||||
int lastBaseAddress = 0; // last Base Address, default 0
|
||||
int lastAddress = 0;
|
||||
int lastAddress;
|
||||
try {
|
||||
b = in.read();
|
||||
while (true) {
|
||||
|
@ -214,7 +213,7 @@ public class HexInputStream extends FilterInputStream {
|
|||
final InputStream in = this.in;
|
||||
|
||||
// temporary value
|
||||
int b = 0;
|
||||
int b;
|
||||
|
||||
int lineSize, type, offset;
|
||||
do {
|
||||
|
@ -249,7 +248,7 @@ public class HexInputStream extends FilterInputStream {
|
|||
switch (type) {
|
||||
case 0x00:
|
||||
// data type
|
||||
if (lastAddress + offset < MBRsize) { // skip MBR
|
||||
if (lastAddress + offset < MBRSize) { // skip MBR
|
||||
type = -1; // some other than 0
|
||||
pos += in.skip(lineSize * 2 /* 2 hex per one byte */+ 2 /* check sum */);
|
||||
}
|
||||
|
|
|
@ -43,11 +43,10 @@ public class ZipHexInputStream extends ZipInputStream {
|
|||
*
|
||||
* @param stream
|
||||
* the Zip Input Stream
|
||||
* @param mbrSize
|
||||
* The size of the MRB segment (Master Boot Record) on the device. The parser will cut data from addresses below that number from all HEX files.
|
||||
* @param types
|
||||
* files to read
|
||||
* @param trim
|
||||
* if <code>true</code> the bin data will be trimmed. All data from addresses < 0x1000 will be skipped. In the Soft Device 7.0.0 it's MBR space and this HEX fragment should not be
|
||||
* transmitted. However, other DFU implementations (f.e. without Soft Device) may require uploading the whole file.
|
||||
* File types that are to be read from the ZIP. Use {@link DfuBaseService#TYPE_APPLICATION} etc.
|
||||
* @throws java.io.IOException
|
||||
*/
|
||||
public ZipHexInputStream(final InputStream stream, final int mbrSize, final int types) throws IOException {
|
||||
|
@ -127,7 +126,7 @@ public class ZipHexInputStream extends ZipInputStream {
|
|||
currentSource = source;
|
||||
} else if (systemInit) {
|
||||
systemInitBytes = source;
|
||||
} else if (applicationInit) {
|
||||
} else { // if (applicationInit) - always true
|
||||
applicationInitBytes = source;
|
||||
}
|
||||
}
|
||||
|
@ -220,7 +219,7 @@ public class ZipHexInputStream extends ZipInputStream {
|
|||
* @return the new source, the same as {@link #currentSource}
|
||||
*/
|
||||
private byte[] startNextFile() {
|
||||
byte[] ret = null;
|
||||
byte[] ret;
|
||||
if (currentSource == softDeviceBytes && bootloaderBytes != null) {
|
||||
ret = currentSource = bootloaderBytes;
|
||||
} else if (currentSource != applicationBytes && applicationBytes != null) {
|
||||
|
|
Loading…
Reference in New Issue