Closedown
This commit is contained in:
@@ -3,6 +3,8 @@ import ch.psi.pshell.serial.SerialPortDevice;
|
||||
import ch.psi.pshell.serial.SerialPortDeviceConfig;
|
||||
import static ch.psi.utils.BitMask.*;
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/*
|
||||
*
|
||||
@@ -16,7 +18,30 @@ public class LaserUE extends SerialPortDevice{
|
||||
public LaserUE(String name, String port) {
|
||||
super(name, port, 921600, SerialPortDeviceConfig.DataBits.DB_8, SerialPortDeviceConfig.StopBits.SB_1, SerialPortDeviceConfig.Parity.None);
|
||||
this.setMode(Mode.FullDuplex);
|
||||
System.out.print("XXX");
|
||||
System.out.println("XXX");
|
||||
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
while(!isClosed()){
|
||||
try{
|
||||
if (isInitialized()){
|
||||
int rx;
|
||||
while ((rx = readByte()) >= 0) {
|
||||
onByte((byte) rx);
|
||||
}
|
||||
}
|
||||
} catch (Exception ex){
|
||||
System.err.println(ex);
|
||||
}
|
||||
try {
|
||||
Thread.sleep(10);
|
||||
} catch (InterruptedException ex) {
|
||||
Logger.getLogger(LaserUE.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
int value = 0;
|
||||
@@ -54,4 +79,5 @@ public class LaserUE extends SerialPortDevice{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user