1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784 |
- 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.Arrays;
- 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.KnxSystemAirconMainScreen;
- 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.KnxSystemAirconMainTestScreen;
- 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 KnxSystemAirconMainScreen knxSystemAirconMainScreen = null;
- private PurityMainScreen purityMainScreen = null;
- private ParkingDoorMainScreen parkingDoorMainScreen = null;
- // 명칭 관련
- public static final int HEATING = 1;
- public static final int LIGHT = 2;
- public static final int CONCENT = 3;
- public static final int SYSTEMAIRCON = 4;
- public static boolean bRoomNameEditUse = false; // 방 명칭 수정 사용 여부
- public String[] mRoomNameList_Light = null; //조명 방 명칭
- public String[] mRoomNameList_Heating = null; //난방 방 명칭
- public String[] mRoomNameList_Concent = null; //콘센트 방 명칭
- public String[] mRoomNameList_SystemAircon = null; //시스템에어컨 방 명칭
- public String[] mRoomNameList_Purity = null; //삼성청정환기 방 명칭
- public String[] mRoomNameList_Shading = 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();
- runMultiControlService();
- }
- super.AppVersionLogOut(); // [APP Version] + [WallPadSupport Lib Version] 을 로그로 출력한다.
- Log.i("[onCreate] Version", "<><><><> WallPadAPI Version = [" + define.WALLPADAPI_VERSION + "] " + "<><><><>");
- // 1. 변수 초기화
- DebugLogOutput("[Create] - Step1 : Data Create");
- PopupActivityRun = false;
- ManualActivityRun = false;
- mPowerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
- mV40IF = new V40IF();
- mContext = this;
- mDimData = new DimData();
- mHideMenuOn = false;
- // 2. 자동 종료 셋팅
- DebugLogOutput("[Create] - Step2 : Auto Finish Setting");
- // 2-1. 자동종료 타이머 셋팅
- if (Common.FINISH_TIME_ENABLE) super.setFinishTimerCreate(Common.FINISH_TIME_SEC);
- Common.ctrlLCDOnOff(true);
- // 3. API 호출
- DebugLogOutput("[Create] - Step3 : API Call");
- if (Common.GetDeviceSampleMode(this)) OPERATION_MODE = Common.MODE_BUSINESS_SAMPLE;
- else OPERATION_MODE = Common.MODE_NOMAL;
- // 3.1. wpapi 생성
- if (OPERATION_MODE == Common.MODE_NOMAL) {
- Log.d(TAG, "[onCreate] OperationMode = MODE_NOMAL");
- try {
- wpapi = new WallPadAPI(this);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[ExceptionError] - new WallPadAPI : " + e);
- }
- }
- else if (OPERATION_MODE == Common.MODE_BUSINESS_SAMPLE) {
- Log.d(TAG, "[onCreate] OperationMode = MODE_BUSINESS_SAMPLE");
- try {
- wpapi = new WallPadAPI(this);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[ExceptionError] - new WallPadAPI : " + e);
- }
- }
- try {
- wdb = new WallpadStatusData(this);
- wallpaddbmgr.AddressSet addc = wdb.getAddressMGR(); //DB에서 동호 정보 받아옴
- if (wdb != null) wdb.closeDB();
- //동, 호, ip 정보 저장
- myIP = addc.IPAddress;
- myDong = addc.Dong;
- myHo = addc.Ho;
- if(!myHo.equals("NONE")) {
- ho = Integer.valueOf(myHo.substring(0, 1));
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[ExceptionError] - onCreate->WallpadStatusData Create : " + e);
- }
- getConstructionFunction();
- WallpadDeviceSet deviceSet = new WallpadDeviceSet(getContext());
- bRoomNameEditUse = deviceSet.Get_RoomNameEditUse();
- deviceSet.closeDB();
- Log.d(TAG, "[Create] bRoomNameEditUse [" + bRoomNameEditUse + "]");
- GetRoomNameV2(); // 방명칭 수정 시나리오 적용
- //if (bRoomNameEditUse) GetRoomNameV2(); // 방명칭 수정 시나리오 적용
- //else 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.d(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();
- 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 @@@@@@@@@@@@@@@@@@@@");
- }
- // 거주자 안전확인 서비스 사용여부 확인하고, 화면 WallPadSupport Lib.에 관련 설정을 한다.
- // 성북동 주택은 생략
- if (Version.getModelType() != Version.MODEL_TYPE.IHN_D101_I_LX2) {
- 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 && Version.getModelType() != Version.MODEL_TYPE.IHN_D101_I_LX2) {
- 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.d(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.d(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) {
- ViewRegistration(TopLayout, TopManualBtn, marginLeft, 0);
- TopManualBtn.setVisibility(View.VISIBLE);
- }
- 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 (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[i].setButtonEventOffDisable();
- }
- 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) {
- if(ho==2){
- setChangeScreen(API_Menu.SubMenuCtrl.Gas, false);
- }else{
- StartMultiControl(ID.screen.GasTestScreen, 2);
- }
- //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) {
- MultiBtn[0].setButtonEventOffEnable(R.drawable.tab_floor_1_disabled);
- MultiBtn[1].setButtonEventOffEnable(R.drawable.tab_floor_2_selected);
- MultiBtn[2].setButtonEventOffEnable(R.drawable.tab_floor_3_disabled);
- //다른층은 2층으로 연동시킨다.
- StartMultiControl(ID.screen.GasTestScreen, 2);
- } else if (mCurrentScreenId == API_Menu.SubMenuCtrl.SystemAircon) {
- StartMultiControl(ID.screen.KnxSystemAirconMainTestScreen, index+1);
- //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);
- intent.putExtra("Ho", mMultiAddress);
- 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("Ho", mMultiAddress);
- 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 {
- if(mCurrentMultiScreenId == ID.screen.LightKnxMainTestScreen||mCurrentMultiScreenId == ID.screen.HeatingV2TestScreen
- ||mCurrentMultiScreenId == ID.screen.KnxSystemAirconMainTestScreen||mCurrentMultiScreenId == ID.screen.VentiMainTestScreen){
- if(resultCode==0&&data==null){
- super.onActivityResult(requestCode, 10000, data);
- }
- }
- 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:
- case ID.screen.LightKnxMainTestScreen:
- 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:
- case ID.screen.GasTestScreen:
- 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:
- case ID.screen.VentiMainTestScreen:
- 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:
- case ID.screen.KnxSystemAirconMainTestScreen:
- SetTitleText(API_Menu.SubMenuCtrl.Name_SystemAircon);
- ret = true;
- break;
- case API_Menu.SubMenuCtrl.Purity:
- SetTitleText(API_Menu.SubMenuCtrl.Name_Purity);
- ret = true;
- break;
- case API_Menu.SubMenuCtrl.ParkingDoor:
- SetTitleText(API_Menu.SubMenuCtrl.Name_ParkingDoor);
- 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);
- GetRoomNameV2(); // 스크린 체인지 시 방명칭 수정 적용되어야 함.
- //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);
- if(ho==2) {
- hybridCookTopMainScreen = new HybridCookTopMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(hybridCookTopMainScreen);
- }else {
- StartMultiControl(ID.screen.GasTestScreen, 2);
- }
- }
- else
- {
- SetTitleText(API_Menu.SubMenuCtrl.Name_Gas);
- if(ho==2) {
- hybridCookTopMainScreen = new HybridCookTopMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(hybridCookTopMainScreen);
- }else {
- StartMultiControl(ID.screen.GasTestScreen, 2);
- }
- //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);
- setGasMultiBtnVisible(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, mRoomNameList_Concent);
- 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_Concent);
- 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);
- if (nDistributionPanelType == Version.DISTRIBUTION_MODEL.KNX_DIST) {
- // KNX 분전반
- knxSystemAirconMainScreen = new KnxSystemAirconMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mRoomNameList_SystemAircon);
- super.setCurrentScreen(knxSystemAirconMainScreen);
- }else {
- systemAirconMainScreen = new SystemAirconMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mRoomNameList_SystemAircon);
- 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: // 시스템 에어컨
- SystemAirconTestScreen systemAirconTest1Screen = new SystemAirconTestScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mDefaultRoomNameList);
- super.setCurrentScreen(systemAirconTest1Screen);
- result = true;
- break;
- case ID.screen.KnxSystemAirconMainTestScreen: // 시스템 에어컨
- KnxSystemAirconMainTestScreen knxSystemAirconMainTestScreen = new KnxSystemAirconMainTestScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mDefaultRoomNameList);
- super.setCurrentScreen(knxSystemAirconMainTestScreen);
- mCurrentMultiScreenId = ID.screen.KnxSystemAirconMainTestScreen;
- result = true;
- break;
- case ID.screen.LightKnxMainTestScreen: // 조명
- LightKnxMainTestScreen lightKnxMainTestScreen = new LightKnxMainTestScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mRoomNameList_Light);
- super.setCurrentScreen(lightKnxMainTestScreen);
- mCurrentMultiScreenId = ID.screen.LightKnxMainTestScreen;
- result = true;
- break;
- case ID.screen.HeatingV2TestScreen: // 난방
- 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);
- mCurrentMultiScreenId = ID.screen.VentiMainTestScreen;
- 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();
- int nConcentEnable = mWallpadDeviceSet.Get_Concent_Info(); // 콘센트 사용 유무
- boolean bInterWPMultiCtrlUsage = mWallpadDeviceSet.Get_InterWallPadMultiCtrlUsage(); // 월패드간 제어기기 멀티제어 지원여부
- 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 || bInterWPMultiCtrlUsage) {
- 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_D101_I_LX2
- || 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) {
- if(nConcentEnable==WallpadDeviceSet.DO_USE) {
- 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++;
- }
- // 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);
- }
- }
- private void runMultiControlService() {
- ActivityManager mActivityManager = (ActivityManager)getApplicationContext().getSystemService(Context.ACTIVITY_SERVICE);
- List<ActivityManager.RunningAppProcessInfo> RunningAppList = mActivityManager.getRunningAppProcesses();
- for (int i = 0; i < RunningAppList.size(); i++) {
- ActivityManager.RunningAppProcessInfo RunningAppListInfo = RunningAppList.get(i);
- if (RunningAppListInfo.processName.equals("kr.co.icontrols.wallpadmulticontrolservice")) {
- Log.w(TAG, "[runMultiControlService] runMultiControlService is already running");
- return;
- }
- }
- Log.i(TAG, "[runMultiControlService] Start runMultiControlService!!");
- Intent mIntent = new Intent("wallpadmulticontrolservice.DataSenderService");
- startService(mIntent);
- }
- /**
- * 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(define.ROOM_NAME_HEATING);
- }
- else {
- RoomNameList = wallpadStatusData.GetDevRoomName(define.ROOM_NAME_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;
- }
- private String[] getRoomNameFromDBV2(String strDeviceType) {
- try {
- String[] RoomNameList = null;
- WallpadStatusData wallpadStatusData = new WallpadStatusData(getContext().getApplicationContext());
- RoomNameList = wallpadStatusData.GetDevRoomNameList(strDeviceType);
- wallpadStatusData.closeDB();
- if (RoomNameList == null) {
- Log.e(TAG, "[getRoomNameFromDBV2] - RoomNameList is null !!!");
- return null;
- }
- Log.i(TAG, "[getRoomNameFromDBV2] RoomNameList " + Arrays.toString(RoomNameList));
- return RoomNameList;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getRoomNameFromDBV2(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;
- }
- }
- }
- mRoomNameList_Concent = mDefaultRoomNameList;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] GetRoomName()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private void GetRoomNameV2() {
- try {
- Log.i(TAG, "[GetRoomNameV2] START");
- mRoomNameList_Light = getRoomNameFromDBV2(define.ROOM_NAME_LIGHT);
- mRoomNameList_Heating = getRoomNameFromDBV2(define.ROOM_NAME_HEATING);
- mRoomNameList_Concent = getRoomNameFromDBV2(define.ROOM_NAME_CONCENT);
- mRoomNameList_SystemAircon = getRoomNameFromDBV2(define.ROOM_NAME_SYSTEMAIRCON);
- mRoomNameList_Purity = getRoomNameFromDBV2(define.ROOM_NAME_PURITY);
- mRoomNameList_Shading = getRoomNameFromDBV2(define.ROOM_NAME_SHADING);
- Log.i(TAG, "[GetRoomNameV2] mRoomNameList_Light: Length [" + mRoomNameList_Light.length + "], " + Arrays.toString(mRoomNameList_Light));
- Log.i(TAG, "[GetRoomNameV2] mRoomNameList_Heating: Length [" + mRoomNameList_Heating.length + "], " + Arrays.toString(mRoomNameList_Heating));
- Log.i(TAG, "[GetRoomNameV2] mRoomNameList_Concent: Length [" + mRoomNameList_Concent.length + "], " + Arrays.toString(mRoomNameList_Concent));
- Log.i(TAG, "[GetRoomNameV2] mRoomNameList_SystemAircon: Length [" + mRoomNameList_SystemAircon.length + "], " + Arrays.toString(mRoomNameList_SystemAircon));
- Log.i(TAG, "[GetRoomNameV2] mRoomNameList_Purity: Length [" + mRoomNameList_Purity.length + "], " + Arrays.toString(mRoomNameList_Purity));
- Log.i(TAG, "[GetRoomNameV2] mRoomNameList_Shading: Length [" + mRoomNameList_Shading.length + "], " + Arrays.toString(mRoomNameList_Shading));
- } 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;
- }
-
- /**
- * 멀티 제어 층 버튼 활성화 & 비활성화
- *
- * @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();
- MultiBtn[i].setButtonEventOffDisable();
- } else {
- if (MultiBtn[i].getVisibility() != View.INVISIBLE)
- MultiBtn[i].setVisibility(View.INVISIBLE);
- }
- }
- if (myIP.equals("10.1.2.1")) {
- MultiBtn[1].setButtonRearImage();
- } else if (myIP.equals("10.1.1.1")) {
- MultiBtn[0].setButtonRearImage();
- } else if (myIP.equals("10.1.3.1")) {
- MultiBtn[2].setButtonRearImage();
- }
- }
- /**
- * 멀티 가스 제어 층 버튼 활성화 & 비활성화
- *
- * @param Enabled - true : 활성화, false : 비활성화
- * @return (boolean) true : 성공, false : 실패
- */
- public void setGasMultiBtnVisible(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);
- }
- }
- //MultiBtn[1].setButtonRearImage();
- MultiBtn[0].setButtonEventOffEnable(R.drawable.tab_floor_1_disabled);
- MultiBtn[1].setButtonEventOffEnable(R.drawable.tab_floor_2_selected);
- MultiBtn[2].setButtonEventOffEnable(R.drawable.tab_floor_3_disabled);
- }
- /**
- * 상단 KCC디밍조절 버튼 활성화 & 비활성화
- *
- * @param Enabled - true : 활성화, false : 비활성화
- * @return (boolean) true : 성공, false : 실패
- */
- public void setKccDimmBtnVisible(boolean Enabled) {
- WallpadDeviceSet wdst = new WallpadDeviceSet(getContext());
- int dimmUse = wdst.GetDeviceSetted("KCC디밍제어기"); // 1: 사용안함 / 2: 사용함
- wdst.closeDB();
- Log.i(TAG, "[setKccDimmBtnVisible] - KCC Dimm : " + dimmUse);
- // null, 사용안함 이면 안나오도록 한다.
- if (dimmUse == 0 || dimmUse == 1) {
- Log.w(TAG, "[setKccDimmBtnVisible] - KCC Dimm NOT USE !!!");
- Enabled = false;
- KccDimUse = 0;
- }
- else {
- KccDimUse = 1;
- }
- for (int i = 0; i < TopDimmingBtn.length; i++) {
- if (Enabled == true) {
- if (TopDimmingBtn[i].getVisibility() != View.VISIBLE)
- TopDimmingBtn[i].setVisibility(View.VISIBLE);
- TopDimmingBtn[i].bringToFront();
- }
- else {
- if (TopDimmingBtn[i].getVisibility() != View.INVISIBLE)
- TopDimmingBtn[i].setVisibility(View.INVISIBLE);
- }
- }
- }
- /**
- * 조명제어기의 디밍 레벨을 조절한다.
- *
- * @param Level - 디밍레벨
- * @return (int) - >=0 : 성공, <0 : 실패
- */
- private int Device_SetDimmingLevel(byte Level) {
- DebugLogOutput("[Device_SetAllDimmingLevel] - Start (Level : " + Level + ")");
- // 1. Api Load Check
- if (ledDimmingAPI == null) {
- Log.e(TAG, "[Device_SetAllDimmingLevel] ledDimmingAPI unload !!!");
- return -1;
- }
- // 2. Param Range Check
- if (mDimData.DimData.DeviceCnt == 0) {
- Log.w(TAG, "[Device_SetAllDimmingLevel] mData.DeviceCnt == 0");
- return -2;
- }
- // 3. Light Control
- try {
- int ret = ledDimmingAPI.SetDimmingLevel(0, Level);
- if (ret < 0) {
- Log.e(TAG, "[Device_SetAllDimmingLevel] SetAllDimmingLevel Error (" + ret + ") ErrorCode = " + ledDimmingAPI.ErrorCode.ErrStr());
- return -6;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -100;
- }
- catch (Exception e) {
- Log.e(TAG, "[Device_SetAllDimmingLevel] - [Exception Error] ledDimmingAPI.SetAllDimmingLevel()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -100;
- }
- DebugLogOutput("[Device_SetAllDimmingLevel] - OK");
- return 0;
- }
- private void Draw_Update_DimmBtn() {
- // 디밍 표시
- Log.i(TAG, "[Draw_Update_DimmBtn] - Dimming Draw Start");
- if (mDimData.DimData == null) {
- Log.w(TAG, "[Draw_Update_DimmBtn] - mDimData.DimData null");
- return;
- }
- else {
- Log.i(TAG, "[Draw_Update_DimmBtn] - mDimData.DimData normal");
- }
- byte Level = mDimData.DimData.Device[0].device.Level;
- Log.i(TAG, "[Draw_Update_DimmBtn] - Level =" + Level);
- for (int i = 0; i < 4; i++) {
- if (Level == mLevelArray[i]) {
- Log.i(TAG, "[Draw_Update_DimmBtn] - Same Level Button i = " + i);
- TopDimmingBtn[i].setButtonRearImage();
- }
- else {
- Log.i(TAG, "[Draw_Update_DimmBtn] - Diff Level Button i = " + i);
- TopDimmingBtn[i].setButtonFrontImage();
- }
- }
- Log.i(TAG, "[Draw_Update_DimmBtn] - Dimming Draw End");
- }
- /**
- * KCC 디밍제어기의 상태를 갱신한다.
- *
- * @param real - (boolean) true : 실시간 , false : 가장최근
- * @param index - (byte) 방 인덱스 (0~5개별방, Common.INDEX_ALL 전체)
- * @return (int) - >=0 : 성공, <0 : 실패
- */
- private int Device_Update_Dimming(boolean real, byte index) {
- DebugLogOutput("[Device_Update_Dimming] - Start (real : " + real + ", index:" + index + ")");
- // 1. Api Load Check
- if (ledDimmingAPI == null) {
- Log.e(TAG, "[Device_Update_Dimming] ledDimmingAPI unload !!!");
- return -1;
- }
- // 2. refresh
- try {
- int ret = ledDimmingAPI.Refresh(index, real);
- if (ret < 0) {
- Log.e(TAG, "[Device_Update_Dimming] Refresh(" + index + ", " + real + ") ret = " + ret + " / ErrorCode = " + ledDimmingAPI.ErrorCode.ErrStr());
- return -2;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -100;
- }
- catch (Exception e) {
- Log.e(TAG, "[Device_Update_Dimming] - [Exception Error] ledDimmingAPI.Refresh(index:" + index + ", real:" + real + ")");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -100;
- }
- // 3. Range Check
- if (ledDimmingAPI.data.DeviceCnt <= 0) {
- Log.e(TAG, "[Device_Update_Dimming] - DeviceCnt Out of range !!! (DeviceCnt:" + ledDimmingAPI.data.DeviceCnt + ")");
- return -10;
- }
- // 4. Data Copy
- mDimData.DimData = ledDimmingAPI.data;
- // 5. Debug Msg
- DebugLogOutput("---------------------------------------");
- DebugLogOutput("[Device_Update_Dimming]");
- DebugLogOutput("---------------------------------------");
- DebugLogOutput("DeviceCnt = " + ledDimmingAPI.data.DeviceCnt);
- byte DeviceCnt = ledDimmingAPI.data.DeviceCnt;
- if (index == define.DEVICE_ALL_OR_NOTHING) {
- for (byte i = 0; i < DeviceCnt; i++) {
- DebugLogOutput(ledDimmingAPI.data.Device[i].info.ToDebugString(i));
- DebugLogOutput(ledDimmingAPI.data.Device[i].device.ToDebugString(i));
- }
- }
- else {
- DebugLogOutput(ledDimmingAPI.data.Device[index].device.ToDebugString(index));
- }
- DebugLogOutput("---------------------------------------");
- DebugLogOutput("[Device_Update_Dimming] - OK");
- return 0;
- }
- /**
- * 현관호출 or 전화호출시 사용되는 keycode - Broadcast 을 송신한다.
- *
- * @param code - (int) 송신할 keycode
- * @return (int) - >=0 : 성공, <0 : 실패
- */
- private int setSendEventBR(int code) {
- try {
- KeyEvent event = new KeyEvent(KeyEvent.ACTION_UP, code);
- Intent intent = new Intent("EVENT_DEVICE_CONTROL", null);
- intent.putExtra(Intent.EXTRA_KEY_EVENT, event);
- intent.putExtra("keycode",code);
- getContext().sendBroadcast(intent);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -100;
- }
- catch (Exception e) {
- Log.e(TAG, "[setSendEventBR] - [Exception Error] code:" + code);
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -100;
- }
- return 0;
- }
- /**
- * 히든메뉴의 버튼 타임아웃을 설정한다.
- */
- private void HideMenu_setTimeOut() {
- if (mHideMenuTimer != null) mHideMenuTimer.cancel();
- mHideMenuTimer = new CountDownTimer( 1 * 1000, 1000) {
- @Override
- public void onFinish() {
- Log.d(TAG, "mHideMenuTimer - onFinish !!!");
- mHideMenuEntryStatus = 0;
- }
- @Override
- public void onTick(long millisUntilFinished) {
- }
- };
- mHideMenuTimer.cancel();
- mHideMenuTimer.start();
- }
- /**
- * 히든메뉴 진입용 프로세스
- *
- * @param TargetId - 히든메뉴용 버튼 ID
- */
- private void HideMenuEntryProc(int TargetId) {
- if (OPERATION_MODE != Common.MODE_NOMAL) return;
- if (mHideMenuOn) return;
- if (TargetId == ID.main.button.HIDE1) {
- if (mHideMenuEntryStatus == 0) { mHideMenuEntryStatus = 1; HideMenu_setTimeOut(); }
- else if (mHideMenuEntryStatus == 2) { mHideMenuEntryStatus = 3; HideMenu_setTimeOut(); }
- else if (mHideMenuEntryStatus == 4) { mHideMenuEntryStatus = 5; HideMenu_setTimeOut(); }
- }
- else if (TargetId == ID.main.button.HIDE2) {
- if (mHideMenuEntryStatus == 1) { mHideMenuEntryStatus = 2; HideMenu_setTimeOut(); }
- else if (mHideMenuEntryStatus == 3) { mHideMenuEntryStatus = 4; HideMenu_setTimeOut(); }
- else if (mHideMenuEntryStatus == 5) {
- mHideMenuEntryStatus = 6;
- mHideMenuOn = true;
- if (mHideMenuTimer != null) {
- mHideMenuTimer.cancel();
- mHideMenuTimer = null;
- TopBackground.setImageResource(0);
- TopBackground.setBackgroundColor(Color.RED);
- Sound().Play(SND.call.CALLSTART);
- super.setFinishTimerDestroy();
- Log.i(TAG, "================================");
- Log.i(TAG, "[HideMenu] START !!!!!");
- Log.i(TAG, "================================");
- }
- }
- }
- }
- public boolean GetEasyModeUXUse() {
- try {
- WallpadDeviceSet deviceSet = new WallpadDeviceSet(mContext);
- boolean bSupport = deviceSet.Get_EasyModeUX_Support();
- deviceSet.closeDB();
- WallpadStatusData data = new WallpadStatusData(mContext);
- boolean bUse = data.GetEasyModeUxUse();
- data.closeDB();
- Log.d(TAG, "[GetEasyModeUXUse] bSupport [" + bSupport + "], bUse [" + bUse + "]");
- return bSupport & bUse;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] GetEasyModeUXUse()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- return false;
- }
- public boolean getAirSensorAPUsage() {
- try {
- boolean bUsage = false;
- WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(getApplicationContext());
- int nAirQualityEnable = mWallpadDeviceSet.GetDeviceSetted("센서AP");
- mWallpadDeviceSet.closeDB();
- if(nAirQualityEnable == WallpadDeviceSet.DEV_DATA_ENABLE) bUsage = true;
- Log.d(TAG, "[getAirSensorAPUsage] bUsage [" + bUsage + "]");
- return bUsage;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] getAirSensorAPUsage()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- return false;
- }
- /**
- * 제어기 상태를 가져온다.
- *
- * @param bReal - (boolean) true : 실시간 , false : 가장최근
- * @return (int) - >=0 : 성공, <0 : 실패
- */
- private int updateVentilatorData(boolean bReal) {
- Log.i(TAG, "[updateVentilatorData] - Start (bReal : " + bReal + ")");
- // 1. Api Load Check
- if (mVentilAPI == null) {
- Log.e(TAG, "[updateVentilatorData] - mVentilAPI unload !!!");
- return -1;
- }
- // 2. reflash
- try {
- int ret = mVentilAPI.Refresh(bReal);
- if (ret < 0) {
- Log.e(TAG, "[updateVentilatorData] Refresh - ret (" + ret + ") ErrorCode = " + mVentilAPI.ErrorCode.ErrStr());
- return -2;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -100;
- }
- catch (Exception e) {
- Log.e(TAG, "[updateVentilatorData] - [Exception Error] mVentilAPI.Refresh(" + bReal + ")");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -100;
- }
- // 3. Data Copy
- VentilStatus = mVentilAPI.data;
- // 4. Debug Msg
- Log.i(TAG, VentilStatus.ToDebugString());
- Log.i(TAG, VentilStatus.ToFaultString());
- Log.i(TAG, "[updateVentilatorData] - OK");
- return 0;
- }
- /**
- * Knx 환기 제어기 상태를 가져온다.
- *
- * @param bReal - (boolean) true : 실시간 , false : 가장최근
- * @return (int) - >=0 : 성공, <0 : 실패
- */
- private int updateKnxVentilatorData(boolean bReal) {
- Log.i(TAG, "[updateKnxVentilatorData] - Start (bReal : " + bReal + ")");
- // 1. Api Load Check
- if (mKnxVentilAPI == null) {
- Log.e(TAG, "[updateKnxVentilatorData] - mVentilAPI unload !!!");
- return -1;
- }
- // 2. reflash
- try {
- int ret = mKnxVentilAPI.Refresh(Common.INDEX_ALL, bReal);
- if (ret < 0) {
- Log.e(TAG, "[updateKnxVentilatorData] Refresh - ret (" + ret + ") ErrorCode = " + mKnxVentilAPI.ErrorCode.ErrStr());
- return -2;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -100;
- }
- catch (Exception e) {
- Log.e(TAG, "[updateKnxVentilatorData] - [Exception Error] mKnxVentilAPI.Refresh(" + bReal + ")");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -100;
- }
- // 3. Data Copy
- VentilStatus = mKnxVentilAPI.data.Device[0];
- // 4. Debug Msg
- Log.i(TAG, VentilStatus.ToDebugString());
- Log.i(TAG, VentilStatus.ToFaultString());
- Log.i(TAG, "[updateVentilatorData] - OK");
- return 0;
- }
- public static int nConstructionFunction = WallpadDeviceSet.CONSTRUCTION_SPECIAL_FUNCTION_NONE;
- private void getConstructionFunction() {
- try {
- WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(getApplicationContext());
- nConstructionFunction = mWallpadDeviceSet.Get_Construction_SpecialFunc();
- mWallpadDeviceSet.closeDB();
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getConstructionFunction()");
- e.printStackTrace();
- }
- }
- 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, position;
- private int roomNumber;
- private double doubleState;
- private byte[] arrayState;
- private int state = -9999;
- int dong=0;
- 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 dong, int kind, int reason, int position, String category, int roomNumber, int state) {
- this.handler = handler;
- this.menu = menu;
- this.dong = dong;
- 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, String category, int roomNumber, double state) {
- this.handler = handler;
- this.menu = menu;
- this.kind = kind;
- this.reason = reason;
- this.position = position;
- this.category = category;
- this.roomNumber = roomNumber;
- this.doubleState = state;
- }
- public ClientThread(Handler handler, int menu, int kind, int reason, int position, String category, int roomNumber, byte[] state) {
- this.handler = handler;
- this.menu = menu;
- this.kind = kind;
- this.reason = reason;
- this.position = position;
- this.category = category;
- this.roomNumber = roomNumber;
- this.arrayState = state;
- this.state = -1111;
- }
- 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";
- if(dong==0) {
- host = "10.1." + mMultiAddress + ".1";
- }else{
- host = "10.1." + dong + ".1";
- }
- 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("number", roomNumber);
- dataJsonObject.accumulate("category", category);
- if(state==-1111) {
- dataJsonObject.accumulate("arrayState", arrayState);
- }else if(state!=-9999) {
- dataJsonObject.accumulate("state", state);
- }else{
- dataJsonObject.accumulate("doubleState", doubleState);
- }
- }
- //상태 조회
- else if (reason == Common.JSON.REASON.Status) {
- dataJsonObject.accumulate("number", roomNumber);
- }
- 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);
- 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);
- DebugLogOutput("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();
- DebugLogOutput("ClientThread Exception error=" + e);
- }
- }
- }
- 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 requestMultiControl(Handler handler, int menu, int dong, int kind, int reason, int position, String category, int number, int state) {
- ClientThread thread = new ClientThread(handler, menu, dong, kind, reason, position, category, number, state);
- thread.start();
- }
- public void requestMultiControl(Handler handler, int menu, int kind, int reason, int position, String category, int number, double 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();
- }
- }
|