comparison src/com/five_ten_sg/connectbot/transport/TN5250.java @ 143:63f0f0267545

testing key codes
author Carl Byington <carl@five-ten-sg.com>
date Sat, 21 Jun 2014 16:23:57 -0700
parents 4fe73e73d4d7
children 03af90a2f0a9
comparison
equal deleted inserted replaced
142:e66667cc2473 143:63f0f0267545
60 60
61 private Screen5250 screen52; 61 private Screen5250 screen52;
62 private tnvt handler = null; 62 private tnvt handler = null;
63 private Socket socket; 63 private Socket socket;
64 private boolean connected = false; 64 private boolean connected = false;
65 private TerminalKeyListener keyListener = null;
65 66
66 static final Pattern hostmask; 67 static final Pattern hostmask;
67 static { 68 static {
68 hostmask = Pattern.compile("^([0-9a-z.-]+)(:(\\d+))?$", Pattern.CASE_INSENSITIVE); 69 hostmask = Pattern.compile("^([0-9a-z.-]+)(:(\\d+))?$", Pattern.CASE_INSENSITIVE);
69 } 70 }
144 145
145 // terminal key listener sending to local screen 146 // terminal key listener sending to local screen
146 @Override 147 @Override
147 public void write(byte[] b) { 148 public void write(byte[] b) {
148 if (bridge.monitor != null) bridge.monitor.hostData(b); 149 if (bridge.monitor != null) bridge.monitor.hostData(b);
149 150 if (b == 120) {
151 // special case x for testing
152 KeyEvent event = new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_F3);
153 keyListener.onKey(bridge.parent, event.getKeyCode(), event);
154 return;
155 }
150 screen52.sendKeys(new String(b)); 156 screen52.sendKeys(new String(b));
151 } 157 }
152 @Override 158 @Override
153 public void write(int b) { 159 public void write(int b) {
154 if (controls.containsKey(b)) { 160 if (controls.containsKey(b)) {
442 // we don't use a relay thread between the transport and the vt320 buffer 448 // we don't use a relay thread between the transport and the vt320 buffer
443 return false; 449 return false;
444 } 450 }
445 451
446 public TerminalKeyListener getTerminalKeyListener() { 452 public TerminalKeyListener getTerminalKeyListener() {
447 return new TerminalKeyListener(manager, bridge, buffer, host.getEncoding()); 453 keyListener = new TerminalKeyListener(manager, bridge, buffer, host.getEncoding());
454 return keyListener;
448 } 455 }
449 456
450 } 457 }