This commit is contained in:
Dmitry Isaenko 2019-02-11 21:35:43 +03:00
parent a5ee39ad69
commit f1c6f7985f
2 changed files with 8 additions and 6 deletions

View file

@ -19,7 +19,7 @@ import java.util.Locale;
import java.util.ResourceBundle; import java.util.ResourceBundle;
public class NSLMain extends Application { public class NSLMain extends Application {
static final String appVersion = "v0.1-DEVELOPMENT"; static final String appVersion = "v0.1";
@Override @Override
public void start(Stage primaryStage) throws Exception{ public void start(Stage primaryStage) throws Exception{
ResourceBundle rb; ResourceBundle rb;

View file

@ -433,8 +433,8 @@ class UsbCommunications extends Task<Void> {
return true; return true;
if ((currentOffset + readPice) >= receivedRangeSize ) if ((currentOffset + readPice) >= receivedRangeSize )
readPice = Math.toIntExact(receivedRangeSize - currentOffset); readPice = Math.toIntExact(receivedRangeSize - currentOffset);
System.out.println("CO: "+currentOffset+"\t\tEO: "+receivedRangeSize+"\t\tRP: "+readPice); // TODO: -----------------------DEBUG----------------- //System.out.println("CO: "+currentOffset+"\t\tEO: "+receivedRangeSize+"\t\tRP: "+readPice); // TODO: NOTE: -----------------------DEBUG-----------------
// updating progress bar if needed START // updating progress bar (if a lot of data requested) START BLOCK
if (isProgessBarInitiated){ if (isProgessBarInitiated){
try { try {
if (currentOffset+readPice == receivedRangeOffset){ if (currentOffset+readPice == receivedRangeOffset){
@ -451,7 +451,7 @@ class UsbCommunications extends Task<Void> {
if ((readPice == 8388608) && (currentOffset == 0)) if ((readPice == 8388608) && (currentOffset == 0))
isProgessBarInitiated = true; isProgessBarInitiated = true;
} }
// updating progress bar if needed END // updating progress bar if needed END BLOCK
bufferCurrent = new byte[readPice]; // TODO: not perfect moment, consider refactoring. bufferCurrent = new byte[readPice]; // TODO: not perfect moment, consider refactoring.
@ -587,12 +587,12 @@ class UsbCommunications extends Task<Void> {
printLog("Execution stopped", MsgType.FAIL); printLog("Execution stopped", MsgType.FAIL);
return null; return null;
} else { } else {
// DEBUG START----------------------------------------------------------------------------------------------
int trans = readBufTransferred.get(); int trans = readBufTransferred.get();
byte[] receivedBytes = new byte[trans]; byte[] receivedBytes = new byte[trans];
readBuffer.get(receivedBytes); readBuffer.get(receivedBytes);
/* DEBUG START----------------------------------------------------------------------------------------------
hexDumpUTF8(receivedBytes); hexDumpUTF8(receivedBytes);
// DEBUG END------------------------------------------------------------------------------------------------ // DEBUG END----------------------------------------------------------------------------------------------*/
return receivedBytes; return receivedBytes;
} }
} }
@ -625,6 +625,7 @@ class UsbCommunications extends Task<Void> {
/** /**
* Debug tool like hexdump <3 * Debug tool like hexdump <3
*/ */
/*
private void hexDumpUTF8(byte[] byteArray){ private void hexDumpUTF8(byte[] byteArray){
for (int i=0; i < byteArray.length; i++) for (int i=0; i < byteArray.length; i++)
System.out.print(String.format("%02d-", i%10)); System.out.print(String.format("%02d-", i%10));
@ -635,4 +636,5 @@ class UsbCommunications extends Task<Void> {
+ new String(byteArray, StandardCharsets.UTF_8) + new String(byteArray, StandardCharsets.UTF_8)
+ "\n"); + "\n");
} }
*/
} }