MainActivity.java 140 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784
  1. package kr.co.icontrols.wallpadhomectrl;
  2. import android.annotation.SuppressLint;
  3. import android.app.ActivityManager;
  4. import android.content.BroadcastReceiver;
  5. import android.content.Context;
  6. import android.content.Intent;
  7. import android.content.IntentFilter;
  8. import android.graphics.Color;
  9. import android.os.Bundle;
  10. import android.os.CountDownTimer;
  11. import android.os.Handler;
  12. import android.os.Message;
  13. import android.os.PowerManager;
  14. import android.util.Log;
  15. import android.view.Gravity;
  16. import android.view.KeyEvent;
  17. import android.view.MotionEvent;
  18. import android.view.View;
  19. import android.view.View.OnTouchListener;
  20. import android.view.animation.AccelerateInterpolator;
  21. import android.view.animation.Animation;
  22. import android.view.animation.Animation.AnimationListener;
  23. import android.view.animation.TranslateAnimation;
  24. import android.widget.ExpandableListView;
  25. import android.widget.ExpandableListView.OnGroupClickListener;
  26. import android.widget.ExpandableListView.OnGroupCollapseListener;
  27. import android.widget.ExpandableListView.OnGroupExpandListener;
  28. import android.widget.RelativeLayout;
  29. import com.artncore.WallPadDataMgr.WallpadDeviceSet;
  30. import com.artncore.WallPadDataMgr.WallpadStatusData;
  31. import com.artncore.WallPadDataMgr.wallpaddbmgr;
  32. import com.artncore.commons.API_Menu;
  33. import com.artncore.commons.API_Menu.MenuListDataClass;
  34. import com.artncore.commons.API_Menu.MenuListDataClass.ChildIDMapping;
  35. import com.artncore.commons.DataClasses;
  36. import com.artncore.commons.define;
  37. import com.artncore.wallpadapi.KnxVentiAPI;
  38. import com.artncore.wallpadapi.LedDimmingKCC_API;
  39. import com.artncore.wallpadapi.MultiSwitchAPI;
  40. import com.artncore.wallpadapi.VentiAPI;
  41. import com.artncore.wallpadapi.WallPadAPI;
  42. import com.util.LogUtil;
  43. import org.json.JSONException;
  44. import org.json.JSONObject;
  45. import java.io.ObjectInputStream;
  46. import java.io.ObjectOutputStream;
  47. import java.net.InetSocketAddress;
  48. import java.net.Socket;
  49. import java.sql.Timestamp;
  50. import java.text.SimpleDateFormat;
  51. import java.util.ArrayList;
  52. import java.util.Arrays;
  53. import java.util.List;
  54. import kr.co.icontrols.v40ioctl.V40IF;
  55. import kr.co.icontrols.wallpadhomectrl.declare.Common;
  56. import kr.co.icontrols.wallpadhomectrl.declare.ID;
  57. import kr.co.icontrols.wallpadhomectrl.screen.screen_aircon.KnxSystemAirconMainScreen;
  58. import kr.co.icontrols.wallpadhomectrl.screen.screen_aircon.SystemAirconMainScreen;
  59. import kr.co.icontrols.wallpadhomectrl.screen.screen_multi.HeatingV2TestScreen;
  60. import kr.co.icontrols.wallpadhomectrl.screen.screen_multi.HybridCookTopTestScreen;
  61. import kr.co.icontrols.wallpadhomectrl.screen.screen_multi.KnxSystemAirconMainTestScreen;
  62. import kr.co.icontrols.wallpadhomectrl.screen.screen_multi.LightKnxMainTestScreen;
  63. import kr.co.icontrols.wallpadhomectrl.screen.screen_multi.ParkingDoorMainScreen;
  64. import kr.co.icontrols.wallpadhomectrl.screen.screen_multi.SystemAirconTestScreen;
  65. import kr.co.icontrols.wallpadhomectrl.screen.screen_airquality.AirQualityMainScreen;
  66. import kr.co.icontrols.wallpadhomectrl.screen.screen_airquality.DustInfoScreen;
  67. import kr.co.icontrols.wallpadhomectrl.screen.screen_concent.ConcentHdcNEachMainScreen;
  68. import kr.co.icontrols.wallpadhomectrl.screen.screen_concent.ConcentKnxMainScreen;
  69. import kr.co.icontrols.wallpadhomectrl.screen.screen_concent.ConcentMainScreen;
  70. import kr.co.icontrols.wallpadhomectrl.screen.screen_doorlock.DoorLockMainScreen;
  71. import kr.co.icontrols.wallpadhomectrl.screen.screen_elecrange.ElectricRangeMainScreen;
  72. import kr.co.icontrols.wallpadhomectrl.screen.screen_gas.CookTopConcentMainScreen;
  73. import kr.co.icontrols.wallpadhomectrl.screen.screen_gas.GasMainScreen;
  74. import kr.co.icontrols.wallpadhomectrl.screen.screen_gas.HybridCookTopMainScreen;
  75. import kr.co.icontrols.wallpadhomectrl.screen.screen_heating.HeatingV1MainScreen;
  76. import kr.co.icontrols.wallpadhomectrl.screen.screen_heating.HeatingV2MainScreen;
  77. import kr.co.icontrols.wallpadhomectrl.screen.screen_knx_venti.KnxVentiEasymodeScreen;
  78. import kr.co.icontrols.wallpadhomectrl.screen.screen_knx_venti.KnxVentiMainScreen;
  79. import kr.co.icontrols.wallpadhomectrl.screen.screen_light.LightEtcEachMainScreen;
  80. import kr.co.icontrols.wallpadhomectrl.screen.screen_light.LightEtcLivMainScreen;
  81. import kr.co.icontrols.wallpadhomectrl.screen.screen_light.LightHdcLivConifgScreen;
  82. import kr.co.icontrols.wallpadhomectrl.screen.screen_light.LightHdcLivKnxMainScreen;
  83. import kr.co.icontrols.wallpadhomectrl.screen.screen_light.LightHdcLivMainScreen;
  84. import kr.co.icontrols.wallpadhomectrl.screen.screen_light.LightHdcNEachMainScreen;
  85. import kr.co.icontrols.wallpadhomectrl.screen.screen_light.LightKnxMainScreen;
  86. import kr.co.icontrols.wallpadhomectrl.screen.screen_multi.VentilationMainTestScreen;
  87. import kr.co.icontrols.wallpadhomectrl.screen.screen_purity.PurityMainScreen;
  88. import kr.co.icontrols.wallpadhomectrl.screen.screen_venti.VentiEasymodeScreen;
  89. import kr.co.icontrols.wallpadhomectrl.screen.screen_venti.VentiMainScreen;
  90. import kr.co.icontrols.wallpadhomectrl.screen.screen_venti.VentilationMainScreen;
  91. import kr.co.icontrols.wallpadhomectrl.screen.screen_venti.VentilationModelMainScreen;
  92. import kr.co.icontrols.wallpadsupport.Version;
  93. import kr.co.icontrols.wallpadsupport.WpadActivity;
  94. import kr.co.icontrols.wallpadsupport.WpadImageView;
  95. import kr.co.icontrols.wallpadsupport.WpadImageView.TOUCH_KIND;
  96. import kr.co.icontrols.wallpadsupport.WpadScale;
  97. import kr.co.icontrols.wallpadsupport.WpadSound.SND;
  98. import kr.co.icontrols.wallpadsupport.WpadTextView;
  99. import kr.co.icontrols.wallpadsupport.WpadUtil;
  100. import static com.artncore.WallPadDataMgr.WallpadDeviceSet.DOORLOCK_TYPE_FINGERPRINT;
  101. import static com.artncore.WallPadDataMgr.WallpadDeviceSet.DOORLOCK_TYPE_NORMAL;
  102. import static com.artncore.WallPadDataMgr.WallpadDeviceSet.DOORLOCK_TYPE_RF;
  103. /**
  104. * @description 월패드 [설정기능] 메인화면 이다.<br>
  105. * 상단의 Top 메뉴, [홈] [돌아가기]<br>
  106. * 좌측의 Tab 메뉴, [환경설정] [화면청소] [비밀번호변경] ... 등 선택 메뉴<br>
  107. * 를 여기서 처리한다.
  108. */
  109. public class MainActivity extends WpadActivity {
  110. private final static String TAG = "MainActivity";
  111. private final boolean DEBUG_LOG_ON = true;
  112. private void DebugLogOutput(String s)
  113. {
  114. if (DEBUG_LOG_ON) Log.d(TAG, s);
  115. }
  116. // =================================================================================================
  117. // [[ Declaration ]] region
  118. // =================================================================================================
  119. protected Context mContext = null;
  120. public Context getContext()
  121. {
  122. return mContext;
  123. }
  124. private WallPadAPI wpapi = null;
  125. private int OPERATION_MODE = Common.MODE;
  126. private WallpadStatusData wdb = null;
  127. // Layout
  128. private RelativeLayout AllLayout; // 화면 전체
  129. private RelativeLayout TopLayout; // 상단 메뉴
  130. private RelativeLayout ScreenLayout; // 메인 화면
  131. private RelativeLayout MenuLayout; // 메뉴 화면
  132. // Top Menu
  133. private WpadImageView TopBackground;
  134. private WpadTextView TopTitle;
  135. private WpadImageView TopHomeBtn, TopBackBtn, TopMenuBtn, TopBoilerBtn;
  136. private WpadImageView MultiBtn[];
  137. private WpadImageView TopAirBackBtn, BTN_TOP_BACK_VENTIL;
  138. private WpadImageView TopDimmingBtn[];
  139. public static WpadImageView TopManualBtn;
  140. private WpadImageView Hide1Btn, Hide2Btn;
  141. // Main
  142. private WpadImageView ScreenBackground;
  143. // Menu
  144. private WpadImageView MenuBackground;
  145. private WpadImageView MenuClose;
  146. private WpadTextView MenuTitle;
  147. private static ExpandableListView mListView;
  148. private Menu_AdptMain adptMain;
  149. private MenuListDataClass menueListDataClass;
  150. private Menu mMenu = null; //WPadAPI의 Menu class
  151. private boolean MenuOpen = false;
  152. // HideMenu
  153. private int mHideMenuEntryStatus = 0;
  154. private static boolean mHideMenuOn = false;
  155. public static boolean getHideMenuOn() { return mHideMenuOn; }
  156. private CountDownTimer mHideMenuTimer = null;
  157. // PopupActivityRun
  158. private static boolean PopupActivityRun = false;
  159. public static boolean getPopupActivityRun()
  160. {
  161. return PopupActivityRun;
  162. }
  163. public static void setPopupActivityRun(boolean run)
  164. {
  165. PopupActivityRun = run;
  166. }
  167. // CurrentScreenId
  168. private int mCurrentScreenId = -1;
  169. private int mTempCurrentScreenId = -1;
  170. public static int mCurrentManualScreenId = -1;
  171. public static int mCurrentMultiScreenId = -1;
  172. // Screen
  173. private LightHdcLivMainScreen lightHdcLivMainScreen = null;
  174. private LightHdcLivKnxMainScreen lightHdcLivKnxMainScreen = null;
  175. private LightKnxMainScreen lightKnxMainScreen = null;
  176. private KnxVentiMainScreen KnxVentiMainScreen = null;
  177. private VentiMainScreen ventiMainScreen = null;
  178. private VentilationMainScreen ventilationMainScreen = null;
  179. private kr.co.icontrols.wallpadhomectrl.screen.screen_venti.VentilationModelMainScreen ventilationModelMainScreen = null;
  180. private KnxVentiMainScreen knxVentiMainScreen = null;
  181. private KnxVentiEasymodeScreen knxVentiEasymodeScreen= null;
  182. private VentiEasymodeScreen ventiEasymodeScreen= null;
  183. private GasMainScreen gasMainScreen = null;
  184. private DoorLockMainScreen doorLockMainScreen = null;
  185. private HeatingV2MainScreen heatingV2MainScreen = null;
  186. private HeatingV1MainScreen heatingV1MainScreen = null;
  187. private LightHdcLivConifgScreen lightHdcLivConifgScreen = null;
  188. private LightEtcEachMainScreen lightEtcEachMainScreen = null;
  189. private LightEtcLivMainScreen lightEtcLivMainScreen = null;
  190. private LightHdcNEachMainScreen lightHdcNEachMainScreen = null;
  191. private AirQualityMainScreen airQualityMainScreen = null;
  192. private DustInfoScreen dustInfoScreen = null;
  193. private ConcentMainScreen concentMainScreen = null;
  194. private ConcentKnxMainScreen concentKnxMainScreen = null;
  195. private HybridCookTopMainScreen hybridCookTopMainScreen = null;
  196. private ConcentHdcNEachMainScreen concentHdcNEachMainScreen = null;
  197. private ElectricRangeMainScreen electricRangeMainScreen = null;
  198. private CookTopConcentMainScreen cookTopConcentMainScreen = null;
  199. private SystemAirconMainScreen systemAirconMainScreen = null;
  200. private KnxSystemAirconMainScreen knxSystemAirconMainScreen = null;
  201. private PurityMainScreen purityMainScreen = null;
  202. private ParkingDoorMainScreen parkingDoorMainScreen = null;
  203. // 명칭 관련
  204. public static final int HEATING = 1;
  205. public static final int LIGHT = 2;
  206. public static final int CONCENT = 3;
  207. public static final int SYSTEMAIRCON = 4;
  208. public static boolean bRoomNameEditUse = false; // 방 명칭 수정 사용 여부
  209. public String[] mRoomNameList_Light = null; //조명 방 명칭
  210. public String[] mRoomNameList_Heating = null; //난방 방 명칭
  211. public String[] mRoomNameList_Concent = null; //콘센트 방 명칭
  212. public String[] mRoomNameList_SystemAircon = null; //시스템에어컨 방 명칭
  213. public String[] mRoomNameList_Purity = null; //삼성청정환기 방 명칭
  214. public String[] mRoomNameList_Shading = null; //차광제어기 방 명칭
  215. private String[] mDefaultRoomNameList = new String[]{"거실", "방1", "방2", "방3", "방4", "방5", "방6", "방7", "방8"};
  216. private String[] mDefaultRoomNameList_Light = new String[]{"거실", "주방", "방1", "방2", "방3", "방4", "방5", "방6", "방7", "방8"};
  217. private String[] mDefaultRoomNameList_Light_SK = new String[]{"거실", "주방", "안방", "침실1", "침실2", "침실3", "침실4", "침실5", "침실6", "침실7", "침실8"};
  218. private String[] mDefaultRoomNameList_Heating = new String[]{"거실", "방1", "방2", "방3", "방4", "방5", "방6", "방7", "방8"};
  219. private String[] mDefaultRoomNameList_Heating_SK = new String[]{"거실", "안방", "침실1", "침실2", "침실3", "침실4", "침실5", "침실6", "침실7", "침실8"};
  220. private String[] mDefaultRoomNameList_Heating_easymode = new String[]{"거실", "방1", "방2", "방3", "방4", "방5", "방6", "방7", "방8"};
  221. private int[][] KCC_DimmBtnOffArray =
  222. {
  223. {R.drawable.btn_top_dimm_normal_off, R.drawable.btn_top_dimm_normal_pressed},
  224. {R.drawable.btn_top_dimm_study_off, R.drawable.btn_top_dimm_study_pressed},
  225. {R.drawable.btn_top_dimm_sensi_off, R.drawable.btn_top_dimm_sensi_pressed},
  226. {R.drawable.btn_top_dimm_rest_off, R.drawable.btn_top_dimm_rest_pressed}
  227. };
  228. private int[][] KCC_DimmBtnOnArray =
  229. {
  230. {R.drawable.btn_top_dimm_normal_selected, R.drawable.btn_top_dimm_normal_pressed},
  231. {R.drawable.btn_top_dimm_study_selected, R.drawable.btn_top_dimm_study_pressed},
  232. {R.drawable.btn_top_dimm_sensi_selected, R.drawable.btn_top_dimm_sensi_pressed},
  233. {R.drawable.btn_top_dimm_rest_selected, R.drawable.btn_top_dimm_rest_pressed},
  234. };
  235. private int[][] MultiBtnArray =
  236. {
  237. {R.drawable.tab_floor_1_normal, R.drawable.tab_floor_1_pressed},
  238. {R.drawable.tab_floor_2_normal, R.drawable.tab_floor_2_pressed},
  239. {R.drawable.tab_floor_3_normal, R.drawable.tab_floor_3_pressed}
  240. };
  241. private int[][] MultiSelectedBtnArray =
  242. {
  243. {R.drawable.tab_floor_1_selected, R.drawable.tab_floor_1_selected},
  244. {R.drawable.tab_floor_2_selected, R.drawable.tab_floor_2_selected},
  245. {R.drawable.tab_floor_3_selected, R.drawable.tab_floor_3_selected}
  246. };
  247. private LedDimmingKCC_API ledDimmingAPI = null;
  248. private class DimData {
  249. LedDimmingKCC_API.Data DimData;
  250. public DimData()
  251. {
  252. DimData = null;
  253. }
  254. }
  255. private DimData mDimData = null;
  256. private byte [] mLevelArray = { 100, 70, 50, 20 };
  257. private boolean bMultiConcentExist = false;
  258. boolean bKitchenLightonLivingEM = false; // 거실EM에 주방등 연결 여부
  259. public static PowerManager mPowerManager;
  260. public static V40IF mV40IF;
  261. //Value
  262. String myIP = "NONE";
  263. String myDong = "NONE";
  264. String myHo = "NONE";
  265. int ho;
  266. int mMultiAddress;
  267. public int KccDimUse = 0;
  268. // int SmartDistUse = -1;
  269. // boolean KnxDistUse = false;
  270. public static int nDistributionPanelType = Version.DISTRIBUTION_MODEL.OTHER;
  271. private VentiAPI mVentilAPI = null;
  272. private KnxVentiAPI mKnxVentilAPI = null;
  273. DataClasses.Venti VentilStatus;
  274. /**
  275. * 모델하우스 전용 환기 버전2 사용 여부 체크
  276. * UI만 동작함
  277. */
  278. private boolean isUseModelHouse_Venti = false;
  279. // =================================================================================================
  280. // [[ Activity Life Cycle ]] region
  281. // =================================================================================================
  282. /**
  283. * Activity Constructors
  284. */
  285. @Override
  286. protected void onCreate(Bundle savedInstanceState) {
  287. Log.i(TAG, "[onCreate] -------------------------------------------------------------");
  288. Log.i(TAG, "[onCreate] ------------------ [START - MainActivity] -------------------");
  289. Log.i(TAG, "[onCreate] -------------------------------------------------------------");
  290. super.onCreate(savedInstanceState);
  291. // @ AutoScale 설정
  292. WpadScale.setAutoScale(true);
  293. if (Common.CHECK_DEV_SERVICE) {
  294. StartDevService();
  295. runMultiControlService();
  296. }
  297. super.AppVersionLogOut(); // [APP Version] + [WallPadSupport Lib Version] 을 로그로 출력한다.
  298. Log.i("[onCreate] Version", "<><><><> WallPadAPI Version = [" + define.WALLPADAPI_VERSION + "] " + "<><><><>");
  299. // 1. 변수 초기화
  300. DebugLogOutput("[Create] - Step1 : Data Create");
  301. PopupActivityRun = false;
  302. ManualActivityRun = false;
  303. mPowerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
  304. mV40IF = new V40IF();
  305. mContext = this;
  306. mDimData = new DimData();
  307. mHideMenuOn = false;
  308. // 2. 자동 종료 셋팅
  309. DebugLogOutput("[Create] - Step2 : Auto Finish Setting");
  310. // 2-1. 자동종료 타이머 셋팅
  311. if (Common.FINISH_TIME_ENABLE) super.setFinishTimerCreate(Common.FINISH_TIME_SEC);
  312. Common.ctrlLCDOnOff(true);
  313. // 3. API 호출
  314. DebugLogOutput("[Create] - Step3 : API Call");
  315. if (Common.GetDeviceSampleMode(this)) OPERATION_MODE = Common.MODE_BUSINESS_SAMPLE;
  316. else OPERATION_MODE = Common.MODE_NOMAL;
  317. // 3.1. wpapi 생성
  318. if (OPERATION_MODE == Common.MODE_NOMAL) {
  319. Log.d(TAG, "[onCreate] OperationMode = MODE_NOMAL");
  320. try {
  321. wpapi = new WallPadAPI(this);
  322. } catch (RuntimeException re) {
  323. LogUtil.errorLogInfo("", TAG, re);
  324. }
  325. catch (Exception e) {
  326. Log.e(TAG, "[ExceptionError] - new WallPadAPI : " + e);
  327. }
  328. }
  329. else if (OPERATION_MODE == Common.MODE_BUSINESS_SAMPLE) {
  330. Log.d(TAG, "[onCreate] OperationMode = MODE_BUSINESS_SAMPLE");
  331. try {
  332. wpapi = new WallPadAPI(this);
  333. } catch (RuntimeException re) {
  334. LogUtil.errorLogInfo("", TAG, re);
  335. }
  336. catch (Exception e) {
  337. Log.e(TAG, "[ExceptionError] - new WallPadAPI : " + e);
  338. }
  339. }
  340. try {
  341. wdb = new WallpadStatusData(this);
  342. wallpaddbmgr.AddressSet addc = wdb.getAddressMGR(); //DB에서 동호 정보 받아옴
  343. if (wdb != null) wdb.closeDB();
  344. //동, 호, ip 정보 저장
  345. myIP = addc.IPAddress;
  346. myDong = addc.Dong;
  347. myHo = addc.Ho;
  348. if(!myHo.equals("NONE")) {
  349. ho = Integer.valueOf(myHo.substring(0, 1));
  350. }
  351. } catch (RuntimeException re) {
  352. LogUtil.errorLogInfo("", TAG, re);
  353. }
  354. catch (Exception e) {
  355. Log.e(TAG, "[ExceptionError] - onCreate->WallpadStatusData Create : " + e);
  356. }
  357. getConstructionFunction();
  358. WallpadDeviceSet deviceSet = new WallpadDeviceSet(getContext());
  359. bRoomNameEditUse = deviceSet.Get_RoomNameEditUse();
  360. deviceSet.closeDB();
  361. Log.d(TAG, "[Create] bRoomNameEditUse [" + bRoomNameEditUse + "]");
  362. GetRoomNameV2(); // 방명칭 수정 시나리오 적용
  363. //if (bRoomNameEditUse) GetRoomNameV2(); // 방명칭 수정 시나리오 적용
  364. //else GetRoomName();
  365. //mMultiConentCheckHandler.sendEmptyMessage(0); // 멀티스위치 콘센트 유무 확인
  366. // 4. Layout registration
  367. DebugLogOutput("[Create] - Step4 : Layout registration");
  368. // 4-1. mainLayout
  369. AllLayout = new RelativeLayout(this);
  370. RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(WpadScale.getWidthPixels(), WpadScale.getHeightPixels());
  371. AllLayout.setLayoutParams(params);
  372. AllLayout.setId(ID.main.layout.ALL);
  373. super.setAllLayoutRegistration(AllLayout);
  374. // 4-2. TopLayout
  375. TopLayout = new RelativeLayout(this);
  376. WpadUtil.LayoutRegistration(AllLayout, TopLayout, 1280, 110, 0, 0, ID.main.layout.TOP);
  377. // 4-4. ScreenLayout
  378. ScreenLayout = new RelativeLayout(this);
  379. WpadUtil.LayoutRegistration(AllLayout, ScreenLayout, 1280, 690, 0, 110, ID.main.layout.SCREEN);
  380. ScreenBackground = new WpadImageView(this, TOUCH_KIND.NONE, 1280, 690, R.drawable.bg_body, R.drawable.bg_body, ID.main.image.SCREEN_BACKGROUND);
  381. ViewRegistration(ScreenLayout, ScreenBackground, 0, 0);
  382. // 5. Top Menu - ImageView registration
  383. DebugLogOutput("[Create] - Step5 : Top Menu - ImageView registration");
  384. TopBackground = new WpadImageView(this, TOUCH_KIND.NONE, 1280, 110, R.drawable.bg_topbar, R.drawable.bg_topbar, ID.main.image.TOP_BACKGROUND);
  385. ViewRegistration(TopLayout, TopBackground, 0, 0);
  386. TopTitle = new WpadTextView(this, false, 247 + 600, 80, Gravity.LEFT, Color.WHITE, Common.fontsize._44, true, ID.main.text.TITLE);
  387. ViewRegistration(TopLayout, TopTitle, 133, 15);
  388. 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);
  389. ViewRegistration(TopLayout, TopHomeBtn, 1145, 0);
  390. 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);
  391. ViewRegistration(TopLayout, TopMenuBtn, 0, 0);
  392. 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);
  393. setManualBtnVisible(getManualUse(), 1019);
  394. 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);
  395. ViewRegistration(TopLayout, TopBackBtn, 1019, 0);
  396. setTopBackBtnVisible(false);
  397. 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);
  398. ViewRegistration(TopLayout, TopBoilerBtn, 1019, 0);
  399. setTopBoilerBtnVisible(false);
  400. 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);
  401. ViewRegistration(TopLayout, TopAirBackBtn, 1019, 0);
  402. setAIRBackBtnVisible(false);
  403. 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);
  404. ViewRegistration(TopLayout, BTN_TOP_BACK_VENTIL, 1019, 0);
  405. setVentilBackBtnVisible(false);
  406. Hide1Btn = new WpadImageView(this, TOUCH_KIND.BUTTON_M, 100, 110, 0, 0, ID.main.button.HIDE1);
  407. ViewRegistration(TopLayout, Hide1Btn, 530, 0);
  408. Hide2Btn = new WpadImageView(this, TOUCH_KIND.BUTTON_M, 100, 110, 0, 0, ID.main.button.HIDE2);
  409. ViewRegistration(TopLayout, Hide2Btn, 650, 0);
  410. TopDimmingBtn = new WpadImageView[4];
  411. for (int i = 0; i < TopDimmingBtn.length; i++) {
  412. TopDimmingBtn[i] = new WpadImageView(this, TOUCH_KIND.BUTTON, 76, 76, KCC_DimmBtnOffArray[i], KCC_DimmBtnOnArray[i], ID.main.button.DIMM_NORMAL + i);
  413. ViewRegistration(TopLayout, TopDimmingBtn[i], 445 + (i*100), 17);
  414. }
  415. setKccDimmBtnVisible(false);
  416. MultiBtn = new WpadImageView[3];
  417. for (int i = 0; i < MultiBtn.length; i++) {
  418. MultiBtn[i] = new WpadImageView(this, TOUCH_KIND.BUTTON, 156, 50,
  419. MultiBtnArray[i],
  420. MultiSelectedBtnArray[i],
  421. ID.main.button.MULTI1 + i);
  422. ViewRegistration(TopLayout, MultiBtn[i], 464 + (i*160), 30);
  423. }
  424. setMultiBtnVisible(false);
  425. WallpadDeviceSet wpdds = new WallpadDeviceSet(getContext());
  426. bKitchenLightonLivingEM = wpdds.Get_LivingEm_KitchenLight_Use();
  427. wpdds.closeDB();
  428. // 6. Menu Loading
  429. // 6-1. 메뉴 정보를 가져온다 (DB에서 가져온다)
  430. DebugLogOutput("[Create] - Step6 : Side Menu - Insert Menu List");
  431. wallpaddbmgr WallpadDBMGR = new wallpaddbmgr(getApplicationContext());
  432. menueListDataClass = WallpadDBMGR.GetMenuList();
  433. WallpadDBMGR.closeDB();
  434. //WallPadMain에서 MenuList를 넣어주지 않아 아래 테스트 코드를 넣음
  435. menueListDataClass = null;
  436. if (menueListDataClass == null) {
  437. Log.d(TAG, "[onCreate] menueListDataClass == null, Load Default List");
  438. menueListDataClass = loadDefaultMenuList();
  439. }
  440. else {
  441. for (int i = 0; i < menueListDataClass.idMappingTable.length; i++) {
  442. Log.d(TAG, "[onCreate] i [" + i + "], ID [" + menueListDataClass.idMappingTable[i].Id + ", NAME [" + menueListDataClass.idMappingTable[i].Name + "]");
  443. }
  444. }
  445. // 6-2. 시작 화면을 main APP으로 부터 받아서 처리한다.
  446. VentilStatus = new DataClasses.Venti();
  447. mMenu = new Menu();
  448. mMenu = super.getIntentParsingMenu(getIntent());
  449. if (mMenu == null) {
  450. Log.i(TAG, "[onCreate] mMenu = null");
  451. if (OPERATION_MODE == Common.MODE_NOMAL) {
  452. mTempCurrentScreenId = API_Menu.SubMenuCtrl.HDC_LivingLamp;
  453. setTitleName(mTempCurrentScreenId);
  454. mWallPadApiCheckHandler.sendEmptyMessage(0);
  455. }
  456. else {
  457. setChangeScreen(API_Menu.SubMenuCtrl.HDC_LivingLamp, false);
  458. }
  459. }
  460. else {
  461. Log.i(TAG, "[onCreate] mMenu != null");
  462. if (OPERATION_MODE == Common.MODE_NOMAL) {
  463. mTempCurrentScreenId = mMenu.getStartId();
  464. setTitleName(mTempCurrentScreenId);
  465. mWallPadApiCheckHandler.sendEmptyMessage(0);
  466. }
  467. else {
  468. mTempCurrentScreenId = mMenu.getStartId();
  469. setTitleName(mTempCurrentScreenId);
  470. mWallPadApiCheckHandler.sendEmptyMessage(0);
  471. /*boolean result = setChangeScreen(mMenu.getStartId(), false);
  472. Log.i(TAG, "Menu Sample result = " + result);
  473. if (result == false)
  474. {
  475. setChangeScreen(API_Menu.SubMenuCtrl.HDC_LivingLamp, false);
  476. }*/
  477. }
  478. }
  479. // 7. Draw
  480. DebugLogOutput("[Create] - Step7 : setContentView");
  481. setContentView(AllLayout);
  482. // 8. Window ReSize
  483. DebugLogOutput("[Create] - Step8 : Window ReSize");
  484. //super.WindowReSize(Common.SCREEN_SIZE_MAIN_W, Common.SCREEN_SIZE_MAIN_H, false);
  485. // 9. BR Receiver 등록(메뉴에서 다른 화면이 눌린 경우 BR처리)
  486. reg_Receiver();
  487. WallpadDeviceSet wds = new WallpadDeviceSet(getContext());
  488. int gateway = wds.GetGatewayModelKindInfo();
  489. nDistributionPanelType = wds.Get_DistributionPannelType_Info();
  490. wds.closeDB();
  491. if (gateway == Version.GATEWAY_MODEL.IGW_200) {
  492. Log.i(TAG, "[onCreate] IGW_200 SET @@@@@@@@@@@@@@@@@@@@");
  493. }
  494. else if (gateway == Version.GATEWAY_MODEL.IGW_300) {
  495. Log.i(TAG, "[onCreate] IGW_300 SET @@@@@@@@@@@@@@@@@@@@");
  496. }
  497. else {
  498. Log.i(TAG, "[onCreate] GATEWAY OTHER @@@@@@@@@@@@@@@@@@@@");
  499. }
  500. // 거주자 안전확인 서비스 사용여부 확인하고, 화면 WallPadSupport Lib.에 관련 설정을 한다.
  501. // 성북동 주택은 생략
  502. if (Version.getModelType() != Version.MODEL_TYPE.IHN_D101_I_LX2) {
  503. getResidentSafetyCheckSetting();
  504. }
  505. Log.i(TAG, "[onCreate] End onCreate -------------------------------------------------");
  506. }
  507. /**
  508. * (임시코드) WallPadAPI 초기생성시 Connect 에 시간이 걸리며, <br>
  509. * WallPadAPI 초기화후 바로 Get_GasValveController 등을 사용하여 API 를 가져올수 없기에, <br>
  510. * 본 딜레이 코드를 임시로 적용한다.
  511. */
  512. @SuppressLint("HandlerLeak")
  513. protected Handler mWallPadApiCheckHandler = new Handler() {
  514. @SuppressLint("HandlerLeak")
  515. @Override
  516. public void handleMessage(Message msg) {
  517. try {
  518. if (msg.what == 0) {
  519. if (wpapi != null) {
  520. //Log.d(TAG, "Handler go");
  521. if (wpapi.Check_Connect()) {
  522. //성북동 주택의 환기는 일반환기로 적용
  523. if (nDistributionPanelType == Version.DISTRIBUTION_MODEL.KNX_DIST && Version.getModelType() != Version.MODEL_TYPE.IHN_D101_I_LX2) {
  524. mKnxVentilAPI = wpapi.Get_KnxVentiController();
  525. // KNX 환기
  526. if (mKnxVentilAPI != null) {
  527. Log.e(TAG, "[mWallPadApiCheckHandler] mKnxVentilAPI is not null!!");
  528. updateKnxVentilatorData(false);
  529. }
  530. else {
  531. Log.e(TAG, "[mWallPadApiCheckHandler] mKnxVentilAPI is null!!");
  532. mWallPadApiCheckHandler.sendEmptyMessageDelayed(0, 10);
  533. }
  534. mVentilAPI = wpapi.Get_VentiController();
  535. if (mVentilAPI != null) {
  536. Log.d(TAG, "[mWallPadApiCheckHandler] mVentilAPI is not null!!");
  537. updateVentilatorData(false);
  538. }
  539. else {
  540. Log.e(TAG, "[mWallPadApiCheckHandler] mVentilAPI is null!!");
  541. mWallPadApiCheckHandler.sendEmptyMessageDelayed(0, 10);
  542. }
  543. }
  544. else {
  545. // 일반 환기
  546. mVentilAPI = wpapi.Get_VentiController();
  547. if (mVentilAPI != null) {
  548. Log.d(TAG, "[mWallPadApiCheckHandler] mVentilAPI is not null!!");
  549. updateVentilatorData(false);
  550. }
  551. else {
  552. Log.e(TAG, "[mWallPadApiCheckHandler] mVentilAPI is null!!");
  553. mWallPadApiCheckHandler.sendEmptyMessageDelayed(0, 10);
  554. }
  555. }
  556. // KCC 디밍제어기 사용여부 확인
  557. WallpadDeviceSet wdst = new WallpadDeviceSet(getContext());
  558. int nKCCDimmingUsage = wdst.GetDeviceSetted("KCC디밍제어기"); // 1: 사용안함 / 2: 사용함
  559. int[] nLightType = wdst.Get_Light_info();
  560. wdst.closeDB();
  561. if (nKCCDimmingUsage == WallpadDeviceSet.DEV_DATA_ENABLE) {
  562. ledDimmingAPI = wpapi.Get_KCCDimmingController();
  563. if (ledDimmingAPI != null) {
  564. ledDimmingAPI.regChangedBR(ID.main.BR_KCC_DIM);
  565. if (ledDimmingAPI.Refresh((byte)0, false) >= 0) {
  566. mDimData.DimData = ledDimmingAPI.data;
  567. }
  568. Draw_Update_DimmBtn();
  569. }
  570. else {
  571. Log.w(TAG, "[mWallPadApiCheckHandler] ledDimmingAPI is null!!");
  572. //mWallPadApiCheckHandler.sendEmptyMessageDelayed(0, 10);
  573. }
  574. }
  575. if (nLightType[0] == WallpadDeviceSet.DO_USE) {
  576. if (nLightType[1] == WallpadDeviceSet.LIGHT_TYPE_ROOM || nLightType[1] == WallpadDeviceSet.LIGHT_TYPE_HDC_INTLIGHT_ADD_BATCHLIGHT_MULTISWITCH) {
  577. // 조명 : 멀티스위치인 경우
  578. try {
  579. MultiSwitchAPI mMultiSwitchAPI = wpapi.Get_MultiSwitchController();
  580. if (mMultiSwitchAPI.Refresh((byte) 0xFF, false) >= 0) {
  581. Log.i(TAG, "[mWallPadApiCheckHandler] Multi Refresh ----> true @@@@@@@@@@@@@");
  582. if (mMultiSwitchAPI.isExist_ConcentDevice()) {
  583. Log.i(TAG, "[mWallPadApiCheckHandler] Multi concent ----> true @@@@@@@@@@@@@");
  584. bMultiConcentExist = true; // 콘센트 있는지 확인
  585. }
  586. }
  587. } catch (RuntimeException re) {
  588. LogUtil.errorLogInfo("", TAG, re);
  589. }
  590. catch (Exception e) {
  591. Log.e(TAG, e.toString());
  592. }
  593. }
  594. }
  595. mWallPadApiCheckHandler.sendEmptyMessageDelayed(1, 10);
  596. }
  597. else {
  598. mWallPadApiCheckHandler.sendEmptyMessageDelayed(0, 10);
  599. }
  600. }
  601. else {
  602. Log.w(TAG, "[mWallPadApiCheckHandler] wpapi is null!!");
  603. }
  604. }
  605. else if (msg.what == 1) {
  606. Log.d(TAG, "Handler finish");
  607. menueListDataClass = loadDefaultMenuList(); // 다시 메뉴를 만들어 질까? ??????
  608. boolean result = setChangeScreen(mTempCurrentScreenId, false);
  609. if (result == false) {
  610. setChangeScreen(API_Menu.SubMenuCtrl.HDC_LivingLamp, false);
  611. }
  612. }
  613. } catch (RuntimeException re) {
  614. LogUtil.errorLogInfo("", TAG, re);
  615. }
  616. catch (Exception e) {
  617. Log.e(TAG, "[Exception] mWallPadApiCheckHandler.handleMessage(Message msg)");
  618. //e.printStackTrace();
  619. LogUtil.errorLogInfo("", TAG, e);
  620. }
  621. }
  622. };
  623. boolean multiConcentFindRoutine = false;
  624. @SuppressLint("HandlerLeak")
  625. protected Handler mMultiConentCheckHandler = new Handler()
  626. {
  627. @SuppressLint("HandlerLeak")
  628. @Override
  629. public void handleMessage(Message msg) {
  630. if (msg.what == 0) {
  631. if (wpapi != null) {
  632. //Log.d(TAG, "Handler go");
  633. if (wpapi.Check_Connect()) {
  634. WallpadDeviceSet wdst = new WallpadDeviceSet(getContext());
  635. int[] lightType = wdst.Get_Light_info();
  636. wdst.closeDB();
  637. if (lightType[0] == WallpadDeviceSet.DO_USE) {
  638. if (lightType[1] == WallpadDeviceSet.LIGHT_TYPE_ROOM) {
  639. // 조명 : 멀티스위치인 경우,
  640. try {
  641. MultiSwitchAPI MSAPI = wpapi.Get_MultiSwitchController();
  642. if (MSAPI.Refresh((byte) 0xFF, false) >= 0) {
  643. Log.i(TAG, "Multi Refresh ----> true @@@@@@@@@@@@@");
  644. if (MSAPI.isExist_ConcentDevice()) {
  645. Log.i(TAG, "Multi concent ----> true @@@@@@@@@@@@@");
  646. bMultiConcentExist = true; // 콘센트 있는지 확인
  647. }
  648. }
  649. } catch (RuntimeException re) {
  650. LogUtil.errorLogInfo("", TAG, re);
  651. }
  652. catch (Exception e) {
  653. Log.e(TAG, e.toString());
  654. }
  655. }
  656. else {
  657. mWallPadApiCheckHandler.sendEmptyMessageDelayed(1, 10);
  658. }
  659. }
  660. mWallPadApiCheckHandler.sendEmptyMessageDelayed(1, 10);
  661. }
  662. else {
  663. mWallPadApiCheckHandler.sendEmptyMessageDelayed(0, 10);
  664. }
  665. }
  666. }
  667. else if (msg.what == 1) {
  668. Log.d(TAG, "Handler finish");
  669. multiConcentFindRoutine = true;
  670. menueListDataClass = loadDefaultMenuList(); // 다시 메뉴를 만들어 질까? ??????
  671. }
  672. }
  673. };
  674. /* ================================================================================================
  675. * [Manual Activity] Section
  676. ================================================================================================ */
  677. public static ManualActivity mManualActivity;
  678. public void setManualBtnVisible(boolean bEnable, int marginLeft) {
  679. try {
  680. Log.d(TAG, "[setManualBtnVisible] bEnable [" + bEnable + "], marginLeft [" + marginLeft + "]");
  681. if (bEnable) {
  682. ViewRegistration(TopLayout, TopManualBtn, marginLeft, 0);
  683. TopManualBtn.setVisibility(View.VISIBLE);
  684. }
  685. else {
  686. TopManualBtn.setVisibility(View.INVISIBLE);
  687. }
  688. } catch (RuntimeException re) {
  689. LogUtil.errorLogInfo("", TAG, re);
  690. }
  691. catch (Exception e) {
  692. Log.e(TAG, "[Exception] setManualBtnVisible(boolean bEnable, int marginLeft)");
  693. //e.printStackTrace();
  694. LogUtil.errorLogInfo("", TAG, e);
  695. }
  696. }
  697. /**
  698. * 매뉴얼 버튼 사용 유무
  699. * @return boolean 타입 - true: 사용, false: 미사용
  700. */
  701. public boolean getManualUse() {
  702. try {
  703. WallpadDeviceSet devSet = new WallpadDeviceSet(mContext);
  704. String[] DBinfo = devSet.GetSettingData("매뉴얼");
  705. devSet.closeDB();
  706. if (DBinfo != null) {
  707. if (DBinfo[1].indexOf("사용함") > 0) {
  708. Log.d(TAG, "[getManualUse] Use Manual");
  709. return true;
  710. }
  711. else {
  712. // 미사용
  713. Log.d(TAG, "[getManualUse] Not Use Manual [1]");
  714. return false;
  715. }
  716. }
  717. else {
  718. // 미사용
  719. Log.d(TAG, "[getManualUse] Not Use Manual [2]");
  720. return false;
  721. }
  722. } catch (RuntimeException re) {
  723. LogUtil.errorLogInfo("", TAG, re);
  724. }
  725. catch (Exception e) {
  726. Log.e(TAG, "[Exception] getManualUse()");
  727. //e.printStackTrace();
  728. LogUtil.errorLogInfo("", TAG, e);
  729. }
  730. return false;
  731. }
  732. // ManualActivityRun
  733. private static boolean ManualActivityRun = false;
  734. public static boolean getManualActivityRun() {
  735. Log.d(TAG, "[getManualActivityRun] ManualActivityRun: " + ManualActivityRun);
  736. return ManualActivityRun;
  737. }
  738. public static void setManualActivityRun(boolean run) {
  739. ManualActivityRun = run;
  740. if (!ManualActivityRun) resetCurrentManualScreenID();
  741. }
  742. public boolean StartManual(int screenId) {
  743. try {
  744. Log.d(TAG, "[StartManual] ScreenId [" + screenId + "], mCurrentManualScreenId [" + mCurrentManualScreenId + "]");
  745. if (getManualActivityRun()) {
  746. mCurrentManualScreenId = screenId;
  747. return ((WpadActivity) (ManualActivity.getContext())).ChangeScreen(screenId);
  748. }
  749. else {
  750. if (mCurrentManualScreenId == screenId) return false;
  751. mCurrentManualScreenId = screenId;
  752. setManualActivityRun(true);
  753. Intent intent = new Intent(mContext, ManualActivity.class);
  754. intent.putExtra("ScreenId", screenId);
  755. if (mCurrentScreenId == API_Menu.SubMenuCtrl.Heating_V2) {
  756. intent.putExtra("HeatInfo", heatingV2MainScreen.Heating_Manual_Str);
  757. }
  758. else if (mCurrentScreenId == API_Menu.SubMenuCtrl.OutSide_EachLamp) {
  759. intent.putExtra("EtcMultiInfo", "RoomCount:"+lightEtcEachMainScreen.TotalRoomCount + "/" + "KccDim:" + KccDimUse );
  760. }
  761. else if (mCurrentScreenId == API_Menu.SubMenuCtrl.Concent) {
  762. intent.putExtra("ConcentInfo", "ConcentCount:"+concentMainScreen.mConDeviceCount );
  763. }
  764. else if (mCurrentScreenId == API_Menu.SubMenuCtrl.ChangAir_Normal) {
  765. if (GetEasyModeUXUse() == true) {
  766. intent.putExtra("VentiInfo", ventiEasymodeScreen.VentiManual_Str);
  767. }
  768. else {
  769. if (ventiMainScreen != null) intent.putExtra("VentiInfo", ventiMainScreen.VentiManual_Str);
  770. }
  771. }
  772. overridePendingTransition(0, 0);
  773. startActivityForResult(intent, 0);
  774. return true;
  775. }
  776. } catch (RuntimeException re) {
  777. LogUtil.errorLogInfo("", TAG, re);
  778. return false;
  779. }
  780. catch (Exception e) {
  781. Log.e(TAG, "[Exception] StartManual(int screenId)");
  782. //e.printStackTrace();
  783. LogUtil.errorLogInfo("", TAG, e);
  784. return false;
  785. }
  786. }
  787. public boolean StartMultiControl(int screenId, int ho) {
  788. try {
  789. Log.d(TAG, "[StartMultiControl] ScreenId [" + screenId + "], mCurrentScreenId [" + mCurrentScreenId + "]");
  790. if (mCurrentScreenId == screenId) return false;
  791. if(setMultiScreen(screenId, ho)){
  792. return true;
  793. }
  794. return false;
  795. } catch (RuntimeException re) {
  796. LogUtil.errorLogInfo("", TAG, re);
  797. return false;
  798. }
  799. catch (Exception e) {
  800. Log.e(TAG, "[Exception] StartMultiControl(int screenId)");
  801. //e.printStackTrace();
  802. LogUtil.errorLogInfo("", TAG, e);
  803. return false;
  804. }
  805. }
  806. public static void resetCurrentManualScreenID() {
  807. try {
  808. mCurrentManualScreenId = -1;
  809. } catch (RuntimeException re) {
  810. LogUtil.errorLogInfo("", TAG, re);
  811. }
  812. catch (Exception e) {
  813. Log.e(TAG, "[Exception] resetCurrentManualScreenID()");
  814. //e.printStackTrace();
  815. LogUtil.errorLogInfo("", TAG, e);
  816. }
  817. }
  818. public static void FinishManualActivity() {
  819. Log.i(TAG, "[FinishManualActivity]");
  820. try {
  821. if (mManualActivity != null) {
  822. mCurrentManualScreenId = -1;
  823. mManualActivity.finish();
  824. }
  825. } catch (RuntimeException re) {
  826. LogUtil.errorLogInfo("", TAG, re);
  827. }
  828. catch (Exception e) {
  829. Log.e(TAG, "[Exception] FinishManualActivity()");
  830. //e.printStackTrace();
  831. LogUtil.errorLogInfo("", TAG, e);
  832. }
  833. }
  834. /**
  835. * onDestroy
  836. */
  837. @Override
  838. protected void onDestroy() {
  839. try {
  840. setChangeScreen(mCurrentScreenId, true);
  841. if (mWallPadApiCheckHandler != null) {
  842. mWallPadApiCheckHandler.removeMessages(0);
  843. }
  844. this.unregisterReceiver(mWallPadAlertBR);
  845. this.unregisterReceiver(mWallPadJogBR);
  846. this.unregisterReceiver(mKccDimmBR);
  847. if (ledDimmingAPI != null) {
  848. ledDimmingAPI.unregChangedBR(ID.main.BR_KCC_DIM);
  849. super.removeBrActionFilter(ID.main.BR_KCC_DIM);
  850. }
  851. if (getManualUse()) {
  852. FinishManualActivity();
  853. }
  854. super.setFinishTimerDestroy();
  855. super.onDestroy();
  856. Log.i(TAG, "*************************************************************");
  857. Log.i(TAG, "****************** [END - MainActivity] *******************");
  858. Log.i(TAG, "*************************************************************");
  859. } catch (RuntimeException re) {
  860. LogUtil.errorLogInfo("", TAG, re);
  861. }
  862. catch (Exception e) {
  863. Log.e(TAG, "[Exception] onDestroy()");
  864. //e.printStackTrace();
  865. LogUtil.errorLogInfo("", TAG, e);
  866. }
  867. }
  868. /**
  869. * onResume
  870. */
  871. @Override
  872. protected void onResume() {
  873. super.onResume();
  874. if (wpapi != null) wpapi.Resume();
  875. DebugLogOutput("@@@@@@@@ [onResume] @@@@@@@@");
  876. }
  877. /**
  878. * onPause
  879. */
  880. @Override
  881. protected void onPause() {
  882. super.onPause();
  883. if (wpapi != null) wpapi.Pause();
  884. DebugLogOutput("@@@@@@@@ [onPause] @@@@@@@@");
  885. }
  886. /* ================================================================================================
  887. * [BroadcastReceiver] Section
  888. ================================================================================================ */
  889. /**
  890. * BroadcastReceiver.onReceive for [WpadActivity]
  891. */
  892. @Override
  893. protected void onBrReceive(Intent intent) {
  894. super.onBrReceive(intent);
  895. String strActionName = intent.getAction();
  896. DebugLogOutput("[onBrReceive] strActionName [" + intent.getAction() + "]");
  897. if (strActionName.equals(ID.main.BR_KCC_DIM)) {
  898. DebugLogOutput("[onBrReceive] ID.main.BR_KCC_DIM");
  899. Device_Update_Dimming(false, (byte)0);
  900. Draw_Update_DimmBtn();
  901. }
  902. }
  903. /* ================================================================================================
  904. * [Touch & Key Event] Section
  905. ================================================================================================ */
  906. /**
  907. * TouchEvent for [WpadActivity]
  908. */
  909. @Override
  910. protected void onTouchEvent(View v, MotionEvent event) {
  911. super.onTouchEvent(v, event);
  912. try {
  913. int TargetId = v.getId();
  914. int MoveEvent = event.getAction();
  915. //DebugLogOutput("onTouch - " + "id : " + v.getId() + " / Action : " + event.getAction());
  916. if (MoveEvent == MotionEvent.ACTION_UP) {
  917. if (TargetId == ID.main.button.HOME) {
  918. DebugLogOutput("onTouchEvent [HOME] BUTTON !!!");
  919. Sound().Play(SND.effect.TOUCH_LATCHED);
  920. Intent intent = new Intent();
  921. intent.putExtra("Finish_Kind", "HomeButton");
  922. setResult(RESULT_OK, intent);
  923. finish();
  924. }
  925. else if (TargetId == ID.main.button.BACK) {
  926. DebugLogOutput("onTouchEvent [BACK] BUTTON !!!");
  927. Sound().Play(SND.effect.TOUCH_LATCHED);
  928. /**
  929. *[수정필요]Back Button 필요한 화면은 아래 부분 추가 후 사용 필요
  930. * **/
  931. /*
  932. if(mCurrentScreenId == API_Menu.SubMenuConfig.SmartKey)
  933. {
  934. setChangeScreen(API_Menu.SubMenuConfig.Configuration, false);
  935. }
  936. */
  937. }
  938. else if (TargetId == ID.main.button.MENU) {
  939. DebugLogOutput("onTouchEvent [MENU] BUTTON !!!");
  940. Log.i(TAG, "MenuOpen = " + MenuOpen);
  941. Sound().Play(SND.effect.TOUCH_LATCHED);
  942. if (MenuOpen == true) {
  943. return;
  944. }
  945. OpenMenuLayout();
  946. }
  947. else if (TargetId == ID.main.button.MENUCLOSE) {
  948. Sound().Play(SND.effect.TOUCH_LATCHED);
  949. CloseMenuLayout();
  950. }
  951. else if (TargetId == ID.main.button.BOILER) {
  952. DebugLogOutput("onTouchEvent [BOILER] BUTTON !!!");
  953. if (mCurrentMultiScreenId == ID.screen.HeatingV2TestScreen) {
  954. if(StartPopup(ID.screen.HeatingV2PopupBoilerTestScreen)) {
  955. Sound().Play(SND.effect.TOUCH_LATCHED);
  956. }
  957. }
  958. else {
  959. if(StartPopup(ID.screen.HeatingV2PopupBoilerScreen)) {
  960. Sound().Play(SND.effect.TOUCH_LATCHED);
  961. }
  962. }
  963. }
  964. else if (TargetId == ID.main.button.HIDE1 || TargetId == ID.main.button.HIDE2) {
  965. HideMenuEntryProc(TargetId);
  966. }
  967. else if (TargetId == ID.main.button.AIRQBACK) {
  968. DebugLogOutput("onTouchEvent [AIRQBACK] BUTTON !!!");
  969. Sound().Play(SND.effect.TOUCH_LATCHED);
  970. setAIRBackBtnVisible(false);
  971. setChangeScreen(API_Menu.SubMenuCtrl.Inner_AirQuality, false);
  972. }
  973. else if (TargetId == ID.main.button.VENTILBACK) {
  974. DebugLogOutput("onTouchEvent [AIRQBACK] BUTTON !!!");
  975. Sound().Play(SND.effect.TOUCH_LATCHED);
  976. setVentilBackBtnVisible(false);
  977. setChangeScreen(API_Menu.SubMenuCtrl.ChangAir_Normal, false);
  978. }
  979. else if (TargetId >= ID.main.button.DIMM_NORMAL && TargetId <= ID.main.button.DIMM_REST) {
  980. DebugLogOutput("onTouchEvent [DIMM_NORMAL] BUTTON !!!");
  981. try {
  982. // 디밍제어
  983. int index = TargetId - ID.main.button.DIMM_NORMAL;
  984. DebugLogOutput("onTouchEvent [DIM_LEV" + (index + 1) + "] BUTTON !!!");
  985. if (mDimData.DimData.Device[0] == null) {
  986. DebugLogOutput("null event");
  987. }
  988. if(mDimData.DimData.Device[0]!=null && mLevelArray!=null)
  989. {
  990. byte NowLevel = mDimData.DimData.Device[0].device.Level;
  991. DebugLogOutput("NowLevel :" + NowLevel);
  992. byte CtrlLevel = mLevelArray[index];
  993. DebugLogOutput("CtrlLevel :" + CtrlLevel);
  994. if (NowLevel == CtrlLevel) {
  995. TopDimmingBtn[index].setButtonRearImage(); // 켜진 상태 그대로 유지
  996. }
  997. else if (NowLevel != CtrlLevel) {
  998. int ret = Device_SetDimmingLevel(CtrlLevel);
  999. if (ret >= 0) Sound().Play(SND.effect.TOUCH_LATCHED);
  1000. else Sound().Play(SND.effect.TOUCH_UNLATCHED);
  1001. }
  1002. }
  1003. } catch (RuntimeException re) {
  1004. Sound().Play(SND.effect.TOUCH_UNLATCHED);
  1005. LogUtil.errorLogInfo("", TAG, re);
  1006. }
  1007. catch (Exception ex) {
  1008. Sound().Play(SND.effect.TOUCH_UNLATCHED);
  1009. //ex.printStackTrace();
  1010. LogUtil.errorLogInfo("", TAG, ex);
  1011. }
  1012. }
  1013. else if (TargetId == ID.main.button.MANUAL) {
  1014. Log.i(TAG, "onTouchEvent [MANUAL] BUTTON [mCurrentScreenId = " + mCurrentScreenId + "]");
  1015. Sound().Play(SND.effect.TOUCH_LATCHED);
  1016. if (mCurrentScreenId == API_Menu.SubMenuCtrl.HDC_LivingLamp) { StartManual(ID.MANUAL.MANUAL_HdcLivingLight); }
  1017. else if (mCurrentScreenId == API_Menu.SubMenuCtrl.LivingLightConfig) { StartManual(ID.MANUAL.MANUAL_HdcLivingGroup); }
  1018. else if (mCurrentScreenId == API_Menu.SubMenuCtrl.OutSide_livingLamp) { StartManual(ID.MANUAL.MANUAL_EtcLivingLight); }
  1019. else if (mCurrentScreenId == API_Menu.SubMenuCtrl.HDCLivingNEach_Lamp) {}
  1020. else if (mCurrentScreenId == API_Menu.SubMenuCtrl.OutSide_EachLamp) { StartManual(ID.MANUAL.MANUAL_EtcMultiLight); }
  1021. else if (mCurrentScreenId == API_Menu.SubMenuCtrl.Heating_V2 || mCurrentScreenId == API_Menu.SubMenuCtrl.Heating_V1) { StartManual(ID.MANUAL.MANUAL_Heating); }
  1022. else if (mCurrentScreenId == API_Menu.SubMenuCtrl.Gas) { StartManual(ID.MANUAL.MANUAL_Gas); }
  1023. else if (mCurrentScreenId == API_Menu.SubMenuCtrl.Cooktop_Concent) { StartManual(ID.MANUAL.MANUAL_CookTopConcent); }
  1024. else if (mCurrentScreenId == API_Menu.SubMenuCtrl.DoorLockWL) { StartManual(ID.MANUAL.MANUAL_Doorlock); }
  1025. else if (mCurrentScreenId == API_Menu.SubMenuCtrl.DoorLock485) { StartManual(ID.MANUAL.MANUAL_Doorlock); }
  1026. else if (mCurrentScreenId == API_Menu.SubMenuCtrl.Concent) { StartManual(ID.MANUAL.MANUAL_Concent); }
  1027. else if (mCurrentScreenId == API_Menu.SubMenuCtrl.ChangAir_Normal) {
  1028. if (getAirSensorAPUsage() && VentilStatus.Support.InnerCycle && VentilStatus.Support.OutAirClean) {
  1029. if (nDistributionPanelType != Version.DISTRIBUTION_MODEL.KNX_DIST) StartManual(ID.MANUAL.MANUAL_Ventilation);
  1030. }
  1031. else {
  1032. if (GetEasyModeUXUse()) StartManual(ID.MANUAL.MANUAL_Easymode_Venti);
  1033. else {
  1034. if (VentilStatus.Support2.WindowVenti) StartManual(ID.MANUAL.MANUAL_Venti);
  1035. else StartManual(ID.MANUAL.MANUAL_Ventilation);
  1036. }
  1037. }
  1038. }
  1039. else if (mCurrentScreenId == API_Menu.SubMenuCtrl.Inner_AirQuality) { StartManual(ID.MANUAL.MANUAL_InAirQual); }
  1040. else if (mCurrentScreenId == API_Menu.SubMenuCtrl.Inner_AirInfo) { /*StartManual(ID.MANUAL.MANUAL_AirInfo);*/ }
  1041. else if (mCurrentScreenId == API_Menu.SubMenuCtrl.Electric_Range) { StartManual(ID.MANUAL.MANUAL_ElecRange); }
  1042. }
  1043. else if (TargetId >= ID.main.button.MULTI1 && TargetId <= ID.main.button.MULTI3) {
  1044. Log.i(TAG, "onTouchEvent [TEST1] BUTTON [mCurrentScreenId = " + mCurrentScreenId + "]");
  1045. Sound().Play(SND.effect.TOUCH_LATCHED);
  1046. int index = TargetId - ID.main.button.MULTI1;
  1047. for(int i = 0; i< MultiBtn.length; i++){
  1048. MultiBtn[i].setButtonFrontImage();
  1049. MultiBtn[i].setButtonEventOffDisable();
  1050. }
  1051. MultiBtn[index].setButtonRearImage();
  1052. //해당층
  1053. if(ho==(index+1)){
  1054. if (mCurrentScreenId == API_Menu.SubMenuCtrl.HDC_LivingLamp) {
  1055. setChangeScreen(API_Menu.SubMenuCtrl.HDC_LivingLamp, false);
  1056. } else if (mCurrentScreenId == API_Menu.SubMenuCtrl.Heating_V2 || mCurrentScreenId == API_Menu.SubMenuCtrl.Heating_V1) {
  1057. setChangeScreen(API_Menu.SubMenuCtrl.Heating_V2, false);
  1058. } else if (mCurrentScreenId == API_Menu.SubMenuCtrl.Gas) {
  1059. if(ho==2){
  1060. setChangeScreen(API_Menu.SubMenuCtrl.Gas, false);
  1061. }else{
  1062. StartMultiControl(ID.screen.GasTestScreen, 2);
  1063. }
  1064. //setChangeScreen(API_Menu.SubMenuCtrl.Gas, false);
  1065. } else if (mCurrentScreenId == API_Menu.SubMenuCtrl.SystemAircon) {
  1066. setChangeScreen(API_Menu.SubMenuCtrl.SystemAircon, false);
  1067. } else if (mCurrentScreenId == API_Menu.SubMenuCtrl.ChangAir_Normal) {
  1068. setChangeScreen(API_Menu.SubMenuCtrl.ChangAir_Normal, false);
  1069. }
  1070. }else {
  1071. //다른층
  1072. if (mCurrentScreenId == API_Menu.SubMenuCtrl.HDC_LivingLamp) {
  1073. StartMultiControl(ID.screen.LightKnxMainTestScreen, index+1);
  1074. } else if (mCurrentScreenId == API_Menu.SubMenuCtrl.LivingLightConfig) {
  1075. StartMultiControl(API_Menu.SubMenuCtrl.Gas, index+1);
  1076. } else if (mCurrentScreenId == API_Menu.SubMenuCtrl.Heating_V2 || mCurrentScreenId == API_Menu.SubMenuCtrl.Heating_V1) {
  1077. StartMultiControl(ID.screen.HeatingV2TestScreen, index+1);
  1078. } else if (mCurrentScreenId == API_Menu.SubMenuCtrl.Gas) {
  1079. MultiBtn[0].setButtonEventOffEnable(R.drawable.tab_floor_1_disabled);
  1080. MultiBtn[1].setButtonEventOffEnable(R.drawable.tab_floor_2_selected);
  1081. MultiBtn[2].setButtonEventOffEnable(R.drawable.tab_floor_3_disabled);
  1082. //다른층은 2층으로 연동시킨다.
  1083. StartMultiControl(ID.screen.GasTestScreen, 2);
  1084. } else if (mCurrentScreenId == API_Menu.SubMenuCtrl.SystemAircon) {
  1085. StartMultiControl(ID.screen.KnxSystemAirconMainTestScreen, index+1);
  1086. //StartMultiControl(ID.screen.SystemAirconTest1Screen, index+1);
  1087. } else if (mCurrentScreenId == API_Menu.SubMenuCtrl.ChangAir_Normal) {
  1088. StartMultiControl(ID.screen.VentiMainTestScreen, index+1);
  1089. }
  1090. }
  1091. }
  1092. }
  1093. } catch (RuntimeException re) {
  1094. LogUtil.errorLogInfo("", TAG, re);
  1095. }
  1096. catch (Exception e) {
  1097. Log.e(TAG, "[Exception] onTouchEvent(View v, MotionEvent event)");
  1098. //e.printStackTrace();
  1099. LogUtil.errorLogInfo("", TAG, e);
  1100. }
  1101. }
  1102. /**
  1103. * H/W Key Event
  1104. */
  1105. @Override
  1106. public boolean onKeyDown(int keyCode, KeyEvent event) {
  1107. Log.i(TAG, "[onKeyDown] keyCode : " + keyCode + ", Action : " + event.getAction());
  1108. return super.onKeyDown(keyCode, event);
  1109. }
  1110. /* ================================================================================================
  1111. * [TOP - Back] Section
  1112. ================================================================================================ */
  1113. /**
  1114. * TOP 돌아가기 버튼 활성화 & 비활성화
  1115. *
  1116. * @param Enabled - true : 활성화, false : 비활성화
  1117. * @return (boolean) true : 성공, false : 실패
  1118. */
  1119. public boolean setTopBackBtnVisible(boolean Enabled) {
  1120. try {
  1121. if (Enabled == true) {
  1122. if (TopBackBtn.getVisibility() != View.VISIBLE) TopBackBtn.setVisibility(View.VISIBLE);
  1123. TopBackBtn.bringToFront();
  1124. }
  1125. else {
  1126. if (TopBackBtn.getVisibility() != View.INVISIBLE) TopBackBtn.setVisibility(View.INVISIBLE);
  1127. }
  1128. return true;
  1129. } catch (RuntimeException re) {
  1130. LogUtil.errorLogInfo("", TAG, re);
  1131. return false;
  1132. }
  1133. catch (Exception e) {
  1134. Log.e(TAG, "[Exception] setTopBackBtnVisible(boolean Enabled)");
  1135. //e.printStackTrace();
  1136. LogUtil.errorLogInfo("", TAG, e);
  1137. return false;
  1138. }
  1139. }
  1140. /* ================================================================================================
  1141. * [Popup Activity] Section
  1142. ================================================================================================ */
  1143. /**
  1144. * Popup Activity 를 시작시킨다.
  1145. *
  1146. * @param ScreenId - 팝업시작시 Screen ID
  1147. * @return (boolean) true : 성공, false : 실패
  1148. */
  1149. public boolean StartPopup(int ScreenId) {
  1150. if (getPopupActivityRun() == true) {
  1151. return ((WpadActivity) (PopupActivity.getContext())).ChangeScreen(ScreenId);
  1152. }
  1153. else {
  1154. setPopupActivityRun(true);
  1155. Intent intent = new Intent(mContext, PopupActivity.class);
  1156. intent.putExtra("ScreenId", ScreenId);
  1157. intent.putExtra("Ho", mMultiAddress);
  1158. overridePendingTransition(0, 0);
  1159. startActivityForResult(intent, 0);
  1160. return true;
  1161. }
  1162. }
  1163. /**
  1164. * Popup Activity 를 시작시킨다. (시작시 Intent Type 데이터를 전달한다)
  1165. *
  1166. * @param ScreenId - 팝업시작시 Screen ID
  1167. * @param data - 전달할 데이터
  1168. * @return (boolean) true : 성공, false : 실패
  1169. */
  1170. public boolean StartPopup(int ScreenId, Intent data) {
  1171. if (getPopupActivityRun() == true) {
  1172. return false;
  1173. }
  1174. else {
  1175. setPopupActivityRun(true);
  1176. Intent intent = new Intent(mContext, PopupActivity.class);
  1177. intent.putExtra("ScreenId", ScreenId);
  1178. intent.putExtra("Ho", mMultiAddress);
  1179. intent.putExtra("PopupScreenDataIntent", data);
  1180. overridePendingTransition(0, 0);
  1181. startActivityForResult(intent, 0);
  1182. return true;
  1183. }
  1184. }
  1185. /**
  1186. * Activity Result Reception
  1187. */
  1188. @Override
  1189. protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  1190. super.onActivityResult(requestCode, resultCode, data);
  1191. try {
  1192. if(mCurrentMultiScreenId == ID.screen.LightKnxMainTestScreen||mCurrentMultiScreenId == ID.screen.HeatingV2TestScreen
  1193. ||mCurrentMultiScreenId == ID.screen.KnxSystemAirconMainTestScreen||mCurrentMultiScreenId == ID.screen.VentiMainTestScreen){
  1194. if(resultCode==0&&data==null){
  1195. super.onActivityResult(requestCode, 10000, data);
  1196. }
  1197. }
  1198. Log.d(TAG, "@@@@@@@@ [onActivityResult] @@@@@@@@");
  1199. if (resultCode == RESULT_OK) {
  1200. // PopupActivity 에서 FinishTimer 로 인하여 종료가 되었을 경우
  1201. // MainActivity 도 즉시 종료시킨다.
  1202. String code = (String) data.getExtras().get("Finish_Kind");
  1203. Log.d(TAG, "[onActivityResult] Finish_Kind : " + code);
  1204. if (code != null) {
  1205. if (code.equals("FinishTimer")) {
  1206. Log.d(TAG, "FinishTimer finish");
  1207. finish();
  1208. }
  1209. }
  1210. }
  1211. } catch (RuntimeException re) {
  1212. LogUtil.errorLogInfo("", TAG, re);
  1213. }
  1214. catch (Exception e) {
  1215. Log.e(TAG, "[Exception] onActivityResult(int requestCode, int resultCode, Intent data)");
  1216. //e.printStackTrace();
  1217. LogUtil.errorLogInfo("", TAG, e);
  1218. }
  1219. }
  1220. /* ================================================================================================
  1221. * [Screen] Section
  1222. ================================================================================================ */
  1223. /**
  1224. * Screen 에서 Screen 변경을 요청할 경우 호출된다.<br>
  1225. * Override 사용하여 Screen 변경을 처리한다.<br>
  1226. *
  1227. * @param nScreenId - 변경할 Screen ID
  1228. * @return (boolean) true : 성공, false : 실패
  1229. */
  1230. @Override
  1231. protected boolean onChangeScreen(int nScreenId) {
  1232. super.onChangeScreen(nScreenId);
  1233. return setChangeScreen(nScreenId, false);
  1234. }
  1235. /**
  1236. * @param nScreenId - 변경할 Screen ID
  1237. * @return (boolean) true : 성공, false : 실패
  1238. **/
  1239. private boolean setTitleName(int nScreenId) {
  1240. boolean ret = false;
  1241. try {
  1242. Log.d(TAG, "[setTitleName] nScreenId [" + nScreenId + "]");
  1243. switch (nScreenId) {
  1244. case API_Menu.SubMenuCtrl.HDC_LivingLamp:
  1245. case ID.screen.LightKnxMainTestScreen:
  1246. SetTitleText(API_Menu.SubMenuCtrl.Name_Lamp);
  1247. ret = true;
  1248. break;
  1249. case API_Menu.SubMenuCtrl.HDC_EachLamp:
  1250. SetTitleText(API_Menu.SubMenuCtrl.Name_Lamp);
  1251. ret = true;
  1252. break;
  1253. case API_Menu.SubMenuCtrl.LivingLightConfig:
  1254. SetTitleText(API_Menu.SubMenuCtrl.Name_LivingLightConfig);
  1255. ret = true;
  1256. break;
  1257. case API_Menu.SubMenuCtrl.OutSide_livingLamp:
  1258. SetTitleText(API_Menu.SubMenuCtrl.Name_Lamp);
  1259. ret = true;
  1260. break;
  1261. case API_Menu.SubMenuCtrl.OutSide_EachLamp:
  1262. SetTitleText(API_Menu.SubMenuCtrl.Name_Lamp);
  1263. ret = true;
  1264. break;
  1265. case API_Menu.SubMenuCtrl.HDCLivingNEach_Lamp:
  1266. SetTitleText(API_Menu.SubMenuCtrl.Name_Lamp);
  1267. ret = true;
  1268. break;
  1269. case API_Menu.SubMenuCtrl.Heating_V2:
  1270. case ID.screen.HeatingV2TestScreen:
  1271. SetTitleText(API_Menu.SubMenuCtrl.Name_Heating);
  1272. ret = true;
  1273. break;
  1274. case API_Menu.SubMenuCtrl.Gas:
  1275. case ID.screen.GasTestScreen:
  1276. SetTitleText(API_Menu.SubMenuCtrl.Name_Gas);
  1277. ret = true;
  1278. break;
  1279. case API_Menu.SubMenuCtrl.DoorLock485:
  1280. SetTitleText(API_Menu.SubMenuCtrl.Name_DoorLock);
  1281. ret = true;
  1282. break;
  1283. case API_Menu.SubMenuCtrl.DoorLockWL:
  1284. SetTitleText(API_Menu.SubMenuCtrl.Name_DoorLock);
  1285. ret = true;
  1286. break;
  1287. case API_Menu.SubMenuCtrl.ChangAir_Normal:
  1288. case API_Menu.SubMenuCtrl.ChangAir_LH:
  1289. case API_Menu.SubMenuCtrl.ChangAir_Hood:
  1290. case ID.screen.VentiMainTestScreen:
  1291. SetTitleText(API_Menu.SubMenuCtrl.Name_Venti);
  1292. ret = true;
  1293. break;
  1294. case API_Menu.SubMenuCtrl.Inner_AirQuality:
  1295. SetTitleText(API_Menu.SubMenuCtrl.Name_InnerAirQuality);
  1296. ret = true;
  1297. break;
  1298. case API_Menu.SubMenuCtrl.Inner_AirInfo:
  1299. SetTitleText(API_Menu.SubMenuCtrl.Name_InnerAirInfo);
  1300. ret = true;
  1301. break;
  1302. case API_Menu.SubMenuCtrl.Concent:
  1303. case API_Menu.SubMenuCtrl.HDCLivingNEach_Concent:
  1304. SetTitleText(API_Menu.SubMenuCtrl.Name_Concent);
  1305. ret = true;
  1306. break;
  1307. case API_Menu.SubMenuCtrl.SystemAircon:
  1308. case ID.screen.SystemAirconTest1Screen:
  1309. case ID.screen.KnxSystemAirconMainTestScreen:
  1310. SetTitleText(API_Menu.SubMenuCtrl.Name_SystemAircon);
  1311. ret = true;
  1312. break;
  1313. case API_Menu.SubMenuCtrl.Purity:
  1314. SetTitleText(API_Menu.SubMenuCtrl.Name_Purity);
  1315. ret = true;
  1316. break;
  1317. case API_Menu.SubMenuCtrl.ParkingDoor:
  1318. SetTitleText(API_Menu.SubMenuCtrl.Name_ParkingDoor);
  1319. ret = true;
  1320. break;
  1321. default:
  1322. Log.e(TAG, "[Error] setTitleName - nScreenId Not found!!! (" + mCurrentScreenId + ")");
  1323. //mCurrentScreenId = -1;
  1324. SetTitleText(API_Menu.SubMenuCtrl.Name_Lamp);
  1325. ret = false;
  1326. break;
  1327. }
  1328. } catch (RuntimeException re) {
  1329. LogUtil.errorLogInfo("", TAG, re);
  1330. }
  1331. catch (Exception e) {
  1332. Log.e(TAG, "[Exception] setTitleName(int nScreenId)");
  1333. //e.printStackTrace();
  1334. LogUtil.errorLogInfo("", TAG, e);
  1335. }
  1336. return ret;
  1337. }
  1338. /**
  1339. * Screen 등록자<br>
  1340. * ScreenLayout 에 현재 Screen 을 삭제하고, 새로운 Screen 을 등록시킨다.
  1341. *
  1342. * @param nScreenId - 변경할 Screen ID
  1343. * @param OnlyRemove - 현재 Screen 을 삭제만 할 경우 (onDestroy 에서 사용)
  1344. * @return (boolean) true : 성공, false : 실패
  1345. */
  1346. private boolean setChangeScreen(int nScreenId, boolean OnlyRemove) {
  1347. DebugLogOutput("setChangeScreen - " + "CurrentSelectDeviceId : " + mCurrentScreenId + " / NextLayoutId : " + nScreenId + " / OnlyRemove : " + OnlyRemove);
  1348. // 1. 현재 Layout 삭제
  1349. if (mCurrentScreenId > 0) {
  1350. ScreenLayout.removeAllViews();
  1351. super.setCurrentScreen(null);
  1352. }
  1353. if (OnlyRemove) return true;
  1354. mCurrentScreenId = nScreenId;
  1355. mCurrentMultiScreenId = 0;
  1356. setTopBackBtnVisible(false);
  1357. setMultiBtnVisible(false);
  1358. boolean result = false;
  1359. // 2. 새로운 Layout 표시
  1360. try {
  1361. setTitleName(nScreenId);
  1362. GetRoomNameV2(); // 스크린 체인지 시 방명칭 수정 적용되어야 함.
  1363. //super.setFinishTimerCreate(Common.FINISH_TIME_SEC);
  1364. switch (nScreenId) {
  1365. /**
  1366. * [수정필요]
  1367. * Back Button 필요한 화면은 setTopBackBtnVisible(true) 호출 필요
  1368. * 추가 또는 수정해야할 부분 1. - 스크린 별 layout 생성
  1369. * **/
  1370. //추가 또는 수정해야할 부분 1. - 스크린 별 layout 생성
  1371. case API_Menu.SubMenuCtrl.HDC_LivingLamp: {
  1372. if (nDistributionPanelType == Version.DISTRIBUTION_MODEL.SMART_DIST) {
  1373. // 스마트 분전반
  1374. lightHdcLivMainScreen = new LightHdcLivMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
  1375. super.setCurrentScreen(lightHdcLivMainScreen);
  1376. setTopBoilerBtnVisible(false);
  1377. setAIRBackBtnVisible(false);
  1378. setKccDimmBtnVisible(false);
  1379. setVentilBackBtnVisible(false);
  1380. result = true;
  1381. break;
  1382. }
  1383. else if (nDistributionPanelType == Version.DISTRIBUTION_MODEL.KNX_DIST) {
  1384. // KNX 분전반
  1385. // madeinlab 새로 만든 스크린으로 적용한다.
  1386. lightKnxMainScreen = new LightKnxMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mRoomNameList_Light);
  1387. super.setCurrentScreen(lightKnxMainScreen);
  1388. setTopBoilerBtnVisible(false);
  1389. setAIRBackBtnVisible(false);
  1390. setKccDimmBtnVisible(false);
  1391. setVentilBackBtnVisible(false);
  1392. setManualBtnVisible(false, 1019);
  1393. setMultiBtnVisible(true);
  1394. result = true;
  1395. break;
  1396. }
  1397. }
  1398. /*case API_Menu.SubMenuCtrl.HDC_EachLamp:
  1399. {
  1400. if( (SmartDistUse == 1) && (KnxDistUse == false) ) // 스마트분전반 O / KNX 분전반 X
  1401. {
  1402. lightHdcLivMainScreen = new LightHdcLivMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
  1403. super.setCurrentScreen(lightHdcLivMainScreen);
  1404. setTopBoilerBtnVisible(false);
  1405. setAIRBackBtnVisible(false);
  1406. setKccDimmBtnVisible(false);
  1407. result = true;
  1408. break;
  1409. }
  1410. else if( (SmartDistUse == 0) && (KnxDistUse == true) ) // 스마트분전반 X / KNX 분전반 O
  1411. {
  1412. lightHdcLivKnxMainScreen = new LightHdcLivKnxMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
  1413. super.setCurrentScreen(lightHdcLivKnxMainScreen);
  1414. setTopBoilerBtnVisible(false);
  1415. setAIRBackBtnVisible(false);
  1416. setKccDimmBtnVisible(false);
  1417. result = true;
  1418. break;
  1419. }
  1420. }*/
  1421. case API_Menu.SubMenuCtrl.LivingLightConfig:
  1422. lightHdcLivConifgScreen = new LightHdcLivConifgScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
  1423. super.setCurrentScreen(lightHdcLivConifgScreen);
  1424. setTopBoilerBtnVisible(false);
  1425. setAIRBackBtnVisible(false);
  1426. setKccDimmBtnVisible(false);
  1427. setVentilBackBtnVisible(false);
  1428. result = true;
  1429. break;
  1430. //OutSide_EachLamp
  1431. case API_Menu.SubMenuCtrl.OutSide_EachLamp:
  1432. SetTitleText(API_Menu.SubMenuCtrl.Name_Lamp);
  1433. lightEtcEachMainScreen = new LightEtcEachMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mRoomNameList_Light);
  1434. super.setCurrentScreen(lightEtcEachMainScreen);
  1435. setTopBoilerBtnVisible(false);
  1436. setAIRBackBtnVisible(false);
  1437. setKccDimmBtnVisible(true);
  1438. setVentilBackBtnVisible(false);
  1439. result = true;
  1440. break;
  1441. case API_Menu.SubMenuCtrl.OutSide_livingLamp:
  1442. SetTitleText(API_Menu.SubMenuCtrl.Name_Lamp);
  1443. lightEtcLivMainScreen = new LightEtcLivMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
  1444. super.setCurrentScreen(lightEtcLivMainScreen);
  1445. setTopBoilerBtnVisible(false);
  1446. setAIRBackBtnVisible(false);
  1447. setKccDimmBtnVisible(true);
  1448. setVentilBackBtnVisible(false);
  1449. result = true;
  1450. break;
  1451. case API_Menu.SubMenuCtrl.HDCLivingNEach_Lamp:
  1452. SetTitleText(API_Menu.SubMenuCtrl.Name_Lamp);
  1453. lightHdcNEachMainScreen = new LightHdcNEachMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mRoomNameList_Light);
  1454. super.setCurrentScreen(lightHdcNEachMainScreen);
  1455. setTopBoilerBtnVisible(false);
  1456. setAIRBackBtnVisible(false);
  1457. setKccDimmBtnVisible(true);
  1458. setVentilBackBtnVisible(false);
  1459. result = true;
  1460. break;
  1461. case API_Menu.SubMenuCtrl.Heating_V1:
  1462. case API_Menu.SubMenuCtrl.Heating_V2:
  1463. SetTitleText(API_Menu.SubMenuCtrl.Name_Heating);
  1464. try {
  1465. if(wpapi.GetHeatingKind() == 1)
  1466. {
  1467. heatingV1MainScreen = new HeatingV1MainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mRoomNameList_Heating);
  1468. super.setCurrentScreen(heatingV1MainScreen);
  1469. if (OPERATION_MODE == Common.MODE_BUSINESS_SAMPLE) {
  1470. //setTopBoilerBtnVisible(true); // 임시 강제 생성코드
  1471. }
  1472. }
  1473. else
  1474. {
  1475. heatingV2MainScreen = new HeatingV2MainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mRoomNameList_Heating);
  1476. super.setCurrentScreen(heatingV2MainScreen);
  1477. if (OPERATION_MODE == Common.MODE_BUSINESS_SAMPLE) {
  1478. //setTopBoilerBtnVisible(true); // 임시 강제 생성코드
  1479. }
  1480. }
  1481. }
  1482. catch (Exception e)
  1483. {
  1484. heatingV2MainScreen = new HeatingV2MainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mRoomNameList_Heating);
  1485. super.setCurrentScreen(heatingV2MainScreen);
  1486. if (OPERATION_MODE == Common.MODE_BUSINESS_SAMPLE) {
  1487. //setTopBoilerBtnVisible(true); // 임시 강제 생성코드
  1488. }
  1489. }
  1490. setAIRBackBtnVisible(false);
  1491. setKccDimmBtnVisible(false);
  1492. setVentilBackBtnVisible(false);
  1493. setMultiBtnVisible(true);
  1494. result = true;
  1495. break;
  1496. case API_Menu.SubMenuCtrl.Gas:
  1497. try {
  1498. if(wpapi.GetGasKind() == 1)
  1499. {
  1500. SetTitleText(API_Menu.SubMenuCtrl.Name_Gas);
  1501. gasMainScreen = new GasMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
  1502. super.setCurrentScreen(gasMainScreen);
  1503. }
  1504. else if(wpapi.GetGasKind() == 2)
  1505. {
  1506. SetTitleText(API_Menu.SubMenuCtrl.Name_Gas);
  1507. if(ho==2) {
  1508. hybridCookTopMainScreen = new HybridCookTopMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
  1509. super.setCurrentScreen(hybridCookTopMainScreen);
  1510. }else {
  1511. StartMultiControl(ID.screen.GasTestScreen, 2);
  1512. }
  1513. }
  1514. else
  1515. {
  1516. SetTitleText(API_Menu.SubMenuCtrl.Name_Gas);
  1517. if(ho==2) {
  1518. hybridCookTopMainScreen = new HybridCookTopMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
  1519. super.setCurrentScreen(hybridCookTopMainScreen);
  1520. }else {
  1521. StartMultiControl(ID.screen.GasTestScreen, 2);
  1522. }
  1523. //gasMainScreen = new GasMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
  1524. //super.setCurrentScreen(gasMainScreen);
  1525. }
  1526. }
  1527. catch (Exception e)
  1528. {
  1529. // SetTitleText(API_Menu.SubMenuCtrl.Name_Gas);
  1530. // gasMainScreen = new GasMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
  1531. // super.setCurrentScreen(gasMainScreen);
  1532. }
  1533. // SetTitleText(API_Menu.SubMenuCtrl.Name_Gas);
  1534. // gasMainScreen = new GasMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
  1535. // super.setCurrentScreen(gasMainScreen);
  1536. setTopBoilerBtnVisible(false);
  1537. setAIRBackBtnVisible(false);
  1538. setKccDimmBtnVisible(false);
  1539. setVentilBackBtnVisible(false);
  1540. setGasMultiBtnVisible(true);
  1541. result = true;
  1542. break;
  1543. case API_Menu.SubMenuCtrl.DoorLock485:
  1544. SetTitleText(API_Menu.SubMenuCtrl.Name_DoorLock);
  1545. doorLockMainScreen = new DoorLockMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, API_Menu.SubMenuCtrl.DoorLock485);
  1546. super.setCurrentScreen(doorLockMainScreen);
  1547. setTopBoilerBtnVisible(false);
  1548. setAIRBackBtnVisible(false);
  1549. setKccDimmBtnVisible(false);
  1550. result = true;
  1551. break;
  1552. case API_Menu.SubMenuCtrl.DoorLockWL:
  1553. SetTitleText(API_Menu.SubMenuCtrl.Name_DoorLock);
  1554. doorLockMainScreen = new DoorLockMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, API_Menu.SubMenuCtrl.DoorLockWL);
  1555. super.setCurrentScreen(doorLockMainScreen);
  1556. setTopBoilerBtnVisible(false);
  1557. setAIRBackBtnVisible(false);
  1558. setKccDimmBtnVisible(false);
  1559. result = true;
  1560. break;
  1561. case API_Menu.SubMenuCtrl.ChangAir_Normal:
  1562. case API_Menu.SubMenuCtrl.ChangAir_LH:
  1563. case API_Menu.SubMenuCtrl.ChangAir_Hood:
  1564. if(isUseModelHouse_Venti)
  1565. {
  1566. SetTitleText(API_Menu.SubMenuCtrl.Name_Venti);
  1567. ventilationModelMainScreen = new VentilationModelMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, nScreenId);
  1568. super.setFinishTimerDestroy();
  1569. super.setCurrentScreen(ventilationModelMainScreen);
  1570. setTopBoilerBtnVisible(false);
  1571. setAIRBackBtnVisible(false);
  1572. setKccDimmBtnVisible(false);
  1573. setVentilBackBtnVisible(false);
  1574. result = true;
  1575. }
  1576. else
  1577. {
  1578. Log.e(TAG, "[setChangeScreen] getAirSensorAPUsage [" + getAirSensorAPUsage() + "], Support.InnerCycle [" + VentilStatus.Support.InnerCycle + "], Support.OutAirClean [" + VentilStatus.Support.OutAirClean + "]");
  1579. if (getAirSensorAPUsage() && VentilStatus.Support.InnerCycle && VentilStatus.Support.OutAirClean) {
  1580. if(isUseModelHouse_Venti)
  1581. {
  1582. ventilationModelMainScreen = new VentilationModelMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, nScreenId);
  1583. super.setCurrentScreen(ventilationModelMainScreen);
  1584. super.setFinishTimerDestroy();
  1585. }
  1586. else
  1587. {
  1588. if (nDistributionPanelType == Version.DISTRIBUTION_MODEL.KNX_DIST) {
  1589. //고급향은 환기가 3개임. KNX 쪽으로 우선 분기를 태움.
  1590. SetTitleText(API_Menu.SubMenuCtrl.Name_Venti);
  1591. //고급향 환기 테스트 때문에 임시로 바꿈.
  1592. //knxVentiMainScreen = new KnxVentiMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, nScreenId);
  1593. //super.setCurrentScreen(knxVentiMainScreen);
  1594. ventilationMainScreen = new VentilationMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, nScreenId);
  1595. super.setCurrentScreen(ventilationMainScreen);
  1596. }
  1597. else {
  1598. SetTitleText(API_Menu.SubMenuCtrl.Name_Venti);
  1599. ventilationMainScreen = new VentilationMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, nScreenId);
  1600. super.setCurrentScreen(ventilationMainScreen);
  1601. }
  1602. }
  1603. setTopBoilerBtnVisible(false);
  1604. setAIRBackBtnVisible(false);
  1605. setKccDimmBtnVisible(false);
  1606. setVentilBackBtnVisible(false);
  1607. setMultiBtnVisible(true);
  1608. result = true;
  1609. }
  1610. else {
  1611. if (GetEasyModeUXUse() == true) {
  1612. SetTitleText(API_Menu.SubMenuCtrl.Name_Venti);
  1613. ventiEasymodeScreen = new VentiEasymodeScreen(this, ScreenLayout, wpapi, OPERATION_MODE, nScreenId);
  1614. super.setCurrentScreen(ventiEasymodeScreen);;
  1615. setTopBoilerBtnVisible(false);
  1616. setAIRBackBtnVisible(false);
  1617. setKccDimmBtnVisible(false);
  1618. setVentilBackBtnVisible(false);
  1619. result = true;
  1620. }
  1621. else {
  1622. if (VentilStatus.Support2.WindowVenti) {
  1623. SetTitleText(API_Menu.SubMenuCtrl.Name_Venti);
  1624. ventiMainScreen = new VentiMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, nScreenId);
  1625. super.setCurrentScreen(ventiMainScreen);
  1626. }
  1627. else {
  1628. if (nDistributionPanelType == Version.DISTRIBUTION_MODEL.KNX_DIST) {
  1629. SetTitleText(API_Menu.SubMenuCtrl.Name_Venti);
  1630. //테스트 때문에 바꿈
  1631. //knxVentiMainScreen = new KnxVentiMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, nScreenId);
  1632. //super.setCurrentScreen(knxVentiMainScreen);
  1633. ventilationMainScreen = new VentilationMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, nScreenId);
  1634. super.setCurrentScreen(ventilationMainScreen);
  1635. setManualBtnVisible(false, 1019);
  1636. }
  1637. else {
  1638. SetTitleText(API_Menu.SubMenuCtrl.Name_Venti);
  1639. ventilationMainScreen = new VentilationMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, nScreenId);
  1640. super.setCurrentScreen(ventilationMainScreen);
  1641. // SetTitleText(API_Menu.SubMenuCtrl.Name_Venti);
  1642. // ventiMainScreen = new VentiMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, API_Menu.SubMenuCtrl.ChangAir_Normal);
  1643. // super.setCurrentScreen(ventiMainScreen);
  1644. }
  1645. }
  1646. setTopBoilerBtnVisible(false);
  1647. setAIRBackBtnVisible(false);
  1648. setKccDimmBtnVisible(false);
  1649. setVentilBackBtnVisible(false);
  1650. setMultiBtnVisible(true);
  1651. result = true;
  1652. }
  1653. }
  1654. }
  1655. break;
  1656. case API_Menu.SubMenuCtrl.Inner_AirQuality:
  1657. SetTitleText(API_Menu.SubMenuCtrl.Name_InnerAirQuality);
  1658. airQualityMainScreen = new AirQualityMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
  1659. super.setCurrentScreen(airQualityMainScreen);
  1660. setTopBoilerBtnVisible(false);
  1661. setAIRBackBtnVisible(false);
  1662. setKccDimmBtnVisible(false);
  1663. setVentilBackBtnVisible(false);
  1664. result = true;
  1665. break;
  1666. case API_Menu.SubMenuCtrl.Inner_AirInfo:
  1667. SetTitleText(API_Menu.SubMenuCtrl.Name_InnerAirInfo);
  1668. dustInfoScreen = new DustInfoScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
  1669. super.setCurrentScreen(dustInfoScreen);
  1670. setTopBoilerBtnVisible(false);
  1671. setAIRBackBtnVisible(false);
  1672. setKccDimmBtnVisible(false);
  1673. setVentilBackBtnVisible(false);
  1674. result = true;
  1675. break;
  1676. case API_Menu.SubMenuCtrl.Concent:
  1677. if (nDistributionPanelType == Version.DISTRIBUTION_MODEL.KNX_DIST) {
  1678. SetTitleText(API_Menu.SubMenuCtrl.Name_Concent);
  1679. concentKnxMainScreen = new ConcentKnxMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mRoomNameList_Light);
  1680. super.setCurrentScreen(concentKnxMainScreen);
  1681. setManualBtnVisible(false, 1019);
  1682. }
  1683. else {
  1684. SetTitleText(API_Menu.SubMenuCtrl.Name_Concent);
  1685. concentMainScreen = new ConcentMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mRoomNameList_Concent);
  1686. super.setCurrentScreen(concentMainScreen);
  1687. setManualBtnVisible(getManualUse(), 1019);
  1688. }
  1689. setTopBoilerBtnVisible(false);
  1690. setAIRBackBtnVisible(false);
  1691. setKccDimmBtnVisible(false);
  1692. setVentilBackBtnVisible(false);
  1693. result = true;
  1694. break;
  1695. case API_Menu.SubMenuCtrl.HDCLivingNEach_Concent:
  1696. SetTitleText(API_Menu.SubMenuCtrl.Name_Concent);
  1697. concentHdcNEachMainScreen = new ConcentHdcNEachMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mRoomNameList_Concent);
  1698. super.setCurrentScreen(concentHdcNEachMainScreen);
  1699. setTopBoilerBtnVisible(false);
  1700. setAIRBackBtnVisible(false);
  1701. setKccDimmBtnVisible(false);
  1702. setVentilBackBtnVisible(false);
  1703. setManualBtnVisible(false, 1019);
  1704. result = true;
  1705. break;
  1706. case API_Menu.SubMenuCtrl.Electric_Range:
  1707. SetTitleText(API_Menu.SubMenuCtrl.Name_ElectricRange);
  1708. electricRangeMainScreen = new ElectricRangeMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
  1709. super.setCurrentScreen(electricRangeMainScreen);
  1710. setTopBoilerBtnVisible(false);
  1711. setAIRBackBtnVisible(false);
  1712. setKccDimmBtnVisible(false);
  1713. setVentilBackBtnVisible(false);
  1714. result = true;
  1715. break;
  1716. case API_Menu.SubMenuCtrl.Cooktop_Concent:
  1717. SetTitleText(API_Menu.SubMenuCtrl.Name_CooktopConcent);
  1718. cookTopConcentMainScreen = new CookTopConcentMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
  1719. super.setCurrentScreen(cookTopConcentMainScreen);
  1720. setTopBoilerBtnVisible(false);
  1721. setAIRBackBtnVisible(false);
  1722. setKccDimmBtnVisible(false);
  1723. setVentilBackBtnVisible(false);
  1724. result = true;
  1725. break;
  1726. case API_Menu.SubMenuCtrl.SystemAircon:
  1727. SetTitleText(API_Menu.SubMenuCtrl.Name_SystemAircon);
  1728. if (nDistributionPanelType == Version.DISTRIBUTION_MODEL.KNX_DIST) {
  1729. // KNX 분전반
  1730. knxSystemAirconMainScreen = new KnxSystemAirconMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mRoomNameList_SystemAircon);
  1731. super.setCurrentScreen(knxSystemAirconMainScreen);
  1732. }else {
  1733. systemAirconMainScreen = new SystemAirconMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mRoomNameList_SystemAircon);
  1734. super.setCurrentScreen(systemAirconMainScreen);
  1735. }
  1736. setTopBoilerBtnVisible(false);
  1737. setAIRBackBtnVisible(false);
  1738. setKccDimmBtnVisible(false);
  1739. setVentilBackBtnVisible(false);
  1740. setManualBtnVisible(false, 1019);
  1741. setMultiBtnVisible(true);
  1742. result = true;
  1743. break;
  1744. case API_Menu.SubMenuCtrl.Purity:
  1745. SetTitleText(API_Menu.SubMenuCtrl.Name_Purity);
  1746. purityMainScreen = new PurityMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mDefaultRoomNameList);
  1747. super.setCurrentScreen(purityMainScreen);
  1748. setTopBoilerBtnVisible(false);
  1749. setAIRBackBtnVisible(false);
  1750. setKccDimmBtnVisible(false);
  1751. setVentilBackBtnVisible(false);
  1752. result = true;
  1753. break;
  1754. case API_Menu.SubMenuCtrl.ParkingDoor:
  1755. SetTitleText(API_Menu.SubMenuCtrl.Name_ParkingDoor);
  1756. parkingDoorMainScreen = new ParkingDoorMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, API_Menu.SubMenuCtrl.ParkingDoor);
  1757. super.setCurrentScreen(parkingDoorMainScreen);
  1758. setTopBoilerBtnVisible(false);
  1759. setAIRBackBtnVisible(false);
  1760. setKccDimmBtnVisible(false);
  1761. result = true;
  1762. break;
  1763. default:
  1764. Log.i(TAG, "[Error] setChangeScreen - nScreenId Not found!!! (" + mCurrentScreenId + ")");
  1765. if (Version.getGatewayUsage()) {
  1766. // 게이트웨이 사용
  1767. SetTitleText(API_Menu.SubMenuCtrl.Name_Lamp);
  1768. lightHdcLivMainScreen = new LightHdcLivMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
  1769. super.setCurrentScreen(lightHdcLivMainScreen);
  1770. setTopBoilerBtnVisible(false);
  1771. setAIRBackBtnVisible(false);
  1772. setKccDimmBtnVisible(false);
  1773. setVentilBackBtnVisible(false);
  1774. }
  1775. else {
  1776. // 게이트웨이 미사용
  1777. SetTitleText(API_Menu.SubMenuCtrl.Name_Lamp);
  1778. lightEtcEachMainScreen = new LightEtcEachMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mRoomNameList_Light);
  1779. super.setCurrentScreen(lightEtcEachMainScreen);
  1780. setTopBoilerBtnVisible(false);
  1781. setAIRBackBtnVisible(false);
  1782. setKccDimmBtnVisible(true);
  1783. setVentilBackBtnVisible(false);
  1784. }
  1785. result = false;
  1786. break;
  1787. //mCurrentScreenId = -1;
  1788. //return false;
  1789. }
  1790. } catch (RuntimeException re) {
  1791. LogUtil.errorLogInfo("", TAG, re);
  1792. return false;
  1793. }
  1794. catch (Exception e) {
  1795. Log.e(TAG, "[Exception] setChangeScreen(int nScreenId, boolean OnlyRemove)");
  1796. //e.printStackTrace();
  1797. LogUtil.errorLogInfo("", TAG, e);
  1798. return false;
  1799. }
  1800. return result;
  1801. }
  1802. /**
  1803. * Screen 등록자<br>
  1804. * ScreenLayout 에 현재 Screen 을 삭제하고, 새로운 Screen 을 등록시킨다.
  1805. *
  1806. * @param nScreenId - 변경할 Screen ID
  1807. * @param ho - 멀티제어하려논 호
  1808. * @return (boolean) true : 성공, false : 실패
  1809. */
  1810. private boolean setMultiScreen(int nScreenId, int ho) {
  1811. // 1. 현재 Layout 삭제
  1812. if (mCurrentScreenId > 0) {
  1813. ScreenLayout.removeAllViews();
  1814. super.setCurrentScreen(null);
  1815. }
  1816. mMultiAddress = ho;
  1817. setTopBackBtnVisible(false);
  1818. boolean result = false;
  1819. // 2. 새로운 Layout 표시
  1820. try {
  1821. setTitleName(nScreenId);
  1822. //super.setFinishTimerCreate(Common.FINISH_TIME_SEC);
  1823. switch (nScreenId) {
  1824. case ID.screen.SystemAirconTest1Screen: // 시스템 에어컨
  1825. SystemAirconTestScreen systemAirconTest1Screen = new SystemAirconTestScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mDefaultRoomNameList);
  1826. super.setCurrentScreen(systemAirconTest1Screen);
  1827. result = true;
  1828. break;
  1829. case ID.screen.KnxSystemAirconMainTestScreen: // 시스템 에어컨
  1830. KnxSystemAirconMainTestScreen knxSystemAirconMainTestScreen = new KnxSystemAirconMainTestScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mDefaultRoomNameList);
  1831. super.setCurrentScreen(knxSystemAirconMainTestScreen);
  1832. mCurrentMultiScreenId = ID.screen.KnxSystemAirconMainTestScreen;
  1833. result = true;
  1834. break;
  1835. case ID.screen.LightKnxMainTestScreen: // 조명
  1836. LightKnxMainTestScreen lightKnxMainTestScreen = new LightKnxMainTestScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mRoomNameList_Light);
  1837. super.setCurrentScreen(lightKnxMainTestScreen);
  1838. mCurrentMultiScreenId = ID.screen.LightKnxMainTestScreen;
  1839. result = true;
  1840. break;
  1841. case ID.screen.HeatingV2TestScreen: // 난방
  1842. HeatingV2TestScreen heatingV2TestScreen = new HeatingV2TestScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mRoomNameList_Heating);
  1843. super.setCurrentScreen(heatingV2TestScreen);
  1844. mCurrentMultiScreenId = ID.screen.HeatingV2TestScreen;
  1845. result = true;
  1846. break;
  1847. case ID.screen.GasTestScreen: // 가스
  1848. HybridCookTopTestScreen hybridCookTopTestScreen = new HybridCookTopTestScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
  1849. super.setCurrentScreen(hybridCookTopTestScreen);
  1850. result = true;
  1851. break;
  1852. case ID.screen.VentiMainTestScreen: // 환기
  1853. VentilationMainTestScreen ventilationMainTestScreen = new VentilationMainTestScreen(this, ScreenLayout, wpapi, OPERATION_MODE, nScreenId);
  1854. super.setCurrentScreen(ventilationMainTestScreen);
  1855. mCurrentMultiScreenId = ID.screen.VentiMainTestScreen;
  1856. result = true;
  1857. break;
  1858. default:
  1859. result = false;
  1860. break;
  1861. }
  1862. } catch (RuntimeException re) {
  1863. LogUtil.errorLogInfo("", TAG, re);
  1864. return false;
  1865. }
  1866. catch (Exception e) {
  1867. LogUtil.errorLogInfo("", TAG, e);
  1868. return false;
  1869. }
  1870. return result;
  1871. }
  1872. /**
  1873. * 상단 타이틀 텍스트 수정
  1874. *
  1875. * @param SetText (String) 수정할 타이틀 이름
  1876. **/
  1877. private void SetTitleText(String SetText) {
  1878. if (SetText != null) {
  1879. TopTitle.setText(SetText);
  1880. }
  1881. }
  1882. /* ================================================================================================
  1883. * [Menu Layout] Section
  1884. ================================================================================================ */
  1885. /**
  1886. * 메뉴 레이아웃 생성
  1887. **/
  1888. private void OpenMenuLayout() {
  1889. Log.i(TAG, "Enter OpenMenuLayout !!!");
  1890. if (MenuOpen == true) {
  1891. Log.e(TAG, "[OpenMenuLayout] MenuOpen");
  1892. return;
  1893. }
  1894. if (menueListDataClass == null) {
  1895. Log.e(TAG, "[OpenMenuLayout] menueListDataClass is null");
  1896. return;
  1897. }
  1898. //0. 현재 ID 및 리스트 불러오기
  1899. String Title = API_Menu.GetGroupNameByID((mCurrentScreenId / 1000) * 1000);
  1900. String TempChildName = null;
  1901. int ChooseGroup = 0;
  1902. int ChooseChild = 0;
  1903. for (int i = 0; i < menueListDataClass.arrayGroup.size(); i++) {
  1904. if (menueListDataClass.arrayGroup.get(i).equals(Title)) {
  1905. ChooseGroup = i;
  1906. break;
  1907. }
  1908. }
  1909. Log.i(TAG, "[OpenMenuLayout] - ChooseGroup = " + ChooseGroup);
  1910. for (int i = 0; i < menueListDataClass.idMappingTable.length; i++) {
  1911. if (menueListDataClass.idMappingTable[i].Id == mCurrentScreenId) {
  1912. TempChildName = menueListDataClass.idMappingTable[i].Name;
  1913. break;
  1914. }
  1915. }
  1916. Log.i(TAG, "[OpenMenuLayout] - TempChildName = " + TempChildName);
  1917. if (TempChildName == null) {
  1918. Log.e(TAG, "TempChildName is null");
  1919. return;
  1920. }
  1921. for (int i = 0; i < menueListDataClass.arrayChild.get(Title).size(); i++) {
  1922. if (menueListDataClass.arrayChild.get(Title).get(i).equals(TempChildName) == true) {
  1923. ChooseChild = i;
  1924. break;
  1925. }
  1926. }
  1927. //1. 기존 화면 투명도 변경
  1928. TopLayout.setAlpha(0.5f);
  1929. ScreenLayout.setAlpha(0.5f);
  1930. //2. Layout 생성 및 처리 이벤트 등록
  1931. MenuLayout = new RelativeLayout(this);
  1932. WpadUtil.LayoutRegistration(AllLayout, MenuLayout, 1280, 800, 0, 0, ID.main.layout.MENU);
  1933. MenuLayout.setOnTouchListener(new OnTouchListener() {
  1934. @Override
  1935. public boolean onTouch(View v, MotionEvent event) {
  1936. if (event.getAction() == MotionEvent.ACTION_UP) {
  1937. setFinishTimerReset();
  1938. CloseMenuLayout();
  1939. }
  1940. return true;
  1941. }
  1942. });
  1943. //3. 배경 이미지 생성 및 에니메이션 등록
  1944. MenuBackground = new WpadImageView(this, TOUCH_KIND.BUTTON, 460, 800, R.drawable.bg_menu, R.drawable.bg_menu, ID.main.image.TAB_BACKGROUND);
  1945. TranslateAnimation anim = new TranslateAnimation(WpadScale.getWidth(-460), 0, 0, 0);
  1946. anim.setDuration(200);
  1947. anim.setInterpolator(new AccelerateInterpolator());
  1948. MenuLayout.setAnimation(anim);
  1949. ViewRegistration(MenuLayout, MenuBackground, 0, 0);
  1950. //4. 타이틀 등록
  1951. MenuTitle = new WpadTextView(this, false, 247, 80, Gravity.LEFT, Color.WHITE, Common.fontsize._44, true, ID.main.text.TITLE);
  1952. ViewRegistration(MenuLayout, MenuTitle, 133, 15);
  1953. MenuTitle.setText(Title);
  1954. //5. 종료 버튼 등록
  1955. 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);
  1956. MenuClose.setTouchDelayMs(1000);
  1957. ViewRegistration(MenuLayout, MenuClose, 380, 15);
  1958. //6. 리스트뷰 초기화 및 등록
  1959. mListView = new ExpandableListView(this);
  1960. ExpandableListView.LayoutParams params = new ExpandableListView.LayoutParams(WpadScale.getWidth(460), WpadScale.getHeight(690));
  1961. mListView.setLayoutParams(params);
  1962. mListView.setX(WpadScale.getWidth(0));
  1963. mListView.setY(WpadScale.getHeight(112));
  1964. mListView.setBackgroundColor(Color.BLACK);
  1965. mListView.setId(ID.main.liveview.lv);
  1966. mListView.setGroupIndicator(null);
  1967. mListView.setDividerHeight(0);
  1968. mListView.setDivider(null);
  1969. mListView.setFocusable(true);
  1970. mListView.setSmoothScrollbarEnabled(true);
  1971. mListView.setTranscriptMode(android.widget.AbsListView.TRANSCRIPT_MODE_DISABLED);
  1972. mListView.setScrollbarFadingEnabled(true);
  1973. MenuLayout.addView(mListView);
  1974. adptMain = new Menu_AdptMain(this, menueListDataClass.arrayGroup, menueListDataClass.arrayChild, ChooseGroup, ChooseChild);
  1975. mListView.setAdapter(adptMain);
  1976. //7. 선택된 그룹 열기
  1977. mListView.setSelectedGroup(ChooseGroup);
  1978. mListView.expandGroup(ChooseGroup);
  1979. // 8. 리스트뷰 터치 이벤트 등록
  1980. mListView.setOnTouchListener(new OnTouchListener() {
  1981. @Override
  1982. public boolean onTouch(View v, MotionEvent event) {
  1983. if ((event.getAction() == MotionEvent.ACTION_DOWN) ||
  1984. (event.getAction() == MotionEvent.ACTION_UP)) {
  1985. WpadActivity.setFinishTimerReset();
  1986. }
  1987. return false;
  1988. }
  1989. });
  1990. // 9. 그룹 터치 이벤트 등록
  1991. mListView.setOnGroupClickListener(new OnGroupClickListener() {
  1992. @Override
  1993. public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
  1994. DebugLogOutput("group click = " + groupPosition);
  1995. WpadActivity.setFinishTimerReset();
  1996. return false;
  1997. }
  1998. });
  1999. // 10. 차일드 터치 이벤트 등록
  2000. /*
  2001. mListView.setOnChildClickListener(new OnChildClickListener()
  2002. {
  2003. @Override
  2004. public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id)
  2005. {
  2006. DebugLogOutput("onChildClick");
  2007. DebugLogOutput("groupPosition = " + groupPosition);
  2008. DebugLogOutput("childPosition = " + childPosition);
  2009. WpadActivity.setFinishTimerReset();
  2010. return false;
  2011. }
  2012. });
  2013. */
  2014. // 11. 그룹 열리는 경우 이벤트
  2015. mListView.setOnGroupExpandListener(new OnGroupExpandListener() {
  2016. @Override
  2017. public void onGroupExpand(int groupPosition) {
  2018. DebugLogOutput("groupPosition Open Event = " + groupPosition);
  2019. Sound().Play(SND.effect.TOUCH_LATCHED);
  2020. WpadActivity.setFinishTimerReset();
  2021. }
  2022. });
  2023. // 12. 그룹 닫히는 경우 이벤트
  2024. mListView.setOnGroupCollapseListener(new OnGroupCollapseListener() {
  2025. @Override
  2026. public void onGroupCollapse(int groupPosition) {
  2027. DebugLogOutput("groupPosition Close Event = " + groupPosition);
  2028. Sound().Play(SND.effect.TOUCH_LATCHED);
  2029. WpadActivity.setFinishTimerReset();
  2030. }
  2031. });
  2032. // 13. MenuOpen True 설정
  2033. MenuOpen = true;
  2034. }
  2035. /**
  2036. * 메뉴 layout 닫힘 처리
  2037. **/
  2038. private void CloseMenuLayout() {
  2039. if (MenuOpen == false) {
  2040. return;
  2041. }
  2042. TranslateAnimation anim = new TranslateAnimation(0, WpadScale.getWidth(-460), 0, 0);
  2043. anim.setDuration(200);
  2044. anim.setInterpolator(new AccelerateInterpolator());
  2045. anim.setAnimationListener(new AnimationListener() {
  2046. @Override
  2047. public void onAnimationStart(Animation animation) {
  2048. MenuOpen = false;
  2049. }
  2050. @Override
  2051. public void onAnimationRepeat(Animation animation) {
  2052. }
  2053. @Override
  2054. public void onAnimationEnd(Animation animation) {
  2055. AllLayout.removeView(MenuLayout);
  2056. TopLayout.setAlpha(1.0f);
  2057. ScreenLayout.setAlpha(1.0f);
  2058. }
  2059. });
  2060. MenuLayout.startAnimation(anim);
  2061. }
  2062. /**
  2063. * 메뉴 그룹 터치시 처리 (Menu_AdptMain에서 호출)
  2064. **/
  2065. public static void SetListViewGroupExpand_Collapse(int GroupID, boolean ExpandEnable) {
  2066. if (ExpandEnable) {
  2067. mListView.expandGroup(GroupID);
  2068. }
  2069. else {
  2070. mListView.collapseGroup(GroupID);
  2071. }
  2072. }
  2073. /**
  2074. * Menu정보가 DB에 없을 경우 불러올 스크린 로딩
  2075. *
  2076. * @return MenuListDataClass 타입의 초기정보
  2077. **/
  2078. private MenuListDataClass loadDefaultMenuList() {
  2079. try {
  2080. MenuListDataClass tempMenuListDataClass = new MenuListDataClass();
  2081. tempMenuListDataClass.SetArrayGroup(API_Menu.SubMenuCtrl.Name);
  2082. ArrayList<String> arrayList = new ArrayList<String>();
  2083. WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(getApplicationContext());
  2084. int nAirQualitySensorUsage = mWallpadDeviceSet.GetDeviceSetted("센서AP");
  2085. int[] nLightType = mWallpadDeviceSet.Get_Light_info();
  2086. int[] nDoorlockType = mWallpadDeviceSet.Get_DoorLock_Info();
  2087. int[] nVentilType = mWallpadDeviceSet.Get_Ventil_Info();
  2088. int nHeatingUsage = mWallpadDeviceSet.Get_Temper_Info();
  2089. int nGasValveUsage = mWallpadDeviceSet.Get_GAS_Info();
  2090. boolean bElecCooktopUsage = mWallpadDeviceSet.Get_ElectricRange_Use();
  2091. boolean bCooktopOutletUsage = mWallpadDeviceSet.Get_CookTopConcent_Use();
  2092. int nSystemAirconUsage = mWallpadDeviceSet.Get_AirCON_Info();
  2093. int nPurityUsage = mWallpadDeviceSet.Get_Purity_Info();
  2094. int nConcentEnable = mWallpadDeviceSet.Get_Concent_Info(); // 콘센트 사용 유무
  2095. boolean bInterWPMultiCtrlUsage = mWallpadDeviceSet.Get_InterWallPadMultiCtrlUsage(); // 월패드간 제어기기 멀티제어 지원여부
  2096. mWallpadDeviceSet.closeDB();
  2097. WallpadStatusData mWallpadStatusData = new WallpadStatusData(getContext());
  2098. boolean bElecOutletUsage = mWallpadStatusData.Get_MultiSwitch_Concent_Use();
  2099. mWallpadStatusData.closeDB();
  2100. int nChildCnt = 0;
  2101. //[수정필요]
  2102. //추가 또는 수정해야할 부분 1. - Menu정보가 DB에 없을 경우 불러올 스크린 종류(시작)
  2103. if (nLightType[0] == WallpadDeviceSet.DO_USE) {
  2104. arrayList.add(API_Menu.SubMenuCtrl.Name_Lamp);
  2105. nChildCnt++;
  2106. }
  2107. if (nLightType[1] == WallpadDeviceSet.LIGHT_TYPE_ROOM || nLightType[1] == WallpadDeviceSet.LIGHT_TYPE_HDC_INTLIGHT_ADD_BATCHLIGHT_MULTISWITCH) {
  2108. Log.i(TAG, "[loadDefaultMenuList] bElecOutletUsage = " + bElecOutletUsage + " @@@@@@@@@@@@@@@@");
  2109. Log.i(TAG, "[loadDefaultMenuList] MultiConcentExist = " + bMultiConcentExist + " @@@@@@@@@@@@@@@@");
  2110. if ((OPERATION_MODE == Common.MODE_BUSINESS_SAMPLE) || (nLightType[0] == 1 && bElecOutletUsage && bMultiConcentExist)) {
  2111. // Log.i(TAG, "[loadDefaultMenuList] Add Concent @@@@@@@@@@@@@@@@");
  2112. arrayList.add(API_Menu.SubMenuCtrl.Name_Concent);
  2113. nChildCnt++;
  2114. }
  2115. }
  2116. if (nHeatingUsage == WallpadDeviceSet.DO_USE) {
  2117. arrayList.add(API_Menu.SubMenuCtrl.Name_Heating);
  2118. nChildCnt++;
  2119. }
  2120. if (nGasValveUsage == WallpadDeviceSet.DO_USE || bInterWPMultiCtrlUsage) {
  2121. arrayList.add(API_Menu.SubMenuCtrl.Name_Gas);
  2122. nChildCnt++;
  2123. }
  2124. if (bCooktopOutletUsage) {
  2125. // 쿡탑콘센트
  2126. arrayList.add(API_Menu.SubMenuCtrl.Name_CooktopConcent);
  2127. nChildCnt++;
  2128. Log.i(TAG, "cooktopConcentUse = " + bCooktopOutletUsage + " @@@@@@@@@@@@@@@@");
  2129. Log.i(TAG, "Name_CooktopConcent Added ~~~ " + " @@@@@@@@@@@@@@@@");
  2130. }
  2131. if (bElecCooktopUsage) {
  2132. arrayList.add(API_Menu.SubMenuCtrl.Name_ElectricRange);
  2133. nChildCnt++;
  2134. }
  2135. if (nDoorlockType[0] == WallpadDeviceSet.DO_USE) {
  2136. arrayList.add(API_Menu.SubMenuCtrl.Name_DoorLock);
  2137. nChildCnt++;
  2138. }
  2139. if (nVentilType[0] == WallpadDeviceSet.DO_USE) {
  2140. arrayList.add(API_Menu.SubMenuCtrl.Name_Venti);
  2141. nChildCnt++;
  2142. }
  2143. if (nSystemAirconUsage != WallpadDeviceSet.SYSTEMAIRCON_NONE) {
  2144. arrayList.add(API_Menu.SubMenuCtrl.Name_SystemAircon);
  2145. nChildCnt++;
  2146. }
  2147. 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
  2148. || Version.getModelType() == Version.MODEL_TYPE.IHN_D101K || Version.getModelType() == Version.MODEL_TYPE.IHN_D101K_I
  2149. || Version.getModelType() == Version.MODEL_TYPE.IHN_D101_I_OCF)
  2150. {
  2151. if (!bKitchenLightonLivingEM &&(nDistributionPanelType != Version.DISTRIBUTION_MODEL.KNX_DIST)) {
  2152. // knx분전반은 거실조명 그룹설정 메뉴에서 빠짐
  2153. arrayList.add(API_Menu.SubMenuCtrl.Name_LivingLightConfig);
  2154. nChildCnt++;
  2155. }
  2156. if (nDistributionPanelType == Version.DISTRIBUTION_MODEL.KNX_DIST) {
  2157. if(nConcentEnable==WallpadDeviceSet.DO_USE) {
  2158. arrayList.add(API_Menu.SubMenuCtrl.Name_Concent);
  2159. nChildCnt++;
  2160. }
  2161. }
  2162. if (nPurityUsage == WallpadDeviceSet.DO_USE) {
  2163. arrayList.add(API_Menu.SubMenuCtrl.Name_Purity);
  2164. nChildCnt++;
  2165. }
  2166. }
  2167. if (nAirQualitySensorUsage == WallpadDeviceSet.DEV_DATA_ENABLE) {
  2168. arrayList.add(API_Menu.SubMenuCtrl.Name_InnerAirQuality);
  2169. nChildCnt++;
  2170. arrayList.add(API_Menu.SubMenuCtrl.Name_InnerAirInfo);
  2171. nChildCnt++;
  2172. }
  2173. // arrayList.add(API_Menu.SubMenuCtrl.Name_ParkingDoor);
  2174. // nChildCnt++;
  2175. //추가 또는 수정해야할 부분 1. - Menu정보가 DB에 없을 경우 불러올 스크린 종류(끝)
  2176. Log.i(TAG, "[loadDefaultMenuList] childCount = " + nChildCnt);
  2177. tempMenuListDataClass.SetArrayChild(API_Menu.SubMenuCtrl.Name, arrayList);
  2178. tempMenuListDataClass.idMappingTable = new ChildIDMapping[nChildCnt];
  2179. for (int i = 0; i < nChildCnt; i++) {
  2180. tempMenuListDataClass.idMappingTable[i] = new ChildIDMapping();
  2181. //[수정필요]
  2182. //추가 또는 수정해야할 부분 2. - 불러올 스크린의 ID를 임의로 입력(시작)
  2183. // Log.d(TAG, "[loadDefaultMenuList] arrayList.get(" + i + ") = " + arrayList.get(i));
  2184. if (arrayList.get(i).equals(API_Menu.SubMenuCtrl.Name_Lamp)) {
  2185. if (Version.getGatewayUsage()) {
  2186. if (Version.getModelType() == Version.MODEL_TYPE.IHN_1010GL || Version.getModelType() == Version.MODEL_TYPE.IHN_1010GL_I
  2187. || Version.getModelType() == Version.MODEL_TYPE.IHN_1010GL_I_2443|| Version.getModelType() == Version.MODEL_TYPE.IHN_1010GL_I_6410) {
  2188. tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.HDCLivingNEach_Lamp;
  2189. tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_Lamp;
  2190. }
  2191. else {
  2192. if (nDistributionPanelType == Version.DISTRIBUTION_MODEL.SMART_DIST) {
  2193. // 스마트 분전반
  2194. tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.HDC_LivingLamp;
  2195. tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_Lamp;
  2196. }
  2197. else if (nDistributionPanelType == Version.DISTRIBUTION_MODEL.KNX_DIST) {
  2198. // KNX 분전반
  2199. tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.HDC_LivingLamp;
  2200. tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_Lamp;
  2201. }
  2202. else {
  2203. tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.HDC_LivingLamp;
  2204. tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_Lamp;
  2205. }
  2206. }
  2207. }
  2208. else {
  2209. if (nLightType[1] == WallpadDeviceSet.LIGHT_TYPE_LIVING) {
  2210. tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.OutSide_livingLamp;
  2211. tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_Lamp;
  2212. }
  2213. else if (nLightType[1] == WallpadDeviceSet.LIGHT_TYPE_ROOM) {
  2214. tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.OutSide_EachLamp;
  2215. tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_Lamp;
  2216. }
  2217. }
  2218. }
  2219. else if (arrayList.get(i).equals(API_Menu.SubMenuCtrl.Name_Concent)) {
  2220. if (nLightType[1] == WallpadDeviceSet.LIGHT_TYPE_ROOM) {
  2221. if ((OPERATION_MODE == Common.MODE_BUSINESS_SAMPLE) || (bElecOutletUsage && bMultiConcentExist)) {
  2222. tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.Concent;
  2223. tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_Concent;
  2224. }
  2225. }
  2226. else if (nLightType[1] == WallpadDeviceSet.LIGHT_TYPE_HDC_INTLIGHT_ADD_BATCHLIGHT_MULTISWITCH) {
  2227. if ((OPERATION_MODE == Common.MODE_BUSINESS_SAMPLE) || (bElecOutletUsage && bMultiConcentExist)) {
  2228. tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.HDCLivingNEach_Concent;
  2229. tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_Concent;
  2230. }
  2231. }
  2232. else if (nDistributionPanelType == Version.DISTRIBUTION_MODEL.KNX_DIST) {
  2233. tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.Concent;
  2234. tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_Concent;
  2235. }
  2236. }
  2237. else if (arrayList.get(i).equals(API_Menu.SubMenuCtrl.Name_Gas)) {
  2238. tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.Gas;
  2239. tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_Gas;
  2240. }
  2241. else if (arrayList.get(i).equals(API_Menu.SubMenuCtrl.Name_CooktopConcent)) {
  2242. tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.Cooktop_Concent;
  2243. tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_CooktopConcent;
  2244. }
  2245. else if (arrayList.get(i).equals(API_Menu.SubMenuCtrl.Name_DoorLock)) {
  2246. if (nDoorlockType[1] == DOORLOCK_TYPE_NORMAL) {
  2247. tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.DoorLock485;
  2248. tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_DoorLock;
  2249. }
  2250. else if (nDoorlockType[1] == DOORLOCK_TYPE_RF) {
  2251. tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.DoorLockWL;
  2252. tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_DoorLock;
  2253. }
  2254. else if (nDoorlockType[1] == DOORLOCK_TYPE_FINGERPRINT) {
  2255. tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.DoorLockWL;
  2256. tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_DoorLock;
  2257. }
  2258. }
  2259. else if (arrayList.get(i).equals(API_Menu.SubMenuCtrl.Name_Venti)) {
  2260. Log.d(TAG, "[loadDefaultMenuList] nVentilType[1] = " + nVentilType[1]);
  2261. if (nVentilType[1] == WallpadDeviceSet.VENTIL_TYPE_NORMAL) {
  2262. tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.ChangAir_Normal;
  2263. tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_Venti;
  2264. }
  2265. else if (nVentilType[1] == WallpadDeviceSet.VENTIL_TYPE_LH) {
  2266. tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.ChangAir_LH;
  2267. tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_Venti;
  2268. }
  2269. else if (nVentilType[1] == WallpadDeviceSet.VENTIL_TYPE_HOOD) {
  2270. tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.ChangAir_Hood;
  2271. tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_Venti;
  2272. }
  2273. }
  2274. else if (arrayList.get(i).equals(API_Menu.SubMenuCtrl.Name_Heating)) {
  2275. tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.Heating_V2;
  2276. tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_Heating;
  2277. }
  2278. /*
  2279. //확인 필요
  2280. else if (arrayList.get(i).equals(API_Menu.SubMenuCtrl.Name_Heating)) {
  2281. tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.Heating_V1;
  2282. tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_Heating;
  2283. }
  2284. */
  2285. else if (arrayList.get(i).equals(API_Menu.SubMenuCtrl.Name_InnerAirQuality)) {
  2286. tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.Inner_AirQuality;
  2287. tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_InnerAirQuality;
  2288. }
  2289. else if (arrayList.get(i).equals(API_Menu.SubMenuCtrl.Name_InnerAirInfo)) {
  2290. tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.Inner_AirInfo;
  2291. tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_InnerAirInfo;
  2292. }
  2293. else if (arrayList.get(i).equals(API_Menu.SubMenuCtrl.Name_ElectricRange)) {
  2294. tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.Electric_Range;
  2295. tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_ElectricRange;
  2296. }
  2297. else if (arrayList.get(i).equals(API_Menu.SubMenuCtrl.Name_SystemAircon)) {
  2298. tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.SystemAircon;
  2299. tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_SystemAircon;
  2300. }
  2301. else if (arrayList.get(i).equals(API_Menu.SubMenuCtrl.Name_LivingLightConfig)) {
  2302. tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.LivingLightConfig;
  2303. tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_LivingLightConfig;
  2304. }
  2305. else if (arrayList.get(i).equals(API_Menu.SubMenuCtrl.Name_ParkingDoor)) {
  2306. tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.ParkingDoor;
  2307. tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_ParkingDoor;
  2308. }
  2309. else {
  2310. Log.w(TAG, "[loadDefaultMenuList] arrayList.get(" + i + ") is not supported menu!!");
  2311. }
  2312. //추가 또는 수정해야할 부분 2. - 불러올 스크린의 ID를 임의로 입력(끝)
  2313. }
  2314. // for (int j = 0; j < tempMenuListDataClass.idMappingTable.length; j++) {
  2315. // Log.d(TAG, "[loadDefaultMenuList] tempMenuListDataClass.idMappingTable[" + j + "].Name = " + tempMenuListDataClass.idMappingTable[j].Name);
  2316. // Log.d(TAG, "[loadDefaultMenuList] tempMenuListDataClass.idMappingTable[" + j + "].Id = " + tempMenuListDataClass.idMappingTable[j].Id);
  2317. // }
  2318. return tempMenuListDataClass;
  2319. } catch (RuntimeException re) {
  2320. LogUtil.errorLogInfo("", TAG, re);
  2321. return null;
  2322. }
  2323. catch (Exception e) {
  2324. Log.e(TAG, "[Exception] loadDefaultMenuList()");
  2325. //e.printStackTrace();
  2326. LogUtil.errorLogInfo("", TAG, e);
  2327. return null;
  2328. }
  2329. }
  2330. /**
  2331. * Menu Event intent filter 등록
  2332. **/
  2333. private void reg_Receiver() {
  2334. try {
  2335. IntentFilter filter = new IntentFilter();
  2336. filter.addAction("MENU_EVENT");
  2337. registerReceiver(mWallPadAlertBR, filter);
  2338. filter = new IntentFilter();
  2339. filter.addAction(define.NOTIFY_DAIL);
  2340. filter.addAction("WALLPAD_DIAL_GLOBALSCREEN_TOUCH");
  2341. registerReceiver(mWallPadJogBR, filter);
  2342. filter = new IntentFilter();
  2343. filter.addAction(ID.main.BR_KCC_DIM);
  2344. registerReceiver(mKccDimmBR, filter);
  2345. } catch (RuntimeException re) {
  2346. LogUtil.errorLogInfo("", TAG, re);
  2347. }
  2348. catch (Exception e) {
  2349. Log.e(TAG, "[Exception] reg_Receiver()");
  2350. //e.printStackTrace();
  2351. LogUtil.errorLogInfo("", TAG, e);
  2352. }
  2353. }
  2354. /**
  2355. * 조그버튼 입력 받을 시 처리
  2356. **/
  2357. BroadcastReceiver mWallPadJogBR = new BroadcastReceiver() {
  2358. @Override
  2359. public void onReceive(Context context, Intent intent) {
  2360. WpadActivity.setFinishTimerReset();
  2361. }
  2362. };
  2363. /**
  2364. * KCC디밍조절기 BR 등록
  2365. **/
  2366. BroadcastReceiver mKccDimmBR = new BroadcastReceiver() {
  2367. @Override
  2368. public void onReceive(Context context, Intent intent) {
  2369. WpadActivity.setFinishTimerReset();
  2370. DebugLogOutput("[mKccDimmBR] - onReceive - mKccDimmBR");
  2371. Device_Update_Dimming(false, (byte)0);
  2372. Draw_Update_DimmBtn();
  2373. }
  2374. };
  2375. /**
  2376. * 메뉴에서 버튼 터치 처리
  2377. **/
  2378. BroadcastReceiver mWallPadAlertBR = new BroadcastReceiver() {
  2379. @Override
  2380. public void onReceive(Context context, Intent intent) {
  2381. int groupPosition = intent.getIntExtra("groupPosition", -1);
  2382. int childPosition = intent.getIntExtra("childPosition", -1);
  2383. Log.i(TAG, "[mWallPadAlertBR] groupPosition :" + groupPosition + ", childPosition :" + childPosition);
  2384. if ((groupPosition >= 0) && (childPosition >= 0)) {
  2385. if (MenuOpen == true) {
  2386. Sound().Play(SND.effect.TOUCH_LATCHED);
  2387. CloseMenuLayout();
  2388. if (menueListDataClass == null) {
  2389. return;
  2390. }
  2391. String childName = menueListDataClass.arrayChild.get(menueListDataClass.arrayGroup.get(groupPosition)).get(childPosition);
  2392. for (int i = 0; i < menueListDataClass.idMappingTable.length; i++) {
  2393. if (menueListDataClass.idMappingTable[i].Name.equals(childName)) {
  2394. API_Menu api_Menu = new API_Menu();
  2395. int TempID = api_Menu.GetMyGroupID(getApplicationContext().getPackageName());
  2396. int ChildID = menueListDataClass.idMappingTable[i].Id;
  2397. int ChildGroupID = (ChildID / 1000) * 1000;
  2398. Log.i(TAG, "[mWallPadAlertBR] Child ID :" + ChildID);
  2399. if (TempID == 0) {
  2400. return;
  2401. }
  2402. if (ChildGroupID == TempID) {
  2403. //해당 APP내에서 스크린 전환 필요
  2404. //[수정필요]
  2405. if (OPERATION_MODE == Common.MODE_NOMAL) {
  2406. mTempCurrentScreenId = ChildID;
  2407. mWallPadApiCheckHandler.sendEmptyMessage(0);
  2408. }
  2409. else {
  2410. boolean result = setChangeScreen(ChildID, false);
  2411. if (result == false) {
  2412. setChangeScreen(API_Menu.SubMenuCtrl.HDC_LivingLamp, false);
  2413. }
  2414. }
  2415. WpadActivity.setFinishTimerReset();
  2416. }
  2417. else {
  2418. //외부 앱 호출 후, 본 APP Finish 필요
  2419. api_Menu.startSubScreenActivity(getApplicationContext(), menueListDataClass.idMappingTable[i].Id, API_Menu.MENU_START_OPTION_1, api_Menu.GetAPK_Name_ByID(ChildGroupID));
  2420. Intent mIntent = new Intent();
  2421. mIntent.putExtra("Finish_Kind", "HomeButton");
  2422. MainActivity.this.setResult(RESULT_OK, mIntent);
  2423. finish();
  2424. }
  2425. break;
  2426. }
  2427. }
  2428. }
  2429. }
  2430. }
  2431. };
  2432. /**
  2433. * 디바이스 서비스 APP 을 체크하여 실행되어있지 않을시 실행시킨다.
  2434. */
  2435. private void StartDevService() {
  2436. try {
  2437. ActivityManager am = (ActivityManager) getApplicationContext().getSystemService(Context.ACTIVITY_SERVICE);
  2438. List<ActivityManager.RunningAppProcessInfo> appList = am.getRunningAppProcesses();
  2439. boolean DevServiceExist = false;
  2440. for (int i = 0; i < appList.size(); i++) {
  2441. ActivityManager.RunningAppProcessInfo rapi = appList.get(i);
  2442. Log.i(TAG, "App List i = " + i + " / name = " + rapi.getClass().getName());
  2443. if (rapi.processName.equals("com.artncore.deviceservice")) {
  2444. Log.d(TAG, "Filter 1 : Service already running");
  2445. DevServiceExist = true;
  2446. break;
  2447. }
  2448. }
  2449. ActivityManager am2 = (ActivityManager)getApplicationContext().getSystemService(Context.ACTIVITY_SERVICE);
  2450. List<ActivityManager.RunningServiceInfo> rs = am2.getRunningServices(1000);
  2451. for (int i = 0; i < rs.size(); i++) {
  2452. ActivityManager.RunningServiceInfo rsi = rs.get(i);
  2453. //Log.d("run service","Package Name " + i + " = " + rsi.service.getPackageName());
  2454. //Log.d("run service","Class Name : " + i + " = " + rsi.service.getClassName());
  2455. if (rsi.service.getPackageName().equals("com.artncore.deviceservice")) {
  2456. Log.d(TAG, "Filter 2 : Service already running");
  2457. DevServiceExist = true;
  2458. break;
  2459. }
  2460. }
  2461. if (!DevServiceExist) {
  2462. Log.d(TAG, "Call Service Start");
  2463. Intent intent = new Intent("wallpaddevservice.ServiceMain");
  2464. startService(intent);
  2465. try {
  2466. Thread.sleep(3000);
  2467. } catch (RuntimeException re) {
  2468. LogUtil.errorLogInfo("", TAG, re);
  2469. }
  2470. catch (Exception e) {
  2471. Log.e(TAG, "[Exception] StartDevService().sleep(...)");
  2472. }
  2473. }
  2474. } catch (RuntimeException re) {
  2475. LogUtil.errorLogInfo("", TAG, re);
  2476. }
  2477. catch (Exception e) {
  2478. Log.w(TAG, "[Exception] StartDevService()");
  2479. //e.printStackTrace();
  2480. LogUtil.errorLogInfo("", TAG, e);
  2481. }
  2482. }
  2483. private void runMultiControlService() {
  2484. ActivityManager mActivityManager = (ActivityManager)getApplicationContext().getSystemService(Context.ACTIVITY_SERVICE);
  2485. List<ActivityManager.RunningAppProcessInfo> RunningAppList = mActivityManager.getRunningAppProcesses();
  2486. for (int i = 0; i < RunningAppList.size(); i++) {
  2487. ActivityManager.RunningAppProcessInfo RunningAppListInfo = RunningAppList.get(i);
  2488. if (RunningAppListInfo.processName.equals("kr.co.icontrols.wallpadmulticontrolservice")) {
  2489. Log.w(TAG, "[runMultiControlService] runMultiControlService is already running");
  2490. return;
  2491. }
  2492. }
  2493. Log.i(TAG, "[runMultiControlService] Start runMultiControlService!!");
  2494. Intent mIntent = new Intent("wallpadmulticontrolservice.DataSenderService");
  2495. startService(mIntent);
  2496. }
  2497. /**
  2498. * DB 에서 룸이름 정보를 가져온다.
  2499. *
  2500. * @return (String []) null - 실패, not null
  2501. */
  2502. private String[] getRoomNameFromDB() {
  2503. try {
  2504. WallpadStatusData wallpadStatusData = new WallpadStatusData(getContext().getApplicationContext());
  2505. String[] RoomNameList = wallpadStatusData.GetDevRoomName();
  2506. wallpadStatusData.closeDB();
  2507. if (RoomNameList == null) {
  2508. Log.e(TAG, "[getRoomNameFromDB] - RoomNameList is null !!!");
  2509. return null;
  2510. }
  2511. if (RoomNameList.length != 6) {
  2512. Log.e(TAG, "[getRoomNameFromDB.length Not Match (" + RoomNameList.length + ")");
  2513. return null;
  2514. }
  2515. if (DEBUG_LOG_ON) {
  2516. for (int i = 0; i < RoomNameList.length; i++)
  2517. DebugLogOutput("[getRoomNameFromDB] RoomNameList[" + i + "] " + RoomNameList[i]);
  2518. }
  2519. return RoomNameList;
  2520. } catch (RuntimeException re) {
  2521. LogUtil.errorLogInfo("", TAG, re);
  2522. }
  2523. catch (Exception e) {
  2524. Log.e(TAG, "[Exception] getRoomNameFromDB()");
  2525. //e.printStackTrace();
  2526. LogUtil.errorLogInfo("", TAG, e);
  2527. }
  2528. return null;
  2529. }
  2530. /**
  2531. * DB 에서 룸이름 정보를 가져온다. 난방, 조명 개발 명칭 가져오기
  2532. *
  2533. * @param Device - int
  2534. * @return (String []) null - 실패, not null
  2535. */
  2536. private String[] getRoomNameFromDB(int Device) {
  2537. try {
  2538. String[] RoomNameList = null;
  2539. WallpadStatusData wallpadStatusData = new WallpadStatusData(getContext().getApplicationContext());
  2540. if (Device == HEATING) {
  2541. RoomNameList = wallpadStatusData.GetDevRoomName(define.ROOM_NAME_HEATING);
  2542. }
  2543. else {
  2544. RoomNameList = wallpadStatusData.GetDevRoomName(define.ROOM_NAME_LIGHT);
  2545. }
  2546. wallpadStatusData.closeDB();
  2547. if (RoomNameList == null) {
  2548. Log.e(TAG, "[DB_GetRoomName] - RoomNameList is null !!!");
  2549. return null;
  2550. }
  2551. if (RoomNameList.length != 6) {
  2552. Log.e(TAG, "[DB_GetRoomName] - RoomNameList.length Not Match (" + RoomNameList.length + ")");
  2553. return null;
  2554. }
  2555. if (DEBUG_LOG_ON) {
  2556. for (int i = 0; i < RoomNameList.length; i++)
  2557. DebugLogOutput("RoomNameList[" + i + "] " + RoomNameList[i]);
  2558. }
  2559. return RoomNameList;
  2560. } catch (RuntimeException re) {
  2561. LogUtil.errorLogInfo("", TAG, re);
  2562. }
  2563. catch (Exception e) {
  2564. Log.e(TAG, "[Exception] DB_GetRoomName(int Device)");
  2565. //e.printStackTrace();
  2566. LogUtil.errorLogInfo("", TAG, e);
  2567. }
  2568. return null;
  2569. }
  2570. private String[] getRoomNameFromDBV2(String strDeviceType) {
  2571. try {
  2572. String[] RoomNameList = null;
  2573. WallpadStatusData wallpadStatusData = new WallpadStatusData(getContext().getApplicationContext());
  2574. RoomNameList = wallpadStatusData.GetDevRoomNameList(strDeviceType);
  2575. wallpadStatusData.closeDB();
  2576. if (RoomNameList == null) {
  2577. Log.e(TAG, "[getRoomNameFromDBV2] - RoomNameList is null !!!");
  2578. return null;
  2579. }
  2580. Log.i(TAG, "[getRoomNameFromDBV2] RoomNameList " + Arrays.toString(RoomNameList));
  2581. return RoomNameList;
  2582. } catch (RuntimeException re) {
  2583. LogUtil.errorLogInfo("", TAG, re);
  2584. } catch (Exception e) {
  2585. Log.e(TAG, "[Exception] getRoomNameFromDBV2(int Device)");
  2586. //e.printStackTrace();
  2587. LogUtil.errorLogInfo("", TAG, e);
  2588. }
  2589. return null;
  2590. }
  2591. /**
  2592. * DB에서 방 이름을 가져와서 방 명칭 관련 변수에 값을 넣는다.
  2593. **/
  2594. private void GetRoomName() {
  2595. try {
  2596. WallpadDeviceSet wallpadDeviceSet = new WallpadDeviceSet(getContext().getApplicationContext());
  2597. boolean UseEachRoomName = wallpadDeviceSet.GetEachRoomNameInfo();
  2598. wallpadDeviceSet.closeDB();
  2599. Log.e(TAG, "[GetRoomName] UseEachRoomName = " + UseEachRoomName);
  2600. if (UseEachRoomName == false) {
  2601. // 명칭 통합사용
  2602. if (nConstructionFunction == WallpadDeviceSet.CONSTRUCTION_SPECIAL_FUNCTION_SK) {
  2603. // SK건설
  2604. mRoomNameList_Light = mDefaultRoomNameList_Light_SK;
  2605. mRoomNameList_Heating = mDefaultRoomNameList_Heating_SK;
  2606. }
  2607. else {
  2608. mRoomNameList_Light = getRoomNameFromDB();
  2609. if (mRoomNameList_Light == null) {
  2610. mRoomNameList_Light = mDefaultRoomNameList;
  2611. }
  2612. if (GetEasyModeUXUse()) {
  2613. mRoomNameList_Heating = mDefaultRoomNameList_Heating_easymode;
  2614. }
  2615. else {
  2616. mRoomNameList_Heating = getRoomNameFromDB();
  2617. if (mRoomNameList_Heating == null) {
  2618. mRoomNameList_Heating = mDefaultRoomNameList;
  2619. }
  2620. }
  2621. }
  2622. }
  2623. else {
  2624. // 명칭 난방, 조명 분리 사용
  2625. mRoomNameList_Light = getRoomNameFromDB(LIGHT);
  2626. if (mRoomNameList_Light == null) {
  2627. mRoomNameList_Light = mDefaultRoomNameList_Light;
  2628. }
  2629. if (GetEasyModeUXUse()) {
  2630. mRoomNameList_Heating = mDefaultRoomNameList_Heating_easymode;
  2631. }
  2632. else {
  2633. mRoomNameList_Heating = getRoomNameFromDB(HEATING);
  2634. if (mRoomNameList_Heating == null) {
  2635. mRoomNameList_Heating = mDefaultRoomNameList_Heating;
  2636. }
  2637. }
  2638. }
  2639. mRoomNameList_Concent = mDefaultRoomNameList;
  2640. } catch (RuntimeException re) {
  2641. LogUtil.errorLogInfo("", TAG, re);
  2642. }
  2643. catch (Exception e) {
  2644. Log.e(TAG, "[Exception] GetRoomName()");
  2645. //e.printStackTrace();
  2646. LogUtil.errorLogInfo("", TAG, e);
  2647. }
  2648. }
  2649. private void GetRoomNameV2() {
  2650. try {
  2651. Log.i(TAG, "[GetRoomNameV2] START");
  2652. mRoomNameList_Light = getRoomNameFromDBV2(define.ROOM_NAME_LIGHT);
  2653. mRoomNameList_Heating = getRoomNameFromDBV2(define.ROOM_NAME_HEATING);
  2654. mRoomNameList_Concent = getRoomNameFromDBV2(define.ROOM_NAME_CONCENT);
  2655. mRoomNameList_SystemAircon = getRoomNameFromDBV2(define.ROOM_NAME_SYSTEMAIRCON);
  2656. mRoomNameList_Purity = getRoomNameFromDBV2(define.ROOM_NAME_PURITY);
  2657. mRoomNameList_Shading = getRoomNameFromDBV2(define.ROOM_NAME_SHADING);
  2658. Log.i(TAG, "[GetRoomNameV2] mRoomNameList_Light: Length [" + mRoomNameList_Light.length + "], " + Arrays.toString(mRoomNameList_Light));
  2659. Log.i(TAG, "[GetRoomNameV2] mRoomNameList_Heating: Length [" + mRoomNameList_Heating.length + "], " + Arrays.toString(mRoomNameList_Heating));
  2660. Log.i(TAG, "[GetRoomNameV2] mRoomNameList_Concent: Length [" + mRoomNameList_Concent.length + "], " + Arrays.toString(mRoomNameList_Concent));
  2661. Log.i(TAG, "[GetRoomNameV2] mRoomNameList_SystemAircon: Length [" + mRoomNameList_SystemAircon.length + "], " + Arrays.toString(mRoomNameList_SystemAircon));
  2662. Log.i(TAG, "[GetRoomNameV2] mRoomNameList_Purity: Length [" + mRoomNameList_Purity.length + "], " + Arrays.toString(mRoomNameList_Purity));
  2663. Log.i(TAG, "[GetRoomNameV2] mRoomNameList_Shading: Length [" + mRoomNameList_Shading.length + "], " + Arrays.toString(mRoomNameList_Shading));
  2664. } catch (RuntimeException re) {
  2665. LogUtil.errorLogInfo("", TAG, re);
  2666. } catch (Exception e) {
  2667. Log.e(TAG, "[Exception] GetRoomName()");
  2668. //e.printStackTrace();
  2669. LogUtil.errorLogInfo("", TAG, e);
  2670. }
  2671. }
  2672. /**
  2673. * TOP 에 보일러 아이콘 활성화 & 비활성화
  2674. *
  2675. * @param Enabled - true : 활성화, false : 비활성화
  2676. * @return (boolean) true : 성공, false : 실패
  2677. */
  2678. public boolean setTopBoilerBtnVisible(boolean Enabled) {
  2679. try {
  2680. if (Enabled == true) {
  2681. Log.i(TAG, "[setTopBoilerBtnVisible] ENTER 0");
  2682. if (TopBoilerBtn.getVisibility() != View.VISIBLE) {
  2683. Log.i(TAG, "[setTopBoilerBtnVisible] ENTER 1");
  2684. if (TopBackBtn.getVisibility() == View.VISIBLE) {
  2685. // 1019
  2686. Log.i(TAG, "[setTopBoilerBtnVisible] ENTER 2");
  2687. WpadUtil.ViewMove(TopBoilerBtn, 893, 0);
  2688. WpadUtil.ViewMove(TopManualBtn, 767, 0);
  2689. }
  2690. else {
  2691. Log.i(TAG, "[setTopBoilerBtnVisible] ENTER 3-1");
  2692. WpadUtil.ViewMove(TopBoilerBtn, 1019, 0);
  2693. }
  2694. if(TopBoilerBtn!=null) TopBoilerBtn.setVisibility(View.VISIBLE);
  2695. if(TopBoilerBtn!=null) TopBoilerBtn.bringToFront();
  2696. if (TopBoilerBtn!=null && TopBoilerBtn.getVisibility() == View.VISIBLE) {
  2697. Log.i(TAG, "[setTopBoilerBtnVisible] ENTER 3-2");
  2698. WpadUtil.ViewMove(TopManualBtn, 893, 0);
  2699. // TopManualBtn.bringToFront();
  2700. }
  2701. }
  2702. }
  2703. else {
  2704. Log.i(TAG, "[setTopBoilerBtnVisible] ENTER 4");
  2705. if (TopBoilerBtn.getVisibility() != View.INVISIBLE) {
  2706. Log.i(TAG, "[setTopBoilerBtnVisible] ENTER 5");
  2707. TopBoilerBtn.setVisibility(View.INVISIBLE);
  2708. if (TopBackBtn.getVisibility() == View.VISIBLE) {
  2709. Log.i(TAG, "[setTopBoilerBtnVisible] ENTER 6");
  2710. WpadUtil.ViewMove(TopManualBtn, 893, 0);
  2711. }
  2712. else {
  2713. Log.i(TAG, "[setTopBoilerBtnVisible] ENTER 7");
  2714. WpadUtil.ViewMove(TopManualBtn, 1019, 0);
  2715. }
  2716. }
  2717. }
  2718. } catch (RuntimeException re) {
  2719. LogUtil.errorLogInfo("", TAG, re);
  2720. return false;
  2721. }
  2722. catch (Exception ex) {
  2723. Log.e(TAG, "[Exception] setTopBoilerBtnVisible(boolean Enabled)");
  2724. //ex.printStackTrace();
  2725. LogUtil.errorLogInfo("", TAG, ex);
  2726. return false;
  2727. }
  2728. return true;
  2729. }
  2730. /**
  2731. * 실내공기질 돌아가기 버튼 활성화 & 비활성화
  2732. *
  2733. * @param Enabled - true : 활성화, false : 비활성화
  2734. * @return (boolean) true : 성공, false : 실패
  2735. */
  2736. public boolean setAIRBackBtnVisible(boolean Enabled) {
  2737. if (Enabled == true) {
  2738. if (TopAirBackBtn.getVisibility() != View.VISIBLE) TopAirBackBtn.setVisibility(View.VISIBLE);
  2739. TopAirBackBtn.bringToFront();
  2740. if (TopAirBackBtn.getVisibility() == View.VISIBLE) {
  2741. WpadUtil.ViewMove(TopManualBtn, 893, 0);
  2742. }
  2743. if(TopManualBtn!=null) TopManualBtn.setVisibility(View.INVISIBLE);
  2744. }
  2745. else {
  2746. if (TopAirBackBtn.getVisibility() != View.INVISIBLE) TopAirBackBtn.setVisibility(View.INVISIBLE);
  2747. if (TopAirBackBtn.getVisibility() == View.INVISIBLE) {
  2748. WpadUtil.ViewMove(TopManualBtn, 1019, 0);
  2749. }
  2750. }
  2751. return true;
  2752. }
  2753. /**
  2754. * 환기제어 돌아가기 버튼 활성화 & 비활성화
  2755. *
  2756. * @param Enabled - true : 활성화, false : 비활성화
  2757. * @return (boolean) true : 성공, false : 실패
  2758. */
  2759. public boolean setVentilBackBtnVisible(boolean Enabled) {
  2760. if (Enabled == true) {
  2761. if (BTN_TOP_BACK_VENTIL.getVisibility() != View.VISIBLE) BTN_TOP_BACK_VENTIL.setVisibility(View.VISIBLE);
  2762. BTN_TOP_BACK_VENTIL.bringToFront();
  2763. if (BTN_TOP_BACK_VENTIL.getVisibility() == View.VISIBLE) {
  2764. WpadUtil.ViewMove(TopManualBtn, 893, 0);
  2765. }
  2766. if(TopManualBtn!=null) TopManualBtn.setVisibility(View.INVISIBLE);
  2767. }
  2768. else {
  2769. if (BTN_TOP_BACK_VENTIL.getVisibility() != View.INVISIBLE) BTN_TOP_BACK_VENTIL.setVisibility(View.INVISIBLE);
  2770. if (BTN_TOP_BACK_VENTIL.getVisibility() == View.INVISIBLE) {
  2771. if (TopBoilerBtn != null && TopBoilerBtn.getVisibility() == View.VISIBLE) {
  2772. WpadUtil.ViewMove(TopManualBtn, 893, 0);
  2773. }
  2774. else {
  2775. WpadUtil.ViewMove(TopManualBtn, 1019, 0);
  2776. }
  2777. }
  2778. }
  2779. return true;
  2780. }
  2781. /**
  2782. * 멀티 제어 층 버튼 활성화 & 비활성화
  2783. *
  2784. * @param Enabled - true : 활성화, false : 비활성화
  2785. * @return (boolean) true : 성공, false : 실패
  2786. */
  2787. public void setMultiBtnVisible(boolean Enabled) {
  2788. for (int i = 0; i < MultiBtn.length; i++) {
  2789. if (Enabled == true) {
  2790. if (MultiBtn[i].getVisibility() != View.VISIBLE)
  2791. MultiBtn[i].setVisibility(View.VISIBLE);
  2792. MultiBtn[i].bringToFront();
  2793. MultiBtn[i].setButtonFrontImage();
  2794. MultiBtn[i].setButtonEventOffDisable();
  2795. } else {
  2796. if (MultiBtn[i].getVisibility() != View.INVISIBLE)
  2797. MultiBtn[i].setVisibility(View.INVISIBLE);
  2798. }
  2799. }
  2800. if (myIP.equals("10.1.2.1")) {
  2801. MultiBtn[1].setButtonRearImage();
  2802. } else if (myIP.equals("10.1.1.1")) {
  2803. MultiBtn[0].setButtonRearImage();
  2804. } else if (myIP.equals("10.1.3.1")) {
  2805. MultiBtn[2].setButtonRearImage();
  2806. }
  2807. }
  2808. /**
  2809. * 멀티 가스 제어 층 버튼 활성화 & 비활성화
  2810. *
  2811. * @param Enabled - true : 활성화, false : 비활성화
  2812. * @return (boolean) true : 성공, false : 실패
  2813. */
  2814. public void setGasMultiBtnVisible(boolean Enabled) {
  2815. for (int i = 0; i < MultiBtn.length; i++) {
  2816. if (Enabled == true) {
  2817. if (MultiBtn[i].getVisibility() != View.VISIBLE)
  2818. MultiBtn[i].setVisibility(View.VISIBLE);
  2819. MultiBtn[i].bringToFront();
  2820. MultiBtn[i].setButtonFrontImage();
  2821. } else {
  2822. if (MultiBtn[i].getVisibility() != View.INVISIBLE)
  2823. MultiBtn[i].setVisibility(View.INVISIBLE);
  2824. }
  2825. }
  2826. //MultiBtn[1].setButtonRearImage();
  2827. MultiBtn[0].setButtonEventOffEnable(R.drawable.tab_floor_1_disabled);
  2828. MultiBtn[1].setButtonEventOffEnable(R.drawable.tab_floor_2_selected);
  2829. MultiBtn[2].setButtonEventOffEnable(R.drawable.tab_floor_3_disabled);
  2830. }
  2831. /**
  2832. * 상단 KCC디밍조절 버튼 활성화 & 비활성화
  2833. *
  2834. * @param Enabled - true : 활성화, false : 비활성화
  2835. * @return (boolean) true : 성공, false : 실패
  2836. */
  2837. public void setKccDimmBtnVisible(boolean Enabled) {
  2838. WallpadDeviceSet wdst = new WallpadDeviceSet(getContext());
  2839. int dimmUse = wdst.GetDeviceSetted("KCC디밍제어기"); // 1: 사용안함 / 2: 사용함
  2840. wdst.closeDB();
  2841. Log.i(TAG, "[setKccDimmBtnVisible] - KCC Dimm : " + dimmUse);
  2842. // null, 사용안함 이면 안나오도록 한다.
  2843. if (dimmUse == 0 || dimmUse == 1) {
  2844. Log.w(TAG, "[setKccDimmBtnVisible] - KCC Dimm NOT USE !!!");
  2845. Enabled = false;
  2846. KccDimUse = 0;
  2847. }
  2848. else {
  2849. KccDimUse = 1;
  2850. }
  2851. for (int i = 0; i < TopDimmingBtn.length; i++) {
  2852. if (Enabled == true) {
  2853. if (TopDimmingBtn[i].getVisibility() != View.VISIBLE)
  2854. TopDimmingBtn[i].setVisibility(View.VISIBLE);
  2855. TopDimmingBtn[i].bringToFront();
  2856. }
  2857. else {
  2858. if (TopDimmingBtn[i].getVisibility() != View.INVISIBLE)
  2859. TopDimmingBtn[i].setVisibility(View.INVISIBLE);
  2860. }
  2861. }
  2862. }
  2863. /**
  2864. * 조명제어기의 디밍 레벨을 조절한다.
  2865. *
  2866. * @param Level - 디밍레벨
  2867. * @return (int) - >=0 : 성공, <0 : 실패
  2868. */
  2869. private int Device_SetDimmingLevel(byte Level) {
  2870. DebugLogOutput("[Device_SetAllDimmingLevel] - Start (Level : " + Level + ")");
  2871. // 1. Api Load Check
  2872. if (ledDimmingAPI == null) {
  2873. Log.e(TAG, "[Device_SetAllDimmingLevel] ledDimmingAPI unload !!!");
  2874. return -1;
  2875. }
  2876. // 2. Param Range Check
  2877. if (mDimData.DimData.DeviceCnt == 0) {
  2878. Log.w(TAG, "[Device_SetAllDimmingLevel] mData.DeviceCnt == 0");
  2879. return -2;
  2880. }
  2881. // 3. Light Control
  2882. try {
  2883. int ret = ledDimmingAPI.SetDimmingLevel(0, Level);
  2884. if (ret < 0) {
  2885. Log.e(TAG, "[Device_SetAllDimmingLevel] SetAllDimmingLevel Error (" + ret + ") ErrorCode = " + ledDimmingAPI.ErrorCode.ErrStr());
  2886. return -6;
  2887. }
  2888. } catch (RuntimeException re) {
  2889. LogUtil.errorLogInfo("", TAG, re);
  2890. return -100;
  2891. }
  2892. catch (Exception e) {
  2893. Log.e(TAG, "[Device_SetAllDimmingLevel] - [Exception Error] ledDimmingAPI.SetAllDimmingLevel()");
  2894. //e.printStackTrace();
  2895. LogUtil.errorLogInfo("", TAG, e);
  2896. return -100;
  2897. }
  2898. DebugLogOutput("[Device_SetAllDimmingLevel] - OK");
  2899. return 0;
  2900. }
  2901. private void Draw_Update_DimmBtn() {
  2902. // 디밍 표시
  2903. Log.i(TAG, "[Draw_Update_DimmBtn] - Dimming Draw Start");
  2904. if (mDimData.DimData == null) {
  2905. Log.w(TAG, "[Draw_Update_DimmBtn] - mDimData.DimData null");
  2906. return;
  2907. }
  2908. else {
  2909. Log.i(TAG, "[Draw_Update_DimmBtn] - mDimData.DimData normal");
  2910. }
  2911. byte Level = mDimData.DimData.Device[0].device.Level;
  2912. Log.i(TAG, "[Draw_Update_DimmBtn] - Level =" + Level);
  2913. for (int i = 0; i < 4; i++) {
  2914. if (Level == mLevelArray[i]) {
  2915. Log.i(TAG, "[Draw_Update_DimmBtn] - Same Level Button i = " + i);
  2916. TopDimmingBtn[i].setButtonRearImage();
  2917. }
  2918. else {
  2919. Log.i(TAG, "[Draw_Update_DimmBtn] - Diff Level Button i = " + i);
  2920. TopDimmingBtn[i].setButtonFrontImage();
  2921. }
  2922. }
  2923. Log.i(TAG, "[Draw_Update_DimmBtn] - Dimming Draw End");
  2924. }
  2925. /**
  2926. * KCC 디밍제어기의 상태를 갱신한다.
  2927. *
  2928. * @param real - (boolean) true : 실시간 , false : 가장최근
  2929. * @param index - (byte) 방 인덱스 (0~5개별방, Common.INDEX_ALL 전체)
  2930. * @return (int) - >=0 : 성공, <0 : 실패
  2931. */
  2932. private int Device_Update_Dimming(boolean real, byte index) {
  2933. DebugLogOutput("[Device_Update_Dimming] - Start (real : " + real + ", index:" + index + ")");
  2934. // 1. Api Load Check
  2935. if (ledDimmingAPI == null) {
  2936. Log.e(TAG, "[Device_Update_Dimming] ledDimmingAPI unload !!!");
  2937. return -1;
  2938. }
  2939. // 2. refresh
  2940. try {
  2941. int ret = ledDimmingAPI.Refresh(index, real);
  2942. if (ret < 0) {
  2943. Log.e(TAG, "[Device_Update_Dimming] Refresh(" + index + ", " + real + ") ret = " + ret + " / ErrorCode = " + ledDimmingAPI.ErrorCode.ErrStr());
  2944. return -2;
  2945. }
  2946. } catch (RuntimeException re) {
  2947. LogUtil.errorLogInfo("", TAG, re);
  2948. return -100;
  2949. }
  2950. catch (Exception e) {
  2951. Log.e(TAG, "[Device_Update_Dimming] - [Exception Error] ledDimmingAPI.Refresh(index:" + index + ", real:" + real + ")");
  2952. //e.printStackTrace();
  2953. LogUtil.errorLogInfo("", TAG, e);
  2954. return -100;
  2955. }
  2956. // 3. Range Check
  2957. if (ledDimmingAPI.data.DeviceCnt <= 0) {
  2958. Log.e(TAG, "[Device_Update_Dimming] - DeviceCnt Out of range !!! (DeviceCnt:" + ledDimmingAPI.data.DeviceCnt + ")");
  2959. return -10;
  2960. }
  2961. // 4. Data Copy
  2962. mDimData.DimData = ledDimmingAPI.data;
  2963. // 5. Debug Msg
  2964. DebugLogOutput("---------------------------------------");
  2965. DebugLogOutput("[Device_Update_Dimming]");
  2966. DebugLogOutput("---------------------------------------");
  2967. DebugLogOutput("DeviceCnt = " + ledDimmingAPI.data.DeviceCnt);
  2968. byte DeviceCnt = ledDimmingAPI.data.DeviceCnt;
  2969. if (index == define.DEVICE_ALL_OR_NOTHING) {
  2970. for (byte i = 0; i < DeviceCnt; i++) {
  2971. DebugLogOutput(ledDimmingAPI.data.Device[i].info.ToDebugString(i));
  2972. DebugLogOutput(ledDimmingAPI.data.Device[i].device.ToDebugString(i));
  2973. }
  2974. }
  2975. else {
  2976. DebugLogOutput(ledDimmingAPI.data.Device[index].device.ToDebugString(index));
  2977. }
  2978. DebugLogOutput("---------------------------------------");
  2979. DebugLogOutput("[Device_Update_Dimming] - OK");
  2980. return 0;
  2981. }
  2982. /**
  2983. * 현관호출 or 전화호출시 사용되는 keycode - Broadcast 을 송신한다.
  2984. *
  2985. * @param code - (int) 송신할 keycode
  2986. * @return (int) - >=0 : 성공, <0 : 실패
  2987. */
  2988. private int setSendEventBR(int code) {
  2989. try {
  2990. KeyEvent event = new KeyEvent(KeyEvent.ACTION_UP, code);
  2991. Intent intent = new Intent("EVENT_DEVICE_CONTROL", null);
  2992. intent.putExtra(Intent.EXTRA_KEY_EVENT, event);
  2993. intent.putExtra("keycode",code);
  2994. getContext().sendBroadcast(intent);
  2995. } catch (RuntimeException re) {
  2996. LogUtil.errorLogInfo("", TAG, re);
  2997. return -100;
  2998. }
  2999. catch (Exception e) {
  3000. Log.e(TAG, "[setSendEventBR] - [Exception Error] code:" + code);
  3001. //e.printStackTrace();
  3002. LogUtil.errorLogInfo("", TAG, e);
  3003. return -100;
  3004. }
  3005. return 0;
  3006. }
  3007. /**
  3008. * 히든메뉴의 버튼 타임아웃을 설정한다.
  3009. */
  3010. private void HideMenu_setTimeOut() {
  3011. if (mHideMenuTimer != null) mHideMenuTimer.cancel();
  3012. mHideMenuTimer = new CountDownTimer( 1 * 1000, 1000) {
  3013. @Override
  3014. public void onFinish() {
  3015. Log.d(TAG, "mHideMenuTimer - onFinish !!!");
  3016. mHideMenuEntryStatus = 0;
  3017. }
  3018. @Override
  3019. public void onTick(long millisUntilFinished) {
  3020. }
  3021. };
  3022. mHideMenuTimer.cancel();
  3023. mHideMenuTimer.start();
  3024. }
  3025. /**
  3026. * 히든메뉴 진입용 프로세스
  3027. *
  3028. * @param TargetId - 히든메뉴용 버튼 ID
  3029. */
  3030. private void HideMenuEntryProc(int TargetId) {
  3031. if (OPERATION_MODE != Common.MODE_NOMAL) return;
  3032. if (mHideMenuOn) return;
  3033. if (TargetId == ID.main.button.HIDE1) {
  3034. if (mHideMenuEntryStatus == 0) { mHideMenuEntryStatus = 1; HideMenu_setTimeOut(); }
  3035. else if (mHideMenuEntryStatus == 2) { mHideMenuEntryStatus = 3; HideMenu_setTimeOut(); }
  3036. else if (mHideMenuEntryStatus == 4) { mHideMenuEntryStatus = 5; HideMenu_setTimeOut(); }
  3037. }
  3038. else if (TargetId == ID.main.button.HIDE2) {
  3039. if (mHideMenuEntryStatus == 1) { mHideMenuEntryStatus = 2; HideMenu_setTimeOut(); }
  3040. else if (mHideMenuEntryStatus == 3) { mHideMenuEntryStatus = 4; HideMenu_setTimeOut(); }
  3041. else if (mHideMenuEntryStatus == 5) {
  3042. mHideMenuEntryStatus = 6;
  3043. mHideMenuOn = true;
  3044. if (mHideMenuTimer != null) {
  3045. mHideMenuTimer.cancel();
  3046. mHideMenuTimer = null;
  3047. TopBackground.setImageResource(0);
  3048. TopBackground.setBackgroundColor(Color.RED);
  3049. Sound().Play(SND.call.CALLSTART);
  3050. super.setFinishTimerDestroy();
  3051. Log.i(TAG, "================================");
  3052. Log.i(TAG, "[HideMenu] START !!!!!");
  3053. Log.i(TAG, "================================");
  3054. }
  3055. }
  3056. }
  3057. }
  3058. public boolean GetEasyModeUXUse() {
  3059. try {
  3060. WallpadDeviceSet deviceSet = new WallpadDeviceSet(mContext);
  3061. boolean bSupport = deviceSet.Get_EasyModeUX_Support();
  3062. deviceSet.closeDB();
  3063. WallpadStatusData data = new WallpadStatusData(mContext);
  3064. boolean bUse = data.GetEasyModeUxUse();
  3065. data.closeDB();
  3066. Log.d(TAG, "[GetEasyModeUXUse] bSupport [" + bSupport + "], bUse [" + bUse + "]");
  3067. return bSupport & bUse;
  3068. } catch (RuntimeException re) {
  3069. LogUtil.errorLogInfo("", TAG, re);
  3070. }
  3071. catch (Exception e) {
  3072. Log.e(TAG, "[Exception] GetEasyModeUXUse()");
  3073. //e.printStackTrace();
  3074. LogUtil.errorLogInfo("", TAG, e);
  3075. }
  3076. return false;
  3077. }
  3078. public boolean getAirSensorAPUsage() {
  3079. try {
  3080. boolean bUsage = false;
  3081. WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(getApplicationContext());
  3082. int nAirQualityEnable = mWallpadDeviceSet.GetDeviceSetted("센서AP");
  3083. mWallpadDeviceSet.closeDB();
  3084. if(nAirQualityEnable == WallpadDeviceSet.DEV_DATA_ENABLE) bUsage = true;
  3085. Log.d(TAG, "[getAirSensorAPUsage] bUsage [" + bUsage + "]");
  3086. return bUsage;
  3087. } catch (RuntimeException re) {
  3088. LogUtil.errorLogInfo("", TAG, re);
  3089. }
  3090. catch (Exception e) {
  3091. Log.e(TAG, "[Exception] getAirSensorAPUsage()");
  3092. //e.printStackTrace();
  3093. LogUtil.errorLogInfo("", TAG, e);
  3094. }
  3095. return false;
  3096. }
  3097. /**
  3098. * 제어기 상태를 가져온다.
  3099. *
  3100. * @param bReal - (boolean) true : 실시간 , false : 가장최근
  3101. * @return (int) - >=0 : 성공, <0 : 실패
  3102. */
  3103. private int updateVentilatorData(boolean bReal) {
  3104. Log.i(TAG, "[updateVentilatorData] - Start (bReal : " + bReal + ")");
  3105. // 1. Api Load Check
  3106. if (mVentilAPI == null) {
  3107. Log.e(TAG, "[updateVentilatorData] - mVentilAPI unload !!!");
  3108. return -1;
  3109. }
  3110. // 2. reflash
  3111. try {
  3112. int ret = mVentilAPI.Refresh(bReal);
  3113. if (ret < 0) {
  3114. Log.e(TAG, "[updateVentilatorData] Refresh - ret (" + ret + ") ErrorCode = " + mVentilAPI.ErrorCode.ErrStr());
  3115. return -2;
  3116. }
  3117. } catch (RuntimeException re) {
  3118. LogUtil.errorLogInfo("", TAG, re);
  3119. return -100;
  3120. }
  3121. catch (Exception e) {
  3122. Log.e(TAG, "[updateVentilatorData] - [Exception Error] mVentilAPI.Refresh(" + bReal + ")");
  3123. //e.printStackTrace();
  3124. LogUtil.errorLogInfo("", TAG, e);
  3125. return -100;
  3126. }
  3127. // 3. Data Copy
  3128. VentilStatus = mVentilAPI.data;
  3129. // 4. Debug Msg
  3130. Log.i(TAG, VentilStatus.ToDebugString());
  3131. Log.i(TAG, VentilStatus.ToFaultString());
  3132. Log.i(TAG, "[updateVentilatorData] - OK");
  3133. return 0;
  3134. }
  3135. /**
  3136. * Knx 환기 제어기 상태를 가져온다.
  3137. *
  3138. * @param bReal - (boolean) true : 실시간 , false : 가장최근
  3139. * @return (int) - >=0 : 성공, <0 : 실패
  3140. */
  3141. private int updateKnxVentilatorData(boolean bReal) {
  3142. Log.i(TAG, "[updateKnxVentilatorData] - Start (bReal : " + bReal + ")");
  3143. // 1. Api Load Check
  3144. if (mKnxVentilAPI == null) {
  3145. Log.e(TAG, "[updateKnxVentilatorData] - mVentilAPI unload !!!");
  3146. return -1;
  3147. }
  3148. // 2. reflash
  3149. try {
  3150. int ret = mKnxVentilAPI.Refresh(Common.INDEX_ALL, bReal);
  3151. if (ret < 0) {
  3152. Log.e(TAG, "[updateKnxVentilatorData] Refresh - ret (" + ret + ") ErrorCode = " + mKnxVentilAPI.ErrorCode.ErrStr());
  3153. return -2;
  3154. }
  3155. } catch (RuntimeException re) {
  3156. LogUtil.errorLogInfo("", TAG, re);
  3157. return -100;
  3158. }
  3159. catch (Exception e) {
  3160. Log.e(TAG, "[updateKnxVentilatorData] - [Exception Error] mKnxVentilAPI.Refresh(" + bReal + ")");
  3161. //e.printStackTrace();
  3162. LogUtil.errorLogInfo("", TAG, e);
  3163. return -100;
  3164. }
  3165. // 3. Data Copy
  3166. VentilStatus = mKnxVentilAPI.data.Device[0];
  3167. // 4. Debug Msg
  3168. Log.i(TAG, VentilStatus.ToDebugString());
  3169. Log.i(TAG, VentilStatus.ToFaultString());
  3170. Log.i(TAG, "[updateVentilatorData] - OK");
  3171. return 0;
  3172. }
  3173. public static int nConstructionFunction = WallpadDeviceSet.CONSTRUCTION_SPECIAL_FUNCTION_NONE;
  3174. private void getConstructionFunction() {
  3175. try {
  3176. WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(getApplicationContext());
  3177. nConstructionFunction = mWallpadDeviceSet.Get_Construction_SpecialFunc();
  3178. mWallpadDeviceSet.closeDB();
  3179. } catch (Exception e) {
  3180. Log.e(TAG, "[Exception] getConstructionFunction()");
  3181. e.printStackTrace();
  3182. }
  3183. }
  3184. public static int nResidentSafetyCheckSetting = WallpadDeviceSet.RESIDENT_SAFETY_CHECK_DISABLE;
  3185. private void getResidentSafetyCheckSetting() {
  3186. try {
  3187. WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(getApplicationContext());
  3188. nResidentSafetyCheckSetting = mWallpadDeviceSet.getResidentSafetyCheck();
  3189. mWallpadDeviceSet.closeDB();
  3190. Log.e(TAG, "[getResidentSafetyCheckSetting] nResidentSafetyCheckSetting: " + nResidentSafetyCheckSetting);
  3191. if (nResidentSafetyCheckSetting == WallpadDeviceSet.RESIDENT_SAFETY_CHECK_ENABLE) Version.setResidentSafety();
  3192. else Version.unsetResidentSafety();
  3193. } catch (RuntimeException re) {
  3194. LogUtil.errorLogInfo("", TAG, re);
  3195. } catch (Exception e) {
  3196. Log.e(TAG, "[Exception] getResidentSafetyCheckSetting()");
  3197. //e.printStackTrace();
  3198. LogUtil.errorLogInfo("", TAG, e);
  3199. }
  3200. }
  3201. /**
  3202. * 멀티제어 관련.
  3203. *
  3204. * */
  3205. public String millToDate(long mills) {
  3206. String pattern = "yyyy-MM-dd'T'HH:mm:ss";
  3207. SimpleDateFormat formatter = new SimpleDateFormat(pattern);
  3208. String date = (String) formatter.format(new Timestamp(mills));
  3209. return date;
  3210. }
  3211. class ClientThread extends Thread {
  3212. private Handler handler;
  3213. private String category;
  3214. private int menu, kind, reason, position;
  3215. private int roomNumber;
  3216. private double doubleState;
  3217. private byte[] arrayState;
  3218. private int state = -9999;
  3219. int dong=0;
  3220. public ClientThread(Handler handler, int menu, int kind, int reason, int position, String category, int roomNumber, int state) {
  3221. this.handler = handler;
  3222. this.menu = menu;
  3223. this.kind = kind;
  3224. this.reason = reason;
  3225. this.position = position;
  3226. this.category = category;
  3227. this.roomNumber = roomNumber;
  3228. this.state = state;
  3229. }
  3230. public ClientThread(Handler handler, int menu, int dong, int kind, int reason, int position, String category, int roomNumber, int state) {
  3231. this.handler = handler;
  3232. this.menu = menu;
  3233. this.dong = dong;
  3234. this.kind = kind;
  3235. this.reason = reason;
  3236. this.position = position;
  3237. this.category = category;
  3238. this.roomNumber = roomNumber;
  3239. this.state = state;
  3240. }
  3241. public ClientThread(Handler handler, int menu, int kind, int reason, int position, String category, int roomNumber, double state) {
  3242. this.handler = handler;
  3243. this.menu = menu;
  3244. this.kind = kind;
  3245. this.reason = reason;
  3246. this.position = position;
  3247. this.category = category;
  3248. this.roomNumber = roomNumber;
  3249. this.doubleState = state;
  3250. }
  3251. public ClientThread(Handler handler, int menu, int kind, int reason, int position, String category, int roomNumber, byte[] state) {
  3252. this.handler = handler;
  3253. this.menu = menu;
  3254. this.kind = kind;
  3255. this.reason = reason;
  3256. this.position = position;
  3257. this.category = category;
  3258. this.roomNumber = roomNumber;
  3259. this.arrayState = state;
  3260. this.state = -1111;
  3261. }
  3262. public ClientThread(Handler handler, int menu, int kind, int reason, int position) {
  3263. this.handler = handler;
  3264. this.menu = menu;
  3265. this.kind = kind;
  3266. this.reason = reason;
  3267. this.position = position;
  3268. }
  3269. public void run() {
  3270. String host = "10.1.1.1";
  3271. if(dong==0) {
  3272. host = "10.1." + mMultiAddress + ".1";
  3273. }else{
  3274. host = "10.1." + dong + ".1";
  3275. }
  3276. int port = 9998;
  3277. String json = "";
  3278. // build jsonObject
  3279. JSONObject jsonObject = new JSONObject();
  3280. JSONObject dataJsonObject = new JSONObject();
  3281. try {
  3282. jsonObject.accumulate("type", "request");
  3283. jsonObject.accumulate("timestamp", millToDate(System.currentTimeMillis()));
  3284. jsonObject.accumulate("wallpadip", myIP);
  3285. jsonObject.accumulate("menu", menu);
  3286. jsonObject.accumulate("kind", kind);
  3287. jsonObject.accumulate("reason", reason);
  3288. jsonObject.accumulate("position", position);
  3289. //제어
  3290. if (reason == Common.JSON.REASON.Control) {
  3291. dataJsonObject.accumulate("number", roomNumber);
  3292. dataJsonObject.accumulate("category", category);
  3293. if(state==-1111) {
  3294. dataJsonObject.accumulate("arrayState", arrayState);
  3295. }else if(state!=-9999) {
  3296. dataJsonObject.accumulate("state", state);
  3297. }else{
  3298. dataJsonObject.accumulate("doubleState", doubleState);
  3299. }
  3300. }
  3301. //상태 조회
  3302. else if (reason == Common.JSON.REASON.Status) {
  3303. dataJsonObject.accumulate("number", roomNumber);
  3304. }
  3305. jsonObject.accumulate("data", dataJsonObject);
  3306. } catch (JSONException e) {
  3307. e.printStackTrace();
  3308. }
  3309. // convert JSONObject to JSON to String
  3310. json = jsonObject.toString();
  3311. try {
  3312. Socket socket = new Socket();
  3313. InetSocketAddress ipep = new InetSocketAddress(host, port); // 방법 2
  3314. socket.connect(ipep);
  3315. ObjectOutputStream outputStream = new ObjectOutputStream(socket.getOutputStream());
  3316. outputStream.writeObject(json);
  3317. ObjectInputStream inputStream = new ObjectInputStream(socket.getInputStream());
  3318. StringBuffer stb = new StringBuffer();
  3319. String data;
  3320. while (true) {
  3321. try {
  3322. socket.setSoTimeout(5000);
  3323. data = (String) inputStream.readObject();
  3324. if (data == null) {
  3325. break;
  3326. }
  3327. stb.append(data);
  3328. } catch (Exception e) {
  3329. if (socket != null) {
  3330. socket.close();
  3331. }
  3332. if (inputStream != null) {
  3333. inputStream.close();
  3334. }
  3335. if (outputStream != null) {
  3336. outputStream.close();
  3337. }
  3338. break;
  3339. }
  3340. }
  3341. if (socket != null) {
  3342. socket.close();
  3343. }
  3344. if (inputStream != null) {
  3345. inputStream.close();
  3346. }
  3347. if (outputStream != null) {
  3348. outputStream.close();
  3349. }
  3350. final String response = String.valueOf(stb);
  3351. DebugLogOutput("ClientThread response=" + response);
  3352. final String finalResponse = response;
  3353. Message message = handler.obtainMessage();
  3354. message.what = 1000;
  3355. Bundle bundle = new Bundle();
  3356. bundle.putString("response", finalResponse);
  3357. message.setData(bundle);
  3358. handler.sendMessage(message);
  3359. } catch (Exception e) {
  3360. e.printStackTrace();
  3361. DebugLogOutput("ClientThread Exception error=" + e);
  3362. }
  3363. }
  3364. }
  3365. public void requestMultiControl(Handler handler, int menu, int kind, int reason, int position, String category, int number, int state) {
  3366. ClientThread thread = new ClientThread(handler, menu, kind, reason, position, category, number, state);
  3367. thread.start();
  3368. }
  3369. public void requestMultiControl(Handler handler, int menu, int dong, int kind, int reason, int position, String category, int number, int state) {
  3370. ClientThread thread = new ClientThread(handler, menu, dong, kind, reason, position, category, number, state);
  3371. thread.start();
  3372. }
  3373. public void requestMultiControl(Handler handler, int menu, int kind, int reason, int position, String category, int number, double state) {
  3374. ClientThread thread = new ClientThread(handler, menu, kind, reason, position, category, number, state);
  3375. thread.start();
  3376. }
  3377. public void requestMultiStatus(Handler handler, int menu, int kind, int reason, int position) {
  3378. ClientThread thread = new ClientThread(handler, menu, kind, reason, position);
  3379. thread.start();
  3380. }
  3381. }