MainActivity.java 115 KB

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