From 5e5292020c4c83747ea7e9bebbdcf588df848794 Mon Sep 17 00:00:00 2001 From: gac-S_Changer Date: Thu, 31 Aug 2017 17:31:37 +0200 Subject: [PATCH] Closedown --- plugins/LaserUE.java | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/plugins/LaserUE.java b/plugins/LaserUE.java index f88628c..bfd6ba2 100644 --- a/plugins/LaserUE.java +++ b/plugins/LaserUE.java @@ -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{ } } } + }