comparison src/com/five_ten_sg/connectbot/service/TerminalMonitor.java @ 424:09c1d3aae3f0

updateDirty before testChanged, try to eliminate sending duplicate screenChanged to the monitor
author Carl Byington <carl@five-ten-sg.com>
date Fri, 31 Oct 2014 12:40:09 -0700
parents 651aff5a46c7
children b284b8f9e535
comparison
equal deleted inserted replaced
423:76efe8fa29b9 424:09c1d3aae3f0
39 public static final char MONITOR_CMD_SCREENWATCH = 7; 39 public static final char MONITOR_CMD_SCREENWATCH = 7;
40 public static final char MONITOR_CMD_DEPRESS = 8; 40 public static final char MONITOR_CMD_DEPRESS = 8;
41 public static final char MONITOR_CMD_SHOWURL = 9; 41 public static final char MONITOR_CMD_SHOWURL = 9;
42 public static final char MONITOR_CMD_SWITCHSESSION = 10; 42 public static final char MONITOR_CMD_SWITCHSESSION = 10;
43 public static final char MONITOR_CMD_CURSORREQUEST = 11; 43 public static final char MONITOR_CMD_CURSORREQUEST = 11;
44
45 public static final String[] commands = {
46 "cmd_init",
47 "cmd_activate",
48 "cmd_keystate",
49 "cmd_cursormove",
50 "cmd_screenchange",
51 "cmd_fieldvalue/setfield",
52 "cmd_getfield",
53 "cmd_screenwatch",
54 "cmd_depress",
55 "cmd_showurl",
56 "cmd_switchsession",
57 "cmd_cursorrequest"
58 };
44 59
45 public static final char CURSOR_REQUESTED = 0; 60 public static final char CURSOR_REQUESTED = 0;
46 public static final char CURSOR_SCREEN_CHANGE = 1; 61 public static final char CURSOR_SCREEN_CHANGE = 1;
47 public static final char CURSOR_USER_KEY = 2; 62 public static final char CURSOR_USER_KEY = 2;
48 63
328 public synchronized void monitorWrite(char cmd, char[] c) { 343 public synchronized void monitorWrite(char cmd, char[] c) {
329 try { 344 try {
330 if (monitor_out != null) { 345 if (monitor_out != null) {
331 c[0] = (char)(c.length - 1); // number of chars following 346 c[0] = (char)(c.length - 1); // number of chars following
332 c[1] = cmd; 347 c[1] = cmd;
333 //Log.i(TAG, String.format("sending %d command", (int)cmd)); 348 Log.i(TAG, String.format("sending %s", commands[cmd]));
334 monitor_out.write(charsToBytes(c)); 349 monitor_out.write(charsToBytes(c));
350 monitor_out.flush();
335 } 351 }
336 else { 352 else {
337 c[1] = cmd; 353 c[1] = cmd;
338 pending_commands.offer(c); 354 pending_commands.offer(c);
339 } 355 }