12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248 |
- package kr.co.icontrols.wallpadhomectrl;
- import android.annotation.SuppressLint;
- import android.app.ActivityManager;
- import android.content.BroadcastReceiver;
- import android.content.Context;
- import android.content.Intent;
- import android.content.IntentFilter;
- import android.graphics.Color;
- import android.os.Bundle;
- import android.os.CountDownTimer;
- import android.os.Handler;
- import android.os.Message;
- import android.os.PowerManager;
- import android.util.Log;
- import android.view.Gravity;
- import android.view.KeyEvent;
- import android.view.MotionEvent;
- import android.view.View;
- import android.view.View.OnTouchListener;
- import android.view.animation.AccelerateInterpolator;
- import android.view.animation.Animation;
- import android.view.animation.Animation.AnimationListener;
- import android.view.animation.TranslateAnimation;
- import android.widget.ExpandableListView;
- import android.widget.ExpandableListView.OnGroupClickListener;
- import android.widget.ExpandableListView.OnGroupCollapseListener;
- import android.widget.ExpandableListView.OnGroupExpandListener;
- import android.widget.RelativeLayout;
- import com.artncore.WallPadDataMgr.WallpadDeviceSet;
- import com.artncore.WallPadDataMgr.WallpadStatusData;
- import com.artncore.WallPadDataMgr.wallpaddbmgr;
- import com.artncore.commons.API_Menu;
- import com.artncore.commons.API_Menu.MenuListDataClass;
- import com.artncore.commons.API_Menu.MenuListDataClass.ChildIDMapping;
- import com.artncore.commons.DataClasses;
- import com.artncore.commons.define;
- import com.artncore.wallpadapi.KnxVentiAPI;
- import com.artncore.wallpadapi.LedDimmingKCC_API;
- import com.artncore.wallpadapi.MultiSwitchAPI;
- import com.artncore.wallpadapi.VentiAPI;
- import com.artncore.wallpadapi.WallPadAPI;
- import com.util.LogUtil;
- import java.util.ArrayList;
- import java.util.List;
- import kr.co.icontrols.v40ioctl.V40IF;
- import kr.co.icontrols.wallpadhomectrl.declare.Common;
- import kr.co.icontrols.wallpadhomectrl.declare.ID;
- import kr.co.icontrols.wallpadhomectrl.screen.screen_aircon.SystemAirconMainScreen;
- import kr.co.icontrols.wallpadhomectrl.screen.screen_airquality.AirQualityMainScreen;
- import kr.co.icontrols.wallpadhomectrl.screen.screen_airquality.DustInfoScreen;
- import kr.co.icontrols.wallpadhomectrl.screen.screen_concent.ConcentEnergyMeterScreen;
- import kr.co.icontrols.wallpadhomectrl.screen.screen_concent.ConcentHdcNEachMainScreen;
- import kr.co.icontrols.wallpadhomectrl.screen.screen_concent.ConcentKnxMainScreen;
- import kr.co.icontrols.wallpadhomectrl.screen.screen_concent.ConcentMainScreen;
- import kr.co.icontrols.wallpadhomectrl.screen.screen_curtain.CurTainV1MainScreen;
- import kr.co.icontrols.wallpadhomectrl.screen.screen_doorlock.DoorLockMainScreen;
- import kr.co.icontrols.wallpadhomectrl.screen.screen_elecrange.ElectricRangeMainScreen;
- import kr.co.icontrols.wallpadhomectrl.screen.screen_gas.CookTopConcentMainScreen;
- import kr.co.icontrols.wallpadhomectrl.screen.screen_gas.GasMainScreen;
- import kr.co.icontrols.wallpadhomectrl.screen.screen_gas.HybridCookTopMainScreen;
- import kr.co.icontrols.wallpadhomectrl.screen.screen_heating.HeatingV1MainScreen;
- import kr.co.icontrols.wallpadhomectrl.screen.screen_heating.HeatingV2MainScreen;
- import kr.co.icontrols.wallpadhomectrl.screen.screen_knx_venti.KnxVentiEasymodeScreen;
- import kr.co.icontrols.wallpadhomectrl.screen.screen_knx_venti.KnxVentiMainScreen;
- import kr.co.icontrols.wallpadhomectrl.screen.screen_light.LightEtcEachMainScreen;
- import kr.co.icontrols.wallpadhomectrl.screen.screen_light.LightEtcLivMainScreen;
- import kr.co.icontrols.wallpadhomectrl.screen.screen_light.LightHdcLightEnergyMeterMainScreen;
- import kr.co.icontrols.wallpadhomectrl.screen.screen_light.LightHdcLivConifgScreen;
- import kr.co.icontrols.wallpadhomectrl.screen.screen_light.LightHdcLivKnxMainScreen;
- import kr.co.icontrols.wallpadhomectrl.screen.screen_light.LightHdcLivMainScreen;
- import kr.co.icontrols.wallpadhomectrl.screen.screen_light.LightHdcNEachMainScreen;
- import kr.co.icontrols.wallpadhomectrl.screen.screen_light.LightKnxMainScreen;
- import kr.co.icontrols.wallpadhomectrl.screen.screen_purity.PurityMainScreen;
- import kr.co.icontrols.wallpadhomectrl.screen.screen_venti.VentiEasymodeScreen;
- import kr.co.icontrols.wallpadhomectrl.screen.screen_venti.VentiMainScreen;
- import kr.co.icontrols.wallpadhomectrl.screen.screen_venti.VentilationMainScreen;
- import kr.co.icontrols.wallpadhomectrl.screen.screen_venti.VentilationModelMainScreen;
- import kr.co.icontrols.wallpadsupport.Version;
- import kr.co.icontrols.wallpadsupport.WpadActivity;
- import kr.co.icontrols.wallpadsupport.WpadImageView;
- import kr.co.icontrols.wallpadsupport.WpadImageView.TOUCH_KIND;
- import kr.co.icontrols.wallpadsupport.WpadScale;
- import kr.co.icontrols.wallpadsupport.WpadSound.SND;
- import kr.co.icontrols.wallpadsupport.WpadTextView;
- import kr.co.icontrols.wallpadsupport.WpadUtil;
- import static com.artncore.WallPadDataMgr.WallpadDeviceSet.DOORLOCK_TYPE_FINGERPRINT;
- import static com.artncore.WallPadDataMgr.WallpadDeviceSet.DOORLOCK_TYPE_NORMAL;
- import static com.artncore.WallPadDataMgr.WallpadDeviceSet.DOORLOCK_TYPE_RF;
- /**
- * @description 월패드 [설정기능] 메인화면 이다.<br>
- * 상단의 Top 메뉴, [홈] [돌아가기]<br>
- * 좌측의 Tab 메뉴, [환경설정] [화면청소] [비밀번호변경] ... 등 선택 메뉴<br>
- * 를 여기서 처리한다.
- */
- public class MainActivity extends WpadActivity {
- private final static String TAG = "MainActivity";
- private final boolean DEBUG_LOG_ON = true;
- private void DebugLogOutput(String s)
- {
- if (DEBUG_LOG_ON) Log.d(TAG, s);
- }
- // =================================================================================================
- // [[ Declaration ]] region
- // =================================================================================================
- protected Context mContext = null;
- public Context getContext()
- {
- return mContext;
- }
- private WallPadAPI wpapi = null;
- private int OPERATION_MODE = Common.MODE;
- private WallpadStatusData wdb = null;
- // Layout
- private RelativeLayout AllLayout; // 화면 전체
- private RelativeLayout TopLayout; // 상단 메뉴
- private RelativeLayout ScreenLayout; // 메인 화면
- private RelativeLayout MenuLayout; // 메뉴 화면
- // Top Menu
- private WpadImageView TopBackground;
- private WpadTextView TopTitle;
- private WpadImageView TopHomeBtn, TopBackBtn, TopMenuBtn, TopBoilerBtn;
- private WpadImageView TopAirBackBtn, BTN_TOP_BACK_VENTIL;
- private WpadImageView TopDimmingBtn[];
- public static WpadImageView TopManualBtn;
- private WpadImageView Hide1Btn, Hide2Btn;
- // Main
- private WpadImageView ScreenBackground;
- // Menu
- private WpadImageView MenuBackground;
- private WpadImageView MenuClose;
- private WpadTextView MenuTitle;
- private static ExpandableListView mListView;
- private Menu_AdptMain adptMain;
- private MenuListDataClass menueListDataClass;
- private Menu mMenu = null; //WPadAPI의 Menu class
- private boolean MenuOpen = false;
- // HideMenu
- private int mHideMenuEntryStatus = 0;
- private static boolean mHideMenuOn = false;
- public static boolean getHideMenuOn() { return mHideMenuOn; }
- private CountDownTimer mHideMenuTimer = null;
- // PopupActivityRun
- private static boolean PopupActivityRun = false;
- public static boolean getPopupActivityRun()
- {
- return PopupActivityRun;
- }
- public static void setPopupActivityRun(boolean run)
- {
- PopupActivityRun = run;
- }
- // CurrentScreenId
- private int mCurrentScreenId = -1;
- private int mTempCurrentScreenId = -1;
- public static int mCurrentManualScreenId = -1;
- // Screen
- private LightHdcLivMainScreen lightHdcLivMainScreen = null;
- private LightHdcLivKnxMainScreen lightHdcLivKnxMainScreen = null;
- private LightKnxMainScreen lightKnxMainScreen = null;
- private KnxVentiMainScreen KnxVentiMainScreen = null;
- private VentiMainScreen ventiMainScreen = null;
- private VentilationMainScreen ventilationMainScreen = null;
- private kr.co.icontrols.wallpadhomectrl.screen.screen_venti.VentilationModelMainScreen ventilationModelMainScreen = null;
- private KnxVentiMainScreen knxVentiMainScreen = null;
- private KnxVentiEasymodeScreen knxVentiEasymodeScreen= null;
- private VentiEasymodeScreen ventiEasymodeScreen= null;
- private GasMainScreen gasMainScreen = null;
- private DoorLockMainScreen doorLockMainScreen = null;
- private HeatingV2MainScreen heatingV2MainScreen = null;
- private HeatingV1MainScreen heatingV1MainScreen = null;
- private LightHdcLivConifgScreen lightHdcLivConifgScreen = null;
- private LightEtcEachMainScreen lightEtcEachMainScreen = null;
- private LightEtcLivMainScreen lightEtcLivMainScreen = null;
- private LightHdcNEachMainScreen lightHdcNEachMainScreen = null;
- private LightHdcLightEnergyMeterMainScreen lightHdcLightEnergyMeterMainScreen = null;
- private AirQualityMainScreen airQualityMainScreen = null;
- private DustInfoScreen dustInfoScreen = null;
- private ConcentMainScreen concentMainScreen = null;
- private ConcentKnxMainScreen concentKnxMainScreen = null;
- private ConcentEnergyMeterScreen concentEnergyMeterScreen = null;
- private HybridCookTopMainScreen hybridCookTopMainScreen = null;
-
- private ConcentHdcNEachMainScreen concentHdcNEachMainScreen = null;
- private ElectricRangeMainScreen electricRangeMainScreen = null;
- private CookTopConcentMainScreen cookTopConcentMainScreen = null;
- private SystemAirconMainScreen systemAirconMainScreen = null;
- private PurityMainScreen purityMainScreen = null;
- private CurTainV1MainScreen curTainV1MainScreen = null;
- //API
- public WallpadStatusData GetDBObj() {
- return wdb;
- }
- // 명칭 관련
- public static final int HEATING = 1;
- public static final int LIGHT = 2;
- private String[] mRoomNameList_Light = null; //조명 방 명칭
- private String[] mRoomNameList_Heating = null; //난방 방 명칭
- private String[] mDefaultRoomNameList = new String[]{"거실", "방1", "방2", "방3", "방4", "방5", "방6", "방7", "방8"};
- private String[] mDefaultRoomNameList_Light = new String[]{"거실", "주방", "방1", "방2", "방3", "방4", "방5", "방6", "방7", "방8"};
- private String[] mDefaultRoomNameList_Light_SK = new String[]{"거실", "주방", "안방", "침실1", "침실2", "침실3", "침실4", "침실5", "침실6", "침실7", "침실8"};
- private String[] mDefaultRoomNameList_Heating = new String[]{"거실", "방1", "방2", "방3", "방4", "방5", "방6", "방7", "방8"};
- private String[] mDefaultRoomNameList_Heating_SK = new String[]{"거실", "안방", "침실1", "침실2", "침실3", "침실4", "침실5", "침실6", "침실7", "침실8"};
- private String[] mDefaultRoomNameList_Heating_easymode = new String[]{"거실", "방1", "방2", "방3", "방4", "방5", "방6", "방7", "방8"};
- private int[][] KCC_DimmBtnOffArray =
- {
- {R.drawable.btn_top_dimm_normal_off, R.drawable.btn_top_dimm_normal_pressed},
- {R.drawable.btn_top_dimm_study_off, R.drawable.btn_top_dimm_study_pressed},
- {R.drawable.btn_top_dimm_sensi_off, R.drawable.btn_top_dimm_sensi_pressed},
- {R.drawable.btn_top_dimm_rest_off, R.drawable.btn_top_dimm_rest_pressed}
- };
- private int[][] KCC_DimmBtnOnArray =
- {
- {R.drawable.btn_top_dimm_normal_selected, R.drawable.btn_top_dimm_normal_pressed},
- {R.drawable.btn_top_dimm_study_selected, R.drawable.btn_top_dimm_study_pressed},
- {R.drawable.btn_top_dimm_sensi_selected, R.drawable.btn_top_dimm_sensi_pressed},
- {R.drawable.btn_top_dimm_rest_selected, R.drawable.btn_top_dimm_rest_pressed},
- };
- private LedDimmingKCC_API ledDimmingAPI = null;
- private class DimData {
- LedDimmingKCC_API.Data DimData;
- public DimData()
- {
- DimData = null;
- }
- }
- private DimData mDimData = null;
- private byte [] mLevelArray = { 100, 70, 50, 20 };
- private boolean bMultiConcentExist = false;
- boolean bKitchenLightonLivingEM = false; // 거실EM에 주방등 연결 여부
- int[] naLightEnable = null; // 조명 타입
- public static PowerManager mPowerManager;
- public static V40IF mV40IF;
- //Value
- public int KccDimUse = 0;
- // int SmartDistUse = -1;
- // boolean KnxDistUse = false;
- public static int nDistributionPanelType = Version.DISTRIBUTION_MODEL.OTHER;
- public static int nEnergyProductionUse;
- private VentiAPI mVentilAPI = null;
- private KnxVentiAPI mKnxVentilAPI = null;
- DataClasses.Venti VentilStatus;
-
- /**
- * 모델하우스 전용 환기 버전2 사용 여부 체크
- * UI만 동작함
- */
- private boolean isUseModelHouse_Venti = false;
- // =================================================================================================
- // [[ Activity Life Cycle ]] region
- // =================================================================================================
- /**
- * Activity Constructors
- */
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- Log.i(TAG, "[onCreate] -------------------------------------------------------------");
- Log.i(TAG, "[onCreate] ------------------ [START - MainActivity] -------------------");
- Log.i(TAG, "[onCreate] -------------------------------------------------------------");
- super.onCreate(savedInstanceState);
- // @ AutoScale 설정
- WpadScale.setAutoScale(true);
- if (Common.CHECK_DEV_SERVICE) StartDevService();
- super.AppVersionLogOut(); // [APP Version] + [WallPadSupport Lib Version] 을 로그로 출력한다.
- Log.i("[onCreate] Version", "<><><><> WallPadAPI Version = [" + define.WALLPADAPI_VERSION + "] " + "<><><><>");
- // 1. 변수 초기화
- DebugLogOutput("[Create] - Step1 : Data Create");
- PopupActivityRun = false;
- ManualActivityRun = false;
- mPowerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
- mV40IF = new V40IF();
- mContext = this;
- mDimData = new DimData();
- mHideMenuOn = false;
- // 2. 자동 종료 셋팅
- DebugLogOutput("[Create] - Step2 : Auto Finish Setting");
- // 2-1. 자동종료 타이머 셋팅
- if (Common.FINISH_TIME_ENABLE) super.setFinishTimerCreate(Common.FINISH_TIME_SEC);
- Common.ctrlLCDOnOff(true);
- // 3. API 호출
- DebugLogOutput("[Create] - Step3 : API Call");
- if (Common.GetDeviceSampleMode(this)) OPERATION_MODE = Common.MODE_BUSINESS_SAMPLE;
- else OPERATION_MODE = Common.MODE_NOMAL;
- // 3.1. wpapi 생성
- if (OPERATION_MODE == Common.MODE_NOMAL) {
- Log.d(TAG, "[onCreate] OperationMode = MODE_NOMAL");
- try {
- wpapi = new WallPadAPI(this);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[ExceptionError] - new WallPadAPI : " + e);
- }
- }
- else if (OPERATION_MODE == Common.MODE_BUSINESS_SAMPLE) {
- Log.d(TAG, "[onCreate] OperationMode = MODE_BUSINESS_SAMPLE");
- try {
- wpapi = new WallPadAPI(this);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[ExceptionError] - new WallPadAPI : " + e);
- }
- }
- try {
- wdb = new WallpadStatusData(this);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[ExceptionError] - onCreate->WallpadStatusData Create : " + e);
- }
- getConstructionFunction();
- GetRoomName();
- //mMultiConentCheckHandler.sendEmptyMessage(0); // 멀티스위치 콘센트 유무 확인
- // 4. Layout registration
- DebugLogOutput("[Create] - Step4 : Layout registration");
- // 4-1. mainLayout
- AllLayout = new RelativeLayout(this);
- RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(WpadScale.getWidthPixels(), WpadScale.getHeightPixels());
- AllLayout.setLayoutParams(params);
- AllLayout.setId(ID.main.layout.ALL);
- super.setAllLayoutRegistration(AllLayout);
- // 4-2. TopLayout
- TopLayout = new RelativeLayout(this);
- WpadUtil.LayoutRegistration(AllLayout, TopLayout, 1280, 110, 0, 0, ID.main.layout.TOP);
- // 4-4. ScreenLayout
- ScreenLayout = new RelativeLayout(this);
- WpadUtil.LayoutRegistration(AllLayout, ScreenLayout, 1280, 690, 0, 110, ID.main.layout.SCREEN);
- ScreenBackground = new WpadImageView(this, TOUCH_KIND.NONE, 1280, 690, R.drawable.bg_body, R.drawable.bg_body, ID.main.image.SCREEN_BACKGROUND);
- ViewRegistration(ScreenLayout, ScreenBackground, 0, 0);
- // 5. Top Menu - ImageView registration
- DebugLogOutput("[Create] - Step5 : Top Menu - ImageView registration");
- TopBackground = new WpadImageView(this, TOUCH_KIND.NONE, 1280, 110, R.drawable.bg_topbar, R.drawable.bg_topbar, ID.main.image.TOP_BACKGROUND);
- ViewRegistration(TopLayout, TopBackground, 0, 0);
- TopTitle = new WpadTextView(this, false, 247 + 600, 80, Gravity.LEFT, Color.WHITE, Common.fontsize._44, true, ID.main.text.TITLE);
- ViewRegistration(TopLayout, TopTitle, 133, 15);
- TopHomeBtn = new WpadImageView(this, TOUCH_KIND.BUTTON, 110, 110, R.drawable.topbar_icon_home_normal, R.drawable.topbar_icon_home_pressed, ID.main.button.HOME);
- ViewRegistration(TopLayout, TopHomeBtn, 1145, 0);
- TopMenuBtn = new WpadImageView(this, TOUCH_KIND.BUTTON, 110, 110, R.drawable.topbar_icon_menu_normal, R.drawable.topbar_icon_menu_pressed, ID.main.button.MENU);
- ViewRegistration(TopLayout, TopMenuBtn, 0, 0);
- TopManualBtn = new WpadImageView(this, TOUCH_KIND.BUTTON, 110, 110, R.drawable.topbar_icon_manual_normal, R.drawable.topbar_icon_manual_pressed, ID.main.button.MANUAL);
- setManualBtnVisible(getManualUse(), 1019);
- TopBackBtn = new WpadImageView(this, TOUCH_KIND.BUTTON, 110, 110, R.drawable.topbar_icon_back_normal, R.drawable.topbar_icon_back_pressed, ID.main.button.BACK);
- ViewRegistration(TopLayout, TopBackBtn, 1019, 0);
- setTopBackBtnVisible(false);
- TopBoilerBtn = new WpadImageView(this, TOUCH_KIND.BUTTON, 110, 110, R.drawable.top_but_boiler_normal, R.drawable.top_but_boiler_pressed, ID.main.button.BOILER);
- ViewRegistration(TopLayout, TopBoilerBtn, 1019, 0);
- setTopBoilerBtnVisible(false);
- TopAirBackBtn = new WpadImageView(this, TOUCH_KIND.BUTTON, 110, 110, R.drawable.topbar_icon_back_normal, R.drawable.topbar_icon_back_pressed, ID.main.button.AIRQBACK);
- ViewRegistration(TopLayout, TopAirBackBtn, 1019, 0);
- setAIRBackBtnVisible(false);
- BTN_TOP_BACK_VENTIL = new WpadImageView(this, TOUCH_KIND.BUTTON, 110, 110, R.drawable.topbar_icon_back_normal, R.drawable.topbar_icon_back_pressed, ID.main.button.VENTILBACK);
- ViewRegistration(TopLayout, BTN_TOP_BACK_VENTIL, 1019, 0);
- setVentilBackBtnVisible(false);
- Hide1Btn = new WpadImageView(this, TOUCH_KIND.BUTTON_M, 100, 110, 0, 0, ID.main.button.HIDE1);
- ViewRegistration(TopLayout, Hide1Btn, 530, 0);
- Hide2Btn = new WpadImageView(this, TOUCH_KIND.BUTTON_M, 100, 110, 0, 0, ID.main.button.HIDE2);
- ViewRegistration(TopLayout, Hide2Btn, 650, 0);
- TopDimmingBtn = new WpadImageView[4];
- for (int i = 0; i < TopDimmingBtn.length; i++) {
- TopDimmingBtn[i] = new WpadImageView(this, TOUCH_KIND.BUTTON, 76, 76, KCC_DimmBtnOffArray[i], KCC_DimmBtnOnArray[i], ID.main.button.DIMM_NORMAL + i);
- ViewRegistration(TopLayout, TopDimmingBtn[i], 445 + (i*100), 17);
- }
- setKccDimmBtnVisible(false);
- WallpadDeviceSet wpdds = new WallpadDeviceSet(getContext());
- bKitchenLightonLivingEM = wpdds.Get_LivingEm_KitchenLight_Use();
- naLightEnable = wpdds.Get_Light_info(); // 조명
- wpdds.closeDB();
- // 6. Menu Loading
- // 6-1. 메뉴 정보를 가져온다 (DB에서 가져온다)
- DebugLogOutput("[Create] - Step6 : Side Menu - Insert Menu List");
- wallpaddbmgr WallpadDBMGR = new wallpaddbmgr(getApplicationContext());
- menueListDataClass = WallpadDBMGR.GetMenuList();
- WallpadDBMGR.closeDB();
- //WallPadMain에서 MenuList를 넣어주지 않아 아래 테스트 코드를 넣음
- menueListDataClass = null;
- if (menueListDataClass == null) {
- Log.e(TAG, "[onCreate] menueListDataClass == null, Load Default List");
- menueListDataClass = loadDefaultMenuList();
- }
- else {
- for (int i = 0; i < menueListDataClass.idMappingTable.length; i++) {
- Log.d(TAG, "[onCreate] i [" + i + "], ID [" + menueListDataClass.idMappingTable[i].Id + ", NAME [" + menueListDataClass.idMappingTable[i].Name + "]");
- }
- }
- // 6-2. 시작 화면을 main APP으로 부터 받아서 처리한다.
- VentilStatus = new DataClasses.Venti();
- mMenu = new Menu();
- mMenu = super.getIntentParsingMenu(getIntent());
- if (mMenu == null) {
- Log.i(TAG, "[onCreate] mMenu = null");
- if (OPERATION_MODE == Common.MODE_NOMAL) {
- mTempCurrentScreenId = API_Menu.SubMenuCtrl.HDC_LivingLamp;
- setTitleName(mTempCurrentScreenId);
- mWallPadApiCheckHandler.sendEmptyMessage(0);
- }
- else {
- setChangeScreen(API_Menu.SubMenuCtrl.HDC_LivingLamp, false);
- }
- }
- else {
- Log.i(TAG, "[onCreate] mMenu != null");
- if (OPERATION_MODE == Common.MODE_NOMAL) {
- mTempCurrentScreenId = mMenu.getStartId();
- setTitleName(mTempCurrentScreenId);
- mWallPadApiCheckHandler.sendEmptyMessage(0);
- }
- else {
- mTempCurrentScreenId = mMenu.getStartId();
- setTitleName(mTempCurrentScreenId);
- mWallPadApiCheckHandler.sendEmptyMessage(0);
- /*boolean result = setChangeScreen(mMenu.getStartId(), false);
- Log.i(TAG, "Menu Sample result = " + result);
- if (result == false)
- {
- setChangeScreen(API_Menu.SubMenuCtrl.HDC_LivingLamp, false);
- }*/
- }
- }
- // 7. Draw
- DebugLogOutput("[Create] - Step7 : setContentView");
- setContentView(AllLayout);
- // 8. Window ReSize
- DebugLogOutput("[Create] - Step8 : Window ReSize");
- //super.WindowReSize(Common.SCREEN_SIZE_MAIN_W, Common.SCREEN_SIZE_MAIN_H, false);
- // 9. BR Receiver 등록(메뉴에서 다른 화면이 눌린 경우 BR처리)
- reg_Receiver();
- WallpadDeviceSet wds = new WallpadDeviceSet(getContext());
- int gateway = wds.GetGatewayModelKindInfo();
- nDistributionPanelType = wds.Get_DistributionPannelType_Info();
- nEnergyProductionUse = wds.Get_Energy_Devices_Info(); //에너지 제품군
- wds.closeDB();
- if (gateway == Version.GATEWAY_MODEL.IGW_200) {
- Log.i(TAG, "[onCreate] IGW_200 SET @@@@@@@@@@@@@@@@@@@@");
- }
- else if (gateway == Version.GATEWAY_MODEL.IGW_300) {
- Log.i(TAG, "[onCreate] IGW_300 SET @@@@@@@@@@@@@@@@@@@@");
- }
- else {
- Log.i(TAG, "[onCreate] GATEWAY OTHER @@@@@@@@@@@@@@@@@@@@");
- }
- /*if( (SmartDistUse == 1) && (KnxDistUse == false) ) // 스마트분전반 O / KNX 분전반 X
- {
- SdbAPI sdbAPI = Get_SdbController();
- if(sdbAPI == null) return -1;
- ret = sdbAPI.Refresh(SdbAPI.DEVICE_INDEX.ENERGY_CONT, define.DEVICE_ALL_OR_NOTHING);
- if(ret < 0) return -2;
- if(sdbAPI.data.EnergyController.Data.BatchOffStatus == Sdb_DataClasses.BATCHOFF_STATUS.SET) return 0;
- else return 1;
- }
- else if( (SmartDistUse == 0) && (KnxDistUse == true) ) // 스마트분전반 X / KNX 분전반 O
- {
- KnxAPI knxAPI = Get_KnxController();
- if(knxAPI == null) return -1;
- ret = knxAPI.Refresh(KnxAPI.DEVICE_INDEX.MASTER_CONT, define.DEVICE_ALL_OR_NOTHING);
- if(ret < 0) return -2;
- if(knxAPI.data.MasterController.Data.BatchOffStatus == KNX_DataClasses.BATCHOFF_STATUS.SET) return 0;
- else return 1;
- }
- else // 그밖의 경우, 스마트분전반을 기본으로 로딩.
- {
- SdbAPI sdbAPI = Get_SdbController();
- if(sdbAPI == null) return -1;
- ret = sdbAPI.Refresh(SdbAPI.DEVICE_INDEX.ENERGY_CONT, define.DEVICE_ALL_OR_NOTHING);
- if(ret < 0) return -2;
- if(sdbAPI.data.EnergyController.Data.BatchOffStatus == Sdb_DataClasses.BATCHOFF_STATUS.SET) return 0;
- else return 1;
- }*/
- Log.i(TAG, "[onCreate] End onCreate -------------------------------------------------");
- }
- /**
- * (임시코드) WallPadAPI 초기생성시 Connect 에 시간이 걸리며, <br>
- * WallPadAPI 초기화후 바로 Get_GasValveController 등을 사용하여 API 를 가져올수 없기에, <br>
- * 본 딜레이 코드를 임시로 적용한다.
- */
- @SuppressLint("HandlerLeak")
- protected Handler mWallPadApiCheckHandler = new Handler() {
- @SuppressLint("HandlerLeak")
- @Override
- public void handleMessage(Message msg) {
- try {
- if (msg.what == 0) {
- if (wpapi != null) {
- //Log.d(TAG, "Handler go");
- if (wpapi.Check_Connect()) {
- if (nDistributionPanelType == Version.DISTRIBUTION_MODEL.KNX_DIST) {
- mKnxVentilAPI = wpapi.Get_KnxVentiController();
- // KNX 환기
- if (mKnxVentilAPI != null) {
- Log.e(TAG, "[mWallPadApiCheckHandler] mKnxVentilAPI is not null!!");
- updateKnxVentilatorData(false);
- }
- else {
- Log.e(TAG, "[mWallPadApiCheckHandler] mKnxVentilAPI is null!!");
- mWallPadApiCheckHandler.sendEmptyMessageDelayed(0, 10);
- }
- mVentilAPI = wpapi.Get_VentiController();
- if (mVentilAPI != null) {
- Log.e(TAG, "[mWallPadApiCheckHandler] mVentilAPI is not null!!");
- updateVentilatorData(false);
- }
- else {
- Log.e(TAG, "[mWallPadApiCheckHandler] mVentilAPI is null!!");
- mWallPadApiCheckHandler.sendEmptyMessageDelayed(0, 10);
- }
- }
- else {
- // 일반 환기
- mVentilAPI = wpapi.Get_VentiController();
- if (mVentilAPI != null) {
- Log.e(TAG, "[mWallPadApiCheckHandler] mVentilAPI is not null!!");
- updateVentilatorData(false);
- }
- else {
- Log.e(TAG, "[mWallPadApiCheckHandler] mVentilAPI is null!!");
- mWallPadApiCheckHandler.sendEmptyMessageDelayed(0, 10);
- }
- }
- // KCC 디밍제어기 사용여부 확인
- WallpadDeviceSet wdst = new WallpadDeviceSet(getContext());
- int nKCCDimmingUsage = wdst.GetDeviceSetted("KCC디밍제어기"); // 1: 사용안함 / 2: 사용함
- int[] nLightType = wdst.Get_Light_info();
- wdst.closeDB();
- if (nKCCDimmingUsage == WallpadDeviceSet.DEV_DATA_ENABLE) {
- ledDimmingAPI = wpapi.Get_KCCDimmingController();
- if (ledDimmingAPI != null) {
- ledDimmingAPI.regChangedBR(ID.main.BR_KCC_DIM);
- if (ledDimmingAPI.Refresh((byte)0, false) >= 0) {
- mDimData.DimData = ledDimmingAPI.data;
- }
- Draw_Update_DimmBtn();
- }
- else {
- Log.w(TAG, "[mWallPadApiCheckHandler] ledDimmingAPI is null!!");
- //mWallPadApiCheckHandler.sendEmptyMessageDelayed(0, 10);
- }
- }
- if (nLightType[0] == WallpadDeviceSet.DO_USE) {
- if (nLightType[1] == WallpadDeviceSet.LIGHT_TYPE_ROOM) {
- // 조명 : 멀티스위치인 경우
- try {
- MultiSwitchAPI mMultiSwitchAPI = wpapi.Get_MultiSwitchController();
- if (mMultiSwitchAPI.Refresh((byte) 0xFF, false) >= 0) {
- Log.i(TAG, "[mWallPadApiCheckHandler] Multi Refresh ----> true @@@@@@@@@@@@@");
- if (mMultiSwitchAPI.isExist_ConcentDevice()) {
- Log.i(TAG, "[mWallPadApiCheckHandler] Multi concent ----> true @@@@@@@@@@@@@");
- bMultiConcentExist = true; // 콘센트 있는지 확인
- }
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, e.toString());
- }
- }
- }
- mWallPadApiCheckHandler.sendEmptyMessageDelayed(1, 10);
- }
- else {
- mWallPadApiCheckHandler.sendEmptyMessageDelayed(0, 10);
- }
- }
- else {
- Log.w(TAG, "[mWallPadApiCheckHandler] wpapi is null!!");
- }
- }
- else if (msg.what == 1) {
- Log.d(TAG, "Handler finish");
- menueListDataClass = loadDefaultMenuList(); // 다시 메뉴를 만들어 질까? ??????
- boolean result = setChangeScreen(mTempCurrentScreenId, false);
- if (result == false) {
- setChangeScreen(API_Menu.SubMenuCtrl.HDC_LivingLamp, false);
- }
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] mWallPadApiCheckHandler.handleMessage(Message msg)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- };
- boolean multiConcentFindRoutine = false;
- @SuppressLint("HandlerLeak")
- protected Handler mMultiConentCheckHandler = new Handler()
- {
- @SuppressLint("HandlerLeak")
- @Override
- public void handleMessage(Message msg) {
- if (msg.what == 0) {
- if (wpapi != null) {
- //Log.d(TAG, "Handler go");
- if (wpapi.Check_Connect()) {
- WallpadDeviceSet wdst = new WallpadDeviceSet(getContext());
- int[] lightType = wdst.Get_Light_info();
- wdst.closeDB();
- if (lightType[0] == WallpadDeviceSet.DO_USE) {
- if (lightType[1] == WallpadDeviceSet.LIGHT_TYPE_ROOM) {
- // 조명 : 멀티스위치인 경우,
- try {
- MultiSwitchAPI MSAPI = wpapi.Get_MultiSwitchController();
- if (MSAPI.Refresh((byte) 0xFF, false) >= 0) {
- Log.i(TAG, "Multi Refresh ----> true @@@@@@@@@@@@@");
- if (MSAPI.isExist_ConcentDevice()) {
- Log.i(TAG, "Multi concent ----> true @@@@@@@@@@@@@");
- bMultiConcentExist = true; // 콘센트 있는지 확인
- }
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, e.toString());
- }
- }
- else {
- mWallPadApiCheckHandler.sendEmptyMessageDelayed(1, 10);
- }
- }
- mWallPadApiCheckHandler.sendEmptyMessageDelayed(1, 10);
- }
- else {
- mWallPadApiCheckHandler.sendEmptyMessageDelayed(0, 10);
- }
- }
- }
- else if (msg.what == 1) {
- Log.d(TAG, "Handler finish");
- multiConcentFindRoutine = true;
- menueListDataClass = loadDefaultMenuList(); // 다시 메뉴를 만들어 질까? ??????
- }
- }
- };
- /* ================================================================================================
- * [Manual Activity] Section
- ================================================================================================ */
- public static ManualActivity mManualActivity;
- public void setManualBtnVisible(boolean bEnable, int marginLeft) {
- try {
- Log.d(TAG, "[setManualBtnVisible] bEnable [" + bEnable + "], marginLeft [" + marginLeft + "]");
- if (bEnable) {
- TopManualBtn.setVisibility(View.VISIBLE);
- ViewRegistration(TopLayout, TopManualBtn, marginLeft, 0);
- }
- else {
- TopManualBtn.setVisibility(View.INVISIBLE);
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] setManualBtnVisible(boolean bEnable, int marginLeft)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /**
- * 매뉴얼 버튼 사용 유무
- * @return boolean 타입 - true: 사용, false: 미사용
- */
- public boolean getManualUse() {
- try {
- WallpadDeviceSet devSet = new WallpadDeviceSet(mContext);
- String[] DBinfo = devSet.GetSettingData("매뉴얼");
- devSet.closeDB();
- if (DBinfo != null) {
- if (DBinfo[1].indexOf("사용함") > 0) {
- Log.d(TAG, "[getManualUse] Use Manual");
- return true;
- }
- else {
- // 미사용
- Log.d(TAG, "[getManualUse] Not Use Manual [1]");
- return false;
- }
- }
- else {
- // 미사용
- Log.d(TAG, "[getManualUse] Not Use Manual [2]");
- return false;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] getManualUse()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- return false;
- }
- // ManualActivityRun
- private static boolean ManualActivityRun = false;
- public static boolean getManualActivityRun() {
- Log.d(TAG, "[getManualActivityRun] ManualActivityRun: " + ManualActivityRun);
- return ManualActivityRun;
- }
- public static void setManualActivityRun(boolean run) {
- ManualActivityRun = run;
- if (!ManualActivityRun) resetCurrentManualScreenID();
- }
- public boolean StartManual(int screenId) {
- try {
- Log.d(TAG, "[StartManual] ScreenId [" + screenId + "], mCurrentManualScreenId [" + mCurrentManualScreenId + "]");
- if (getManualActivityRun()) {
- mCurrentManualScreenId = screenId;
- return ((WpadActivity) (ManualActivity.getContext())).ChangeScreen(screenId);
- }
- else {
- if (mCurrentManualScreenId == screenId) return false;
- mCurrentManualScreenId = screenId;
- setManualActivityRun(true);
- Intent intent = new Intent(mContext, ManualActivity.class);
- intent.putExtra("ScreenId", screenId);
- if (mCurrentScreenId == API_Menu.SubMenuCtrl.Heating_V2) {
- intent.putExtra("HeatInfo", heatingV2MainScreen.Heating_Manual_Str);
- }
- else if (mCurrentScreenId == API_Menu.SubMenuCtrl.OutSide_EachLamp) {
- intent.putExtra("EtcMultiInfo", "RoomCount:"+lightEtcEachMainScreen.TotalRoomCount + "/" + "KccDim:" + KccDimUse );
- }
- else if (mCurrentScreenId == API_Menu.SubMenuCtrl.Concent) {
- intent.putExtra("ConcentInfo", "ConcentCount:"+concentMainScreen.mConDeviceCount );
- }
- else if (mCurrentScreenId == API_Menu.SubMenuCtrl.ChangAir_Normal) {
- if (GetEasyModeUXUse() == true) {
- intent.putExtra("VentiInfo", ventiEasymodeScreen.VentiManual_Str);
- }
- else {
- if (ventiMainScreen != null) intent.putExtra("VentiInfo", ventiMainScreen.VentiManual_Str);
- }
- }
- overridePendingTransition(0, 0);
- startActivityForResult(intent, 0);
- return true;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] StartManual(int screenId)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- public static void resetCurrentManualScreenID() {
- try {
- mCurrentManualScreenId = -1;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] resetCurrentManualScreenID()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public static void FinishManualActivity() {
- Log.i(TAG, "[FinishManualActivity]");
- try {
- if (mManualActivity != null) {
- mCurrentManualScreenId = -1;
- mManualActivity.finish();
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] FinishManualActivity()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /**
- * onDestroy
- */
- @Override
- protected void onDestroy() {
- try {
- setChangeScreen(mCurrentScreenId, true);
- if (wdb != null) wdb.closeDB();
- if (mWallPadApiCheckHandler != null) {
- mWallPadApiCheckHandler.removeMessages(0);
- }
- this.unregisterReceiver(mWallPadAlertBR);
- this.unregisterReceiver(mWallPadJogBR);
- this.unregisterReceiver(mKccDimmBR);
- if (ledDimmingAPI != null) {
- ledDimmingAPI.unregChangedBR(ID.main.BR_KCC_DIM);
- super.removeBrActionFilter(ID.main.BR_KCC_DIM);
- }
- if (getManualUse()) {
- FinishManualActivity();
- }
- super.setFinishTimerDestroy();
- super.onDestroy();
- Log.i(TAG, "*************************************************************");
- Log.i(TAG, "****************** [END - MainActivity] *******************");
- Log.i(TAG, "*************************************************************");
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] onDestroy()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /**
- * onResume
- */
- @Override
- protected void onResume() {
- super.onResume();
- if (wpapi != null) wpapi.Resume();
- DebugLogOutput("@@@@@@@@ [onResume] @@@@@@@@");
- }
- /**
- * onPause
- */
- @Override
- protected void onPause() {
- super.onPause();
- if (wpapi != null) wpapi.Pause();
- DebugLogOutput("@@@@@@@@ [onPause] @@@@@@@@");
- }
- /* ================================================================================================
- * [BroadcastReceiver] Section
- ================================================================================================ */
- /**
- * BroadcastReceiver.onReceive for [WpadActivity]
- */
- @Override
- protected void onBrReceive(Intent intent) {
- super.onBrReceive(intent);
- String strActionName = intent.getAction();
- DebugLogOutput("[onBrReceive] strActionName [" + intent.getAction() + "]");
- if (strActionName.equals(ID.main.BR_KCC_DIM)) {
- DebugLogOutput("[onBrReceive] ID.main.BR_KCC_DIM");
- Device_Update_Dimming(false, (byte)0);
- Draw_Update_DimmBtn();
- }
- }
- /* ================================================================================================
- * [Touch & Key Event] Section
- ================================================================================================ */
- /**
- * TouchEvent for [WpadActivity]
- */
- @Override
- protected void onTouchEvent(View v, MotionEvent event) {
- super.onTouchEvent(v, event);
- try {
- int TargetId = v.getId();
- int MoveEvent = event.getAction();
- //DebugLogOutput("onTouch - " + "id : " + v.getId() + " / Action : " + event.getAction());
- if (MoveEvent == MotionEvent.ACTION_UP) {
- if (TargetId == ID.main.button.HOME) {
- DebugLogOutput("onTouchEvent [HOME] BUTTON !!!");
- Sound().Play(SND.effect.TOUCH_LATCHED);
- Intent intent = new Intent();
- intent.putExtra("Finish_Kind", "HomeButton");
- setResult(RESULT_OK, intent);
- finish();
- }
- else if (TargetId == ID.main.button.BACK) {
- DebugLogOutput("onTouchEvent [BACK] BUTTON !!!");
- Sound().Play(SND.effect.TOUCH_LATCHED);
- /**
- *[수정필요]Back Button 필요한 화면은 아래 부분 추가 후 사용 필요
- * **/
- /*
- if(mCurrentScreenId == API_Menu.SubMenuConfig.SmartKey)
- {
- setChangeScreen(API_Menu.SubMenuConfig.Configuration, false);
- }
- */
- }
- else if (TargetId == ID.main.button.MENU) {
- DebugLogOutput("onTouchEvent [MENU] BUTTON !!!");
- Log.i(TAG, "MenuOpen = " + MenuOpen);
- Sound().Play(SND.effect.TOUCH_LATCHED);
- if (MenuOpen == true) {
- return;
- }
- OpenMenuLayout();
- }
- else if (TargetId == ID.main.button.MENUCLOSE) {
- Sound().Play(SND.effect.TOUCH_LATCHED);
- CloseMenuLayout();
- }
- else if (TargetId == ID.main.button.BOILER) {
- DebugLogOutput("onTouchEvent [BOILER] BUTTON !!!");
- if (StartPopup(ID.screen.HeatingV2PopupBoilerScreen)) {
- Sound().Play(SND.effect.TOUCH_LATCHED);
- }
- }
- else if (TargetId == ID.main.button.HIDE1 || TargetId == ID.main.button.HIDE2) {
- HideMenuEntryProc(TargetId);
- }
- else if (TargetId == ID.main.button.AIRQBACK) {
- DebugLogOutput("onTouchEvent [AIRQBACK] BUTTON !!!");
- Sound().Play(SND.effect.TOUCH_LATCHED);
- setAIRBackBtnVisible(false);
- setChangeScreen(API_Menu.SubMenuCtrl.Inner_AirQuality, false);
- }
- else if (TargetId == ID.main.button.VENTILBACK) {
- DebugLogOutput("onTouchEvent [AIRQBACK] BUTTON !!!");
- Sound().Play(SND.effect.TOUCH_LATCHED);
- setVentilBackBtnVisible(false);
- setChangeScreen(API_Menu.SubMenuCtrl.ChangAir_Normal, false);
- }
- else if (TargetId >= ID.main.button.DIMM_NORMAL && TargetId <= ID.main.button.DIMM_REST) {
- DebugLogOutput("onTouchEvent [DIMM_NORMAL] BUTTON !!!");
- try {
- // 디밍제어
- int index = TargetId - ID.main.button.DIMM_NORMAL;
- DebugLogOutput("onTouchEvent [DIM_LEV" + (index + 1) + "] BUTTON !!!");
- if (mDimData.DimData.Device[0] == null) {
- DebugLogOutput("null event");
- }
- if(mDimData.DimData.Device[0]!=null && mLevelArray!=null)
- {
- byte NowLevel = mDimData.DimData.Device[0].device.Level;
- DebugLogOutput("NowLevel :" + NowLevel);
- byte CtrlLevel = mLevelArray[index];
- DebugLogOutput("CtrlLevel :" + CtrlLevel);
- if (NowLevel == CtrlLevel) {
- TopDimmingBtn[index].setButtonRearImage(); // 켜진 상태 그대로 유지
- }
- else if (NowLevel != CtrlLevel) {
- int ret = Device_SetDimmingLevel(CtrlLevel);
- if (ret >= 0) Sound().Play(SND.effect.TOUCH_LATCHED);
- else Sound().Play(SND.effect.TOUCH_UNLATCHED);
- }
- }
- } catch (RuntimeException re) {
- Sound().Play(SND.effect.TOUCH_UNLATCHED);
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception ex) {
- Sound().Play(SND.effect.TOUCH_UNLATCHED);
- //ex.printStackTrace();
- LogUtil.errorLogInfo("", TAG, ex);
- }
- }
- else if (TargetId == ID.main.button.MANUAL) {
- Log.i(TAG, "onTouchEvent [MANUAL] BUTTON [mCurrentScreenId = " + mCurrentScreenId + "]");
- Sound().Play(SND.effect.TOUCH_LATCHED);
- if (mCurrentScreenId == API_Menu.SubMenuCtrl.HDC_LivingLamp) { StartManual(ID.MANUAL.MANUAL_HdcLivingLight); }
- else if (mCurrentScreenId == API_Menu.SubMenuCtrl.LivingLightConfig) { StartManual(ID.MANUAL.MANUAL_HdcLivingGroup); }
- else if (mCurrentScreenId == API_Menu.SubMenuCtrl.OutSide_livingLamp) { StartManual(ID.MANUAL.MANUAL_EtcLivingLight); }
- else if (mCurrentScreenId == API_Menu.SubMenuCtrl.HDCLivingNEach_Lamp) {}
- else if (mCurrentScreenId == API_Menu.SubMenuCtrl.OutSide_EachLamp) { StartManual(ID.MANUAL.MANUAL_EtcMultiLight); }
- else if (mCurrentScreenId == API_Menu.SubMenuCtrl.Heating_V2 || mCurrentScreenId == API_Menu.SubMenuCtrl.Heating_V1) { StartManual(ID.MANUAL.MANUAL_Heating); }
- else if (mCurrentScreenId == API_Menu.SubMenuCtrl.Gas) { StartManual(ID.MANUAL.MANUAL_Gas); }
- else if (mCurrentScreenId == API_Menu.SubMenuCtrl.Cooktop_Concent) { StartManual(ID.MANUAL.MANUAL_CookTopConcent); }
- else if (mCurrentScreenId == API_Menu.SubMenuCtrl.DoorLockWL) { StartManual(ID.MANUAL.MANUAL_Doorlock); }
- else if (mCurrentScreenId == API_Menu.SubMenuCtrl.DoorLock485) { StartManual(ID.MANUAL.MANUAL_Doorlock); }
- else if (mCurrentScreenId == API_Menu.SubMenuCtrl.Concent) { StartManual(ID.MANUAL.MANUAL_Concent); }
- else if (mCurrentScreenId == API_Menu.SubMenuCtrl.ChangAir_Normal) {
- if (getAirSensorAPUsage() && VentilStatus.Support.InnerCycle && VentilStatus.Support.OutAirClean) {
- if (nDistributionPanelType != Version.DISTRIBUTION_MODEL.KNX_DIST) StartManual(ID.MANUAL.MANUAL_Ventilation);
- }
- else {
- if (GetEasyModeUXUse()) StartManual(ID.MANUAL.MANUAL_Easymode_Venti);
- else {
- if (VentilStatus.Support2.WindowVenti) StartManual(ID.MANUAL.MANUAL_Venti);
- else StartManual(ID.MANUAL.MANUAL_Ventilation);
- }
- }
- }
- else if (mCurrentScreenId == API_Menu.SubMenuCtrl.Inner_AirQuality) { StartManual(ID.MANUAL.MANUAL_InAirQual); }
- else if (mCurrentScreenId == API_Menu.SubMenuCtrl.Inner_AirInfo) { /*StartManual(ID.MANUAL.MANUAL_AirInfo);*/ }
- else if (mCurrentScreenId == API_Menu.SubMenuCtrl.Electric_Range) { StartManual(ID.MANUAL.MANUAL_ElecRange); }
- }
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] onTouchEvent(View v, MotionEvent event)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /**
- * H/W Key Event
- */
- @Override
- public boolean onKeyDown(int keyCode, KeyEvent event) {
- Log.i(TAG, "[onKeyDown] keyCode : " + keyCode + ", Action : " + event.getAction());
- return super.onKeyDown(keyCode, event);
- }
- /* ================================================================================================
- * [TOP - Back] Section
- ================================================================================================ */
- /**
- * TOP 돌아가기 버튼 활성화 & 비활성화
- *
- * @param Enabled - true : 활성화, false : 비활성화
- * @return (boolean) true : 성공, false : 실패
- */
- public boolean setTopBackBtnVisible(boolean Enabled) {
- try {
- if (Enabled == true) {
- if (TopBackBtn.getVisibility() != View.VISIBLE) TopBackBtn.setVisibility(View.VISIBLE);
- TopBackBtn.bringToFront();
- }
- else {
- if (TopBackBtn.getVisibility() != View.INVISIBLE) TopBackBtn.setVisibility(View.INVISIBLE);
- }
- return true;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] setTopBackBtnVisible(boolean Enabled)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- /* ================================================================================================
- * [Popup Activity] Section
- ================================================================================================ */
- /**
- * Popup Activity 를 시작시킨다.
- *
- * @param ScreenId - 팝업시작시 Screen ID
- * @return (boolean) true : 성공, false : 실패
- */
- public boolean StartPopup(int ScreenId) {
- if (getPopupActivityRun() == true) {
- return ((WpadActivity) (PopupActivity.getContext())).ChangeScreen(ScreenId);
- }
- else {
- setPopupActivityRun(true);
- Intent intent = new Intent(mContext, PopupActivity.class);
- intent.putExtra("ScreenId", ScreenId);
- overridePendingTransition(0, 0);
- startActivityForResult(intent, 0);
- return true;
- }
- }
- /**
- * Popup Activity 를 시작시킨다. (시작시 Intent Type 데이터를 전달한다)
- *
- * @param ScreenId - 팝업시작시 Screen ID
- * @param data - 전달할 데이터
- * @return (boolean) true : 성공, false : 실패
- */
- public boolean StartPopup(int ScreenId, Intent data) {
- if (getPopupActivityRun() == true) { return false;
- }
- else {
- setPopupActivityRun(true);
- Intent intent = new Intent(mContext, PopupActivity.class);
- intent.putExtra("ScreenId", ScreenId);
- intent.putExtra("PopupScreenDataIntent", data);
- overridePendingTransition(0, 0);
- startActivityForResult(intent, 0);
- return true;
- }
- }
- /**
- * Activity Result Reception
- */
- @Override
- protected void onActivityResult(int requestCode, int resultCode, Intent data) {
- super.onActivityResult(requestCode, resultCode, data);
- try {
- Log.d(TAG, "@@@@@@@@ [onActivityResult] @@@@@@@@");
- if (resultCode == RESULT_OK) {
- // PopupActivity 에서 FinishTimer 로 인하여 종료가 되었을 경우
- // MainActivity 도 즉시 종료시킨다.
- String code = (String) data.getExtras().get("Finish_Kind");
- Log.d(TAG, "[onActivityResult] Finish_Kind : " + code);
- if (code != null) {
- if (code.equals("FinishTimer")) {
- Log.d(TAG, "FinishTimer finish");
- finish();
- }
- }
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] onActivityResult(int requestCode, int resultCode, Intent data)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /* ================================================================================================
- * [Screen] Section
- ================================================================================================ */
- /**
- * Screen 에서 Screen 변경을 요청할 경우 호출된다.<br>
- * Override 사용하여 Screen 변경을 처리한다.<br>
- *
- * @param nScreenId - 변경할 Screen ID
- * @return (boolean) true : 성공, false : 실패
- */
- @Override
- protected boolean onChangeScreen(int nScreenId) {
- super.onChangeScreen(nScreenId);
- return setChangeScreen(nScreenId, false);
- }
- /**
- * @param nScreenId - 변경할 Screen ID
- * @return (boolean) true : 성공, false : 실패
- **/
- private boolean setTitleName(int nScreenId) {
- boolean ret = false;
- try {
- Log.d(TAG, "[setTitleName] nScreenId [" + nScreenId + "]");
- switch (nScreenId) {
- case API_Menu.SubMenuCtrl.HDC_LivingLamp:
- SetTitleText(API_Menu.SubMenuCtrl.Name_Lamp);
- ret = true;
- break;
- case API_Menu.SubMenuCtrl.HDC_EachLamp:
- SetTitleText(API_Menu.SubMenuCtrl.Name_Lamp);
- ret = true;
- break;
- case API_Menu.SubMenuCtrl.LivingLightConfig:
- SetTitleText(API_Menu.SubMenuCtrl.Name_LivingLightConfig);
- ret = true;
- break;
- case API_Menu.SubMenuCtrl.OutSide_livingLamp:
- SetTitleText(API_Menu.SubMenuCtrl.Name_Lamp);
- ret = true;
- break;
- case API_Menu.SubMenuCtrl.OutSide_EachLamp:
- SetTitleText(API_Menu.SubMenuCtrl.Name_Lamp);
- ret = true;
- break;
- case API_Menu.SubMenuCtrl.HDCLivingNEach_Lamp:
- SetTitleText(API_Menu.SubMenuCtrl.Name_Lamp);
- ret = true;
- break;
- case API_Menu.SubMenuCtrl.Heating_V2:
- SetTitleText(API_Menu.SubMenuCtrl.Name_Heating);
- ret = true;
- break;
- case API_Menu.SubMenuCtrl.Gas:
- SetTitleText(API_Menu.SubMenuCtrl.Name_Gas);
- ret = true;
- break;
- case API_Menu.SubMenuCtrl.DoorLock485:
- SetTitleText(API_Menu.SubMenuCtrl.Name_DoorLock);
- ret = true;
- break;
- case API_Menu.SubMenuCtrl.DoorLockWL:
- SetTitleText(API_Menu.SubMenuCtrl.Name_DoorLock);
- ret = true;
- break;
- case API_Menu.SubMenuCtrl.ChangAir_Normal:
- case API_Menu.SubMenuCtrl.ChangAir_LH:
- case API_Menu.SubMenuCtrl.ChangAir_Hood:
- SetTitleText(API_Menu.SubMenuCtrl.Name_Venti);
- ret = true;
- break;
- case API_Menu.SubMenuCtrl.Inner_AirQuality:
- SetTitleText(API_Menu.SubMenuCtrl.Name_InnerAirQuality);
- ret = true;
- break;
- case API_Menu.SubMenuCtrl.Inner_AirInfo:
- SetTitleText(API_Menu.SubMenuCtrl.Name_InnerAirInfo);
- ret = true;
- break;
- case API_Menu.SubMenuCtrl.Concent:
- case API_Menu.SubMenuCtrl.HDCLivingNEach_Concent:
- SetTitleText(API_Menu.SubMenuCtrl.Name_Concent);
- ret = true;
- break;
- case API_Menu.SubMenuCtrl.SystemAircon:
- SetTitleText(API_Menu.SubMenuCtrl.Name_SystemAircon);
- ret = true;
- break;
- case API_Menu.SubMenuCtrl.Purity:
- SetTitleText(API_Menu.SubMenuCtrl.Name_Purity);
- ret = true;
- break;
- default:
- Log.e(TAG, "[Error] setTitleName - nScreenId Not found!!! (" + mCurrentScreenId + ")");
- //mCurrentScreenId = -1;
- SetTitleText(API_Menu.SubMenuCtrl.Name_Lamp);
- ret = false;
- break;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] setTitleName(int nScreenId)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- return ret;
- }
- /**
- * Screen 등록자<br>
- * ScreenLayout 에 현재 Screen 을 삭제하고, 새로운 Screen 을 등록시킨다.
- *
- * @param nScreenId - 변경할 Screen ID
- * @param OnlyRemove - 현재 Screen 을 삭제만 할 경우 (onDestroy 에서 사용)
- * @return (boolean) true : 성공, false : 실패
- */
- private boolean setChangeScreen(int nScreenId, boolean OnlyRemove) {
- DebugLogOutput("setChangeScreen - " + "CurrentSelectDeviceId : " + mCurrentScreenId + " / NextLayoutId : " + nScreenId + " / OnlyRemove : " + OnlyRemove);
- // 1. 현재 Layout 삭제
- if (mCurrentScreenId > 0) {
- ScreenLayout.removeAllViews();
- super.setCurrentScreen(null);
- }
- if (OnlyRemove) return true;
- mCurrentScreenId = nScreenId;
- setTopBackBtnVisible(false);
- boolean result = false;
- // 2. 새로운 Layout 표시
- try {
- setTitleName(nScreenId);
- super.setFinishTimerCreate(Common.FINISH_TIME_SEC);
- switch (nScreenId) {
- /**
- * [수정필요]
- * Back Button 필요한 화면은 setTopBackBtnVisible(true) 호출 필요
- * 추가 또는 수정해야할 부분 1. - 스크린 별 layout 생성
- * **/
- //추가 또는 수정해야할 부분 1. - 스크린 별 layout 생성
- case API_Menu.SubMenuCtrl.HDC_LivingLamp: {
- if (nDistributionPanelType == Version.DISTRIBUTION_MODEL.SMART_DIST) {
- // 스마트 분전반
- lightHdcLivMainScreen = new LightHdcLivMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(lightHdcLivMainScreen);
- setTopBoilerBtnVisible(false);
- setAIRBackBtnVisible(false);
- setKccDimmBtnVisible(false);
- setVentilBackBtnVisible(false);
- result = true;
- break;
- }
- else if (nDistributionPanelType == Version.DISTRIBUTION_MODEL.KNX_DIST) {
- // KNX 분전반
- // madeinlab 새로 만든 스크린으로 적용한다.
- lightKnxMainScreen = new LightKnxMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mRoomNameList_Light);
- super.setCurrentScreen(lightKnxMainScreen);
- setTopBoilerBtnVisible(false);
- setAIRBackBtnVisible(false);
- setKccDimmBtnVisible(false);
- setVentilBackBtnVisible(false);
- setManualBtnVisible(false, 1019);
- result = true;
- break;
- }
- }
- /*case API_Menu.SubMenuCtrl.HDC_EachLamp:
- {
- if( (SmartDistUse == 1) && (KnxDistUse == false) ) // 스마트분전반 O / KNX 분전반 X
- {
- lightHdcLivMainScreen = new LightHdcLivMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(lightHdcLivMainScreen);
- setTopBoilerBtnVisible(false);
- setAIRBackBtnVisible(false);
- setKccDimmBtnVisible(false);
- result = true;
- break;
- }
- else if( (SmartDistUse == 0) && (KnxDistUse == true) ) // 스마트분전반 X / KNX 분전반 O
- {
- lightHdcLivKnxMainScreen = new LightHdcLivKnxMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(lightHdcLivKnxMainScreen);
- setTopBoilerBtnVisible(false);
- setAIRBackBtnVisible(false);
- setKccDimmBtnVisible(false);
- result = true;
- break;
- }
- }*/
- case API_Menu.SubMenuCtrl.LivingLightConfig:
- lightHdcLivConifgScreen = new LightHdcLivConifgScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(lightHdcLivConifgScreen);
- setTopBoilerBtnVisible(false);
- setAIRBackBtnVisible(false);
- setKccDimmBtnVisible(false);
- setVentilBackBtnVisible(false);
- result = true;
- break;
- //OutSide_EachLamp
- case API_Menu.SubMenuCtrl.OutSide_EachLamp:
- SetTitleText(API_Menu.SubMenuCtrl.Name_Lamp);
- lightEtcEachMainScreen = new LightEtcEachMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mRoomNameList_Light);
- super.setCurrentScreen(lightEtcEachMainScreen);
- setTopBoilerBtnVisible(false);
- setAIRBackBtnVisible(false);
- setKccDimmBtnVisible(true);
- setVentilBackBtnVisible(false);
- result = true;
- break;
- case API_Menu.SubMenuCtrl.OutSide_livingLamp:
- SetTitleText(API_Menu.SubMenuCtrl.Name_Lamp);
- lightEtcLivMainScreen = new LightEtcLivMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(lightEtcLivMainScreen);
- setTopBoilerBtnVisible(false);
- setAIRBackBtnVisible(false);
- setKccDimmBtnVisible(true);
- setVentilBackBtnVisible(false);
- result = true;
- break;
- case API_Menu.SubMenuCtrl.HDCLivingNEach_Lamp:
- SetTitleText(API_Menu.SubMenuCtrl.Name_Lamp);
- lightHdcNEachMainScreen = new LightHdcNEachMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mRoomNameList_Light);
- super.setCurrentScreen(lightHdcNEachMainScreen);
- setTopBoilerBtnVisible(false);
- setAIRBackBtnVisible(false);
- setKccDimmBtnVisible(true);
- setVentilBackBtnVisible(false);
- result = true;
- break;
- //에너지미터 + 기본형
- case API_Menu.SubMenuCtrl.HDCLivingNEnergyMeter_Lamp:
- SetTitleText(API_Menu.SubMenuCtrl.Name_Lamp);
- lightHdcLightEnergyMeterMainScreen = new LightHdcLightEnergyMeterMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mRoomNameList_Light);
- super.setCurrentScreen(lightHdcLightEnergyMeterMainScreen);
- setTopBoilerBtnVisible(false);
- setAIRBackBtnVisible(false);
- setKccDimmBtnVisible(true);
- setVentilBackBtnVisible(false);
- result = true;
- break;
- case API_Menu.SubMenuCtrl.Heating_V1:
- case API_Menu.SubMenuCtrl.Heating_V2:
- SetTitleText(API_Menu.SubMenuCtrl.Name_Heating);
- try {
- if(wpapi.GetHeatingKind() == 1)
- {
- heatingV1MainScreen = new HeatingV1MainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mRoomNameList_Heating);
- super.setCurrentScreen(heatingV1MainScreen);
- if (OPERATION_MODE == Common.MODE_BUSINESS_SAMPLE) {
- //setTopBoilerBtnVisible(true); // 임시 강제 생성코드
- }
- }
- else
- {
- heatingV2MainScreen = new HeatingV2MainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mRoomNameList_Heating);
- super.setCurrentScreen(heatingV2MainScreen);
- if (OPERATION_MODE == Common.MODE_BUSINESS_SAMPLE) {
- //setTopBoilerBtnVisible(true); // 임시 강제 생성코드
- }
- }
- }
- catch (Exception e)
- {
- heatingV2MainScreen = new HeatingV2MainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mRoomNameList_Heating);
- super.setCurrentScreen(heatingV2MainScreen);
- if (OPERATION_MODE == Common.MODE_BUSINESS_SAMPLE) {
- //setTopBoilerBtnVisible(true); // 임시 강제 생성코드
- }
- }
- setAIRBackBtnVisible(false);
- setKccDimmBtnVisible(false);
- setVentilBackBtnVisible(false);
- result = true;
- break;
- case API_Menu.SubMenuCtrl.Gas:
- try {
- if(wpapi.GetGasKind() == 1)
- {
- SetTitleText(API_Menu.SubMenuCtrl.Name_Gas);
- gasMainScreen = new GasMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(gasMainScreen);
- }
- else if(wpapi.GetGasKind() == 2)
- {
- SetTitleText(API_Menu.SubMenuCtrl.Name_Gas);
- hybridCookTopMainScreen = new HybridCookTopMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(hybridCookTopMainScreen);
- }
- else
- {
- SetTitleText(API_Menu.SubMenuCtrl.Name_Gas);
- gasMainScreen = new GasMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(gasMainScreen);
- }
- }
- catch (Exception e)
- {
- // SetTitleText(API_Menu.SubMenuCtrl.Name_Gas);
- // gasMainScreen = new GasMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
- // super.setCurrentScreen(gasMainScreen);
- }
- // SetTitleText(API_Menu.SubMenuCtrl.Name_Gas);
- // gasMainScreen = new GasMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
- // super.setCurrentScreen(gasMainScreen);
- setTopBoilerBtnVisible(false);
- setAIRBackBtnVisible(false);
- setKccDimmBtnVisible(false);
- setVentilBackBtnVisible(false);
- result = true;
- break;
- case API_Menu.SubMenuCtrl.DoorLock485:
- SetTitleText(API_Menu.SubMenuCtrl.Name_DoorLock);
- doorLockMainScreen = new DoorLockMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, API_Menu.SubMenuCtrl.DoorLock485);
- super.setCurrentScreen(doorLockMainScreen);
- setTopBoilerBtnVisible(false);
- setAIRBackBtnVisible(false);
- setKccDimmBtnVisible(false);
- result = true;
- break;
- case API_Menu.SubMenuCtrl.DoorLockWL:
- SetTitleText(API_Menu.SubMenuCtrl.Name_DoorLock);
- doorLockMainScreen = new DoorLockMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, API_Menu.SubMenuCtrl.DoorLockWL);
- super.setCurrentScreen(doorLockMainScreen);
- setTopBoilerBtnVisible(false);
- setAIRBackBtnVisible(false);
- setKccDimmBtnVisible(false);
- result = true;
- break;
- case API_Menu.SubMenuCtrl.ChangAir_Normal:
- case API_Menu.SubMenuCtrl.ChangAir_LH:
- case API_Menu.SubMenuCtrl.ChangAir_Hood:
- if(isUseModelHouse_Venti)
- {
- SetTitleText(API_Menu.SubMenuCtrl.Name_Venti);
- ventilationModelMainScreen = new VentilationModelMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, nScreenId);
- super.setFinishTimerDestroy();
- super.setCurrentScreen(ventilationModelMainScreen);
- setTopBoilerBtnVisible(false);
- setAIRBackBtnVisible(false);
- setKccDimmBtnVisible(false);
- setVentilBackBtnVisible(false);
- result = true;
- }
- else
- {
- Log.e(TAG, "[setChangeScreen] getAirSensorAPUsage [" + getAirSensorAPUsage() + "], Support.InnerCycle [" + VentilStatus.Support.InnerCycle + "], Support.OutAirClean [" + VentilStatus.Support.OutAirClean + "]");
- if (getAirSensorAPUsage() && VentilStatus.Support.InnerCycle && VentilStatus.Support.OutAirClean) {
- if(isUseModelHouse_Venti)
- {
- ventilationModelMainScreen = new VentilationModelMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, nScreenId);
- super.setCurrentScreen(ventilationModelMainScreen);
- super.setFinishTimerDestroy();
- }
- else
- {
- if (nDistributionPanelType == Version.DISTRIBUTION_MODEL.KNX_DIST) {
- //고급향은 환기가 3개임. KNX 쪽으로 우선 분기를 태움.
- SetTitleText(API_Menu.SubMenuCtrl.Name_Venti);
- knxVentiMainScreen = new KnxVentiMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, nScreenId);
- super.setCurrentScreen(knxVentiMainScreen);
- }
- else {
- SetTitleText(API_Menu.SubMenuCtrl.Name_Venti);
- ventilationMainScreen = new VentilationMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, nScreenId);
- super.setCurrentScreen(ventilationMainScreen);
- }
- }
- setTopBoilerBtnVisible(false);
- setAIRBackBtnVisible(false);
- setKccDimmBtnVisible(false);
- setVentilBackBtnVisible(false);
- result = true;
- }
- else {
- if (GetEasyModeUXUse() == true) {
- SetTitleText(API_Menu.SubMenuCtrl.Name_Venti);
- ventiEasymodeScreen = new VentiEasymodeScreen(this, ScreenLayout, wpapi, OPERATION_MODE, nScreenId);
- super.setCurrentScreen(ventiEasymodeScreen);;
- setTopBoilerBtnVisible(false);
- setAIRBackBtnVisible(false);
- setKccDimmBtnVisible(false);
- setVentilBackBtnVisible(false);
- result = true;
- }
- else {
- if (VentilStatus.Support2.WindowVenti) {
- SetTitleText(API_Menu.SubMenuCtrl.Name_Venti);
- ventiMainScreen = new VentiMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, nScreenId);
- super.setCurrentScreen(ventiMainScreen);
- }
- else {
- if (nDistributionPanelType == Version.DISTRIBUTION_MODEL.KNX_DIST) {
- SetTitleText(API_Menu.SubMenuCtrl.Name_Venti);
- knxVentiMainScreen = new KnxVentiMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, nScreenId);
- super.setCurrentScreen(knxVentiMainScreen);
- setManualBtnVisible(false, 1019);
- }
- else {
- SetTitleText(API_Menu.SubMenuCtrl.Name_Venti);
- ventilationMainScreen = new VentilationMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, nScreenId);
- super.setCurrentScreen(ventilationMainScreen);
- // SetTitleText(API_Menu.SubMenuCtrl.Name_Venti);
- // ventiMainScreen = new VentiMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, API_Menu.SubMenuCtrl.ChangAir_Normal);
- // super.setCurrentScreen(ventiMainScreen);
- }
- }
- setTopBoilerBtnVisible(false);
- setAIRBackBtnVisible(false);
- setKccDimmBtnVisible(false);
- setVentilBackBtnVisible(false);
- result = true;
- }
- }
- }
- break;
- case API_Menu.SubMenuCtrl.Inner_AirQuality:
- SetTitleText(API_Menu.SubMenuCtrl.Name_InnerAirQuality);
- airQualityMainScreen = new AirQualityMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(airQualityMainScreen);
- setTopBoilerBtnVisible(false);
- setAIRBackBtnVisible(false);
- setKccDimmBtnVisible(false);
- setVentilBackBtnVisible(false);
- result = true;
- break;
- case API_Menu.SubMenuCtrl.Inner_AirInfo:
- SetTitleText(API_Menu.SubMenuCtrl.Name_InnerAirInfo);
- dustInfoScreen = new DustInfoScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(dustInfoScreen);
- setTopBoilerBtnVisible(false);
- setAIRBackBtnVisible(false);
- setKccDimmBtnVisible(false);
- setVentilBackBtnVisible(false);
- result = true;
- break;
- case API_Menu.SubMenuCtrl.Concent:
- if (nDistributionPanelType == Version.DISTRIBUTION_MODEL.KNX_DIST) {
- SetTitleText(API_Menu.SubMenuCtrl.Name_Concent);
- concentKnxMainScreen = new ConcentKnxMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mRoomNameList_Light);
- super.setCurrentScreen(concentKnxMainScreen);
- setManualBtnVisible(false, 1019);
- }
- else
- {
- SetTitleText(API_Menu.SubMenuCtrl.Name_Concent);
- concentMainScreen = new ConcentMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mDefaultRoomNameList_Light);
- super.setCurrentScreen(concentMainScreen);
- setManualBtnVisible(getManualUse(), 1019);
- }
- setTopBoilerBtnVisible(false);
- setAIRBackBtnVisible(false);
- setKccDimmBtnVisible(false);
- setVentilBackBtnVisible(false);
- result = true;
- break;
- case API_Menu.SubMenuCtrl.HDCLivingNEach_Concent:
- SetTitleText(API_Menu.SubMenuCtrl.Name_Concent);
- //여기서 에너지 미터 사용 여부 체크해서 사용하면 에너지 미터 화면을 가져다가 사용하도록 함
- if(nEnergyProductionUse == WallpadDeviceSet.DO_USE)
- {
- concentEnergyMeterScreen = new ConcentEnergyMeterScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mDefaultRoomNameList_Light);
- super.setCurrentScreen(concentEnergyMeterScreen);
- }
- else
- {
- concentHdcNEachMainScreen = new ConcentHdcNEachMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mRoomNameList_Light);
- super.setCurrentScreen(concentHdcNEachMainScreen);
- }
- setTopBoilerBtnVisible(false);
- setAIRBackBtnVisible(false);
- setKccDimmBtnVisible(false);
- setVentilBackBtnVisible(false);
- setManualBtnVisible(false, 1019);
- result = true;
- break;
- case API_Menu.SubMenuCtrl.Electric_Range:
- SetTitleText(API_Menu.SubMenuCtrl.Name_ElectricRange);
- electricRangeMainScreen = new ElectricRangeMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(electricRangeMainScreen);
- setTopBoilerBtnVisible(false);
- setAIRBackBtnVisible(false);
- setKccDimmBtnVisible(false);
- setVentilBackBtnVisible(false);
- result = true;
- break;
- case API_Menu.SubMenuCtrl.Cooktop_Concent:
- SetTitleText(API_Menu.SubMenuCtrl.Name_CooktopConcent);
- cookTopConcentMainScreen = new CookTopConcentMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(cookTopConcentMainScreen);
- setTopBoilerBtnVisible(false);
- setAIRBackBtnVisible(false);
- setKccDimmBtnVisible(false);
- setVentilBackBtnVisible(false);
- result = true;
- break;
- case API_Menu.SubMenuCtrl.SystemAircon:
- SetTitleText(API_Menu.SubMenuCtrl.Name_SystemAircon);
- systemAirconMainScreen = new SystemAirconMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mDefaultRoomNameList);
- super.setCurrentScreen(systemAirconMainScreen);
- setTopBoilerBtnVisible(false);
- setAIRBackBtnVisible(false);
- setKccDimmBtnVisible(false);
- setVentilBackBtnVisible(false);
- setManualBtnVisible(false, 1019);
- result = true;
- break;
- case API_Menu.SubMenuCtrl.Purity:
- SetTitleText(API_Menu.SubMenuCtrl.Name_Purity);
- purityMainScreen = new PurityMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mDefaultRoomNameList);
- super.setCurrentScreen(purityMainScreen);
- setTopBoilerBtnVisible(false);
- setAIRBackBtnVisible(false);
- setKccDimmBtnVisible(false);
- setVentilBackBtnVisible(false);
- result = true;
- break;
- case API_Menu.SubMenuCtrl.Curtain:
- SetTitleText(API_Menu.SubMenuCtrl.Name_Curtain);
- curTainV1MainScreen = new CurTainV1MainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(curTainV1MainScreen);
- setTopBoilerBtnVisible(false);
- setAIRBackBtnVisible(false);
- setKccDimmBtnVisible(false);
- setVentilBackBtnVisible(false);
- result = true;
- break;
- default:
- Log.i(TAG, "[Error] setChangeScreen - nScreenId Not found!!! (" + mCurrentScreenId + ")");
- if (Version.getGatewayUsage()) {
- // 게이트웨이 사용
- SetTitleText(API_Menu.SubMenuCtrl.Name_Lamp);
- lightHdcLivMainScreen = new LightHdcLivMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
- super.setCurrentScreen(lightHdcLivMainScreen);
- setTopBoilerBtnVisible(false);
- setAIRBackBtnVisible(false);
- setKccDimmBtnVisible(false);
- setVentilBackBtnVisible(false);
- }
- else {
- // 게이트웨이 미사용
- SetTitleText(API_Menu.SubMenuCtrl.Name_Lamp);
- lightEtcEachMainScreen = new LightEtcEachMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, mRoomNameList_Light);
- super.setCurrentScreen(lightEtcEachMainScreen);
- setTopBoilerBtnVisible(false);
- setAIRBackBtnVisible(false);
- setKccDimmBtnVisible(true);
- setVentilBackBtnVisible(false);
- }
- result = false;
- break;
- //mCurrentScreenId = -1;
- //return false;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] setChangeScreen(int nScreenId, boolean OnlyRemove)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- return result;
- }
- /**
- * 상단 타이틀 텍스트 수정
- *
- * @param SetText (String) 수정할 타이틀 이름
- **/
- private void SetTitleText(String SetText) {
- if (SetText != null) {
- TopTitle.setText(SetText);
- }
- }
- /* ================================================================================================
- * [Menu Layout] Section
- ================================================================================================ */
- /**
- * 메뉴 레이아웃 생성
- **/
- private void OpenMenuLayout() {
- Log.i(TAG, "Enter OpenMenuLayout !!!");
- if (MenuOpen == true) {
- Log.e(TAG, "[OpenMenuLayout] MenuOpen");
- return;
- }
- if (menueListDataClass == null) {
- Log.e(TAG, "[OpenMenuLayout] menueListDataClass is null");
- return;
- }
- //0. 현재 ID 및 리스트 불러오기
- String Title = API_Menu.GetGroupNameByID((mCurrentScreenId / 1000) * 1000);
- String TempChildName = null;
- int ChooseGroup = 0;
- int ChooseChild = 0;
- for (int i = 0; i < menueListDataClass.arrayGroup.size(); i++) {
- if (menueListDataClass.arrayGroup.get(i).equals(Title)) {
- ChooseGroup = i;
- break;
- }
- }
- Log.i(TAG, "[OpenMenuLayout] - ChooseGroup = " + ChooseGroup);
- for (int i = 0; i < menueListDataClass.idMappingTable.length; i++) {
- if (menueListDataClass.idMappingTable[i].Id == mCurrentScreenId) {
- TempChildName = menueListDataClass.idMappingTable[i].Name;
- break;
- }
- //도어락 화면은 공용으로 사용하기 때문에 1042화면을 사용하나, 도어락 타입을 나누어야 하기 때문에
- else if (menueListDataClass.idMappingTable[i].Id == API_Menu.SubMenuCtrl.DoorLock485) {
- TempChildName = menueListDataClass.idMappingTable[i].Name;
- break;
- }
- }
- Log.i(TAG, "[OpenMenuLayout] - TempChildName = " + TempChildName);
- if (TempChildName == null) {
- Log.e(TAG, "TempChildName is null");
- return;
- }
- for (int i = 0; i < menueListDataClass.arrayChild.get(Title).size(); i++) {
- if (menueListDataClass.arrayChild.get(Title).get(i).equals(TempChildName) == true) {
- ChooseChild = i;
- break;
- }
- }
- //1. 기존 화면 투명도 변경
- TopLayout.setAlpha(0.5f);
- ScreenLayout.setAlpha(0.5f);
- //2. Layout 생성 및 처리 이벤트 등록
- MenuLayout = new RelativeLayout(this);
- WpadUtil.LayoutRegistration(AllLayout, MenuLayout, 1280, 800, 0, 0, ID.main.layout.MENU);
- MenuLayout.setOnTouchListener(new OnTouchListener() {
- @Override
- public boolean onTouch(View v, MotionEvent event) {
- if (event.getAction() == MotionEvent.ACTION_UP) {
- setFinishTimerReset();
- CloseMenuLayout();
- }
- return true;
- }
- });
- //3. 배경 이미지 생성 및 에니메이션 등록
- MenuBackground = new WpadImageView(this, TOUCH_KIND.BUTTON, 460, 800, R.drawable.bg_menu, R.drawable.bg_menu, ID.main.image.TAB_BACKGROUND);
- TranslateAnimation anim = new TranslateAnimation(WpadScale.getWidth(-460), 0, 0, 0);
- anim.setDuration(200);
- anim.setInterpolator(new AccelerateInterpolator());
- MenuLayout.setAnimation(anim);
- ViewRegistration(MenuLayout, MenuBackground, 0, 0);
- //4. 타이틀 등록
- MenuTitle = new WpadTextView(this, false, 247, 80, Gravity.LEFT, Color.WHITE, Common.fontsize._44, true, ID.main.text.TITLE);
- ViewRegistration(MenuLayout, MenuTitle, 133, 15);
- MenuTitle.setText(Title);
- //5. 종료 버튼 등록
- MenuClose = new WpadImageView(this, TOUCH_KIND.BUTTON, 80, 80, R.drawable.topbar_icon_close_normal, R.drawable.topbar_icon_close_pressed, ID.main.button.MENUCLOSE);
- MenuClose.setTouchDelayMs(1000);
- ViewRegistration(MenuLayout, MenuClose, 380, 15);
- //6. 리스트뷰 초기화 및 등록
- mListView = new ExpandableListView(this);
- ExpandableListView.LayoutParams params = new ExpandableListView.LayoutParams(WpadScale.getWidth(460), WpadScale.getHeight(690));
- mListView.setLayoutParams(params);
- mListView.setX(WpadScale.getWidth(0));
- mListView.setY(WpadScale.getHeight(112));
- mListView.setBackgroundColor(Color.BLACK);
- mListView.setId(ID.main.liveview.lv);
- mListView.setGroupIndicator(null);
- mListView.setDividerHeight(0);
- mListView.setDivider(null);
- mListView.setFocusable(true);
- mListView.setSmoothScrollbarEnabled(true);
- mListView.setTranscriptMode(android.widget.AbsListView.TRANSCRIPT_MODE_DISABLED);
- mListView.setScrollbarFadingEnabled(true);
- MenuLayout.addView(mListView);
- adptMain = new Menu_AdptMain(this, menueListDataClass.arrayGroup, menueListDataClass.arrayChild, ChooseGroup, ChooseChild);
- mListView.setAdapter(adptMain);
- //7. 선택된 그룹 열기
- mListView.setSelectedGroup(ChooseGroup);
- mListView.expandGroup(ChooseGroup);
- // 8. 리스트뷰 터치 이벤트 등록
- mListView.setOnTouchListener(new OnTouchListener() {
- @Override
- public boolean onTouch(View v, MotionEvent event) {
- if ((event.getAction() == MotionEvent.ACTION_DOWN) ||
- (event.getAction() == MotionEvent.ACTION_UP)) {
- WpadActivity.setFinishTimerReset();
- }
- return false;
- }
- });
- // 9. 그룹 터치 이벤트 등록
- mListView.setOnGroupClickListener(new OnGroupClickListener() {
- @Override
- public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
- DebugLogOutput("group click = " + groupPosition);
- WpadActivity.setFinishTimerReset();
- return false;
- }
- });
- // 10. 차일드 터치 이벤트 등록
- /*
- mListView.setOnChildClickListener(new OnChildClickListener()
- {
- @Override
- public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id)
- {
- DebugLogOutput("onChildClick");
- DebugLogOutput("groupPosition = " + groupPosition);
- DebugLogOutput("childPosition = " + childPosition);
- WpadActivity.setFinishTimerReset();
- return false;
- }
- });
- */
- // 11. 그룹 열리는 경우 이벤트
- mListView.setOnGroupExpandListener(new OnGroupExpandListener() {
- @Override
- public void onGroupExpand(int groupPosition) {
- DebugLogOutput("groupPosition Open Event = " + groupPosition);
- Sound().Play(SND.effect.TOUCH_LATCHED);
- WpadActivity.setFinishTimerReset();
- }
- });
- // 12. 그룹 닫히는 경우 이벤트
- mListView.setOnGroupCollapseListener(new OnGroupCollapseListener() {
- @Override
- public void onGroupCollapse(int groupPosition) {
- DebugLogOutput("groupPosition Close Event = " + groupPosition);
- Sound().Play(SND.effect.TOUCH_LATCHED);
- WpadActivity.setFinishTimerReset();
- }
- });
- // 13. MenuOpen True 설정
- MenuOpen = true;
- }
- /**
- * 메뉴 layout 닫힘 처리
- **/
- private void CloseMenuLayout() {
- if (MenuOpen == false) {
- return;
- }
- TranslateAnimation anim = new TranslateAnimation(0, WpadScale.getWidth(-460), 0, 0);
- anim.setDuration(200);
- anim.setInterpolator(new AccelerateInterpolator());
- anim.setAnimationListener(new AnimationListener() {
- @Override
- public void onAnimationStart(Animation animation) {
- MenuOpen = false;
- }
- @Override
- public void onAnimationRepeat(Animation animation) {
- }
- @Override
- public void onAnimationEnd(Animation animation) {
- AllLayout.removeView(MenuLayout);
- TopLayout.setAlpha(1.0f);
- ScreenLayout.setAlpha(1.0f);
- }
- });
- MenuLayout.startAnimation(anim);
- }
- /**
- * 메뉴 그룹 터치시 처리 (Menu_AdptMain에서 호출)
- **/
- public static void SetListViewGroupExpand_Collapse(int GroupID, boolean ExpandEnable) {
- if (ExpandEnable) {
- mListView.expandGroup(GroupID);
- }
- else {
- mListView.collapseGroup(GroupID);
- }
- }
- /**
- * Menu정보가 DB에 없을 경우 불러올 스크린 로딩
- *
- * @return MenuListDataClass 타입의 초기정보
- **/
- private MenuListDataClass loadDefaultMenuList() {
- try {
- MenuListDataClass tempMenuListDataClass = new MenuListDataClass();
- tempMenuListDataClass.SetArrayGroup(API_Menu.SubMenuCtrl.Name);
- ArrayList<String> arrayList = new ArrayList<String>();
- WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(getApplicationContext());
- int nAirQualitySensorUsage = mWallpadDeviceSet.GetDeviceSetted("센서AP");
- int[] nLightType = mWallpadDeviceSet.Get_Light_info();
- int[] nDoorlockType = mWallpadDeviceSet.Get_DoorLock_Info();
- int[] nVentilType = mWallpadDeviceSet.Get_Ventil_Info();
- boolean bShadingEnable = mWallpadDeviceSet.Get_Shading_Use();
- int nHeatingUsage = mWallpadDeviceSet.Get_Temper_Info();
- int nGasValveUsage = mWallpadDeviceSet.Get_GAS_Info();
- boolean bElecCooktopUsage = mWallpadDeviceSet.Get_ElectricRange_Use();
- boolean bCooktopOutletUsage = mWallpadDeviceSet.Get_CookTopConcent_Use();
- int nSystemAirconUsage = mWallpadDeviceSet.Get_AirCON_Info();
- int nPurityUsage = mWallpadDeviceSet.Get_Purity_Info();
- // 여기서 서브 월패드
- boolean isSubWallPadUse = mWallpadDeviceSet.GetSubWpdUse();
- // 서브 월패드 조명 타입 정보 가져오기
- int[] naSubWallPadLightType = mWallpadDeviceSet.GetSubWpdDirect_Light();
- mWallpadDeviceSet.closeDB();
- WallpadStatusData mWallpadStatusData = new WallpadStatusData(getContext());
- boolean bElecOutletUsage = mWallpadStatusData.Get_MultiSwitch_Concent_Use();
- mWallpadStatusData.closeDB();
- int nChildCnt = 0;
- if(isSubWallPadUse)
- {
- if(naSubWallPadLightType!=null && naSubWallPadLightType.length == 2 && naSubWallPadLightType[1] == WallpadDeviceSet.SUBWPD_CTR_DIRECT )
- {
- if (nLightType[0] == WallpadDeviceSet.DO_USE) {
- arrayList.add(API_Menu.SubMenuCtrl.Name_Lamp);
- nChildCnt++;
- }
- }
- }
- else
- {
- //[수정필요]
- //추가 또는 수정해야할 부분 1. - Menu정보가 DB에 없을 경우 불러올 스크린 종류(시작)
- if (nLightType[0] == WallpadDeviceSet.DO_USE) {
- arrayList.add(API_Menu.SubMenuCtrl.Name_Lamp);
- nChildCnt++;
- }
- if (nLightType[1] == WallpadDeviceSet.LIGHT_TYPE_ROOM) {
- Log.i(TAG, "bElecOutletUsage = " + bElecOutletUsage + " @@@@@@@@@@@@@@@@");
- Log.i(TAG, "MultiConcentExist = " + bMultiConcentExist + " @@@@@@@@@@@@@@@@");
- if ((OPERATION_MODE == Common.MODE_BUSINESS_SAMPLE) || (nLightType[0] == 1 && bElecOutletUsage && bMultiConcentExist)) {
- arrayList.add(API_Menu.SubMenuCtrl.Name_Concent);
- nChildCnt++;
- }
- }
- if (nHeatingUsage == WallpadDeviceSet.DO_USE) {
- arrayList.add(API_Menu.SubMenuCtrl.Name_Heating);
- nChildCnt++;
- }
- if (nGasValveUsage == WallpadDeviceSet.DO_USE) {
- arrayList.add(API_Menu.SubMenuCtrl.Name_Gas);
- nChildCnt++;
- }
- if (bCooktopOutletUsage) {
- // 쿡탑콘센트
- arrayList.add(API_Menu.SubMenuCtrl.Name_CooktopConcent);
- nChildCnt++;
- Log.i(TAG, "cooktopConcentUse = " + bCooktopOutletUsage + " @@@@@@@@@@@@@@@@");
- Log.i(TAG, "Name_CooktopConcent Added ~~~ " + " @@@@@@@@@@@@@@@@");
- }
- if (bElecCooktopUsage) {
- arrayList.add(API_Menu.SubMenuCtrl.Name_ElectricRange);
- nChildCnt++;
- }
- if (nDoorlockType[0] == WallpadDeviceSet.DO_USE) {
- arrayList.add(API_Menu.SubMenuCtrl.Name_DoorLock);
- nChildCnt++;
- }
- if (nVentilType[0] == WallpadDeviceSet.DO_USE) {
- arrayList.add(API_Menu.SubMenuCtrl.Name_Venti);
- nChildCnt++;
- }
- if (bShadingEnable) {
- //전동커튼
- arrayList.add(API_Menu.SubMenuCtrl.Name_Curtain);
- nChildCnt++;
- }
- if (nSystemAirconUsage != WallpadDeviceSet.SYSTEMAIRCON_NONE) {
- arrayList.add(API_Menu.SubMenuCtrl.Name_SystemAircon);
- nChildCnt++;
- }
- if (Version.getModelType() == Version.MODEL_TYPE.IHN_D101 || Version.getModelType() == Version.MODEL_TYPE.IHN_D101_I
- || Version.getModelType() == Version.MODEL_TYPE.IHN_D101K || Version.getModelType() == Version.MODEL_TYPE.IHN_D101K_I
- || Version.getModelType() == Version.MODEL_TYPE.IHN_D101_I_OCF)
- {
- if (!bKitchenLightonLivingEM &&(nDistributionPanelType != Version.DISTRIBUTION_MODEL.KNX_DIST)) {
- // knx분전반은 거실조명 그룹설정 메뉴에서 빠짐
- arrayList.add(API_Menu.SubMenuCtrl.Name_LivingLightConfig);
- nChildCnt++;
- }
- if (nDistributionPanelType == Version.DISTRIBUTION_MODEL.KNX_DIST) {
- arrayList.add(API_Menu.SubMenuCtrl.Name_Concent);
- nChildCnt++;
- }
- if (nPurityUsage == WallpadDeviceSet.DO_USE) {
- arrayList.add(API_Menu.SubMenuCtrl.Name_Purity);
- nChildCnt++;
- }
- }
- if (nAirQualitySensorUsage == WallpadDeviceSet.DEV_DATA_ENABLE) {
- arrayList.add(API_Menu.SubMenuCtrl.Name_InnerAirQuality);
- nChildCnt++;
- arrayList.add(API_Menu.SubMenuCtrl.Name_InnerAirInfo);
- nChildCnt++;
- }
- }
- //추가 또는 수정해야할 부분 1. - Menu정보가 DB에 없을 경우 불러올 스크린 종류(끝)
- Log.i(TAG, "childCount = " + nChildCnt);
- tempMenuListDataClass.SetArrayChild(API_Menu.SubMenuCtrl.Name, arrayList);
- tempMenuListDataClass.idMappingTable = new ChildIDMapping[nChildCnt];
- for (int i = 0; i < nChildCnt; i++) {
- tempMenuListDataClass.idMappingTable[i] = new ChildIDMapping();
- //[수정필요]
- //추가 또는 수정해야할 부분 2. - 불러올 스크린의 ID를 임의로 입력(시작)
- if (arrayList.get(i).equals(API_Menu.SubMenuCtrl.Name_Lamp)) {
- if (Version.getGatewayUsage()) {
- if (Version.getModelType() == Version.MODEL_TYPE.IHN_1010GL || Version.getModelType() == Version.MODEL_TYPE.IHN_1010GL_I
- || Version.getModelType() == Version.MODEL_TYPE.IHN_1010GL_I_2443|| Version.getModelType() == Version.MODEL_TYPE.IHN_1010GL_I_6410) {
- //여기서 분리
- //기본형
- if(naLightEnable[1] == WallpadDeviceSet.LIGHT_TYPE_HDC_INTLIGHT_ADD_BATCHLIGHT_MULTISWITCH)
- {
- //기본형 + 에너지미터
- tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.HDCLivingNEnergyMeter_Lamp;
- }
- else
- {
- //기본형
- tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.HDCLivingNEach_Lamp;
- }
- tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_Lamp;
- }
- else {
- if (nDistributionPanelType == Version.DISTRIBUTION_MODEL.SMART_DIST) {
- // 스마트 분전반
- tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.HDC_LivingLamp;
- tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_Lamp;
- }
- else if (nDistributionPanelType == Version.DISTRIBUTION_MODEL.KNX_DIST) {
- // KNX 분전반
- tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.HDC_LivingLamp;
- tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_Lamp;
- }
- else {
- tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.HDC_LivingLamp;
- tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_Lamp;
- }
- }
- }
- else {
- if (nLightType[1] == WallpadDeviceSet.LIGHT_TYPE_LIVING) {
- tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.OutSide_livingLamp;
- tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_Lamp;
- }
- else if (nLightType[1] == WallpadDeviceSet.LIGHT_TYPE_ROOM) {
- tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.OutSide_EachLamp;
- tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_Lamp;
- }
- }
- }
- else if (arrayList.get(i).equals(API_Menu.SubMenuCtrl.Name_Concent)) {
- if (nLightType[1] == WallpadDeviceSet.LIGHT_TYPE_ROOM) {
- if ((OPERATION_MODE == Common.MODE_BUSINESS_SAMPLE) || (bElecOutletUsage && bMultiConcentExist)) {
- tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.Concent;
- tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_Concent;
- }
- }
- else if (nDistributionPanelType == Version.DISTRIBUTION_MODEL.KNX_DIST) {
- tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.Concent;
- tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_Concent;
- }
- }
- else if (arrayList.get(i).equals(API_Menu.SubMenuCtrl.Name_Gas)) {
- tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.Gas;
- tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_Gas;
- }
- else if (arrayList.get(i).equals(API_Menu.SubMenuCtrl.Name_CooktopConcent)) {
- tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.Cooktop_Concent;
- tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_CooktopConcent;
- }
- else if (arrayList.get(i).equals(API_Menu.SubMenuCtrl.Name_DoorLock)) {
- if (nDoorlockType[1] == DOORLOCK_TYPE_NORMAL) {
- tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.DoorLock485;
- tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_DoorLock;
- }
- else if (nDoorlockType[1] == DOORLOCK_TYPE_RF) {
- tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.DoorLockWL;
- tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_DoorLock;
- }
- else if (nDoorlockType[1] == DOORLOCK_TYPE_FINGERPRINT) {
- tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.DoorLockWL;
- tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_DoorLock;
- }
- }
- else if (arrayList.get(i).equals(API_Menu.SubMenuCtrl.Name_Venti)) {
- Log.d(TAG, "[loadDefaultMenuList] nVentilType[1] = " + nVentilType[1]);
- if (nVentilType[1] == WallpadDeviceSet.VENTIL_TYPE_NORMAL) {
- tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.ChangAir_Normal;
- tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_Venti;
- }
- else if (nVentilType[1] == WallpadDeviceSet.VENTIL_TYPE_LH) {
- tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.ChangAir_LH;
- tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_Venti;
- }
- else if (nVentilType[1] == WallpadDeviceSet.VENTIL_TYPE_HOOD) {
- tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.ChangAir_Hood;
- tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_Venti;
- }
- }
- else if (arrayList.get(i).equals(API_Menu.SubMenuCtrl.Name_Heating)) {
- tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.Heating_V2;
- tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_Heating;
- }
- /*
- //확인 필요
- else if (arrayList.get(i).equals(API_Menu.SubMenuCtrl.Name_Heating)) {
- tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.Heating_V1;
- tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_Heating;
- }
- */
- else if (arrayList.get(i).equals(API_Menu.SubMenuCtrl.Name_Curtain)) {
- tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.Curtain;
- tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_Curtain;
- }
- else if (arrayList.get(i).equals(API_Menu.SubMenuCtrl.Name_InnerAirQuality)) {
- tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.Inner_AirQuality;
- tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_InnerAirQuality;
- }
- else if (arrayList.get(i).equals(API_Menu.SubMenuCtrl.Name_InnerAirInfo)) {
- tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.Inner_AirInfo;
- tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_InnerAirInfo;
- }
- else if (arrayList.get(i).equals(API_Menu.SubMenuCtrl.Name_ElectricRange)) {
- tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.Electric_Range;
- tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_ElectricRange;
- }
- else if (arrayList.get(i).equals(API_Menu.SubMenuCtrl.Name_SystemAircon)) {
- tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.SystemAircon;
- tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_SystemAircon;
- }
- else if (arrayList.get(i).equals(API_Menu.SubMenuCtrl.Name_LivingLightConfig)) {
- tempMenuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCtrl.LivingLightConfig;
- tempMenuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCtrl.Name_LivingLightConfig;
- }
- else {
- Log.w(TAG, "[loadDefaultMenuList] arrayList.get(" + i + ") is not supported menu!!");
- }
- //추가 또는 수정해야할 부분 2. - 불러올 스크린의 ID를 임의로 입력(끝)
- }
- return tempMenuListDataClass;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return null;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] loadDefaultMenuList()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return null;
- }
- }
- /**
- * Menu Event intent filter 등록
- **/
- private void reg_Receiver() {
- try {
- IntentFilter filter = new IntentFilter();
- filter.addAction("MENU_EVENT");
- registerReceiver(mWallPadAlertBR, filter);
- filter = new IntentFilter();
- filter.addAction(define.NOTIFY_DAIL);
- filter.addAction("WALLPAD_DIAL_GLOBALSCREEN_TOUCH");
- registerReceiver(mWallPadJogBR, filter);
- filter = new IntentFilter();
- filter.addAction(ID.main.BR_KCC_DIM);
- registerReceiver(mKccDimmBR, filter);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] reg_Receiver()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /**
- * 조그버튼 입력 받을 시 처리
- **/
- BroadcastReceiver mWallPadJogBR = new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- WpadActivity.setFinishTimerReset();
- }
- };
- /**
- * KCC디밍조절기 BR 등록
- **/
- BroadcastReceiver mKccDimmBR = new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- WpadActivity.setFinishTimerReset();
- DebugLogOutput("[mKccDimmBR] - onReceive - mKccDimmBR");
- Device_Update_Dimming(false, (byte)0);
- Draw_Update_DimmBtn();
- }
- };
- /**
- * 메뉴에서 버튼 터치 처리
- **/
- BroadcastReceiver mWallPadAlertBR = new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- int groupPosition = intent.getIntExtra("groupPosition", -1);
- int childPosition = intent.getIntExtra("childPosition", -1);
- Log.i(TAG, "[mWallPadAlertBR] groupPosition :" + groupPosition + ", childPosition :" + childPosition);
- if ((groupPosition >= 0) && (childPosition >= 0)) {
- if (MenuOpen == true) {
- Sound().Play(SND.effect.TOUCH_LATCHED);
- CloseMenuLayout();
- if (menueListDataClass == null) {
- return;
- }
- String childName = menueListDataClass.arrayChild.get(menueListDataClass.arrayGroup.get(groupPosition)).get(childPosition);
- for (int i = 0; i < menueListDataClass.idMappingTable.length; i++) {
- if (menueListDataClass.idMappingTable[i].Name.equals(childName)) {
- API_Menu api_Menu = new API_Menu();
- int TempID = api_Menu.GetMyGroupID(getApplicationContext().getPackageName());
- int ChildID = menueListDataClass.idMappingTable[i].Id;
- int ChildGroupID = (ChildID / 1000) * 1000;
- Log.i(TAG, "[mWallPadAlertBR] Child ID :" + ChildID);
- if (TempID == 0) {
- return;
- }
- if (ChildGroupID == TempID) {
- //해당 APP내에서 스크린 전환 필요
- //[수정필요]
- if (OPERATION_MODE == Common.MODE_NOMAL) {
- mTempCurrentScreenId = ChildID;
- mWallPadApiCheckHandler.sendEmptyMessage(0);
- }
- else {
- boolean result = setChangeScreen(ChildID, false);
- if (result == false) {
- setChangeScreen(API_Menu.SubMenuCtrl.HDC_LivingLamp, false);
- }
- }
- WpadActivity.setFinishTimerReset();
- }
- else {
- //외부 앱 호출 후, 본 APP Finish 필요
- api_Menu.startSubScreenActivity(getApplicationContext(), menueListDataClass.idMappingTable[i].Id, API_Menu.MENU_START_OPTION_1, api_Menu.GetAPK_Name_ByID(ChildGroupID));
- Intent mIntent = new Intent();
- mIntent.putExtra("Finish_Kind", "HomeButton");
- MainActivity.this.setResult(RESULT_OK, mIntent);
- finish();
- }
- break;
- }
- }
- }
- }
- }
- };
- /**
- * 디바이스 서비스 APP 을 체크하여 실행되어있지 않을시 실행시킨다.
- */
- private void StartDevService() {
- try {
- ActivityManager am = (ActivityManager) getApplicationContext().getSystemService(Context.ACTIVITY_SERVICE);
- List<ActivityManager.RunningAppProcessInfo> appList = am.getRunningAppProcesses();
- boolean DevServiceExist = false;
- for (int i = 0; i < appList.size(); i++) {
- ActivityManager.RunningAppProcessInfo rapi = appList.get(i);
- Log.i(TAG, "App List i = " + i + " / name = " + rapi.getClass().getName());
- if (rapi.processName.equals("com.artncore.deviceservice")) {
- Log.d(TAG, "Filter 1 : Service already running");
- DevServiceExist = true;
- break;
- }
- }
- ActivityManager am2 = (ActivityManager)getApplicationContext().getSystemService(Context.ACTIVITY_SERVICE);
- List<ActivityManager.RunningServiceInfo> rs = am2.getRunningServices(1000);
- for (int i = 0; i < rs.size(); i++) {
- ActivityManager.RunningServiceInfo rsi = rs.get(i);
- //Log.d("run service","Package Name " + i + " = " + rsi.service.getPackageName());
- //Log.d("run service","Class Name : " + i + " = " + rsi.service.getClassName());
- if (rsi.service.getPackageName().equals("com.artncore.deviceservice")) {
- Log.d(TAG, "Filter 2 : Service already running");
- DevServiceExist = true;
- break;
- }
- }
- if (!DevServiceExist) {
- Log.d(TAG, "Call Service Start");
- Intent intent = new Intent("wallpaddevservice.ServiceMain");
- startService(intent);
- try {
- Thread.sleep(3000);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] StartDevService().sleep(...)");
- }
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.w(TAG, "[Exception] StartDevService()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /**
- * DB 에서 룸이름 정보를 가져온다.
- *
- * @return (String []) null - 실패, not null
- */
- private String[] getRoomNameFromDB() {
- try {
- WallpadStatusData wallpadStatusData = new WallpadStatusData(getContext().getApplicationContext());
- String[] RoomNameList = wallpadStatusData.GetDevRoomName();
- wallpadStatusData.closeDB();
- if (RoomNameList == null) {
- Log.e(TAG, "[getRoomNameFromDB] - RoomNameList is null !!!");
- return null;
- }
- if (RoomNameList.length != 6) {
- Log.e(TAG, "[getRoomNameFromDB.length Not Match (" + RoomNameList.length + ")");
- return null;
- }
- if (DEBUG_LOG_ON) {
- for (int i = 0; i < RoomNameList.length; i++)
- DebugLogOutput("[getRoomNameFromDB] RoomNameList[" + i + "] " + RoomNameList[i]);
- }
- return RoomNameList;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] getRoomNameFromDB()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- return null;
- }
- /**
- * DB 에서 룸이름 정보를 가져온다. 난방, 조명 개발 명칭 가져오기
- *
- * @param Device - int
- * @return (String []) null - 실패, not null
- */
- private String[] getRoomNameFromDB(int Device) {
- try {
- String[] RoomNameList = null;
- WallpadStatusData wallpadStatusData = new WallpadStatusData(getContext().getApplicationContext());
- if (Device == HEATING) {
- RoomNameList = wallpadStatusData.GetDevRoomName("heating");
- }
- else {
- RoomNameList = wallpadStatusData.GetDevRoomName("light");
- }
- wallpadStatusData.closeDB();
- if (RoomNameList == null) {
- Log.e(TAG, "[DB_GetRoomName] - RoomNameList is null !!!");
- return null;
- }
- if (RoomNameList.length != 6) {
- Log.e(TAG, "[DB_GetRoomName] - RoomNameList.length Not Match (" + RoomNameList.length + ")");
- return null;
- }
- if (DEBUG_LOG_ON) {
- for (int i = 0; i < RoomNameList.length; i++)
- DebugLogOutput("RoomNameList[" + i + "] " + RoomNameList[i]);
- }
- return RoomNameList;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] DB_GetRoomName(int Device)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- return null;
- }
- /**
- * DB에서 방 이름을 가져와서 방 명칭 관련 변수에 값을 넣는다.
- **/
- private void GetRoomName() {
- try {
- WallpadDeviceSet wallpadDeviceSet = new WallpadDeviceSet(getContext().getApplicationContext());
- boolean UseEachRoomName = wallpadDeviceSet.GetEachRoomNameInfo();
- wallpadDeviceSet.closeDB();
- Log.e(TAG, "[GetRoomName] UseEachRoomName = " + UseEachRoomName);
- if (UseEachRoomName == false) {
- // 명칭 통합사용
- if (nConstructionFunction == WallpadDeviceSet.CONSTRUCTION_SPECIAL_FUNCTION_SK) {
- // SK건설
- mRoomNameList_Light = mDefaultRoomNameList_Light_SK;
- mRoomNameList_Heating = mDefaultRoomNameList_Heating_SK;
- }
- else {
- mRoomNameList_Light = getRoomNameFromDB();
- if (mRoomNameList_Light == null) {
- mRoomNameList_Light = mDefaultRoomNameList;
- }
- if (GetEasyModeUXUse()) {
- mRoomNameList_Heating = mDefaultRoomNameList_Heating_easymode;
- }
- else {
- mRoomNameList_Heating = getRoomNameFromDB();
- if (mRoomNameList_Heating == null) {
- mRoomNameList_Heating = mDefaultRoomNameList;
- }
- }
- }
- }
- else {
- // 명칭 난방, 조명 분리 사용
- mRoomNameList_Light = getRoomNameFromDB(LIGHT);
- if (mRoomNameList_Light == null) {
- mRoomNameList_Light = mDefaultRoomNameList_Light;
- }
- if (GetEasyModeUXUse()) {
- mRoomNameList_Heating = mDefaultRoomNameList_Heating_easymode;
- }
- else {
- mRoomNameList_Heating = getRoomNameFromDB(HEATING);
- if (mRoomNameList_Heating == null) {
- mRoomNameList_Heating = mDefaultRoomNameList_Heating;
- }
- }
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] GetRoomName()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /**
- * TOP 에 보일러 아이콘 활성화 & 비활성화
- *
- * @param Enabled - true : 활성화, false : 비활성화
- * @return (boolean) true : 성공, false : 실패
- */
- public boolean setTopBoilerBtnVisible(boolean Enabled) {
- try {
- if (Enabled == true) {
- Log.i(TAG, "[setTopBoilerBtnVisible] ENTER 0");
- if (TopBoilerBtn.getVisibility() != View.VISIBLE) {
- Log.i(TAG, "[setTopBoilerBtnVisible] ENTER 1");
- if (TopBackBtn.getVisibility() == View.VISIBLE) {
- // 1019
- Log.i(TAG, "[setTopBoilerBtnVisible] ENTER 2");
- WpadUtil.ViewMove(TopBoilerBtn, 893, 0);
- WpadUtil.ViewMove(TopManualBtn, 767, 0);
- }
- else {
- Log.i(TAG, "[setTopBoilerBtnVisible] ENTER 3-1");
- WpadUtil.ViewMove(TopBoilerBtn, 1019, 0);
- //WpadUtil.ViewMove(TopManualBtn, 893, 0);
- }
- if(TopBoilerBtn!=null) TopBoilerBtn.setVisibility(View.VISIBLE);
- if(TopBoilerBtn!=null) TopBoilerBtn.bringToFront();
- if (TopBoilerBtn!=null && TopBoilerBtn.getVisibility() == View.VISIBLE) {
- Log.i(TAG, "[setTopBoilerBtnVisible] ENTER 3-2");
- WpadUtil.ViewMove(TopManualBtn, 893, 0);
- //TopManualBtn.bringToFront();
- }
- }
- }
- else {
- Log.i(TAG, "[setTopBoilerBtnVisible] ENTER 4");
- if (TopBoilerBtn.getVisibility() != View.INVISIBLE) {
- Log.i(TAG, "[setTopBoilerBtnVisible] ENTER 5");
- TopBoilerBtn.setVisibility(View.INVISIBLE);
- if (TopBackBtn.getVisibility() == View.VISIBLE) {
- Log.i(TAG, "[setTopBoilerBtnVisible] ENTER 6");
- WpadUtil.ViewMove(TopManualBtn, 893, 0);
- }
- else {
- Log.i(TAG, "[setTopBoilerBtnVisible] ENTER 7");
- WpadUtil.ViewMove(TopManualBtn, 1019, 0);
- }
- }
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- }
- catch (Exception ex) {
- Log.e(TAG, "[Exception] setTopBoilerBtnVisible(boolean Enabled)");
- //ex.printStackTrace();
- LogUtil.errorLogInfo("", TAG, ex);
- return false;
- }
- return true;
- }
- /**
- * 실내공기질 돌아가기 버튼 활성화 & 비활성화
- *
- * @param Enabled - true : 활성화, false : 비활성화
- * @return (boolean) true : 성공, false : 실패
- */
- public boolean setAIRBackBtnVisible(boolean Enabled) {
- if (Enabled == true) {
- if (TopAirBackBtn.getVisibility() != View.VISIBLE) TopAirBackBtn.setVisibility(View.VISIBLE);
- TopAirBackBtn.bringToFront();
- if (TopAirBackBtn.getVisibility() == View.VISIBLE) {
- WpadUtil.ViewMove(TopManualBtn, 893, 0);
- }
- if(TopManualBtn!=null) TopManualBtn.setVisibility(View.INVISIBLE);
- }
- else {
- if (TopAirBackBtn.getVisibility() != View.INVISIBLE) TopAirBackBtn.setVisibility(View.INVISIBLE);
- if (TopAirBackBtn.getVisibility() == View.INVISIBLE) {
- WpadUtil.ViewMove(TopManualBtn, 1019, 0);
- }
- }
- return true;
- }
- /**
- * 환기제어 돌아가기 버튼 활성화 & 비활성화
- *
- * @param Enabled - true : 활성화, false : 비활성화
- * @return (boolean) true : 성공, false : 실패
- */
- public boolean setVentilBackBtnVisible(boolean Enabled) {
- if (Enabled == true) {
- if (BTN_TOP_BACK_VENTIL.getVisibility() != View.VISIBLE) BTN_TOP_BACK_VENTIL.setVisibility(View.VISIBLE);
- BTN_TOP_BACK_VENTIL.bringToFront();
- if (BTN_TOP_BACK_VENTIL.getVisibility() == View.VISIBLE) {
- WpadUtil.ViewMove(TopManualBtn, 893, 0);
- }
- if(TopManualBtn!=null) TopManualBtn.setVisibility(View.INVISIBLE);
- }
- else {
- if (BTN_TOP_BACK_VENTIL.getVisibility() != View.INVISIBLE) BTN_TOP_BACK_VENTIL.setVisibility(View.INVISIBLE);
- if (BTN_TOP_BACK_VENTIL.getVisibility() == View.INVISIBLE) {
- WpadUtil.ViewMove(TopManualBtn, 1019, 0);
- }
- }
- return true;
- }
- /**
- * 상단 KCC디밍조절 버튼 활성화 & 비활성화
- *
- * @param Enabled - true : 활성화, false : 비활성화
- * @return (boolean) true : 성공, false : 실패
- */
- public void setKccDimmBtnVisible(boolean Enabled) {
- WallpadDeviceSet wdst = new WallpadDeviceSet(getContext());
- int dimmUse = wdst.GetDeviceSetted("KCC디밍제어기"); // 1: 사용안함 / 2: 사용함
- wdst.closeDB();
- Log.i(TAG, "[setKccDimmBtnVisible] - KCC Dimm : " + dimmUse);
- // null, 사용안함 이면 안나오도록 한다.
- if (dimmUse == 0 || dimmUse == 1) {
- Log.w(TAG, "[setKccDimmBtnVisible] - KCC Dimm NOT USE !!!");
- Enabled = false;
- KccDimUse = 0;
- }
- else {
- KccDimUse = 1;
- }
- for (int i = 0; i < TopDimmingBtn.length; i++) {
- if (Enabled == true) {
- if (TopDimmingBtn[i].getVisibility() != View.VISIBLE)
- TopDimmingBtn[i].setVisibility(View.VISIBLE);
- TopDimmingBtn[i].bringToFront();
- }
- else {
- if (TopDimmingBtn[i].getVisibility() != View.INVISIBLE)
- TopDimmingBtn[i].setVisibility(View.INVISIBLE);
- }
- }
- }
- /**
- * 조명제어기의 디밍 레벨을 조절한다.
- *
- * @param Level - 디밍레벨
- * @return (int) - >=0 : 성공, <0 : 실패
- */
- private int Device_SetDimmingLevel(byte Level) {
- DebugLogOutput("[Device_SetAllDimmingLevel] - Start (Level : " + Level + ")");
- // 1. Api Load Check
- if (ledDimmingAPI == null) {
- Log.e(TAG, "[Device_SetAllDimmingLevel] ledDimmingAPI unload !!!");
- return -1;
- }
- // 2. Param Range Check
- if (mDimData.DimData.DeviceCnt == 0) {
- Log.w(TAG, "[Device_SetAllDimmingLevel] mData.DeviceCnt == 0");
- return -2;
- }
- // 3. Light Control
- try {
- int ret = ledDimmingAPI.SetDimmingLevel(0, Level);
- if (ret < 0) {
- Log.e(TAG, "[Device_SetAllDimmingLevel] SetAllDimmingLevel Error (" + ret + ") ErrorCode = " + ledDimmingAPI.ErrorCode.ErrStr());
- return -6;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -100;
- }
- catch (Exception e) {
- Log.e(TAG, "[Device_SetAllDimmingLevel] - [Exception Error] ledDimmingAPI.SetAllDimmingLevel()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -100;
- }
- DebugLogOutput("[Device_SetAllDimmingLevel] - OK");
- return 0;
- }
- private void Draw_Update_DimmBtn() {
- // 디밍 표시
- Log.i(TAG, "[Draw_Update_DimmBtn] - Dimming Draw Start");
- if (mDimData.DimData == null) {
- Log.w(TAG, "[Draw_Update_DimmBtn] - mDimData.DimData null");
- return;
- }
- else {
- Log.i(TAG, "[Draw_Update_DimmBtn] - mDimData.DimData normal");
- }
- byte Level = mDimData.DimData.Device[0].device.Level;
- Log.i(TAG, "[Draw_Update_DimmBtn] - Level =" + Level);
- for (int i = 0; i < 4; i++) {
- if (Level == mLevelArray[i]) {
- Log.i(TAG, "[Draw_Update_DimmBtn] - Same Level Button i = " + i);
- TopDimmingBtn[i].setButtonRearImage();
- }
- else {
- Log.i(TAG, "[Draw_Update_DimmBtn] - Diff Level Button i = " + i);
- TopDimmingBtn[i].setButtonFrontImage();
- }
- }
- Log.i(TAG, "[Draw_Update_DimmBtn] - Dimming Draw End");
- }
- /**
- * KCC 디밍제어기의 상태를 갱신한다.
- *
- * @param real - (boolean) true : 실시간 , false : 가장최근
- * @param index - (byte) 방 인덱스 (0~5개별방, Common.INDEX_ALL 전체)
- * @return (int) - >=0 : 성공, <0 : 실패
- */
- private int Device_Update_Dimming(boolean real, byte index) {
- DebugLogOutput("[Device_Update_Dimming] - Start (real : " + real + ", index:" + index + ")");
- // 1. Api Load Check
- if (ledDimmingAPI == null) {
- Log.e(TAG, "[Device_Update_Dimming] ledDimmingAPI unload !!!");
- return -1;
- }
- // 2. refresh
- try {
- int ret = ledDimmingAPI.Refresh(index, real);
- if (ret < 0) {
- Log.e(TAG, "[Device_Update_Dimming] Refresh(" + index + ", " + real + ") ret = " + ret + " / ErrorCode = " + ledDimmingAPI.ErrorCode.ErrStr());
- return -2;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -100;
- }
- catch (Exception e) {
- Log.e(TAG, "[Device_Update_Dimming] - [Exception Error] ledDimmingAPI.Refresh(index:" + index + ", real:" + real + ")");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -100;
- }
- // 3. Range Check
- if (ledDimmingAPI.data.DeviceCnt <= 0) {
- Log.e(TAG, "[Device_Update_Dimming] - DeviceCnt Out of range !!! (DeviceCnt:" + ledDimmingAPI.data.DeviceCnt + ")");
- return -10;
- }
- // 4. Data Copy
- mDimData.DimData = ledDimmingAPI.data;
- // 5. Debug Msg
- DebugLogOutput("---------------------------------------");
- DebugLogOutput("[Device_Update_Dimming]");
- DebugLogOutput("---------------------------------------");
- DebugLogOutput("DeviceCnt = " + ledDimmingAPI.data.DeviceCnt);
- byte DeviceCnt = ledDimmingAPI.data.DeviceCnt;
- if (index == define.DEVICE_ALL_OR_NOTHING) {
- for (byte i = 0; i < DeviceCnt; i++) {
- DebugLogOutput(ledDimmingAPI.data.Device[i].info.ToDebugString(i));
- DebugLogOutput(ledDimmingAPI.data.Device[i].device.ToDebugString(i));
- }
- }
- else {
- DebugLogOutput(ledDimmingAPI.data.Device[index].device.ToDebugString(index));
- }
- DebugLogOutput("---------------------------------------");
- DebugLogOutput("[Device_Update_Dimming] - OK");
- return 0;
- }
- /**
- * 현관호출 or 전화호출시 사용되는 keycode - Broadcast 을 송신한다.
- *
- * @param code - (int) 송신할 keycode
- * @return (int) - >=0 : 성공, <0 : 실패
- */
- private int setSendEventBR(int code) {
- try {
- KeyEvent event = new KeyEvent(KeyEvent.ACTION_UP, code);
- Intent intent = new Intent("EVENT_DEVICE_CONTROL", null);
- intent.putExtra(Intent.EXTRA_KEY_EVENT, event);
- intent.putExtra("keycode",code);
- getContext().sendBroadcast(intent);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -100;
- }
- catch (Exception e) {
- Log.e(TAG, "[setSendEventBR] - [Exception Error] code:" + code);
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -100;
- }
- return 0;
- }
- /**
- * 히든메뉴의 버튼 타임아웃을 설정한다.
- */
- private void HideMenu_setTimeOut() {
- if (mHideMenuTimer != null) mHideMenuTimer.cancel();
- mHideMenuTimer = new CountDownTimer( 1 * 1000, 1000) {
- @Override
- public void onFinish() {
- Log.d(TAG, "mHideMenuTimer - onFinish !!!");
- mHideMenuEntryStatus = 0;
- }
- @Override
- public void onTick(long millisUntilFinished) {
- }
- };
- mHideMenuTimer.cancel();
- mHideMenuTimer.start();
- }
- /**
- * 히든메뉴 진입용 프로세스
- *
- * @param TargetId - 히든메뉴용 버튼 ID
- */
- private void HideMenuEntryProc(int TargetId) {
- if (OPERATION_MODE != Common.MODE_NOMAL) return;
- if (mHideMenuOn) return;
- if (TargetId == ID.main.button.HIDE1) {
- if (mHideMenuEntryStatus == 0) { mHideMenuEntryStatus = 1; HideMenu_setTimeOut(); }
- else if (mHideMenuEntryStatus == 2) { mHideMenuEntryStatus = 3; HideMenu_setTimeOut(); }
- else if (mHideMenuEntryStatus == 4) { mHideMenuEntryStatus = 5; HideMenu_setTimeOut(); }
- }
- else if (TargetId == ID.main.button.HIDE2) {
- if (mHideMenuEntryStatus == 1) { mHideMenuEntryStatus = 2; HideMenu_setTimeOut(); }
- else if (mHideMenuEntryStatus == 3) { mHideMenuEntryStatus = 4; HideMenu_setTimeOut(); }
- else if (mHideMenuEntryStatus == 5) {
- mHideMenuEntryStatus = 6;
- mHideMenuOn = true;
- if (mHideMenuTimer != null) {
- mHideMenuTimer.cancel();
- mHideMenuTimer = null;
- TopBackground.setImageResource(0);
- TopBackground.setBackgroundColor(Color.RED);
- Sound().Play(SND.call.CALLSTART);
- super.setFinishTimerDestroy();
- Log.i(TAG, "================================");
- Log.i(TAG, "[HideMenu] START !!!!!");
- Log.i(TAG, "================================");
- }
- }
- }
- }
- public boolean GetEasyModeUXUse() {
- try {
- WallpadDeviceSet deviceSet = new WallpadDeviceSet(mContext);
- boolean bSupport = deviceSet.Get_EasyModeUX_Support();
- deviceSet.closeDB();
- WallpadStatusData data = new WallpadStatusData(mContext);
- boolean bUse = data.GetEasyModeUxUse();
- data.closeDB();
- Log.d(TAG, "[GetEasyModeUXUse] bSupport [" + bSupport + "], bUse [" + bUse + "]");
- return bSupport & bUse;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] GetEasyModeUXUse()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- return false;
- }
- public boolean getAirSensorAPUsage() {
- try {
- boolean bUsage = false;
- WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(getApplicationContext());
- int nAirQualityEnable = mWallpadDeviceSet.GetDeviceSetted("센서AP");
- mWallpadDeviceSet.closeDB();
- if(nAirQualityEnable == WallpadDeviceSet.DEV_DATA_ENABLE) bUsage = true;
- Log.d(TAG, "[getAirSensorAPUsage] bUsage [" + bUsage + "]");
- return bUsage;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] getAirSensorAPUsage()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- return false;
- }
- /**
- * 제어기 상태를 가져온다.
- *
- * @param bReal - (boolean) true : 실시간 , false : 가장최근
- * @return (int) - >=0 : 성공, <0 : 실패
- */
- private int updateVentilatorData(boolean bReal) {
- Log.i(TAG, "[updateVentilatorData] - Start (bReal : " + bReal + ")");
- // 1. Api Load Check
- if (mVentilAPI == null) {
- Log.e(TAG, "[updateVentilatorData] - mVentilAPI unload !!!");
- return -1;
- }
- // 2. reflash
- try {
- int ret = mVentilAPI.Refresh(bReal);
- if (ret < 0) {
- Log.e(TAG, "[updateVentilatorData] Refresh - ret (" + ret + ") ErrorCode = " + mVentilAPI.ErrorCode.ErrStr());
- return -2;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -100;
- }
- catch (Exception e) {
- Log.e(TAG, "[updateVentilatorData] - [Exception Error] mVentilAPI.Refresh(" + bReal + ")");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -100;
- }
- // 3. Data Copy
- VentilStatus = mVentilAPI.data;
- // 4. Debug Msg
- Log.i(TAG, VentilStatus.ToDebugString());
- Log.i(TAG, VentilStatus.ToFaultString());
- Log.i(TAG, "[updateVentilatorData] - OK");
- return 0;
- }
- /**
- * Knx 환기 제어기 상태를 가져온다.
- *
- * @param bReal - (boolean) true : 실시간 , false : 가장최근
- * @return (int) - >=0 : 성공, <0 : 실패
- */
- private int updateKnxVentilatorData(boolean bReal) {
- Log.i(TAG, "[updateKnxVentilatorData] - Start (bReal : " + bReal + ")");
- // 1. Api Load Check
- if (mKnxVentilAPI == null) {
- Log.e(TAG, "[updateKnxVentilatorData] - mVentilAPI unload !!!");
- return -1;
- }
- // 2. reflash
- try {
- int ret = mKnxVentilAPI.Refresh(Common.INDEX_ALL, bReal);
- if (ret < 0) {
- Log.e(TAG, "[updateKnxVentilatorData] Refresh - ret (" + ret + ") ErrorCode = " + mKnxVentilAPI.ErrorCode.ErrStr());
- return -2;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -100;
- }
- catch (Exception e) {
- Log.e(TAG, "[updateKnxVentilatorData] - [Exception Error] mKnxVentilAPI.Refresh(" + bReal + ")");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -100;
- }
- // 3. Data Copy
- VentilStatus = mKnxVentilAPI.data.Device[0];
- // 4. Debug Msg
- Log.i(TAG, VentilStatus.ToDebugString());
- Log.i(TAG, VentilStatus.ToFaultString());
- Log.i(TAG, "[updateVentilatorData] - OK");
- return 0;
- }
- public static int nConstructionFunction = WallpadDeviceSet.CONSTRUCTION_SPECIAL_FUNCTION_NONE;
- private void getConstructionFunction() {
- try {
- WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(getApplicationContext());
- nConstructionFunction = mWallpadDeviceSet.Get_Construction_SpecialFunc();
- mWallpadDeviceSet.closeDB();
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getConstructionFunction()");
- e.printStackTrace();
- }
- }
- }
|