package kr.co.icontrols.wallpadhomectrl;
import android.annotation.SuppressLint;
import android.app.ActivityManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Color;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.os.Handler;
import android.os.Message;
import android.os.PowerManager;
import android.util.Log;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.TranslateAnimation;
import android.widget.ExpandableListView;
import android.widget.ExpandableListView.OnGroupClickListener;
import android.widget.ExpandableListView.OnGroupCollapseListener;
import android.widget.ExpandableListView.OnGroupExpandListener;
import android.widget.RelativeLayout;
import com.artncore.WallPadDataMgr.WallpadDeviceSet;
import com.artncore.WallPadDataMgr.WallpadStatusData;
import com.artncore.WallPadDataMgr.wallpaddbmgr;
import com.artncore.commons.API_Menu;
import com.artncore.commons.API_Menu.MenuListDataClass;
import com.artncore.commons.API_Menu.MenuListDataClass.ChildIDMapping;
import com.artncore.commons.DataClasses;
import com.artncore.commons.define;
import com.artncore.wallpadapi.KnxVentiAPI;
import com.artncore.wallpadapi.LedDimmingKCC_API;
import com.artncore.wallpadapi.MultiSwitchAPI;
import com.artncore.wallpadapi.VentiAPI;
import com.artncore.wallpadapi.WallPadAPI;
import com.util.LogUtil;
import java.util.ArrayList;
import java.util.List;
import kr.co.icontrols.v40ioctl.V40IF;
import kr.co.icontrols.wallpadhomectrl.declare.Common;
import kr.co.icontrols.wallpadhomectrl.declare.ID;
import kr.co.icontrols.wallpadhomectrl.screen.screen_aircon.SystemAirconMainScreen;
import kr.co.icontrols.wallpadhomectrl.screen.screen_airquality.AirQualityMainScreen;
import kr.co.icontrols.wallpadhomectrl.screen.screen_airquality.DustInfoScreen;
import kr.co.icontrols.wallpadhomectrl.screen.screen_concent.ConcentEnergyMeterScreen;
import kr.co.icontrols.wallpadhomectrl.screen.screen_concent.ConcentHdcNEachMainScreen;
import kr.co.icontrols.wallpadhomectrl.screen.screen_concent.ConcentKnxMainScreen;
import kr.co.icontrols.wallpadhomectrl.screen.screen_concent.ConcentMainScreen;
import kr.co.icontrols.wallpadhomectrl.screen.screen_curtain.CurTainV1MainScreen;
import kr.co.icontrols.wallpadhomectrl.screen.screen_doorlock.DoorLockMainScreen;
import kr.co.icontrols.wallpadhomectrl.screen.screen_elecrange.ElectricRangeMainScreen;
import kr.co.icontrols.wallpadhomectrl.screen.screen_gas.CookTopConcentMainScreen;
import kr.co.icontrols.wallpadhomectrl.screen.screen_gas.GasMainScreen;
import kr.co.icontrols.wallpadhomectrl.screen.screen_gas.HybridCookTopMainScreen;
import kr.co.icontrols.wallpadhomectrl.screen.screen_heating.HeatingV1MainScreen;
import kr.co.icontrols.wallpadhomectrl.screen.screen_heating.HeatingV2MainScreen;
import kr.co.icontrols.wallpadhomectrl.screen.screen_knx_venti.KnxVentiEasymodeScreen;
import kr.co.icontrols.wallpadhomectrl.screen.screen_knx_venti.KnxVentiMainScreen;
import kr.co.icontrols.wallpadhomectrl.screen.screen_light.LightEtcEachMainScreen;
import kr.co.icontrols.wallpadhomectrl.screen.screen_light.LightEtcLivMainScreen;
import kr.co.icontrols.wallpadhomectrl.screen.screen_light.LightHdcLightEnergyMeterMainScreen;
import kr.co.icontrols.wallpadhomectrl.screen.screen_light.LightHdcLivConifgScreen;
import kr.co.icontrols.wallpadhomectrl.screen.screen_light.LightHdcLivKnxMainScreen;
import kr.co.icontrols.wallpadhomectrl.screen.screen_light.LightHdcLivMainScreen;
import kr.co.icontrols.wallpadhomectrl.screen.screen_light.LightHdcNEachMainScreen;
import kr.co.icontrols.wallpadhomectrl.screen.screen_light.LightKnxMainScreen;
import kr.co.icontrols.wallpadhomectrl.screen.screen_purity.PurityMainScreen;
import kr.co.icontrols.wallpadhomectrl.screen.screen_venti.VentiEasymodeScreen;
import kr.co.icontrols.wallpadhomectrl.screen.screen_venti.VentiMainScreen;
import kr.co.icontrols.wallpadhomectrl.screen.screen_venti.VentilationMainScreen;
import kr.co.icontrols.wallpadhomectrl.screen.screen_venti.VentilationModelMainScreen;
import kr.co.icontrols.wallpadsupport.Version;
import kr.co.icontrols.wallpadsupport.WpadActivity;
import kr.co.icontrols.wallpadsupport.WpadImageView;
import kr.co.icontrols.wallpadsupport.WpadImageView.TOUCH_KIND;
import kr.co.icontrols.wallpadsupport.WpadScale;
import kr.co.icontrols.wallpadsupport.WpadSound.SND;
import kr.co.icontrols.wallpadsupport.WpadTextView;
import kr.co.icontrols.wallpadsupport.WpadUtil;
import static com.artncore.WallPadDataMgr.WallpadDeviceSet.DOORLOCK_TYPE_FINGERPRINT;
import static com.artncore.WallPadDataMgr.WallpadDeviceSet.DOORLOCK_TYPE_NORMAL;
import static com.artncore.WallPadDataMgr.WallpadDeviceSet.DOORLOCK_TYPE_RF;
/**
* @description 월패드 [설정기능] 메인화면 이다.
* 상단의 Top 메뉴, [홈] [돌아가기]
* 좌측의 Tab 메뉴, [환경설정] [화면청소] [비밀번호변경] ... 등 선택 메뉴
* 를 여기서 처리한다.
*/
public class MainActivity extends WpadActivity {
private final static String TAG = "MainActivity";
private final boolean DEBUG_LOG_ON = true;
private void DebugLogOutput(String s)
{
if (DEBUG_LOG_ON) Log.d(TAG, s);
}
// =================================================================================================
// [[ Declaration ]] region
// =================================================================================================
protected Context mContext = null;
public Context getContext()
{
return mContext;
}
private WallPadAPI wpapi = null;
private int OPERATION_MODE = Common.MODE;
private WallpadStatusData wdb = null;
// Layout
private RelativeLayout AllLayout; // 화면 전체
private RelativeLayout TopLayout; // 상단 메뉴
private RelativeLayout ScreenLayout; // 메인 화면
private RelativeLayout MenuLayout; // 메뉴 화면
// Top Menu
private WpadImageView TopBackground;
private WpadTextView TopTitle;
private WpadImageView TopHomeBtn, TopBackBtn, TopMenuBtn, TopBoilerBtn;
private WpadImageView TopAirBackBtn, BTN_TOP_BACK_VENTIL;
private WpadImageView TopDimmingBtn[];
public static WpadImageView TopManualBtn;
private WpadImageView Hide1Btn, Hide2Btn;
// Main
private WpadImageView ScreenBackground;
// Menu
private WpadImageView MenuBackground;
private WpadImageView MenuClose;
private WpadTextView MenuTitle;
private static ExpandableListView mListView;
private Menu_AdptMain adptMain;
private MenuListDataClass menueListDataClass;
private Menu mMenu = null; //WPadAPI의 Menu class
private boolean MenuOpen = false;
// HideMenu
private int mHideMenuEntryStatus = 0;
private static boolean mHideMenuOn = false;
public static boolean getHideMenuOn() { return mHideMenuOn; }
private CountDownTimer mHideMenuTimer = null;
// PopupActivityRun
private static boolean PopupActivityRun = false;
public static boolean getPopupActivityRun()
{
return PopupActivityRun;
}
public static void setPopupActivityRun(boolean run)
{
PopupActivityRun = run;
}
// CurrentScreenId
private int mCurrentScreenId = -1;
private int mTempCurrentScreenId = -1;
public static int mCurrentManualScreenId = -1;
// Screen
private LightHdcLivMainScreen lightHdcLivMainScreen = null;
private LightHdcLivKnxMainScreen lightHdcLivKnxMainScreen = null;
private LightKnxMainScreen lightKnxMainScreen = null;
private KnxVentiMainScreen KnxVentiMainScreen = null;
private VentiMainScreen ventiMainScreen = null;
private VentilationMainScreen ventilationMainScreen = null;
private kr.co.icontrols.wallpadhomectrl.screen.screen_venti.VentilationModelMainScreen ventilationModelMainScreen = null;
private KnxVentiMainScreen knxVentiMainScreen = null;
private KnxVentiEasymodeScreen knxVentiEasymodeScreen= null;
private VentiEasymodeScreen ventiEasymodeScreen= null;
private GasMainScreen gasMainScreen = null;
private DoorLockMainScreen doorLockMainScreen = null;
private HeatingV2MainScreen heatingV2MainScreen = null;
private HeatingV1MainScreen heatingV1MainScreen = null;
private LightHdcLivConifgScreen lightHdcLivConifgScreen = null;
private LightEtcEachMainScreen lightEtcEachMainScreen = null;
private LightEtcLivMainScreen lightEtcLivMainScreen = null;
private LightHdcNEachMainScreen lightHdcNEachMainScreen = null;
private LightHdcLightEnergyMeterMainScreen lightHdcLightEnergyMeterMainScreen = null;
private AirQualityMainScreen airQualityMainScreen = null;
private DustInfoScreen dustInfoScreen = null;
private ConcentMainScreen concentMainScreen = null;
private ConcentKnxMainScreen concentKnxMainScreen = null;
private ConcentEnergyMeterScreen concentEnergyMeterScreen = null;
private HybridCookTopMainScreen hybridCookTopMainScreen = null;
private ConcentHdcNEachMainScreen concentHdcNEachMainScreen = null;
private ElectricRangeMainScreen electricRangeMainScreen = null;
private CookTopConcentMainScreen cookTopConcentMainScreen = null;
private SystemAirconMainScreen systemAirconMainScreen = null;
private PurityMainScreen purityMainScreen = null;
private CurTainV1MainScreen curTainV1MainScreen = null;
//API
public WallpadStatusData GetDBObj() {
return wdb;
}
// 명칭 관련
public static final int HEATING = 1;
public static final int LIGHT = 2;
private String[] mRoomNameList_Light = null; //조명 방 명칭
private String[] mRoomNameList_Heating = null; //난방 방 명칭
private String[] mDefaultRoomNameList = new String[]{"거실", "방1", "방2", "방3", "방4", "방5", "방6", "방7", "방8"};
private String[] mDefaultRoomNameList_Light = new String[]{"거실", "주방", "방1", "방2", "방3", "방4", "방5", "방6", "방7", "방8"};
private String[] mDefaultRoomNameList_Light_SK = new String[]{"거실", "주방", "안방", "침실1", "침실2", "침실3", "침실4", "침실5", "침실6", "침실7", "침실8"};
private String[] mDefaultRoomNameList_Heating = new String[]{"거실", "방1", "방2", "방3", "방4", "방5", "방6", "방7", "방8"};
private String[] mDefaultRoomNameList_Heating_SK = new String[]{"거실", "안방", "침실1", "침실2", "침실3", "침실4", "침실5", "침실6", "침실7", "침실8"};
private String[] mDefaultRoomNameList_Heating_easymode = new String[]{"거실", "방1", "방2", "방3", "방4", "방5", "방6", "방7", "방8"};
private int[][] KCC_DimmBtnOffArray =
{
{R.drawable.btn_top_dimm_normal_off, R.drawable.btn_top_dimm_normal_pressed},
{R.drawable.btn_top_dimm_study_off, R.drawable.btn_top_dimm_study_pressed},
{R.drawable.btn_top_dimm_sensi_off, R.drawable.btn_top_dimm_sensi_pressed},
{R.drawable.btn_top_dimm_rest_off, R.drawable.btn_top_dimm_rest_pressed}
};
private int[][] KCC_DimmBtnOnArray =
{
{R.drawable.btn_top_dimm_normal_selected, R.drawable.btn_top_dimm_normal_pressed},
{R.drawable.btn_top_dimm_study_selected, R.drawable.btn_top_dimm_study_pressed},
{R.drawable.btn_top_dimm_sensi_selected, R.drawable.btn_top_dimm_sensi_pressed},
{R.drawable.btn_top_dimm_rest_selected, R.drawable.btn_top_dimm_rest_pressed},
};
private LedDimmingKCC_API ledDimmingAPI = null;
private class DimData {
LedDimmingKCC_API.Data DimData;
public DimData()
{
DimData = null;
}
}
private DimData mDimData = null;
private byte [] mLevelArray = { 100, 70, 50, 20 };
private boolean bMultiConcentExist = false;
boolean bKitchenLightonLivingEM = false; // 거실EM에 주방등 연결 여부
int[] naLightEnable = null; // 조명 타입
public static PowerManager mPowerManager;
public static V40IF mV40IF;
//Value
public int KccDimUse = 0;
// int SmartDistUse = -1;
// boolean KnxDistUse = false;
public static int nDistributionPanelType = Version.DISTRIBUTION_MODEL.OTHER;
public static int nEnergyProductionUse;
private VentiAPI mVentilAPI = null;
private KnxVentiAPI mKnxVentilAPI = null;
DataClasses.Venti VentilStatus;
/**
* 모델하우스 전용 환기 버전2 사용 여부 체크
* UI만 동작함
*/
private boolean isUseModelHouse_Venti = false;
// =================================================================================================
// [[ Activity Life Cycle ]] region
// =================================================================================================
/**
* Activity Constructors
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
Log.i(TAG, "[onCreate] -------------------------------------------------------------");
Log.i(TAG, "[onCreate] ------------------ [START - MainActivity] -------------------");
Log.i(TAG, "[onCreate] -------------------------------------------------------------");
super.onCreate(savedInstanceState);
// @ AutoScale 설정
WpadScale.setAutoScale(true);
if (Common.CHECK_DEV_SERVICE) StartDevService();
super.AppVersionLogOut(); // [APP Version] + [WallPadSupport Lib Version] 을 로그로 출력한다.
Log.i("[onCreate] Version", "<><><><> WallPadAPI Version = [" + define.WALLPADAPI_VERSION + "] " + "<><><><>");
// 1. 변수 초기화
DebugLogOutput("[Create] - Step1 : Data Create");
PopupActivityRun = false;
ManualActivityRun = false;
mPowerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
mV40IF = new V40IF();
mContext = this;
mDimData = new DimData();
mHideMenuOn = false;
// 2. 자동 종료 셋팅
DebugLogOutput("[Create] - Step2 : Auto Finish Setting");
// 2-1. 자동종료 타이머 셋팅
if (Common.FINISH_TIME_ENABLE) super.setFinishTimerCreate(Common.FINISH_TIME_SEC);
Common.ctrlLCDOnOff(true);
// 3. API 호출
DebugLogOutput("[Create] - Step3 : API Call");
if (Common.GetDeviceSampleMode(this)) OPERATION_MODE = Common.MODE_BUSINESS_SAMPLE;
else OPERATION_MODE = Common.MODE_NOMAL;
// 3.1. wpapi 생성
if (OPERATION_MODE == Common.MODE_NOMAL) {
Log.d(TAG, "[onCreate] OperationMode = MODE_NOMAL");
try {
wpapi = new WallPadAPI(this);
} catch (RuntimeException re) {
LogUtil.errorLogInfo("", TAG, re);
}
catch (Exception e) {
Log.e(TAG, "[ExceptionError] - new WallPadAPI : " + e);
}
}
else if (OPERATION_MODE == Common.MODE_BUSINESS_SAMPLE) {
Log.d(TAG, "[onCreate] OperationMode = MODE_BUSINESS_SAMPLE");
try {
wpapi = new WallPadAPI(this);
} catch (RuntimeException re) {
LogUtil.errorLogInfo("", TAG, re);
}
catch (Exception e) {
Log.e(TAG, "[ExceptionError] - new WallPadAPI : " + e);
}
}
try {
wdb = new WallpadStatusData(this);
} catch (RuntimeException re) {
LogUtil.errorLogInfo("", TAG, re);
}
catch (Exception e) {
Log.e(TAG, "[ExceptionError] - onCreate->WallpadStatusData Create : " + e);
}
getConstructionFunction();
GetRoomName();
//mMultiConentCheckHandler.sendEmptyMessage(0); // 멀티스위치 콘센트 유무 확인
// 4. Layout registration
DebugLogOutput("[Create] - Step4 : Layout registration");
// 4-1. mainLayout
AllLayout = new RelativeLayout(this);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(WpadScale.getWidthPixels(), WpadScale.getHeightPixels());
AllLayout.setLayoutParams(params);
AllLayout.setId(ID.main.layout.ALL);
super.setAllLayoutRegistration(AllLayout);
// 4-2. TopLayout
TopLayout = new RelativeLayout(this);
WpadUtil.LayoutRegistration(AllLayout, TopLayout, 1280, 110, 0, 0, ID.main.layout.TOP);
// 4-4. ScreenLayout
ScreenLayout = new RelativeLayout(this);
WpadUtil.LayoutRegistration(AllLayout, ScreenLayout, 1280, 690, 0, 110, ID.main.layout.SCREEN);
ScreenBackground = new WpadImageView(this, TOUCH_KIND.NONE, 1280, 690, R.drawable.bg_body, R.drawable.bg_body, ID.main.image.SCREEN_BACKGROUND);
ViewRegistration(ScreenLayout, ScreenBackground, 0, 0);
// 5. Top Menu - ImageView registration
DebugLogOutput("[Create] - Step5 : Top Menu - ImageView registration");
TopBackground = new WpadImageView(this, TOUCH_KIND.NONE, 1280, 110, R.drawable.bg_topbar, R.drawable.bg_topbar, ID.main.image.TOP_BACKGROUND);
ViewRegistration(TopLayout, TopBackground, 0, 0);
TopTitle = new WpadTextView(this, false, 247 + 600, 80, Gravity.LEFT, Color.WHITE, Common.fontsize._44, true, ID.main.text.TITLE);
ViewRegistration(TopLayout, TopTitle, 133, 15);
TopHomeBtn = new WpadImageView(this, TOUCH_KIND.BUTTON, 110, 110, R.drawable.topbar_icon_home_normal, R.drawable.topbar_icon_home_pressed, ID.main.button.HOME);
ViewRegistration(TopLayout, TopHomeBtn, 1145, 0);
TopMenuBtn = new WpadImageView(this, TOUCH_KIND.BUTTON, 110, 110, R.drawable.topbar_icon_menu_normal, R.drawable.topbar_icon_menu_pressed, ID.main.button.MENU);
ViewRegistration(TopLayout, TopMenuBtn, 0, 0);
TopManualBtn = new WpadImageView(this, TOUCH_KIND.BUTTON, 110, 110, R.drawable.topbar_icon_manual_normal, R.drawable.topbar_icon_manual_pressed, ID.main.button.MANUAL);
setManualBtnVisible(getManualUse(), 1019);
TopBackBtn = new WpadImageView(this, TOUCH_KIND.BUTTON, 110, 110, R.drawable.topbar_icon_back_normal, R.drawable.topbar_icon_back_pressed, ID.main.button.BACK);
ViewRegistration(TopLayout, TopBackBtn, 1019, 0);
setTopBackBtnVisible(false);
TopBoilerBtn = new WpadImageView(this, TOUCH_KIND.BUTTON, 110, 110, R.drawable.top_but_boiler_normal, R.drawable.top_but_boiler_pressed, ID.main.button.BOILER);
ViewRegistration(TopLayout, TopBoilerBtn, 1019, 0);
setTopBoilerBtnVisible(false);
TopAirBackBtn = new WpadImageView(this, TOUCH_KIND.BUTTON, 110, 110, R.drawable.topbar_icon_back_normal, R.drawable.topbar_icon_back_pressed, ID.main.button.AIRQBACK);
ViewRegistration(TopLayout, TopAirBackBtn, 1019, 0);
setAIRBackBtnVisible(false);
BTN_TOP_BACK_VENTIL = new WpadImageView(this, TOUCH_KIND.BUTTON, 110, 110, R.drawable.topbar_icon_back_normal, R.drawable.topbar_icon_back_pressed, ID.main.button.VENTILBACK);
ViewRegistration(TopLayout, BTN_TOP_BACK_VENTIL, 1019, 0);
setVentilBackBtnVisible(false);
Hide1Btn = new WpadImageView(this, TOUCH_KIND.BUTTON_M, 100, 110, 0, 0, ID.main.button.HIDE1);
ViewRegistration(TopLayout, Hide1Btn, 530, 0);
Hide2Btn = new WpadImageView(this, TOUCH_KIND.BUTTON_M, 100, 110, 0, 0, ID.main.button.HIDE2);
ViewRegistration(TopLayout, Hide2Btn, 650, 0);
TopDimmingBtn = new WpadImageView[4];
for (int i = 0; i < TopDimmingBtn.length; i++) {
TopDimmingBtn[i] = new WpadImageView(this, TOUCH_KIND.BUTTON, 76, 76, KCC_DimmBtnOffArray[i], KCC_DimmBtnOnArray[i], ID.main.button.DIMM_NORMAL + i);
ViewRegistration(TopLayout, TopDimmingBtn[i], 445 + (i*100), 17);
}
setKccDimmBtnVisible(false);
WallpadDeviceSet wpdds = new WallpadDeviceSet(getContext());
bKitchenLightonLivingEM = wpdds.Get_LivingEm_KitchenLight_Use();
naLightEnable = wpdds.Get_Light_info(); // 조명
wpdds.closeDB();
// 6. Menu Loading
// 6-1. 메뉴 정보를 가져온다 (DB에서 가져온다)
DebugLogOutput("[Create] - Step6 : Side Menu - Insert Menu List");
wallpaddbmgr WallpadDBMGR = new wallpaddbmgr(getApplicationContext());
menueListDataClass = WallpadDBMGR.GetMenuList();
WallpadDBMGR.closeDB();
//WallPadMain에서 MenuList를 넣어주지 않아 아래 테스트 코드를 넣음
menueListDataClass = null;
if (menueListDataClass == null) {
Log.e(TAG, "[onCreate] menueListDataClass == null, Load Default List");
menueListDataClass = loadDefaultMenuList();
}
else {
for (int i = 0; i < menueListDataClass.idMappingTable.length; i++) {
Log.d(TAG, "[onCreate] i [" + i + "], ID [" + menueListDataClass.idMappingTable[i].Id + ", NAME [" + menueListDataClass.idMappingTable[i].Name + "]");
}
}
// 6-2. 시작 화면을 main APP으로 부터 받아서 처리한다.
VentilStatus = new DataClasses.Venti();
mMenu = new Menu();
mMenu = super.getIntentParsingMenu(getIntent());
if (mMenu == null) {
Log.i(TAG, "[onCreate] mMenu = null");
if (OPERATION_MODE == Common.MODE_NOMAL) {
mTempCurrentScreenId = API_Menu.SubMenuCtrl.HDC_LivingLamp;
setTitleName(mTempCurrentScreenId);
mWallPadApiCheckHandler.sendEmptyMessage(0);
}
else {
setChangeScreen(API_Menu.SubMenuCtrl.HDC_LivingLamp, false);
}
}
else {
Log.i(TAG, "[onCreate] mMenu != null");
if (OPERATION_MODE == Common.MODE_NOMAL) {
mTempCurrentScreenId = mMenu.getStartId();
setTitleName(mTempCurrentScreenId);
mWallPadApiCheckHandler.sendEmptyMessage(0);
}
else {
mTempCurrentScreenId = mMenu.getStartId();
setTitleName(mTempCurrentScreenId);
mWallPadApiCheckHandler.sendEmptyMessage(0);
/*boolean result = setChangeScreen(mMenu.getStartId(), false);
Log.i(TAG, "Menu Sample result = " + result);
if (result == false)
{
setChangeScreen(API_Menu.SubMenuCtrl.HDC_LivingLamp, false);
}*/
}
}
// 7. Draw
DebugLogOutput("[Create] - Step7 : setContentView");
setContentView(AllLayout);
// 8. Window ReSize
DebugLogOutput("[Create] - Step8 : Window ReSize");
//super.WindowReSize(Common.SCREEN_SIZE_MAIN_W, Common.SCREEN_SIZE_MAIN_H, false);
// 9. BR Receiver 등록(메뉴에서 다른 화면이 눌린 경우 BR처리)
reg_Receiver();
WallpadDeviceSet wds = new WallpadDeviceSet(getContext());
int gateway = wds.GetGatewayModelKindInfo();
nDistributionPanelType = wds.Get_DistributionPannelType_Info();
nEnergyProductionUse = wds.Get_Energy_Devices_Info(); //에너지 제품군
wds.closeDB();
if (gateway == Version.GATEWAY_MODEL.IGW_200) {
Log.i(TAG, "[onCreate] IGW_200 SET @@@@@@@@@@@@@@@@@@@@");
}
else if (gateway == Version.GATEWAY_MODEL.IGW_300) {
Log.i(TAG, "[onCreate] IGW_300 SET @@@@@@@@@@@@@@@@@@@@");
}
else {
Log.i(TAG, "[onCreate] GATEWAY OTHER @@@@@@@@@@@@@@@@@@@@");
}
/*if( (SmartDistUse == 1) && (KnxDistUse == false) ) // 스마트분전반 O / KNX 분전반 X
{
SdbAPI sdbAPI = Get_SdbController();
if(sdbAPI == null) return -1;
ret = sdbAPI.Refresh(SdbAPI.DEVICE_INDEX.ENERGY_CONT, define.DEVICE_ALL_OR_NOTHING);
if(ret < 0) return -2;
if(sdbAPI.data.EnergyController.Data.BatchOffStatus == Sdb_DataClasses.BATCHOFF_STATUS.SET) return 0;
else return 1;
}
else if( (SmartDistUse == 0) && (KnxDistUse == true) ) // 스마트분전반 X / KNX 분전반 O
{
KnxAPI knxAPI = Get_KnxController();
if(knxAPI == null) return -1;
ret = knxAPI.Refresh(KnxAPI.DEVICE_INDEX.MASTER_CONT, define.DEVICE_ALL_OR_NOTHING);
if(ret < 0) return -2;
if(knxAPI.data.MasterController.Data.BatchOffStatus == KNX_DataClasses.BATCHOFF_STATUS.SET) return 0;
else return 1;
}
else // 그밖의 경우, 스마트분전반을 기본으로 로딩.
{
SdbAPI sdbAPI = Get_SdbController();
if(sdbAPI == null) return -1;
ret = sdbAPI.Refresh(SdbAPI.DEVICE_INDEX.ENERGY_CONT, define.DEVICE_ALL_OR_NOTHING);
if(ret < 0) return -2;
if(sdbAPI.data.EnergyController.Data.BatchOffStatus == Sdb_DataClasses.BATCHOFF_STATUS.SET) return 0;
else return 1;
}*/
Log.i(TAG, "[onCreate] End onCreate -------------------------------------------------");
}
/**
* (임시코드) WallPadAPI 초기생성시 Connect 에 시간이 걸리며,
* WallPadAPI 초기화후 바로 Get_GasValveController 등을 사용하여 API 를 가져올수 없기에,
* 본 딜레이 코드를 임시로 적용한다.
*/
@SuppressLint("HandlerLeak")
protected Handler mWallPadApiCheckHandler = new Handler() {
@SuppressLint("HandlerLeak")
@Override
public void handleMessage(Message msg) {
try {
if (msg.what == 0) {
if (wpapi != null) {
//Log.d(TAG, "Handler go");
if (wpapi.Check_Connect()) {
if (nDistributionPanelType == Version.DISTRIBUTION_MODEL.KNX_DIST) {
mKnxVentilAPI = wpapi.Get_KnxVentiController();
// KNX 환기
if (mKnxVentilAPI != null) {
Log.e(TAG, "[mWallPadApiCheckHandler] mKnxVentilAPI is not null!!");
updateKnxVentilatorData(false);
}
else {
Log.e(TAG, "[mWallPadApiCheckHandler] mKnxVentilAPI is null!!");
mWallPadApiCheckHandler.sendEmptyMessageDelayed(0, 10);
}
mVentilAPI = wpapi.Get_VentiController();
if (mVentilAPI != null) {
Log.e(TAG, "[mWallPadApiCheckHandler] mVentilAPI is not null!!");
updateVentilatorData(false);
}
else {
Log.e(TAG, "[mWallPadApiCheckHandler] mVentilAPI is null!!");
mWallPadApiCheckHandler.sendEmptyMessageDelayed(0, 10);
}
}
else {
// 일반 환기
mVentilAPI = wpapi.Get_VentiController();
if (mVentilAPI != null) {
Log.e(TAG, "[mWallPadApiCheckHandler] mVentilAPI is not null!!");
updateVentilatorData(false);
}
else {
Log.e(TAG, "[mWallPadApiCheckHandler] mVentilAPI is null!!");
mWallPadApiCheckHandler.sendEmptyMessageDelayed(0, 10);
}
}
// KCC 디밍제어기 사용여부 확인
WallpadDeviceSet wdst = new WallpadDeviceSet(getContext());
int nKCCDimmingUsage = wdst.GetDeviceSetted("KCC디밍제어기"); // 1: 사용안함 / 2: 사용함
int[] nLightType = wdst.Get_Light_info();
wdst.closeDB();
if (nKCCDimmingUsage == WallpadDeviceSet.DEV_DATA_ENABLE) {
ledDimmingAPI = wpapi.Get_KCCDimmingController();
if (ledDimmingAPI != null) {
ledDimmingAPI.regChangedBR(ID.main.BR_KCC_DIM);
if (ledDimmingAPI.Refresh((byte)0, false) >= 0) {
mDimData.DimData = ledDimmingAPI.data;
}
Draw_Update_DimmBtn();
}
else {
Log.w(TAG, "[mWallPadApiCheckHandler] ledDimmingAPI is null!!");
//mWallPadApiCheckHandler.sendEmptyMessageDelayed(0, 10);
}
}
if (nLightType[0] == WallpadDeviceSet.DO_USE) {
if (nLightType[1] == WallpadDeviceSet.LIGHT_TYPE_ROOM) {
// 조명 : 멀티스위치인 경우
try {
MultiSwitchAPI mMultiSwitchAPI = wpapi.Get_MultiSwitchController();
if (mMultiSwitchAPI.Refresh((byte) 0xFF, false) >= 0) {
Log.i(TAG, "[mWallPadApiCheckHandler] Multi Refresh ----> true @@@@@@@@@@@@@");
if (mMultiSwitchAPI.isExist_ConcentDevice()) {
Log.i(TAG, "[mWallPadApiCheckHandler] Multi concent ----> true @@@@@@@@@@@@@");
bMultiConcentExist = true; // 콘센트 있는지 확인
}
}
} catch (RuntimeException re) {
LogUtil.errorLogInfo("", TAG, re);
}
catch (Exception e) {
Log.e(TAG, e.toString());
}
}
}
mWallPadApiCheckHandler.sendEmptyMessageDelayed(1, 10);
}
else {
mWallPadApiCheckHandler.sendEmptyMessageDelayed(0, 10);
}
}
else {
Log.w(TAG, "[mWallPadApiCheckHandler] wpapi is null!!");
}
}
else if (msg.what == 1) {
Log.d(TAG, "Handler finish");
menueListDataClass = loadDefaultMenuList(); // 다시 메뉴를 만들어 질까? ??????
boolean result = setChangeScreen(mTempCurrentScreenId, false);
if (result == false) {
setChangeScreen(API_Menu.SubMenuCtrl.HDC_LivingLamp, false);
}
}
} catch (RuntimeException re) {
LogUtil.errorLogInfo("", TAG, re);
}
catch (Exception e) {
Log.e(TAG, "[Exception] mWallPadApiCheckHandler.handleMessage(Message msg)");
//e.printStackTrace();
LogUtil.errorLogInfo("", TAG, e);
}
}
};
boolean multiConcentFindRoutine = false;
@SuppressLint("HandlerLeak")
protected Handler mMultiConentCheckHandler = new Handler()
{
@SuppressLint("HandlerLeak")
@Override
public void handleMessage(Message msg) {
if (msg.what == 0) {
if (wpapi != null) {
//Log.d(TAG, "Handler go");
if (wpapi.Check_Connect()) {
WallpadDeviceSet wdst = new WallpadDeviceSet(getContext());
int[] lightType = wdst.Get_Light_info();
wdst.closeDB();
if (lightType[0] == WallpadDeviceSet.DO_USE) {
if (lightType[1] == WallpadDeviceSet.LIGHT_TYPE_ROOM) {
// 조명 : 멀티스위치인 경우,
try {
MultiSwitchAPI MSAPI = wpapi.Get_MultiSwitchController();
if (MSAPI.Refresh((byte) 0xFF, false) >= 0) {
Log.i(TAG, "Multi Refresh ----> true @@@@@@@@@@@@@");
if (MSAPI.isExist_ConcentDevice()) {
Log.i(TAG, "Multi concent ----> true @@@@@@@@@@@@@");
bMultiConcentExist = true; // 콘센트 있는지 확인
}
}
} catch (RuntimeException re) {
LogUtil.errorLogInfo("", TAG, re);
}
catch (Exception e) {
Log.e(TAG, e.toString());
}
}
else {
mWallPadApiCheckHandler.sendEmptyMessageDelayed(1, 10);
}
}
mWallPadApiCheckHandler.sendEmptyMessageDelayed(1, 10);
}
else {
mWallPadApiCheckHandler.sendEmptyMessageDelayed(0, 10);
}
}
}
else if (msg.what == 1) {
Log.d(TAG, "Handler finish");
multiConcentFindRoutine = true;
menueListDataClass = loadDefaultMenuList(); // 다시 메뉴를 만들어 질까? ??????
}
}
};
/* ================================================================================================
* [Manual Activity] Section
================================================================================================ */
public static ManualActivity mManualActivity;
public void setManualBtnVisible(boolean bEnable, int marginLeft) {
try {
Log.d(TAG, "[setManualBtnVisible] bEnable [" + bEnable + "], marginLeft [" + marginLeft + "]");
if (bEnable) {
TopManualBtn.setVisibility(View.VISIBLE);
ViewRegistration(TopLayout, TopManualBtn, marginLeft, 0);
}
else {
TopManualBtn.setVisibility(View.INVISIBLE);
}
} catch (RuntimeException re) {
LogUtil.errorLogInfo("", TAG, re);
}
catch (Exception e) {
Log.e(TAG, "[Exception] setManualBtnVisible(boolean bEnable, int marginLeft)");
//e.printStackTrace();
LogUtil.errorLogInfo("", TAG, e);
}
}
/**
* 매뉴얼 버튼 사용 유무
* @return boolean 타입 - true: 사용, false: 미사용
*/
public boolean getManualUse() {
try {
WallpadDeviceSet devSet = new WallpadDeviceSet(mContext);
String[] DBinfo = devSet.GetSettingData("매뉴얼");
devSet.closeDB();
if (DBinfo != null) {
if (DBinfo[1].indexOf("사용함") > 0) {
Log.d(TAG, "[getManualUse] Use Manual");
return true;
}
else {
// 미사용
Log.d(TAG, "[getManualUse] Not Use Manual [1]");
return false;
}
}
else {
// 미사용
Log.d(TAG, "[getManualUse] Not Use Manual [2]");
return false;
}
} catch (RuntimeException re) {
LogUtil.errorLogInfo("", TAG, re);
}
catch (Exception e) {
Log.e(TAG, "[Exception] getManualUse()");
//e.printStackTrace();
LogUtil.errorLogInfo("", TAG, e);
}
return false;
}
// ManualActivityRun
private static boolean ManualActivityRun = false;
public static boolean getManualActivityRun() {
Log.d(TAG, "[getManualActivityRun] ManualActivityRun: " + ManualActivityRun);
return ManualActivityRun;
}
public static void setManualActivityRun(boolean run) {
ManualActivityRun = run;
if (!ManualActivityRun) resetCurrentManualScreenID();
}
public boolean StartManual(int screenId) {
try {
Log.d(TAG, "[StartManual] ScreenId [" + screenId + "], mCurrentManualScreenId [" + mCurrentManualScreenId + "]");
if (getManualActivityRun()) {
mCurrentManualScreenId = screenId;
return ((WpadActivity) (ManualActivity.getContext())).ChangeScreen(screenId);
}
else {
if (mCurrentManualScreenId == screenId) return false;
mCurrentManualScreenId = screenId;
setManualActivityRun(true);
Intent intent = new Intent(mContext, ManualActivity.class);
intent.putExtra("ScreenId", screenId);
if (mCurrentScreenId == API_Menu.SubMenuCtrl.Heating_V2) {
intent.putExtra("HeatInfo", heatingV2MainScreen.Heating_Manual_Str);
}
else if (mCurrentScreenId == API_Menu.SubMenuCtrl.OutSide_EachLamp) {
intent.putExtra("EtcMultiInfo", "RoomCount:"+lightEtcEachMainScreen.TotalRoomCount + "/" + "KccDim:" + KccDimUse );
}
else if (mCurrentScreenId == API_Menu.SubMenuCtrl.Concent) {
intent.putExtra("ConcentInfo", "ConcentCount:"+concentMainScreen.mConDeviceCount );
}
else if (mCurrentScreenId == API_Menu.SubMenuCtrl.ChangAir_Normal) {
if (GetEasyModeUXUse() == true) {
intent.putExtra("VentiInfo", ventiEasymodeScreen.VentiManual_Str);
}
else {
if (ventiMainScreen != null) intent.putExtra("VentiInfo", ventiMainScreen.VentiManual_Str);
}
}
overridePendingTransition(0, 0);
startActivityForResult(intent, 0);
return true;
}
} catch (RuntimeException re) {
LogUtil.errorLogInfo("", TAG, re);
return false;
}
catch (Exception e) {
Log.e(TAG, "[Exception] StartManual(int screenId)");
//e.printStackTrace();
LogUtil.errorLogInfo("", TAG, e);
return false;
}
}
public static void resetCurrentManualScreenID() {
try {
mCurrentManualScreenId = -1;
} catch (RuntimeException re) {
LogUtil.errorLogInfo("", TAG, re);
}
catch (Exception e) {
Log.e(TAG, "[Exception] resetCurrentManualScreenID()");
//e.printStackTrace();
LogUtil.errorLogInfo("", TAG, e);
}
}
public static void FinishManualActivity() {
Log.i(TAG, "[FinishManualActivity]");
try {
if (mManualActivity != null) {
mCurrentManualScreenId = -1;
mManualActivity.finish();
}
} catch (RuntimeException re) {
LogUtil.errorLogInfo("", TAG, re);
}
catch (Exception e) {
Log.e(TAG, "[Exception] FinishManualActivity()");
//e.printStackTrace();
LogUtil.errorLogInfo("", TAG, e);
}
}
/**
* onDestroy
*/
@Override
protected void onDestroy() {
try {
setChangeScreen(mCurrentScreenId, true);
if (wdb != null) wdb.closeDB();
if (mWallPadApiCheckHandler != null) {
mWallPadApiCheckHandler.removeMessages(0);
}
this.unregisterReceiver(mWallPadAlertBR);
this.unregisterReceiver(mWallPadJogBR);
this.unregisterReceiver(mKccDimmBR);
if (ledDimmingAPI != null) {
ledDimmingAPI.unregChangedBR(ID.main.BR_KCC_DIM);
super.removeBrActionFilter(ID.main.BR_KCC_DIM);
}
if (getManualUse()) {
FinishManualActivity();
}
super.setFinishTimerDestroy();
super.onDestroy();
Log.i(TAG, "*************************************************************");
Log.i(TAG, "****************** [END - MainActivity] *******************");
Log.i(TAG, "*************************************************************");
} catch (RuntimeException re) {
LogUtil.errorLogInfo("", TAG, re);
}
catch (Exception e) {
Log.e(TAG, "[Exception] onDestroy()");
//e.printStackTrace();
LogUtil.errorLogInfo("", TAG, e);
}
}
/**
* onResume
*/
@Override
protected void onResume() {
super.onResume();
if (wpapi != null) wpapi.Resume();
DebugLogOutput("@@@@@@@@ [onResume] @@@@@@@@");
}
/**
* onPause
*/
@Override
protected void onPause() {
super.onPause();
if (wpapi != null) wpapi.Pause();
DebugLogOutput("@@@@@@@@ [onPause] @@@@@@@@");
}
/* ================================================================================================
* [BroadcastReceiver] Section
================================================================================================ */
/**
* BroadcastReceiver.onReceive for [WpadActivity]
*/
@Override
protected void onBrReceive(Intent intent) {
super.onBrReceive(intent);
String strActionName = intent.getAction();
DebugLogOutput("[onBrReceive] strActionName [" + intent.getAction() + "]");
if (strActionName.equals(ID.main.BR_KCC_DIM)) {
DebugLogOutput("[onBrReceive] ID.main.BR_KCC_DIM");
Device_Update_Dimming(false, (byte)0);
Draw_Update_DimmBtn();
}
}
/* ================================================================================================
* [Touch & Key Event] Section
================================================================================================ */
/**
* TouchEvent for [WpadActivity]
*/
@Override
protected void onTouchEvent(View v, MotionEvent event) {
super.onTouchEvent(v, event);
try {
int TargetId = v.getId();
int MoveEvent = event.getAction();
//DebugLogOutput("onTouch - " + "id : " + v.getId() + " / Action : " + event.getAction());
if (MoveEvent == MotionEvent.ACTION_UP) {
if (TargetId == ID.main.button.HOME) {
DebugLogOutput("onTouchEvent [HOME] BUTTON !!!");
Sound().Play(SND.effect.TOUCH_LATCHED);
Intent intent = new Intent();
intent.putExtra("Finish_Kind", "HomeButton");
setResult(RESULT_OK, intent);
finish();
}
else if (TargetId == ID.main.button.BACK) {
DebugLogOutput("onTouchEvent [BACK] BUTTON !!!");
Sound().Play(SND.effect.TOUCH_LATCHED);
/**
*[수정필요]Back Button 필요한 화면은 아래 부분 추가 후 사용 필요
* **/
/*
if(mCurrentScreenId == API_Menu.SubMenuConfig.SmartKey)
{
setChangeScreen(API_Menu.SubMenuConfig.Configuration, false);
}
*/
}
else if (TargetId == ID.main.button.MENU) {
DebugLogOutput("onTouchEvent [MENU] BUTTON !!!");
Log.i(TAG, "MenuOpen = " + MenuOpen);
Sound().Play(SND.effect.TOUCH_LATCHED);
if (MenuOpen == true) {
return;
}
OpenMenuLayout();
}
else if (TargetId == ID.main.button.MENUCLOSE) {
Sound().Play(SND.effect.TOUCH_LATCHED);
CloseMenuLayout();
}
else if (TargetId == ID.main.button.BOILER) {
DebugLogOutput("onTouchEvent [BOILER] BUTTON !!!");
if (StartPopup(ID.screen.HeatingV2PopupBoilerScreen)) {
Sound().Play(SND.effect.TOUCH_LATCHED);
}
}
else if (TargetId == ID.main.button.HIDE1 || TargetId == ID.main.button.HIDE2) {
HideMenuEntryProc(TargetId);
}
else if (TargetId == ID.main.button.AIRQBACK) {
DebugLogOutput("onTouchEvent [AIRQBACK] BUTTON !!!");
Sound().Play(SND.effect.TOUCH_LATCHED);
setAIRBackBtnVisible(false);
setChangeScreen(API_Menu.SubMenuCtrl.Inner_AirQuality, false);
}
else if (TargetId == ID.main.button.VENTILBACK) {
DebugLogOutput("onTouchEvent [AIRQBACK] BUTTON !!!");
Sound().Play(SND.effect.TOUCH_LATCHED);
setVentilBackBtnVisible(false);
setChangeScreen(API_Menu.SubMenuCtrl.ChangAir_Normal, false);
}
else if (TargetId >= ID.main.button.DIMM_NORMAL && TargetId <= ID.main.button.DIMM_REST) {
DebugLogOutput("onTouchEvent [DIMM_NORMAL] BUTTON !!!");
try {
// 디밍제어
int index = TargetId - ID.main.button.DIMM_NORMAL;
DebugLogOutput("onTouchEvent [DIM_LEV" + (index + 1) + "] BUTTON !!!");
if (mDimData.DimData.Device[0] == null) {
DebugLogOutput("null event");
}
if(mDimData.DimData.Device[0]!=null && mLevelArray!=null)
{
byte NowLevel = mDimData.DimData.Device[0].device.Level;
DebugLogOutput("NowLevel :" + NowLevel);
byte CtrlLevel = mLevelArray[index];
DebugLogOutput("CtrlLevel :" + CtrlLevel);
if (NowLevel == CtrlLevel) {
TopDimmingBtn[index].setButtonRearImage(); // 켜진 상태 그대로 유지
}
else if (NowLevel != CtrlLevel) {
int ret = Device_SetDimmingLevel(CtrlLevel);
if (ret >= 0) Sound().Play(SND.effect.TOUCH_LATCHED);
else Sound().Play(SND.effect.TOUCH_UNLATCHED);
}
}
} catch (RuntimeException re) {
Sound().Play(SND.effect.TOUCH_UNLATCHED);
LogUtil.errorLogInfo("", TAG, re);
}
catch (Exception ex) {
Sound().Play(SND.effect.TOUCH_UNLATCHED);
//ex.printStackTrace();
LogUtil.errorLogInfo("", TAG, ex);
}
}
else if (TargetId == ID.main.button.MANUAL) {
Log.i(TAG, "onTouchEvent [MANUAL] BUTTON [mCurrentScreenId = " + mCurrentScreenId + "]");
Sound().Play(SND.effect.TOUCH_LATCHED);
if (mCurrentScreenId == API_Menu.SubMenuCtrl.HDC_LivingLamp) { StartManual(ID.MANUAL.MANUAL_HdcLivingLight); }
else if (mCurrentScreenId == API_Menu.SubMenuCtrl.LivingLightConfig) { StartManual(ID.MANUAL.MANUAL_HdcLivingGroup); }
else if (mCurrentScreenId == API_Menu.SubMenuCtrl.OutSide_livingLamp) { StartManual(ID.MANUAL.MANUAL_EtcLivingLight); }
else if (mCurrentScreenId == API_Menu.SubMenuCtrl.HDCLivingNEach_Lamp) {}
else if (mCurrentScreenId == API_Menu.SubMenuCtrl.OutSide_EachLamp) { StartManual(ID.MANUAL.MANUAL_EtcMultiLight); }
else if (mCurrentScreenId == API_Menu.SubMenuCtrl.Heating_V2 || mCurrentScreenId == API_Menu.SubMenuCtrl.Heating_V1) { StartManual(ID.MANUAL.MANUAL_Heating); }
else if (mCurrentScreenId == API_Menu.SubMenuCtrl.Gas) { StartManual(ID.MANUAL.MANUAL_Gas); }
else if (mCurrentScreenId == API_Menu.SubMenuCtrl.Cooktop_Concent) { StartManual(ID.MANUAL.MANUAL_CookTopConcent); }
else if (mCurrentScreenId == API_Menu.SubMenuCtrl.DoorLockWL) { StartManual(ID.MANUAL.MANUAL_Doorlock); }
else if (mCurrentScreenId == API_Menu.SubMenuCtrl.DoorLock485) { StartManual(ID.MANUAL.MANUAL_Doorlock); }
else if (mCurrentScreenId == API_Menu.SubMenuCtrl.Concent) { StartManual(ID.MANUAL.MANUAL_Concent); }
else if (mCurrentScreenId == API_Menu.SubMenuCtrl.ChangAir_Normal) {
if (getAirSensorAPUsage() && VentilStatus.Support.InnerCycle && VentilStatus.Support.OutAirClean) {
if (nDistributionPanelType != Version.DISTRIBUTION_MODEL.KNX_DIST) StartManual(ID.MANUAL.MANUAL_Ventilation);
}
else {
if (GetEasyModeUXUse()) StartManual(ID.MANUAL.MANUAL_Easymode_Venti);
else {
if (VentilStatus.Support2.WindowVenti) StartManual(ID.MANUAL.MANUAL_Venti);
else StartManual(ID.MANUAL.MANUAL_Ventilation);
}
}
}
else if (mCurrentScreenId == API_Menu.SubMenuCtrl.Inner_AirQuality) { StartManual(ID.MANUAL.MANUAL_InAirQual); }
else if (mCurrentScreenId == API_Menu.SubMenuCtrl.Inner_AirInfo) { /*StartManual(ID.MANUAL.MANUAL_AirInfo);*/ }
else if (mCurrentScreenId == API_Menu.SubMenuCtrl.Electric_Range) { StartManual(ID.MANUAL.MANUAL_ElecRange); }
}
}
} catch (RuntimeException re) {
LogUtil.errorLogInfo("", TAG, re);
}
catch (Exception e) {
Log.e(TAG, "[Exception] onTouchEvent(View v, MotionEvent event)");
//e.printStackTrace();
LogUtil.errorLogInfo("", TAG, e);
}
}
/**
* H/W Key Event
*/
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
Log.i(TAG, "[onKeyDown] keyCode : " + keyCode + ", Action : " + event.getAction());
return super.onKeyDown(keyCode, event);
}
/* ================================================================================================
* [TOP - Back] Section
================================================================================================ */
/**
* TOP 돌아가기 버튼 활성화 & 비활성화
*
* @param Enabled - true : 활성화, false : 비활성화
* @return (boolean) true : 성공, false : 실패
*/
public boolean setTopBackBtnVisible(boolean Enabled) {
try {
if (Enabled == true) {
if (TopBackBtn.getVisibility() != View.VISIBLE) TopBackBtn.setVisibility(View.VISIBLE);
TopBackBtn.bringToFront();
}
else {
if (TopBackBtn.getVisibility() != View.INVISIBLE) TopBackBtn.setVisibility(View.INVISIBLE);
}
return true;
} catch (RuntimeException re) {
LogUtil.errorLogInfo("", TAG, re);
return false;
}
catch (Exception e) {
Log.e(TAG, "[Exception] setTopBackBtnVisible(boolean Enabled)");
//e.printStackTrace();
LogUtil.errorLogInfo("", TAG, e);
return false;
}
}
/* ================================================================================================
* [Popup Activity] Section
================================================================================================ */
/**
* Popup Activity 를 시작시킨다.
*
* @param ScreenId - 팝업시작시 Screen ID
* @return (boolean) true : 성공, false : 실패
*/
public boolean StartPopup(int ScreenId) {
if (getPopupActivityRun() == true) {
return ((WpadActivity) (PopupActivity.getContext())).ChangeScreen(ScreenId);
}
else {
setPopupActivityRun(true);
Intent intent = new Intent(mContext, PopupActivity.class);
intent.putExtra("ScreenId", ScreenId);
overridePendingTransition(0, 0);
startActivityForResult(intent, 0);
return true;
}
}
/**
* Popup Activity 를 시작시킨다. (시작시 Intent Type 데이터를 전달한다)
*
* @param ScreenId - 팝업시작시 Screen ID
* @param data - 전달할 데이터
* @return (boolean) true : 성공, false : 실패
*/
public boolean StartPopup(int ScreenId, Intent data) {
if (getPopupActivityRun() == true) { return false;
}
else {
setPopupActivityRun(true);
Intent intent = new Intent(mContext, PopupActivity.class);
intent.putExtra("ScreenId", ScreenId);
intent.putExtra("PopupScreenDataIntent", data);
overridePendingTransition(0, 0);
startActivityForResult(intent, 0);
return true;
}
}
/**
* Activity Result Reception
*/
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
try {
Log.d(TAG, "@@@@@@@@ [onActivityResult] @@@@@@@@");
if (resultCode == RESULT_OK) {
// PopupActivity 에서 FinishTimer 로 인하여 종료가 되었을 경우
// MainActivity 도 즉시 종료시킨다.
String code = (String) data.getExtras().get("Finish_Kind");
Log.d(TAG, "[onActivityResult] Finish_Kind : " + code);
if (code != null) {
if (code.equals("FinishTimer")) {
Log.d(TAG, "FinishTimer finish");
finish();
}
}
}
} catch (RuntimeException re) {
LogUtil.errorLogInfo("", TAG, re);
}
catch (Exception e) {
Log.e(TAG, "[Exception] onActivityResult(int requestCode, int resultCode, Intent data)");
//e.printStackTrace();
LogUtil.errorLogInfo("", TAG, e);
}
}
/* ================================================================================================
* [Screen] Section
================================================================================================ */
/**
* Screen 에서 Screen 변경을 요청할 경우 호출된다.
* Override 사용하여 Screen 변경을 처리한다.
*
* @param nScreenId - 변경할 Screen ID
* @return (boolean) true : 성공, false : 실패
*/
@Override
protected boolean onChangeScreen(int nScreenId) {
super.onChangeScreen(nScreenId);
return setChangeScreen(nScreenId, false);
}
/**
* @param nScreenId - 변경할 Screen ID
* @return (boolean) true : 성공, false : 실패
**/
private boolean setTitleName(int nScreenId) {
boolean ret = false;
try {
Log.d(TAG, "[setTitleName] nScreenId [" + nScreenId + "]");
switch (nScreenId) {
case API_Menu.SubMenuCtrl.HDC_LivingLamp:
SetTitleText(API_Menu.SubMenuCtrl.Name_Lamp);
ret = true;
break;
case API_Menu.SubMenuCtrl.HDC_EachLamp:
SetTitleText(API_Menu.SubMenuCtrl.Name_Lamp);
ret = true;
break;
case API_Menu.SubMenuCtrl.LivingLightConfig:
SetTitleText(API_Menu.SubMenuCtrl.Name_LivingLightConfig);
ret = true;
break;
case API_Menu.SubMenuCtrl.OutSide_livingLamp:
SetTitleText(API_Menu.SubMenuCtrl.Name_Lamp);
ret = true;
break;
case API_Menu.SubMenuCtrl.OutSide_EachLamp:
SetTitleText(API_Menu.SubMenuCtrl.Name_Lamp);
ret = true;
break;
case API_Menu.SubMenuCtrl.HDCLivingNEach_Lamp:
SetTitleText(API_Menu.SubMenuCtrl.Name_Lamp);
ret = true;
break;
case API_Menu.SubMenuCtrl.Heating_V2:
SetTitleText(API_Menu.SubMenuCtrl.Name_Heating);
ret = true;
break;
case API_Menu.SubMenuCtrl.Gas:
SetTitleText(API_Menu.SubMenuCtrl.Name_Gas);
ret = true;
break;
case API_Menu.SubMenuCtrl.DoorLock485:
SetTitleText(API_Menu.SubMenuCtrl.Name_DoorLock);
ret = true;
break;
case API_Menu.SubMenuCtrl.DoorLockWL:
SetTitleText(API_Menu.SubMenuCtrl.Name_DoorLock);
ret = true;
break;
case API_Menu.SubMenuCtrl.ChangAir_Normal:
case API_Menu.SubMenuCtrl.ChangAir_LH:
case API_Menu.SubMenuCtrl.ChangAir_Hood:
SetTitleText(API_Menu.SubMenuCtrl.Name_Venti);
ret = true;
break;
case API_Menu.SubMenuCtrl.Inner_AirQuality:
SetTitleText(API_Menu.SubMenuCtrl.Name_InnerAirQuality);
ret = true;
break;
case API_Menu.SubMenuCtrl.Inner_AirInfo:
SetTitleText(API_Menu.SubMenuCtrl.Name_InnerAirInfo);
ret = true;
break;
case API_Menu.SubMenuCtrl.Concent:
case API_Menu.SubMenuCtrl.HDCLivingNEach_Concent:
SetTitleText(API_Menu.SubMenuCtrl.Name_Concent);
ret = true;
break;
case API_Menu.SubMenuCtrl.SystemAircon:
SetTitleText(API_Menu.SubMenuCtrl.Name_SystemAircon);
ret = true;
break;
case API_Menu.SubMenuCtrl.Purity:
SetTitleText(API_Menu.SubMenuCtrl.Name_Purity);
ret = true;
break;
default:
Log.e(TAG, "[Error] setTitleName - nScreenId Not found!!! (" + mCurrentScreenId + ")");
//mCurrentScreenId = -1;
SetTitleText(API_Menu.SubMenuCtrl.Name_Lamp);
ret = false;
break;
}
} catch (RuntimeException re) {
LogUtil.errorLogInfo("", TAG, re);
}
catch (Exception e) {
Log.e(TAG, "[Exception] setTitleName(int nScreenId)");
//e.printStackTrace();
LogUtil.errorLogInfo("", TAG, e);
}
return ret;
}
/**
* Screen 등록자
* ScreenLayout 에 현재 Screen 을 삭제하고, 새로운 Screen 을 등록시킨다.
*
* @param nScreenId - 변경할 Screen ID
* @param OnlyRemove - 현재 Screen 을 삭제만 할 경우 (onDestroy 에서 사용)
* @return (boolean) true : 성공, false : 실패
*/
private boolean setChangeScreen(int nScreenId, boolean OnlyRemove) {
DebugLogOutput("setChangeScreen - " + "CurrentSelectDeviceId : " + mCurrentScreenId + " / NextLayoutId : " + nScreenId + " / OnlyRemove : " + OnlyRemove);
// 1. 현재 Layout 삭제
if (mCurrentScreenId > 0) {
ScreenLayout.removeAllViews();
super.setCurrentScreen(null);
}
if (OnlyRemove) return true;
mCurrentScreenId = nScreenId;
setTopBackBtnVisible(false);
boolean result = false;
// 2. 새로운 Layout 표시
try {
setTitleName(nScreenId);
super.setFinishTimerCreate(Common.FINISH_TIME_SEC);
switch (nScreenId) {
/**
* [수정필요]
* Back Button 필요한 화면은 setTopBackBtnVisible(true) 호출 필요
* 추가 또는 수정해야할 부분 1. - 스크린 별 layout 생성
* **/
//추가 또는 수정해야할 부분 1. - 스크린 별 layout 생성
case API_Menu.SubMenuCtrl.HDC_LivingLamp: {
if (nDistributionPanelType == Version.DISTRIBUTION_MODEL.SMART_DIST) {
// 스마트 분전반
lightHdcLivMainScreen = new LightHdcLivMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
super.setCurrentScreen(lightHdcLivMainScreen);
setTopBoilerBtnVisible(false);
setAIRBackBtnVisible(false);
setKccDimmBtnVisible(false);
setVentilBackBtnVisible(false);
result = true;
break;
}
else if (nDistributionPanelType == Version.DISTRIBUTION_MODEL.KNX_DIST) {
// KNX 분전반
// madeinlab 새로 만든 스크린으로 적용한다.
lightKnxMainScreen = new LightKnxMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mRoomNameList_Light);
super.setCurrentScreen(lightKnxMainScreen);
setTopBoilerBtnVisible(false);
setAIRBackBtnVisible(false);
setKccDimmBtnVisible(false);
setVentilBackBtnVisible(false);
setManualBtnVisible(false, 1019);
result = true;
break;
}
}
/*case API_Menu.SubMenuCtrl.HDC_EachLamp:
{
if( (SmartDistUse == 1) && (KnxDistUse == false) ) // 스마트분전반 O / KNX 분전반 X
{
lightHdcLivMainScreen = new LightHdcLivMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
super.setCurrentScreen(lightHdcLivMainScreen);
setTopBoilerBtnVisible(false);
setAIRBackBtnVisible(false);
setKccDimmBtnVisible(false);
result = true;
break;
}
else if( (SmartDistUse == 0) && (KnxDistUse == true) ) // 스마트분전반 X / KNX 분전반 O
{
lightHdcLivKnxMainScreen = new LightHdcLivKnxMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
super.setCurrentScreen(lightHdcLivKnxMainScreen);
setTopBoilerBtnVisible(false);
setAIRBackBtnVisible(false);
setKccDimmBtnVisible(false);
result = true;
break;
}
}*/
case API_Menu.SubMenuCtrl.LivingLightConfig:
lightHdcLivConifgScreen = new LightHdcLivConifgScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
super.setCurrentScreen(lightHdcLivConifgScreen);
setTopBoilerBtnVisible(false);
setAIRBackBtnVisible(false);
setKccDimmBtnVisible(false);
setVentilBackBtnVisible(false);
result = true;
break;
//OutSide_EachLamp
case API_Menu.SubMenuCtrl.OutSide_EachLamp:
SetTitleText(API_Menu.SubMenuCtrl.Name_Lamp);
lightEtcEachMainScreen = new LightEtcEachMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mRoomNameList_Light);
super.setCurrentScreen(lightEtcEachMainScreen);
setTopBoilerBtnVisible(false);
setAIRBackBtnVisible(false);
setKccDimmBtnVisible(true);
setVentilBackBtnVisible(false);
result = true;
break;
case API_Menu.SubMenuCtrl.OutSide_livingLamp:
SetTitleText(API_Menu.SubMenuCtrl.Name_Lamp);
lightEtcLivMainScreen = new LightEtcLivMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
super.setCurrentScreen(lightEtcLivMainScreen);
setTopBoilerBtnVisible(false);
setAIRBackBtnVisible(false);
setKccDimmBtnVisible(true);
setVentilBackBtnVisible(false);
result = true;
break;
case API_Menu.SubMenuCtrl.HDCLivingNEach_Lamp:
SetTitleText(API_Menu.SubMenuCtrl.Name_Lamp);
lightHdcNEachMainScreen = new LightHdcNEachMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mRoomNameList_Light);
super.setCurrentScreen(lightHdcNEachMainScreen);
setTopBoilerBtnVisible(false);
setAIRBackBtnVisible(false);
setKccDimmBtnVisible(true);
setVentilBackBtnVisible(false);
result = true;
break;
//에너지미터 + 기본형
case API_Menu.SubMenuCtrl.HDCLivingNEnergyMeter_Lamp:
SetTitleText(API_Menu.SubMenuCtrl.Name_Lamp);
lightHdcLightEnergyMeterMainScreen = new LightHdcLightEnergyMeterMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mRoomNameList_Light);
super.setCurrentScreen(lightHdcLightEnergyMeterMainScreen);
setTopBoilerBtnVisible(false);
setAIRBackBtnVisible(false);
setKccDimmBtnVisible(true);
setVentilBackBtnVisible(false);
result = true;
break;
case API_Menu.SubMenuCtrl.Heating_V1:
case API_Menu.SubMenuCtrl.Heating_V2:
SetTitleText(API_Menu.SubMenuCtrl.Name_Heating);
try {
if(wpapi.GetHeatingKind() == 1)
{
heatingV1MainScreen = new HeatingV1MainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mRoomNameList_Heating);
super.setCurrentScreen(heatingV1MainScreen);
if (OPERATION_MODE == Common.MODE_BUSINESS_SAMPLE) {
//setTopBoilerBtnVisible(true); // 임시 강제 생성코드
}
}
else
{
heatingV2MainScreen = new HeatingV2MainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mRoomNameList_Heating);
super.setCurrentScreen(heatingV2MainScreen);
if (OPERATION_MODE == Common.MODE_BUSINESS_SAMPLE) {
//setTopBoilerBtnVisible(true); // 임시 강제 생성코드
}
}
}
catch (Exception e)
{
heatingV2MainScreen = new HeatingV2MainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mRoomNameList_Heating);
super.setCurrentScreen(heatingV2MainScreen);
if (OPERATION_MODE == Common.MODE_BUSINESS_SAMPLE) {
//setTopBoilerBtnVisible(true); // 임시 강제 생성코드
}
}
setAIRBackBtnVisible(false);
setKccDimmBtnVisible(false);
setVentilBackBtnVisible(false);
result = true;
break;
case API_Menu.SubMenuCtrl.Gas:
try {
if(wpapi.GetGasKind() == 1)
{
SetTitleText(API_Menu.SubMenuCtrl.Name_Gas);
gasMainScreen = new GasMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
super.setCurrentScreen(gasMainScreen);
}
else if(wpapi.GetGasKind() == 2)
{
SetTitleText(API_Menu.SubMenuCtrl.Name_Gas);
hybridCookTopMainScreen = new HybridCookTopMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
super.setCurrentScreen(hybridCookTopMainScreen);
}
else
{
SetTitleText(API_Menu.SubMenuCtrl.Name_Gas);
gasMainScreen = new GasMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
super.setCurrentScreen(gasMainScreen);
}
}
catch (Exception e)
{
// SetTitleText(API_Menu.SubMenuCtrl.Name_Gas);
// gasMainScreen = new GasMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
// super.setCurrentScreen(gasMainScreen);
}
// SetTitleText(API_Menu.SubMenuCtrl.Name_Gas);
// gasMainScreen = new GasMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
// super.setCurrentScreen(gasMainScreen);
setTopBoilerBtnVisible(false);
setAIRBackBtnVisible(false);
setKccDimmBtnVisible(false);
setVentilBackBtnVisible(false);
result = true;
break;
case API_Menu.SubMenuCtrl.DoorLock485:
SetTitleText(API_Menu.SubMenuCtrl.Name_DoorLock);
doorLockMainScreen = new DoorLockMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, API_Menu.SubMenuCtrl.DoorLock485);
super.setCurrentScreen(doorLockMainScreen);
setTopBoilerBtnVisible(false);
setAIRBackBtnVisible(false);
setKccDimmBtnVisible(false);
result = true;
break;
case API_Menu.SubMenuCtrl.DoorLockWL:
SetTitleText(API_Menu.SubMenuCtrl.Name_DoorLock);
doorLockMainScreen = new DoorLockMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, API_Menu.SubMenuCtrl.DoorLockWL);
super.setCurrentScreen(doorLockMainScreen);
setTopBoilerBtnVisible(false);
setAIRBackBtnVisible(false);
setKccDimmBtnVisible(false);
result = true;
break;
case API_Menu.SubMenuCtrl.ChangAir_Normal:
case API_Menu.SubMenuCtrl.ChangAir_LH:
case API_Menu.SubMenuCtrl.ChangAir_Hood:
if(isUseModelHouse_Venti)
{
SetTitleText(API_Menu.SubMenuCtrl.Name_Venti);
ventilationModelMainScreen = new VentilationModelMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, nScreenId);
super.setFinishTimerDestroy();
super.setCurrentScreen(ventilationModelMainScreen);
setTopBoilerBtnVisible(false);
setAIRBackBtnVisible(false);
setKccDimmBtnVisible(false);
setVentilBackBtnVisible(false);
result = true;
}
else
{
Log.e(TAG, "[setChangeScreen] getAirSensorAPUsage [" + getAirSensorAPUsage() + "], Support.InnerCycle [" + VentilStatus.Support.InnerCycle + "], Support.OutAirClean [" + VentilStatus.Support.OutAirClean + "]");
if (getAirSensorAPUsage() && VentilStatus.Support.InnerCycle && VentilStatus.Support.OutAirClean) {
if(isUseModelHouse_Venti)
{
ventilationModelMainScreen = new VentilationModelMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, nScreenId);
super.setCurrentScreen(ventilationModelMainScreen);
super.setFinishTimerDestroy();
}
else
{
if (nDistributionPanelType == Version.DISTRIBUTION_MODEL.KNX_DIST) {
//고급향은 환기가 3개임. KNX 쪽으로 우선 분기를 태움.
SetTitleText(API_Menu.SubMenuCtrl.Name_Venti);
knxVentiMainScreen = new KnxVentiMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, nScreenId);
super.setCurrentScreen(knxVentiMainScreen);
}
else {
SetTitleText(API_Menu.SubMenuCtrl.Name_Venti);
ventilationMainScreen = new VentilationMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, nScreenId);
super.setCurrentScreen(ventilationMainScreen);
}
}
setTopBoilerBtnVisible(false);
setAIRBackBtnVisible(false);
setKccDimmBtnVisible(false);
setVentilBackBtnVisible(false);
result = true;
}
else {
if (GetEasyModeUXUse() == true) {
SetTitleText(API_Menu.SubMenuCtrl.Name_Venti);
ventiEasymodeScreen = new VentiEasymodeScreen(this, ScreenLayout, wpapi, OPERATION_MODE, nScreenId);
super.setCurrentScreen(ventiEasymodeScreen);;
setTopBoilerBtnVisible(false);
setAIRBackBtnVisible(false);
setKccDimmBtnVisible(false);
setVentilBackBtnVisible(false);
result = true;
}
else {
if (VentilStatus.Support2.WindowVenti) {
SetTitleText(API_Menu.SubMenuCtrl.Name_Venti);
ventiMainScreen = new VentiMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, nScreenId);
super.setCurrentScreen(ventiMainScreen);
}
else {
if (nDistributionPanelType == Version.DISTRIBUTION_MODEL.KNX_DIST) {
SetTitleText(API_Menu.SubMenuCtrl.Name_Venti);
knxVentiMainScreen = new KnxVentiMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, nScreenId);
super.setCurrentScreen(knxVentiMainScreen);
setManualBtnVisible(false, 1019);
}
else {
SetTitleText(API_Menu.SubMenuCtrl.Name_Venti);
ventilationMainScreen = new VentilationMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, nScreenId);
super.setCurrentScreen(ventilationMainScreen);
// SetTitleText(API_Menu.SubMenuCtrl.Name_Venti);
// ventiMainScreen = new VentiMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, API_Menu.SubMenuCtrl.ChangAir_Normal);
// super.setCurrentScreen(ventiMainScreen);
}
}
setTopBoilerBtnVisible(false);
setAIRBackBtnVisible(false);
setKccDimmBtnVisible(false);
setVentilBackBtnVisible(false);
result = true;
}
}
}
break;
case API_Menu.SubMenuCtrl.Inner_AirQuality:
SetTitleText(API_Menu.SubMenuCtrl.Name_InnerAirQuality);
airQualityMainScreen = new AirQualityMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
super.setCurrentScreen(airQualityMainScreen);
setTopBoilerBtnVisible(false);
setAIRBackBtnVisible(false);
setKccDimmBtnVisible(false);
setVentilBackBtnVisible(false);
result = true;
break;
case API_Menu.SubMenuCtrl.Inner_AirInfo:
SetTitleText(API_Menu.SubMenuCtrl.Name_InnerAirInfo);
dustInfoScreen = new DustInfoScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
super.setCurrentScreen(dustInfoScreen);
setTopBoilerBtnVisible(false);
setAIRBackBtnVisible(false);
setKccDimmBtnVisible(false);
setVentilBackBtnVisible(false);
result = true;
break;
case API_Menu.SubMenuCtrl.Concent:
if (nDistributionPanelType == Version.DISTRIBUTION_MODEL.KNX_DIST) {
SetTitleText(API_Menu.SubMenuCtrl.Name_Concent);
concentKnxMainScreen = new ConcentKnxMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mRoomNameList_Light);
super.setCurrentScreen(concentKnxMainScreen);
setManualBtnVisible(false, 1019);
}
else
{
SetTitleText(API_Menu.SubMenuCtrl.Name_Concent);
concentMainScreen = new ConcentMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mDefaultRoomNameList_Light);
super.setCurrentScreen(concentMainScreen);
setManualBtnVisible(getManualUse(), 1019);
}
setTopBoilerBtnVisible(false);
setAIRBackBtnVisible(false);
setKccDimmBtnVisible(false);
setVentilBackBtnVisible(false);
result = true;
break;
case API_Menu.SubMenuCtrl.HDCLivingNEach_Concent:
SetTitleText(API_Menu.SubMenuCtrl.Name_Concent);
//여기서 에너지 미터 사용 여부 체크해서 사용하면 에너지 미터 화면을 가져다가 사용하도록 함
if(nEnergyProductionUse == WallpadDeviceSet.DO_USE)
{
concentEnergyMeterScreen = new ConcentEnergyMeterScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mDefaultRoomNameList_Light);
super.setCurrentScreen(concentEnergyMeterScreen);
}
else
{
concentHdcNEachMainScreen = new ConcentHdcNEachMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mRoomNameList_Light);
super.setCurrentScreen(concentHdcNEachMainScreen);
}
setTopBoilerBtnVisible(false);
setAIRBackBtnVisible(false);
setKccDimmBtnVisible(false);
setVentilBackBtnVisible(false);
setManualBtnVisible(false, 1019);
result = true;
break;
case API_Menu.SubMenuCtrl.Electric_Range:
SetTitleText(API_Menu.SubMenuCtrl.Name_ElectricRange);
electricRangeMainScreen = new ElectricRangeMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
super.setCurrentScreen(electricRangeMainScreen);
setTopBoilerBtnVisible(false);
setAIRBackBtnVisible(false);
setKccDimmBtnVisible(false);
setVentilBackBtnVisible(false);
result = true;
break;
case API_Menu.SubMenuCtrl.Cooktop_Concent:
SetTitleText(API_Menu.SubMenuCtrl.Name_CooktopConcent);
cookTopConcentMainScreen = new CookTopConcentMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
super.setCurrentScreen(cookTopConcentMainScreen);
setTopBoilerBtnVisible(false);
setAIRBackBtnVisible(false);
setKccDimmBtnVisible(false);
setVentilBackBtnVisible(false);
result = true;
break;
case API_Menu.SubMenuCtrl.SystemAircon:
SetTitleText(API_Menu.SubMenuCtrl.Name_SystemAircon);
systemAirconMainScreen = new SystemAirconMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mDefaultRoomNameList);
super.setCurrentScreen(systemAirconMainScreen);
setTopBoilerBtnVisible(false);
setAIRBackBtnVisible(false);
setKccDimmBtnVisible(false);
setVentilBackBtnVisible(false);
setManualBtnVisible(false, 1019);
result = true;
break;
case API_Menu.SubMenuCtrl.Purity:
SetTitleText(API_Menu.SubMenuCtrl.Name_Purity);
purityMainScreen = new PurityMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mDefaultRoomNameList);
super.setCurrentScreen(purityMainScreen);
setTopBoilerBtnVisible(false);
setAIRBackBtnVisible(false);
setKccDimmBtnVisible(false);
setVentilBackBtnVisible(false);
result = true;
break;
case API_Menu.SubMenuCtrl.Curtain:
SetTitleText(API_Menu.SubMenuCtrl.Name_Curtain);
curTainV1MainScreen = new CurTainV1MainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
super.setCurrentScreen(curTainV1MainScreen);
setTopBoilerBtnVisible(false);
setAIRBackBtnVisible(false);
setKccDimmBtnVisible(false);
setVentilBackBtnVisible(false);
result = true;
break;
default:
Log.i(TAG, "[Error] setChangeScreen - nScreenId Not found!!! (" + mCurrentScreenId + ")");
if (Version.getGatewayUsage()) {
// 게이트웨이 사용
SetTitleText(API_Menu.SubMenuCtrl.Name_Lamp);
lightHdcLivMainScreen = new LightHdcLivMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
super.setCurrentScreen(lightHdcLivMainScreen);
setTopBoilerBtnVisible(false);
setAIRBackBtnVisible(false);
setKccDimmBtnVisible(false);
setVentilBackBtnVisible(false);
}
else {
// 게이트웨이 미사용
SetTitleText(API_Menu.SubMenuCtrl.Name_Lamp);
lightEtcEachMainScreen = new LightEtcEachMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mRoomNameList_Light);
super.setCurrentScreen(lightEtcEachMainScreen);
setTopBoilerBtnVisible(false);
setAIRBackBtnVisible(false);
setKccDimmBtnVisible(true);
setVentilBackBtnVisible(false);
}
result = false;
break;
//mCurrentScreenId = -1;
//return false;
}
} catch (RuntimeException re) {
LogUtil.errorLogInfo("", TAG, re);
return false;
}
catch (Exception e) {
Log.e(TAG, "[Exception] setChangeScreen(int nScreenId, boolean OnlyRemove)");
//e.printStackTrace();
LogUtil.errorLogInfo("", TAG, e);
return false;
}
return result;
}
/**
* 상단 타이틀 텍스트 수정
*
* @param SetText (String) 수정할 타이틀 이름
**/
private void SetTitleText(String SetText) {
if (SetText != null) {
TopTitle.setText(SetText);
}
}
/* ================================================================================================
* [Menu Layout] Section
================================================================================================ */
/**
* 메뉴 레이아웃 생성
**/
private void OpenMenuLayout() {
Log.i(TAG, "Enter OpenMenuLayout !!!");
if (MenuOpen == true) {
Log.e(TAG, "[OpenMenuLayout] MenuOpen");
return;
}
if (menueListDataClass == null) {
Log.e(TAG, "[OpenMenuLayout] menueListDataClass is null");
return;
}
//0. 현재 ID 및 리스트 불러오기
String Title = API_Menu.GetGroupNameByID((mCurrentScreenId / 1000) * 1000);
String TempChildName = null;
int ChooseGroup = 0;
int ChooseChild = 0;
for (int i = 0; i < menueListDataClass.arrayGroup.size(); i++) {
if (menueListDataClass.arrayGroup.get(i).equals(Title)) {
ChooseGroup = i;
break;
}
}
Log.i(TAG, "[OpenMenuLayout] - ChooseGroup = " + ChooseGroup);
for (int i = 0; i < menueListDataClass.idMappingTable.length; i++) {
if (menueListDataClass.idMappingTable[i].Id == mCurrentScreenId) {
TempChildName = menueListDataClass.idMappingTable[i].Name;
break;
}
//도어락 화면은 공용으로 사용하기 때문에 1042화면을 사용하나, 도어락 타입을 나누어야 하기 때문에
else if (menueListDataClass.idMappingTable[i].Id == API_Menu.SubMenuCtrl.DoorLock485) {
TempChildName = menueListDataClass.idMappingTable[i].Name;
break;
}
}
Log.i(TAG, "[OpenMenuLayout] - TempChildName = " + TempChildName);
if (TempChildName == null) {
Log.e(TAG, "TempChildName is null");
return;
}
for (int i = 0; i < menueListDataClass.arrayChild.get(Title).size(); i++) {
if (menueListDataClass.arrayChild.get(Title).get(i).equals(TempChildName) == true) {
ChooseChild = i;
break;
}
}
//1. 기존 화면 투명도 변경
TopLayout.setAlpha(0.5f);
ScreenLayout.setAlpha(0.5f);
//2. Layout 생성 및 처리 이벤트 등록
MenuLayout = new RelativeLayout(this);
WpadUtil.LayoutRegistration(AllLayout, MenuLayout, 1280, 800, 0, 0, ID.main.layout.MENU);
MenuLayout.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_UP) {
setFinishTimerReset();
CloseMenuLayout();
}
return true;
}
});
//3. 배경 이미지 생성 및 에니메이션 등록
MenuBackground = new WpadImageView(this, TOUCH_KIND.BUTTON, 460, 800, R.drawable.bg_menu, R.drawable.bg_menu, ID.main.image.TAB_BACKGROUND);
TranslateAnimation anim = new TranslateAnimation(WpadScale.getWidth(-460), 0, 0, 0);
anim.setDuration(200);
anim.setInterpolator(new AccelerateInterpolator());
MenuLayout.setAnimation(anim);
ViewRegistration(MenuLayout, MenuBackground, 0, 0);
//4. 타이틀 등록
MenuTitle = new WpadTextView(this, false, 247, 80, Gravity.LEFT, Color.WHITE, Common.fontsize._44, true, ID.main.text.TITLE);
ViewRegistration(MenuLayout, MenuTitle, 133, 15);
MenuTitle.setText(Title);
//5. 종료 버튼 등록
MenuClose = new WpadImageView(this, TOUCH_KIND.BUTTON, 80, 80, R.drawable.topbar_icon_close_normal, R.drawable.topbar_icon_close_pressed, ID.main.button.MENUCLOSE);
MenuClose.setTouchDelayMs(1000);
ViewRegistration(MenuLayout, MenuClose, 380, 15);
//6. 리스트뷰 초기화 및 등록
mListView = new ExpandableListView(this);
ExpandableListView.LayoutParams params = new ExpandableListView.LayoutParams(WpadScale.getWidth(460), WpadScale.getHeight(690));
mListView.setLayoutParams(params);
mListView.setX(WpadScale.getWidth(0));
mListView.setY(WpadScale.getHeight(112));
mListView.setBackgroundColor(Color.BLACK);
mListView.setId(ID.main.liveview.lv);
mListView.setGroupIndicator(null);
mListView.setDividerHeight(0);
mListView.setDivider(null);
mListView.setFocusable(true);
mListView.setSmoothScrollbarEnabled(true);
mListView.setTranscriptMode(android.widget.AbsListView.TRANSCRIPT_MODE_DISABLED);
mListView.setScrollbarFadingEnabled(true);
MenuLayout.addView(mListView);
adptMain = new Menu_AdptMain(this, menueListDataClass.arrayGroup, menueListDataClass.arrayChild, ChooseGroup, ChooseChild);
mListView.setAdapter(adptMain);
//7. 선택된 그룹 열기
mListView.setSelectedGroup(ChooseGroup);
mListView.expandGroup(ChooseGroup);
// 8. 리스트뷰 터치 이벤트 등록
mListView.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if ((event.getAction() == MotionEvent.ACTION_DOWN) ||
(event.getAction() == MotionEvent.ACTION_UP)) {
WpadActivity.setFinishTimerReset();
}
return false;
}
});
// 9. 그룹 터치 이벤트 등록
mListView.setOnGroupClickListener(new OnGroupClickListener() {
@Override
public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
DebugLogOutput("group click = " + groupPosition);
WpadActivity.setFinishTimerReset();
return false;
}
});
// 10. 차일드 터치 이벤트 등록
/*
mListView.setOnChildClickListener(new OnChildClickListener()
{
@Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id)
{
DebugLogOutput("onChildClick");
DebugLogOutput("groupPosition = " + groupPosition);
DebugLogOutput("childPosition = " + childPosition);
WpadActivity.setFinishTimerReset();
return false;
}
});
*/
// 11. 그룹 열리는 경우 이벤트
mListView.setOnGroupExpandListener(new OnGroupExpandListener() {
@Override
public void onGroupExpand(int groupPosition) {
DebugLogOutput("groupPosition Open Event = " + groupPosition);
Sound().Play(SND.effect.TOUCH_LATCHED);
WpadActivity.setFinishTimerReset();
}
});
// 12. 그룹 닫히는 경우 이벤트
mListView.setOnGroupCollapseListener(new OnGroupCollapseListener() {
@Override
public void onGroupCollapse(int groupPosition) {
DebugLogOutput("groupPosition Close Event = " + groupPosition);
Sound().Play(SND.effect.TOUCH_LATCHED);
WpadActivity.setFinishTimerReset();
}
});
// 13. MenuOpen True 설정
MenuOpen = true;
}
/**
* 메뉴 layout 닫힘 처리
**/
private void CloseMenuLayout() {
if (MenuOpen == false) {
return;
}
TranslateAnimation anim = new TranslateAnimation(0, WpadScale.getWidth(-460), 0, 0);
anim.setDuration(200);
anim.setInterpolator(new AccelerateInterpolator());
anim.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
MenuOpen = false;
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
AllLayout.removeView(MenuLayout);
TopLayout.setAlpha(1.0f);
ScreenLayout.setAlpha(1.0f);
}
});
MenuLayout.startAnimation(anim);
}
/**
* 메뉴 그룹 터치시 처리 (Menu_AdptMain에서 호출)
**/
public static void SetListViewGroupExpand_Collapse(int GroupID, boolean ExpandEnable) {
if (ExpandEnable) {
mListView.expandGroup(GroupID);
}
else {
mListView.collapseGroup(GroupID);
}
}
/**
* Menu정보가 DB에 없을 경우 불러올 스크린 로딩
*
* @return MenuListDataClass 타입의 초기정보
**/
private MenuListDataClass loadDefaultMenuList() {
try {
MenuListDataClass tempMenuListDataClass = new MenuListDataClass();
tempMenuListDataClass.SetArrayGroup(API_Menu.SubMenuCtrl.Name);
ArrayList arrayList = new ArrayList();
WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(getApplicationContext());
int nAirQualitySensorUsage = mWallpadDeviceSet.GetDeviceSetted("센서AP");
int[] nLightType = mWallpadDeviceSet.Get_Light_info();
int[] nDoorlockType = mWallpadDeviceSet.Get_DoorLock_Info();
int[] nVentilType = mWallpadDeviceSet.Get_Ventil_Info();
boolean bShadingEnable = mWallpadDeviceSet.Get_Shading_Use();
int nHeatingUsage = mWallpadDeviceSet.Get_Temper_Info();
int nGasValveUsage = mWallpadDeviceSet.Get_GAS_Info();
boolean bElecCooktopUsage = mWallpadDeviceSet.Get_ElectricRange_Use();
boolean bCooktopOutletUsage = mWallpadDeviceSet.Get_CookTopConcent_Use();
int nSystemAirconUsage = mWallpadDeviceSet.Get_AirCON_Info();
int nPurityUsage = mWallpadDeviceSet.Get_Purity_Info();
// 여기서 서브 월패드
boolean isSubWallPadUse = mWallpadDeviceSet.GetSubWpdUse();
// 서브 월패드 조명 타입 정보 가져오기
int[] naSubWallPadLightType = mWallpadDeviceSet.GetSubWpdDirect_Light();
mWallpadDeviceSet.closeDB();
WallpadStatusData mWallpadStatusData = new WallpadStatusData(getContext());
boolean bElecOutletUsage = mWallpadStatusData.Get_MultiSwitch_Concent_Use();
mWallpadStatusData.closeDB();
int nChildCnt = 0;
if(isSubWallPadUse)
{
if(naSubWallPadLightType!=null && naSubWallPadLightType.length == 2 && naSubWallPadLightType[1] == WallpadDeviceSet.SUBWPD_CTR_DIRECT )
{
if (nLightType[0] == WallpadDeviceSet.DO_USE) {
arrayList.add(API_Menu.SubMenuCtrl.Name_Lamp);
nChildCnt++;
}
}
}
else
{
//[수정필요]
//추가 또는 수정해야할 부분 1. - Menu정보가 DB에 없을 경우 불러올 스크린 종류(시작)
if (nLightType[0] == WallpadDeviceSet.DO_USE) {
arrayList.add(API_Menu.SubMenuCtrl.Name_Lamp);
nChildCnt++;
}
if (nLightType[1] == WallpadDeviceSet.LIGHT_TYPE_ROOM) {
Log.i(TAG, "bElecOutletUsage = " + bElecOutletUsage + " @@@@@@@@@@@@@@@@");
Log.i(TAG, "MultiConcentExist = " + bMultiConcentExist + " @@@@@@@@@@@@@@@@");
if ((OPERATION_MODE == Common.MODE_BUSINESS_SAMPLE) || (nLightType[0] == 1 && bElecOutletUsage && bMultiConcentExist)) {
arrayList.add(API_Menu.SubMenuCtrl.Name_Concent);
nChildCnt++;
}
}
if (nHeatingUsage == WallpadDeviceSet.DO_USE) {
arrayList.add(API_Menu.SubMenuCtrl.Name_Heating);
nChildCnt++;
}
if (nGasValveUsage == WallpadDeviceSet.DO_USE) {
arrayList.add(API_Menu.SubMenuCtrl.Name_Gas);
nChildCnt++;
}
if (bCooktopOutletUsage) {
// 쿡탑콘센트
arrayList.add(API_Menu.SubMenuCtrl.Name_CooktopConcent);
nChildCnt++;
Log.i(TAG, "cooktopConcentUse = " + bCooktopOutletUsage + " @@@@@@@@@@@@@@@@");
Log.i(TAG, "Name_CooktopConcent Added ~~~ " + " @@@@@@@@@@@@@@@@");
}
if (bElecCooktopUsage) {
arrayList.add(API_Menu.SubMenuCtrl.Name_ElectricRange);
nChildCnt++;
}
if (nDoorlockType[0] == WallpadDeviceSet.DO_USE) {
arrayList.add(API_Menu.SubMenuCtrl.Name_DoorLock);
nChildCnt++;
}
if (nVentilType[0] == WallpadDeviceSet.DO_USE) {
arrayList.add(API_Menu.SubMenuCtrl.Name_Venti);
nChildCnt++;
}
if (bShadingEnable) {
//전동커튼
arrayList.add(API_Menu.SubMenuCtrl.Name_Curtain);
nChildCnt++;
}
if (nSystemAirconUsage != WallpadDeviceSet.SYSTEMAIRCON_NONE) {
arrayList.add(API_Menu.SubMenuCtrl.Name_SystemAircon);
nChildCnt++;
}
if (Version.getModelType() == Version.MODEL_TYPE.IHN_D101 || Version.getModelType() == Version.MODEL_TYPE.IHN_D101_I
|| 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 (!bKitchenLightonLivingEM &&(nDistributionPanelType != Version.DISTRIBUTION_MODEL.KNX_DIST)) {
// knx분전반은 거실조명 그룹설정 메뉴에서 빠짐
arrayList.add(API_Menu.SubMenuCtrl.Name_LivingLightConfig);
nChildCnt++;
}
if (nDistributionPanelType == Version.DISTRIBUTION_MODEL.KNX_DIST) {
arrayList.add(API_Menu.SubMenuCtrl.Name_Concent);
nChildCnt++;
}
if (nPurityUsage == WallpadDeviceSet.DO_USE) {
arrayList.add(API_Menu.SubMenuCtrl.Name_Purity);
nChildCnt++;
}
}
if (nAirQualitySensorUsage == WallpadDeviceSet.DEV_DATA_ENABLE) {
arrayList.add(API_Menu.SubMenuCtrl.Name_InnerAirQuality);
nChildCnt++;
arrayList.add(API_Menu.SubMenuCtrl.Name_InnerAirInfo);
nChildCnt++;
}
}
//추가 또는 수정해야할 부분 1. - Menu정보가 DB에 없을 경우 불러올 스크린 종류(끝)
Log.i(TAG, "childCount = " + nChildCnt);
tempMenuListDataClass.SetArrayChild(API_Menu.SubMenuCtrl.Name, arrayList);
tempMenuListDataClass.idMappingTable = new ChildIDMapping[nChildCnt];
for (int i = 0; i < nChildCnt; i++) {
tempMenuListDataClass.idMappingTable[i] = new ChildIDMapping();
//[수정필요]
//추가 또는 수정해야할 부분 2. - 불러올 스크린의 ID를 임의로 입력(시작)
if (arrayList.get(i).equals(API_Menu.SubMenuCtrl.Name_Lamp)) {
if (Version.getGatewayUsage()) {
if (Version.getModelType() == Version.MODEL_TYPE.IHN_1010GL || Version.getModelType() == Version.MODEL_TYPE.IHN_1010GL_I
|| Version.getModelType() == Version.MODEL_TYPE.IHN_1010GL_I_2443|| Version.getModelType() == Version.MODEL_TYPE.IHN_1010GL_I_6410) {
//여기서 분리
//기본형
if(naLightEnable[1] == WallpadDeviceSet.LIGHT_TYPE_HDC_INTLIGHT_ADD_BATCHLIGHT_MULTISWITCH)
{
//기본형 + 에너지미터
tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.HDCLivingNEnergyMeter_Lamp;
}
else
{
//기본형
tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.HDCLivingNEach_Lamp;
}
tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_Lamp;
}
else {
if (nDistributionPanelType == Version.DISTRIBUTION_MODEL.SMART_DIST) {
// 스마트 분전반
tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.HDC_LivingLamp;
tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_Lamp;
}
else if (nDistributionPanelType == Version.DISTRIBUTION_MODEL.KNX_DIST) {
// KNX 분전반
tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.HDC_LivingLamp;
tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_Lamp;
}
else {
tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.HDC_LivingLamp;
tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_Lamp;
}
}
}
else {
if (nLightType[1] == WallpadDeviceSet.LIGHT_TYPE_LIVING) {
tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.OutSide_livingLamp;
tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_Lamp;
}
else if (nLightType[1] == WallpadDeviceSet.LIGHT_TYPE_ROOM) {
tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.OutSide_EachLamp;
tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_Lamp;
}
}
}
else if (arrayList.get(i).equals(API_Menu.SubMenuCtrl.Name_Concent)) {
if (nLightType[1] == WallpadDeviceSet.LIGHT_TYPE_ROOM) {
if ((OPERATION_MODE == Common.MODE_BUSINESS_SAMPLE) || (bElecOutletUsage && bMultiConcentExist)) {
tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.Concent;
tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_Concent;
}
}
else if (nDistributionPanelType == Version.DISTRIBUTION_MODEL.KNX_DIST) {
tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.Concent;
tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_Concent;
}
}
else if (arrayList.get(i).equals(API_Menu.SubMenuCtrl.Name_Gas)) {
tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.Gas;
tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_Gas;
}
else if (arrayList.get(i).equals(API_Menu.SubMenuCtrl.Name_CooktopConcent)) {
tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.Cooktop_Concent;
tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_CooktopConcent;
}
else if (arrayList.get(i).equals(API_Menu.SubMenuCtrl.Name_DoorLock)) {
if (nDoorlockType[1] == DOORLOCK_TYPE_NORMAL) {
tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.DoorLock485;
tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_DoorLock;
}
else if (nDoorlockType[1] == DOORLOCK_TYPE_RF) {
tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.DoorLockWL;
tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_DoorLock;
}
else if (nDoorlockType[1] == DOORLOCK_TYPE_FINGERPRINT) {
tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.DoorLockWL;
tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_DoorLock;
}
}
else if (arrayList.get(i).equals(API_Menu.SubMenuCtrl.Name_Venti)) {
Log.d(TAG, "[loadDefaultMenuList] nVentilType[1] = " + nVentilType[1]);
if (nVentilType[1] == WallpadDeviceSet.VENTIL_TYPE_NORMAL) {
tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.ChangAir_Normal;
tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_Venti;
}
else if (nVentilType[1] == WallpadDeviceSet.VENTIL_TYPE_LH) {
tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.ChangAir_LH;
tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_Venti;
}
else if (nVentilType[1] == WallpadDeviceSet.VENTIL_TYPE_HOOD) {
tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.ChangAir_Hood;
tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_Venti;
}
}
else if (arrayList.get(i).equals(API_Menu.SubMenuCtrl.Name_Heating)) {
tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.Heating_V2;
tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_Heating;
}
/*
//확인 필요
else if (arrayList.get(i).equals(API_Menu.SubMenuCtrl.Name_Heating)) {
tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.Heating_V1;
tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_Heating;
}
*/
else if (arrayList.get(i).equals(API_Menu.SubMenuCtrl.Name_Curtain)) {
tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.Curtain;
tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_Curtain;
}
else if (arrayList.get(i).equals(API_Menu.SubMenuCtrl.Name_InnerAirQuality)) {
tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.Inner_AirQuality;
tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_InnerAirQuality;
}
else if (arrayList.get(i).equals(API_Menu.SubMenuCtrl.Name_InnerAirInfo)) {
tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.Inner_AirInfo;
tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_InnerAirInfo;
}
else if (arrayList.get(i).equals(API_Menu.SubMenuCtrl.Name_ElectricRange)) {
tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.Electric_Range;
tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_ElectricRange;
}
else if (arrayList.get(i).equals(API_Menu.SubMenuCtrl.Name_SystemAircon)) {
tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.SystemAircon;
tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_SystemAircon;
}
else if (arrayList.get(i).equals(API_Menu.SubMenuCtrl.Name_LivingLightConfig)) {
tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.LivingLightConfig;
tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_LivingLightConfig;
}
else {
Log.w(TAG, "[loadDefaultMenuList] arrayList.get(" + i + ") is not supported menu!!");
}
//추가 또는 수정해야할 부분 2. - 불러올 스크린의 ID를 임의로 입력(끝)
}
return tempMenuListDataClass;
} catch (RuntimeException re) {
LogUtil.errorLogInfo("", TAG, re);
return null;
}
catch (Exception e) {
Log.e(TAG, "[Exception] loadDefaultMenuList()");
//e.printStackTrace();
LogUtil.errorLogInfo("", TAG, e);
return null;
}
}
/**
* Menu Event intent filter 등록
**/
private void reg_Receiver() {
try {
IntentFilter filter = new IntentFilter();
filter.addAction("MENU_EVENT");
registerReceiver(mWallPadAlertBR, filter);
filter = new IntentFilter();
filter.addAction(define.NOTIFY_DAIL);
filter.addAction("WALLPAD_DIAL_GLOBALSCREEN_TOUCH");
registerReceiver(mWallPadJogBR, filter);
filter = new IntentFilter();
filter.addAction(ID.main.BR_KCC_DIM);
registerReceiver(mKccDimmBR, filter);
} catch (RuntimeException re) {
LogUtil.errorLogInfo("", TAG, re);
}
catch (Exception e) {
Log.e(TAG, "[Exception] reg_Receiver()");
//e.printStackTrace();
LogUtil.errorLogInfo("", TAG, e);
}
}
/**
* 조그버튼 입력 받을 시 처리
**/
BroadcastReceiver mWallPadJogBR = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
WpadActivity.setFinishTimerReset();
}
};
/**
* KCC디밍조절기 BR 등록
**/
BroadcastReceiver mKccDimmBR = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
WpadActivity.setFinishTimerReset();
DebugLogOutput("[mKccDimmBR] - onReceive - mKccDimmBR");
Device_Update_Dimming(false, (byte)0);
Draw_Update_DimmBtn();
}
};
/**
* 메뉴에서 버튼 터치 처리
**/
BroadcastReceiver mWallPadAlertBR = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
int groupPosition = intent.getIntExtra("groupPosition", -1);
int childPosition = intent.getIntExtra("childPosition", -1);
Log.i(TAG, "[mWallPadAlertBR] groupPosition :" + groupPosition + ", childPosition :" + childPosition);
if ((groupPosition >= 0) && (childPosition >= 0)) {
if (MenuOpen == true) {
Sound().Play(SND.effect.TOUCH_LATCHED);
CloseMenuLayout();
if (menueListDataClass == null) {
return;
}
String childName = menueListDataClass.arrayChild.get(menueListDataClass.arrayGroup.get(groupPosition)).get(childPosition);
for (int i = 0; i < menueListDataClass.idMappingTable.length; i++) {
if (menueListDataClass.idMappingTable[i].Name.equals(childName)) {
API_Menu api_Menu = new API_Menu();
int TempID = api_Menu.GetMyGroupID(getApplicationContext().getPackageName());
int ChildID = menueListDataClass.idMappingTable[i].Id;
int ChildGroupID = (ChildID / 1000) * 1000;
Log.i(TAG, "[mWallPadAlertBR] Child ID :" + ChildID);
if (TempID == 0) {
return;
}
if (ChildGroupID == TempID) {
//해당 APP내에서 스크린 전환 필요
//[수정필요]
if (OPERATION_MODE == Common.MODE_NOMAL) {
mTempCurrentScreenId = ChildID;
mWallPadApiCheckHandler.sendEmptyMessage(0);
}
else {
boolean result = setChangeScreen(ChildID, false);
if (result == false) {
setChangeScreen(API_Menu.SubMenuCtrl.HDC_LivingLamp, false);
}
}
WpadActivity.setFinishTimerReset();
}
else {
//외부 앱 호출 후, 본 APP Finish 필요
api_Menu.startSubScreenActivity(getApplicationContext(), menueListDataClass.idMappingTable[i].Id, API_Menu.MENU_START_OPTION_1, api_Menu.GetAPK_Name_ByID(ChildGroupID));
Intent mIntent = new Intent();
mIntent.putExtra("Finish_Kind", "HomeButton");
MainActivity.this.setResult(RESULT_OK, mIntent);
finish();
}
break;
}
}
}
}
}
};
/**
* 디바이스 서비스 APP 을 체크하여 실행되어있지 않을시 실행시킨다.
*/
private void StartDevService() {
try {
ActivityManager am = (ActivityManager) getApplicationContext().getSystemService(Context.ACTIVITY_SERVICE);
List appList = am.getRunningAppProcesses();
boolean DevServiceExist = false;
for (int i = 0; i < appList.size(); i++) {
ActivityManager.RunningAppProcessInfo rapi = appList.get(i);
Log.i(TAG, "App List i = " + i + " / name = " + rapi.getClass().getName());
if (rapi.processName.equals("com.artncore.deviceservice")) {
Log.d(TAG, "Filter 1 : Service already running");
DevServiceExist = true;
break;
}
}
ActivityManager am2 = (ActivityManager)getApplicationContext().getSystemService(Context.ACTIVITY_SERVICE);
List rs = am2.getRunningServices(1000);
for (int i = 0; i < rs.size(); i++) {
ActivityManager.RunningServiceInfo rsi = rs.get(i);
//Log.d("run service","Package Name " + i + " = " + rsi.service.getPackageName());
//Log.d("run service","Class Name : " + i + " = " + rsi.service.getClassName());
if (rsi.service.getPackageName().equals("com.artncore.deviceservice")) {
Log.d(TAG, "Filter 2 : Service already running");
DevServiceExist = true;
break;
}
}
if (!DevServiceExist) {
Log.d(TAG, "Call Service Start");
Intent intent = new Intent("wallpaddevservice.ServiceMain");
startService(intent);
try {
Thread.sleep(3000);
} catch (RuntimeException re) {
LogUtil.errorLogInfo("", TAG, re);
}
catch (Exception e) {
Log.e(TAG, "[Exception] StartDevService().sleep(...)");
}
}
} catch (RuntimeException re) {
LogUtil.errorLogInfo("", TAG, re);
}
catch (Exception e) {
Log.w(TAG, "[Exception] StartDevService()");
//e.printStackTrace();
LogUtil.errorLogInfo("", TAG, e);
}
}
/**
* DB 에서 룸이름 정보를 가져온다.
*
* @return (String []) null - 실패, not null
*/
private String[] getRoomNameFromDB() {
try {
WallpadStatusData wallpadStatusData = new WallpadStatusData(getContext().getApplicationContext());
String[] RoomNameList = wallpadStatusData.GetDevRoomName();
wallpadStatusData.closeDB();
if (RoomNameList == null) {
Log.e(TAG, "[getRoomNameFromDB] - RoomNameList is null !!!");
return null;
}
if (RoomNameList.length != 6) {
Log.e(TAG, "[getRoomNameFromDB.length Not Match (" + RoomNameList.length + ")");
return null;
}
if (DEBUG_LOG_ON) {
for (int i = 0; i < RoomNameList.length; i++)
DebugLogOutput("[getRoomNameFromDB] RoomNameList[" + i + "] " + RoomNameList[i]);
}
return RoomNameList;
} catch (RuntimeException re) {
LogUtil.errorLogInfo("", TAG, re);
}
catch (Exception e) {
Log.e(TAG, "[Exception] getRoomNameFromDB()");
//e.printStackTrace();
LogUtil.errorLogInfo("", TAG, e);
}
return null;
}
/**
* DB 에서 룸이름 정보를 가져온다. 난방, 조명 개발 명칭 가져오기
*
* @param Device - int
* @return (String []) null - 실패, not null
*/
private String[] getRoomNameFromDB(int Device) {
try {
String[] RoomNameList = null;
WallpadStatusData wallpadStatusData = new WallpadStatusData(getContext().getApplicationContext());
if (Device == HEATING) {
RoomNameList = wallpadStatusData.GetDevRoomName("heating");
}
else {
RoomNameList = wallpadStatusData.GetDevRoomName("light");
}
wallpadStatusData.closeDB();
if (RoomNameList == null) {
Log.e(TAG, "[DB_GetRoomName] - RoomNameList is null !!!");
return null;
}
if (RoomNameList.length != 6) {
Log.e(TAG, "[DB_GetRoomName] - RoomNameList.length Not Match (" + RoomNameList.length + ")");
return null;
}
if (DEBUG_LOG_ON) {
for (int i = 0; i < RoomNameList.length; i++)
DebugLogOutput("RoomNameList[" + i + "] " + RoomNameList[i]);
}
return RoomNameList;
} catch (RuntimeException re) {
LogUtil.errorLogInfo("", TAG, re);
}
catch (Exception e) {
Log.e(TAG, "[Exception] DB_GetRoomName(int Device)");
//e.printStackTrace();
LogUtil.errorLogInfo("", TAG, e);
}
return null;
}
/**
* DB에서 방 이름을 가져와서 방 명칭 관련 변수에 값을 넣는다.
**/
private void GetRoomName() {
try {
WallpadDeviceSet wallpadDeviceSet = new WallpadDeviceSet(getContext().getApplicationContext());
boolean UseEachRoomName = wallpadDeviceSet.GetEachRoomNameInfo();
wallpadDeviceSet.closeDB();
Log.e(TAG, "[GetRoomName] UseEachRoomName = " + UseEachRoomName);
if (UseEachRoomName == false) {
// 명칭 통합사용
if (nConstructionFunction == WallpadDeviceSet.CONSTRUCTION_SPECIAL_FUNCTION_SK) {
// SK건설
mRoomNameList_Light = mDefaultRoomNameList_Light_SK;
mRoomNameList_Heating = mDefaultRoomNameList_Heating_SK;
}
else {
mRoomNameList_Light = getRoomNameFromDB();
if (mRoomNameList_Light == null) {
mRoomNameList_Light = mDefaultRoomNameList;
}
if (GetEasyModeUXUse()) {
mRoomNameList_Heating = mDefaultRoomNameList_Heating_easymode;
}
else {
mRoomNameList_Heating = getRoomNameFromDB();
if (mRoomNameList_Heating == null) {
mRoomNameList_Heating = mDefaultRoomNameList;
}
}
}
}
else {
// 명칭 난방, 조명 분리 사용
mRoomNameList_Light = getRoomNameFromDB(LIGHT);
if (mRoomNameList_Light == null) {
mRoomNameList_Light = mDefaultRoomNameList_Light;
}
if (GetEasyModeUXUse()) {
mRoomNameList_Heating = mDefaultRoomNameList_Heating_easymode;
}
else {
mRoomNameList_Heating = getRoomNameFromDB(HEATING);
if (mRoomNameList_Heating == null) {
mRoomNameList_Heating = mDefaultRoomNameList_Heating;
}
}
}
} catch (RuntimeException re) {
LogUtil.errorLogInfo("", TAG, re);
}
catch (Exception e) {
Log.e(TAG, "[Exception] GetRoomName()");
//e.printStackTrace();
LogUtil.errorLogInfo("", TAG, e);
}
}
/**
* TOP 에 보일러 아이콘 활성화 & 비활성화
*
* @param Enabled - true : 활성화, false : 비활성화
* @return (boolean) true : 성공, false : 실패
*/
public boolean setTopBoilerBtnVisible(boolean Enabled) {
try {
if (Enabled == true) {
Log.i(TAG, "[setTopBoilerBtnVisible] ENTER 0");
if (TopBoilerBtn.getVisibility() != View.VISIBLE) {
Log.i(TAG, "[setTopBoilerBtnVisible] ENTER 1");
if (TopBackBtn.getVisibility() == View.VISIBLE) {
// 1019
Log.i(TAG, "[setTopBoilerBtnVisible] ENTER 2");
WpadUtil.ViewMove(TopBoilerBtn, 893, 0);
WpadUtil.ViewMove(TopManualBtn, 767, 0);
}
else {
Log.i(TAG, "[setTopBoilerBtnVisible] ENTER 3-1");
WpadUtil.ViewMove(TopBoilerBtn, 1019, 0);
//WpadUtil.ViewMove(TopManualBtn, 893, 0);
}
if(TopBoilerBtn!=null) TopBoilerBtn.setVisibility(View.VISIBLE);
if(TopBoilerBtn!=null) TopBoilerBtn.bringToFront();
if (TopBoilerBtn!=null && TopBoilerBtn.getVisibility() == View.VISIBLE) {
Log.i(TAG, "[setTopBoilerBtnVisible] ENTER 3-2");
WpadUtil.ViewMove(TopManualBtn, 893, 0);
//TopManualBtn.bringToFront();
}
}
}
else {
Log.i(TAG, "[setTopBoilerBtnVisible] ENTER 4");
if (TopBoilerBtn.getVisibility() != View.INVISIBLE) {
Log.i(TAG, "[setTopBoilerBtnVisible] ENTER 5");
TopBoilerBtn.setVisibility(View.INVISIBLE);
if (TopBackBtn.getVisibility() == View.VISIBLE) {
Log.i(TAG, "[setTopBoilerBtnVisible] ENTER 6");
WpadUtil.ViewMove(TopManualBtn, 893, 0);
}
else {
Log.i(TAG, "[setTopBoilerBtnVisible] ENTER 7");
WpadUtil.ViewMove(TopManualBtn, 1019, 0);
}
}
}
} catch (RuntimeException re) {
LogUtil.errorLogInfo("", TAG, re);
return false;
}
catch (Exception ex) {
Log.e(TAG, "[Exception] setTopBoilerBtnVisible(boolean Enabled)");
//ex.printStackTrace();
LogUtil.errorLogInfo("", TAG, ex);
return false;
}
return true;
}
/**
* 실내공기질 돌아가기 버튼 활성화 & 비활성화
*
* @param Enabled - true : 활성화, false : 비활성화
* @return (boolean) true : 성공, false : 실패
*/
public boolean setAIRBackBtnVisible(boolean Enabled) {
if (Enabled == true) {
if (TopAirBackBtn.getVisibility() != View.VISIBLE) TopAirBackBtn.setVisibility(View.VISIBLE);
TopAirBackBtn.bringToFront();
if (TopAirBackBtn.getVisibility() == View.VISIBLE) {
WpadUtil.ViewMove(TopManualBtn, 893, 0);
}
if(TopManualBtn!=null) TopManualBtn.setVisibility(View.INVISIBLE);
}
else {
if (TopAirBackBtn.getVisibility() != View.INVISIBLE) TopAirBackBtn.setVisibility(View.INVISIBLE);
if (TopAirBackBtn.getVisibility() == View.INVISIBLE) {
WpadUtil.ViewMove(TopManualBtn, 1019, 0);
}
}
return true;
}
/**
* 환기제어 돌아가기 버튼 활성화 & 비활성화
*
* @param Enabled - true : 활성화, false : 비활성화
* @return (boolean) true : 성공, false : 실패
*/
public boolean setVentilBackBtnVisible(boolean Enabled) {
if (Enabled == true) {
if (BTN_TOP_BACK_VENTIL.getVisibility() != View.VISIBLE) BTN_TOP_BACK_VENTIL.setVisibility(View.VISIBLE);
BTN_TOP_BACK_VENTIL.bringToFront();
if (BTN_TOP_BACK_VENTIL.getVisibility() == View.VISIBLE) {
WpadUtil.ViewMove(TopManualBtn, 893, 0);
}
if(TopManualBtn!=null) TopManualBtn.setVisibility(View.INVISIBLE);
}
else {
if (BTN_TOP_BACK_VENTIL.getVisibility() != View.INVISIBLE) BTN_TOP_BACK_VENTIL.setVisibility(View.INVISIBLE);
if (BTN_TOP_BACK_VENTIL.getVisibility() == View.INVISIBLE) {
WpadUtil.ViewMove(TopManualBtn, 1019, 0);
}
}
return true;
}
/**
* 상단 KCC디밍조절 버튼 활성화 & 비활성화
*
* @param Enabled - true : 활성화, false : 비활성화
* @return (boolean) true : 성공, false : 실패
*/
public void setKccDimmBtnVisible(boolean Enabled) {
WallpadDeviceSet wdst = new WallpadDeviceSet(getContext());
int dimmUse = wdst.GetDeviceSetted("KCC디밍제어기"); // 1: 사용안함 / 2: 사용함
wdst.closeDB();
Log.i(TAG, "[setKccDimmBtnVisible] - KCC Dimm : " + dimmUse);
// null, 사용안함 이면 안나오도록 한다.
if (dimmUse == 0 || dimmUse == 1) {
Log.w(TAG, "[setKccDimmBtnVisible] - KCC Dimm NOT USE !!!");
Enabled = false;
KccDimUse = 0;
}
else {
KccDimUse = 1;
}
for (int i = 0; i < TopDimmingBtn.length; i++) {
if (Enabled == true) {
if (TopDimmingBtn[i].getVisibility() != View.VISIBLE)
TopDimmingBtn[i].setVisibility(View.VISIBLE);
TopDimmingBtn[i].bringToFront();
}
else {
if (TopDimmingBtn[i].getVisibility() != View.INVISIBLE)
TopDimmingBtn[i].setVisibility(View.INVISIBLE);
}
}
}
/**
* 조명제어기의 디밍 레벨을 조절한다.
*
* @param Level - 디밍레벨
* @return (int) - >=0 : 성공, <0 : 실패
*/
private int Device_SetDimmingLevel(byte Level) {
DebugLogOutput("[Device_SetAllDimmingLevel] - Start (Level : " + Level + ")");
// 1. Api Load Check
if (ledDimmingAPI == null) {
Log.e(TAG, "[Device_SetAllDimmingLevel] ledDimmingAPI unload !!!");
return -1;
}
// 2. Param Range Check
if (mDimData.DimData.DeviceCnt == 0) {
Log.w(TAG, "[Device_SetAllDimmingLevel] mData.DeviceCnt == 0");
return -2;
}
// 3. Light Control
try {
int ret = ledDimmingAPI.SetDimmingLevel(0, Level);
if (ret < 0) {
Log.e(TAG, "[Device_SetAllDimmingLevel] SetAllDimmingLevel Error (" + ret + ") ErrorCode = " + ledDimmingAPI.ErrorCode.ErrStr());
return -6;
}
} catch (RuntimeException re) {
LogUtil.errorLogInfo("", TAG, re);
return -100;
}
catch (Exception e) {
Log.e(TAG, "[Device_SetAllDimmingLevel] - [Exception Error] ledDimmingAPI.SetAllDimmingLevel()");
//e.printStackTrace();
LogUtil.errorLogInfo("", TAG, e);
return -100;
}
DebugLogOutput("[Device_SetAllDimmingLevel] - OK");
return 0;
}
private void Draw_Update_DimmBtn() {
// 디밍 표시
Log.i(TAG, "[Draw_Update_DimmBtn] - Dimming Draw Start");
if (mDimData.DimData == null) {
Log.w(TAG, "[Draw_Update_DimmBtn] - mDimData.DimData null");
return;
}
else {
Log.i(TAG, "[Draw_Update_DimmBtn] - mDimData.DimData normal");
}
byte Level = mDimData.DimData.Device[0].device.Level;
Log.i(TAG, "[Draw_Update_DimmBtn] - Level =" + Level);
for (int i = 0; i < 4; i++) {
if (Level == mLevelArray[i]) {
Log.i(TAG, "[Draw_Update_DimmBtn] - Same Level Button i = " + i);
TopDimmingBtn[i].setButtonRearImage();
}
else {
Log.i(TAG, "[Draw_Update_DimmBtn] - Diff Level Button i = " + i);
TopDimmingBtn[i].setButtonFrontImage();
}
}
Log.i(TAG, "[Draw_Update_DimmBtn] - Dimming Draw End");
}
/**
* KCC 디밍제어기의 상태를 갱신한다.
*
* @param real - (boolean) true : 실시간 , false : 가장최근
* @param index - (byte) 방 인덱스 (0~5개별방, Common.INDEX_ALL 전체)
* @return (int) - >=0 : 성공, <0 : 실패
*/
private int Device_Update_Dimming(boolean real, byte index) {
DebugLogOutput("[Device_Update_Dimming] - Start (real : " + real + ", index:" + index + ")");
// 1. Api Load Check
if (ledDimmingAPI == null) {
Log.e(TAG, "[Device_Update_Dimming] ledDimmingAPI unload !!!");
return -1;
}
// 2. refresh
try {
int ret = ledDimmingAPI.Refresh(index, real);
if (ret < 0) {
Log.e(TAG, "[Device_Update_Dimming] Refresh(" + index + ", " + real + ") ret = " + ret + " / ErrorCode = " + ledDimmingAPI.ErrorCode.ErrStr());
return -2;
}
} catch (RuntimeException re) {
LogUtil.errorLogInfo("", TAG, re);
return -100;
}
catch (Exception e) {
Log.e(TAG, "[Device_Update_Dimming] - [Exception Error] ledDimmingAPI.Refresh(index:" + index + ", real:" + real + ")");
//e.printStackTrace();
LogUtil.errorLogInfo("", TAG, e);
return -100;
}
// 3. Range Check
if (ledDimmingAPI.data.DeviceCnt <= 0) {
Log.e(TAG, "[Device_Update_Dimming] - DeviceCnt Out of range !!! (DeviceCnt:" + ledDimmingAPI.data.DeviceCnt + ")");
return -10;
}
// 4. Data Copy
mDimData.DimData = ledDimmingAPI.data;
// 5. Debug Msg
DebugLogOutput("---------------------------------------");
DebugLogOutput("[Device_Update_Dimming]");
DebugLogOutput("---------------------------------------");
DebugLogOutput("DeviceCnt = " + ledDimmingAPI.data.DeviceCnt);
byte DeviceCnt = ledDimmingAPI.data.DeviceCnt;
if (index == define.DEVICE_ALL_OR_NOTHING) {
for (byte i = 0; i < DeviceCnt; i++) {
DebugLogOutput(ledDimmingAPI.data.Device[i].info.ToDebugString(i));
DebugLogOutput(ledDimmingAPI.data.Device[i].device.ToDebugString(i));
}
}
else {
DebugLogOutput(ledDimmingAPI.data.Device[index].device.ToDebugString(index));
}
DebugLogOutput("---------------------------------------");
DebugLogOutput("[Device_Update_Dimming] - OK");
return 0;
}
/**
* 현관호출 or 전화호출시 사용되는 keycode - Broadcast 을 송신한다.
*
* @param code - (int) 송신할 keycode
* @return (int) - >=0 : 성공, <0 : 실패
*/
private int setSendEventBR(int code) {
try {
KeyEvent event = new KeyEvent(KeyEvent.ACTION_UP, code);
Intent intent = new Intent("EVENT_DEVICE_CONTROL", null);
intent.putExtra(Intent.EXTRA_KEY_EVENT, event);
intent.putExtra("keycode",code);
getContext().sendBroadcast(intent);
} catch (RuntimeException re) {
LogUtil.errorLogInfo("", TAG, re);
return -100;
}
catch (Exception e) {
Log.e(TAG, "[setSendEventBR] - [Exception Error] code:" + code);
//e.printStackTrace();
LogUtil.errorLogInfo("", TAG, e);
return -100;
}
return 0;
}
/**
* 히든메뉴의 버튼 타임아웃을 설정한다.
*/
private void HideMenu_setTimeOut() {
if (mHideMenuTimer != null) mHideMenuTimer.cancel();
mHideMenuTimer = new CountDownTimer( 1 * 1000, 1000) {
@Override
public void onFinish() {
Log.d(TAG, "mHideMenuTimer - onFinish !!!");
mHideMenuEntryStatus = 0;
}
@Override
public void onTick(long millisUntilFinished) {
}
};
mHideMenuTimer.cancel();
mHideMenuTimer.start();
}
/**
* 히든메뉴 진입용 프로세스
*
* @param TargetId - 히든메뉴용 버튼 ID
*/
private void HideMenuEntryProc(int TargetId) {
if (OPERATION_MODE != Common.MODE_NOMAL) return;
if (mHideMenuOn) return;
if (TargetId == ID.main.button.HIDE1) {
if (mHideMenuEntryStatus == 0) { mHideMenuEntryStatus = 1; HideMenu_setTimeOut(); }
else if (mHideMenuEntryStatus == 2) { mHideMenuEntryStatus = 3; HideMenu_setTimeOut(); }
else if (mHideMenuEntryStatus == 4) { mHideMenuEntryStatus = 5; HideMenu_setTimeOut(); }
}
else if (TargetId == ID.main.button.HIDE2) {
if (mHideMenuEntryStatus == 1) { mHideMenuEntryStatus = 2; HideMenu_setTimeOut(); }
else if (mHideMenuEntryStatus == 3) { mHideMenuEntryStatus = 4; HideMenu_setTimeOut(); }
else if (mHideMenuEntryStatus == 5) {
mHideMenuEntryStatus = 6;
mHideMenuOn = true;
if (mHideMenuTimer != null) {
mHideMenuTimer.cancel();
mHideMenuTimer = null;
TopBackground.setImageResource(0);
TopBackground.setBackgroundColor(Color.RED);
Sound().Play(SND.call.CALLSTART);
super.setFinishTimerDestroy();
Log.i(TAG, "================================");
Log.i(TAG, "[HideMenu] START !!!!!");
Log.i(TAG, "================================");
}
}
}
}
public boolean GetEasyModeUXUse() {
try {
WallpadDeviceSet deviceSet = new WallpadDeviceSet(mContext);
boolean bSupport = deviceSet.Get_EasyModeUX_Support();
deviceSet.closeDB();
WallpadStatusData data = new WallpadStatusData(mContext);
boolean bUse = data.GetEasyModeUxUse();
data.closeDB();
Log.d(TAG, "[GetEasyModeUXUse] bSupport [" + bSupport + "], bUse [" + bUse + "]");
return bSupport & bUse;
} catch (RuntimeException re) {
LogUtil.errorLogInfo("", TAG, re);
}
catch (Exception e) {
Log.e(TAG, "[Exception] GetEasyModeUXUse()");
//e.printStackTrace();
LogUtil.errorLogInfo("", TAG, e);
}
return false;
}
public boolean getAirSensorAPUsage() {
try {
boolean bUsage = false;
WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(getApplicationContext());
int nAirQualityEnable = mWallpadDeviceSet.GetDeviceSetted("센서AP");
mWallpadDeviceSet.closeDB();
if(nAirQualityEnable == WallpadDeviceSet.DEV_DATA_ENABLE) bUsage = true;
Log.d(TAG, "[getAirSensorAPUsage] bUsage [" + bUsage + "]");
return bUsage;
} catch (RuntimeException re) {
LogUtil.errorLogInfo("", TAG, re);
}
catch (Exception e) {
Log.e(TAG, "[Exception] getAirSensorAPUsage()");
//e.printStackTrace();
LogUtil.errorLogInfo("", TAG, e);
}
return false;
}
/**
* 제어기 상태를 가져온다.
*
* @param bReal - (boolean) true : 실시간 , false : 가장최근
* @return (int) - >=0 : 성공, <0 : 실패
*/
private int updateVentilatorData(boolean bReal) {
Log.i(TAG, "[updateVentilatorData] - Start (bReal : " + bReal + ")");
// 1. Api Load Check
if (mVentilAPI == null) {
Log.e(TAG, "[updateVentilatorData] - mVentilAPI unload !!!");
return -1;
}
// 2. reflash
try {
int ret = mVentilAPI.Refresh(bReal);
if (ret < 0) {
Log.e(TAG, "[updateVentilatorData] Refresh - ret (" + ret + ") ErrorCode = " + mVentilAPI.ErrorCode.ErrStr());
return -2;
}
} catch (RuntimeException re) {
LogUtil.errorLogInfo("", TAG, re);
return -100;
}
catch (Exception e) {
Log.e(TAG, "[updateVentilatorData] - [Exception Error] mVentilAPI.Refresh(" + bReal + ")");
//e.printStackTrace();
LogUtil.errorLogInfo("", TAG, e);
return -100;
}
// 3. Data Copy
VentilStatus = mVentilAPI.data;
// 4. Debug Msg
Log.i(TAG, VentilStatus.ToDebugString());
Log.i(TAG, VentilStatus.ToFaultString());
Log.i(TAG, "[updateVentilatorData] - OK");
return 0;
}
/**
* Knx 환기 제어기 상태를 가져온다.
*
* @param bReal - (boolean) true : 실시간 , false : 가장최근
* @return (int) - >=0 : 성공, <0 : 실패
*/
private int updateKnxVentilatorData(boolean bReal) {
Log.i(TAG, "[updateKnxVentilatorData] - Start (bReal : " + bReal + ")");
// 1. Api Load Check
if (mKnxVentilAPI == null) {
Log.e(TAG, "[updateKnxVentilatorData] - mVentilAPI unload !!!");
return -1;
}
// 2. reflash
try {
int ret = mKnxVentilAPI.Refresh(Common.INDEX_ALL, bReal);
if (ret < 0) {
Log.e(TAG, "[updateKnxVentilatorData] Refresh - ret (" + ret + ") ErrorCode = " + mKnxVentilAPI.ErrorCode.ErrStr());
return -2;
}
} catch (RuntimeException re) {
LogUtil.errorLogInfo("", TAG, re);
return -100;
}
catch (Exception e) {
Log.e(TAG, "[updateKnxVentilatorData] - [Exception Error] mKnxVentilAPI.Refresh(" + bReal + ")");
//e.printStackTrace();
LogUtil.errorLogInfo("", TAG, e);
return -100;
}
// 3. Data Copy
VentilStatus = mKnxVentilAPI.data.Device[0];
// 4. Debug Msg
Log.i(TAG, VentilStatus.ToDebugString());
Log.i(TAG, VentilStatus.ToFaultString());
Log.i(TAG, "[updateVentilatorData] - OK");
return 0;
}
public static int nConstructionFunction = WallpadDeviceSet.CONSTRUCTION_SPECIAL_FUNCTION_NONE;
private void getConstructionFunction() {
try {
WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(getApplicationContext());
nConstructionFunction = mWallpadDeviceSet.Get_Construction_SpecialFunc();
mWallpadDeviceSet.closeDB();
} catch (Exception e) {
Log.e(TAG, "[Exception] getConstructionFunction()");
e.printStackTrace();
}
}
}