1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891 |
- package kr.co.icontrols.wallpadenergyctrl;
- import java.util.ArrayList;
- 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.define;
- import com.artncore.wallpadapi.WallPadAPI;
- import android.annotation.SuppressLint;
- 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.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.WindowManager;
- 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.Button;
- import android.widget.RelativeLayout;
- import kr.co.icontrols.wallpadenergyctrl.declare.Common;
- import kr.co.icontrols.wallpadenergyctrl.declare.ID;
- import kr.co.icontrols.wallpadenergyctrl.screen.*;
- import kr.co.icontrols.wallpadenergyctrl.screen.ienergy.EachRoomEnergyDetailScreen;
- import kr.co.icontrols.wallpadenergyctrl.screen.ienergy.EachRoomEnergyMainScreen;
- import kr.co.icontrols.wallpadenergyctrl.screen.smart_distribution.SmartConcentScreen;
- import kr.co.icontrols.wallpadenergyctrl.screen.smart_distribution.SmartDisPanelScreen;
- import kr.co.icontrols.wallpadenergyctrl.screen.smart_distribution.SmartDisPanelScreen_01;
- import kr.co.icontrols.wallpadenergyctrl.screen.smart_distribution.SmartDisPanelScreen_02;
- import kr.co.icontrols.wallpadenergyctrl.screen.smart_distribution.SmartLightScreen;
- import kr.co.icontrols.wallpadsupport.Version;
- import kr.co.icontrols.wallpadsupport.WpadActivity;
- import kr.co.icontrols.wallpadsupport.WpadImageView;
- import kr.co.icontrols.wallpadsupport.WpadScale;
- import kr.co.icontrols.wallpadsupport.WpadTextView;
- import kr.co.icontrols.wallpadsupport.WpadUtil;
- import kr.co.icontrols.wallpadsupport.WpadImageView.TOUCH_KIND;
- import kr.co.icontrols.wallpadsupport.WpadSound.SND;
- import com.util.LogUtil;
- /**
- * @description
- * 월패드 [에너지관리] 메인화면 이다.<br>
- * 상단의 Top 메뉴, [홈] [돌아가기]<br>
- * 좌측의 Tab 메뉴, [원격검침] [IEnergy] [실시간검침] ... 등 선택 메뉴<br>
- * 를 여기서 처리한다.
- */
- 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 WallpadStatusData wdb = null;
- private int OPERATION_MODE = Common.MODE;
- // 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, TopSetTargetBtn;
- private WpadImageView Hide1Btn, Hide2Btn;
- private TextButton EnergyResetBtn;
- private WpadTextView SampleModeTitle;
- private WpadImageView BackBtn_SmartDist;
- private WpadImageView TopManualBtn;
- // Tab Menu
- /* private int [][] TabBgDrawIdArray = new int [][]
- {
- { R.drawable.sub_menu_bgr_normal_1, R.drawable.sub_menu_bgr_pressed },
- { R.drawable.sub_menu_bgr_normal_2, R.drawable.sub_menu_bgr_pressed },
- { R.drawable.sub_menu_bgr_normal_3, R.drawable.sub_menu_bgr_pressed },
- { R.drawable.sub_menu_bgr_normal_4, R.drawable.sub_menu_bgr_pressed },
- { R.drawable.sub_menu_bgr_normal_5, R.drawable.sub_menu_bgr_pressed },
- { R.drawable.sub_menu_bgr_normal_6, R.drawable.sub_menu_bgr_pressed },
- { R.drawable.sub_menu_bgr_normal_7, R.drawable.sub_menu_bgr_pressed },
- };
- private WpadImageView TabBtn1, TabBtn2, TabBtn3, TabBtn4, TabBtn5, TabBtn6, TabBtn7;
- private WpadImageView [] TabBtn_Array = new WpadImageView [] {TabBtn1, TabBtn2, TabBtn3, TabBtn4, TabBtn5, TabBtn6, TabBtn7};*/
- // 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 boolean MenuOpen = false;
- // PopupActivityRun
- private static boolean PopupActivityRun = false;
- public static boolean getPopupActivityRun() { return PopupActivityRun; }
- public static void setPopupActivityRun(boolean run) { PopupActivityRun = run; }
- // Menu & TabData
- private Menu mMenu = null;
- // private TabData mTabData = null;
- // CurrentScreenId
- private int mCurrentScreenId = -1;
- private int mTempCurrentScreenId = -1;
- public static int mCurrentManualScreenId = -1;
- // HideMenu
- private int mHideMenuEntryStatus = 0;
- private static boolean mHideMenuOn = false;
- public static boolean getHideMenuOn() { return mHideMenuOn; }
- private CountDownTimer mHideMenuTimer = null;
- // TextButton
- private class TextButton {
- public WpadImageView Bg; // 배경
- public WpadTextView Text; // 글씨
- public TextButton(RelativeLayout layout, boolean UseButton, int bgcolor, int w, int h, int id, int textcolor, int textsize, boolean textbold, int left, int top) {
- int TouchKind = TOUCH_KIND.NONE;
- if(UseButton) TouchKind = TOUCH_KIND.BUTTON_M;
- Bg = new WpadImageView(getContext(), TouchKind, w, h, 0, 0, id);
- Bg.setBackgroundColor(bgcolor);
- ViewRegistration(layout, Bg, left, top);
- Text = new WpadTextView(getContext(), false, w, h, Gravity.CENTER, textcolor, textsize, textbold, 0);
- ViewRegistration(layout, Text, left, top);
- }
- public void setText(String str)
- {
- if(Text != null) Text.setText(str);
- }
- public void setVisibility(int visibility) {
- Bg.setVisibility(visibility);
- Text.setVisibility(visibility);
- }
- }
- // Screen
- private RemoteMeterMainScreen remoteMeterMainScreen = null; //원격검침
- private IcEnergyMgrScreen icEnergyMgrScreen = null ;//HEMS
- //private RealTimeMeterMainScreen realTimeMeterMainScreen = null; //실시간검침
- private RemoteMeterCostTableScreen remoteMeterCostTableScreen = null; //요금테이블
- private EachRoomEnergyMainScreen eachRoomEnergyMainScreen; // I'Energy Main Screen (간편보기) -> 신규 사용안함..
- private EachRoomEnergyDetailScreen eachRoomEnergyDetailScreen; // I'Energy 상세보기 -> 신규 기본화면
- private SmartDisPanelScreen smartDisPanelScreen;
- private SmartDisPanelScreen_01 smartDisPanelScreen_01; // 신규 화면 (통합전력제어기: 전력측정(VE버전))
- private SmartDisPanelScreen_02 smartDisPanelScreen_02; // 신규 화면 (통합전력제어기: 직결)
- private SmartConcentScreen smartConcentScreen;
- private SmartLightScreen smartLightScreen;
- // 명칭 관련
- public static final int HEATING = 1;
- public static final int LIGHT = 2;
- private String [] mRoomNameList = null; //조명 방 명칭
- 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"};
- public WallpadStatusData GetDBObj()
- {
- return wdb;
- }
- // =================================================================================================
- // [[ Activity Life Cycle ]] region
- // =================================================================================================
- /**
- * Activity Constructors
- */
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- Log.i(TAG, "-------------------------------------------------------------");
- Log.i(TAG, "------------------ [START - MainActivity] -------------------");
- Log.i(TAG, "-------------------------------------------------------------");
- super.onCreate(savedInstanceState);
- // @ AutoScale 설정
- WpadScale.setAutoScale(true);
- super.AppVersionLogOut(); // [APP Version] + [WallPadSupport Lib Version] 을 로그로 출력한다.
- Log.i("Version", "<><><><> WallPadAPI Version = [" + define.WALLPADAPI_VERSION + "] " + "<><><><>");
- // 1. 변수 초기화
- DebugLogOutput("[Create] - Step1 : Data Create");
- PopupActivityRun = false;
- mContext = this;
- mHideMenuOn = false;
- // 2. 자동 종료 셋팅
- DebugLogOutput("[Create] - Step2 : Auto Finish Setting");
- // 2-1. 자동종료 타이머 셋팅
- if (Common.MODE == Common.MODE_PRODUCTION) {
- // LCD 항상 켜져 있게 하는 기능 추가
- // PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
- // pm.userActivity(2, true);
- getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
- }
- else {
- if (Common.FINISH_TIME_ENABLE) super.setFinishTimerCreate(Common.FINISH_TIME_SEC); // 주석 해제해야 정상임
- }
- // 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, "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);
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- else if (OPERATION_MODE == Common.MODE_BUSINESS_SAMPLE) {
- Log.d(TAG, "OperationMode = MODE_BUSINESS_SAMPLE");
- }
- try { wdb = new WallpadStatusData(this); }
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) { Log.e(TAG, "[ExceptionError] - onCreate->WallpadStatusData Create : " + e); }
- getIntegratedPowerCtrllerType();
- GetRoomName();
- // 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);
- if (OPERATION_MODE == Common.MODE_BUSINESS_SAMPLE) {
- SampleModeTitle = new WpadTextView(this, false, 200, 72, Gravity.CENTER, Color.WHITE, Common.fontsize._26_DEFAULT, true, 0);
- ViewRegistration(TopLayout, SampleModeTitle, 133, 15);
- SampleModeTitle.setText("[영업샘플모드]");
- }
- else if (Common.MODE == Common.MODE_PRODUCTION) {
- SampleModeTitle = new WpadTextView(this, false, 200, 72, Gravity.CENTER, Color.WHITE, Common.fontsize._26_DEFAULT, true, 0);
- ViewRegistration(TopLayout, SampleModeTitle, 316, 0);
- SampleModeTitle.setText("[생산 검수 모드]");
- EnergyResetBtn = new TextButton(TopLayout, true, Color.WHITE, 200, 72, ID.main.button.ENERGY_RESET, Color.BLACK, Common.fontsize._32_POPUP_TITLE, true, 316+200+100, 0);
- EnergyResetBtn.setText("RESET");
- EnergyResetBtn.setVisibility(View.INVISIBLE);
- }
- 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+50, 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);
- 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);
- 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);
- BackBtn_SmartDist = new WpadImageView(this, TOUCH_KIND.BUTTON, 110, 110, R.drawable.topbar_icon_back_normal, R.drawable.topbar_icon_back_pressed, ID.main.button.BACK_SMARTDIST);
- ViewRegistration(TopLayout, BackBtn_SmartDist, 1020, 0);
- setBackBtnSmartDistVisible(false);
- 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);
- // Hide1Btn = new WpadImageView(this, TOUCH_KIND.BUTTON_M, 70, 61, 0, 0, ID.main.button.HIDE1);
- // ViewRegistration(TopLayout, Hide1Btn, 0, 0);
- // Hide2Btn = new WpadImageView(this, TOUCH_KIND.BUTTON_M, 70, 61, 0, 0, ID.main.button.HIDE2);
- // ViewRegistration(TopLayout, Hide2Btn, 1024-70, 0);
- // 6. Menu Loading
- // 6-1. 메뉴 정보를 가져온다 (DB에서 가져온다)
- wallpaddbmgr WallpadDBMGR = new wallpaddbmgr(getApplicationContext());
- //test
- WallpadDBMGR.DeleteMenuList();
- ArrayList<ArrayList<Integer>> mGroupList = null;
- ArrayList<Integer> mChildList = null;
- mGroupList = new ArrayList<ArrayList<Integer>>();
- //b. 에너지관리
- mChildList = new ArrayList<Integer>();
- mChildList.add(API_Menu.SubMenuEnergy.EnergyMgr);
- mChildList.add(API_Menu.SubMenuEnergy.RemoteMeter);
- mChildList.add(API_Menu.SubMenuEnergy.EachRoomEnergy);
- //mChildList.add(API_Menu.SubMenuEnergy.CostTable);
- mGroupList.add(mChildList);
- WallpadDBMGR.SetMenuList(mGroupList);
- menueListDataClass = WallpadDBMGR.GetMenuList();
- WallpadDBMGR.closeDB();
- if (menueListDataClass == null) {
- Log.e(TAG, "menueListDataClass == null, Load Default List");
- menueListDataClass = LoadDefaultMenuList();
- }
- //WallPadMain에서 MenuList를 넣어주지 않아 아래 테스트 코드를 넣음
- menueListDataClass = LoadDefaultMenuList();
- // 6-2. 시작 화면을 main APP으로 부터 받아서 처리한다.
- mMenu = new Menu();
- mMenu = super.getIntentParsingMenu(getIntent());
- if(mMenu == null)
- {
- //setChangeScreen(API_Menu.SubMenuEnergy.RemoteMeter, false);
- Log.i(TAG, "mMenu = null");
- if (OPERATION_MODE == Common.MODE_NOMAL)
- {
- mTempCurrentScreenId =API_Menu.SubMenuEnergy.RemoteMeter;
- //SetTitleText(mTempCurrentScreenId);
- mWallPadApiCheckHandler.sendEmptyMessage(0);
- } else
- {
- setChangeScreen(API_Menu.SubMenuEnergy.RemoteMeter, false);
- }
- }
- else
- {
- /*boolean result = setChangeScreen(mMenu.getStartId(), false);
- if(result == false)
- {
- setChangeScreen(API_Menu.SubMenuEnergy.RemoteMeter, false);
- }*/
- Log.i(TAG, "mMenu != null");
- if (OPERATION_MODE == Common.MODE_NOMAL)
- {
- mTempCurrentScreenId = mMenu.getStartId();
- //setTitleName(mTempCurrentScreenId);
- mWallPadApiCheckHandler.sendEmptyMessage(0);
- } else
- {
- boolean result = setChangeScreen(mMenu.getStartId(), false);
- if (result == false)
- {
- setChangeScreen(API_Menu.SubMenuEnergy.RemoteMeter, 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 wd = new WallpadDeviceSet(getContext());
- if(wd.Get_SmartDistribution_Info() == 1)
- {
- Log.i(TAG, "스마트분전반 사용설정 ON");
- }
- else
- {
- Log.i(TAG, "스마트분전반 사용설정 OFF");
- }*/
- Log.i(TAG, "End onCreate -------------------------------------------------");
- }
- /* *
- * (임시코드) WallPadAPI 초기생성시 Connect 에 시간이 걸리며, <br>
- * WallPadAPI 초기화후 바로 Get_GasValveController 등을 사용하여 API 를 가져올수 없기에, <br>
- * 본 딜레이 코드를 임시로 적용한다.*/
- @SuppressLint("HandlerLeak")
- protected Handler mWallPadApiCheckHandler = new Handler()
- {
- @SuppressLint("HandlerLeak")
- @Override
- public void handleMessage(Message msg)
- {
- if(msg.what == 0)
- {
- if(wpapi != null)
- {
- if(wpapi.Check_Connect()) mWallPadApiCheckHandler.sendEmptyMessageDelayed(1, 10);
- else mWallPadApiCheckHandler.sendEmptyMessageDelayed(0, 10);
- }
- }
- else if(msg.what == 1)
- {
- setChangeScreen(mTempCurrentScreenId, false);
- }
- }
- };
- /**
- * onDestroy
- */
- @Override
- protected void onDestroy()
- {
- if(Common.MODE == Common.MODE_PRODUCTION)
- {
- // LCD 를 Normal 상태로 변경하는 기능 추가
- // PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
- // pm.userActivity(1, true);
- getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
- }
- setChangeScreen(mCurrentScreenId, true);
- if(wdb != null) wdb.closeDB();
- this.unregisterReceiver(mWallPadAlertBR);
- this.unregisterReceiver(mWallPadJogBR);
- if(getManualUse())
- {
- FinishManualActivity();
- }
- super.setFinishTimerDestroy();
- super.onDestroy();
- Log.i(TAG, "*************************************************************");
- Log.i(TAG, "****************** [END - MainActivity] *******************");
- Log.i(TAG, "*************************************************************");
- }
- /**
- * 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);
- DebugLogOutput("Receive BR " + intent.getAction());
- }
- /* ================================================================================================
- * [Touch & Key Event] Section
- ================================================================================================ */
- /**
- * TouchEvent for [WpadActivity]
- */
- @Override
- protected void onTouchEvent(View v, MotionEvent event)
- {
- super.onTouchEvent(v, event);
- 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_SMARTDIST)
- {
- DebugLogOutput("onTouchEvent [BACK_SMARTDIST] BUTTON !!!");
- Sound().Play(SND.effect.TOUCH_LATCHED);
- setBackBtnSmartDistVisible(false);
- setChangeScreen(API_Menu.SubMenuEnergy.SmartPanel, false);
- }
- 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 !!!");
- if(MenuOpen == true)
- {
- return;
- }
- Sound().Play(SND.effect.TOUCH_LATCHED);
- OpenMenuLayout();
- }
- else if (TargetId == ID.main.button.MENUCLOSE)
- {
- if(MenuOpen == true)
- {
- Sound().Play(SND.effect.TOUCH_LATCHED);
- CloseMenuLayout();
- }
- }
- else if(TargetId == ID.main.button.ENERGY_RESET)
- {
- DebugLogOutput("onTouchEvent [ENERGY_RESET] BUTTON !!!");
- try
- {
- if(wpapi != null && wpapi.Get_IGW200dController()!=null)
- {
- int ret = wpapi.Get_IGW200dController().EnergyReset();
- if(ret >= 0)
- {
- Sound().Play(SND.effect.EFFECT1);
- }
- }
- }
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e)
- {
- Log.e(TAG, "[ExceptionError] - onTouchEvent->ENERGY_RESET wpapi.Get_IGW200dController().EnergyReset()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- else if (TargetId == ID.main.button.MANUAL)
- {
- Log.i(TAG, "onTouchEvent [MANUAL] BUTTON [mCurrentScreenId = " + mCurrentScreenId + "]");
- Sound().Play(SND.effect.TOUCH_LATCHED);
- try
- {
- if(mCurrentScreenId == API_Menu.SubMenuEnergy.RemoteMeter) { StartManual(ID.MANUAL.MANUAL_RemoteMeter); }
- else if(mCurrentScreenId == API_Menu.SubMenuEnergy.EnergyMgr) { StartManual(ID.MANUAL.MANUAL_HEMS); }
- else if(mCurrentScreenId == API_Menu.SubMenuEnergy.SmartPanel) { StartManual(ID.MANUAL.MANUAL_SmartDist); }
- else if(mCurrentScreenId == API_Menu.SubMenuEnergy.SmartLight) { StartManual(ID.MANUAL.MANUAL_SmartLight); }
- else if(mCurrentScreenId == API_Menu.SubMenuEnergy.SmartOutlet) { StartManual(ID.MANUAL.MANUAL_SmartConcent); }
- }
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception ex)
- {
- //ex.printStackTrace();
- LogUtil.errorLogInfo("", TAG, ex);
- }
- }
- }
- }
- /**
- * 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)
- {
- 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;
- }
- /**
- * 스마트분전반 돌아가기 버튼 활성화 & 비활성화
- *
- * @param Enabled - true : 활성화, false : 비활성화
- * @return (boolean) true : 성공, false : 실패
- */
- public boolean setBackBtnSmartDistVisible(boolean Enabled)
- {
- if(Enabled == true)
- {
- if(BackBtn_SmartDist.getVisibility() != View.VISIBLE) BackBtn_SmartDist.setVisibility(View.VISIBLE);
- BackBtn_SmartDist.bringToFront();
- if(TopManualBtn.getVisibility() == View.VISIBLE)
- {
- WpadUtil.ViewMove(TopManualBtn, 893, 0);
- }
- }
- else
- {
- if(BackBtn_SmartDist.getVisibility() != View.INVISIBLE) BackBtn_SmartDist.setVisibility(View.INVISIBLE);
- if(TopManualBtn.getVisibility() == View.VISIBLE)
- {
- WpadUtil.ViewMove(TopManualBtn, 1019, 0);
- }
- }
- return true;
- }
- /**
- * TOP 에 목표량설정 아이콘 활성화 & 비활성화
- *
- * @param Enabled - true : 활성화, false : 비활성화
- * @return (boolean) true : 성공, false : 실패
- */
- public boolean setTopSetTargetBtnVisible(boolean Enabled)
- {
- if(Enabled == true)
- {
- if(TopSetTargetBtn.getVisibility() != View.VISIBLE)
- {
- WpadUtil.ViewMove(TopSetTargetBtn, 93, 132);
- if(TopSetTargetBtn!=null) TopSetTargetBtn.setVisibility(View.VISIBLE);
- }
- if(TopSetTargetBtn!=null) TopSetTargetBtn.bringToFront();
- }
- else
- {
- if(TopSetTargetBtn.getVisibility() != View.INVISIBLE && TopSetTargetBtn!=null) TopSetTargetBtn.setVisibility(View.INVISIBLE);
- }
- return true;
- }
- /**
- * TOP 에너지미터 리셋 버튼 활성화 & 비활성화
- *
- * @param Enabled - true : 활성화, false : 비활성화
- */
- public void setTopEnergyResetBtnVisible(boolean Enabled)
- {
- if(Enabled == true)
- EnergyResetBtn.setVisibility(View.VISIBLE);
- else
- EnergyResetBtn.setVisibility(View.INVISIBLE);
- }
- /* ================================================================================================
- * [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);
- else TopManualBtn.setVisibility(View.INVISIBLE);
- ViewRegistration(TopLayout, TopManualBtn, marginLeft, 0);
- }
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e)
- {
- Log.e(TAG, "[Exception] setManualBtnVisible(boolean bEnable)");
- //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 ex)
- {
- Log.e(TAG, "[getManualUse] - Exception !!!");
- //ex.printStackTrace();
- LogUtil.errorLogInfo("", TAG, ex);
- }
- 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)
- {
- Log.d(TAG, "[StartManual] ScreenId [" + screenId + "], mCurrentManualScreenId [" + mCurrentManualScreenId + "]");
- if (getManualActivityRun())
- {
- mCurrentManualScreenId = screenId;
- try
- {
- boolean ret = mManualActivity.ChangeScreen(screenId);
- Log.d(TAG, "[StartManual] - ret : " + ret);
- return ret;
- }
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- }
- catch (Exception ex)
- {
- //ex.printStackTrace();
- LogUtil.errorLogInfo("", TAG, ex);
- return false;
- }
- }
- else
- {
- try
- {
- if (mCurrentManualScreenId == screenId) return false;
- mCurrentManualScreenId = screenId;
- setManualActivityRun(true);
- Intent intent = new Intent(mContext, ManualActivity.class);
- intent.putExtra("ScreenId", screenId);
- if(mCurrentScreenId == API_Menu.SubMenuEnergy.SmartLight)
- {
- intent.putExtra("SmartLightInfo", smartLightScreen.nAllEMCnt);
- }
- else if(mCurrentScreenId == API_Menu.SubMenuEnergy.SmartOutlet)
- {
- if(smartConcentScreen.concentRooms != null)
- {
- intent.putExtra("SmartConcentInfo", smartConcentScreen.concentRooms.length);
- }
- }
- overridePendingTransition(0, 0);
- startActivityForResult(intent, 0);
- return true;
- }
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- }
- catch (Exception exc)
- {
- //exc.printStackTrace();
- LogUtil.errorLogInfo("", TAG, exc);
- 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);
- }
- }
- /* ================================================================================================
- * [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);
- Log.d(TAG, "@@@@@@@@ [onActivityResult] @@@@@@@@");
- if(resultCode == RESULT_OK)
- {
- try
- {
- // PopupActivity 에서 FinishTimer 로 인하여 종료가 되었을 경우
- // MainActivity 도 즉시 종료시킨다.
- String code = (String) data.getExtras().get("Finish_Kind");
- Log.d(TAG, "Finish_Kind : " + code);
- if(code.equals("FinishTimer") == true)
- {
- Log.d(TAG, "FinishTimer finish");
- finish();
- }
- }
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e)
- {
- Log.e(TAG, "[Exception Error] [onActivityResult] - data.getExtras().get");
- }
- }
- }
- /* ================================================================================================
- * [Screen] Section
- ================================================================================================ */
- /**
- * Screen 에서 Screen 변경을 요청할 경우 호출된다.<br>
- * Override 사용하여 Screen 변경을 처리한다.<br>
- *
- * @param nScreenId - 변경할 Screen ID
- * @return (boolean) true : 성공, false : 실패
- */
- @Override
- protected boolean onChangeScreen(int nScreenId) {
- super.onChangeScreen(nScreenId);
- return setChangeScreen(nScreenId, false);
- }
- /**
- * Screen 등록자<br>
- * 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);
- // 2. 새로운 Layout 표시
- try
- {
- switch(nScreenId)
- {
- /**
- * [수정필요]
- * Back Button 필요한 화면은 setTopBackBtnVisible(true) 호출 필요
- * 추가 또는 수정해야할 부분 1. - 스크린 별 layout 생성
- * **/
- case API_Menu.SubMenuEnergy.RemoteMeter:
- SetTitleText(API_Menu.SubMenuEnergy.Name_RemoteMeter);
- remoteMeterMainScreen = new RemoteMeterMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(remoteMeterMainScreen);
- break;
- case API_Menu.SubMenuEnergy.EnergyMgr:
- SetTitleText(API_Menu.SubMenuEnergy.Name_EnergyMgr);
- icEnergyMgrScreen= new IcEnergyMgrScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(icEnergyMgrScreen);
- break;
- case API_Menu.SubMenuEnergy.CostTable:
- SetTitleText(API_Menu.SubMenuEnergy.Name_CostTable);
- remoteMeterCostTableScreen= new RemoteMeterCostTableScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(remoteMeterCostTableScreen);
- break;
- case API_Menu.SubMenuEnergy.EachRoomEnergy:
- SetTitleText(API_Menu.SubMenuEnergy.Name_EachRoomEnergy);
- eachRoomEnergyDetailScreen = new EachRoomEnergyDetailScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mRoomNameList);
- super.setCurrentScreen(eachRoomEnergyDetailScreen);
- break;
- case API_Menu.SubMenuEnergy.SmartPanel:
- if (nIntegratedPowerCtrller == WallpadDeviceSet.POWERCONTROLLER_TYPE_DEFAULT) {
- SetTitleText(API_Menu.SubMenuEnergy.Name_SmartDistribution);
- smartDisPanelScreen = new SmartDisPanelScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(smartDisPanelScreen);
- }
- else if (nIntegratedPowerCtrller == WallpadDeviceSet.POWERCONTROLLER_TYPE_MEASURE) {
- SetTitleText(API_Menu.SubMenuEnergy.Name_SmartDistribution);
- smartDisPanelScreen_01 = new SmartDisPanelScreen_01(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(smartDisPanelScreen_01);
- }
- else if (nIntegratedPowerCtrller == WallpadDeviceSet.POWERCONTROLLER_TYPE_DIRECT) {
- SetTitleText(API_Menu.SubMenuEnergy.Name_SmartDistribution);
- smartDisPanelScreen_02 = new SmartDisPanelScreen_02(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(smartDisPanelScreen_02);
- }
- else {
- // 설정값이 없는 경우에는 기본화면을 출력한다.
- SetTitleText(API_Menu.SubMenuEnergy.Name_SmartDistribution);
- smartDisPanelScreen = new SmartDisPanelScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(smartDisPanelScreen);
- Log.w(TAG, "[setChangeScreen] API_Menu.SubMenuEnergy.SmartPanel -> Not supported type : nIntegratedPowerCtrller -> " + nIntegratedPowerCtrller);
- }
- break;
- case API_Menu.SubMenuEnergy.SmartOutlet:
- SetTitleText(API_Menu.SubMenuEnergy.Name_SmartConcent);
- smartConcentScreen = new SmartConcentScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mRoomNameList_Light, false);
- super.setCurrentScreen(smartConcentScreen);
- break;
- case API_Menu.SubMenuEnergy.SmartLight:
- SetTitleText(API_Menu.SubMenuEnergy.Name_SmartLight);
- smartLightScreen = new SmartLightScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mRoomNameList_Light, false);
- super.setCurrentScreen(smartLightScreen);
- break;
- default:
- Log.e(TAG, "[Error] setChangeScreen - nScreenId Not found!!! (" + mCurrentScreenId + ")");
- mCurrentScreenId = -1;
- return false;
- }
- }
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- }
- catch (Exception e)
- {
- Log.e(TAG, "[ExceptionError] - setChangeScreen->Screen Create : " + e);
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- return true;
- }
- /**
- * 상단 타이틀 텍스트 수정
- * @param SetText 수정할 타이틀 이름
- * **/
- private void SetTitleText(String SetText)
- {
- if(SetText != null)
- {
- TopTitle.setText(SetText);
- }
- }
- /* ================================================================================================
- * [Menu Layout] Section
- ================================================================================================ */
- /**
- * 메뉴 레이아웃 생성
- * **/
- private void OpenMenuLayout()
- {
- if(MenuOpen == true)
- {
- Log.d(TAG, "MenuOpen == true");
- return;
- }
- if(menueListDataClass == null)
- {
- Log.d(TAG, "menueListDataClass = null");
- return;
- }
- //0. 현재 ID 및 리스트 불러오기
- String Title = API_Menu.GetGroupNameByID((mCurrentScreenId / 1000) * 1000);
- //Log.i(TAG, "[OpenMenuLayout] - API_Menu title = " + Title);
- 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))
- {
- //Log.i(TAG, "arrayGroup[" + i + "] = " + menueListDataClass.arrayGroup.get(i));
- ChooseGroup = i;
- break;
- }
- }
- //Log.i(TAG, "[OpenMenuLayout] - ChooseGroup = " + ChooseGroup);
- //Log.i(TAG, "mCurrentScreenId = " + mCurrentScreenId);
- for(int i = 0; i< menueListDataClass.idMappingTable.length; i++)
- {
- //Log.i(TAG, "[OpenMenuLayout] - menueListDataClass.idMappingTable[i].Id = " + menueListDataClass.idMappingTable[i].Id);
- if (menueListDataClass.idMappingTable[i].Id == mCurrentScreenId)
- {
- TempChildName = menueListDataClass.idMappingTable[i].Name;
- //Log.i(TAG, "[OpenMenuLayout] - Same ChildName = " + TempChildName);
- break;
- }
- }
- if(TempChildName == null)
- {
- Log.i(TAG, "[OpenMenuLayout] - TempChildName == null");
- return;
- }
- //Log.i(TAG, "[OpenMenuLayout] - TempChildName = " + TempChildName);
- try
- {
- for(int i = 0; i< menueListDataClass.arrayChild.get(Title).size(); i++)
- {
- if(menueListDataClass.arrayChild.get(Title).get(i).equals(TempChildName) == true)
- {
- ChooseChild = i;
- break;
- }
- }
- }
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e)
- {
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- //Log.i(TAG, "[OpenMenuLayout] - ChooseChild = " + ChooseChild);
- //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 Button.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 == true)
- {
- mListView.expandGroup(GroupID);
- }
- else
- {
- mListView.collapseGroup(GroupID);
- }
- }
- /**
- * Menu정보가 DB에 없을 경우 불러올 스크린 로딩
- * @return MenuListDataClass 타입의 초기정보
- * **/
- private MenuListDataClass LoadDefaultMenuList()
- {
- MenuListDataClass Temp_menueListDataClass = new MenuListDataClass();
- Temp_menueListDataClass.SetArrayGroup(API_Menu.SubMenuEnergy.Name);
- ArrayList<String> arrayList = new ArrayList<String>();
- int ChildCount = 0;
- WallpadDeviceSet devset = new WallpadDeviceSet(getApplicationContext());
- int[] realUse = devset.Get_RealTimeMetor_Info();
- boolean remoteMeterUse = devset.Get_RemoteMeter_Use();
- int nDistributionPanelType = devset.Get_DistributionPannelType_Info();
- devset.closeDB();
- //[수정필요]
- //추가 또는 수정해야할 부분 1. - Menu정보가 DB에 없을 경우 불러올 스크린 종류(시작)
- if(remoteMeterUse == true)
- {
- Log.i(TAG, "[LoadDefaultMenuList] - RemoteMeter Screen ADD ~~~");
- arrayList.add(API_Menu.SubMenuEnergy.Name_RemoteMeter); ChildCount++;
- if(Version.getModelType() != Version.MODEL_TYPE.IHN_1010GL_I_2443ALT)
- {
- arrayList.add(API_Menu.SubMenuEnergy.Name_EnergyMgr); ChildCount++;
- }
- }
- /*if(realUse[0] == 1)
- {
- Log.i(TAG, "[LoadDefaultMenuList] - EnergyValue Screen ADD ~~~");
- arrayList.add(API_Menu.SubMenuEnergy.Name_EnergyMgr); ChildCount++;
- }*/
- //arrayList.add(API_Menu.SubMenuEnergy.Name_CostTable); ChildCount++;
- //arrayList.add(API_Menu.SubMenuEnergy.Name_EachRoomEnergy); ChildCount++;
- //if(Version.getModelType() == Version.MODEL_TYPE.IHN_D101)
- if(nDistributionPanelType == Version.DISTRIBUTION_MODEL.SMART_DIST)
- {
- arrayList.add(API_Menu.SubMenuEnergy.Name_SmartDistribution); ChildCount++;
- arrayList.add(API_Menu.SubMenuEnergy.Name_SmartConcent); ChildCount++;
- arrayList.add(API_Menu.SubMenuEnergy.Name_SmartLight); ChildCount++;
- }
- Log.i(TAG, "[LoadDefaultMenuList] - ChildCount : " + ChildCount);
- //Log.i(TAG, "[LoadDefaultMenuList] - childCount = " + ChildCount);
- //추가 또는 수정해야할 부분 1. - Menu정보가 DB에 없을 경우 불러올 스크린 종류(끝)
- Temp_menueListDataClass.SetArrayChild(API_Menu.SubMenuEnergy.Name, arrayList);
- Temp_menueListDataClass.idMappingTable = new ChildIDMapping[ChildCount];
- for (int i = 0; i < ChildCount; i++)
- {
- Temp_menueListDataClass.idMappingTable[i] = new ChildIDMapping();
- //[수정필요]
- //추가 또는 수정해야할 부분 2. - 불러올 스크린의 ID를 임의로 입력(시작)
- if(arrayList.get(i).equals(API_Menu.SubMenuEnergy.Name_RemoteMeter) == true)
- {
- Temp_menueListDataClass.idMappingTable[i].Id = API_Menu.SubMenuEnergy.RemoteMeter;
- Temp_menueListDataClass.idMappingTable[i].Name = API_Menu.SubMenuEnergy.Name_RemoteMeter;
- }
- else if(arrayList.get(i).equals(API_Menu.SubMenuEnergy.Name_EnergyMgr) == true)
- {
- Temp_menueListDataClass.idMappingTable[i].Id = API_Menu.SubMenuEnergy.EnergyMgr;
- Temp_menueListDataClass.idMappingTable[i].Name = API_Menu.SubMenuEnergy.Name_EnergyMgr;
- }
- else if(arrayList.get(i).equals(API_Menu.SubMenuEnergy.Name_CostTable) == true)
- {
- Temp_menueListDataClass.idMappingTable[i].Id = API_Menu.SubMenuEnergy.CostTable;
- Temp_menueListDataClass.idMappingTable[i].Name = API_Menu.SubMenuEnergy.Name_CostTable;
- }
- else if(arrayList.get(i).equals(API_Menu.SubMenuEnergy.Name_EachRoomEnergy) == true)
- {
- Temp_menueListDataClass.idMappingTable[i].Id = API_Menu.SubMenuEnergy.EachRoomEnergy;
- Temp_menueListDataClass.idMappingTable[i].Name = API_Menu.SubMenuEnergy.Name_EachRoomEnergy;
- }
- else if(arrayList.get(i).equals(API_Menu.SubMenuEnergy.Name_SmartDistribution) == true)
- {
- Temp_menueListDataClass.idMappingTable[i].Id = API_Menu.SubMenuEnergy.SmartPanel;
- Temp_menueListDataClass.idMappingTable[i].Name = API_Menu.SubMenuEnergy.Name_SmartDistribution;
- }
- else if(arrayList.get(i).equals(API_Menu.SubMenuEnergy.Name_SmartConcent) == true)
- {
- Temp_menueListDataClass.idMappingTable[i].Id = API_Menu.SubMenuEnergy.SmartOutlet;
- Temp_menueListDataClass.idMappingTable[i].Name = API_Menu.SubMenuEnergy.Name_SmartConcent;
- }
- else if(arrayList.get(i).equals(API_Menu.SubMenuEnergy.Name_SmartLight) == true)
- {
- Temp_menueListDataClass.idMappingTable[i].Id = API_Menu.SubMenuEnergy.SmartLight;
- Temp_menueListDataClass.idMappingTable[i].Name = API_Menu.SubMenuEnergy.Name_SmartLight;
- }
- //Log.i(TAG, "[LoadDefaultMenuList] - idMappingTable.id[" + i + "] = " + Temp_menueListDataClass.idMappingTable[i].Id);
- //Log.i(TAG, "[LoadDefaultMenuList] - idMappingTable.Name[" + i + "] = " + Temp_menueListDataClass.idMappingTable[i].Name);
- }
- return Temp_menueListDataClass;
- }
- /**
- * 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] - RoomNameList.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]);
- }
- //{ "거실", "주방", "방1", "방2", "방3", "방4", "방5", "방6", "방7", "방8"};
- //RoomNameList += {"방5", "방6", "방7", "방8"};
- String[] retRoomNameList = new String[10];
- for (int i = 0; i < retRoomNameList.length; i++) {
- if (i < 6) {
- if (i < 1) retRoomNameList[i] = RoomNameList[i];
- else if (i == 1) retRoomNameList[i] = "주방"; // 난방 기준의 방명칭 설정을 조명/콘센트에 적용시에는 두번째에 주방을 추가한다. 이는 추후 방명칭 입력단계부터 개선해야 함
- else retRoomNameList[i] = RoomNameList[i - 1];
- }
- else {
- retRoomNameList[i] = mDefaultRoomNameList[i];
- }
- }
- for (int i = 0; i < retRoomNameList.length; i++) DebugLogOutput("[getRoomNamefromDB] retRoomNameList[" + i + "] = " + retRoomNameList[i]);
- return retRoomNameList;
- } 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, "[DB_GetRoomName] [ExceptionError] : " + e);
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- return null;
- }
- /**
- * DB에서 방 이름을 가져와서 방 명칭 관련 변수에 값을 넣는다.
- **/
- private void GetRoomName() {
- WallpadDeviceSet wallpadDeviceSet = new WallpadDeviceSet(getContext().getApplicationContext());
- boolean UseEachRoomName = wallpadDeviceSet.GetEachRoomNameInfo();
- wallpadDeviceSet.closeDB();
- Log.i(TAG, "[GetRoomName] UseEachRoomName [" + UseEachRoomName + "]");
- if (UseEachRoomName == false) {
- // 명칭 통합사용
- mRoomNameList_Light = getRoomNamefromDB();
- if (mRoomNameList_Light == null) {
- mRoomNameList_Light = mDefaultRoomNameList;
- }
- }
- else {
- // 명칭 난방, 조명 분리 사용
- mRoomNameList_Light = getRoomNamefromDB(LIGHT);
- if (mRoomNameList_Light == null) {
- mRoomNameList_Light = mDefaultRoomNameList_Light;
- }
- }
- }
- /**
- * 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);
- }
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e)
- {
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /**
- * 조그버튼 입력 받을 시 처리
- **/
- BroadcastReceiver mWallPadJogBR = new BroadcastReceiver()
- {
- @Override
- public void onReceive(Context context, Intent intent)
- {
- WpadActivity.setFinishTimerReset();
- }
- };
- /**
- * 메뉴에서 버튼 터치 처리
- * **/
- 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, "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) == true)
- {
- 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, "Child ID :" + ChildID);
- if(TempID == 0)
- {
- return;
- }
- if(ChildGroupID == TempID)
- {
- //해당 APP내에서 스크린 전환 필요
- //[수정필요]
- boolean result = setChangeScreen(ChildID, false);
- setBackBtnSmartDistVisible(false);
- if(result == false)
- {
- setChangeScreen(API_Menu.SubMenuEnergy.RemoteMeter, 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;
- }
- }
- }
- }
- }
- };
- /**
- * 현관호출 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;
- }
- /**
- * 간편모드 UX 사용여부를 반환한다.
- * @return TRUE일 경우 간편모드 UX 사용
- */
- 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;
- }
- /**
- * 통합전력제어기 종류를 확인한다.
- * POWERCONTROLLER_TYPE_NONE = 110; // 사용안함
- * POWERCONTROLLER_TYPE_DEFAULT = 111; // 기본
- * POWERCONTROLLER_TYPE_DIRECT = 112 // 직결보드
- * POWERCONTROLLER_TYPE_MEASURE = 113 // 전력측정직결보드
- */
- int nIntegratedPowerCtrller = WallpadDeviceSet.POWERCONTROLLER_TYPE_NONE;
- public int getIntegratedPowerCtrllerType() {
- try {
- WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(mContext);
- nIntegratedPowerCtrller = mWallpadDeviceSet.Get_PowerControllerType_Info();
- mWallpadDeviceSet.closeDB();
- Log.d(TAG, "[getIntegratedPowerCtrllerType] nIntegratedPowerCtrller [" + nIntegratedPowerCtrller + "]");
- return nIntegratedPowerCtrller;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return WallpadDeviceSet.POWERCONTROLLER_TYPE_NONE;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] getIntegratedPowerCtrllerType()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return WallpadDeviceSet.POWERCONTROLLER_TYPE_NONE;
- }
- }
- }
|