|
@@ -27,6 +27,7 @@ import android.widget.ExpandableListView.OnGroupExpandListener;
|
|
|
import android.widget.RelativeLayout;
|
|
|
|
|
|
import com.artncore.WallPadDataMgr.WallpadDeviceSet;
|
|
|
+import com.artncore.WallPadDataMgr.WallpadMobileDeviceData;
|
|
|
import com.artncore.WallPadDataMgr.WallpadStatusData;
|
|
|
import com.artncore.WallPadDataMgr.wallpaddbmgr;
|
|
|
import com.artncore.commons.API_Menu;
|
|
@@ -34,6 +35,7 @@ import com.artncore.commons.API_Menu.MenuListDataClass;
|
|
|
import com.artncore.commons.API_Menu.MenuListDataClass.ChildIDMapping;
|
|
|
import com.artncore.commons.define;
|
|
|
import com.artncore.wallpadapi.WallPadAPI;
|
|
|
+import com.google.gson.Gson;
|
|
|
import com.util.LogUtil;
|
|
|
|
|
|
import org.json.JSONArray;
|
|
@@ -48,6 +50,7 @@ import java.net.Socket;
|
|
|
import java.sql.Timestamp;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
|
|
|
import kr.co.icontrols.ReliefCall.ReliefCallInterface;
|
|
|
import kr.co.icontrols.wallpadconfig.declare.Common;
|
|
@@ -113,7 +116,7 @@ public class MainActivity extends WpadActivity
|
|
|
// Top Menu
|
|
|
private WpadImageView TopBackground;
|
|
|
private WpadTextView TopTitle;
|
|
|
- private WpadImageView TopHomeBtn,TopBackBtn, TopMenuBtn, TopSetBtn;
|
|
|
+ private WpadImageView TopHomeBtn,TopBackBtn, TopMenuBtn, TopSetBtn, TopSyncBtn;
|
|
|
private WpadImageView TopManualBtn;
|
|
|
private WpadImageView BackBtn_InRoom;
|
|
|
|
|
@@ -279,6 +282,10 @@ public class MainActivity extends WpadActivity
|
|
|
ViewRegistration(TopLayout, TopSetBtn, 1019, 0);
|
|
|
setTopSetBtnVisible(false);
|
|
|
|
|
|
+ TopSyncBtn = new WpadImageView(this, TOUCH_KIND.BUTTON, 110, 110, R.drawable.topbar_icon_sync_normal, R.drawable.topbar_icon_sync_pressed, ID.main.button.SYNK);
|
|
|
+ ViewRegistration(TopLayout, TopSyncBtn, 1019, 0);
|
|
|
+ setTopSyncBtnVisible(false);
|
|
|
+
|
|
|
TopManualBtn = new WpadImageView(this, TOUCH_KIND.BUTTON, 110, 110, R.drawable.topbar_icon_manual_normal, R.drawable.topbar_icon_manual_pressed, ID.main.button.MENUAL);
|
|
|
setManualBtnVisible(getManualUse(), 1019);
|
|
|
|
|
@@ -647,6 +654,31 @@ public class MainActivity extends WpadActivity
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * TOP 모바일 동기화 버튼 활성화 & 비활성화
|
|
|
+ *
|
|
|
+ * @param bEnable - true : 활성화, false : 비활성화
|
|
|
+ * @return (boolean) true : 성공, false : 실패
|
|
|
+ */
|
|
|
+ public boolean setTopSyncBtnVisible(boolean bEnable) {
|
|
|
+ if (bEnable) {
|
|
|
+ if (TopSyncBtn.getVisibility() != View.VISIBLE) TopSyncBtn.setVisibility(View.VISIBLE);
|
|
|
+ TopSyncBtn.bringToFront();
|
|
|
+
|
|
|
+ if (TopSyncBtn.getVisibility() == View.VISIBLE) {
|
|
|
+ WpadUtil.ViewMove(TopManualBtn, 893, 0);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (TopSyncBtn.getVisibility() != View.INVISIBLE)
|
|
|
+ TopSyncBtn.setVisibility(View.INVISIBLE);
|
|
|
+
|
|
|
+ if (TopSyncBtn.getVisibility() == View.INVISIBLE) {
|
|
|
+ WpadUtil.ViewMove(TopManualBtn, 1019, 0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
/* ================================================================================================
|
|
|
* [Manual Activity] Section
|
|
|
================================================================================================ */
|
|
@@ -950,6 +982,12 @@ public class MainActivity extends WpadActivity
|
|
|
if (mCurrentScreenId == API_Menu.SubMenuConfig.MobileDeviceReg)
|
|
|
StartPopup(ID.screen.PopupRemoteCallUserSetting);
|
|
|
}
|
|
|
+ else if (TargetId == ID.main.button.SYNK)
|
|
|
+ {
|
|
|
+ Sound().Play(SND.effect.TOUCH_LATCHED);
|
|
|
+ if (mCurrentScreenId == API_Menu.SubMenuConfig.MobileDeviceReg)
|
|
|
+ StartPopup(ID.screen.PopupMobileSync);
|
|
|
+ }
|
|
|
else if(TargetId == ID.main.button.BACK_INROOM)
|
|
|
{
|
|
|
DebugLogOutput("onTouchEvent [BACK_INROOM] BUTTON !!!");
|
|
@@ -1145,6 +1183,26 @@ public class MainActivity extends WpadActivity
|
|
|
Log.e(TAG, "[Exception Error] [onActivityResult] - data.getExtras().get");
|
|
|
}
|
|
|
}
|
|
|
+ else if(resultCode == ID.popupMobileSync.ResultCode.OK)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ //모바일 동기화 작업을 여기서 해준다.
|
|
|
+ WallpadMobileDeviceData wallpadMobileDeviceData = new WallpadMobileDeviceData(mContext);
|
|
|
+ List<WallpadMobileDeviceData.MobileDeviceClass> DataList = wallpadMobileDeviceData.GetMobileDeviceData();
|
|
|
+ wallpadMobileDeviceData.closeDB();
|
|
|
+ for(int i=1; i<4; i++) {
|
|
|
+ requestMultiControl(syncHandler, Common.JSON.MENU.MOBILE, JSON.REASON.MobileSync, i, DataList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (RuntimeException re) {
|
|
|
+ LogUtil.errorLogInfo("", TAG, re);
|
|
|
+ }
|
|
|
+ catch (Exception e)
|
|
|
+ {
|
|
|
+ Log.e(TAG, "[Exception Error] [onActivityResult] - data.getExtras().get");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1190,6 +1248,7 @@ public class MainActivity extends WpadActivity
|
|
|
mCurrentScreenId = nScreenId;
|
|
|
setTopBackBtnVisible(false);
|
|
|
setTopSetBtnVisible(false);
|
|
|
+ setTopSyncBtnVisible(false);
|
|
|
|
|
|
// 2. 새로운 Layout 표시
|
|
|
try
|
|
@@ -1277,7 +1336,7 @@ public class MainActivity extends WpadActivity
|
|
|
case API_Menu.SubMenuConfig.MobileDeviceReg:
|
|
|
SetTitleText(API_Menu.SubMenuConfig.Name_MobileDeviceReg);
|
|
|
configMobileDeviceAddScreen = new ConfigMobileDeviceAddScreen(this, ScreenLayout, mWallPadAPI, OPERATION_MODE);
|
|
|
- // setTopBackBtnVisible(true);
|
|
|
+ setTopSyncBtnVisible(true);
|
|
|
super.setCurrentScreen(configMobileDeviceAddScreen);
|
|
|
break;
|
|
|
|
|
@@ -1959,22 +2018,30 @@ public class MainActivity extends WpadActivity
|
|
|
class ClientThread extends Thread {
|
|
|
private Handler handler;
|
|
|
private String value1;
|
|
|
- private String value2;
|
|
|
+ private String valueID;
|
|
|
private int menu, reason, state, position;
|
|
|
private int roomNumber;
|
|
|
|
|
|
- public ClientThread(Handler handler, int menu, int reason, int position, String value1, String value2) {
|
|
|
+ List<WallpadMobileDeviceData.MobileDeviceClass> dataList;
|
|
|
+
|
|
|
+ public ClientThread(Handler handler, int menu, int reason, int position, String value1, String valueID) {
|
|
|
this.handler = handler;
|
|
|
this.menu = menu;
|
|
|
this.reason = reason;
|
|
|
this.position = position;
|
|
|
this.value1 = value1;
|
|
|
- this.value2 = value2;
|
|
|
+ this.valueID = valueID;
|
|
|
+ }
|
|
|
+
|
|
|
+ public ClientThread(Handler handler, int menu, int reason, int position, List<WallpadMobileDeviceData.MobileDeviceClass> dataList) {
|
|
|
+ this.handler = handler;
|
|
|
+ this.menu = menu;
|
|
|
+ this.reason = reason;
|
|
|
+ this.position = position;
|
|
|
+ this.dataList = dataList;
|
|
|
}
|
|
|
|
|
|
public void run() {
|
|
|
- //String host = "10.1.1.1";
|
|
|
- //String host = "10.1.1." + position;
|
|
|
String host = "10.1."+position+".1";
|
|
|
int port = 9998;
|
|
|
String json = "";
|
|
@@ -1991,13 +2058,19 @@ public class MainActivity extends WpadActivity
|
|
|
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);
|
|
|
+ jsonObject.accumulate("id", valueID);
|
|
|
} else if(reason == JSON.REASON.MobileDelete) {
|
|
|
- jsonObject.accumulate("id", value2);
|
|
|
+ jsonObject.accumulate("id", valueID);
|
|
|
+ } else if(reason == JSON.REASON.MobileSync) {
|
|
|
+ JSONArray jArray = new JSONArray();
|
|
|
+ for (int i=0; i<dataList.size(); i++) {
|
|
|
+ jArray.put(dataList.get(i).Name + "|" + dataList.get(i).Uid);
|
|
|
+ }
|
|
|
+ jsonObject.accumulate("arrayData", jArray);
|
|
|
}
|
|
|
}
|
|
|
} catch (JSONException e) {
|
|
@@ -2056,9 +2129,39 @@ public class MainActivity extends WpadActivity
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void requestMultiControl(Handler handler, int menu, int reason, int position, String value1, String value2) {
|
|
|
+ @SuppressLint("HandlerLeak")
|
|
|
+ final Handler syncHandler = new Handler() {
|
|
|
+ Gson gson = new Gson();
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void handleMessage(Message msg) {
|
|
|
+ switch (msg.what) {
|
|
|
+ case 1000:
|
|
|
+ try {
|
|
|
+ Bundle bundle = msg.getData();
|
|
|
+ String response = bundle.getString("response");
|
|
|
+ Log.d("syncHandler", "response=" + response);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+ public void requestMultiControl(Handler handler, int menu, int reason, int position, String value1, String valueID) {
|
|
|
+ if(position!=ho) {
|
|
|
+ ClientThread thread = new ClientThread(handler, menu, reason, position, value1, valueID);
|
|
|
+ thread.start();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public void requestMultiControl(Handler handler, int menu, int reason, int position, List<WallpadMobileDeviceData.MobileDeviceClass> dataList) {
|
|
|
if(position!=ho) {
|
|
|
- ClientThread thread = new ClientThread(handler, menu, reason, position, value1, value2);
|
|
|
+ ClientThread thread = new ClientThread(handler, menu, reason, position, dataList);
|
|
|
thread.start();
|
|
|
}
|
|
|
}
|