comparison src/com/five_ten_sg/connectbot/service/TerminalMonitor.java @ 425:b284b8f9e535 stable-1.9.0-8

cleanup logging
author Carl Byington <carl@five-ten-sg.com>
date Fri, 31 Oct 2014 17:22:05 -0700
parents 09c1d3aae3f0
children
comparison
equal deleted inserted replaced
424:09c1d3aae3f0 425:b284b8f9e535
122 while (true) { 122 while (true) {
123 try { 123 try {
124 char[] len = forceRead(1); 124 char[] len = forceRead(1);
125 char[] packet = forceRead(len[0]); 125 char[] packet = forceRead(len[0]);
126 char cmd = packet[0]; 126 char cmd = packet[0];
127 Log.i(TAG, String.format("received %d command", (int)cmd)); 127 Log.i(TAG, String.format("received %s", commands[cmd]));
128 128
129 switch (cmd) { 129 switch (cmd) {
130 case MONITOR_CMD_SETFIELD: 130 case MONITOR_CMD_SETFIELD:
131 if (packet.length >= 3) 131 if (packet.length >= 3)
132 setField(packet[1], packet[2], packet, 3); 132 setField(packet[1], packet[2], packet, 3);
443 public synchronized void screenChanged(int l, int c) { 443 public synchronized void screenChanged(int l, int c) {
444 screenChanged(l, l, c, c); 444 screenChanged(l, l, c, c);
445 } 445 }
446 446
447 public synchronized void setField(int l, int c, char[] data, int offset) { 447 public synchronized void setField(int l, int c, char[] data, int offset) {
448 Log.i(TAG, "setField()");
449 int len = data.length - offset; 448 int len = data.length - offset;
450 char[] da = new char[len]; 449 char[] da = new char[len];
451 System.arraycopy(data, offset, da, 0, len); 450 System.arraycopy(data, offset, da, 0, len);
452 Log.i(TAG, String.format("setField(line %d, col %d, value %s)", l, c, new String(da))); 451 Log.i(TAG, String.format("setField(line %d, col %d, value %s)", l, c, new String(da)));
453 452
462 461
463 buffer.setField(l, c, da); 462 buffer.setField(l, c, da);
464 } 463 }
465 464
466 public synchronized void showUrl(char [] data, int offset) { 465 public synchronized void showUrl(char [] data, int offset) {
467 Log.i(TAG, "setField()");
468 char[] da = new char[data.length - offset]; 466 char[] da = new char[data.length - offset];
469 System.arraycopy(data, offset, da, 0, data.length - offset); 467 System.arraycopy(data, offset, da, 0, data.length - offset);
470 String url = new String(da); 468 String url = new String(da);
471 Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); 469 Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
472 parent.startActivity(intent); 470 parent.startActivity(intent);
492 490
493 monitorWrite(MONITOR_CMD_FIELDVALUE, arg2); 491 monitorWrite(MONITOR_CMD_FIELDVALUE, arg2);
494 } 492 }
495 493
496 public synchronized void screenWatch(int l, int c, int len) { 494 public synchronized void screenWatch(int l, int c, int len) {
497 Log.i(TAG, "screenWatch()"); 495 Log.i(TAG, String.format("screenWatch(line %d, col %d, len %d)", l, c, len));
498 start_line = l; 496 start_line = l;
499 end_line = l; 497 end_line = l;
500 start_column = c; 498 start_column = c;
501 end_column = c + len - 1; 499 end_column = c + len - 1;
502 } 500 }
503 501
504 public synchronized void depress(int vk_key) { 502 public synchronized void depress(int vk_key) {
505 Log.i(TAG, String.format("depress() %d", vk_key)); 503 Log.i(TAG, String.format("depress(%d)", vk_key));
506 Integer x = keymap.get(new Integer(vk_key)); 504 Integer x = keymap.get(new Integer(vk_key));
507 505
508 if (x != null) buffer.keyDepressed(x, ' ', 0); 506 if (x != null) buffer.keyDepressed(x, ' ', 0);
509 } 507 }
510 508
516 parent.startActivity(intent); 514 parent.startActivity(intent);
517 } 515 }
518 516
519 517
520 public synchronized void cursorRequest() { 518 public synchronized void cursorRequest() {
521 Log.i(TAG, "cursorRequest()");
522 cursorMoved(CURSOR_REQUESTED); 519 cursorMoved(CURSOR_REQUESTED);
523 } 520 }
524 521
525 } 522 }