diff src/com/five_ten_sg/connectbot/transport/TN5250.java @ 45:80dcebe51af2 tn5250

start tn5250 integration
author Carl Byington <carl@five-ten-sg.com>
date Wed, 11 Jun 2014 09:54:18 -0700
parents 6b0f1ece1d91
children 34ce32c4e807
line wrap: on
line diff
--- a/src/com/five_ten_sg/connectbot/transport/TN5250.java	Wed Jun 11 09:30:50 2014 -0700
+++ b/src/com/five_ten_sg/connectbot/transport/TN5250.java	Wed Jun 11 09:54:18 2014 -0700
@@ -63,8 +63,39 @@
         hostmask = Pattern.compile("^([0-9a-z.-]+)(:(\\d+))?$", Pattern.CASE_INSENSITIVE);
     }
 
+
+    class vt320x5250 extends vt320 {
+        @Override
+        public void debug(String s) {
+            Log.d(TAG, s);
+        }
+        @Override
+        public void write(byte[] b) {
+        }
+        @Override
+        public void write(int b) {
+        }
+        // bridge.monitor placement of new characters
+        @Override
+        public void putChar(int c, int l, char ch, int attributes) {
+            if (bridge.monitor != null) bridge.monitor.screenChanged(l, c);
+            super.putChar(c, l, ch, attributes);
+        }
+        @Override
+        public void setCursorPosition(int c, int l) {
+            if (bridge.monitor != null) bridge.monitor.cursorMove(l, c);
+            super.setCursorPosition(c, l);
+        }
+    };
+
+
     class Terminal5250KeyListener extends TerminalKeyListener {
-
+        public TerminalKeyListener(TerminalManager manager,
+                                   TerminalBridge bridge,
+                                   vt320 buffer,
+                                   String encoding) {
+            super(manager, bridge, buffer, encoding);
+        }
     };
 
     public TN5250() {
@@ -219,6 +250,13 @@
 
 
     @Override
+    public vt320 getTransportBuffer() {
+        buffer = new vt320x5250();
+        return super();
+    }
+
+
+    @Override
     public int getDefaultPort() {
         return DEFAULT_PORT;
     }