|
@@ -36,6 +36,7 @@ import com.artncore.commons.define;
|
|
|
import com.artncore.wallpadapi.WallPadAPI;
|
|
|
import com.util.LogUtil;
|
|
|
|
|
|
+import org.json.JSONArray;
|
|
|
import org.json.JSONException;
|
|
|
import org.json.JSONObject;
|
|
|
|
|
@@ -225,7 +226,8 @@ public class MainActivity extends WpadActivity
|
|
|
wallpaddbmgr.AddressSet addc = wdb.getAddressMGR();
|
|
|
|
|
|
myIP = addc.IPAddress;
|
|
|
- myHo = Integer.valueOf(myIP.substring(myIP.length()-1));
|
|
|
+ myHo = addc.Ho;
|
|
|
+ ho = Integer.valueOf(myHo.substring(0,1));
|
|
|
}
|
|
|
catch (RuntimeException re) {
|
|
|
LogUtil.errorLogInfo("", TAG, re);
|
|
@@ -1939,7 +1941,8 @@ public class MainActivity extends WpadActivity
|
|
|
int mMultiAddress;
|
|
|
|
|
|
String myIP = "NONE";
|
|
|
- int myHo = 0;
|
|
|
+ String myHo = "NONE";
|
|
|
+ int ho = 0;
|
|
|
|
|
|
public String millToDate(long mills) {
|
|
|
String pattern = "yyyy-MM-dd'T'HH:mm:ss";
|
|
@@ -1950,26 +1953,26 @@ public class MainActivity extends WpadActivity
|
|
|
|
|
|
class ClientThread extends Thread {
|
|
|
private Handler handler;
|
|
|
- private String pwNum;
|
|
|
- private int menu, kind, reason, state, position;
|
|
|
+ private String value1;
|
|
|
+ private String value2;
|
|
|
+ private int menu, reason, state, position;
|
|
|
private int roomNumber;
|
|
|
|
|
|
- public ClientThread(Handler handler, int menu, int kind, int reason, int position, String pwNum) {
|
|
|
+ public ClientThread(Handler handler, int menu, int reason, int position, String value1, String value2) {
|
|
|
this.handler = handler;
|
|
|
this.menu = menu;
|
|
|
- this.kind = kind;
|
|
|
this.reason = reason;
|
|
|
this.position = position;
|
|
|
- this.pwNum = pwNum;
|
|
|
+ this.value1 = value1;
|
|
|
+ this.value2 = value2;
|
|
|
}
|
|
|
|
|
|
public void run() {
|
|
|
|
|
|
-
|
|
|
- String host = "10.1.1." + position;
|
|
|
+
|
|
|
+ String host = "10.1."+position+".1";
|
|
|
int port = 9998;
|
|
|
String json = "";
|
|
|
-
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
|
|
|
try {
|
|
@@ -1977,12 +1980,20 @@ public class MainActivity extends WpadActivity
|
|
|
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 == JSON.REASON.PassWordChange) {
|
|
|
- jsonObject.accumulate("number", pwNum);
|
|
|
+
|
|
|
+ if (menu == JSON.MENU.PASSWORD) {
|
|
|
+ jsonObject.accumulate("number", value1);
|
|
|
+ }
|
|
|
+
|
|
|
+ else if (menu == JSON.MENU.MOBILE) {
|
|
|
+ if(reason == JSON.REASON.MobileRegister) {
|
|
|
+ jsonObject.accumulate("name", value1);
|
|
|
+ jsonObject.accumulate("id", value2);
|
|
|
+ } else if(reason == JSON.REASON.MobileDelete) {
|
|
|
+ jsonObject.accumulate("id", value2);
|
|
|
+ }
|
|
|
}
|
|
|
} catch (JSONException e) {
|
|
|
e.printStackTrace();
|
|
@@ -2040,9 +2051,9 @@ public class MainActivity extends WpadActivity
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void requestMultiControl(Handler handler, int menu, int kind, int reason, int position, String pwNum) {
|
|
|
- if(position!=myHo) {
|
|
|
- ClientThread thread = new ClientThread(handler, menu, kind, reason, position, pwNum);
|
|
|
+ public void requestMultiControl(Handler handler, int menu, int reason, int position, String value1, String value2) {
|
|
|
+ if(position!=ho) {
|
|
|
+ ClientThread thread = new ClientThread(handler, menu, reason, position, value1, value2);
|
|
|
thread.start();
|
|
|
}
|
|
|
}
|