Browse Source

[WallPadHomeCtrl]
1. 서브 월패드이면서, 조명 직접 제어인경우 조명의 일괄소등 삭제

jglee 2 years ago
parent
commit
4b916a1749

+ 55 - 15
WallPadHomeCtrl/src/main/java/kr/co/icontrols/wallpadhomectrl/screen/screen_light/LightEtcEachMainScreen.java

@@ -4,6 +4,7 @@ import android.content.Intent;
 import android.graphics.Color;
 import android.util.Log;
 
+import com.artncore.WallPadDataMgr.WallpadDeviceSet;
 import com.artncore.WallPadDataMgr.WallpadSalesSampleData;
 import com.artncore.commons.DataClasses.MultiSwitch;
 import com.artncore.commons.define;
@@ -173,6 +174,7 @@ public class LightEtcEachMainScreen extends WpadScreen {
 	public int mLightDeviceCount = 0;						// 조명가 있는 기기 개수합
 	private int [] mLightDeviceTable = null;				// 조명 기기인덱스로 하여 실제 기기인덱스를 구할 수 잇는 테이블
 
+	private boolean isSubWallPad = false;
 
 	/**
 	 * 조명개수에 따른 좌표를 정의한다.
@@ -324,22 +326,28 @@ public class LightEtcEachMainScreen extends WpadScreen {
 			}
 		}
 
+
+		isSubWallPad = getIsSubWallpad(context);
+
 		try {
-			if ((mData.DeviceCnt > 0) && (mData.DeviceCnt <= 6)) {
-				BatchOff_Enable = new WpadImageView(context, TOUCH_KIND.BUTTON, 230, 272, R.drawable.control_multisw_batch_en_normal, R.drawable.control_multisw_batch_en_pressed, ID.LightEtcEachMainScreenID.button.BATCHOFF_ENABLE);
-				ViewRegistration(layout, BatchOff_Enable, Common.ImgPosion.GetX(980), Common.ImgPosion.GetY(169));
-				BatchOff_Enable.setTouchDelayMs(Common.BTN_DELAY_DEVCTRL);
-				BatchOff_Disable = new WpadImageView(context, TOUCH_KIND.BUTTON, 230, 272, R.drawable.control_multisw_batch_dis_normal, R.drawable.control_multisw_batch_dis_pressed, ID.LightEtcEachMainScreenID.button.BATCHOFF_DISABLE);
-				ViewRegistration(layout, BatchOff_Disable, Common.ImgPosion.GetX(980), Common.ImgPosion.GetY(441));
-				BatchOff_Disable.setTouchDelayMs(Common.BTN_DELAY_DEVCTRL);
-			}
-			else if ((mData.DeviceCnt >= 7) && (mData.DeviceCnt <= 8)) {
-				BatchOff_Enable = new WpadImageView(context, TOUCH_KIND.BUTTON, 230, 272, R.drawable.control_multisw_batch_en_normal, R.drawable.control_multisw_batch_en_pressed, ID.LightEtcEachMainScreenID.button.BATCHOFF_ENABLE);
-				ViewRegistration(layout, BatchOff_Enable, Common.ImgPosion.GetX(1025), Common.ImgPosion.GetY(169));
-				BatchOff_Enable.setTouchDelayMs(Common.BTN_DELAY_DEVCTRL);
-				BatchOff_Disable = new WpadImageView(context, TOUCH_KIND.BUTTON, 230, 272, R.drawable.control_multisw_batch_dis_normal, R.drawable.control_multisw_batch_dis_pressed, ID.LightEtcEachMainScreenID.button.BATCHOFF_DISABLE);
-				ViewRegistration(layout, BatchOff_Disable, Common.ImgPosion.GetX(1025), Common.ImgPosion.GetY(441));
-				BatchOff_Disable.setTouchDelayMs(Common.BTN_DELAY_DEVCTRL);
+			if(!isSubWallPad)
+			{
+				if ((mData.DeviceCnt > 0) && (mData.DeviceCnt <= 6)) {
+					BatchOff_Enable = new WpadImageView(context, TOUCH_KIND.BUTTON, 230, 272, R.drawable.control_multisw_batch_en_normal, R.drawable.control_multisw_batch_en_pressed, ID.LightEtcEachMainScreenID.button.BATCHOFF_ENABLE);
+					ViewRegistration(layout, BatchOff_Enable, Common.ImgPosion.GetX(980), Common.ImgPosion.GetY(169));
+					BatchOff_Enable.setTouchDelayMs(Common.BTN_DELAY_DEVCTRL);
+					BatchOff_Disable = new WpadImageView(context, TOUCH_KIND.BUTTON, 230, 272, R.drawable.control_multisw_batch_dis_normal, R.drawable.control_multisw_batch_dis_pressed, ID.LightEtcEachMainScreenID.button.BATCHOFF_DISABLE);
+					ViewRegistration(layout, BatchOff_Disable, Common.ImgPosion.GetX(980), Common.ImgPosion.GetY(441));
+					BatchOff_Disable.setTouchDelayMs(Common.BTN_DELAY_DEVCTRL);
+				}
+				else if ((mData.DeviceCnt >= 7) && (mData.DeviceCnt <= 8)) {
+					BatchOff_Enable = new WpadImageView(context, TOUCH_KIND.BUTTON, 230, 272, R.drawable.control_multisw_batch_en_normal, R.drawable.control_multisw_batch_en_pressed, ID.LightEtcEachMainScreenID.button.BATCHOFF_ENABLE);
+					ViewRegistration(layout, BatchOff_Enable, Common.ImgPosion.GetX(1025), Common.ImgPosion.GetY(169));
+					BatchOff_Enable.setTouchDelayMs(Common.BTN_DELAY_DEVCTRL);
+					BatchOff_Disable = new WpadImageView(context, TOUCH_KIND.BUTTON, 230, 272, R.drawable.control_multisw_batch_dis_normal, R.drawable.control_multisw_batch_dis_pressed, ID.LightEtcEachMainScreenID.button.BATCHOFF_DISABLE);
+					ViewRegistration(layout, BatchOff_Disable, Common.ImgPosion.GetX(1025), Common.ImgPosion.GetY(441));
+					BatchOff_Disable.setTouchDelayMs(Common.BTN_DELAY_DEVCTRL);
+				}
 			}
 		} catch (RuntimeException re) {
             LogUtil.errorLogInfo("", TAG, re);
@@ -1150,5 +1158,37 @@ public class LightEtcEachMainScreen extends WpadScreen {
 	}
 
 
+	/**
+	 * 월패드 타입 판별
+	 * @return bResult
+	 * false: 메인월패드
+	 * true: 서브월패드
+	 */
+	public boolean getIsSubWallpad(Context ctx) {
+		boolean bResult = false;
+		try {
+			WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(ctx);
+			String[] DBinfo = mWallpadDeviceSet.GetSettingData("서브월패드");
+			mWallpadDeviceSet.closeDB();
+
+			if (DBinfo == null) bResult = false;
+			else {
+				if (DBinfo[1].indexOf("사용함") > 0) bResult = true;
+				else bResult = false;
+			}
+			Log.d(TAG, "[getIsSubWallpad] bResult [" + bResult + "]");
+			return bResult;
+		} catch (RuntimeException re) {
+			LogUtil.errorLogInfo("", TAG, re);
+			return false;
+		}
+		catch (Exception e) {
+			Log.e(TAG, "[Exception] getIsSubWallpad()");
+			LogUtil.errorLogInfo("", TAG, e);
+			return false;
+		}
+	}
+
+
 
 }