|
@@ -1,11 +1,13 @@
|
|
package kr.co.icontrols.wallpadconfig;
|
|
package kr.co.icontrols.wallpadconfig;
|
|
|
|
|
|
import android.annotation.SuppressLint;
|
|
import android.annotation.SuppressLint;
|
|
|
|
+import android.app.Activity;
|
|
import android.content.BroadcastReceiver;
|
|
import android.content.BroadcastReceiver;
|
|
import android.content.Context;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.content.Intent;
|
|
import android.content.IntentFilter;
|
|
import android.content.IntentFilter;
|
|
import android.graphics.Color;
|
|
import android.graphics.Color;
|
|
|
|
+import android.os.AsyncTask;
|
|
import android.os.Bundle;
|
|
import android.os.Bundle;
|
|
import android.os.Handler;
|
|
import android.os.Handler;
|
|
import android.os.Message;
|
|
import android.os.Message;
|
|
@@ -15,6 +17,7 @@ import android.view.KeyEvent;
|
|
import android.view.MotionEvent;
|
|
import android.view.MotionEvent;
|
|
import android.view.View;
|
|
import android.view.View;
|
|
import android.view.View.OnTouchListener;
|
|
import android.view.View.OnTouchListener;
|
|
|
|
+import android.view.WindowManager;
|
|
import android.view.animation.AccelerateInterpolator;
|
|
import android.view.animation.AccelerateInterpolator;
|
|
import android.view.animation.Animation;
|
|
import android.view.animation.Animation;
|
|
import android.view.animation.Animation.AnimationListener;
|
|
import android.view.animation.Animation.AnimationListener;
|
|
@@ -25,7 +28,9 @@ import android.widget.ExpandableListView.OnGroupClickListener;
|
|
import android.widget.ExpandableListView.OnGroupCollapseListener;
|
|
import android.widget.ExpandableListView.OnGroupCollapseListener;
|
|
import android.widget.ExpandableListView.OnGroupExpandListener;
|
|
import android.widget.ExpandableListView.OnGroupExpandListener;
|
|
import android.widget.RelativeLayout;
|
|
import android.widget.RelativeLayout;
|
|
|
|
+import android.widget.Toast;
|
|
|
|
|
|
|
|
+import com.artncore.WallPadDataMgr.WallPadRemoteCallUserData;
|
|
import com.artncore.WallPadDataMgr.WallpadDeviceSet;
|
|
import com.artncore.WallPadDataMgr.WallpadDeviceSet;
|
|
import com.artncore.WallPadDataMgr.WallpadMobileDeviceData;
|
|
import com.artncore.WallPadDataMgr.WallpadMobileDeviceData;
|
|
import com.artncore.WallPadDataMgr.WallpadStatusData;
|
|
import com.artncore.WallPadDataMgr.WallpadStatusData;
|
|
@@ -43,16 +48,20 @@ import org.json.JSONException;
|
|
import org.json.JSONObject;
|
|
import org.json.JSONObject;
|
|
|
|
|
|
import java.io.File;
|
|
import java.io.File;
|
|
|
|
+import java.io.IOException;
|
|
import java.io.ObjectInputStream;
|
|
import java.io.ObjectInputStream;
|
|
import java.io.ObjectOutputStream;
|
|
import java.io.ObjectOutputStream;
|
|
|
|
+import java.net.InetAddress;
|
|
import java.net.InetSocketAddress;
|
|
import java.net.InetSocketAddress;
|
|
import java.net.Socket;
|
|
import java.net.Socket;
|
|
|
|
+import java.net.UnknownHostException;
|
|
import java.sql.Timestamp;
|
|
import java.sql.Timestamp;
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
import kr.co.icontrols.ReliefCall.ReliefCallInterface;
|
|
import kr.co.icontrols.ReliefCall.ReliefCallInterface;
|
|
|
|
+import kr.co.icontrols.wallpadconfig.data.ResultData;
|
|
import kr.co.icontrols.wallpadconfig.declare.Common;
|
|
import kr.co.icontrols.wallpadconfig.declare.Common;
|
|
import kr.co.icontrols.wallpadconfig.declare.Common.JSON;
|
|
import kr.co.icontrols.wallpadconfig.declare.Common.JSON;
|
|
import kr.co.icontrols.wallpadconfig.declare.ID;
|
|
import kr.co.icontrols.wallpadconfig.declare.ID;
|
|
@@ -897,6 +906,63 @@ public class MainActivity extends WpadActivity
|
|
DebugLogOutput("Receive BR " + intent.getAction());
|
|
DebugLogOutput("Receive BR " + intent.getAction());
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private final int PING_TIMEOUT = 1000;
|
|
|
|
+ private class PingTestTask extends AsyncTask<Object, Void, String[]> {
|
|
|
|
+ @Override
|
|
|
|
+ protected String[] doInBackground(Object... params) {
|
|
|
|
+ String type = (String)params[0];
|
|
|
|
+ String testIP1 = (String)params[1];
|
|
|
|
+ String testIP2 = (String)params[2];
|
|
|
|
+
|
|
|
|
+ String arrResult[] = new String[2];
|
|
|
|
+
|
|
|
|
+ StringBuilder result = new StringBuilder();
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ InetAddress ia = InetAddress.getByName(testIP1);
|
|
|
|
+ if(ia.isReachable(PING_TIMEOUT) == true) {
|
|
|
|
+ result.append("success");
|
|
|
|
+ } else {
|
|
|
|
+ result.append("fail");
|
|
|
|
+ }
|
|
|
|
+ InetAddress ia2 = InetAddress.getByName(testIP2);
|
|
|
|
+ if(ia2.isReachable(PING_TIMEOUT) == true) {
|
|
|
|
+ result.append("success");
|
|
|
|
+ } else {
|
|
|
|
+ result.append("fail");
|
|
|
|
+ }
|
|
|
|
+ } catch (UnknownHostException e){
|
|
|
|
+ result.append("fail");
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
+ result.append("fail");
|
|
|
|
+ } catch (IllegalArgumentException e) {
|
|
|
|
+ result.append("fail");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ arrResult[0] = type;
|
|
|
|
+ arrResult[1] = result.toString();
|
|
|
|
+
|
|
|
|
+ return arrResult;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ protected void onPostExecute(String[] arrResult) {
|
|
|
|
+ if (arrResult[1].contains("fail")) {
|
|
|
|
+ ((MainActivity) (getContext())).StartPopup(ID.screen.PopupMobileNetworkCheck);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (arrResult[0].contains("synk")) {
|
|
|
|
+ if (mCurrentScreenId == API_Menu.SubMenuConfig.MobileDeviceReg)
|
|
|
|
+ StartPopup(ID.screen.PopupMobileSync);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // testIP로 ping test를 수행
|
|
|
|
+ private void doPingTest2(String type, String IP1, String IP2) {
|
|
|
|
+ new PingTestTask().execute(type, IP1, IP2);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
/* ================================================================================================
|
|
/* ================================================================================================
|
|
* [Touch & Key Event] Section
|
|
* [Touch & Key Event] Section
|
|
@@ -986,8 +1052,7 @@ public class MainActivity extends WpadActivity
|
|
{
|
|
{
|
|
Sound().Play(SND.effect.TOUCH_LATCHED);
|
|
Sound().Play(SND.effect.TOUCH_LATCHED);
|
|
if(myIP.equals("10.1.1.1")) {
|
|
if(myIP.equals("10.1.1.1")) {
|
|
- if (mCurrentScreenId == API_Menu.SubMenuConfig.MobileDeviceReg)
|
|
|
|
- StartPopup(ID.screen.PopupMobileSync);
|
|
|
|
|
|
+ doPingTest2("synk", "10.1.2.1", "10.1.3.1");
|
|
} else {
|
|
} else {
|
|
StartPopup(ID.screen.PopupMobileNotUseConfirm);
|
|
StartPopup(ID.screen.PopupMobileNotUseConfirm);
|
|
}
|
|
}
|
|
@@ -2117,6 +2182,7 @@ public class MainActivity extends WpadActivity
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ int successCount = 0;
|
|
@SuppressLint("HandlerLeak")
|
|
@SuppressLint("HandlerLeak")
|
|
final Handler syncHandler = new Handler() {
|
|
final Handler syncHandler = new Handler() {
|
|
Gson gson = new Gson();
|
|
Gson gson = new Gson();
|
|
@@ -2128,7 +2194,22 @@ public class MainActivity extends WpadActivity
|
|
try {
|
|
try {
|
|
Bundle bundle = msg.getData();
|
|
Bundle bundle = msg.getData();
|
|
String response = bundle.getString("response");
|
|
String response = bundle.getString("response");
|
|
|
|
+ JSONObject jsonObject = new JSONObject(response);
|
|
|
|
+ ResultData resultData = gson.fromJson(jsonObject.toString(), ResultData.class);
|
|
Log.d("syncHandler", "response=" + response);
|
|
Log.d("syncHandler", "response=" + response);
|
|
|
|
+ if (resultData.getType().equals("mobileResponse") && resultData.getResult().equals("ok")) {
|
|
|
|
+ //멀티 동기화 성공시
|
|
|
|
+ if(resultData.getIp().equals("10.1.2.1")||resultData.getIp().equals("10.1.3.1")){
|
|
|
|
+ successCount++;
|
|
|
|
+ if(successCount==2){
|
|
|
|
+ Sound().PlayMent(SND.setting.SETTING);
|
|
|
|
+ successCount = 0;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ Sound().PlayMent(SND.mode.HOME_DEVICE_CHECK);
|
|
|
|
+ successCount = 0;
|
|
|
|
+ }
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|