mirror of https://github.com/rusefi/RomRaider.git
Utec logging back in place
git-svn-id: http://svn.3splooges.com/romraider-arch/trunk@540 d2e2e1cd-ba16-0410-be16-b7c4453c7c2d
This commit is contained in:
parent
6d85ef77eb
commit
a1580eb825
|
@ -39,8 +39,8 @@ public class SerialParameters {
|
|||
@param portName New port name.
|
||||
*/
|
||||
public void setPortName(String portName) {
|
||||
//System.out.println("Set portName requested");
|
||||
this.portName = portName;
|
||||
System.out.println("Set portName chosen: "+portName);
|
||||
this.portName = portName;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -230,9 +230,12 @@ public class UtecSerialConnection implements SerialPortEventListener {
|
|||
*/
|
||||
public void openConnection() throws SerialConnectionException {
|
||||
|
||||
if(sPort == null){ System.err.println("No port selected or available to open."); return; }
|
||||
// if(sPort == null){ System.err.println("No port selected or available to open."); return; }
|
||||
|
||||
|
||||
if(parameters == null){
|
||||
System.err.println("No port selected or available to open.");
|
||||
return;
|
||||
}
|
||||
// Obtain a CommPortIdentifier object for the port you want to open.
|
||||
try {
|
||||
// System.out.println("PORT: "+parameters.getPortName());
|
||||
|
@ -240,7 +243,8 @@ public class UtecSerialConnection implements SerialPortEventListener {
|
|||
.getPortName());
|
||||
} catch (NoSuchPortException e) {
|
||||
System.err.println("Can't get commport identifier");
|
||||
throw new SerialConnectionException(e.getMessage());
|
||||
return;
|
||||
//throw new SerialConnectionException(e.getMessage());
|
||||
}
|
||||
|
||||
// Open the port represented by the CommPortIdentifier object. Give
|
||||
|
@ -308,6 +312,7 @@ public class UtecSerialConnection implements SerialPortEventListener {
|
|||
// portId.addPortOwnershipListener(this);
|
||||
|
||||
open = true;
|
||||
System.out.println("Port opened with success.");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -508,18 +513,19 @@ public class UtecSerialConnection implements SerialPortEventListener {
|
|||
|
||||
// Logger data
|
||||
else {
|
||||
/*
|
||||
|
||||
CommEvent commEvent = new CommEvent();
|
||||
commEvent.setLoggerData(new String(inputBuffer));
|
||||
commEvent.setLoggerData(true);
|
||||
|
||||
Iterator portIterator = portListeners.iterator();
|
||||
while (portIterator.hasNext()) {
|
||||
CommListener theListener = (CommListener) portIterator
|
||||
.next();
|
||||
theListener.getCommEvent(commEvent);
|
||||
CommListener theListener = (CommListener) portIterator.next();
|
||||
if(commEvent.isValidData() == true){
|
||||
theListener.getCommEvent(commEvent);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,8 @@ public class CommEvent {
|
|||
|
||||
private UtecMapData mapData = null;
|
||||
|
||||
private boolean isValidData = true;
|
||||
|
||||
public void setLoggerData(String buffer){
|
||||
UtecBuffer = buffer;
|
||||
StringTokenizer st = new StringTokenizer(UtecBuffer, ",");
|
||||
|
@ -82,6 +84,7 @@ public class CommEvent {
|
|||
doubleData[i] = Double.parseDouble(theData);
|
||||
}catch (NumberFormatException e) {
|
||||
System.out.println("Number error in commevent.");
|
||||
this.isValidData = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -147,4 +150,9 @@ public class CommEvent {
|
|||
public void setUtecBuffer(String utecBuffer) {
|
||||
UtecBuffer = utecBuffer;
|
||||
}
|
||||
|
||||
|
||||
public boolean isValidData() {
|
||||
return isValidData;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,11 +73,12 @@ public class UtecInterface{
|
|||
}
|
||||
|
||||
//No port yet chosen
|
||||
/*
|
||||
if(utecControl.parameters.getPortName().equalsIgnoreCase("")){
|
||||
System.err.println("No Port Yet Chosen, nothing to open");
|
||||
return;
|
||||
}
|
||||
|
||||
*/
|
||||
//Port is already opened, any port is open
|
||||
/*
|
||||
if(ISOPEN){
|
||||
|
@ -106,6 +107,7 @@ public class UtecInterface{
|
|||
public static void setPortChoice(String port){
|
||||
utecControl.closeConnection();
|
||||
utecControl.parameters.setPortName(port);
|
||||
openConnection();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -177,10 +177,12 @@ public class JutecGUI extends JFrame implements ActionListener,GetMapFromUtecLis
|
|||
item.setName(theName);
|
||||
item.addActionListener(this);
|
||||
portsMenu.add(item);
|
||||
/*
|
||||
if (counter == 1) {
|
||||
defaultPort = theName;
|
||||
UtecInterface.setPortChoice(defaultPort);
|
||||
}
|
||||
*/
|
||||
}
|
||||
menuBar.add(portsMenu);
|
||||
|
||||
|
|
Loading…
Reference in New Issue