comparison src/com/five_ten_sg/connectbot/service/TerminalBridge.java @ 29:017eeed8332c tn5250

start tn5250 integration
author Carl Byington <carl@five-ten-sg.com>
date Tue, 03 Jun 2014 16:02:29 -0700
parents 0ce5cc452d02
children 139394237973
comparison
equal deleted inserted replaced
28:ad194aedeaab 29:017eeed8332c
305 buffer.setBufferSize(0); 305 buffer.setBufferSize(0);
306 306
307 resetColors(); 307 resetColors();
308 buffer.setDisplay(this); 308 buffer.setDisplay(this);
309 selectionArea = new SelectionArea(); 309 selectionArea = new SelectionArea();
310 keyListener = new TerminalKeyListener(manager, this, buffer, host.getEncoding()); 310 }
311
312 public PromptHelper getPromptHelper() {
313 return promptHelper;
314 }
315
316 /**
317 * Spawn thread to open connection and start login process.
318 */
319 protected void startConnection() {
320 transport = TransportFactory.getTransport(host.getProtocol());
321 keyListener = transport.getTerminalKeyListener(manager, this, buffer, host.getEncoding());
311 322
312 String monitor_init = host.getMonitor(); 323 String monitor_init = host.getMonitor();
313 if ((monitor_init != null) && (monitor_init.length() > 0)) { 324 if ((monitor_init != null) && (monitor_init.length() > 0)) {
314 monitor = new TerminalMonitor(manager, buffer, keyListener, parent, monitor_init); 325 monitor = new TerminalMonitor(manager, buffer, keyListener, parent, monitor_init);
315 } 326 }
316 } 327
317
318 public PromptHelper getPromptHelper() {
319 return promptHelper;
320 }
321
322 /**
323 * Spawn thread to open connection and start login process.
324 */
325 protected void startConnection() {
326 transport = TransportFactory.getTransport(host.getProtocol());
327 transport.setBridge(this); 328 transport.setBridge(this);
328 transport.setManager(manager); 329 transport.setManager(manager);
329 transport.setHost(host); 330 transport.setHost(host);
330 // TODO make this more abstract so we don't litter on AbsTransport
331 transport.setCompression(host.getCompression()); 331 transport.setCompression(host.getCompression());
332 transport.setHttpproxy(host.getHttpproxy()); 332 transport.setHttpproxy(host.getHttpproxy());
333 transport.setUseAuthAgent(host.getUseAuthAgent()); 333 transport.setUseAuthAgent(host.getUseAuthAgent());
334 transport.setEmulation(emulation); 334 transport.setEmulation(emulation);
335 335
439 buffer.setBackspace(vt320.DELETE_IS_BACKSPACE); 439 buffer.setBackspace(vt320.DELETE_IS_BACKSPACE);
440 else 440 else
441 buffer.setBackspace(vt320.DELETE_IS_DEL); 441 buffer.setBackspace(vt320.DELETE_IS_DEL);
442 442
443 // create thread to relay incoming connection data to buffer 443 // create thread to relay incoming connection data to buffer
444 relay = new Relay(this, transport, buffer, host.getEncoding()); 444 // only if needed by the transport
445 Thread relayThread = new Thread(relay); 445 if (transport.needsRelay()) {
446 relayThread.setDaemon(true); 446 relay = new Relay(this, transport, buffer, host.getEncoding());
447 relayThread.setName("Relay"); 447 Thread relayThread = new Thread(relay);
448 relayThread.start(); 448 relayThread.setDaemon(true);
449 relayThread.setName("Relay");
450 relayThread.start();
451 }
452
449 // force font-size to make sure we resizePTY as needed 453 // force font-size to make sure we resizePTY as needed
450 setFontSize(fontSize); 454 setFontSize(fontSize);
451 // finally send any post-login string, if requested 455 // finally send any post-login string, if requested
452 injectString(host.getPostLogin()); 456 injectString(host.getPostLogin());
453 } 457 }
673 } 677 }
674 catch (Exception e) { 678 catch (Exception e) {
675 Log.e(TAG, "Problem while trying to resize screen or PTY", e); 679 Log.e(TAG, "Problem while trying to resize screen or PTY", e);
676 } 680 }
677 681
678 // redraw local output if we don't have a sesson to receive our resize request 682 // redraw local output if we don't have a session to receive our resize request
679 if (transport == null) { 683 if (transport == null) {
680 synchronized (localOutput) { 684 synchronized (localOutput) {
681 buffer.reset(); 685 buffer.reset();
682 686
683 for (String line : localOutput) 687 for (String line : localOutput)