| 
					
				 | 
			
			
				@@ -11080,6 +11080,10 @@ public class MainActivity extends WpadActivity { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     class ClientThread extends Thread { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         private Handler handler; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         private int menu, reason, position; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        int kind, roomNumber; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private int state = -9999; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String category; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        int dong = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         public ClientThread(Handler handler, int menu, int reason, int position) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             this.handler = handler; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -11088,20 +11092,53 @@ public class MainActivity extends WpadActivity { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             this.position = position; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        public ClientThread(Handler handler, int menu, int kind, int reason, int position, String category, int roomNumber, int state, int dong) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.handler = handler; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.menu = menu; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.kind = kind; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.reason = reason; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.position = position; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.category = category; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.roomNumber = roomNumber; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.state = state; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.dong = dong; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         public void run() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //String host = "10.1.1.1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            String host = "10.1."+position+".1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            String host = "10.1.1.1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(dong==0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                host = "10.1."+position+".1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                host = "10.1." + dong + ".1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             int port = 9998; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             String json = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             JSONObject jsonObject = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            JSONObject dataJsonObject = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                jsonObject.accumulate("type", "request"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                jsonObject.accumulate("timestamp", millToDate(System.currentTimeMillis())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                jsonObject.accumulate("wallpadip", myIP); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                jsonObject.accumulate("menu", menu); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                jsonObject.accumulate("reason", reason); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                jsonObject.accumulate("position", position); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if(reason==Common.JSON.REASON.DeviceInfo) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    jsonObject.accumulate("type", "request"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    jsonObject.accumulate("timestamp", millToDate(System.currentTimeMillis())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    jsonObject.accumulate("wallpadip", myIP); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    jsonObject.accumulate("menu", menu); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    jsonObject.accumulate("reason", reason); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    jsonObject.accumulate("position", position); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    jsonObject.accumulate("type", "request"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    jsonObject.accumulate("timestamp", millToDate(System.currentTimeMillis())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    jsonObject.accumulate("wallpadip", myIP); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    jsonObject.accumulate("menu", menu); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    jsonObject.accumulate("kind", kind); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    jsonObject.accumulate("reason", reason); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    jsonObject.accumulate("position", position); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (reason == Common.JSON.REASON.Control) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        dataJsonObject.accumulate("number", roomNumber); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        dataJsonObject.accumulate("category", category); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        dataJsonObject.accumulate("state", state); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    jsonObject.accumulate("data", dataJsonObject); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } catch (JSONException e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -11140,6 +11177,16 @@ public class MainActivity extends WpadActivity { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (socket != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    socket.close(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (inputStream != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    inputStream.close(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (outputStream != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    outputStream.close(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 final String response = String.valueOf(stb); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 Log.d("ClientThread", "response=" + response); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -11168,5 +11215,10 @@ public class MainActivity extends WpadActivity { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public void requestMultiControl(Handler handler, int menu, int kind, int reason, int position, String category, int number, int state, int dong) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ClientThread thread = new ClientThread(handler, menu, kind, reason, position, category, number, state, dong); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        thread.start(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 |