Pārlūkot izejas kodu

관리자 설정 페이지 수정. 초기 위젯 설정. UI 이동 관련 오류 수정

jslee(madeinlab) 3 gadi atpakaļ
vecāks
revīzija
687873336a

+ 1 - 1
ManagerSetting/src/main/java/com/artncore/managersetting/dao/MainDatabaseManager.java

@@ -1552,7 +1552,7 @@ public class MainDatabaseManager {
                         break;
 
                     case SETTING_ITEM_SUB_DEVICE_SYSTEM_AIRCON:
-                        devInfo = "1(1:시스템에어컨(사용안함)종류(삼성))";
+                        devInfo = "1(1:시스템에어컨(사용함)종류(LG냉방))";
                         break;
 
                     case SETTING_ITEM_SUB_DEVICE_ELECTRONICALLY_CURTAIN:

+ 10 - 13
WallPadAPI/src/main/java/com/artncore/WallPadDataMgr/wallpaddbmgr.java

@@ -2601,7 +2601,7 @@ public class wallpaddbmgr {
     public void initWidgetData() {
         if (mModelType == Version.MODEL_TYPE.IHN_D101 || mModelType == Version.MODEL_TYPE.IHN_D101_I
                 || mModelType == Version.MODEL_TYPE.IHN_D101K || mModelType == Version.MODEL_TYPE.IHN_D101K_I
-                || mModelType == Version.MODEL_TYPE.IHN_D101_I_OCF) {
+                ) {
             InsertinitWidgetData(0, define.ICONS.MENUS.MAIN_ELEVATOR.getID());
             InsertinitWidgetData(1, define.ICONS.MENUS.TALK_FRONT.getID());
             InsertinitWidgetData(2, define.ICONS.MENUS.TALK_GUARD.getID());
@@ -2617,21 +2617,18 @@ public class wallpaddbmgr {
 
 
         }
-        else if(mModelType == Version.MODEL_TYPE.IHN_D101_I_LX2){
-            //InsertinitWidgetData(0, define.ICONS.MENUS.MAIN_ELEVATOR.getID());
+        else if(mModelType == Version.MODEL_TYPE.IHN_D101_I_LX2 || mModelType == Version.MODEL_TYPE.IHN_D101_I_OCF){
+            InsertinitWidgetData(0, define.ICONS.MENUS.TALK_NEIGHBOR.getID());
             InsertinitWidgetData(1, define.ICONS.MENUS.TALK_FRONT.getID());
-            //InsertinitWidgetData(2, define.ICONS.MENUS.TALK_GUARD.getID());
-            //InsertinitWidgetData(3, define.ICONS.MENUS.CTRL_LIVINGLIGHT.getID());
-            InsertinitWidgetData(8, define.ICONS.MENUS.CTRL_LIGHT.getID());   // 조명
+            InsertinitWidgetData(2, define.ICONS.MENUS.TALK_CALLHISTORY.getID());
+            InsertinitWidgetData(3, define.ICONS.MENUS.TALK_VISITORPIC.getID());
             InsertinitWidgetData(4, define.ICONS.MENUS.CTRL_HEATING.getID());
             InsertinitWidgetData(5, define.ICONS.MENUS.CTRL_VENT.getID());
-            InsertinitWidgetData(5, define.ICONS.MENUS.CTRL_SYSTEMAIRCON.getID());
-            InsertinitWidgetData(6, define.ICONS.MENUS.CTRL_GAS.getID());
-            InsertinitWidgetData(6, define.ICONS.MENUS.ENERGY_SMARTPANEL.getID());
-            //InsertinitWidgetData(7, define.ICONS.MENUS.ADD_NOTICE.getID());
-            //InsertinitWidgetData(8, define.ICONS.MENUS.ADD_MEMO.getID());
-            //InsertinitWidgetData(9, define.ICONS.MENUS.SECURITY_SETARMED.getID());
-            //InsertinitWidgetData(10, define.ICONS.MENUS.ADD_CCTV.getID());
+            InsertinitWidgetData(6, define.ICONS.MENUS.CTRL_SYSTEMAIRCON.getID());
+            InsertinitWidgetData(7, define.ICONS.MENUS.CTRL_LIGHT.getID());   // 조명
+            InsertinitWidgetData(8, define.ICONS.MENUS.CTRL_GAS.getID());
+            InsertinitWidgetData(9, define.ICONS.MENUS.ENERGY_REMOTEMETER.getID());   // 원격검침
+            InsertinitWidgetData(10, define.ICONS.MENUS.ENERGY_ENERGYCONSUMPTION.getID());   // 에너지 사용량
             InsertinitWidgetData(11, define.ICONS.MENUS.SETTING_CONFIG.getID());
         }
         else if (mModelType == Version.MODEL_TYPE.IHN_HS101 || mModelType == Version.MODEL_TYPE.IHN_HS101_I) {

+ 25 - 4
WallPadHomeCtrl/src/main/java/kr/co/icontrols/wallpadhomectrl/screen/screen_heating/HeatingV2MainScreen.java

@@ -922,10 +922,10 @@ public class HeatingV2MainScreen extends WpadScreen {
                 drawCurrentTemper(pos, roomData.NowTemp);
 
                 // 설정온도 표시
-                if (Data_DriveModeConverterOnOff(index)) drawSetTemper(pos, roomData.SetTemp);
+                if (Data_DriveModeConverterOnOffByBR(index)) drawSetTemper(pos, roomData.SetTemp);
                 else {
-                    if(roomView[index]!=null)
-                        roomView[index].TXT_TEMPER_SET.setText("");
+                    if(roomView[pos]!=null)
+                        roomView[pos].TXT_TEMPER_SET.setText("");
                 }
             }
 
@@ -1188,7 +1188,6 @@ public class HeatingV2MainScreen extends WpadScreen {
 
             float textsize = Common.fontsize._26_DEFAULT;
 
-            int pos = ROOM_POS[index];
             if (Data_DriveModeConverterOnOff((byte)index)) {
             //if (Data_DriveModeConverterOnOff((byte)pos)) {
                 roomView[index].BTN_ONOFF.setButtonRearImage();
@@ -1781,6 +1780,28 @@ public class HeatingV2MainScreen extends WpadScreen {
         return false;
     }
 
+    /**
+     * 운전모드에 따른 ON/OFF 스위치 상태를 반환한다.
+     *
+     * @return (boolean) true : 스위치ON , false : 스위치OFF
+     */
+    private boolean Data_DriveModeConverterOnOffByBR(byte index) {
+        if (mData == null) return false;
+        if (mData.heatingV2.Device.Room == null) return false;
+        if (mData.heatingV2.Device.Room.length <= index) return false;
+
+        byte mode = mData.heatingV2.Device.Room[index].Mode;
+
+        if (mode == HeatingV2.MODE.HeatingON) return true;
+        else if (mode == HeatingV2.MODE.HeatingOFF) return false;
+        else if (mode == HeatingV2.MODE.Outing) return false;
+        else if (mode == HeatingV2.MODE.Sleep) return true;
+        else if (mode == HeatingV2.MODE.Reservation) return true;
+        else if (mode == HeatingV2.MODE.Pause) return false;
+
+        return false;
+    }
+
     /**
      * {@link #mData} DriveMode 를 반환한다.
      *

+ 125 - 187
WallPadHomeCtrl/src/main/java/kr/co/icontrols/wallpadhomectrl/screen/screen_light/LightKnxMainScreen.java

@@ -45,6 +45,7 @@ import kr.co.icontrols.wallpadsupport.WpadTextView;
 public class LightKnxMainScreen extends WpadScreen {
     // [Define]
     String TAG = this.getClass().getSimpleName();
+
     private void DebugLogOutput(String s) {
         if (Common.DEBUG_LOG_ON) Log.d(TAG, s);
     }
@@ -168,7 +169,7 @@ public class LightKnxMainScreen extends WpadScreen {
     private Data_KnxLiv mData = null;
     private boolean NewLivingAPIUse = true;
     boolean livingEm_Kitchen_Use = false;
-    private String [] astrRoomTitle = null;             // 각방 명칭
+    private String[] astrRoomTitle = null;             // 각방 명칭
 
     int TotalPage = 1;
     int NowPage = 1;
@@ -179,11 +180,11 @@ public class LightKnxMainScreen extends WpadScreen {
     private static final int EM_TYPE = 0;
     private static final int SWITCH_TYPE = 1;
 
-    private final int[] ROOM_POS = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};
+    private final int[] ROOM_POS = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20};
     //private final int[] ROOM_POS = {10,11,12,13,14,15,16,7,8,9,0,1,2,3,4,5,6,17,18,19,20};
 
     private String[] mKNXDefaultRoomNameList = new String[]{"거실", "거실", "침실4", "침실1", "파우더룸", "침실2", "주방1", "침실3",
-            "복도1", "욕실1", "욕실2","보조주방","욕실3","욕실4","욕실5","복도2", "현관", "신발장", "창고", "주방2", "간이주방", "서재1", "작업실","드레스룸3","추가룸1","추가룸2","추가룸3","추가룸4","추가룸5"};
+            "복도1", "욕실1", "욕실2", "보조주방", "욕실3", "욕실4", "욕실5", "복도2", "현관", "신발장", "창고", "주방2", "간이주방", "서재1", "작업실", "드레스룸3", "추가룸1", "추가룸2", "추가룸3", "추가룸4", "추가룸5"};
 
     // [Class]
 
@@ -233,25 +234,20 @@ public class LightKnxMainScreen extends WpadScreen {
         public WpadImageView OnOffBtn;    // OnOff 버튼
 
 
-        public LightRoom(int index, int left, int top, int LightNum, String roomName, int type) {
-            //if(mData == null) return;
-
-            lightNum = LightNum;
-
+        public LightRoom(int index, int left, int top, String roomName, int type, int seq) {
             // 배경 그리기
             RoomBackground = new WpadImageView(getContext(), WpadImageView.TOUCH_KIND.NONE, 241, 273, R.drawable.knx_light_box_1, R.drawable.knx_light_box_1, ID.KnxLight.image.Room_BACKGROUND_1 + index);
             ViewRegistration(getLayout(), RoomBackground, Common.ImgPosion.GetX(left), Common.ImgPosion.GetY(top));
 
             // 방 이름 버튼
-            RoomTitleBg = new WpadImageView(getContext(), WpadImageView.TOUCH_KIND.BUTTON, 221, 56, R.drawable.knx_btn_room_normal, R.drawable.knx_btn_room_pressed, ID.KnxLight.button.Room_TITLE_1 + index);
+            RoomTitleBg = new WpadImageView(getContext(), WpadImageView.TOUCH_KIND.BUTTON, 221, 56, R.drawable.knx_btn_room_normal, R.drawable.knx_btn_room_pressed, ID.KnxLight.button.Room_TITLE_1 + seq);
             ViewRegistration(getLayout(), RoomTitleBg, Common.ImgPosion.GetX(left + 10), Common.ImgPosion.GetY(top + 10));
 
             // 방 이름 텍스트
-            RoomTitleText = new WpadTextView(getContext(), false, 221, 56, Gravity.CENTER, Color.BLACK, Common.fontsize._30, true, ID.KnxLight.text.Room_TITLE_1 + index);
+            RoomTitleText = new WpadTextView(getContext(), false, 221, 56, Gravity.CENTER, Color.BLACK, Common.fontsize._30, true, ID.KnxLight.text.Room_TITLE_1 + seq);
             ViewRegistration(getLayout(), RoomTitleText, Common.ImgPosion.GetX(left + 10), Common.ImgPosion.GetY(top + 10));
             RoomTitleText.setTextSize(0, Common.fontsize._30);
-            if(roomName.length() == 6)
-            {
+            if (roomName.length() == 6) {
                 RoomTitleText.setTextSize(0, Common.fontsize._26_DEFAULT);
             }
             RoomTitleText.setText(roomName);
@@ -349,26 +345,26 @@ public class LightKnxMainScreen extends WpadScreen {
         devSet.closeDB();
 
         //서버에서 설정된 UI 순서를 이용하도록 한다.
-        if( strValue != null ) {
-            String strLight = strValue[1].substring( (strValue[1].indexOf("조명(") + 3) , (strValue[1].indexOf(")난방(")));
+        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("))")));
 
             int strLightCount = Integer.valueOf(strLight.substring(0, strLight.indexOf(":")));
 
-            if(strLightCount==(mData.MasterController.Info.Light_SwitchCount + mData.MasterController.Info.Bad_EnergyMeterCount + mData.MasterController.Info.Liv_EnergyMeterCount)){
+            if (strLightCount == (mData.MasterController.Info.Light_SwitchCount + mData.MasterController.Info.Bad_EnergyMeterCount + mData.MasterController.Info.Liv_EnergyMeterCount)) {
                 //개수가 일치하는 경우에 적용
-                strLight = strLight.substring(strLight.indexOf(":")+1);
+                strLight = strLight.substring(strLight.indexOf(":") + 1);
                 String[] strDataSeq = strLight.split("_");
 
                 for (int i = 0; i < strDataSeq.length; i++) {
-                    ROOM_POS[i] = Integer.valueOf(strDataSeq[i])-1;
+                    ROOM_POS[i] = Integer.valueOf(strDataSeq[i]) - 1;
                 }
             }
         }
 
         //EMcount 개수만큼 방이름을 만든다.
-        if (getRoomName==null) astrRoomTitle = mKNXDefaultRoomNameList;
+        if (getRoomName == null) astrRoomTitle = mKNXDefaultRoomNameList;
         else astrRoomTitle = getRoomName;
 
         Log.i(TAG, "[HeatingV2MainScreen] astrRoomTitle: " + Arrays.toString(astrRoomTitle));
@@ -414,7 +410,7 @@ public class LightKnxMainScreen extends WpadScreen {
                 Device_BrRegistration(true);
                 Registration_Light_New();
                 Draw_Update_New();
-                Draw_CurrentPage(AllEMcount, (CurrentPageNum - 1) * ROOM_CNT);
+                //Draw_CurrentPage(AllEMcount, (CurrentPageNum - 1) * ROOM_CNT);
 
                 if (MainActivity.getHideMenuOn())
                     transactionDisplay = new TransactionDisplay(true, (WallPadDevAPI) KnxApi, (WpadScreen) this);
@@ -482,7 +478,7 @@ public class LightKnxMainScreen extends WpadScreen {
                         for (int i = 0; i < AllEMcount; i++) {
                             drawEntireRoomTitle(i);
                         }
-                        ((MainActivity)mContext).mRoomNameList_Heating = astrRoomTitle;
+                        ((MainActivity) mContext).mRoomNameList_Heating = astrRoomTitle;
                     }
                     wallpadStatusData.closeDB();
                 }
@@ -508,14 +504,13 @@ public class LightKnxMainScreen extends WpadScreen {
      * 방명칭을 개별적으로 화면에 반영한다.
      *
      * @param index - (int) 변경할 룸의 인덱스
-     * param TitleStr - (String) 변경할 명칭
+     *              param TitleStr - (String) 변경할 명칭
      */
     private void drawRoomTitle(int index, String value) {
-        if(!checkRoomIndex(index)) return;
+        if (!checkRoomIndex(index)) return;
         lightRooms[index].RoomTitleText.setText(value);
         lightRooms[index].RoomTitleText.setTextSize(0, Common.fontsize._30);
-        if(value.length() == 6)
-        {
+        if (value.length() == 6) {
             lightRooms[index].RoomTitleText.setTextSize(0, Common.fontsize._26_DEFAULT);
         }
     }
@@ -566,7 +561,8 @@ public class LightKnxMainScreen extends WpadScreen {
             setFinishTimerReset();
         }
     }
-    private void setOnOff_BadRoom_EnergyMeter(int index){
+
+    private void setOnOff_BadRoom_EnergyMeter(int index) {
         boolean OnOff = false;
         for (int i = 0; i < mData.BadRoom_EnergyMeter[index].Info.LightCount; i++) {
             if (mData.BadRoom_EnergyMeter[index].Info.Install) {
@@ -583,7 +579,8 @@ public class LightKnxMainScreen extends WpadScreen {
         if (ret >= 0) Sound().Play(SND.effect.TOUCH_LATCHED);
         else Sound().Play(SND.effect.TOUCH_UNLATCHED);
     }
-    private void setOnOff_Light_Switch(int index){
+
+    private void setOnOff_Light_Switch(int index) {
         boolean OnOff = false;
         for (int i = 0; i < mData.Light_Switch[index].Info.LightCount; i++) {
             if (mData.Light_Switch[index].Info.Install) {
@@ -601,8 +598,8 @@ public class LightKnxMainScreen extends WpadScreen {
         else Sound().Play(SND.effect.TOUCH_UNLATCHED);
     }
 
-    private long mLastClickTime=0;
-    private  final  long MIN_CLICK_INTERVAL = 2000;
+    private long mLastClickTime = 0;
+    private final long MIN_CLICK_INTERVAL = 2000;
 
     @Override
     protected void onTouchEvent(View v, MotionEvent event) {
@@ -629,7 +626,7 @@ public class LightKnxMainScreen extends WpadScreen {
             } else if ((TargetId >= ID.KnxLight.button.Light_Btn_1) && (TargetId <= ID.KnxLight.button.Light_Btn_1 + AllEMcount)) {
                 // 방별 조명 제어
                 int index = TargetId - ID.KnxLight.button.Light_Btn_1;
-                index = ROOM_POS[index];
+                //index = ROOM_POS[index];
                 DebugLogOutput("onTouchEvent [LIGHT_" + (index + 1) + "] BUTTON !!!");
 
                 boolean OnOff = false;
@@ -653,20 +650,19 @@ public class LightKnxMainScreen extends WpadScreen {
                         if (ret >= 0) {
                             Sound().Play(SND.effect.TOUCH_LATCHED);
                             long EndTime = System.currentTimeMillis();
-                            DebugLogOutput("[SetLivingLightOnOff]" + "index = "+ index + ",EndTime = " + EndTime);
-                        }
-                        else Sound().Play(SND.effect.TOUCH_UNLATCHED);
-                    } else if(index>0 && index<emCount){
-                        setOnOff_BadRoom_EnergyMeter(index-1);
-                    } else{
+                            DebugLogOutput("[SetLivingLightOnOff]" + "index = " + index + ",EndTime = " + EndTime);
+                        } else Sound().Play(SND.effect.TOUCH_UNLATCHED);
+                    } else if (index > 0 && index < emCount) {
+                        setOnOff_BadRoom_EnergyMeter(index - 1);
+                    } else {
                         //조명스위치 제어
-                        setOnOff_Light_Switch(index-emCount);
+                        setOnOff_Light_Switch(index - emCount);
                     }
                 } else {
-                    if(index<emCount)
+                    if (index < emCount)
                         setOnOff_BadRoom_EnergyMeter(index);
                     else
-                        setOnOff_Light_Switch(index-emCount);
+                        setOnOff_Light_Switch(index - emCount);
                 }
 
                 if (OPERATION_MODE == Common.MODE_BUSINESS_SAMPLE) {
@@ -689,14 +685,14 @@ public class LightKnxMainScreen extends WpadScreen {
                 long currentClickTime = SystemClock.uptimeMillis();
                 long elapsedTime = currentClickTime - mLastClickTime;
                 mLastClickTime = currentClickTime;
-                if(elapsedTime>MIN_CLICK_INTERVAL){
+                if (elapsedTime > MIN_CLICK_INTERVAL) {
                     Device_All_Excecution_Release(false);
                 }
             } else if (TargetId == ID.KnxLight.button.ALL_RELEASE) {
                 long currentClickTime = SystemClock.uptimeMillis();
                 long elapsedTime = currentClickTime - mLastClickTime;
                 mLastClickTime = currentClickTime;
-                if(elapsedTime>MIN_CLICK_INTERVAL){
+                if (elapsedTime > MIN_CLICK_INTERVAL) {
                     Device_All_Excecution_Release(true);
                 }
             }
@@ -739,8 +735,7 @@ public class LightKnxMainScreen extends WpadScreen {
         } catch (RuntimeException re) {
             LogUtil.errorLogInfo("", TAG, re);
             return -100;
-        }
-		catch (Exception e) {
+        } catch (Exception e) {
             Log.e(TAG, "[Device_ApiLoad_Knx] - [Exception Error] wpapi.Get_KnxController");
             Log.e(TAG, "[Device_ApiLoad_Knx] - " + e.toString());
             //e.printStackTrace();
@@ -781,8 +776,7 @@ public class LightKnxMainScreen extends WpadScreen {
             } catch (RuntimeException re) {
                 LogUtil.errorLogInfo("", TAG, re);
                 return -101;
-            }
-            catch (Exception e) {
+            } catch (Exception e) {
                 Log.e(TAG, "[Device_BrRegistration] - [Exception Error] KnxLivApi.regChangedBR");
                 Log.e(TAG, "[Device_BrRegistration] - " + e.toString());
                 //e.printStackTrace();
@@ -800,8 +794,7 @@ public class LightKnxMainScreen extends WpadScreen {
             } catch (RuntimeException re) {
                 LogUtil.errorLogInfo("", TAG, re);
                 return -102;
-            }
-            catch (Exception e) {
+            } catch (Exception e) {
                 Log.e(TAG, "[Device_BrRegistration] - [Exception Error] KnxLivApi.unregChangedBR");
                 Log.e(TAG, "[Device_BrRegistration] - " + e.toString());
                 //e.printStackTrace();
@@ -838,8 +831,7 @@ public class LightKnxMainScreen extends WpadScreen {
         } catch (RuntimeException re) {
             LogUtil.errorLogInfo("", TAG, re);
             return -100;
-        }
-		catch (Exception e) {
+        } catch (Exception e) {
             Log.e(TAG, "[Device_Update_Knx] - [Exception Error] KnxApi.Refresh( )");
             //e.printStackTrace();
             LogUtil.errorLogInfo("", TAG, e);
@@ -863,7 +855,7 @@ public class LightKnxMainScreen extends WpadScreen {
      */
     private void Device_All_Excecution_Release(boolean onoff) {
         boolean OnOff = onoff;
-        if(KnxApi == null) return;
+        if (KnxApi == null) return;
         int ret = KnxApi.AllLightOnOff(OnOff);
         if (ret >= 0) Sound().Play(SND.effect.TOUCH_LATCHED);
         else Sound().Play(SND.effect.TOUCH_UNLATCHED);
@@ -886,8 +878,8 @@ public class LightKnxMainScreen extends WpadScreen {
                 if (lightRooms[j] != null)
                     lightRooms[j].setVisible(false);
             }
-            for (int j = startIdx; j < startIdx+ROOM_CNT; j++) {
-                if(j>=roomCount)    break;
+            for (int j = startIdx; j < startIdx + ROOM_CNT; j++) {
+                if (j >= roomCount) break;
                 if (lightRooms[j] != null)
                     lightRooms[j].setVisible(true);
             }
@@ -906,8 +898,7 @@ public class LightKnxMainScreen extends WpadScreen {
  */
         } catch (RuntimeException re) {
             LogUtil.errorLogInfo("", TAG, re);
-        }
-		catch (Exception e) {
+        } catch (Exception e) {
             //e.printStackTrace();
             LogUtil.errorLogInfo("", TAG, e);
         }
@@ -931,41 +922,40 @@ public class LightKnxMainScreen extends WpadScreen {
             Draw_Update_New();
         } catch (RuntimeException re) {
             LogUtil.errorLogInfo("", TAG, re);
-        }
-		catch (Exception e) {
+        } catch (Exception e) {
             Log.e(TAG, "[Exception] MovePage()");
             //e.printStackTrace();
             LogUtil.errorLogInfo("", TAG, e);
         }
     }
 
-    private void Draw_LightStatus_BadRoom(int startIndex){
+    private void Draw_LightStatus_BadRoom(int startIndex) {
         for (int j = 0; j < mData.MasterController.Info.Bad_EnergyMeterCount; j++) {
             for (int i = 0; i < mData.BadRoom_EnergyMeter[j].Info.LightCount; i++) {
                 //if (mData.BadRoom_EnergyMeter[j].Info.Install) {
-                    if (mData.BadRoom_EnergyMeter[j].Data.BadLight[i].Data.OnOff == true) {
-                        Draw_LightStatusChange(j + startIndex, true, false);
-                        break;
-                    }
-                    if (i == mData.BadRoom_EnergyMeter[j].Info.LightCount - 1) {
-                        Draw_LightStatusChange(j + startIndex, false, false);
-                    }
+                if (mData.BadRoom_EnergyMeter[j].Data.BadLight[i].Data.OnOff == true) {
+                    Draw_LightStatusChange(j + startIndex, true, false);
+                    break;
+                }
+                if (i == mData.BadRoom_EnergyMeter[j].Info.LightCount - 1) {
+                    Draw_LightStatusChange(j + startIndex, false, false);
+                }
                 //}
             }
         }
     }
 
-    private void Draw_LightStatus_LightSwitch(int startIndex){
+    private void Draw_LightStatus_LightSwitch(int startIndex) {
         for (int j = 0; j < mData.MasterController.Info.Light_SwitchCount; j++) {
             for (int i = 0; i < mData.Light_Switch[j].Info.LightCount; i++) {
                 //if (mData.Light_Switch[j].Info.Install) {
-                    if (mData.Light_Switch[j].Data.LightSwitch[i].Data.OnOff == true) {
-                        Draw_LightStatusChange(j + startIndex, true, true);
-                        break;
-                    }
-                    if (i == mData.Light_Switch[j].Info.LightCount - 1) {
-                        Draw_LightStatusChange(j + startIndex, false, true);
-                    }
+                if (mData.Light_Switch[j].Data.LightSwitch[i].Data.OnOff == true) {
+                    Draw_LightStatusChange(j + startIndex, true, true);
+                    break;
+                }
+                if (i == mData.Light_Switch[j].Info.LightCount - 1) {
+                    Draw_LightStatusChange(j + startIndex, false, true);
+                }
                 //}
             }
         }
@@ -981,52 +971,75 @@ public class LightKnxMainScreen extends WpadScreen {
         DebugLogOutput("[Draw_Update_New] Start !!!");
         Device_Update_Knx();
         //설정 상태 확인
-        if(mData.MasterController.Info.Fault_KnxGwSet){
+        if (mData.MasterController.Info.Fault_KnxGwSet) {
             LedConverter.setImageResource(R.drawable.knx_light_led_set_3);
-        }else{
+        } else {
             LedConverter.setImageResource(R.drawable.knx_light_led_set_1);
         }
         //전체소등/전체해제 확인
-        if(mData.MasterController.Data.BatchOffStatus== KNX_DataClasses.BATCHOFF_STATUS.SET){
+        if (mData.MasterController.Data.BatchOffStatus == KNX_DataClasses.BATCHOFF_STATUS.SET) {
             AllExecutionBtn.setButtonEventOffEnable(R.drawable.knx_light_btn_all_off_disabled);
             AllReleaseBtn.setButtonEventOffDisable();
-        }else{
+        } else {
             AllReleaseBtn.setButtonEventOffEnable(R.drawable.knx_light_btn_all_on_disabled);
             AllExecutionBtn.setButtonEventOffDisable();
         }
         //각 방 조명 이미지
         int emCount = 0;
-        emCount = mData.MasterController.Info.Liv_EnergyMeterCount + mData.MasterController.Info.Bad_EnergyMeterCount;
+        int totalCount = 0;
+        int BadLightCount = mData.MasterController.Info.Bad_EnergyMeterCount;
+        int SwitchCount = mData.MasterController.Info.Light_SwitchCount;
+        emCount = mData.MasterController.Info.Liv_EnergyMeterCount + BadLightCount;
+        totalCount = emCount + SwitchCount;
+
         try {
-            if (mData.LivingRoom_EnergyMeter.Info.Install) {
-                for (int i = 0; i < mData.LivingRoom_EnergyMeter.Info.LightCount; i++) {
-                    if (mData.LivingRoom_EnergyMeter.Data.LivingLight[i].Info.Install) {
-                        //Log.i(TAG, "i = " + i + " OnOff = " + );
-                        if (mData.LivingRoom_EnergyMeter.Data.LivingLight[i].Data.OnOff == true) {
-                            Draw_LightStatusChange(1, true, false);
+            for (int k = 0; k < totalCount; k++) {
+                if (mData.LivingRoom_EnergyMeter.Info.Install && ROOM_POS[k] == 0) {
+                    for (int i = 0; i < mData.LivingRoom_EnergyMeter.Info.LightCount; i++) {
+                        if (mData.LivingRoom_EnergyMeter.Data.LivingLight[i].Info.Install) {
+                            //Log.i(TAG, "i = " + i + " OnOff = " + );
+                            if (mData.LivingRoom_EnergyMeter.Data.LivingLight[i].Data.OnOff == true) {
+                                Draw_LightStatusChange(k + 1, true, false);
+                                break;
+                            }
+                            if (i == mData.LivingRoom_EnergyMeter.Info.LightCount - 1) {
+                                Draw_LightStatusChange(k + 1, false, false);
+                            }
+                        }
+                    }
+                } else if (ROOM_POS[k] < emCount) {
+                    for (int i = 0; i < mData.BadRoom_EnergyMeter[ROOM_POS[k] - 1].Info.LightCount; i++) {
+                        //if (mData.BadRoom_EnergyMeter[j].Info.Install) {
+                        if (mData.BadRoom_EnergyMeter[ROOM_POS[k] - 1].Data.BadLight[i].Data.OnOff == true) {
+                            Draw_LightStatusChange(k + 1, true, false);
                             break;
                         }
-                        if (i == mData.LivingRoom_EnergyMeter.Info.LightCount - 1) {
-                            Draw_LightStatusChange(1, false, false);
+                        if (i == mData.BadRoom_EnergyMeter[ROOM_POS[k] - 1].Info.LightCount - 1) {
+                            Draw_LightStatusChange(k + 1, false, false);
                         }
                     }
+                } else {
+                    for (int i = 0; i < mData.Light_Switch[ROOM_POS[k] - emCount].Info.LightCount; i++) {
+                        //if (mData.Light_Switch[j].Info.Install) {
+                        if (mData.Light_Switch[ROOM_POS[k] - emCount].Data.LightSwitch[i].Data.OnOff == true) {
+                            Draw_LightStatusChange(k + 1, true, true);
+                            break;
+                        }
+                        if (i == mData.Light_Switch[ROOM_POS[k] - emCount].Info.LightCount - 1) {
+                            Draw_LightStatusChange(k + 1, false, true);
+                        }
+                        //}
+                    }
                 }
-                Draw_LightStatus_BadRoom(2);
-                Draw_LightStatus_LightSwitch(emCount+1);
-            } else {
-                Draw_LightStatus_BadRoom(1);
-                Draw_LightStatus_LightSwitch(emCount+1);
             }
         } catch (RuntimeException re) {
             LogUtil.errorLogInfo("", TAG, re);
-            lightRooms[0] = null;
-        }
-		catch (Exception e) {
+        } catch (Exception e) {
             Log.e(TAG, "[Exception Error] - [Create] LightView new");
             //e.printStackTrace();
             LogUtil.errorLogInfo("", TAG, e);
-            lightRooms[0] = null;
         }
+
         //현재방 상태에 따라 보여지지 말아야 할 조명은 제거한다.
         Draw_CurrentPage(AllEMcount, (CurrentPageNum - 1) * ROOM_CNT);
     }
@@ -1036,7 +1049,7 @@ public class LightKnxMainScreen extends WpadScreen {
      *
      * @param LightNumber - 변경할 조명 번호 (1~4 각조명 [조명개수를 초과할 경우 변경되지않는다])
      * @param OnOff       - true : ON / false : OFF
-     * @param isSwitch       - true : 조명스위치 / false : 에너지미터 조명
+     * @param isSwitch    - true : 조명스위치 / false : 에너지미터 조명
      */
     private void Draw_LightStatusChange(int LightNumber, boolean OnOff, boolean isSwitch) {
         int startIdx = (CurrentPageNum - 1) * ROOM_CNT;
@@ -1045,8 +1058,7 @@ public class LightKnxMainScreen extends WpadScreen {
         if (lightRooms == null) return;
         if (LightNumber > lightRooms.length) return;
 
-        int index = ROOM_POS[LightNumber - 1];
-        //int index = LightNumber - 1;
+        int index = LightNumber - 1;
 
         //현재 페이지만 갱신하도록 한다.
         if (index >= startIdx + ROOM_CNT) return;
@@ -1056,13 +1068,13 @@ public class LightKnxMainScreen extends WpadScreen {
 
         DebugLogOutput("[Draw_LightStatusChange] LightNumber : " + LightNumber + " / OnOff : " + OnOff);
         // 추후 스위치인지, 에너지미터인지에 따라 구분이 필요할 수 있다.
-        if(isSwitch) {
+        if (isSwitch) {
             if (OnOff) {
                 lightRooms[index].OnOffBtn.setButtonRearImage();
             } else {
                 lightRooms[index].OnOffBtn.setButtonFrontImage();
             }
-        }else{
+        } else {
             if (OnOff) {
                 lightRooms[index].OnOffBtn.setButtonRearImage();
             } else {
@@ -1115,101 +1127,28 @@ public class LightKnxMainScreen extends WpadScreen {
             Log.d(TAG, "installCount = " + installCount);
 
             int posIndex = totalLightCount - 1;
-            //if (installCount < totalLightCount) {
-            //    posIndex = installCount - 1;
-            //    Log.d(TAG, "installCount < LightCount --> change posIndex : " + posIndex);
-            //}
-
-            int createLight = 0;
-
-            //거실 에너지 미터 조명
-            try {
-                if (mData.LivingRoom_EnergyMeter.Info.Install) {
-                    int pos = ROOM_POS[createLight];
-                    int left, top;
-                    if (bEasyModeUse) {
-                        left = (mPos_easymode[posIndex][pos][0]);
-                        top = (mPos_easymode[posIndex][pos][1]);
-                        //left = (mPos_easymode[posIndex][createLight][0]);
-                        //top = (mPos_easymode[posIndex][createLight][1]);
-                    } else {
-                        left = (mPos[posIndex][pos][0]);
-                        top = (mPos[posIndex][pos][1]);
-                        //left = (mPos[posIndex][createLight][0]);
-                        //top = (mPos[posIndex][createLight][1]);
-                    }
-                    String name = astrRoomTitle[createLight];
-                    Log.d(TAG, "[Registration_Light_New] - name[" + name + "] = ");
 
-                    lightRooms[pos] = new LightRoom(ROOM_POS[0], left, top, createLight, name, EM_TYPE);
-                    //lightRooms[createLight] = new LightRoom(0, left, top, createLight, name, EM_TYPE);
-                    createLight++;
-                }
-            } catch (RuntimeException re) {
-                LogUtil.errorLogInfo("", TAG, re);
-                lightRooms[0] = null;
-            }
-            catch (Exception e) {
-                Log.e(TAG, "[Exception Error] - [Create] LightView new");
-                //e.printStackTrace();
-                LogUtil.errorLogInfo("", TAG, e);
-                lightRooms[0] = null;
-            }
-            for (int i = 0; i < BadLightCount; i++) {
+            for (int i = 0; i < totalLightCount; i++) {
                 try {
-                    //if (mData.BadRoom_EnergyMeter[i].Info.Install) {
-                        int pos = ROOM_POS[createLight];
+                    int pos = ROOM_POS[i];
+                    if (pos < LivingLightCount + BadLightCount) {
                         int left, top;
-                        if (bEasyModeUse) {
-                            left = (mPos_easymode[posIndex][pos][0]);
-                            top = (mPos_easymode[posIndex][pos][1]);
-                        } else {
-                            left = (mPos[posIndex][pos][0]);
-                            top = (mPos[posIndex][pos][1]);
-                        }
-                        String name = astrRoomTitle[i+1];
-                        Log.d(TAG, "[Registration_Light_New] - name[" + (i + 1) + "] = " + name);
-
-                        lightRooms[pos] = new LightRoom(ROOM_POS[i + LivingLightCount], left, top, createLight, name, EM_TYPE);
-                        //lightRooms[createLight] = new LightRoom(i + LivingLightCount, left, top, createLight, name, EM_TYPE);
-                        createLight++;
-                    //}
-                } catch (RuntimeException re) {
-                    LogUtil.errorLogInfo("", TAG, re);
-                    lightRooms[i] = null;
-                }
-                catch (Exception e) {
-                    Log.e(TAG, "[Exception Error] - [Create] LightView new");
-                    //e.printStackTrace();
-                    LogUtil.errorLogInfo("", TAG, e);
-                    lightRooms[i] = null;
-                }
-            }
-            for (int i = 0; i < SwitchCount; i++) {
-                try {
-                    //if (mData.Light_Switch[i].Info.Install) {
-                        int pos = ROOM_POS[createLight];
+                        left = (mPos[posIndex][i][0]);
+                        top = (mPos[posIndex][i][1]);
+                        String name = astrRoomTitle[pos];
+                        lightRooms[i] = new LightRoom(pos, left, top, name, EM_TYPE, i);
+                    } else {
                         int left, top;
-                        if (bEasyModeUse) {
-                            left = (mPos_easymode[posIndex][pos][0]);
-                            top = (mPos_easymode[posIndex][pos][1]);
-                        } else {
-                            left = (mPos[posIndex][pos][0]);
-                            top = (mPos[posIndex][pos][1]);
-                        }
+                        left = (mPos[posIndex][i][0]);
+                        top = (mPos[posIndex][i][1]);
 
-                        String name = astrRoomTitle[i+BadLightCount+1];
-                        Log.d(TAG, "[Registration_Light_New] - name[" + (i + 1) + "] = " + name);
-
-                        lightRooms[pos] = new LightRoom(ROOM_POS[i + LivingLightCount + BadLightCount], left, top, createLight, name, SWITCH_TYPE);
-                        //lightRooms[createLight] = new LightRoom(i + LivingLightCount + BadLightCount, left, top, createLight, name, SWITCH_TYPE);
-                        createLight++;
-                    //}
+                        String name = astrRoomTitle[pos];
+                        lightRooms[i] = new LightRoom(pos, left, top, name, SWITCH_TYPE, i);
+                    }
                 } catch (RuntimeException re) {
                     LogUtil.errorLogInfo("", TAG, re);
                     lightRooms[i] = null;
-                }
-                catch (Exception e) {
+                } catch (Exception e) {
                     Log.e(TAG, "[Exception Error] - [Create] LightView new");
                     //e.printStackTrace();
                     LogUtil.errorLogInfo("", TAG, e);
@@ -1249,8 +1188,7 @@ public class LightKnxMainScreen extends WpadScreen {
         } catch (RuntimeException re) {
             LogUtil.errorLogInfo("", TAG, re);
             return -100;
-        }
-		catch (Exception e) {
+        } catch (Exception e) {
             Log.e(TAG, "[DB_GetLightCount] Exception Error");
             //e.printStackTrace();
             LogUtil.errorLogInfo("", TAG, e);

+ 2 - 0
WallPadHomeCtrl/src/main/java/kr/co/icontrols/wallpadhomectrl/screen/screen_light/LightKnxPopupRoomScreen.java

@@ -288,6 +288,8 @@ public class LightKnxPopupRoomScreen extends WpadScreen {
             int RoomIndex = intent.getIntExtra("ROOM_INDEX", -1);
             if (RoomIndex >= 0) {
                 mCurrentRoomIndex = ROOM_POS[RoomIndex];
+                //mCurrentRoomIndex = RoomIndex;
+                //mRoomIndex = ROOM_POS[RoomIndex];
                 mRoomIndex = RoomIndex;
             }
             Log.d(TAG, "mCurrentRoomIndex = " + mCurrentRoomIndex);

+ 75 - 97
WallPadHomeCtrl/src/main/java/kr/co/icontrols/wallpadhomectrl/screen/screen_multi/LightKnxMainTestScreen.java

@@ -76,7 +76,7 @@ public class LightKnxMainTestScreen extends WpadScreen {
             {
                     {{393, 247}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}},                         // 1개(가이드 좌표 X - 임의 설정)
                     {{266, 247}, {507, 247}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}},                     // 2개(가이드 좌표 X - 임의 설정)
-                    {{152, 247}, {393, 247}, {635, 247}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}},                 // 3개(가이드 좌표 O)
+                    {{152, 247}, {393, 247}, {684, 247}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}},                 // 3개(가이드 좌표 O)
                     {{25, 247}, {266, 247}, {507, 247}, {748, 247}, {0, 0}, {0, 0}, {0, 0}, {0, 0}},             // 4개(가이드 좌표 O)
                     {{25, 110}, {266, 110}, {507, 110}, {748, 110}, {25, 383}, {0, 0}, {0, 0}, {0, 0}},            // 5개(가이드 좌표 O)
                     {{25, 110}, {266, 110}, {507, 110}, {748, 110}, {25, 383}, {266, 383}, {0, 0}, {0, 0}},       // 6개(가이드 좌표 O)
@@ -99,6 +99,13 @@ public class LightKnxMainTestScreen extends WpadScreen {
                     {{25, 110}, {266, 110}, {507, 110}, {748, 110}, {25, 383}, {266, 383}, {507, 383}, {748, 383}, {25, 110}, {266, 110}, {507, 110}, {748, 110}, {25, 383}, {266, 383}, {507, 383}, {748, 383}, {25, 110}, {266, 110}, {507, 110}, {748, 110}, {25, 383}, {266, 383}, {507, 383}},       // 23개
                     {{25, 110}, {266, 110}, {507, 110}, {748, 110}, {25, 383}, {266, 383}, {507, 383}, {748, 383}, {25, 110}, {266, 110}, {507, 110}, {748, 110}, {25, 383}, {266, 383}, {507, 383}, {748, 383}, {25, 110}, {266, 110}, {507, 110}, {748, 110}, {25, 383}, {266, 383}, {507, 383}, {748, 383}},       // 24개
                     {{25, 110}, {266, 110}, {507, 110}, {748, 110}, {25, 383}, {266, 383}, {507, 383}, {748, 383}, {25, 110}, {266, 110}, {507, 110}, {748, 110}, {25, 383}, {266, 383}, {507, 383}, {748, 383}, {25, 110}, {266, 110}, {507, 110}, {748, 110}, {25, 383}, {266, 383}, {507, 383}, {748, 383}, {393, 247}},       // 25개
+                    {{25, 110}, {266, 110}, {507, 110}, {748, 110}, {25, 383}, {266, 383}, {507, 383}, {748, 383}, {25, 110}, {266, 110}, {507, 110}, {748, 110}, {25, 383}, {266, 383}, {507, 383}, {748, 383}, {25, 110}, {266, 110}, {507, 110}, {748, 110}, {25, 383}, {266, 383}, {507, 383}, {748, 383}, {266, 247}, {507, 247}},       // 26개
+                    {{25, 110}, {266, 110}, {507, 110}, {748, 110}, {25, 383}, {266, 383}, {507, 383}, {748, 383}, {25, 110}, {266, 110}, {507, 110}, {748, 110}, {25, 383}, {266, 383}, {507, 383}, {748, 383}, {25, 110}, {266, 110}, {507, 110}, {748, 110}, {25, 383}, {266, 383}, {507, 383}, {748, 383}, {152, 247}, {393, 247}, {684, 247}},       // 27개
+                    {{25, 110}, {266, 110}, {507, 110}, {748, 110}, {25, 383}, {266, 383}, {507, 383}, {748, 383}, {25, 110}, {266, 110}, {507, 110}, {748, 110}, {25, 383}, {266, 383}, {507, 383}, {748, 383}, {25, 110}, {266, 110}, {507, 110}, {748, 110}, {25, 383}, {266, 383}, {507, 383}, {748, 383}, {25, 247}, {266, 247}, {507, 247}, {748, 247}},       // 28개
+                    {{25, 110}, {266, 110}, {507, 110}, {748, 110}, {25, 383}, {266, 383}, {507, 383}, {748, 383}, {25, 110}, {266, 110}, {507, 110}, {748, 110}, {25, 383}, {266, 383}, {507, 383}, {748, 383}, {25, 110}, {266, 110}, {507, 110}, {748, 110}, {25, 383}, {266, 383}, {507, 383}, {748, 383}, {25, 110}, {266, 110}, {507, 110}, {748, 110}, {25, 383}},       // 29개
+                    {{25, 110}, {266, 110}, {507, 110}, {748, 110}, {25, 383}, {266, 383}, {507, 383}, {748, 383}, {25, 110}, {266, 110}, {507, 110}, {748, 110}, {25, 383}, {266, 383}, {507, 383}, {748, 383}, {25, 110}, {266, 110}, {507, 110}, {748, 110}, {25, 383}, {266, 383}, {507, 383}, {748, 383}, {25, 110}, {266, 110}, {507, 110}, {748, 110}, {25, 383}, {266, 383}},       // 30개
+                    {{25, 110}, {266, 110}, {507, 110}, {748, 110}, {25, 383}, {266, 383}, {507, 383}, {748, 383}, {25, 110}, {266, 110}, {507, 110}, {748, 110}, {25, 383}, {266, 383}, {507, 383}, {748, 383}, {25, 110}, {266, 110}, {507, 110}, {748, 110}, {25, 383}, {266, 383}, {507, 383}, {748, 383}, {25, 110}, {266, 110}, {507, 110}, {748, 110}, {25, 383}, {266, 383}, {507, 383}},       // 31개
+                    {{25, 110}, {266, 110}, {507, 110}, {748, 110}, {25, 383}, {266, 383}, {507, 383}, {748, 383}, {25, 110}, {266, 110}, {507, 110}, {748, 110}, {25, 383}, {266, 383}, {507, 383}, {748, 383}, {25, 110}, {266, 110}, {507, 110}, {748, 110}, {25, 383}, {266, 383}, {507, 383}, {748, 383}, {25, 110}, {266, 110}, {507, 110}, {748, 110}, {25, 383}, {266, 383}, {507, 383}, {748, 383}},       // 32개
             };
 
     private int[][][] mPos_easymode = new int[][][]
@@ -229,22 +236,22 @@ public class LightKnxMainTestScreen extends WpadScreen {
         public WpadImageView OnOffBtn;    // OnOff 버튼
 
 
-        public LightRoom(int index, int left, int top, int LightNum, String roomName, int type) {
-            //if(mData == null) return;
-
-            lightNum = LightNum;
-
+        public LightRoom(int index, int left, int top, String roomName, int type, int seq) {
             // 배경 그리기
             RoomBackground = new WpadImageView(getContext(), TOUCH_KIND.NONE, 241, 273, R.drawable.knx_light_box_1, R.drawable.knx_light_box_1, ID.KnxLight.image.Room_BACKGROUND_1 + index);
             ViewRegistration(getLayout(), RoomBackground, Common.ImgPosion.GetX(left), Common.ImgPosion.GetY(top));
 
             // 방 이름 버튼
-            RoomTitleBg = new WpadImageView(getContext(), TOUCH_KIND.BUTTON, 221, 56, R.drawable.knx_btn_room_normal, R.drawable.knx_btn_room_pressed, ID.KnxLight.button.Room_TITLE_1 + index);
+            RoomTitleBg = new WpadImageView(getContext(), TOUCH_KIND.BUTTON, 221, 56, R.drawable.knx_btn_room_normal, R.drawable.knx_btn_room_pressed, ID.KnxLight.button.Room_TITLE_1 + seq);
             ViewRegistration(getLayout(), RoomTitleBg, Common.ImgPosion.GetX(left + 10), Common.ImgPosion.GetY(top + 10));
 
             // 방 이름 텍스트
-            RoomTitleText = new WpadTextView(getContext(), false, 221, 56, Gravity.CENTER, Color.BLACK, Common.fontsize._26_DEFAULT, true, ID.KnxLight.text.Room_TITLE_1 + index);
+            RoomTitleText = new WpadTextView(getContext(), false, 221, 56, Gravity.CENTER, Color.BLACK, Common.fontsize._26_DEFAULT, true, ID.KnxLight.text.Room_TITLE_1 + seq);
             ViewRegistration(getLayout(), RoomTitleText, Common.ImgPosion.GetX(left + 10), Common.ImgPosion.GetY(top + 10));
+            RoomTitleText.setTextSize(0, Common.fontsize._30);
+            if (roomName.length() == 6) {
+                RoomTitleText.setTextSize(0, Common.fontsize._26_DEFAULT);
+            }
             RoomTitleText.setText(roomName);
 
             OnOffBtn = new WpadImageView(getContext(), TOUCH_KIND.BUTTON, 120, 120, mOffImg[type], mOnImg[type], ID.KnxLight.button.Light_Btn_1 + index);
@@ -629,7 +636,7 @@ public class LightKnxMainTestScreen extends WpadScreen {
             } else if ((TargetId >= ID.KnxLight.button.Light_Btn_1) && (TargetId <= ID.KnxLight.button.Light_Btn_1 + AllEMcount)) {
                 // 방별 조명 제어
                 int index = TargetId - ID.KnxLight.button.Light_Btn_1;
-                index = ROOM_POS[index];
+                //index = ROOM_POS[index];
                 DebugLogOutput("onTouchEvent [LIGHT_" + (index + 1) + "] BUTTON !!!");
 
                 boolean OnOff = false;
@@ -719,7 +726,8 @@ public class LightKnxMainTestScreen extends WpadScreen {
             }
             for (int j = startIdx; j < startIdx + ROOM_CNT; j++) {
                 if (j >= roomCount) break;
-                lightRooms[j].setVisible(true);
+                if (lightRooms[j] != null)
+                    lightRooms[j].setVisible(true);
             }
         } catch (RuntimeException re) {
             LogUtil.errorLogInfo("", TAG, re);
@@ -809,35 +817,58 @@ public class LightKnxMainTestScreen extends WpadScreen {
         }
         //각 방 조명 이미지
         int emCount = 0;
-        emCount = mData.MasterController.Info.Liv_EnergyMeterCount + mData.MasterController.Info.Bad_EnergyMeterCount;
+        int totalCount = 0;
+        int BadLightCount = mData.MasterController.Info.Bad_EnergyMeterCount;
+        int SwitchCount = mData.MasterController.Info.Light_SwitchCount;
+        emCount = mData.MasterController.Info.Liv_EnergyMeterCount + BadLightCount;
+        totalCount = emCount + SwitchCount;
+
         try {
-            if (mData.LivingRoom_EnergyMeter.Info.Install) {
-                for (int i = 0; i < mData.LivingRoom_EnergyMeter.Info.LightCount; i++) {
-                    if (mData.LivingRoom_EnergyMeter.Data.LivingLight[i].Info.Install) {
-                        //Log.i(TAG, "i = " + i + " OnOff = " + );
-                        if (mData.LivingRoom_EnergyMeter.Data.LivingLight[i].Data.OnOff == true) {
-                            Draw_LightStatusChange(1, true, false);
+            for (int k = 0; k < totalCount; k++) {
+                if (mData.LivingRoom_EnergyMeter.Info.Install && ROOM_POS[k] == 0) {
+                    for (int i = 0; i < mData.LivingRoom_EnergyMeter.Info.LightCount; i++) {
+                        if (mData.LivingRoom_EnergyMeter.Data.LivingLight[i].Info.Install) {
+                            //Log.i(TAG, "i = " + i + " OnOff = " + );
+                            if (mData.LivingRoom_EnergyMeter.Data.LivingLight[i].Data.OnOff == true) {
+                                Draw_LightStatusChange(k + 1, true, false);
+                                break;
+                            }
+                            if (i == mData.LivingRoom_EnergyMeter.Info.LightCount - 1) {
+                                Draw_LightStatusChange(k + 1, false, false);
+                            }
+                        }
+                    }
+                } else if (ROOM_POS[k] < emCount) {
+                    for (int i = 0; i < mData.BadRoom_EnergyMeter[ROOM_POS[k] - 1].Info.LightCount; i++) {
+                        //if (mData.BadRoom_EnergyMeter[j].Info.Install) {
+                        if (mData.BadRoom_EnergyMeter[ROOM_POS[k] - 1].Data.BadLight[i].Data.OnOff == true) {
+                            Draw_LightStatusChange(k + 1, true, false);
+                            break;
+                        }
+                        if (i == mData.BadRoom_EnergyMeter[ROOM_POS[k] - 1].Info.LightCount - 1) {
+                            Draw_LightStatusChange(k + 1, false, false);
+                        }
+                    }
+                } else {
+                    for (int i = 0; i < mData.Light_Switch[ROOM_POS[k] - emCount].Info.LightCount; i++) {
+                        //if (mData.Light_Switch[j].Info.Install) {
+                        if (mData.Light_Switch[ROOM_POS[k] - emCount].Data.LightSwitch[i].Data.OnOff == true) {
+                            Draw_LightStatusChange(k + 1, true, true);
                             break;
                         }
-                        if (i == mData.LivingRoom_EnergyMeter.Info.LightCount - 1) {
-                            Draw_LightStatusChange(1, false, false);
+                        if (i == mData.Light_Switch[ROOM_POS[k] - emCount].Info.LightCount - 1) {
+                            Draw_LightStatusChange(k + 1, false, true);
                         }
+                        //}
                     }
                 }
-                Draw_LightStatus_BadRoom(2);
-                Draw_LightStatus_LightSwitch(emCount + 1);
-            } else {
-                Draw_LightStatus_BadRoom(1);
-                Draw_LightStatus_LightSwitch(emCount + 1);
             }
         } catch (RuntimeException re) {
             LogUtil.errorLogInfo("", TAG, re);
-            lightRooms[0] = null;
         } catch (Exception e) {
             Log.e(TAG, "[Exception Error] - [Create] LightView new");
             //e.printStackTrace();
             LogUtil.errorLogInfo("", TAG, e);
-            lightRooms[0] = null;
         }
         //현재방 상태에 따라 보여지지 말아야 할 조명은 제거한다.
         Draw_CurrentPage(AllEMcount, (CurrentPageNum - 1) * ROOM_CNT);
@@ -857,8 +888,8 @@ public class LightKnxMainTestScreen extends WpadScreen {
         if (lightRooms == null) return;
         if (LightNumber > lightRooms.length) return;
 
-        int index = ROOM_POS[LightNumber - 1];
-        //int index = LightNumber - 1;
+        int index = LightNumber - 1;
+
         //현재 페이지만 갱신하도록 한다.
         if (index >= startIdx + ROOM_CNT) return;
         if (lightRooms[index] == null) return;
@@ -926,77 +957,24 @@ public class LightKnxMainTestScreen extends WpadScreen {
             Log.d(TAG, "installCount = " + installCount);
 
             int posIndex = totalLightCount - 1;
-            //if (installCount < totalLightCount) {
-            //    posIndex = installCount - 1;
-            //    Log.d(TAG, "installCount < LightCount --> change posIndex : " + posIndex);
-            //}
-
-            int createLight = 0;
-
-            //거실 에너지 미터 조명
-            try {
-                if (mData.LivingRoom_EnergyMeter.Info.Install) {
-                    int pos = ROOM_POS[createLight];
-                    int left, top;
-                    left = (mPos[posIndex][pos][0]);
-                    top = (mPos[posIndex][pos][1]);
 
-                    String name = mDefaultRoomNameList[createLight];
-                    mRoomName.add(name);
-                    Log.d(TAG, "[Registration_Light_New] - name[" + name + "] = ");
-
-                    lightRooms[pos] = new LightRoom(pos, left, top, createLight, name, EM_TYPE);
-                    createLight++;
-                }
-            } catch (RuntimeException re) {
-                LogUtil.errorLogInfo("", TAG, re);
-                lightRooms[0] = null;
-            } catch (Exception e) {
-                Log.e(TAG, "[Exception Error] - [Create] LightView new");
-                //e.printStackTrace();
-                LogUtil.errorLogInfo("", TAG, e);
-                lightRooms[0] = null;
-            }
-            for (int i = 0; i < BadLightCount; i++) {
-                try {
-                    //if (mData.BadRoom_EnergyMeter[i].Info.Install) {
-                    int pos = ROOM_POS[createLight];
-                    int left, top;
-                    left = (mPos[posIndex][pos][0]);
-                    top = (mPos[posIndex][pos][1]);
-
-                    String name = mDefaultRoomNameList[i + 1];
-                    mRoomName.add(name);
-                    Log.d(TAG, "[Registration_Light_New] - name[" + (i + 1) + "] = " + name);
-
-                    lightRooms[pos] = new LightRoom(pos, left, top, createLight, name, EM_TYPE);
-                    createLight++;
-                    //}
-                } catch (RuntimeException re) {
-                    LogUtil.errorLogInfo("", TAG, re);
-                    lightRooms[i] = null;
-                } catch (Exception e) {
-                    Log.e(TAG, "[Exception Error] - [Create] LightView new");
-                    //e.printStackTrace();
-                    LogUtil.errorLogInfo("", TAG, e);
-                    lightRooms[i] = null;
-                }
-            }
-            for (int i = 0; i < SwitchCount; i++) {
+            for (int i = 0; i < totalLightCount; i++) {
                 try {
-                    //if (mData.Light_Switch[i].Info.Install) {
-                    int pos = ROOM_POS[createLight];
-                    int left, top;
-                    left = (mPos[posIndex][pos][0]);
-                    top = (mPos[posIndex][pos][1]);
-
-                    String name = mDefaultRoomNameList[i + BadLightCount + 1];
-                    mRoomName.add(name);
-                    Log.d(TAG, "[Registration_Light_New] - name[" + (i + 1) + "] = " + name);
-
-                    lightRooms[pos] = new LightRoom(pos, left, top, createLight, name, SWITCH_TYPE);
-                    createLight++;
-                    //}
+                    int pos = ROOM_POS[i];
+                    if (pos < LivingLightCount + BadLightCount) {
+                        int left, top;
+                        left = (mPos[posIndex][i][0]);
+                        top = (mPos[posIndex][i][1]);
+                        String name = mDefaultRoomNameList[pos];
+                        lightRooms[i] = new LightRoom(pos, left, top, name, EM_TYPE, i);
+                    } else {
+                        int left, top;
+                        left = (mPos[posIndex][i][0]);
+                        top = (mPos[posIndex][i][1]);
+
+                        String name = mDefaultRoomNameList[pos];
+                        lightRooms[i] = new LightRoom(pos, left, top, name, SWITCH_TYPE, i);
+                    }
                 } catch (RuntimeException re) {
                     LogUtil.errorLogInfo("", TAG, re);
                     lightRooms[i] = null;

+ 1 - 1
WallPadMain/src/main/java/kr/co/icontrols/wallpadmain/util/IconManager.java

@@ -342,7 +342,7 @@ public class IconManager {
                     || 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 (Common.CurrentDistributionPanelType == Version.DISTRIBUTION_MODEL.KNX_DIST) {
-                    mIconInfoTable.addIconInfo(ID.ICONS.MENUS.CTRL_LIVINGLIGHT.getID(), ID.ICONS.MENUS.CTRL_LIGHT.getNameKR(), ID.LINKEDSCREEN.SubMenuCtrl.HDC_LivingLamp,
+                    mIconInfoTable.addIconInfo(ID.ICONS.MENUS.CTRL_LIGHT.getID(), ID.ICONS.MENUS.CTRL_LIGHT.getNameKR(), ID.LINKEDSCREEN.SubMenuCtrl.HDC_LivingLamp,
                             R.drawable.icon_ctrl_light_normal, R.drawable.icon_ctrl_light_pressed, R.drawable.icon_ctrl_light_pressed, R.drawable.icon_ctrl_light_pressed);
                 }
                 else {

+ 5 - 5
WallPadMain/src/main/java/kr/co/icontrols/wallpadmain/util/iMapServer.java

@@ -5042,7 +5042,7 @@ public class iMapServer extends Service {
                             heatingV2API.Refresh(define.DEVICE_ALL_OR_NOTHING, false);
                         }
                     } else {
-                        int nDevNum = Integer.parseInt(tempercmd.devnum);
+                        int nDevNum = Integer.parseInt(tempercmd.devnum)-1;
 
                         if (heatingV2API != null) {
                             int ret = heatingV2API.SetEachRoomStatus((byte) nDevNum, Mode, temp);
@@ -5154,16 +5154,16 @@ public class iMapServer extends Service {
                     }
                     else {
                         String drvmode = "off";
-                        int nDevNum = Integer.parseInt(tempercmd.unitnum);
+                        int nDevNum = Integer.parseInt(tempercmd.devnum);
 
-                        HeatingV2.RoomData roomData = heatingV2API.data.Device.Room[nDevNum];
+                        HeatingV2.RoomData roomData = heatingV2API.data.Device.Room[nDevNum-1];
 
                         if (HeatingV2.MODE.GetOnOff(roomData.Mode)) drvmode = "on";
                         else drvmode = "off";
 
                         drvmode += "/" + roomData.SetTemp + "/" + roomData.NowTemp;
                         resultStr += "      <status_map dev_num=\"" + (nDevNum) + "\" unit_cnt=\"1\"/>\r\n";
-                        resultStr += "         <status_info unit_num=\"" + knxRoomNameList[nDevNum] + "\" unit_status=\"" + drvmode + "\"/>\r\n";
+                        resultStr += "         <status_info unit_num=\"" + knxRoomNameList[nDevNum-1] + "\" unit_status=\"" + drvmode + "\"/>\r\n";
                         resultStr += "   </service>\r\n</imap>\r\n";
                         retStr += ("\"ok\">\r\n" + resultStr);
                         return retStr;
@@ -13015,7 +13015,7 @@ public class iMapServer extends Service {
                         Log.d(TAG, "sendMsgToActivity!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!11");
                     }
                     skipCount++;
-                    if(skipCount==3) skipCount = 0 ;
+                    if(skipCount==6) skipCount = 0 ;
                 }
                 try {
                     Thread.sleep(10000);

+ 0 - 3
WallPadMultiControlService/src/main/java/kr/co/icontrols/wallpadmulticontrolservice/DataSenderService.java

@@ -24,12 +24,10 @@ import com.artncore.commons.define;
 import com.artncore.wallpadapi.CooktopAPI;
 import com.artncore.wallpadapi.EnergyMeterAPI;
 import com.artncore.wallpadapi.GasAPI;
-import com.artncore.wallpadapi.HeatingV1API;
 import com.artncore.wallpadapi.HeatingV2API;
 import com.artncore.wallpadapi.IGW300API;
 import com.artncore.wallpadapi.KnxAPI;
 import com.artncore.wallpadapi.KnxSystemAirconAPI;
-import com.artncore.wallpadapi.MultiSwitchAPI;
 import com.artncore.wallpadapi.RealTimeMeterAPI;
 import com.artncore.wallpadapi.SdbAPI;
 import com.artncore.wallpadapi.Sdb_LivingRoomLightAPI;
@@ -2314,7 +2312,6 @@ public class DataSenderService extends Service {
                 }
 
                 WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(getApplicationContext());
-                int[] BatchInfo = mWallpadDeviceSet.Get_BatchSW_Info();
                 int[] retVentil = mWallpadDeviceSet.Get_Ventil_Info();
                 bGasAsCooktopOutlet = mWallpadDeviceSet.Get_CookTopConcent_Use();
                 mWallpadDeviceSet.closeDB();