mirror of https://github.com/rusefi/RomRaider.git
Cleaned up nasty code a bit, still nasty though.
git-svn-id: http://svn.3splooges.com/romraider-arch/trunk@568 d2e2e1cd-ba16-0410-be16-b7c4453c7c2d
This commit is contained in:
parent
6d0f1d1e24
commit
cb2757ad37
|
@ -25,7 +25,7 @@ import enginuity.logger.utec.properties.UtecProperties;
|
|||
// CommPortOwnershipListener {
|
||||
import gnu.io.*;
|
||||
|
||||
public class UtecSerialConnection{
|
||||
public class UtecSerialConnectionManager{
|
||||
|
||||
|
||||
|
||||
|
@ -54,9 +54,9 @@ public class UtecSerialConnection{
|
|||
private static UtecSerialListener serialListener = null;
|
||||
|
||||
public static void init(UtecSerialListener se){
|
||||
UtecSerialConnection.setSerialListener(se);
|
||||
UtecSerialConnectionManager.setSerialListener(se);
|
||||
try {
|
||||
UtecSerialConnection.setConnectionParameters();
|
||||
UtecSerialConnectionManager.setConnectionParameters();
|
||||
} catch (SerialConnectionException e) {
|
||||
System.out.println("Error initializing the connection parameters.");
|
||||
e.printStackTrace();
|
||||
|
@ -185,7 +185,7 @@ public class UtecSerialConnection{
|
|||
* If set fails return the parameters object to origional settings and throw
|
||||
* exception.
|
||||
*/
|
||||
public static void setConnectionParameters() throws SerialConnectionException {
|
||||
private static void setConnectionParameters() throws SerialConnectionException {
|
||||
|
||||
if (sPort == null) {
|
||||
System.err.println("No port selected.");
|
||||
|
@ -256,7 +256,7 @@ public class UtecSerialConnection{
|
|||
/**
|
||||
* Send a one second break signal.
|
||||
*/
|
||||
public static void sendBreak() {
|
||||
private static void sendBreak() {
|
||||
sPort.sendBreak(1000);
|
||||
}
|
||||
|
||||
|
@ -266,7 +266,7 @@ public class UtecSerialConnection{
|
|||
* @param serialListener
|
||||
*/
|
||||
public static void setSerialListener(UtecSerialListener serialListener) {
|
||||
UtecSerialConnection.serialListener = serialListener;
|
||||
UtecSerialConnectionManager.serialListener = serialListener;
|
||||
}
|
||||
|
||||
/**
|
|
@ -2,7 +2,7 @@ package enginuity.logger.utec.commEvent;
|
|||
|
||||
import java.util.TimerTask;
|
||||
|
||||
import enginuity.logger.utec.comm.UtecSerialConnection;
|
||||
import enginuity.logger.utec.comm.UtecSerialConnectionManager;
|
||||
import enginuity.logger.utec.gui.JutecGUI;
|
||||
|
||||
public class UtecTimerTask extends TimerTask{
|
||||
|
@ -27,7 +27,7 @@ public class UtecTimerTask extends TimerTask{
|
|||
System.out.println("->"+theChar+"<- :"+(int)theChar+"");
|
||||
|
||||
//Send the data to the Utec
|
||||
UtecSerialConnection.sendCommandToUtec((int)theChar);
|
||||
UtecSerialConnectionManager.sendCommandToUtec((int)theChar);
|
||||
|
||||
counter++;
|
||||
JutecGUI.getInstance().getJProgressBar().setValue(counter);
|
||||
|
|
|
@ -44,7 +44,7 @@ public class UtecInterface{
|
|||
*
|
||||
*/
|
||||
public static void init(){
|
||||
UtecSerialConnection.init(serialEventListener);
|
||||
UtecSerialConnectionManager.init(serialEventListener);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -250,7 +250,7 @@ public class UtecInterface{
|
|||
* @return
|
||||
*/
|
||||
public static String getPortChoiceUsed(){
|
||||
return UtecSerialConnection.parameters.getPortName();
|
||||
return UtecSerialConnectionManager.parameters.getPortName();
|
||||
}
|
||||
|
||||
|
||||
|
@ -270,7 +270,7 @@ public class UtecInterface{
|
|||
* @param portName
|
||||
*/
|
||||
private static void openConnection(){
|
||||
if(UtecSerialConnection.isOpen()){
|
||||
if(UtecSerialConnectionManager.isOpen()){
|
||||
System.out.println("Port is already open.");
|
||||
return;
|
||||
}
|
||||
|
@ -278,7 +278,7 @@ public class UtecInterface{
|
|||
|
||||
//Attempt to make connection
|
||||
try{
|
||||
UtecSerialConnection.openConnection();
|
||||
UtecSerialConnectionManager.openConnection();
|
||||
}catch(SerialConnectionException e){
|
||||
System.err.println("Error opening serial port connection");
|
||||
e.printStackTrace();
|
||||
|
@ -292,7 +292,7 @@ public class UtecInterface{
|
|||
*
|
||||
*/
|
||||
public static void closeConnection(){
|
||||
UtecSerialConnection.closeConnection();
|
||||
UtecSerialConnectionManager.closeConnection();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -300,8 +300,8 @@ public class UtecInterface{
|
|||
* @param port
|
||||
*/
|
||||
public static void setPortChoice(String port){
|
||||
UtecSerialConnection.closeConnection();
|
||||
UtecSerialConnection.parameters.setPortName(port);
|
||||
UtecSerialConnectionManager.closeConnection();
|
||||
UtecSerialConnectionManager.parameters.setPortName(port);
|
||||
openConnection();
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package enginuity.logger.utec.commInterface;
|
|||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
|
||||
import enginuity.logger.utec.comm.UtecSerialConnection;
|
||||
import enginuity.logger.utec.comm.UtecSerialConnectionManager;
|
||||
import enginuity.logger.utec.commEvent.LoggerEvent;
|
||||
import enginuity.logger.utec.commEvent.LoggerListener;
|
||||
import enginuity.logger.utec.gui.mapTabs.UtecDataManager;
|
||||
|
@ -29,7 +29,7 @@ public class UtecSerialListener implements SerialPortEventListener {
|
|||
// Append new output to buffer
|
||||
while (newData != -1) {
|
||||
try {
|
||||
newData = UtecSerialConnection.getInputFromUtecStream().read();
|
||||
newData = UtecSerialConnectionManager.getInputFromUtecStream().read();
|
||||
|
||||
// Invalid data
|
||||
if (newData == -1) {
|
||||
|
|
Loading…
Reference in New Issue