123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585 |
- 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 org.json.JSONException;
- import org.json.JSONObject;
- import java.io.ObjectInputStream;
- import java.io.ObjectOutputStream;
- import java.net.InetSocketAddress;
- import java.net.Socket;
- import java.sql.Timestamp;
- import java.text.SimpleDateFormat;
- 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_multi.HeatingV2TestScreen;
- import kr.co.icontrols.wallpadhomectrl.screen.screen_multi.HybridCookTopTestScreen;
- import kr.co.icontrols.wallpadhomectrl.screen.screen_multi.LightKnxMainTestScreen;
- import kr.co.icontrols.wallpadhomectrl.screen.screen_multi.ParkingDoorMainScreen;
- import kr.co.icontrols.wallpadhomectrl.screen.screen_multi.SystemAirconTestScreen;
- 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.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_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.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_multi.VentilationMainTestScreen;
- 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 월패드 [설정기능] 메인화면 이다.<br>
- * 상단의 Top 메뉴, [홈] [돌아가기]<br>
- * 좌측의 Tab 메뉴, [환경설정] [화면청소] [비밀번호변경] ... 등 선택 메뉴<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 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 MultiBtn[];
- 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;
- public static int mCurrentMultiScreenId = -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 AirQualityMainScreen airQualityMainScreen = null;
- private DustInfoScreen dustInfoScreen = null;
- private ConcentMainScreen concentMainScreen = null;
- private ConcentKnxMainScreen concentKnxMainScreen = 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 ParkingDoorMainScreen parkingDoorMainScreen = 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 int[][] MultiBtnArray =
- {
- {R.drawable.tab_floor_1_normal, R.drawable.tab_floor_1_pressed},
- {R.drawable.tab_floor_2_normal, R.drawable.tab_floor_2_pressed},
- {R.drawable.tab_floor_3_normal, R.drawable.tab_floor_3_pressed}
- };
- private int[][] MultiSelectedBtnArray =
- {
- {R.drawable.tab_floor_1_selected, R.drawable.tab_floor_1_selected},
- {R.drawable.tab_floor_2_selected, R.drawable.tab_floor_2_selected},
- {R.drawable.tab_floor_3_selected, R.drawable.tab_floor_3_selected}
- };
- 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에 주방등 연결 여부
- public static PowerManager mPowerManager;
- public static V40IF mV40IF;
- //Value
- String myIP = "NONE";
- String myDong = "NONE";
- String myHo = "NONE";
- int ho;
- int mMultiAddress;
- public int KccDimUse = 0;
- // int SmartDistUse = -1;
- // boolean KnxDistUse = false;
- public static int nDistributionPanelType = Version.DISTRIBUTION_MODEL.OTHER;
- 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;
- //for test
- //OPERATION_MODE = Common.MODE_BUSINESS_SAMPLE;
- // 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);
- wallpaddbmgr.AddressSet addc = wdb.getAddressMGR(); //DB에서 동호 정보 받아옴
- //동, 호, ip 정보 저장
- myIP = addc.IPAddress;
- myDong = addc.Dong;
- myHo = addc.Ho;
- ho = Integer.valueOf(myIP.substring(myIP.length()-1, myIP.length()));
- } 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);
- MultiBtn = new WpadImageView[3];
- for (int i = 0; i < MultiBtn.length; i++) {
- MultiBtn[i] = new WpadImageView(this, TOUCH_KIND.BUTTON, 156, 50,
- MultiBtnArray[i],
- MultiSelectedBtnArray[i],
- ID.main.button.MULTI1 + i);
- ViewRegistration(TopLayout, MultiBtn[i], 464 + (i*160), 30);
- }
- setMultiBtnVisible(false);
- WallpadDeviceSet wpdds = new WallpadDeviceSet(getContext());
- bKitchenLightonLivingEM = wpdds.Get_LivingEm_KitchenLight_Use();
- 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();
- wds.closeDB();
- //for test
- nDistributionPanelType = Version.DISTRIBUTION_MODEL.KNX_DIST;
- 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;
- }*/
- // 거주자 안전확인 서비스 사용여부 확인하고, 화면 WallPadSupport Lib.에 관련 설정을 한다.
- getResidentSafetyCheckSetting();
- Log.i(TAG, "[onCreate] 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) {
- 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 || nLightType[1] == WallpadDeviceSet.LIGHT_TYPE_HDC_INTLIGHT_ADD_BATCHLIGHT_MULTISWITCH) {
- // 조명 : 멀티스위치인 경우
- 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 boolean StartMultiControl(int screenId, int ho) {
- try {
- Log.d(TAG, "[StartMultiControl] ScreenId [" + screenId + "], mCurrentScreenId [" + mCurrentScreenId + "]");
- if (mCurrentScreenId == screenId) return false;
- if(setMultiScreen(screenId, ho)){
- return true;
- }
- return false;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] StartMultiControl(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 (mCurrentMultiScreenId == ID.screen.HeatingV2TestScreen) {
- if(StartPopup(ID.screen.HeatingV2PopupBoilerTestScreen)) {
- Sound().Play(SND.effect.TOUCH_LATCHED);
- }
- }
- else {
- 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); }
- }
- else if (TargetId >= ID.main.button.MULTI1 && TargetId <= ID.main.button.MULTI3) {
- Log.i(TAG, "onTouchEvent [TEST1] BUTTON [mCurrentScreenId = " + mCurrentScreenId + "]");
- Sound().Play(SND.effect.TOUCH_LATCHED);
- int index = TargetId - ID.main.button.MULTI1;
- for(int i = 0; i< MultiBtn.length; i++){
- MultiBtn[i].setButtonFrontImage();
- }
- MultiBtn[index].setButtonRearImage();
- //해당층
- if(ho==(index+1)){
- if (mCurrentScreenId == API_Menu.SubMenuCtrl.HDC_LivingLamp) {
- setChangeScreen(API_Menu.SubMenuCtrl.HDC_LivingLamp, false);
- } else if (mCurrentScreenId == API_Menu.SubMenuCtrl.Heating_V2 || mCurrentScreenId == API_Menu.SubMenuCtrl.Heating_V1) {
- setChangeScreen(API_Menu.SubMenuCtrl.Heating_V2, false);
- } else if (mCurrentScreenId == API_Menu.SubMenuCtrl.Gas) {
- setChangeScreen(API_Menu.SubMenuCtrl.Gas, false);
- } else if (mCurrentScreenId == API_Menu.SubMenuCtrl.SystemAircon) {
- setChangeScreen(API_Menu.SubMenuCtrl.SystemAircon, false);
- } else if (mCurrentScreenId == API_Menu.SubMenuCtrl.ChangAir_Normal) {
- setChangeScreen(API_Menu.SubMenuCtrl.ChangAir_Normal, false);
- }
- }else {
- //다른층
- if (mCurrentScreenId == API_Menu.SubMenuCtrl.HDC_LivingLamp) {
- StartMultiControl(ID.screen.LightKnxMainTestScreen, index+1);
- } else if (mCurrentScreenId == API_Menu.SubMenuCtrl.LivingLightConfig) {
- StartMultiControl(API_Menu.SubMenuCtrl.Gas, index+1);
- } else if (mCurrentScreenId == API_Menu.SubMenuCtrl.Heating_V2 || mCurrentScreenId == API_Menu.SubMenuCtrl.Heating_V1) {
- StartMultiControl(ID.screen.HeatingV2TestScreen, index+1);
- } else if (mCurrentScreenId == API_Menu.SubMenuCtrl.Gas) {
- StartMultiControl(ID.screen.GasTestScreen, index+1);
- } else if (mCurrentScreenId == API_Menu.SubMenuCtrl.SystemAircon) {
- StartMultiControl(ID.screen.SystemAirconTest1Screen, index+1);
- } else if (mCurrentScreenId == API_Menu.SubMenuCtrl.ChangAir_Normal) {
- StartMultiControl(ID.screen.VentiMainTestScreen, index+1);
- }
- }
- }
- }
- } 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 변경을 요청할 경우 호출된다.<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);
- }
- /**
- * @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:
- case ID.screen.HeatingV2TestScreen:
- 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:
- case ID.screen.SystemAirconTest1Screen:
- 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 등록자<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;
- mCurrentMultiScreenId = 0;
- setTopBackBtnVisible(false);
- setMultiBtnVisible(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);
- setMultiBtnVisible(true);
- 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.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);
- setMultiBtnVisible(true);
- 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);
- setMultiBtnVisible(true);
- 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);
- ventilationMainScreen = new VentilationMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, nScreenId);
- super.setCurrentScreen(ventilationMainScreen);
- }
- 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);
- setMultiBtnVisible(true);
- 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);
- ventilationMainScreen = new VentilationMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, nScreenId);
- super.setCurrentScreen(ventilationMainScreen);
- 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);
- setMultiBtnVisible(true);
- 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);
- 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);
- setMultiBtnVisible(true);
- 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.ParkingDoor:
- SetTitleText(API_Menu.SubMenuCtrl.Name_ParkingDoor);
- parkingDoorMainScreen = new ParkingDoorMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, API_Menu.SubMenuCtrl.ParkingDoor);
- super.setCurrentScreen(parkingDoorMainScreen);
- setTopBoilerBtnVisible(false);
- setAIRBackBtnVisible(false);
- setKccDimmBtnVisible(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;
- }
- /**
- * Screen 등록자<br>
- * ScreenLayout 에 현재 Screen 을 삭제하고, 새로운 Screen 을 등록시킨다.
- *
- * @param nScreenId - 변경할 Screen ID
- * @param ho - 멀티제어하려논 호
- * @return (boolean) true : 성공, false : 실패
- */
- private boolean setMultiScreen(int nScreenId, int ho) {
- // 1. 현재 Layout 삭제
- if (mCurrentScreenId > 0) {
- ScreenLayout.removeAllViews();
- super.setCurrentScreen(null);
- }
- mMultiAddress = ho;
- setTopBackBtnVisible(false);
- boolean result = false;
- // 2. 새로운 Layout 표시
- try {
- setTitleName(nScreenId);
- //super.setFinishTimerCreate(Common.FINISH_TIME_SEC);
- switch (nScreenId) {
- case ID.screen.SystemAirconTest1Screen: // sub - 공지사항 내용
- SystemAirconTestScreen systemAirconTest1Screen = new SystemAirconTestScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mDefaultRoomNameList);
- super.setCurrentScreen(systemAirconTest1Screen);
- result = true;
- break;
- case ID.screen.LightKnxMainTestScreen: // sub - 공지사항 내용
- LightKnxMainTestScreen lightKnxMainTestScreen = new LightKnxMainTestScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mRoomNameList_Light);
- super.setCurrentScreen(lightKnxMainTestScreen);
- result = true;
- break;
- case ID.screen.HeatingV2TestScreen: // sub - 공지사항 내용
- HeatingV2TestScreen heatingV2TestScreen = new HeatingV2TestScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mRoomNameList_Heating);
- super.setCurrentScreen(heatingV2TestScreen);
- mCurrentMultiScreenId = ID.screen.HeatingV2TestScreen;
- result = true;
- break;
- case ID.screen.GasTestScreen: // 가스
- HybridCookTopTestScreen hybridCookTopTestScreen = new HybridCookTopTestScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(hybridCookTopTestScreen);
- result = true;
- break;
- case ID.screen.VentiMainTestScreen: // 환기
- VentilationMainTestScreen ventilationMainTestScreen = new VentilationMainTestScreen(this, ScreenLayout, wpapi, OPERATION_MODE, nScreenId);
- super.setCurrentScreen(ventilationMainTestScreen);
- result = true;
- break;
- default:
- result = false;
- break;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- }
- catch (Exception e) {
- 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;
- }
- }
- 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<String> arrayList = new ArrayList<String>();
- 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();
- 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();
- mWallpadDeviceSet.closeDB();
- WallpadStatusData mWallpadStatusData = new WallpadStatusData(getContext());
- boolean bElecOutletUsage = mWallpadStatusData.Get_MultiSwitch_Concent_Use();
- mWallpadStatusData.closeDB();
- int nChildCnt = 0;
- //[수정필요]
- //추가 또는 수정해야할 부분 1. - Menu정보가 DB에 없을 경우 불러올 스크린 종류(시작)
- if (nLightType[0] == WallpadDeviceSet.DO_USE) {
- arrayList.add(API_Menu.SubMenuCtrl.Name_Lamp);
- nChildCnt++;
- }
- if (nLightType[1] == WallpadDeviceSet.LIGHT_TYPE_ROOM || nLightType[1] == WallpadDeviceSet.LIGHT_TYPE_HDC_INTLIGHT_ADD_BATCHLIGHT_MULTISWITCH) {
- Log.i(TAG, "[loadDefaultMenuList] bElecOutletUsage = " + bElecOutletUsage + " @@@@@@@@@@@@@@@@");
- Log.i(TAG, "[loadDefaultMenuList] MultiConcentExist = " + bMultiConcentExist + " @@@@@@@@@@@@@@@@");
- if ((OPERATION_MODE == Common.MODE_BUSINESS_SAMPLE) || (nLightType[0] == 1 && bElecOutletUsage && bMultiConcentExist)) {
- // Log.i(TAG, "[loadDefaultMenuList] Add Concent @@@@@@@@@@@@@@@@");
- 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 (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++;
- }
- //for test
- arrayList.add(API_Menu.SubMenuCtrl.Name_ParkingDoor);
- nChildCnt++;
- //추가 또는 수정해야할 부분 1. - Menu정보가 DB에 없을 경우 불러올 스크린 종류(끝)
- Log.i(TAG, "[loadDefaultMenuList] 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를 임의로 입력(시작)
- // Log.d(TAG, "[loadDefaultMenuList] arrayList.get(" + i + ") = " + arrayList.get(i));
- 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) {
- 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 (nLightType[1] == WallpadDeviceSet.LIGHT_TYPE_HDC_INTLIGHT_ADD_BATCHLIGHT_MULTISWITCH) {
- if ((OPERATION_MODE == Common.MODE_BUSINESS_SAMPLE) || (bElecOutletUsage && bMultiConcentExist)) {
- tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.HDCLivingNEach_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_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 if (arrayList.get(i).equals(API_Menu.SubMenuCtrl.Name_ParkingDoor)) {
- tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.ParkingDoor;
- tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_ParkingDoor;
- }
- else {
- Log.w(TAG, "[loadDefaultMenuList] arrayList.get(" + i + ") is not supported menu!!");
- }
- //추가 또는 수정해야할 부분 2. - 불러올 스크린의 ID를 임의로 입력(끝)
- }
- // for (int j = 0; j < tempMenuListDataClass.idMappingTable.length; j++) {
- // Log.d(TAG, "[loadDefaultMenuList] tempMenuListDataClass.idMappingTable[" + j + "].Name = " + tempMenuListDataClass.idMappingTable[j].Name);
- // Log.d(TAG, "[loadDefaultMenuList] tempMenuListDataClass.idMappingTable[" + j + "].Id = " + tempMenuListDataClass.idMappingTable[j].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<ActivityManager.RunningAppProcessInfo> 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<ActivityManager.RunningServiceInfo> 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);
- }
- 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) {
- if (TopBoilerBtn != null && TopBoilerBtn.getVisibility() == View.VISIBLE) {
- WpadUtil.ViewMove(TopManualBtn, 893, 0);
- }
- else {
- WpadUtil.ViewMove(TopManualBtn, 1019, 0);
- }
- }
- }
- return true;
- }
- /**
- * 상단 KCC디밍조절 버튼 활성화 & 비활성화
- *
- * @param Enabled - true : 활성화, false : 비활성화
- * @return (boolean) true : 성공, false : 실패
- */
- public void setMultiBtnVisible(boolean Enabled) {
- for (int i = 0; i < MultiBtn.length; i++) {
- if (Enabled == true) {
- if (MultiBtn[i].getVisibility() != View.VISIBLE)
- MultiBtn[i].setVisibility(View.VISIBLE);
- MultiBtn[i].bringToFront();
- MultiBtn[i].setButtonFrontImage();
- } else {
- if (MultiBtn[i].getVisibility() != View.INVISIBLE)
- MultiBtn[i].setVisibility(View.INVISIBLE);
- }
- }
- if (myIP.equals("10.1.1.2")) {
- MultiBtn[1].setButtonRearImage();
- } else if (myIP.equals("10.1.1.1")) {
- MultiBtn[0].setButtonRearImage();
- } else if (myIP.equals("10.1.1.3")) {
- MultiBtn[2].setButtonRearImage();
- }
- }
- /**
- * 멀티 제어 층 버튼 활성화 & 비활성화
- *
- * @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();
- }
- }
- public static int nResidentSafetyCheckSetting = WallpadDeviceSet.RESIDENT_SAFETY_CHECK_DISABLE;
- private void getResidentSafetyCheckSetting() {
- try {
- WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(getApplicationContext());
- nResidentSafetyCheckSetting = mWallpadDeviceSet.getResidentSafetyCheck();
- mWallpadDeviceSet.closeDB();
- Log.e(TAG, "[getResidentSafetyCheckSetting] nResidentSafetyCheckSetting: " + nResidentSafetyCheckSetting);
- if (nResidentSafetyCheckSetting == WallpadDeviceSet.RESIDENT_SAFETY_CHECK_ENABLE) Version.setResidentSafety();
- else Version.unsetResidentSafety();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getResidentSafetyCheckSetting()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /**
- * 멀티제어 관련.
- *
- * */
- public String millToDate(long mills) {
- String pattern = "yyyy-MM-dd'T'HH:mm:ss";
- SimpleDateFormat formatter = new SimpleDateFormat(pattern);
- String date = (String) formatter.format(new Timestamp(mills));
- return date;
- }
- class ClientThread extends Thread {
- private Handler handler;
- private String category;
- private int menu, kind, reason, state, position;
- private int roomNumber;
- public ClientThread(Handler handler, int menu, int kind, int reason, int position, String category, int roomNumber, int state) {
- this.handler = handler;
- this.menu = menu;
- this.kind = kind;
- this.reason = reason;
- this.position = position;
- this.category = category;
- this.roomNumber = roomNumber;
- this.state = state;
- }
- public ClientThread(Handler handler, int menu, int kind, int reason, int position) {
- this.handler = handler;
- this.menu = menu;
- this.kind = kind;
- this.reason = reason;
- this.position = position;
- }
- public void run() {
- //String host = "10.1.1.1";
- //String host = "10.1.1.2";
- String host = "10.1.1." + mMultiAddress;
- int port = 9998;
- String json = "";
- // build jsonObject
- JSONObject jsonObject = new JSONObject();
- JSONObject dataJsonObject = new JSONObject();
- try {
- jsonObject.accumulate("type", "request");
- jsonObject.accumulate("timestamp", millToDate(System.currentTimeMillis()));
- jsonObject.accumulate("wallpadip", myIP);
- jsonObject.accumulate("menu", menu);
- jsonObject.accumulate("kind", kind);
- jsonObject.accumulate("reason", reason);
- jsonObject.accumulate("position", position);
- //제어
- if (reason == Common.JSON.REASON.Control) {
- dataJsonObject.accumulate("category", category);
- dataJsonObject.accumulate("number", roomNumber);
- dataJsonObject.accumulate("state", state);
- }
- jsonObject.accumulate("data", dataJsonObject);
- } catch (JSONException e) {
- e.printStackTrace();
- }
- // convert JSONObject to JSON to String
- json = jsonObject.toString();
- try {
- Socket socket = new Socket();
- InetSocketAddress ipep = new InetSocketAddress(host, port); // 방법 2
- socket.connect(ipep);
- ObjectOutputStream outputStream = new ObjectOutputStream(socket.getOutputStream());
- outputStream.writeObject(json);
- Log.d("ClientThread", "서버로 보냄.");
- ObjectInputStream inputStream = new ObjectInputStream(socket.getInputStream());
- StringBuffer stb = new StringBuffer();
- String data;
- while (true) {
- try {
- socket.setSoTimeout(5000);
- data = (String) inputStream.readObject();
- if (data == null) {
- break;
- }
- stb.append(data);
- } catch (Exception e) {
- if (socket != null) {
- socket.close();
- }
- if (inputStream != null) {
- inputStream.close();
- }
- if (outputStream != null) {
- outputStream.close();
- }
- break;
- }
- }
- if (socket != null) {
- socket.close();
- }
- if (inputStream != null) {
- inputStream.close();
- }
- if (outputStream != null) {
- outputStream.close();
- }
- final String response = String.valueOf(stb);
- Log.d("ClientThread", "response=" + response);
- final String finalResponse = response;
- Message message = handler.obtainMessage();
- message.what = 1000;
- Bundle bundle = new Bundle();
- bundle.putString("response", finalResponse);
- message.setData(bundle);
- handler.sendMessage(message);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- public void requestMultiControl(Handler handler, int menu, int kind, int reason, int position, String category, int number, int state) {
- ClientThread thread = new ClientThread(handler, menu, kind, reason, position, category, number, state);
- thread.start();
- }
- public void requestMultiStatus(Handler handler, int menu, int kind, int reason, int position) {
- ClientThread thread = new ClientThread(handler, menu, kind, reason, position);
- thread.start();
- }
- }
|