changeset 3:2be5bca648ab

switch to static functions
author Carl Byington <carl@five-ten-sg.com>
date Mon, 23 Jun 2014 17:05:16 -0700
parents f6a1aabf384f
children 46a9cdf018a1
files src/com/five_ten_sg/connectbot/monitor/MonitorActivity.java src/com/five_ten_sg/connectbot/monitor/MonitorService.java
diffstat 2 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/com/five_ten_sg/connectbot/monitor/MonitorActivity.java	Mon Jun 23 16:57:39 2014 -0700
+++ b/src/com/five_ten_sg/connectbot/monitor/MonitorActivity.java	Mon Jun 23 17:05:16 2014 -0700
@@ -68,7 +68,7 @@
     private void printer(String msg) {
         if (count < LINES) count++;
         else               start = (start+1) % LINES;
-        texts[(start+count-1) % LINES] = s + "\n";
+        texts[(start+count-1) % LINES] = msg + "\n";
         String c = "";
         for (int i=0; i<count; i++) c = c.concat(texts[(start+i) % LINES]);
         text.setText(c);
--- a/src/com/five_ten_sg/connectbot/monitor/MonitorService.java	Mon Jun 23 16:57:39 2014 -0700
+++ b/src/com/five_ten_sg/connectbot/monitor/MonitorService.java	Mon Jun 23 17:05:16 2014 -0700
@@ -43,13 +43,14 @@
     public  static final char MONITOR_CMD_DEPRESS      = 8;
 
     public static final int       MONITORPORT = 6000;
+    public static ConcurrentHashMap<Integer,CommunicationThread> clients = new ConcurrentHashMap<Integer,CommunicationThread>();
+    public static int             currentConnection = -1;
 
     private boolean               speech  = false;
     private TextToSpeech          talker  = null;
     public  Handler               handler = null;
     private ServerSocket          serverSocket;
     private Thread                serverThread = null;
-    private ConcurrentHashMap<Integer,CommunicationThread> clients = new ConcurrentHashMap<Integer,CommunicationThread>();
     private WifiManager.WifiLock  wifiLock;
     private PowerManager.WakeLock wakeLock;
     final private IBinder         binder = new MonitorBinder();
@@ -333,7 +334,7 @@
     ////////////////////////////////////////
     //// these functions are called from your monitoring code thread
 
-    public void teSetField(int connection, int l, int c, char[] buf) {
+    public static void teSetField(int connection, int l, int c, char[] buf) {
         int len = buf.length;
         Log.i(TAG, String.format("teSetField %d request line %d column %d len %d", connection, l, c, len));
         CommunicationThread cm = clients.get(connection);
@@ -347,7 +348,7 @@
         }
     }
 
-    public char[] teGetField(int connection, int l, int c, int len) {
+    public static char[] teGetField(int connection, int l, int c, int len) {
         Log.i(TAG, String.format("teGetField %d request line %d column %d len %d", connection, l, c, len));
         CommunicationThread cm = clients.get(connection);
         if (cm != null) {
@@ -368,7 +369,7 @@
         return new char[0];
     }
 
-    public void teScreenWatch(int connection, int l, int c, int len) {
+    public static void teScreenWatch(int connection, int l, int c, int len) {
         Log.i(TAG, String.format("teScreenWatch %d request line %d column %d len %d", connection, l, c, len));
         CommunicationThread cm = clients.get(connection);
         if (cm != null) {
@@ -380,7 +381,7 @@
         }
     }
 
-    public void teSpeak(int connection, String msg, boolean flush) {
+    public static void teSpeak(int connection, String msg, boolean flush) {
         if (speech) talker.speak(msg, (flush) ? TextToSpeech.QUEUE_FLUSH : TextToSpeech.QUEUE_ADD, null);
     }