Mercurial > 510Connectbot
changeset 103:1a34365fab9b
merge
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Tue, 17 Jun 2014 22:01:53 -0700 |
parents | 586b2eedb0d5 (current diff) 6802f1cd1add (diff) |
children | 171e0a977544 |
files | src/org/tn5250j/framework/tn5250/tnvt.java |
diffstat | 4 files changed, 27 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/src/com/five_ten_sg/connectbot/service/TerminalMonitor.java Mon Jun 16 18:02:30 2014 -0700 +++ b/src/com/five_ten_sg/connectbot/service/TerminalMonitor.java Tue Jun 17 22:01:53 2014 -0700 @@ -361,12 +361,12 @@ public synchronized void setField(int l, int c, char[] data, int offset) { Log.i(TAG, "setField()"); - byte[] b = new byte[data.length - offset]; + char[] da = new char[data.length - offset]; int i; - for (i=0; i<b.length; i++) { - b[i] = (byte)(data[i+offset] & 0x00ff); + for (i=0; i<da.length; i++) { + da[i] = data[i+offset]; } - buffer.write(b); + buffer.setField(l, c, da); } public synchronized void getField(int l, int c, int len) {
--- a/src/com/five_ten_sg/connectbot/transport/AbsTransport.java Mon Jun 16 18:02:30 2014 -0700 +++ b/src/com/five_ten_sg/connectbot/transport/AbsTransport.java Tue Jun 17 22:01:53 2014 -0700 @@ -50,6 +50,17 @@ Log.d(TAG, s); } + // monitor injecting a field + @Override + public void setField(int l, int c, char [] data) { + byte[] b = new byte[data.length]; + int i; + for (i=0; i<b.length; i++) { + b[i] = (byte)(data[i] & 0x00ff); + } + write(b); + } + // terminal key listener sending to the host @Override public void write(byte[] b) {
--- a/src/org/tn5250j/framework/tn5250/DataStreamProducer.java Mon Jun 16 18:02:30 2014 -0700 +++ b/src/org/tn5250j/framework/tn5250/DataStreamProducer.java Tue Jun 17 22:01:53 2014 -0700 @@ -14,14 +14,11 @@ import android.util.Log; -import de.mud.terminal.vt320; - public class DataStreamProducer implements Runnable { private static final String TAG = "DataStreamProducer"; private tnvt vt; private BufferedInputStream bin; - private vt320 buffer; private ByteArrayOutputStream baosin; private Thread me; private byte[] saveStream; @@ -34,10 +31,9 @@ - public DataStreamProducer(tnvt vt, BufferedInputStream bin, vt320 buffer, BlockingQueue<Object> queue, byte[] init) { + public DataStreamProducer(tnvt vt, BufferedInputStream bin, BlockingQueue<Object> queue, byte[] init) { this.bin = bin; this.vt = vt; - this.buffer = buffer; baosin = new ByteArrayOutputStream(); dsq = queue; abyte2 = init; @@ -167,7 +163,6 @@ int i = 0; while(!done) { - if (bin.available() == 0) buffer.testChanged(); i = bin.read(); // WVL - LDC : 16/07/2003 : TR.000345 @@ -355,4 +350,4 @@ // System.out.println(i + ">" + shit[i] + "< hex >" + Integer.toHexString((shit[i] & 0xff))); // } -} \ No newline at end of file +}
--- a/src/org/tn5250j/framework/tn5250/tnvt.java Mon Jun 16 18:02:30 2014 -0700 +++ b/src/org/tn5250j/framework/tn5250/tnvt.java Tue Jun 17 22:01:53 2014 -0700 @@ -77,7 +77,7 @@ import java.util.Properties; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.BlockingQueue; - +import java.util.concurrent.TimeUnit; import javax.net.ssl.SSLSocket; import android.content.Intent; @@ -140,6 +140,7 @@ private boolean cursorOn = false; private String hostname = ""; private int port = 23; + private vt320 buffer; private boolean connected = false; private boolean support132 = true; private ByteArrayOutputStream baosp = null; @@ -260,6 +261,7 @@ try { this.hostname = hostname; this.port = port; + this.buffer = buffer; try { screen52.getOIA().setInputInhibited(ScreenOIA.INPUTINHIBITED_SYSTEM_WAIT, @@ -298,7 +300,7 @@ } - producer = new DataStreamProducer(this, bin, buffer, dsq, abyte0); + producer = new DataStreamProducer(this, bin, dsq, abyte0); pthread = new Thread(producer); // pthread.setPriority(pthread.MIN_PRIORITY); pthread.setPriority(Thread.NORM_PRIORITY); @@ -986,7 +988,12 @@ while (keepTrucking) { try { - bk.initialize((byte[]) dsq.take()); + Object e = dsq.poll(0L, TimeUnit.SECONDS); + if (e == null) { + buffer.testChanged(); + e = dsq.take(); + }; + bk.initialize((byte[])e); } catch (InterruptedException ie) { Log.w(TAG," vt thread interrupted and stopping "); keepTrucking = false;