Mercurial > 510Connectbot
comparison src/com/five_ten_sg/connectbot/service/TerminalMonitor.java @ 147:1350adb077b1
monitor key state tracking
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Sun, 22 Jun 2014 07:57:20 -0700 |
parents | 4dfa4dd791c1 |
children | 69333ca1563c |
comparison
equal
deleted
inserted
replaced
146:8754f293f2fd | 147:1350adb077b1 |
---|---|
22 public class TerminalMonitor { | 22 public class TerminalMonitor { |
23 public final static String TAG = "ConnectBot.TerminalMonitor"; | 23 public final static String TAG = "ConnectBot.TerminalMonitor"; |
24 | 24 |
25 public static final char MONITOR_CMD_INIT = 0; | 25 public static final char MONITOR_CMD_INIT = 0; |
26 public static final char MONITOR_CMD_ACTIVATE = 1; | 26 public static final char MONITOR_CMD_ACTIVATE = 1; |
27 public static final char MONITOR_CMD_HOSTDATA = 2; | 27 public static final char MONITOR_CMD_KEYSTATE = 2; |
28 public static final char MONITOR_CMD_CURSORMOVE = 3; | 28 public static final char MONITOR_CMD_CURSORMOVE = 3; |
29 public static final char MONITOR_CMD_SCREENCHANGE = 4; | 29 public static final char MONITOR_CMD_SCREENCHANGE = 4; |
30 public static final char MONITOR_CMD_FIELDVALUE = 5; | 30 public static final char MONITOR_CMD_FIELDVALUE = 5; |
31 public static final char MONITOR_CMD_SETFIELD = 5; | 31 public static final char MONITOR_CMD_SETFIELD = 5; |
32 public static final char MONITOR_CMD_GETFIELD = 6; | 32 public static final char MONITOR_CMD_GETFIELD = 6; |
314 | 314 |
315 public synchronized void activate() { | 315 public synchronized void activate() { |
316 sendScreen(MONITOR_CMD_ACTIVATE); | 316 sendScreen(MONITOR_CMD_ACTIVATE); |
317 } | 317 } |
318 | 318 |
319 public synchronized void hostData(byte[] b) { | 319 public synchronized void keyState(int b) { |
320 for (int i = 0; i < b.length; i++) { | |
321 hostData((int)b[i] & 0xff); | |
322 } | |
323 } | |
324 | |
325 public synchronized void hostData(int b) { | |
326 char[] arg = new char[3]; | 320 char[] arg = new char[3]; |
327 arg[2] = (char)(b & 0x0000ffff); | 321 arg[2] = (char)(b & 0x0000ffff); |
328 monitorWrite(MONITOR_CMD_HOSTDATA, arg); | 322 monitorWrite(MONITOR_CMD_KEYSTATE, arg); |
329 } | 323 } |
330 | 324 |
331 public synchronized void cursorMove(int l, int c) { | 325 public synchronized void cursorMove(int l, int c) { |
332 moved = true; | 326 moved = true; |
333 to_line = l; | 327 to_line = l; |