|
@@ -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);
|