Browse Source

전기차충전 확인. 속도 느려지는 문제 수정.

jslee(madeinlab) 3 years ago
parent
commit
1c2d01f139
14 changed files with 218 additions and 394 deletions
  1. 5 28
      WallPadAddService/src/main/java/kr/co/icontrols/wallpadaddservice/screen/VIPElecCarMainScreen.java
  2. 2 0
      WallPadHomeCtrl/src/main/java/kr/co/icontrols/wallpadhomectrl/MainActivity.java
  3. 15 6
      WallPadHomeCtrl/src/main/java/kr/co/icontrols/wallpadhomectrl/screen/screen_aircon/KnxSystemAirconMainScreen.java
  4. 15 17
      WallPadHomeCtrl/src/main/java/kr/co/icontrols/wallpadhomectrl/screen/screen_aircon/KnxSystemAirconPopupScreen.java
  5. 0 7
      WallPadHomeCtrl/src/main/java/kr/co/icontrols/wallpadhomectrl/screen/screen_heating/HeatingV2MainScreen.java
  6. 1 4
      WallPadHomeCtrl/src/main/java/kr/co/icontrols/wallpadhomectrl/screen/screen_light/LightKnxMainScreen.java
  7. 3 8
      WallPadHomeCtrl/src/main/java/kr/co/icontrols/wallpadhomectrl/screen/screen_multi/HeatingV2PopupBoilerTestScreen.java
  8. 33 18
      WallPadHomeCtrl/src/main/java/kr/co/icontrols/wallpadhomectrl/screen/screen_multi/HeatingV2PopupTestScreen.java
  9. 15 5
      WallPadHomeCtrl/src/main/java/kr/co/icontrols/wallpadhomectrl/screen/screen_multi/HeatingV2TestScreen.java
  10. 22 162
      WallPadHomeCtrl/src/main/java/kr/co/icontrols/wallpadhomectrl/screen/screen_multi/KnxSystemAirconMainTestScreen.java
  11. 13 16
      WallPadHomeCtrl/src/main/java/kr/co/icontrols/wallpadhomectrl/screen/screen_multi/KnxSystemAirconPopupTestScreen.java
  12. 30 27
      WallPadHomeCtrl/src/main/java/kr/co/icontrols/wallpadhomectrl/screen/screen_multi/LightKnxMainTestScreen.java
  13. 30 19
      WallPadHomeCtrl/src/main/java/kr/co/icontrols/wallpadhomectrl/screen/screen_multi/LightKnxPopupTestScreen.java
  14. 34 77
      WallPadMultiControlService/src/main/java/kr/co/icontrols/wallpadmulticontrolservice/DataSenderService.java

+ 5 - 28
WallPadAddService/src/main/java/kr/co/icontrols/wallpadaddservice/screen/VIPElecCarMainScreen.java

@@ -54,19 +54,10 @@ public class VIPElecCarMainScreen extends WpadScreen {
 
     public static int CurrentIndex = 0;
 
-
-    // button
-    WpadImageView Page1_BACK;
-    WpadImageView Page1_NEXT;
-
     WpadTextView Page1_RemainTime;
     WpadTextView TXT_ChargerStatus[] = new WpadTextView[2];
     WpadTextView TXT_ChargingInfo[] = new WpadTextView[2];
 
-    // button
-    WpadImageView Page3_PageBack;
-    WpadImageView Page3_PageNext;
-
 
     private final int PageMode3_Charger_All = 2;
 
@@ -417,7 +408,7 @@ public class VIPElecCarMainScreen extends WpadScreen {
         else m_SampleMode = Common.MODE_NORMAL;
 
         //for test
-        m_SampleMode = Common.MODE_BUSINESS_SAMPLE;
+        //m_SampleMode = Common.MODE_BUSINESS_SAMPLE;
 
         bEasyModeUse = Common.GetEasyModeUXUse(this.getContext());
         if (bEasyModeUse) idx = 1;
@@ -437,19 +428,19 @@ public class VIPElecCarMainScreen extends WpadScreen {
 
         TXT_ChargerStatus[0] = new WpadTextView(getContext(), false, 547, 46, Gravity.CENTER, Color.WHITE, Common.fontsize._36, true, ElecCarMainScreenID.text.CHARGER1_STATUS);
         ViewRegistration(getLayout(), TXT_ChargerStatus[0], Common.ImgPosition.GetX(93), Common.ImgPosition.GetY(575));
-        TXT_ChargerStatus[0].setText("충전중");
+        TXT_ChargerStatus[0].setText("정보없음");
 
         TXT_ChargerStatus[1] = new WpadTextView(getContext(), false, 547, 46, Gravity.CENTER, Color.WHITE, Common.fontsize._36, true, ElecCarMainScreenID.text.CHARGER2_STATUS);
         ViewRegistration(getLayout(), TXT_ChargerStatus[1], Common.ImgPosition.GetX(640), Common.ImgPosition.GetY(575));
-        TXT_ChargerStatus[1].setText("충전중");
+        TXT_ChargerStatus[1].setText("정보없음");
 
         TXT_ChargingInfo[0] = new WpadTextView(getContext(), false, 547, 46, Gravity.CENTER, Color.WHITE, Common.fontsize._30, false, ElecCarMainScreenID.text.CHARGER1_INFO);
         ViewRegistration(getLayout(), TXT_ChargingInfo[0], Common.ImgPosition.GetX(93), Common.ImgPosition.GetY(624));
-        TXT_ChargingInfo[0].setText("12:30");
+        TXT_ChargingInfo[0].setText("");
 
         TXT_ChargingInfo[1] = new WpadTextView(getContext(), false, 547, 46, Gravity.CENTER, Color.WHITE, Common.fontsize._30, false, ElecCarMainScreenID.text.CHARGER2_INFO);
         ViewRegistration(getLayout(), TXT_ChargingInfo[1], Common.ImgPosition.GetX(640), Common.ImgPosition.GetY(624));
-        TXT_ChargingInfo[1].setText("12.3kWh");
+        TXT_ChargingInfo[1].setText("");
 
 
         //변수 초기화
@@ -584,8 +575,6 @@ public class VIPElecCarMainScreen extends WpadScreen {
 
     void LoadDataFromServerCharging() {
         DebugLogOutput("LoadDataFromServerCharging");
-        Page1_BACK.setImageResource(R.drawable.btn_back_disabled); // imap 통신 이후 이미지 바뀌는 현상 방지하기 위해
-        Page1_NEXT.setImageResource(R.drawable.btn_next_disabled);
 
         imapElecCarChargingInfo.DoWork();
         imapElecCarChargingInfo.SetRetCtr(new RetProci() {
@@ -632,14 +621,6 @@ public class VIPElecCarMainScreen extends WpadScreen {
                     imapElecCarChargingInfo.SetItem("message");
                     Car_Charging_Info.message = imapElecCarChargingInfo.GetItemVal(0);
 
-                    if (Car_Charging_Info.arraylist.size() != 0) {
-                        Page1_BACK.setImageResource(R.drawable.btn_back_normal);
-                        Page1_NEXT.setImageResource(R.drawable.btn_next_normal);
-                        MakeContentPage1_Image();
-                    } else {
-                        Page1_BACK.setButtonEventOffEnable(R.drawable.btn_back_disabled);
-                        Page1_NEXT.setButtonEventOffEnable(R.drawable.btn_next_disabled);
-                    }
                 } catch (RuntimeException re) {
                     LogUtil.errorLogInfo("", TAG, re);
                 } catch (Exception e) {
@@ -651,8 +632,6 @@ public class VIPElecCarMainScreen extends WpadScreen {
             @Override
             public void ProcError() {
                 DebugLogOutput("ProcError");
-                Page1_BACK.setButtonEventOffEnable(R.drawable.btn_back_disabled);
-                Page1_NEXT.setButtonEventOffEnable(R.drawable.btn_next_disabled);
             }
 
             @Override
@@ -710,8 +689,6 @@ public class VIPElecCarMainScreen extends WpadScreen {
 
     void LoadDataFromServerCharger() {
         DebugLogOutput("LoadDataFromServerCharger");
-        Page3_PageBack.setImageResource(R.drawable.btn_back_disabled); // imap 통신 이후 이미지 바뀌는 현상 방지하기 위해
-        Page3_PageNext.setImageResource(R.drawable.btn_next_disabled);
 
         Charger_Info = new CHARGER_INFO(0, "null");
 

+ 2 - 0
WallPadHomeCtrl/src/main/java/kr/co/icontrols/wallpadhomectrl/MainActivity.java

@@ -1553,6 +1553,7 @@ public class MainActivity extends WpadActivity {
 		// 2. 새로운 Layout 표시
         try {
 			setTitleName(nScreenId);
+			GetRoomNameV2(); // 스크린 체인지 시 방명칭 수정 적용되어야 함.
 			//super.setFinishTimerCreate(Common.FINISH_TIME_SEC);
             switch (nScreenId) {
                 /**
@@ -3698,6 +3699,7 @@ public class MainActivity extends WpadActivity {
 
 			} catch (Exception e) {
 				e.printStackTrace();
+				Log.e("ClientThread", "error=" + e);
 			}
 		}
 	}

+ 15 - 6
WallPadHomeCtrl/src/main/java/kr/co/icontrols/wallpadhomectrl/screen/screen_aircon/KnxSystemAirconMainScreen.java

@@ -430,11 +430,14 @@ public class KnxSystemAirconMainScreen extends WpadScreen {
                         transactionDisplay = new TransactionDisplay(true, (WallPadDevAPI) airconAPI, (WpadScreen) this);
                 }
                 if (louverAPI != null) {
+                    /*
                     Device_BrRegistration_Louver(true);
                     Draw_Update(INDEX_LOUVER);
 
                     if (MainActivity.getHideMenuOn())
                         transactionDisplay = new TransactionDisplay(true, (WallPadDevAPI) airconAPI, (WpadScreen) this);
+
+                     */
                 }
             } else {
                 Draw_Update(Common.INDEX_ALL);
@@ -571,14 +574,14 @@ public class KnxSystemAirconMainScreen extends WpadScreen {
                 if (transactionDisplay != null) transactionDisplay.Close();
             }
         }
-
+/*
         if (louverAPI != null) {
             Device_BrRegistration_Louver(false);
             if (MainActivity.getHideMenuOn()) {
                 if (transactionDisplay != null) transactionDisplay.Close();
             }
         }
-
+*/
 
         WallpadStatusData wd = new WallpadStatusData(this.getContext());
         Log.d(TAG, "close db val = " + wd.GetCurrentScreenIDValue());
@@ -960,12 +963,12 @@ public class KnxSystemAirconMainScreen extends WpadScreen {
 
 
             //루버 상태 update draw
-            LouverAPI.Data louverData = mDataLouver.louver;
-            Draw_LouverStatusChange(louverData.LouverStatus);
+            //LouverAPI.Data louverData = mDataLouver.louver;
+            //Draw_LouverStatusChange(louverData.LouverStatus);
         } else if(index == INDEX_LOUVER){
             //루버 상태 update draw
-            LouverAPI.Data louverData = mDataLouver.louver;
-            Draw_LouverStatusChange(louverData.LouverStatus);
+            //LouverAPI.Data louverData = mDataLouver.louver;
+            //Draw_LouverStatusChange(louverData.LouverStatus);
         } else {
             int pos = ROOM_POS[index];
             if (!Draw_RangeChecker(pos)) return;
@@ -1378,6 +1381,7 @@ public class KnxSystemAirconMainScreen extends WpadScreen {
             mData.systemAircon = airconAPI.data;
             // 2. Reflash
             if (louverAPI != null) {
+                /*
                 try {
 
                     int ret = (byte) louverAPI.Refresh(real);
@@ -1394,9 +1398,12 @@ public class KnxSystemAirconMainScreen extends WpadScreen {
                     e.printStackTrace();
                     //return -100;
                 }
+
+                 */
             }
         } else {
             // 2. Reflash
+            /*
             if (louverAPI != null) {
                 try {
                     int ret = (byte) louverAPI.Refresh(real);
@@ -1414,6 +1421,8 @@ public class KnxSystemAirconMainScreen extends WpadScreen {
                     //return -100;
                 }
             }
+
+             */
         }
 
         // 5. Debug msg

+ 15 - 17
WallPadHomeCtrl/src/main/java/kr/co/icontrols/wallpadhomectrl/screen/screen_aircon/KnxSystemAirconPopupScreen.java

@@ -615,21 +615,20 @@ public class KnxSystemAirconPopupScreen extends WpadScreen {
         if (mode == KnxSystemAircon.MODE.Auto) {
             ModeBtn[0].setButtonPressedImageID();
             //프로토콜 1.2 : 자동인 경우는 풍량 조절이 안되고 자동으로 고정
-            //madeinlab 이후 disable 이미지를 요청해야 한다
-            VolumeEncBtn.setButtonEventOffEnable(R.drawable.btn_temp_up_normal);
-            VolumeDecBtn.setButtonEventOffEnable(R.drawable.btn_temp_down_normal);
+            VolumeEncBtn.setButtonEventOffEnable(R.drawable.btn_temp_up_disabled);
+            VolumeDecBtn.setButtonEventOffEnable(R.drawable.btn_temp_down_disabled);
         } else if (mode == KnxSystemAircon.MODE.Cold) {
             ModeBtn[1].setButtonPressedImageID();
         } else if (mode == KnxSystemAircon.MODE.Dry) {
             ModeBtn[2].setButtonPressedImageID();
             //제습인 경우, 온도 변경이 안되도록 한다.
-            VolumeEncBtn.setButtonEventOffEnable(R.drawable.btn_temp_up_normal);
-            VolumeDecBtn.setButtonEventOffEnable(R.drawable.btn_temp_down_normal);
+            TempEncBtn.setButtonEventOffEnable(R.drawable.btn_temp_up_disabled);
+            TempDecBtn.setButtonEventOffEnable(R.drawable.btn_temp_down_disabled);
         } else if (mode == KnxSystemAircon.MODE.Venti) {
             ModeBtn[3].setButtonPressedImageID();
             //송풍인 경우, 온도 변경이 안되도록 한다.
-            TempEncBtn.setButtonEventOffEnable(R.drawable.btn_temp_up_normal);
-            TempDecBtn.setButtonEventOffEnable(R.drawable.btn_temp_down_normal);
+            TempEncBtn.setButtonEventOffEnable(R.drawable.btn_temp_up_disabled);
+            TempDecBtn.setButtonEventOffEnable(R.drawable.btn_temp_down_disabled);
         } else if (mode == KnxSystemAircon.MODE.Heat) {
             ModeBtn[4].setButtonPressedImageID();
         } else {
@@ -918,9 +917,8 @@ public class KnxSystemAirconPopupScreen extends WpadScreen {
             mode = 0x00;
             ModeBtn[0].setButtonPressedImageID();
             //프로토콜 1.2 : 자동인 경우는 풍량 조절이 안되고 자동으로 고정
-            //madeinlab 이후 disable 이미지로 교체한다.
-            VolumeEncBtn.setButtonEventOffEnable(R.drawable.btn_temp_up_normal);
-            VolumeDecBtn.setButtonEventOffEnable(R.drawable.btn_temp_down_normal);
+            VolumeEncBtn.setButtonEventOffEnable(R.drawable.btn_temp_up_disabled);
+            VolumeDecBtn.setButtonEventOffEnable(R.drawable.btn_temp_down_disabled);
             roomData.Volume = (byte) KnxSystemAircon.VOLUME.Auto;
             // 풍향 갱신
             Draw_NowVolumeChange(roomData.Volume);
@@ -928,19 +926,19 @@ public class KnxSystemAirconPopupScreen extends WpadScreen {
             mode = 0x01;
             ModeBtn[1].setButtonPressedImageID();
         } else if (index == ID.KNxSystemAirconPopup.button.MODE_3) {
+            //제습 온도조절 안됨
             mode = 0x02;
             ModeBtn[2].setButtonPressedImageID();
-            //프로토콜 1.2 : 자동인 경우는 풍량 조절이 안되고 자동으로 고정
-            VolumeEncBtn.setButtonEventOffEnable(R.drawable.btn_temp_up_normal);
-            VolumeDecBtn.setButtonEventOffEnable(R.drawable.btn_temp_down_normal);
-            roomData.Volume = (byte) KnxSystemAircon.VOLUME.Auto;
+            TempEncBtn.setButtonEventOffEnable(R.drawable.btn_temp_up_disabled);
+            TempDecBtn.setButtonEventOffEnable(R.drawable.btn_temp_down_disabled);
+            //roomData.Volume = (byte) KnxSystemAircon.VOLUME.Auto;
             // 풍향 갱신
-            Draw_NowVolumeChange(roomData.Volume);
+            //Draw_NowVolumeChange(roomData.Volume);
         } else if (index == ID.KNxSystemAirconPopup.button.MODE_4) {
             mode = 0x03;
             ModeBtn[3].setButtonPressedImageID();
-            TempEncBtn.setButtonEventOffEnable(R.drawable.btn_temp_up_normal);
-            TempDecBtn.setButtonEventOffEnable(R.drawable.btn_temp_down_normal);
+            TempEncBtn.setButtonEventOffEnable(R.drawable.btn_temp_up_disabled);
+            TempDecBtn.setButtonEventOffEnable(R.drawable.btn_temp_down_disabled);
         } else if (index == ID.KNxSystemAirconPopup.button.MODE_5) {
             mode = 0x04;
             ModeBtn[4].setButtonPressedImageID();

+ 0 - 7
WallPadHomeCtrl/src/main/java/kr/co/icontrols/wallpadhomectrl/screen/screen_heating/HeatingV2MainScreen.java

@@ -394,15 +394,8 @@ public class HeatingV2MainScreen extends WpadScreen {
 
         // 서버에서 설정된 UI 순서를 이용하도록 한다.
         if( strValue != null ) {
-            //String strLight = strValue[1].substring( (strValue[1].indexOf("조명(") + 3) , (strValue[1].indexOf(")난방(")));
             String strHeating = strValue[1].substring( (strValue[1].indexOf("난방(") + 3) , (strValue[1].indexOf(")에어컨(")));
-            //String strAircon = strValue[1].substring( (strValue[1].indexOf("에어컨(") + 4) , (strValue[1].indexOf("))")));
-            //DebugLogOutput("[Create] - room name strlight "  + strLight);
-            //DebugLogOutput("[Create] - room name strHeating "  + strHeating);
-            //DebugLogOutput("[Create] - room name strAircon "  + strAircon);
-
             int strHeatingCount = Integer.valueOf(strHeating.substring(0, strHeating.indexOf(":")));
-
             if(strHeatingCount==mData.heatingV2.Device.info.RoomCount){
                 //개수가 일치하는 경우에 적용
                 strHeating = strHeating.substring(strHeating.indexOf(":")+1);

+ 1 - 4
WallPadHomeCtrl/src/main/java/kr/co/icontrols/wallpadhomectrl/screen/screen_light/LightKnxMainScreen.java

@@ -348,14 +348,11 @@ public class LightKnxMainScreen extends WpadScreen {
         String[] strValue = devSet.GetSettingData("UI순서");
         devSet.closeDB();
 
-        // 현대건설 더 펜트하우스 서버에서 설정된 UI 순서를 이용하도록 한다.
+        //서버에서 설정된 UI 순서를 이용하도록 한다.
         if( strValue != null ) {
             String strLight = strValue[1].substring( (strValue[1].indexOf("조명(") + 3) , (strValue[1].indexOf(")난방(")));
             //String strHeating = strValue[1].substring( (strValue[1].indexOf("난방(") + 3) , (strValue[1].indexOf(")에어컨(")));
             //String strAircon = strValue[1].substring( (strValue[1].indexOf("에어컨(") + 4) , (strValue[1].indexOf("))")));
-            //DebugLogOutput("[Create] - room name strlight "  + strLight);
-            //DebugLogOutput("[Create] - room name strHeating "  + strHeating);
-            //DebugLogOutput("[Create] - room name strAircon "  + strAircon);
 
             int strLightCount = Integer.valueOf(strLight.substring(0, strLight.indexOf(":")));
 

+ 3 - 8
WallPadHomeCtrl/src/main/java/kr/co/icontrols/wallpadhomectrl/screen/screen_multi/HeatingV2PopupBoilerTestScreen.java

@@ -224,7 +224,7 @@ public class HeatingV2PopupBoilerTestScreen extends WpadScreen
     private void updateData() {
         try {
             //난방 전체 상태 조회. 조회해서 data에 대입해준다.
-            requestMultiStatus(JSON.KIND.All, JSON.REASON.Status,JSON.POSITION.All);
+            requestMultiStatus(JSON.KIND.All, JSON.REASON.Status, JSON.POSITION.All);
         } catch (RuntimeException re) {
             LogUtil.errorLogInfo("", TAG, re);
         }
@@ -288,13 +288,8 @@ public class HeatingV2PopupBoilerTestScreen extends WpadScreen
         mContext = context;
         OPERATION_MODE = operationMode;
         mData = new Data();
-
-        // 2. Device API Load & Update
-        DebugLogOutput("[Create] - Step2 : Device API Load & Update");
-
-        DebugLogOutput("OPERATION_MODE = MODE_BUSINESS_SAMPLE");
         updateData();
-        Sample_DataDefaultSetting();
+        //Sample_DataDefaultSetting();
     }
 
     private boolean setManualBtnVisible(boolean bEnable) {
@@ -540,7 +535,7 @@ public class HeatingV2PopupBoilerTestScreen extends WpadScreen
         if(ChangeHotWater)     mData.ChangeHotWater     = ChangeHotWater;
 
         // 4. 핸들러에 메시지 전송
-        mDeviceTempSetHandler.sendEmptyMessageDelayed(DEVICE_CMD_TEMP_CHANGE, 1200);
+        mDeviceTempSetHandler.sendEmptyMessageDelayed(DEVICE_CMD_TEMP_CHANGE, 1500);
 
         return true;
     }

+ 33 - 18
WallPadHomeCtrl/src/main/java/kr/co/icontrols/wallpadhomectrl/screen/screen_multi/HeatingV2PopupTestScreen.java

@@ -240,16 +240,36 @@ public class HeatingV2PopupTestScreen extends WpadScreen {
         }
     }
 
-    private void requestMultiCommand(int kind, int reason, int position, String category, int number, int state) {
+    private void startRefreshTimer(int delay){
+        resetTimer();
+        TT = new TimerTask() {
+            @Override
+            public void run() {
+                // 반복실행할 구문
+                updateData();
+            }
+        };
+        timer.schedule(TT, delay, 5000); //Timer 실행
+    }
+    private void resetTimer(){
+        if(TT != null)
+        {
+            TT.cancel();
+            TT = null;
+        }
         if (timer != null)
-            timer.cancel();
+            timer.purge();
+    }
+
+
+    private void requestMultiCommand(int kind, int reason, int position, String category, int number, int state) {
+        resetTimer();
         position = ROOM_POS[position];
         ((PopupActivity) mContext).requestMultiControl(handler, JSON.MENU.HEATING, kind, reason, position, category, number, state);
     }
 
     private void requestMultiCommand(int kind, int reason, int position, String category, int number, double state) {
-        if (timer != null)
-            timer.cancel();
+        resetTimer();
         position = ROOM_POS[position];
         ((PopupActivity) mContext).requestMultiControl(handler, JSON.MENU.HEATING, kind, reason, position, category, number, state);
     }
@@ -271,6 +291,8 @@ public class HeatingV2PopupTestScreen extends WpadScreen {
     }
 
     Timer timer;
+    TimerTask TT;
+
     @SuppressLint("HandlerLeak")
     final Handler handler = new Handler() {
         Gson gson = new Gson();
@@ -287,15 +309,7 @@ public class HeatingV2PopupTestScreen extends WpadScreen {
                         if (resultData.getType().equals("controlResponse") && resultData.getResult().equals("ok")) {
                             //제어 명령을 내리고 제대로 응답이 오면 상태를 다시 조회해서 UI 갱신하도록 한다.
                             Sound().Play(SND.effect.TOUCH_LATCHED);
-                            timer = new Timer();
-                            TimerTask TT = new TimerTask() {
-                                @Override
-                                public void run() {
-                                    // 반복실행할 구문
-                                    updateData();
-                                }
-                            };
-                            timer.schedule(TT, 200, 3500); //Timer 실행
+                            startRefreshTimer(500);
                         } else if (resultData.getType().equals("updateResponse")) {
                             //상태 조회 응답이 오면, data를 갱신한다.
                             makeDeviceData(jsonObject);
@@ -650,6 +664,9 @@ public class HeatingV2PopupTestScreen extends WpadScreen {
         drawUpdate((byte) mCurrentRoomIndex);
 
         SetManualStr(NowTab, ReserveUse, SleepUse);
+
+        timer = new Timer();
+        startRefreshTimer(3000);
     }
 
     private boolean setManualBtnVisible(boolean bEnable) {
@@ -678,12 +695,10 @@ public class HeatingV2PopupTestScreen extends WpadScreen {
         Data_CheckReservation();
         Data_CheckSleep();
 
-        //if (timer != null)
-        //    timer.cancel();
-
         new Handler().postDelayed(new Runnable() {
             @Override
             public void run() {
+                resetTimer();
                 if (timer != null)
                     timer.cancel();
             }
@@ -782,8 +797,8 @@ public class HeatingV2PopupTestScreen extends WpadScreen {
                     if (mCurrentTabStatus != TargetId) {
                         Sound().Play(SND.effect.TOUCH_LATCHED);
                         //탭이 변경되면 상태 값을 새로 받아 온다.
-                        if (timer != null)
-                            timer.cancel();
+                        resetTimer();
+                        //예약은 상태를 주기적으로 갱신하면 설정하면서 값이 바뀌게 되어 이상함.
                         updateData();
 
                         if (OPERATION_MODE == Common.MODE_NOMAL) {

+ 15 - 5
WallPadHomeCtrl/src/main/java/kr/co/icontrols/wallpadhomectrl/screen/screen_multi/HeatingV2TestScreen.java

@@ -509,9 +509,18 @@ public class HeatingV2TestScreen extends WpadScreen {
         }
     }
 
-    private void requestMultiCommand(int kind, int reason, int position, String category, int number, int state){
+    private void resetTimer(){
+        if(TT != null)
+        {
+            TT.cancel();
+            TT = null;
+        }
         if (timer != null)
-            timer.cancel();
+            timer.purge();
+    }
+
+    private void requestMultiCommand(int kind, int reason, int position, String category, int number, int state){
+        resetTimer();
         position = ROOM_POS[position];
         ((MainActivity) mContext).requestMultiControl(handler, JSON.MENU.HEATING, kind, reason, position, category, number, state);
     }
@@ -595,13 +604,14 @@ public class HeatingV2TestScreen extends WpadScreen {
         else astrRoomTitle = roomNameList;
 
         mData = new Data();
+        timer = new Timer();
         startRefreshTimer();
         //updateData();
         //Sample_DataDefaultSetting();
     }
 
     private void startRefreshTimer(){
-        timer = new Timer();
+        resetTimer();
         TT = new TimerTask() {
             @Override
             public void run() {
@@ -621,6 +631,7 @@ public class HeatingV2TestScreen extends WpadScreen {
         // 보일러 지원 여부에 따라 아이콘 안보이기
         if (mData.heatingV2.Device.info.Support.Boiler) ((MainActivity)(getContext())).setTopBoilerBtnVisible(false);
 
+        resetTimer();
         if (timer != null)
             timer.cancel();
     }
@@ -681,8 +692,7 @@ public class HeatingV2TestScreen extends WpadScreen {
             }
             else if ((TargetId >= ID.heatingV2main.button.ROOM_TITLE_1) && (TargetId <= ID.heatingV2main.button.ROOM_TITLE_8)) {
                 // 각방 타이틀 클릭
-                if (timer != null)
-                    timer.cancel();
+                resetTimer();
                 int index = TargetId - ID.heatingV2main.button.ROOM_TITLE_1;
                 DebugLogOutput("onTouchEvent [ROOM_TITLE_" + (index+1) + "] BUTTON !!!");
                 Sound().Play(SND.effect.TOUCH_LATCHED);

+ 22 - 162
WallPadHomeCtrl/src/main/java/kr/co/icontrols/wallpadhomectrl/screen/screen_multi/KnxSystemAirconMainTestScreen.java

@@ -94,7 +94,7 @@ public class KnxSystemAirconMainTestScreen extends WpadScreen {
     // [Variables]
     private int OPERATION_MODE = -1;                    // 동작모드
     private Data mData = null;                          // 데이터
-    private DataLouver mDataLouver = null;                          // 데이터
+    //private DataLouver mDataLouver = null;                          // 데이터
     private String[] mRoomNameList = null;             // 각방 명칭
 
     private int AirconCount = 0;
@@ -439,15 +439,23 @@ public class KnxSystemAirconMainTestScreen extends WpadScreen {
         }
     }
 
-    private void requestMultiCommand(int kind, int reason, int position, String category, int number, int state){
+    private void resetTimer(){
+        if(TT != null)
+        {
+            TT.cancel();
+            TT = null;
+        }
         if (timer != null)
-            timer.cancel();
+            timer.purge();
+    }
+
+    private void requestMultiCommand(int kind, int reason, int position, String category, int number, int state){
+        resetTimer();
         ((MainActivity) mContext).requestMultiControl(handler, JSON.MENU.AIRCON, kind, reason, position, category, number, state);
     }
 
     private void requestMultiCommand(int kind, int reason, int position, String category, int number, double state) {
-        if (timer != null)
-            timer.cancel();
+        resetTimer();
         ((MainActivity) mContext).requestMultiControl(handler, JSON.MENU.AIRCON, kind, reason, position, category, number, state);
     }
 
@@ -529,7 +537,7 @@ public class KnxSystemAirconMainTestScreen extends WpadScreen {
         mRoomNameList = mDefaultRoomNameList;
         //mRoomNameList = roomNameList;
         mData = new Data();
-        mDataLouver = new DataLouver();
+        //mDataLouver = new DataLouver();
 
         //madeinLab-- UX_MODE 필요 시 적용.
         //UX_MODE = ((MainActivity) context).GetEasyModeUXUse() ? Common.UX_EASY_MODE : Common.UX_NORMAL_MODE;
@@ -544,13 +552,15 @@ public class KnxSystemAirconMainTestScreen extends WpadScreen {
             Sample_DataDefaultSetting();
         }
 
+        timer = new Timer();
+
         //에어컨 전체 상태 조회. 조회해서 data에 대입해준다.
         startRefreshTimer(300);
         //updateData();
     }
 
     private void startRefreshTimer(int delay){
-        timer = new Timer();
+        resetTimer();
         TT = new TimerTask() {
             @Override
             public void run() {
@@ -566,6 +576,7 @@ public class KnxSystemAirconMainTestScreen extends WpadScreen {
     protected void onClose() {
         super.onClose();
 
+        resetTimer();
         if (timer != null)
             timer.cancel();
     }
@@ -624,8 +635,7 @@ public class KnxSystemAirconMainTestScreen extends WpadScreen {
                 }
             }
             else if ((nTargetId >= ID.KnxSystemAirconMain.button.ROOM_TITLE_1) && (nTargetId <= ID.KnxSystemAirconMain.button.ROOM_TITLE_MAX)) {
-                if (timer != null)
-                    timer.cancel();
+                resetTimer();
                 Sound().Play(SND.effect.TOUCH_LATCHED);
                 int index = nTargetId - ID.KnxSystemAirconMain.button.ROOM_TITLE_1;
                 DebugLogOutput("[onTouchEvent] ROOM_TITLE_" + (index+1) + " BUTTON !!!");
@@ -756,13 +766,7 @@ public class KnxSystemAirconMainTestScreen extends WpadScreen {
      */
     @Override
     protected void onPopupResult(Intent intent) {
-        new Handler().postDelayed(new Runnable() {
-            @Override
-            public void run() {
-                updateData();
-            }
-        }, 2000);
-
+        startRefreshTimer(1500);
     }
 
     // =================================================================================================
@@ -852,8 +856,8 @@ public class KnxSystemAirconMainTestScreen extends WpadScreen {
             //Draw_LouverStatusChange(louverData.LouverStatus);
         } else if(index == INDEX_LOUVER){
             //루버 상태 update draw
-            LouverAPI.Data louverData = mDataLouver.louver;
-            Draw_LouverStatusChange(louverData.LouverStatus);
+            //LouverAPI.Data louverData = mDataLouver.louver;
+            //Draw_LouverStatusChange(louverData.LouverStatus);
         } else {
             int pos = ROOM_POS[index];
             if (!Draw_RangeChecker(pos)) return;
@@ -945,8 +949,6 @@ public class KnxSystemAirconMainTestScreen extends WpadScreen {
      * @param bNext - (boolean) true이면 다음 이동, false이면 이전 이동
      */
     private void MovePage(boolean bNext) {
-        //if (timer != null)
-        //    timer.cancel();
         try {
             if (bNext) {
                 CurrentPageNum++;
@@ -1161,148 +1163,6 @@ public class KnxSystemAirconMainTestScreen extends WpadScreen {
     // [[ Device ]] region
     // =================================================================================================
 
-    /**
-     * 디바이스 API 를 Load 한다.
-     *
-     * @param wpapi - 생성시 전달받은 WallPadAPI
-     * @return (int) - >=0 : 성공, <0 : 실패
-     */
-    private int Device_ApiLoad(WallPadAPI wpapi)
-    {
-        DebugLogOutput("[Device_ApiLoad] - Step1 : Louver API Load...");
-        //Louver 가 에러인 경우엔, return error를 하지 않고 에러를 이미지를 표시해준다.
-        try
-        {
-            louverAPI = wpapi.Get_LouverController();
-        }
-        catch(Exception e)
-        {
-            Log.e(TAG, "[Device_ApiLoad] - [Exception Error] wpapi.Get_LouverController");
-            Log.e(TAG, "[Device_ApiLoad] - " + e.toString());
-            e.printStackTrace();
-            //madeinlab 추후 이미지를 교체해준다.
-            LouverMode.setImageResource(R.drawable.louver_airc_status_1);
-        }
-        if(louverAPI == null)
-        {
-            Log.e(TAG, "[Device_ApiLoad] - louverAPI is null");
-            //madeinlab 추후 이미지를 교체해준다.
-            LouverMode.setImageResource(R.drawable.louver_airc_status_1);
-        }
-
-        DebugLogOutput("[Device_ApiLoad] - OK");
-
-        return 0;
-    }
-    /**
-     * 제어기 상태를 가져온다.
-     *
-     * @param Index - (byte) {link REFRESH_IDX} 값 <br>
-     *                       REFRESH_IDX.ROOM1 ~ REFRESH_IDX.ROOM8 : 방개별 갱신 <br>
-     *                       REFRESH_IDX.ALL : 방전체 갱신 <br>
-     *                       REFRESH_IDX.INFO : 기기정보 갱신<br>
-     *                       REFRESH_IDX.BOILER : 보일러정보 갱신<br>
-     *                       REFRESH_IDX.SPECIALFUNC : 특화기능 정보 갱신<br>
-     *
-     * @param real  - (boolean) true : 실시간, false : 가장최근 (Index 가 REFRESH_IDX.INFO 일경우 가장최근만 적용됨)
-     *
-     * @return (int) - >=0 : 성공, <0 : 실패
-     */
-    private int Device_Update(byte Index, boolean real)
-    {
-
-        DebugLogOutput("[Device_Update] - Start   (Index:" + String.format("0x%02X", Index) + ", real:" + real + ")");
-
-        // 1. Api Load Check
-        if(airconAPI == null)
-        {
-            Log.e(TAG, "[Device_Update] - airconAPI unload !!!");
-            return -1;
-        }
-
-        if( !((Index >= KnxSystemAirconAPI.REFRESH_IDX.AIR1) && (Index <= KnxSystemAirconAPI.REFRESH_IDX.AIR9)) &&
-                !(Index == KnxSystemAirconAPI.REFRESH_IDX.ALL) &&
-                !(Index == INDEX_LOUVER))
-        {
-            Log.e(TAG, "[Device_Update] - param [Index:" + Index + "] Out of range !!!");
-            return -2;
-        }
-
-        if(Index== Common.INDEX_ALL) {
-
-            // 2. Reflash
-            try {
-                int ret = (byte) airconAPI.Refresh(Index, real);
-                if (ret < 0) {
-                    Log.e(TAG, "[Device_Update] Refresh - ret (" + ret + ")   ErrorCode = " + airconAPI.ErrorCode.ErrStr());
-                    return -2;
-                }
-            } catch (Exception e) {
-                Log.e(TAG, "[Device_Update] - [Exception Error] airconAPI.Refresh()");
-                Log.e(TAG, "[Device_Update] - " + e.toString());
-                e.printStackTrace();
-                return -100;
-            }
-            // 4. Data Copy
-            mData.systemAircon = airconAPI.data;
-            // 2. Reflash
-            if (louverAPI != null) {
-                try {
-
-                    int ret = (byte) louverAPI.Refresh(real);
-                    if (ret < 0) {
-                        Log.e(TAG, "[Device_Update] Refresh - ret (" + ret + ")   ErrorCode = " + louverAPI.ErrorCode.ErrStr());
-                        LouverMode.setImageResource(R.drawable.louver_airc_status_2);
-                    } else {
-                        // 4. Data Copy
-                        mDataLouver.louver = louverAPI.data;
-                    }
-                } catch (Exception e) {
-                    Log.e(TAG, "[Device_Update] - [Exception Error] louverAPI.Refresh()");
-                    Log.e(TAG, "[Device_Update] - " + e.toString());
-                    e.printStackTrace();
-                    //return -100;
-                }
-            }
-        } else {
-            // 2. Reflash
-            if (louverAPI != null) {
-                try {
-                    int ret = (byte) louverAPI.Refresh(real);
-                    if (ret < 0) {
-                        Log.e(TAG, "[Device_Update] Refresh - ret (" + ret + ")   ErrorCode = " + louverAPI.ErrorCode.ErrStr());
-                        LouverMode.setImageResource(R.drawable.louver_airc_status_2);
-                    } else {
-                        // 4. Data Copy
-                        mDataLouver.louver = louverAPI.data;
-                    }
-                } catch (Exception e) {
-                    Log.e(TAG, "[Device_Update] - [Exception Error] louverAPI.Refresh()");
-                    Log.e(TAG, "[Device_Update] - " + e.toString());
-                    e.printStackTrace();
-                    //return -100;
-                }
-            }
-        }
-
-        // 5. Debug msg
-        if(DEBUG_LOG_ON)
-        {
-            DebugLogOutput("---------------------------------------");
-            DebugLogOutput("[Device_Update]");
-            DebugLogOutput("---------------------------------------");
-
-            if(Index == INDEX_LOUVER)
-            {
-                DebugLogOutput(mDataLouver.louver.ToDebugString());
-            }
-            DebugLogOutput("---------------------------------------");
-        }
-        DebugLogOutput("[Device_Update] - OK");
-
-        return 0;
-    }
-
 
     /**
      * 전체 on/off 변경 제어

+ 13 - 16
WallPadHomeCtrl/src/main/java/kr/co/icontrols/wallpadhomectrl/screen/screen_multi/KnxSystemAirconPopupTestScreen.java

@@ -608,20 +608,20 @@ public class KnxSystemAirconPopupTestScreen extends WpadScreen {
             ModeBtn[0].setButtonPressedImageID();
             //프로토콜 1.2 : 자동인 경우는 풍량 조절이 안되고 자동으로 고정
             //madeinlab 이후 disable 이미지를 요청해야 한다
-            VolumeEncBtn.setButtonEventOffEnable(R.drawable.btn_temp_up_normal);
-            VolumeDecBtn.setButtonEventOffEnable(R.drawable.btn_temp_down_normal);
+            VolumeEncBtn.setButtonEventOffEnable(R.drawable.btn_temp_up_disabled);
+            VolumeDecBtn.setButtonEventOffEnable(R.drawable.btn_temp_down_disabled);
         } else if (mode == KnxSystemAircon.MODE.Cold) {
             ModeBtn[1].setButtonPressedImageID();
         } else if (mode == KnxSystemAircon.MODE.Dry) {
             ModeBtn[2].setButtonPressedImageID();
             //제습인 경우, 온도 변경이 안되도록 한다.
-            VolumeEncBtn.setButtonEventOffEnable(R.drawable.btn_temp_up_normal);
-            VolumeDecBtn.setButtonEventOffEnable(R.drawable.btn_temp_down_normal);
+            TempEncBtn.setButtonEventOffEnable(R.drawable.btn_temp_up_disabled);
+            TempDecBtn.setButtonEventOffEnable(R.drawable.btn_temp_down_disabled);
         } else if (mode == KnxSystemAircon.MODE.Venti) {
             ModeBtn[3].setButtonPressedImageID();
             //송풍인 경우, 온도 변경이 안되도록 한다.
-            TempEncBtn.setButtonEventOffEnable(R.drawable.btn_temp_up_normal);
-            TempDecBtn.setButtonEventOffEnable(R.drawable.btn_temp_down_normal);
+            TempEncBtn.setButtonEventOffEnable(R.drawable.btn_temp_up_disabled);
+            TempDecBtn.setButtonEventOffEnable(R.drawable.btn_temp_down_disabled);
         } else if (mode == KnxSystemAircon.MODE.Heat) {
             ModeBtn[4].setButtonPressedImageID();
         } else {
@@ -768,8 +768,8 @@ public class KnxSystemAirconPopupTestScreen extends WpadScreen {
             ModeBtn[0].setButtonPressedImageID();
             //프로토콜 1.2 : 자동인 경우는 풍량 조절이 안되고 자동으로 고정
             //madeinlab 이후 disable 이미지로 교체한다.
-            VolumeEncBtn.setButtonEventOffEnable(R.drawable.btn_temp_up_normal);
-            VolumeDecBtn.setButtonEventOffEnable(R.drawable.btn_temp_down_normal);
+            VolumeEncBtn.setButtonEventOffEnable(R.drawable.btn_temp_up_disabled);
+            VolumeDecBtn.setButtonEventOffEnable(R.drawable.btn_temp_down_disabled);
             roomData.Volume = (byte) KnxSystemAircon.VOLUME.Auto;
             // 풍향 갱신
             Draw_NowVolumeChange(roomData.Volume);
@@ -777,19 +777,16 @@ public class KnxSystemAirconPopupTestScreen extends WpadScreen {
             mode = 0x01;
             ModeBtn[1].setButtonPressedImageID();
         } else if (index == ID.KNxSystemAirconPopup.button.MODE_3) {
+            //제습
             mode = 0x02;
             ModeBtn[2].setButtonPressedImageID();
-            //프로토콜 1.2 : 자동인 경우는 풍량 조절이 안되고 자동으로 고정
-            VolumeEncBtn.setButtonEventOffEnable(R.drawable.btn_temp_up_normal);
-            VolumeDecBtn.setButtonEventOffEnable(R.drawable.btn_temp_down_normal);
-            roomData.Volume = (byte) KnxSystemAircon.VOLUME.Auto;
-            // 풍향 갱신
-            Draw_NowVolumeChange(roomData.Volume);
+            TempEncBtn.setButtonEventOffEnable(R.drawable.btn_temp_up_disabled);
+            TempDecBtn.setButtonEventOffEnable(R.drawable.btn_temp_down_disabled);
         } else if (index == ID.KNxSystemAirconPopup.button.MODE_4) {
             mode = 0x03;
             ModeBtn[3].setButtonPressedImageID();
-            TempEncBtn.setButtonEventOffEnable(R.drawable.btn_temp_up_normal);
-            TempDecBtn.setButtonEventOffEnable(R.drawable.btn_temp_down_normal);
+            TempEncBtn.setButtonEventOffEnable(R.drawable.btn_temp_up_disabled);
+            TempDecBtn.setButtonEventOffEnable(R.drawable.btn_temp_down_disabled);
         } else if (index == ID.KNxSystemAirconPopup.button.MODE_5) {
             mode = 0x04;
             ModeBtn[4].setButtonPressedImageID();

+ 30 - 27
WallPadHomeCtrl/src/main/java/kr/co/icontrols/wallpadhomectrl/screen/screen_multi/LightKnxMainTestScreen.java

@@ -428,7 +428,18 @@ public class LightKnxMainTestScreen extends WpadScreen {
         }
     }
 
+    private void resetTimer(){
+        if(TT != null)
+        {
+            TT.cancel();
+            TT = null;
+        }
+        if (timer != null)
+            timer.purge();
+    }
+
     private void requestMultiControl(int kind, int reason, int position, String category, int number, int state) {
+        resetTimer();
         ((MainActivity) mContext).requestMultiControl(handler, JSON.MENU.LIGHT, kind, reason, position, category, number, state);
     }
 
@@ -450,6 +461,7 @@ public class LightKnxMainTestScreen extends WpadScreen {
 
     boolean delayLong = false;
     Timer timer;
+    TimerTask TT;
 
     @SuppressLint("HandlerLeak")
     final Handler handler = new Handler() {
@@ -467,24 +479,7 @@ public class LightKnxMainTestScreen extends WpadScreen {
                         if (resultData.getType().equals("controlResponse") && resultData.getResult().equals("ok")) {
                             //제어 명령을 내리고 제대로 응답이 오면 상태를 다시 조회해서 UI 갱신하도록 한다.
                             Sound().Play(SND.effect.TOUCH_LATCHED);
-                            timer = new Timer();
-                            TimerTask TT = new TimerTask() {
-                                @Override
-                                public void run() {
-                                    // 반복실행할 구문
-                                    updateData();
-                                }
-                            };
-                            timer.schedule(TT, 500, 3500); //Timer 실행
-/*
-                            new Handler().postDelayed(new Runnable() {
-                                @Override
-                                public void run() {
-                                    updateData();
-                                    delayLong = false;
-                                }
-                            }, delayLong==true?2500:500); // delayed가 true이면 3.5초 지연을 준 후 시작
-*/
+                            startRefreshTimer(1000);
                         } else if (resultData.getType().equals("updateResponse")) {
                             //상태 조회 응답이 오면, data를 갱신한다.
                             makeDeviceData(jsonObject);
@@ -528,12 +523,14 @@ public class LightKnxMainTestScreen extends WpadScreen {
         OPERATION_MODE = operationMode;
 
         mData = new Data_KnxLiv();
+        timer = new Timer();
 
         // 2. Device API Load & Update
         DebugLogOutput("[Create] - Step2 : Device API Load & Update");
         if (OPERATION_MODE == Common.MODE_NOMAL) {
             DebugLogOutput("OPERATION_MODE = MODE_NOMAL");
-            updateData();
+            startRefreshTimer(300);
+            //updateData();
         } else if (OPERATION_MODE == Common.MODE_BUSINESS_SAMPLE) {
             DebugLogOutput("OPERATION_MODE = MODE_BUSINESS_SAMPLE");
 
@@ -545,6 +542,18 @@ public class LightKnxMainTestScreen extends WpadScreen {
         }
     }
 
+    private void startRefreshTimer(int delay){
+        resetTimer();
+        TT = new TimerTask() {
+            @Override
+            public void run() {
+                // 반복실행할 구문
+                updateData();
+            }
+        };
+        timer.schedule(TT, delay, 4000); //Timer 실행
+    }
+
     private void Set_TotalPageNum(int AllNum) {
         if (AllNum > 24) {
             TotalPage = 4;
@@ -574,6 +583,7 @@ public class LightKnxMainTestScreen extends WpadScreen {
 
         wd.closeDB();
 
+        resetTimer();
         if (timer != null)
             timer.cancel();
     }
@@ -598,8 +608,7 @@ public class LightKnxMainTestScreen extends WpadScreen {
         } else if (MoveEvent == MotionEvent.ACTION_UP) {
             if ((TargetId >= ID.KnxLight.button.Room_TITLE_1) && (TargetId <= ID.KnxLight.button.Room_TITLE_1 + AllEMcount)) {
                 // 각방 세부 제어 팝업
-                if (timer != null)
-                    timer.cancel();
+                resetTimer();
                 int index = TargetId - ID.KnxLight.button.Room_TITLE_1;
                 DebugLogOutput("onTouchEvent [ROOM_" + (index + 1) + "] BUTTON !!!");
                 Sound().Play(SND.effect.TOUCH_LATCHED);
@@ -612,8 +621,6 @@ public class LightKnxMainTestScreen extends WpadScreen {
                 ((MainActivity) (getContext())).StartPopup(ID.screen.LightKnxPopupTestScreen, data);
             } else if ((TargetId >= ID.KnxLight.button.Light_Btn_1) && (TargetId <= ID.KnxLight.button.Light_Btn_1 + AllEMcount)) {
                 // 방별 조명 제어
-                if (timer != null)
-                    timer.cancel();
                 int index = TargetId - ID.KnxLight.button.Light_Btn_1;
                 index = ROOM_POS[index];
                 DebugLogOutput("onTouchEvent [LIGHT_" + (index + 1) + "] BUTTON !!!");
@@ -664,8 +671,6 @@ public class LightKnxMainTestScreen extends WpadScreen {
                 mLastClickTime = currentClickTime;
                 if (elapsedTime > MIN_CLICK_INTERVAL) {
                     //Device_All_Excecution_Release(false);
-                    if (timer != null)
-                        timer.cancel();
                     requestMultiControl(JSON.KIND.All, JSON.REASON.Control, JSON.POSITION.All, "all_execution_release", 0, 0);
                 }
             } else if (TargetId == ID.KnxLight.button.ALL_RELEASE) {
@@ -674,8 +679,6 @@ public class LightKnxMainTestScreen extends WpadScreen {
                 mLastClickTime = currentClickTime;
                 if (elapsedTime > MIN_CLICK_INTERVAL) {
                     //Device_All_Excecution_Release(true);
-                    if (timer != null)
-                        timer.cancel();
                     requestMultiControl(JSON.KIND.All, JSON.REASON.Control, JSON.POSITION.All, "all_execution_release", 0, 1);
                 }
             }

+ 30 - 19
WallPadHomeCtrl/src/main/java/kr/co/icontrols/wallpadhomectrl/screen/screen_multi/LightKnxPopupTestScreen.java

@@ -352,7 +352,18 @@ public class LightKnxPopupTestScreen extends WpadScreen {
         }
     }
 
+    private void resetTimer(){
+        if(TT != null)
+        {
+            TT.cancel();
+            TT = null;
+        }
+        if (timer != null)
+            timer.purge();
+    }
+
     private void requestMultiControl(int kind, int reason, int position, String category, int number, int state){
+        resetTimer();
         ((PopupActivity) mContext).requestMultiControl(handler, JSON.MENU.LIGHT, kind, reason, position, category, number, state);
     }
 
@@ -375,6 +386,8 @@ public class LightKnxPopupTestScreen extends WpadScreen {
     }
 
     Timer timer;
+    TimerTask TT;
+
     @SuppressLint("HandlerLeak")
     final Handler handler = new Handler() {
         Gson gson = new Gson();
@@ -391,15 +404,7 @@ public class LightKnxPopupTestScreen extends WpadScreen {
                         if(resultData.getType().equals("controlResponse")&&resultData.getResult().equals("ok")) {
                             //제어 명령을 내리고 제대로 응답이 오면 상태를 다시 조회해서 UI 갱신하도록 한다.
                             Sound().Play(SND.effect.TOUCH_LATCHED);
-                            timer = new Timer();
-                            TimerTask TT = new TimerTask() {
-                                @Override
-                                public void run() {
-                                    // 반복실행할 구문
-                                    updateData();
-                                }
-                            };
-                            timer.schedule(TT, 1000, 3500); //Timer 실행
+                            startRefreshTimer(500);
                         }
                         else if(resultData.getType().equals("updateResponse")) {
                             //상태 조회 응답이 오면, data를 갱신한다.
@@ -472,7 +477,21 @@ public class LightKnxPopupTestScreen extends WpadScreen {
             }
         }
 
-        updateData();
+        timer = new Timer();
+        startRefreshTimer(300);
+        //updateData();
+    }
+
+    private void startRefreshTimer(int delay){
+        resetTimer();
+        TT = new TimerTask() {
+            @Override
+            public void run() {
+                // 반복실행할 구문
+                updateData();
+            }
+        };
+        timer.schedule(TT, delay, 4000); //Timer 실행
     }
 
     /**
@@ -480,6 +499,7 @@ public class LightKnxPopupTestScreen extends WpadScreen {
      */
     @Override
     protected void onClose() {
+        resetTimer();
         if (timer != null)
             timer.cancel();
         super.onClose();
@@ -517,9 +537,6 @@ public class LightKnxPopupTestScreen extends WpadScreen {
                         Log.i(TAG, "[onStopTrackingTouch] - seekbarval2 = " + SeekBarValue);
                         {
                             if (mData.ControlType == false) {
-                                if (timer != null)
-                                    timer.cancel();
-
                                 Log.i(TAG, "[onStopTrackingTouch] - Set Dimming 2 ########################");
                                 requestMultiControl(JSON.KIND.All, JSON.REASON.Control, JSON.POSITION.All, "set_light_dimming", 0, SeekBarValue);
                                 //int ret = KnxApi.SetLightDimming(define.DEVICE_ALL_OR_NOTHING, (byte) (SeekBarValue));
@@ -601,8 +618,6 @@ public class LightKnxPopupTestScreen extends WpadScreen {
                 Draw_Update();
             } else if ((TargetId >= ID.lightKnxPopupRoom.button.LIGHT_1) && (TargetId <= ID.lightKnxPopupRoom.button.LIGHT_8)) {
                 // 개별 조명 제어
-                if (timer != null)
-                    timer.cancel();
                 int index = TargetId - ID.lightKnxPopupRoom.button.LIGHT_1;
                 DebugLogOutput("onTouchEvent [LIGHT_" + (index + 1) + "] BUTTON !!!");
 
@@ -613,8 +628,6 @@ public class LightKnxPopupTestScreen extends WpadScreen {
             } else if (TargetId == ID.lightKnxPopupRoom.button.ALL_ON) {
                 // 전체 켜기
                 DebugLogOutput("onTouchEvent [ALL_ON] BUTTON !!!");
-                if (timer != null)
-                    timer.cancel();
                 if (OPERATION_MODE == Common.MODE_NOMAL) {
                     requestMultiControl(JSON.KIND.Individual, JSON.REASON.Control, mCurrentRoomIndex, "switch_light_switch_all", 0, 0);
                     //int ret = Device_LightOnOffAll((byte) mCurrentRoomIndex, true);
@@ -626,8 +639,6 @@ public class LightKnxPopupTestScreen extends WpadScreen {
             } else if (TargetId == ID.lightKnxPopupRoom.button.ALL_OFF) {
                 // 전체 끄기
                 DebugLogOutput("onTouchEvent [ALL_OFF] BUTTON !!!");
-                if (timer != null)
-                    timer.cancel();
                 if (OPERATION_MODE == Common.MODE_NOMAL) {
                     requestMultiControl(JSON.KIND.Individual, JSON.REASON.Control, mCurrentRoomIndex, "switch_light_switch_all", 0, 1);
                     //int ret = Device_LightOnOffAll((byte) mCurrentRoomIndex, false);

+ 34 - 77
WallPadMultiControlService/src/main/java/kr/co/icontrols/wallpadmulticontrolservice/DataSenderService.java

@@ -495,13 +495,13 @@ public class DataSenderService extends Service {
                                     "{ \"hID\" : 3, \"hStatus\" : 2, \"hType\" : " + iValue + ", \"hErrorStatus\" : 0} ]" +
                                     "}";
 
-                            //outputStream.writeObject(result.toString());
+                            outputStream.writeObject(result.toString());
                             String resultTemp;
                             if (menu == 1003) resultTemp = sampleHeatingResult;
                             else if (menu == 1001) resultTemp = sampleLightResult;
                             else if (menu == 1006) resultTemp = sampleCookTopResult;
                             else resultTemp = sampleAirconResult;
-                            outputStream.writeObject(resultTemp);
+                            //outputStream.writeObject(resultTemp);
                             outputStream.close();
                             Log.d("ServerThread", "result 보냄 : " + resultTemp);
                         } catch (Exception e) {
@@ -1557,7 +1557,7 @@ public class DataSenderService extends Service {
                 }
             }
 
-            // 현대건설 더 펜트하우스 서버에서 설정된 UI 순서를 이용하도록 한다.
+            //서버에서 설정된 UI 순서를 이용하도록 한다.
             if (strValue != null) {
                 strHeating = strValue[1].substring((strValue[1].indexOf("난방(") + 3), (strValue[1].indexOf(")에어컨(")));
 
@@ -1984,18 +1984,29 @@ public class DataSenderService extends Service {
 
     private String getDeviceInfo(int index) {
         String strResult = "";
+        String strLight = "1_2_3_4_5_6_7_8_9_10_11_12_13_14_15_16_17_18_19_20";
+        String strHeating = "1_2_3_4_5_6_7_8_9_10_11_12_13_14_15_16_17_18_19_20";
+        String strAircon = "1_2_3_4_5_6_7_8_9_10_11_12_13_14_15_16_17_18_19_20";
+        Log.d(TAG, "[getDeviceInfo] Start !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
         try {
             WallpadDeviceSet devSet = new WallpadDeviceSet(getApplicationContext());
             int nConcentEnable = devSet.Get_Concent_Info();   // 콘센트 사용 유무
+            int Gasinfo = devSet.Get_GAS_Info();
+            int[] DoorLockInfo = devSet.Get_DoorLock_Info();
+            int[] lightinfo = devSet.Get_Light_info();
+            int[] Ventilinfo = devSet.Get_Ventil_Info();
+            int Temperinfo = devSet.Get_Temper_Info();
+            int[] Curtaininfo = devSet.Get_CURTAIN_Info();
             String[] strDeviceSeqValue = devSet.GetSettingData("UI순서");
-
-            String strLight = strDeviceSeqValue[1].substring( (strDeviceSeqValue[1].indexOf("조명(") + 3) , (strDeviceSeqValue[1].indexOf(")난방(")));
-            String strHeating = strDeviceSeqValue[1].substring( (strDeviceSeqValue[1].indexOf("난방(") + 3) , (strDeviceSeqValue[1].indexOf(")에어컨(")));
-            String strAircon = strDeviceSeqValue[1].substring( (strDeviceSeqValue[1].indexOf("에어컨(") + 4) , (strDeviceSeqValue[1].indexOf("))")));
-
-            strLight = (strLight.substring(strLight.indexOf(":")+1)).replaceAll("_","/");
-            strHeating = (strHeating.substring(strHeating.indexOf(":")+1)).replaceAll("_","/");
-            strAircon = (strAircon.substring(strAircon.indexOf(":")+1)).replaceAll("_","/");
+            devSet.closeDB();
+            if(strDeviceSeqValue!=null) {
+                strLight = strDeviceSeqValue[1].substring((strDeviceSeqValue[1].indexOf("조명(") + 3), (strDeviceSeqValue[1].indexOf(")난방(")));
+                strHeating = strDeviceSeqValue[1].substring((strDeviceSeqValue[1].indexOf("난방(") + 3), (strDeviceSeqValue[1].indexOf(")에어컨(")));
+                strAircon = strDeviceSeqValue[1].substring((strDeviceSeqValue[1].indexOf("에어컨(") + 4), (strDeviceSeqValue[1].indexOf("))")));
+                strLight = (strLight.substring(strLight.indexOf(":") + 1)).replaceAll("_", "/");
+                strHeating = (strHeating.substring(strHeating.indexOf(":") + 1)).replaceAll("_", "/");
+                strAircon = (strAircon.substring(strAircon.indexOf(":") + 1)).replaceAll("_", "/");
+            }
 
             String[] devlist;
             if(nConcentEnable==1){
@@ -2008,7 +2019,6 @@ public class DataSenderService extends Service {
                 if (devlist[i].equals("cooktop")) {
                     if (mWallPadAPI.GetGasKind() == 1) {
                         // 가스밸브
-                        int Gasinfo = devSet.Get_GAS_Info();
                         if (Gasinfo == 1) {
                             // 사용함
                             if (bGasAsCooktopOutlet) {
@@ -2046,7 +2056,6 @@ public class DataSenderService extends Service {
                 }
                 else if (devlist[i].equals("doorlock")) {
                     try {
-                        int[] DoorLockInfo = devSet.Get_DoorLock_Info();
                         if ((DoorLockInfo[0] == 1) && (DoorLockInfo[1] == WallpadDeviceSet.DOORLOCK_TYPE_NORMAL)) {
                             strResult += "         <devinfo name=\"doorlock\" value=\"1\" order=\"1\" floor=\"" + index + "\"/>\r\n";
                         } else {
@@ -2063,7 +2072,7 @@ public class DataSenderService extends Service {
                 }
                 else if (devlist[i].equals("light")) {
                     try {
-                        if (Version.getModelType() == Version.MODEL_TYPE.IHN_D101 || Version.getModelType() == Version.MODEL_TYPE.IHN_D101_I
+                        if (Version.getModelType() == Version.MODEL_TYPE.IHN_D101 || Version.getModelType() == Version.MODEL_TYPE.IHN_D101_I || Version.getModelType() == Version.MODEL_TYPE.IHN_D101_I_LX2
                                 || Version.getModelType() == Version.MODEL_TYPE.IHN_D101K || Version.getModelType() == Version.MODEL_TYPE.IHN_D101K_I
                                 || Version.getModelType() == Version.MODEL_TYPE.IHN_D101_I_OCF) {
                             strResult += "         <devinfo name=\"light\" value=\"0\" order=\"1\" floor=\"" + index + "\"/>\r\n";
@@ -2080,8 +2089,8 @@ public class DataSenderService extends Service {
                 }
                 else if (devlist[i].equals("livinglight")) {
                     try {
-                        int[] lightinfo = devSet.Get_Light_info();
-                        if (Version.getModelType() == Version.MODEL_TYPE.IHN_D101 || Version.getModelType() == Version.MODEL_TYPE.IHN_D101_I
+
+                        if (Version.getModelType() == Version.MODEL_TYPE.IHN_D101 || Version.getModelType() == Version.MODEL_TYPE.IHN_D101_I || Version.getModelType() == Version.MODEL_TYPE.IHN_D101_I_LX2
                                 || Version.getModelType() == Version.MODEL_TYPE.IHN_D101K || Version.getModelType() == Version.MODEL_TYPE.IHN_D101K_I
                                 || Version.getModelType() == Version.MODEL_TYPE.IHN_D101_I_OCF) {
                             strResult += "         <devinfo name=\"livinglight\" value=\"0\" order=\"1\" floor=\"" + index + "\"/>\r\n";
@@ -2098,7 +2107,6 @@ public class DataSenderService extends Service {
                 }
                 else if (devlist[i].equals("ventil")) {
                     try {
-                        int[] Ventilinfo = devSet.Get_Ventil_Info();
                         if (Ventilinfo[0] == 0)
                             strResult += "    <devinfo name=\"ventil\" value=\"0\" order=\"1\" floor=\"" + index + "\"/>\r\n";
                         else
@@ -2114,7 +2122,6 @@ public class DataSenderService extends Service {
                 }
                 else if (devlist[i].equals("thermostat")) {
                     try {
-                        int Temperinfo = devSet.Get_Temper_Info();
                         byte RoomCount = 0;
                         if (mHeatingV2API != null) {
                             RoomCount = mHeatingV2API.data.Device.info.RoomCount;
@@ -2135,7 +2142,6 @@ public class DataSenderService extends Service {
                 }
                 else if (devlist[i].equals("curtain")) {
                     try {
-                        int[] Curtaininfo = devSet.Get_CURTAIN_Info();
                         if (Curtaininfo[0] == 0)
                             strResult += "         <devinfo name=\"curtain\" value=\"0\" order=\"1\" floor=\"" + index + "\"/>\r\n";
                         else
@@ -2164,7 +2170,7 @@ public class DataSenderService extends Service {
                                         BadConcentCount++;
                                 }
                             }
-                            Log.e(TAG, "[yskim] iCMDProcDevList() electric : " + BadConcentCount);
+                            Log.d(TAG, "[yskim] iCMDProcDevList() electric : " + BadConcentCount);
                             strResult += "         <devinfo name=\"electric\" value=\"" + BadConcentCount +  "\" floor=\"" + index + "\"/>\r\n";
                         }
                     } catch (RuntimeException re) {
@@ -2181,9 +2187,9 @@ public class DataSenderService extends Service {
                     try {
                         if (mKnxAPI != null) {
                             if (mKnxAPI.data == null)
-                                Log.e(TAG, "[yskim] iCMDProcDevList KnxApi.data == null");
+                                Log.d(TAG, "[yskim] iCMDProcDevList KnxApi.data == null");
                             if (mKnxAPI.data.MasterController == null)
-                                Log.e(TAG, "[yskim] iCMDProcDevList KnxApi.data.MasterController == null");
+                                Log.d(TAG, "[yskim] iCMDProcDevList KnxApi.data.MasterController == null");
                             int LivingLightCount = 0;
                             if (mKnxAPI.data.LivingRoom_EnergyMeter.Info.Install == false) {
                                 Log.w(TAG, "[Registration_Light_NewLiv]mData.LivingRoom_EnergyMeter.Info.Install == false");
@@ -2203,7 +2209,7 @@ public class DataSenderService extends Service {
                     KnxSystemAirconAPI airconAPI = mWallPadAPI.Get_KnxAirconController();
                     if (airconAPI != null) {
                         int nCount = airconAPI.data.Device.info.InsideAirconCount;
-                        Log.e(TAG, "[yskim] iCMDProcDevList() sysaircon : " + nCount);
+                        Log.d(TAG, "[yskim] iCMDProcDevList() sysaircon : " + nCount);
                         // 현대건설 에어컨 처리, 포트가 다르기 때문에 구분해서 처리 필요, 에어컨 API가 동일하다면 그럴 필요는 없음
                         strResult += "         <devinfo name=\"sysaircon\" value=\"" + nCount + "\" order=\"" + strAircon + "\" floor=\"" + index + "\"/>\r\n";
                     } else {
@@ -2214,8 +2220,6 @@ public class DataSenderService extends Service {
             //방범, 센서 여부 응답(고급주택은 사용하지 않아 value 0으로 처리
             strResult += "         <devinfo name=\"mode\" value=\"" + 0 + "\" floor=\"" + index + "\"/>\r\n";
             strResult += "         <devinfo name=\"sensor\" value=\"" + 0 + "\" floor=\"" + index + "\"/>\r\n";
-            devSet.closeDB();
-
         } catch (Exception e) {
             e.printStackTrace();
             return strResult;
@@ -2283,7 +2287,7 @@ public class DataSenderService extends Service {
             int nDPType = wds.Get_DistributionPannelType_Info();
             wds.closeDB();
             if (mWallPadAPI.Check_Connect()) {
-                if (Version.getModelType() == Version.MODEL_TYPE.IHN_D101 || Version.getModelType() == Version.MODEL_TYPE.IHN_D101_I
+                if (Version.getModelType() == Version.MODEL_TYPE.IHN_D101 || Version.getModelType() == Version.MODEL_TYPE.IHN_D101_I || Version.getModelType() == Version.MODEL_TYPE.IHN_D101_I_LX2
                         || Version.getModelType() == Version.MODEL_TYPE.IHN_D101K || Version.getModelType() == Version.MODEL_TYPE.IHN_D101K_I
                         || Version.getModelType() == Version.MODEL_TYPE.IHN_D101_I_OCF) {
                     if (nDPType == Version.DISTRIBUTION_MODEL.SMART_DIST) {
@@ -2328,7 +2332,7 @@ public class DataSenderService extends Service {
             int nDPType = wds.Get_DistributionPannelType_Info();
             wds.closeDB();
             if (mWallPadAPI.Check_Connect()) {
-                if (Version.getModelType() == Version.MODEL_TYPE.IHN_D101 || Version.getModelType() == Version.MODEL_TYPE.IHN_D101_I
+                if (Version.getModelType() == Version.MODEL_TYPE.IHN_D101 || Version.getModelType() == Version.MODEL_TYPE.IHN_D101_I || Version.getModelType() == Version.MODEL_TYPE.IHN_D101_I_LX2
                         || Version.getModelType() == Version.MODEL_TYPE.IHN_D101K || Version.getModelType() == Version.MODEL_TYPE.IHN_D101K_I
                         || Version.getModelType() == Version.MODEL_TYPE.IHN_D101_I_OCF) {
                     deviceApiLoadLight();
@@ -2384,11 +2388,6 @@ public class DataSenderService extends Service {
                     mHeatingControl = new HeatingControl(mHeatingV2API, mContext);
                     mHeatingV2API.Refresh(HeatingV2API.REFRESH_IDX.ALL, false);
                     int roomCount = mHeatingV2API.data.Device.info.RoomCount;
-                    for (int i = 0; i < roomCount; i++) {
-                        mHeating.eachRoom[i].mode = mHeatingV2API.data.Device.Room[i].Mode;
-                        mHeating.eachRoom[i].curTemper = mHeatingV2API.data.Device.Room[i].NowTemp;
-                        mHeating.eachRoom[i].setTemper = mHeatingV2API.data.Device.Room[i].SetTemp;
-                    }
                 }
 
                 if (nDPType == Version.DISTRIBUTION_MODEL.KNX_DIST) {
@@ -2733,42 +2732,7 @@ public class DataSenderService extends Service {
             Log.i(TAG, "[checkChangedHeating] ===== START =====");
             if (mHeatingV2API != null) {
                 mHeatingV2API.Refresh(HeatingV2API.REFRESH_IDX.ALL, false);
-                boolean bChangeUnitState = false;
-                boolean bChangeTotalState = false;
-
-                int roomCount = mHeatingV2API.data.Device.info.RoomCount;
-
-                for (int i = 0; i < roomCount; i++) {
-                    bChangeUnitState = false;
-                    // 전원 상태 변화 확인
-                    if (mHeating.eachRoom[i].mode != mHeatingV2API.data.Device.Room[i].Mode) {
-                        bChangeUnitState = true;
-                    }
-
-                    // 0.5 도 단위로 전송
-                    double old_temer = mHeating.eachRoom[i].curTemper;
-                    double new_temer = mHeatingV2API.data.Device.Room[i].NowTemp;
-                    double diff = old_temer - new_temer;
-
-                    // 현재온도 변화 확인
-                    if (diff > 0.5 || diff < -0.5) {
-                        bChangeTotalState = true;
-                    }
-
-                    // 설정온도 변화 확인
-                    if (mHeating.eachRoom[i].setTemper != mHeatingV2API.data.Device.Room[i].SetTemp) {
-                        bChangeUnitState = true;
-                    }
-                }
-
-                //데이터 저장
-                if (bChangeTotalState == true) {
-                    for (int i = 0; i < roomCount; i++) {
-                        mHeating.eachRoom[i].mode = mHeatingV2API.data.Device.Room[i].Mode;
-                        mHeating.eachRoom[i].curTemper = mHeatingV2API.data.Device.Room[i].NowTemp;
-                        mHeating.eachRoom[i].setTemper = mHeatingV2API.data.Device.Room[i].SetTemp;
-                    }
-                }
+                mHeatingV2API.Refresh(HeatingV2API.REFRESH_IDX.BOILER, false);
             } else {
                 mHeatingV2API = mWallPadAPI.Get_HeatingV2Controller();
             }
@@ -3108,13 +3072,6 @@ public class DataSenderService extends Service {
                         deviceApiLoad();
 
                         break;
-
-                    // 디바이스 연결
-                    case define.NOTIFY_DEVICECONNECTED:
-                        Log.d(TAG, "[mMobileEventBR] ========== DeviceService Complite!! ==========");
-                        deviceApiLoad();
-                        break;
-
                     // 도어락 문열림
                     case define.NOTIFY_RFDOORLOCK_OPEN:
 //						Log.d(TAG, "*********************   NOTIFY_RFDOORLOCK_OPEN   ********************");
@@ -3260,7 +3217,7 @@ public class DataSenderService extends Service {
             IntentFilter mIntentFilter = new IntentFilter();
             mIntentFilter.addAction(define.NOTIFY_ACNAME);
             mIntentFilter.addAction(Common.BR_MAIN_NOTI.ACNAME_MAIN_NOTI);
-            if (Version.getModelType() == Version.MODEL_TYPE.IHN_D101 || Version.getModelType() == Version.MODEL_TYPE.IHN_D101_I
+            if (Version.getModelType() == Version.MODEL_TYPE.IHN_D101 || Version.getModelType() == Version.MODEL_TYPE.IHN_D101_I || Version.getModelType() == Version.MODEL_TYPE.IHN_D101_I_LX2
                     || Version.getModelType() == Version.MODEL_TYPE.IHN_D101K || Version.getModelType() == Version.MODEL_TYPE.IHN_D101K_I) {
                 if (nDPType == Version.DISTRIBUTION_MODEL.SMART_DIST) {
                     // 스마트 분전반
@@ -3304,7 +3261,7 @@ public class DataSenderService extends Service {
                     || Version.getModelType() == Version.MODEL_TYPE.IHN_1010GL
                     || Version.getModelType() == Version.MODEL_TYPE.IHN_1010GL_I) {
                 if (mEnergyMeterAPI != null) mEnergyMeterAPI.regChangedBR(BrID.BR_ENERGY_METER);
-            } else if (Version.getModelType() == Version.MODEL_TYPE.IHN_D101 || Version.getModelType() == Version.MODEL_TYPE.IHN_D101_I
+            } else if (Version.getModelType() == Version.MODEL_TYPE.IHN_D101 || Version.getModelType() == Version.MODEL_TYPE.IHN_D101_I || Version.getModelType() == Version.MODEL_TYPE.IHN_D101_I_LX2
                     || Version.getModelType() == Version.MODEL_TYPE.IHN_D101K || Version.getModelType() == Version.MODEL_TYPE.IHN_D101K_I) {
                 if (nDPType == Version.DISTRIBUTION_MODEL.SMART_DIST) {
                     // 스마트 분전반