123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193 |
- package kr.co.icontrols.wallpadmain;
- import android.annotation.SuppressLint;
- import android.app.Activity;
- import android.app.ActivityManager;
- import android.app.ActivityManager.RunningTaskInfo;
- import android.content.BroadcastReceiver;
- import android.content.ComponentName;
- import android.content.Context;
- import android.content.Intent;
- import android.content.IntentFilter;
- import android.content.ServiceConnection;
- import android.content.SharedPreferences;
- import android.content.pm.PackageInfo;
- import android.content.pm.PackageManager;
- import android.database.SQLException;
- import android.graphics.Color;
- import android.hardware.Camera;
- import android.media.AudioManager;
- import android.media.MediaRecorder;
- import android.net.Uri;
- import android.net.ethernet.EthernetDevInfo;
- import android.net.ethernet.EthernetManager;
- import android.os.Build;
- import android.os.Bundle;
- import android.os.CountDownTimer;
- import android.os.Handler;
- import android.os.IBinder;
- import android.os.Looper;
- import android.os.Message;
- import android.os.Messenger;
- import android.os.PowerManager;
- import android.os.RemoteException;
- import android.provider.Settings;
- import android.util.Log;
- import android.view.KeyEvent;
- import android.view.MotionEvent;
- import android.view.SurfaceHolder;
- import android.view.SurfaceView;
- import android.view.View;
- import android.view.WindowManager;
- import android.view.animation.Animation;
- import android.view.animation.AnimationUtils;
- import android.widget.Button;
- import android.widget.ImageView;
- import android.widget.RelativeLayout;
- import android.widget.TextView;
- import android.widget.ViewFlipper;
- import com.artncore.WallPadDataMgr.WallpadCallHistoryData;
- import com.artncore.WallPadDataMgr.WallpadDeviceSet;
- import com.artncore.WallPadDataMgr.WallpadParkInfo;
- import com.artncore.WallPadDataMgr.WallpadSalesSampleData;
- import com.artncore.WallPadDataMgr.WallpadScheduleData;
- import com.artncore.WallPadDataMgr.WallpadStatusData;
- import com.artncore.WallPadDataMgr.WallpadVisitorPicData_A20;
- import com.artncore.WallPadDataMgr.wallpaddbmgr;
- import com.artncore.WallPadDataMgr.wallpaddbmgr.AddressSet;
- import com.artncore.WallPadDataMgr.wallpaddbmgr.AddressSetBackup;
- import com.artncore.commons.APIErrorCode;
- import com.artncore.commons.DataClasses.CarParkingData;
- import com.artncore.commons.define;
- import com.artncore.deviceinterface.WallPadInterface;
- import com.artncore.wallpadapi.IntLightAPI;
- import com.artncore.wallpadapi.LightAPI;
- import com.artncore.wallpadapi.MultiSwitchAPI;
- import com.artncore.wallpadapi.SdbAPI;
- import com.artncore.wallpadapi.Sdb_LivingRoomLightAPI;
- import com.artncore.wallpadapi.SmartKeyRfDoorAPI;
- import com.artncore.wallpadapi.WallPadAPI;
- import com.artncore.wallpadimap.RetProci;
- import com.artncore.wallpadimap.WallPadiMAPNotifyAPI;
- import com.bumptech.glide.Glide;
- import com.bumptech.glide.load.engine.DiskCacheStrategy;
- import com.google.gson.Gson;
- import com.util.LogUtil;
- import com.icontrols.service.control.ILightControlService;
- import org.json.JSONException;
- import org.json.JSONObject;
- import java.io.BufferedReader;
- import java.io.BufferedWriter;
- import java.io.File;
- import java.io.FileInputStream;
- import java.io.FileOutputStream;
- import java.io.IOException;
- import java.io.InputStream;
- import java.io.InputStreamReader;
- import java.io.ObjectInputStream;
- import java.io.ObjectOutputStream;
- import java.io.OutputStream;
- import java.io.OutputStreamWriter;
- import java.net.InetAddress;
- import java.net.InetSocketAddress;
- import java.net.NetworkInterface;
- import java.net.Socket;
- import java.sql.Timestamp;
- import java.text.SimpleDateFormat;
- import java.util.ArrayList;
- import java.util.Calendar;
- import java.util.Collections;
- import java.util.Date;
- import java.util.GregorianCalendar;
- import java.util.List;
- import java.util.regex.Pattern;
- import kr.co.icontrols.data.ResultData;
- import kr.co.icontrols.v40ioctl.V40IOInterface;
- import kr.co.icontrols.wallpadmain.declare.Common;
- import kr.co.icontrols.wallpadmain.declare.Common.BR_MAIN_LIVE_CHECKER;
- import kr.co.icontrols.wallpadmain.declare.DataClasses.IconInfoTable;
- import kr.co.icontrols.wallpadmain.declare.ID;
- import kr.co.icontrols.wallpadmain.declare.ID_OLD;
- import kr.co.icontrols.wallpadmain.declare.LayoutDevice;
- import kr.co.icontrols.wallpadmain.imap.iMAPAlarmOperation;
- import kr.co.icontrols.wallpadmain.imap.iMAPCarParking;
- import kr.co.icontrols.wallpadmain.imap.iMAPCarParking_UPIS;
- import kr.co.icontrols.wallpadmain.imap.iMAPElecCarChargingInfo;
- import kr.co.icontrols.wallpadmain.imap.iMAPEnergyServer_EnergyMeter;
- import kr.co.icontrols.wallpadmain.imap.iMAPEnergyServer_EnergyModule;
- import kr.co.icontrols.wallpadmain.imap.iMAPEnergyServer_Realmeter;
- import kr.co.icontrols.wallpadmain.imap.iMAPRemotemeter;
- import kr.co.icontrols.wallpadmain.menu.CallSubMenuScreen;
- import kr.co.icontrols.wallpadmain.screen.EASYUI_MAIN;
- import kr.co.icontrols.wallpadmain.screen.HYOSUNGUI_MAIN_HA;
- import kr.co.icontrols.wallpadmain.screen.HYOSUNGUI_MAIN_HN;
- import kr.co.icontrols.wallpadmain.screen.MAIN;
- import kr.co.icontrols.wallpadmain.screen.METROUI_MAIN;
- import kr.co.icontrols.wallpadmain.screen.METROUI_SUB_01;
- import kr.co.icontrols.wallpadmain.screen.METROUI_SUB_02;
- import kr.co.icontrols.wallpadmain.screen.METROUI_SUB_GROUP;
- import kr.co.icontrols.wallpadmain.screen.SUB_01;
- import kr.co.icontrols.wallpadmain.screen.SUB_02;
- import kr.co.icontrols.wallpadmain.util.EnergyAlramPopupMgr;
- import kr.co.icontrols.wallpadmain.util.IconManager;
- import kr.co.icontrols.wallpadmain.util.MobileProcService;
- import kr.co.icontrols.wallpadmain.util.StringUtil;
- import kr.co.icontrols.wallpadmain.util.iMapServer;
- import kr.co.icontrols.wallpadsupport.Version;
- import kr.co.icontrols.wallpadsupport.Version.MODEL_TYPE;
- import kr.co.icontrols.wallpadsupport.WpadActivity;
- import kr.co.icontrols.wallpadsupport.WpadRelativeLayoutParams;
- import kr.co.icontrols.wallpadsupport.WpadScale;
- import kr.co.icontrols.wallpadsupport.WpadSound;
- import kr.co.icontrols.wallpadsupport.WpadSound.SND;
- import kr.co.icontrols.wallpadsupport.WpadUtil;
- import kr.co.icontrols.wallpadmain.imap.iMAPAlarmOperation.EMER_STATE;
- import kr.co.icontrols.wallpadmain.imap.iMAPAlarmOperation.EMER_DETAIL_INFO;
- import static android.content.Intent.ACTION_TIME_TICK;
- import static android.provider.Settings.System.SCREEN_OFF_TIMEOUT;
- import static com.artncore.commons.define.ALBUM_PICTURE_LOCATION;
- import static com.artncore.commons.define.BESTIN_LOCATION;
- /**
- * @description
- * 월패드 [설정기능] 메인화면 이다.<br>
- * 상단의 Top 메뉴, [홈] [돌아가기]<br>
- * 좌측의 Tab 메뉴, [조명] [난방] [가스] ... 등 선택 메뉴<br>
- * 를 여기서 처리한다.
- */
- public class MainActivity extends WpadActivity {
- private final static String TAG = "MainActivity";
-
- private void DebugLogOutput(String s) { if(Common.DEBUG_LOG_ON) Log.d(TAG, s); }
- // =================================================================================================
- // [[ Declaration ]] region
- // =================================================================================================
- protected Context mContext = null;
- public Context getContext() { return mContext; }
- private WallPadAPI mWallPadAPI = null;
- public static IOInterface mIOInterface = null;
- private int DEVICE_OPERATION_MODE = Common.MODE;
- boolean bEasyModeUsage = false;
- public static boolean bGoodDesign2020 = false;
-
- // Layout
- private RelativeLayout MainLayout; // 메인화면
- private RelativeLayout MainScreenLayout;
-
- private RelativeLayout SubLayout_01; // 서브 01 화면
- private RelativeLayout SubScreenLayout_01;
-
- private RelativeLayout SubLayout_02; // 서브 02 화면
- private RelativeLayout SubScreenLayout_02;
- private RelativeLayout EasyMainLayout; // 간편모드 메인화면
- private RelativeLayout EasyMainScreenLayout;
- private ViewFlipper mViewFlipper;
- Animation aniSlideIn, aniSlideOut;
- public static ImageView IMG_LCD_KEEPER;
-
-
- // PopupActivityRun
- private static boolean PopupActivityRun = false;
- public static boolean getPopupActivityRun() { return PopupActivityRun; }
- public static void setPopupActivityRun(boolean run) { PopupActivityRun = run; }
-
- // InfoActivityRun
- private static boolean InfoActivityRun = false;
- public static boolean getInfoActivityRun() {
- Log.d(TAG, "[getInfoActivityRun] InfoActivityRun: " + InfoActivityRun);
- return InfoActivityRun;
- }
- public static void setInfoActivityRun(boolean run) {
- InfoActivityRun = run;
- if (!InfoActivityRun) resetCurrentInfoScreenID();
- }
-
- // Menu & TabData
- private Menu mMenu = null;
- // private TabData mTabData = null;
-
- // CurrentScreenId
- private int mCurrentScreenId = -1;
- private int mTempCurrentScreenId = -1;
- private static int mCurrentInfoScreenId = -1;
-
- // Screen
- private MAIN MainScreen = null;
- private SUB_01 SUB_01Screen = null;
- private SUB_02 SUB_02Screen = null;
- private METROUI_MAIN MetroUI_MainScreen = null;
- private METROUI_SUB_01 MetroUI_SUB_01Screen = null;
- private METROUI_SUB_02 MetroUI_SUB_02Screen = null;
- private METROUI_SUB_GROUP MetroUI_SUB_GroupScreen = null;
- private HYOSUNGUI_MAIN_HN Hyosung_HN_MainScreen = null;
- private HYOSUNGUI_MAIN_HA Hyosung_HA_MainScreen = null;
- private EASYUI_MAIN EasyUI_MainScreen = null;
- // 메뉴 리스트 처리 및 서브 스크린 호출
- public CallSubMenuScreen m_CallSubMenuScreen = null;
-
- ///////////////////////////// AnC 메인어플에서 사용되는 변수 모음
-
-
- int LastTimeSync = 0;
- boolean HomeCTROn = true;
- //int PSTNStatus = 0;
- int MAINStatus = 0;
- public static final int MAIN_NORMAL = 0;
- public static final int MAIN_WAIT_SETIP = 1;
- static boolean Alert_App_On = false;
-
- byte bootupretryCNT = 0;
- static final int MAX_BOOTUP_RETRY_COUNT = 1200;
-
- ScheduleManager SCManager;
-
-
- boolean SYSTEM_TIME_SET = false;
- static boolean CALLSVCSTARTED = false;
-
- public Thread mThread_getAppsVersion = null;
- ///////////////////////////// end
-
- // 거실조명 제어드라이버
- private IntLightAPI mIntLightAPI = null;
- // 에너지미터 제어드라이버
- private Sdb_LivingRoomLightAPI mSdb_LivingRoomLightAPI = null;
- private SdbAPI mSdbAPI = null;
-
- // 멀티스위치 제어 드라이버
- private MultiSwitchAPI m_MultiSwitch = null;
- // 대외향 거실 스위치 드라이버
- private LightAPI m_LightCtrl = null;
-
- private boolean m_ModelHouseSleepModeRelease = false;
- // 거동수상자 녹화 관련 변수
- private ImageView IMG_NOTICE_STRANGER_RECORD;
- private TextView TXT_NOTICE_STRANGER_RECORD;
- private Button BTN_STRANGER_RECORD_VIEW, BTN_STRANGER_RECORD_CANCEL;
- private int RECORD_TIME = 0;
- private CountDownTimer mRecordTimer;
- private int mCurRecordTime = 0;
- public static boolean bRecordStatus = false; // 거동수상자 녹화중 판별 플래그
- private final String VIDEO_TEMP_PATH = define.BESTIN_LOCATION + "VisitorVideo.mp4";
- private final String VISITOR_VIDEO_PATH = define.VISITOR_VIDEO_LOCATION;
- private final String VISITOR_VIDEO_TEMP_PATH = define.VISITOR_VIDEO_LOCATION + "temp/";
- private final static int VISITOR_VIDEO_MAX_COUNT = 20; // 방문자영상 최대 개수
- private MediaRecorder mMediaRecorder;
- public static boolean bRecordDelay = false; // 거동수상자 녹화 후 일정시간 녹화 막음 플래그
- Handler recordDelayHandler = new Handler() {
- @Override
- public void handleMessage(Message msg) {
- bRecordDelay = false;
- }
- };
- //주차정보 관련 변수
- public static boolean bUseofNot_ParkingInfo = false;
- public static int nParkingSystemType = Common.PARKING_SYSTEM_ICONTROLS;
- private String ParkingServerIP = null;
- private int ParkingServerPort = 10000;
- private int cGetParkingMin = 18;
- private boolean bSetMSG_GetParkingInfo = false;
- iMAPCarParking iMAPcarParking;
- iMAPCarParking_UPIS iMapcarParking_UPIS;
-
- //일정 알림 관련 변수
- private int AlarmScheduleCount = 0;
- private String AlarmScheduleString = null;
- private boolean bAlarmScheduleString = false;
-
- //전기차 충전 관련 변수
- iMAPElecCarChargingInfo imapElecCarChargingInfo;
-
- //제로 에너지 하우스 관련 변수
- private boolean bUseofNot_ZeroEnergyHouseInfo = false;
- private int cGetZeroEnergyHouseMin = 12;
- iMAPEnergyServer_Realmeter iMAPenergyServer_Realmeter;
- iMAPEnergyServer_EnergyMeter iMAPenergyServer_EnergyMeter;
- iMAPEnergyServer_EnergyModule iMAPenergyServer_EnergyModule;
- String DayofLastSecond = "2000-01-01 00:00:00";
- boolean DayofLastBoolean = false;
- //에너지관리서버 관련 변수
- private boolean bUseofNot_EnergyServer = false;
-
- //에너지 알람 발생 관련 변수
- private boolean bUseofNot_EnergyAlarm = false;
- private boolean ResultGetIntent = false;
-
- private String elect_target = "Error";
- private String elect_used = "Error";
- private String elect_info = "Error";
-
- private String water_target = "Error";
- private String water_used = "Error";
- private String water_info = "Error";
-
- private String gas_target = "Error";
- private String gas_used = "Error";
- private String gas_info = "Error";
-
- private String hotwater_target = "Error";
- private String hotwater_used = "Error";
- private String hotwater_info = "Error";
-
- private String heating_target = "Error";
- private String heating_used = "Error";
- private String heating_info = "Error";
- /**
- * 월패드 이벤트 알림 관련 변수
- */
- // 스마트 우편, 전기차 충전 사용 여부
- public static boolean bSmartPostUsage = false, bElecVehicleUsage = false;
- // 부재중 전화, 방문객 사진, 공지사항, 택배, 스마트 우편, 전기차 충전 이벤트 개수
- public static int nMissedCallCnt = 0, nVisitorPicCnt = 0, nNoticeCnt = 0, nParcelCnt = 0, nPostCnt = 0, nElecVehicleChangingCnt = 0;
-
- // 끝
- IconManager mIconManager;
- public IconInfoTable mIconInfoTable;
- public static int nShortcutCnt = 0;
- public static int nShortcutMax = 12;
- public static int nShortcutCnt_HS = 0;
- public static int nShortcutMax_HS = 9;
- public static int nShortcutCnt_Metro = 0;
- public static int nShortcutMax_Metro = 3;
- int nIconsOnSubScreen = 24;
- public static List<WallpadStatusData.WidgetItem> MainScreenShortcutList;
- public static List<WallpadStatusData.WidgetItem> HSScreenShortcutList;
- public static List<WallpadStatusData.WidgetItem> MetroScreenShortcutList;
- // 조명상태를 관리하기 위한 클래스
- public static class LightInfo {
- public class Preset {
- public class Lights {
- public String ONOFF = "none";
- public int DIM = 0;
- public int COLOR = 0;
- public Lights() {
- ONOFF = "none";
- DIM = 0;
- COLOR = 0;
- }
- }
- public Lights[] mLights;
- public Preset() {
- mLights = new Lights[9]; // 0번지는 프리셋별 그룹제어 설정값 (조명 1~8)
- for (int i = 0; i < mLights.length; i++) {
- mLights[i] = new Lights();
- }
- }
- }
- public Preset[] mPreset;
- public int nLightPresetNo;
- public LightInfo() {
- mPreset = new Preset[9]; // 0번지는 전체제어 설정값 (프리셋 1~8)
- for (int i = 0; i < mPreset.length; i++) {
- mPreset[i] = new Preset();
- }
- nLightPresetNo = 0;
- }
- }
- public static LightInfo mLightInfo;
- public String BR_CTRL_LIGHT_LIVINGROOM = "kr.co.icontrols.wallpadglobalscreen.BR_CTRL_LIGHT_LIVINGROOM";
- public static WpadSound mSound;
- public void getLivinglightPreset() {
- try {
- WallpadStatusData mWallpadStatusData = new WallpadStatusData(this);
- String[] strEntireValue = mWallpadStatusData.getLivinglightModeCtrlEntireValue();
- mWallpadStatusData.closeDB();
- Log.i(TAG, "[getLivinglightPreset] strEntireValue.length = " + strEntireValue.length);
- for (int i = 0; i < strEntireValue.length; i++) {
- Log.i(TAG, "[getLivinglightPreset] strEntireValue[" + i + "] = " + strEntireValue[i]);
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] getLivinglightPreset()");
-
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public void initLivinglightPreset() {
- WallpadStatusData mWallpadStatusData = new WallpadStatusData(this);
- try {
- if (Version.getModelType() == Version.MODEL_TYPE.IHN_D101 || Version.getModelType() == Version.MODEL_TYPE.IHN_D101_I || Version.getModelType() == MODEL_TYPE.IHN_D101_I_LX2
- || Version.getModelType() == Version.MODEL_TYPE.IHN_D101K || Version.getModelType() == Version.MODEL_TYPE.IHN_D101K_I
- || Version.getModelType() == MODEL_TYPE.IHN_D101_I_OCF) {
- Log.i(TAG, "[initLivinglightPreset] Initialize preset for IHN-D101");
- for (int i = 1; i < 5; i++) {
- String strPreset = mWallpadStatusData.getLivinglightModeCtrlUnitValues(i, 0);
- Log.i(TAG, "[initLivinglightPreset] i = " + i + ", strPreset = " + strPreset);
- String[] strParse = strPreset.split(":");
- if (strParse[1].equalsIgnoreCase("0") || strParse[2].equalsIgnoreCase("0")) {
- if (i == 1) {
- mLightInfo.mPreset[i].mLights[0].ONOFF = "on";
- mLightInfo.mPreset[i].mLights[0].DIM = 7;
- mLightInfo.mPreset[i].mLights[0].COLOR = 5;
- }
- else if (i == 2) {
- mLightInfo.mPreset[i].mLights[0].ONOFF = "on";
- mLightInfo.mPreset[i].mLights[0].DIM = 3;
- mLightInfo.mPreset[i].mLights[0].COLOR = 2;
- }
- else if (i == 3) {
- mLightInfo.mPreset[i].mLights[0].ONOFF = "on";
- mLightInfo.mPreset[i].mLights[0].DIM = 1;
- mLightInfo.mPreset[i].mLights[0].COLOR = 1;
- }
- mWallpadStatusData.setLivinglightModeCtrlUnitValues(i, 0, mLightInfo.mPreset[i].mLights[0].ONOFF, mLightInfo.mPreset[i].mLights[0].DIM, mLightInfo.mPreset[i].mLights[0].COLOR);
- }
- else {
- mLightInfo.mPreset[i].mLights[0].ONOFF = strParse[0];
- mLightInfo.mPreset[i].mLights[0].DIM = Integer.parseInt(strParse[1]);
- mLightInfo.mPreset[i].mLights[0].COLOR = Integer.parseInt(strParse[2]);
- }
- }
- }
- else if (Version.getModelType() == MODEL_TYPE.IHN_1010 || Version.getModelType() == MODEL_TYPE.IHN_1010_I || Version.getModelType() == MODEL_TYPE.IHN_1010_I_LX2) {
- Log.i(TAG, "[initLivinglightPreset] Initialize preset for IHN-1010(-I)");
- if (getKCCDimmingCtrl()) {
- for (int i = 1; i < 5; i++) {
- String strPreset = mWallpadStatusData.getLivinglightModeCtrlUnitValues(i, 0);
- Log.i(TAG, "[initLivinglightPreset] i = " + i + ", strPreset = " + strPreset);
- String[] strParse = strPreset.split(":");
- if (strParse[1].equalsIgnoreCase("0") || strParse[2].equalsIgnoreCase("0")) {
- if (i == 1) {
- mLightInfo.mPreset[i].mLights[0].ONOFF = "on";
- mLightInfo.mPreset[i].mLights[0].DIM = 10;
- mLightInfo.mPreset[i].mLights[0].COLOR = 5;
- }
- else if (i == 2) {
- mLightInfo.mPreset[i].mLights[0].ONOFF = "on";
- mLightInfo.mPreset[i].mLights[0].DIM = 7;
- mLightInfo.mPreset[i].mLights[0].COLOR = 2;
- }
- else if (i == 3) {
- mLightInfo.mPreset[i].mLights[0].ONOFF = "on";
- mLightInfo.mPreset[i].mLights[0].DIM = 5;
- mLightInfo.mPreset[i].mLights[0].COLOR = 1;
- }
- else if (i == 4) {
- mLightInfo.mPreset[i].mLights[0].ONOFF = "on";
- mLightInfo.mPreset[i].mLights[0].DIM = 2;
- mLightInfo.mPreset[i].mLights[0].COLOR = 1;
- }
- mWallpadStatusData.setLivinglightModeCtrlUnitValues(i, 0, mLightInfo.mPreset[i].mLights[0].ONOFF, mLightInfo.mPreset[i].mLights[0].DIM, mLightInfo.mPreset[i].mLights[0].COLOR);
- }
- else {
- Log.i(TAG, "[initLivinglightPreset] i = " + i + ", strPreset = " + strPreset);
- Log.i(TAG, "[initLivinglightPreset] mLightInfo.mPreset[" + i + "].mLights[0].ONOFF = " + mLightInfo.mPreset[i].mLights[0].ONOFF);
- Log.i(TAG, "[initLivinglightPreset] mLightInfo.mPreset[" + i + "].mLights[0].ONOFF = " + mLightInfo.mPreset[i].mLights[0].DIM);
- Log.i(TAG, "[initLivinglightPreset] mLightInfo.mPreset[" + i + "].mLights[0].ONOFF = " + mLightInfo.mPreset[i].mLights[0].COLOR);
- }
- }
- }
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] initLivinglightPreset()");
-
- LogUtil.errorLogInfo("", TAG, e);
- }
- mWallpadStatusData.closeDB();
- }
- private boolean getKCCDimmingCtrl() {
- try {
- Log.i(TAG, "[getKCCDimmingCtrl] ========== START ==========");
- WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(mContext);
- int nEnable = mWallpadDeviceSet.GetDeviceSetted("KCC디밍제어기");
- mWallpadDeviceSet.closeDB();
- Log.i(TAG, "[getKCCDimmingCtrl] nEnable [" + nEnable + "]");
- if (nEnable == WallpadDeviceSet.DEV_DATA_ENABLE) {
- Log.i(TAG, "[getKCCDimmingCtrl] Enabled");
- return true;
- }
- else {
- Log.i(TAG, "[getKCCDimmingCtrl] Disabled");
- return false;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] setKCCDimmingCtrl()");
-
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- private void initEscapeLadderDownSend() {
- try {
- WallpadDeviceSet deviceSet = new WallpadDeviceSet(getContext());
- if(deviceSet!=null)
- {
- int ladderDownSend = deviceSet.getEscapeLadderDownSend();
- boolean ladderDownRecv = deviceSet.GetEscapeLadderDownRecv(); // 기존 '피난사다리입하수신' 설정정보 (더이상 사용하지 않음 2021.01.28)\
- Log.d(TAG, "[initEscapeLadderDownSend] ladderDownRecv [" + ladderDownRecv + "]");
- if (ladderDownRecv) {
- if (ladderDownSend == WallpadDeviceSet.ESCAPELADDER_DOWN_SEND_NONE) {
- Log.d(TAG, "[initEscapeLadderDownSend] ===== first setting =====");
- deviceSet.setEscapeLadderDownSend(WallpadDeviceSet.ESCAPELADDER_DOWN_SEND_UPPER); // 신규 /'피난사다리전송' 설정정보 '윗집'
- } else {
- Log.d(TAG, "[initEscapeLadderDownSend] ladderDownSend [" + ladderDownSend + "]");
- }
- }
- deviceSet.closeDB();
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] initEscapeLadderDownSend()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public void CallSubMenuScreen(int screenID) {
- if (screenID >= ID.LINKEDSCREEN.SubMenuAddService.Notice && screenID <= ID.LINKEDSCREEN.SubMenuAddService.ElecCar) m_CallSubMenuScreen.callStartAddServiceAPK(screenID);
- else if (screenID >= ID.LINKEDSCREEN.SubMenuEnergy.RealTimeCheckMeter && screenID <= ID.LINKEDSCREEN.SubMenuEnergy.IEnergy) m_CallSubMenuScreen.callStartEnergyAPK(screenID);
- }
-
- private void restoreSystemVolume() {
- try {
- String strCurrentTopPackage = getTopActivity();
- Log.i(TAG, "[restoreSystemVolume] strCurrentTopPackage = " + strCurrentTopPackage);
- WallpadStatusData wdb = new WallpadStatusData(this.getContext());
- int nSavedVolume = wdb.GetWallPadMasterVolume();
- wdb.closeDB();
- final AudioManager audioManager = (AudioManager)this.getContext().getSystemService(this.getContext().AUDIO_SERVICE);
- int nCurrentVolume = audioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
- audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, nSavedVolume , 0);
- Log.i(TAG, "[restoreSystemVolume] #Before# nCurrentVolume = " + nCurrentVolume + ", #After# nSavedVolume = " + nSavedVolume);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] restoreSystemVolume()");
-
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- // =================================================================================================
- // [[ Activity Life Cycle ]] region
- // =================================================================================================
- /**
- * Activity Constructors
- */
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- Log.i(TAG, "[onCreate] ========== START ==========");
- Log.w(TAG, "[onCreate] Start to check booting status!!!");
- Runtime mRuntime = Runtime.getRuntime();
- Process mProcess;
- int iDelayCount = 0;
- while (true) {
- try {
- String cmd = "getprop dev.bootcomplete";
- mProcess = mRuntime.exec(cmd);
- BufferedReader br = new BufferedReader(new InputStreamReader(mProcess.getInputStream()));
- String line;
- String strResult = null;
- while ((line = br.readLine()) != null) {
- strResult = line;
- }
- if (strResult!=null && strResult.equals("1")) {
- File sdcard = new File("/storage/emulated/0");
- if(sdcard.exists() == true) {
- iDelayCount = 0;
- Thread.sleep(1000);
- break;
- }
- }
- {
- iDelayCount++;
- Thread.sleep(100);
- }
- if (iDelayCount > 400) {
- cmd = "setprop persist.sys.reboot 1";
- mProcess = mRuntime.exec(cmd);
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] Checking device booting status -> Unable to execute top command");
- e.fillInStackTrace();
-
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- Log.w(TAG, "[onCreate] Device booting completed!!");
- Log.i(TAG, "[onCreate] Wallpad model name [" + Version.getModelType() + "]");
- if (Common.DIAGNOSTIC_MODE) {
- Log.i(TAG, "------------------ [START - DIAGNOSTIC_MODE] -------------------");
- setNetworkAddr( 2, 1, 3);
- }
- // @ AutoScale 설정 - 1.
- if (WpadScale.getWidthPixels() == 800 && WpadScale.getHeightPixels() == 480) {
- // 800x480 일 경우에만 AutoScale 을 설정한다.
- Log.i(TAG, "[onCreate] Wallpad LCD resolution. -> Width [" + WpadScale.getWidthPixels() + "], Height [" + WpadScale.getHeightPixels() + "] -> setAutoScale ON !!!");
- WpadScale.setAutoScale(true);
- }
- else if (WpadScale.getWidthPixels() == 1366 && WpadScale.getHeightPixels() == 768) {
- // 800x480 일 경우에만 AutoScale 을 설정한다.
- Log.i(TAG, "[onCreate] Wallpad LCD resolution. -> Width [" + WpadScale.getWidthPixels() + "], Height [" + WpadScale.getHeightPixels() + "] -> setAutoScale ON !!!");
- WpadScale.setAutoScale(true);
- WpadScale.changeAutoScaleValue(1024, 600);
- }
-
- // @ AutoScale 설정 - 2. 에너지관리화면을 위한 구분자 설정
- if ((WpadScale.getWidthPixels() == 1024) && (WpadScale.getHeightPixels() == 600)) {
- Common.SCREEN_TYPE = Common.SCREEN_TYPE_1024x600;
- }
- else if ((WpadScale.getWidthPixels() == 1280) && (WpadScale.getHeightPixels() == 800)) {
- Common.SCREEN_TYPE = Common.SCREEN_TYPE_1280x800;
- }
- else if ((WpadScale.getWidthPixels() == 800) && (WpadScale.getHeightPixels() == 480)) {
- Common.SCREEN_TYPE = Common.SCREEN_TYPE_800x480;
- }
- else if ((WpadScale.getWidthPixels() == 1366) && (WpadScale.getHeightPixels() == 768)) {
- Common.SCREEN_TYPE = Common.SCREEN_TYPE_1024x600;
- }
- Log.d(TAG, "[onCreate] SCREEN_TYPE: " + Common.SCREEN_TYPE);
-
-
- super.setFinishBrEnable(false);
- super.AppVersionLogOut(); // [APP Version] + [WallPadSupport Lib Version] 을 로그로 출력한다.
-
- LayoutDevice.InitGetScreenSize(this.getWindowManager(), getApplicationContext() );
- try {
- // 최초 DB 폴더가 생성되어 있지 않으면 폴더를 생성하도록 한다.
- File dbhome = new File(wallpaddbmgr.dblocation);
- Log.d(TAG, "[Create] - Step0.3 : dbhome path [" + dbhome.getPath() + "]");
- if (dbhome.exists() == false) {
- dbhome.mkdir();
- Log.d(TAG, "[Create] - Step0.3 : Make DB Folder");
- }
- else {
- Log.d(TAG, "[Create] - Step0.3 : DB exists");
- }
- WallpadStatusData mWallpadStatusData = new WallpadStatusData(getApplicationContext());
- if (mWallpadStatusData != null) {
- DebugLogOutput("[Create] - Step0.3 : WallpadStatusData Open OK");
- mWallpadStatusData.closeDB();
- }
- else {
- DebugLogOutput("[Create] - Step0.3 : WallpadStatusData Open FAIL");
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- LogUtil.errorLogInfo("", TAG, e);
- }
- DebugLogOutput("[Create] - Step0.5 : WallpadStatusData end");
-
- Log.i("Version", "<><><><> WallPadAPI Version = [" + define.WALLPADAPI_VERSION + "] " + "<><><><>");
- checkISSEnergyType();
- runDeviceService();
- if (Version.getModelType() == MODEL_TYPE.IHN_D101_I_OCF) {
- DebugLogOutput("[Create] This is the OCF WallPad!!!");
- runOcfService();
- }
- //vip
- runMultiControlService();
- WallpadStatusData dbMGR = new WallpadStatusData(this.getContext());
- wallpaddbmgr.AddressSet addrSet = dbMGR.getAddressMGR();
- dbMGR.closeDB();
- String strHo = addrSet.Ho;
- //Log.d("TEST1", "strHo " + strHo);
- if(!strHo.contains("NONE"))
- {
- myIP = addrSet.IPAddress;
- ho = Integer.valueOf(strHo.substring(0,1));
- }
- //vip
- // 1. 변수 초기화
- DebugLogOutput("[Create] - Step1 : EMData Create");
- PopupActivityRun = false;
- InfoActivityRun = false;
- mContext = this;
- setCallAppRunning(false); // 메인앱 초기화시 통화앱 미실행값을 DB에 저장
- // 2. 자동 종료 셋팅
- DebugLogOutput("[Create] - Step2 : Auto Finish Setting");
-
- // 3. API 호출
- DebugLogOutput("[Create] - Step3 : API Call");
- // 3.1. mWallPadAPI 생성
- try {
- mWallPadAPI = new WallPadAPI(this);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[ExceptionError] - new WallPadAPI : " + e);
-
- LogUtil.errorLogInfo("", TAG, e);
- }
- initIOInterface(mWallPadAPI);
- Common.CurrentBoardType = mIOInterface.getBoardType(Version.getModelType());
- mIOInterface.initCameraOnOFF();
- mIOInterface.getCameraOnOFF();
- DebugLogOutput("[Create] - Step3.5 : API Call end");
- if (Common.GetDeviceSampleMode(this)) {
- Log.d(TAG, "[Create] OperationMode = MODE_BUSINESS_SAMPLE");
- DEVICE_OPERATION_MODE = Common.MODE_BUSINESS_SAMPLE;
- }
- else {
- Log.d(TAG, "[Create] OperationMode = MODE_NOMAL");
- DEVICE_OPERATION_MODE = Common.MODE_NOMAL;
- }
- // 분전반 정보 가져오기
- WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(this);
- Common.CurrentDistributionPanelType = mWallpadDeviceSet.Get_DistributionPannelType_Info();
- mWallpadDeviceSet.closeDB();
-
- // 4. Layout registration
- DebugLogOutput("[Create] - Step4 : Layout registration");
- Common.eGUIType = checkGUIType(this.getContext());
- Log.i(TAG, "[Create] eGUIType = " + Common.eGUIType);
- mIconManager = new IconManager(mContext, mWallPadAPI);
- if (mIconManager == null) {
- Log.w(TAG, "[Create] mIconManager is null!!");
- }
- mIconInfoTable = mIconManager.getAvailableIcons();
- if (mIconInfoTable == null) {
- Log.w(TAG, "[Create] mIconInfoTable is null!!");
- }
- else {
- Log.i(TAG, "[Create] mIconInfoTable.getCnt() = " + mIconInfoTable.getCnt());
- }
- WallpadDeviceSet deviceSet = new WallpadDeviceSet(mContext);
- boolean bSupport = deviceSet.Get_EasyModeUX_Support();
- deviceSet.closeDB();
- WallpadStatusData mWallpadStatusData = new WallpadStatusData(getApplicationContext());
- if (!bSupport) {
- mWallpadStatusData.SetEasyModeUxUse(false);
- }
- bEasyModeUsage = bSupport & mWallpadStatusData.GetEasyModeUxUse();
- mWallpadStatusData.closeDB();
- // Sound API 등록
- mSound = new WpadSound(this);
-
- // 메인화면 레이아웃
- MainLayout = new RelativeLayout(this);
- RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(WpadScale.getWidthPixels(), WpadScale.getHeightPixels());
- MainLayout.setLayoutParams(params);
- MainLayout.setId(ID_OLD.main.layout.ALL);
- super.setAllLayoutRegistration(MainLayout);
-
- // 메인화면 스크린 레이아웃
- MainScreenLayout = new RelativeLayout(this);
- WpadUtil.LayoutRegistration(MainLayout, MainScreenLayout, WpadScale.getWidthPixels(), WpadScale.getHeightPixels(), 0, 0, ID_OLD.main.layout.SCREEN);
- if (getWallPadCameraUsage() && (Common.CurrentBoardType == Common.BOARD_TYPE.V40 || Common.CurrentBoardType == Common.BOARD_TYPE.V40_NOUGAT)) {
- Log.i(TAG, "[Create] SurfaceLayout Registration!!!");
- SurfaceLayout = new RelativeLayout(this);
- WpadUtil.LayoutRegistration(MainLayout, SurfaceLayout, WpadScale.getWidthPixels(), WpadScale.getWidthPixels(), 0, 0, ID.MAINACTIVITY.LAYOUT.SURFACE);
- }
- if (Common.eGUIType == Common.GUI_TYPE.STANDARD) nIconsOnSubScreen = 24;
- // else if (eGUIType == GUI_TYPE.METRO) nIconsOnSubScreen = 15;
- else nIconsOnSubScreen = 24;
- // 서브화면 1 레이아웃
- if (mIconInfoTable.getCnt() > 0) {
- SubLayout_01 = new RelativeLayout(this);
- params = new RelativeLayout.LayoutParams(WpadScale.getWidthPixels(), WpadScale.getHeightPixels());
- SubLayout_01.setLayoutParams(params);
- SubLayout_01.setId(ID_OLD.main.layout.ALL);
- super.setAllLayoutRegistration(SubLayout_01);
- // 서브화면 1 스크린 레이아웃
- SubScreenLayout_01 = new RelativeLayout(this);
- WpadUtil.LayoutRegistration(SubLayout_01, SubScreenLayout_01, WpadScale.getWidthPixels(), WpadScale.getHeightPixels(), 0, 0, ID_OLD.main.layout.SCREEN);
- }
- // 서브화면 2 레이아웃
- if (mIconInfoTable.getCnt() > nIconsOnSubScreen) {
- SubLayout_02 = new RelativeLayout(this);
- params = new RelativeLayout.LayoutParams(WpadScale.getWidthPixels(), WpadScale.getHeightPixels());
- SubLayout_02.setLayoutParams(params);
- SubLayout_02.setId(ID_OLD.main.layout.ALL);
- super.setAllLayoutRegistration(SubLayout_02);
- // 서브화면 2 스크린 레이아웃
- SubScreenLayout_02 = new RelativeLayout(this);
- WpadUtil.LayoutRegistration(SubLayout_02, SubScreenLayout_02, WpadScale.getWidthPixels(), WpadScale.getHeightPixels(), 0, 0, ID_OLD.main.layout.SCREEN);
- }
- // 간편모드 메인화면 레이아웃
- if (bEasyModeUsage) {
- EasyMainLayout = new RelativeLayout(this);
- params = new RelativeLayout.LayoutParams(WpadScale.getWidthPixels(), WpadScale.getHeightPixels());
- EasyMainLayout.setLayoutParams(params);
- EasyMainLayout.setId(ID_OLD.main.layout.ALL);
- super.setAllLayoutRegistration(EasyMainLayout);
- // 간편모드 메인화면 스크린 레이아웃
- EasyMainScreenLayout = new RelativeLayout(this);
- WpadUtil.LayoutRegistration(EasyMainLayout, EasyMainScreenLayout, WpadScale.getWidthPixels(), WpadScale.getHeightPixels(), 0, 0, ID_OLD.main.layout.SCREEN);
- }
-
- m_ModelHouseSleepModeRelease= Common.GetModelHouseSleepModeRelease(this);
- Log.d(TAG, " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% =====> GetModelHouseSleepModeRelease :" + m_ModelHouseSleepModeRelease);
- if (m_ModelHouseSleepModeRelease) {
- mLCD_SleepHandler.sendEmptyMessageDelayed(0, (30 * 1000));
- }
-
- // 5. Top Menu - ImageView registration
- DebugLogOutput("[Create] - Step5 : Top Menu - ImageView registration");
- // 6. Tab Menu - ImageView registration
- restoreSystemVolume();
- initProximitySensor();
-
-
- // 서브 스크린 호출하기 위한 메뉴 리스트 관리 클래스
- m_CallSubMenuScreen = new CallSubMenuScreen( this , mWallPadAPI);
- if (Common.eGUIType == Common.GUI_TYPE.STANDARD) {
- // 메인화면 3가지 등록으로 인해 변경
- MainScreen = new MAIN(this, MainScreenLayout, mWallPadAPI, m_CallSubMenuScreen, DEVICE_OPERATION_MODE);
- // EasyUI_MainScreen = new EASYUI_MAIN(this, MainScreenLayout, mWallPadAPI, m_CallSubMenuScreen);
- }
- else if (Common.eGUIType == Common.GUI_TYPE.METRO) {
- MetroUI_MainScreen = new METROUI_MAIN(this, MainScreenLayout, mWallPadAPI, m_CallSubMenuScreen);
- }
- else if (Common.eGUIType == Common.GUI_TYPE.HYOSUNG) {
- Hyosung_HN_MainScreen = new HYOSUNGUI_MAIN_HN(this, MainScreenLayout, mWallPadAPI, m_CallSubMenuScreen);
- }
- else {
- MainScreen = new MAIN(this, MainScreenLayout, mWallPadAPI, m_CallSubMenuScreen, DEVICE_OPERATION_MODE);
- }
-
- DebugLogOutput("[Create] - Step6 : Main Screen registration");
- // 7. Draw
- DebugLogOutput("[Create] - Step7 : setContentView");
- try {
- if (Common.eGUIType == Common.GUI_TYPE.STANDARD) {
- if (mIconInfoTable.getCnt() > nIconsOnSubScreen) setContentView(R.layout.main);
- else setContentView(R.layout.main_2);
- }
- else if (Common.eGUIType == Common.GUI_TYPE.METRO) setContentView(R.layout.main_metro);
- else if (Common.eGUIType == Common.GUI_TYPE.HYOSUNG) setContentView(R.layout.main_hyosung);
- else {
- if (mIconInfoTable.getCnt() > nIconsOnSubScreen) setContentView(R.layout.main);
- else setContentView(R.layout.main_2);
- }
- if (bEasyModeUsage) setContentView(R.layout.main_easy);
- // setContentView(R.layout.main);
- // 메인화면 3가지로 슬라이딩 방식으로 구현하기 위하여 뷰플리퍼를 사용하여 처리
- mViewFlipper = (ViewFlipper) findViewById(R.id.viewFlipper);
- if (mViewFlipper != null) {
- if (MainLayout != null) mViewFlipper.addView(MainLayout);
- if (SubLayout_01 != null) mViewFlipper.addView(SubLayout_01);
- if (SubLayout_02 != null && Common.eGUIType == Common.GUI_TYPE.STANDARD) mViewFlipper.addView(SubLayout_02);
- if (EasyMainLayout != null && bEasyModeUsage) mViewFlipper.addView(EasyMainLayout);
- DebugLogOutput("[Create] - Step8 : Add Flipper !!! ");
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
-
- LogUtil.errorLogInfo("", TAG, e);
- }
- registerBroadcastReceiver();
- Check_Upgrade_File();
-
- //앱 버전정보 DB저장
- try {
- Log.d(TAG, "mThread_getAppsVersion Start!! ");
- if (mThread_getAppsVersion== null) {
- mThread_getAppsVersion = new getInstalledPackageInfo();
- mThread_getAppsVersion.start();
- }
- else {
- Log.w(TAG, "mThread_getAppsVersion is null!!");
- }
- Log.d(TAG, "mThread_getAppsVersion End!! ");
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
-
- LogUtil.errorLogInfo("", TAG, e);
- }
-
- try {
- WallpadStatusData SetData = new WallpadStatusData(getApplicationContext());
- AddressSet addc = SetData.getAddressMGR();
- AddressSetBackup addc_Backup = SetData.getAddressMGR_Backup();
- overridePendingTransition(0, 0);
-
- if (!isSystemIPSet()) {
- Log.w(TAG, "[onCreate] The IP Address of OS is not set!");
- startManagerSettingSetAddress();
- }
- else if (addc.Dong.equals("NONE") || addc.Ho.equals("NONE")) {
- Log.w(TAG, "[onCreate] The info. of resi. is not set! [primary db]");
- if (addc_Backup.Dong.equals("NONE") || addc_Backup.Ho.equals("NONE")) {
- Log.w(TAG, "[onCreate] The info. of resi. is not set! [secondary db]");
- startManagerSettingSetAddress();
- }
- else {
- addc.setAddress(addc_Backup.Dong, addc_Backup.Ho);
- addc.setIPAddress(addc_Backup.IPAddress);
-
- m_IPActivity = true;
- if (addc.IPAddress!=null && !addc.IPAddress.equals("NONE")) {
- Log.w(TAG, "[onCreate] ========== start iMapServer service ========== [secondary db]");
- Intent intent = new Intent(getApplicationContext(), iMapServer.class);
- startService(intent);
- //impaserver에 멀티 정보 제공을 위해 통신으로 추가
- bindService(new Intent(this, iMapServer.class), mConnection, Context.BIND_AUTO_CREATE);
- mIsBound = true;
- Intent intentMobile = new Intent(getApplicationContext(), MobileProcService.class);
- Log.w(TAG, "[onCreate] ========== start MobileProcServicee ========== [secondary db]");
- startService(intentMobile);
- }
- MAINStatus = MAIN_NORMAL;
- }
- }
- else {
- m_IPActivity = true;
- if (!addc.IPAddress.equals("NONE")) {
- Log.w(TAG, "[onCreate] ========== start iMapServer service ========== [primary db]");
- Intent intent = new Intent(this, iMapServer.class);
- startService(intent);
- //impaserver에 멀티 정보 제공을 위해 통신으로 추가
- bindService(new Intent(this, iMapServer.class), mConnection, Context.BIND_AUTO_CREATE);
- mIsBound = true;
- Intent intentMobile = new Intent(getApplicationContext(), MobileProcService.class);
- Log.w(TAG, "[onCreate] ========== start MobileProcServicee ========== [secondary db]");
- startService(intentMobile);
- }
- MAINStatus = MAIN_NORMAL;
- }
- SetData.closeDB();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] check device addresses(ip, resi. info.)");
-
- LogUtil.errorLogInfo("", TAG, e);
- }
-
- //주차정보 사용여부 체크
- getParkedVehicleLocationSysInfo();
- //전기차 정보 가져오기
- GetElectricCarInfo();
-
- //에너지관리서버 사용여부 가져오기
- GetEnergyServerInfo();
- //에너지 알람 사용여부 가져오기
- GetEnergyAlarm();
- //통화타임아웃 초기화
- setCallAppTimeoutAsDefault();
- //카카오홈 사용 여부 체크(카카오홈)
- boolean isUseKakao = getKakaoHomeCheck();
- if(isUseKakao)
- {
- WallpadStatusData wdb = new WallpadStatusData(this.getContext());
- if (wdb != null) {
- Log.d(TAG, "[DB SAVE]-WallpadStatusData.ALARM_STOP ");
- if(wdb.GetAlarmStatus() != WallpadStatusData.GUARD_OUT)
- {
- Handler mHandler = new Handler();
- mHandler.postDelayed(mLaunchTaskKakao, 500);
- mHandler = null;
- }
- wdb.closeDB();
- }
- }
- try {
- mWallPadApiCheckHandler.sendEmptyMessage(0);
- // Checker.sendEmptyMessageDelayed(0, 1000);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
-
- LogUtil.errorLogInfo("", TAG, e);
- }
-
-
- // sip 서비스 실행 옮김
- Log.d(TAG, "[onCreate] startCallService start");
- try {
- runCallServices startCallService = new runCallServices();
- startCallService.start();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
-
- LogUtil.errorLogInfo("", TAG, e);
- }
- Log.d(TAG, "[onCreate] startCallService end");
-
- try {
- // 부팅하고 나서 업그레이드 상태를 false 로 해주지 않으면 통화 수신이 안됨
- // 꼭 들어가야 함
-
- // 전체 정전시험시 단지서버도 재부팅은 하나 로긴을 하지 않으면 그시간동안 세대기가 보낸 부트업 메세지를 못 받기 때문에....단말기 시간을 재 셋팅해주도록 한다.
- Calendar cal = new GregorianCalendar();
- String timedata = String.format("%04d",cal.get(Calendar.YEAR))+"."+String.format("%02d",cal.get(Calendar.MONTH)+1)+"."+String.format("%02d",cal.get(Calendar.DAY_OF_MONTH))+"."+String.format("%02d",cal.get(Calendar.HOUR_OF_DAY))+"."+String.format("%02d",cal.get(Calendar.MINUTE))+"."+String.format("%02d",cal.get(Calendar.SECOND));
-
- WallpadStatusData wpd = new WallpadStatusData(getApplicationContext());
- wpd.SetUpgradeState(false);
- wpd.SetLastHeartbeat(timedata);
- wpd.closeDB();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
-
- LogUtil.errorLogInfo("", TAG, e);
- }
-
- try {
- Calendar m_CurCalendar = Calendar.getInstance();
- //CurYear , CurMonth, CurDate, CurHour, CurMin, CurSecond;
- int CurYear = m_CurCalendar.get(Calendar.YEAR);
-
- if (CurYear < 2018) {
- WallpadStatusData DBMGR = new WallpadStatusData(getApplicationContext());
- DBMGR.setSystemTime(2018, 8, 1, 13, 0, 0);
- DBMGR.closeDB();
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
-
- LogUtil.errorLogInfo("", TAG, e);
- }
- mLightInfo = new LightInfo();
- getLivinglightPreset();
- initLivinglightPreset();
- getLivinglightPreset();
- initEscapeLadderDownSend();
- setPageIndicator();
- mGetCallHistoryCheckHandler.sendEmptyMessageDelayed(0, 10000);
- try {
- int getSleepTime = Settings.System.getInt(this.getContext().getContentResolver(), SCREEN_OFF_TIMEOUT);
- int mSleepModeTime = (getSleepTime / 1000);
- Log.d(TAG, "[Create] mSleepModeTime [" + mSleepModeTime + "]");
- if (mSleepModeTime <= 30) {
- Log.d(TAG, "[Create] Reset mSleepModeTime ===== [" + mSleepModeTime + "] =====");
- Settings.System.putInt(this.getContext().getContentResolver(), SCREEN_OFF_TIMEOUT, 28 * 1000); // 백라이트 off와 앱 종료가 동시에 일어나면 월패드가 비정상 종료되므로 수정 (2021.04.06 메이드인랩 김수진 선임 요청)
- }
- } catch (Settings.SettingNotFoundException e) {
- e.printStackTrace();
- }
- try {
- handlerEverySecond.sendEmptyMessageDelayed(0, 1000);
- // BSP 수정으로 인하여 해당 코드 삭제 (2021.02.24, SEULKI)
- // // 월패드 카메라 녹색 노이즈 시험 코드 (월패드 부팅시 월패드 카메라 영상을 잠시 띄운후 없앤다. JEFF/2020.01.21.01)
- // /**
- // * 부팅시 카메라 서비스 정상동작 여부를 확인한다. (Edited by jeff, 2020.09.08)
- // */
- // sendHandlerMsgDelayed(HANDLERMSG.CHECK_WALLPAD_CAMERA_CHECK, 0, 0, 0); // 5초후 월패드 카메라를 초기화 한다. (그냥 화면밖에 영상을 잠시 띄우고 5초뒤에 없앤다.)
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
-
- LogUtil.errorLogInfo("", TAG, e);
- }
- if (bKakaoiEnable) {
- Log.i(TAG, "[onCreate] ========== Kakao function enabled ==========");
- startKakaoiFloatingBTN();
- }
- // forceCtrlStrangerRecordingUserSettingDisable(false);
- getLCDKeeperUsage();
- // 거주자 안전확인 서비스 사용여부 확인하고, 화면 WallPadSupport Lib.에 관련 설정을 한다.
- getResidentSafetyCheckSetting();
- Log.i(TAG, "[onCreate] ==================== onCreate end ====================");
- }
- private void setKaKaOWallPadSerialNumber(String SerialNumber)
- {
- SharedPreferences prefs = mContext.getSharedPreferences("KaKaO", Context.MODE_PRIVATE);
- SharedPreferences.Editor editor = prefs.edit();
- editor.putString("Serial", SerialNumber);
- editor.commit();
- }
- private String getKaKaOWallPadSerialNumber()
- {
- SharedPreferences prefs = mContext.getSharedPreferences("KaKaO", Context.MODE_PRIVATE);
- String serial = prefs.getString("Serial", "");
- return serial;
- }
- private String MakeKaKaOWallPadSerialNumber()
- {
- WallpadDeviceSet devset = new WallpadDeviceSet(mContext);
- String[] SiteCode = devset.GetSettingData("site_code");
- devset.closeDB();
- String code = "" ;
- if ((SiteCode != null) && SiteCode.length > 1) {
- code = SiteCode[1];
- }
- WallpadStatusData DBMGR = new WallpadStatusData(this.getContext());
- wallpaddbmgr.AddressSet addr = DBMGR.getAddressMGR();
- DBMGR.closeDB();
- String strDong = addr.Dong;
- String strHo = addr.Ho;
- String strType = "wallpad";
- for (int i = 4 - strDong.length(); i > 0; i--) {
- strDong = "0" + strDong;
- }
- for (int i = 4 - strHo.length(); i > 0; i--) {
- strHo = "0" + strHo;
- }
- String strPostNumber = "01";
- String serial = code + "_"
- + strType + "_"
- + strDong + "_"
- + strHo + "_"
- + strPostNumber
- ;
- Log.d(TAG, " makeSipID() ret : " + serial);
-
- //여기서 공통된 Preference 선언해서 저장
- SharedPreferences sharedPreference = this.getSharedPreferences("KaKaOData", Context.MODE_MULTI_PROCESS | Context.MODE_WORLD_READABLE);
- SharedPreferences.Editor editor = sharedPreference.edit();
- editor.putString("Serial",serial);
- editor.commit();
- return serial;
- }
- /**
- * 카카오 실행 관련 핸들러
- */
- private Runnable mLaunchTaskKakao = new Runnable() {
- public void run() {
- String Packagename = "com.hdc_icontrols.kakao.stage";
- //Handler를 이용하여 Timer 사용
- Intent mainIntent = mContext.getPackageManager().getLaunchIntentForPackage(Packagename);
- if (mainIntent != null) {
- String serial = getKaKaOWallPadSerialNumber();
- if(serial.equals(""))
- {
- serial = MakeKaKaOWallPadSerialNumber();
- setKaKaOWallPadSerialNumber(serial);
- }
- else {
- String[] serial_data = serial.split("_");
- if(serial_data!=null)
- {
- if(serial_data.length != 5)
- {
- //다시 만들어야 함
- serial = MakeKaKaOWallPadSerialNumber();
- setKaKaOWallPadSerialNumber(serial);
- }
- else if(serial_data.length == 5)
- {
- //ip정보(동,호 정보)
- WallpadStatusData DBMGR = new WallpadStatusData(mContext);
- wallpaddbmgr.AddressSet addr = DBMGR.getAddressMGR();
- DBMGR.closeDB();
- String strDong = addr.Dong;//3번쨰
- String strHo = addr.Ho;//4번쨰
- for (int i = 4 - strDong.length(); i > 0; i--) {
- strDong = "0" + strDong;
- }
- for (int i = 4 - strHo.length(); i > 0; i--) {
- strHo = "0" + strHo;
- }
- if(!serial_data[2].equals(strDong) || !serial_data[3].equals(strHo))
- {
- //다시 만들어야 함
- serial = MakeKaKaOWallPadSerialNumber();
- setKaKaOWallPadSerialNumber(serial);
- }
- }
- }
- }
- mainIntent.putExtra("SeriaData", serial);
- mainIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- startActivity(mainIntent);
- };
- }
- };
- private int nLCDKeeperType = WallpadDeviceSet.LCDKEEPER_NONE;
- private String getLCDKeeperType(int nLCDKeeperType) {
- try {
- Log.i(TAG, "[getLCDKeeperUsage] nLCDKeeperType [" + nLCDKeeperType + "]");
- if (nLCDKeeperType == WallpadDeviceSet.LCDKEEPER_NONE) return "LCDKEEPER_NONE";
- else if (nLCDKeeperType == WallpadDeviceSet.LCDKEEPER_PROTECT) return "LCDKEEPER_PROTECT";
- else if (nLCDKeeperType == WallpadDeviceSet.LCDKEEPER_RECOVER) return "LCDKEEPER_RECOVER";
- else if (nLCDKeeperType == WallpadDeviceSet.LCDKEEPER_PROTECT_RECOVER) return "LCDKEEPER_PROTECT_RECOVER";
- else return "UNKNOWN";
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return "ERROR";
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] getLCDKeeperType(int nLCDKeeperType)");
-
- LogUtil.errorLogInfo("", TAG, e);
- return "ERROR";
- }
- }
- private boolean bLCDKeeperUsage = false;
- private void getLCDKeeperUsage() {
- try {
- WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(getContext());
- nLCDKeeperType = mWallpadDeviceSet.getLCDKeeperUsage();
- mWallpadDeviceSet.closeDB();
- if (nLCDKeeperType == WallpadDeviceSet.LCDKEEPER_PROTECT || nLCDKeeperType == WallpadDeviceSet.LCDKEEPER_RECOVER || nLCDKeeperType == WallpadDeviceSet.LCDKEEPER_PROTECT_RECOVER) {
- bLCDKeeperUsage = true;
- }
- Log.i(TAG, "[getLCDKeeperUsage] bLCDKeeperUsage [" + bLCDKeeperUsage + "], nLCDKeeperType [" + getLCDKeeperType(nLCDKeeperType) + "]");
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] getLCDKeeperUsage()");
-
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public boolean isSystemIPSet() {
- try {
- Log.i(TAG, "[isSystemIPSet] START!");
- String strResult = "";
- if (Build.VERSION.SDK_INT > 23) {
- // Android 7
- strResult = getIPAddress();
- }
- else {
- // Android 6
- if(NetworkInterface.getByName("eth0")!=null)
- {
- String strNetInfo = NetworkInterface.getByName("eth0").toString();
- Log.i(TAG, "[isSystemIPSet] strNetInfo : " + strNetInfo + "]");
- strNetInfo.trim();
- String[] Parse_01 = strNetInfo.split("\\]");
- // for (int i = 0; i < Parse_01.length; i++) {
- // LOG_DEBUG("[getDeviceIPAddress] Parse_01[" + i + "] : " + Parse_01[i]);
- // }
- String[] Parse_02 = Parse_01[Parse_01.length - 1].split("\\/");
- // for (int i = 0; i < Parse_02.length; i++) {
- // LOG_DEBUG("[getDeviceIPAddress] Parse_02[" + i + "] : " + Parse_02[i]);
- // }
- strResult = Parse_02[1];
- }
- }
-
- Log.i(TAG, "[isSystemIPSet] DONE! [IP Address : " + strResult + "]");
-
- Pattern mPattern = Pattern.compile("^(([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.){3}([01]?\\d\\d?|2[0-4]\\d|25[0-5])$");
-
- return mPattern.matcher(strResult).matches();
-
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] isSystemIPSet()");
-
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- public static String getIPAddress() {
- try {
- List<NetworkInterface> interfaces = Collections.list(NetworkInterface.getNetworkInterfaces());
- for (NetworkInterface intf : interfaces) {
- List<InetAddress> addrs = Collections.list(intf.getInetAddresses());
- for (InetAddress addr : addrs) {
- if (!addr.isLoopbackAddress()) {
- String sAddr = addr.getHostAddress();
- //boolean isIPv4 = InetAddressUtils.isIPv4Address(sAddr);
- boolean isIPv4 = sAddr.indexOf(':')<0;
- if (isIPv4)
- return sAddr;
- }
- }
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] isSystemIPSet()");
-
- LogUtil.errorLogInfo("", TAG, e);
- }
- return "";
- }
- public void initIOInterface(WallPadAPI wallpadapi) {
- try {
- mIOInterface = new IOInterface(getContext(), wallpadapi);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] initIOInterface(WallPadAPI wallpadapi)");
-
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
-
- public void checkDongHoSetting() {
- try {
- Log.d(TAG, "[checkDongHoSetting] ========== START ==========");
- boolean IP_ExpansionSettingFlag = false;
- EthernetDevInfo info = new EthernetDevInfo();
-
- WallpadStatusData mWallpadStatusData = new WallpadStatusData(this.getContext());
- AddressSet addc = mWallpadStatusData.getAddressMGR();
- mWallpadStatusData.SetCallAPKStatus(false);
- mWallpadStatusData.closeDB();
-
- if (addc.Dong!=null && !addc.Dong.equals("NONE") && addc.Ho!=null&& !addc.Ho.equals("NONE") && addc.IPAddress!=null&& !addc.IPAddress.equals("NONE")) {
- if (Version.getModelType() == MODEL_TYPE.IHN_1020GL && Version.getModelType() == MODEL_TYPE.IHN_1020B_A
- && Version.getModelType() == MODEL_TYPE.IHN_1020SA_A && Version.getModelType() == MODEL_TYPE.IHN_750) {
- // LH 게이트웨이 때문에 위치 옮김 제어 서비스 보다 먼저 처리
- if(addc.IPAddress!=null)
- {
- String[] iptbl = addc.IPAddress.split("[.]");
- Log.d(TAG, "[checkDongHoSetting] Mac Set -> IP : " + addc.IPAddress +", Length : " + iptbl.length);
- // BSP에서 초기 이더넷 비활성화시 jni 맥 셋팅시 메인어플 다이~~
- EthernetManager mEthManager = (EthernetManager) getSystemService("ethernet");
- mEthManager.setEthernetState(EthernetManager.ETH_STATE_DISABLED);
- Log.d(TAG, "[checkDongHoSetting] ETH_STATE_DISABLED!!!");
- if (IP_ExpansionSettingFlag == true) {
- mEthManager.UpdateEthDevInfo(info);
- }
- mEthManager.setEthernetState(EthernetManager.ETH_STATE_ENABLING);
- Log.d(TAG, "[checkDongHoSetting] ETH_STATE_ENABLING!!!");
- if (iptbl.length == 4) {
- String macadd = String.format("00:%02x:%02x:%02x:%02x:00", Integer.parseInt(iptbl[0]),Integer.parseInt(iptbl[1]), Integer.parseInt(iptbl[2]), Integer.parseInt(iptbl[3]));
- Log.d(TAG, "[checkDongHoSetting] Mac Set "+macadd);
- try {
- WallPadInterface wpdifc = new WallPadInterface();
- wpdifc.setMacAddr(macadd);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception ex) {
- //ex.printStackTrace();
- LogUtil.errorLogInfo("", TAG, ex);
- }
- Log.d(TAG, "[checkDongHoSetting] -----------------------------------MacSet");
- }
- else {
- Log.d(TAG,"[checkDongHoSetting] -----------------------------------Mac iptbl.length fail !!");
- }
- //EthernetManager mEthManager = (EthernetManager) getSystemService("ethernet");
- //mEthManager.setEthernetState(EthernetManager.ETH_STATE_DISABLED);
- mEthManager.setEthernetState(EthernetManager.ETH_STATE_ENABLING);
- Log.d(TAG, "[checkDongHoSetting] ETH_STATE_ENABLING!!!");
- }
- }
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] checkDongHoSetting()");
-
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
-
- public void registerSubScreen() {
- try {
- if (Common.eGUIType == Common.GUI_TYPE.METRO) {
- if (MetroUI_SUB_GroupScreen == null && SubScreenLayout_01 != null ) MetroUI_SUB_GroupScreen = new METROUI_SUB_GROUP(getContext() , SubScreenLayout_01, mWallPadAPI);
- }
- else if (Common.eGUIType == Common.GUI_TYPE.HYOSUNG) {
- if (MetroUI_SUB_GroupScreen == null && SubScreenLayout_01 != null ) MetroUI_SUB_GroupScreen = new METROUI_SUB_GROUP(getContext() , SubScreenLayout_01, mWallPadAPI);
- }
- else {
- if (mIconInfoTable.getCnt() > 0) {
- if (SUB_01Screen == null && SubScreenLayout_01 != null ) SUB_01Screen = new SUB_01(getContext() , SubScreenLayout_01, mWallPadAPI);
- }
- if (mIconInfoTable.getCnt() > nIconsOnSubScreen) {
- if (SUB_02Screen == null && SubScreenLayout_02 != null ) SUB_02Screen = new SUB_02(getContext() , SubScreenLayout_02, mWallPadAPI);
- }
- if (bEasyModeUsage) {
- if (EasyUI_MainScreen == null && EasyMainScreenLayout != null ) EasyUI_MainScreen = new EASYUI_MAIN(getContext() , EasyMainScreenLayout, mWallPadAPI, m_CallSubMenuScreen);
- }
- }
- // restoreSystemVolume();
- SCManager = new ScheduleManager();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.w(TAG, "[registerSubScreen] registerSubScreen()");
-
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
-
- public void moveNextPage() {
- try {
- Log.d(TAG, "[moveNextPage] ===== START =====");
- aniSlideIn = AnimationUtils.loadAnimation(getContext(), R.layout.appear_from_right);
- aniSlideOut = AnimationUtils.loadAnimation(getContext(), R.layout.disappear_to_left);
- mViewFlipper.setInAnimation(aniSlideIn);
- mViewFlipper.setOutAnimation(aniSlideOut);
- mViewFlipper.showNext();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] moveNextPage()");
-
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public void movePreviousPage() {
- try {
- Log.d(TAG, "[movePreviousPage] ===== START =====");
- aniSlideIn = AnimationUtils.loadAnimation(getContext(), R.layout.appear_from_left);
- aniSlideOut = AnimationUtils.loadAnimation(getContext(), R.layout.disappear_to_right);
- mViewFlipper.setInAnimation(aniSlideIn);
- mViewFlipper.setOutAnimation(aniSlideOut);
- mViewFlipper.showPrevious();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] moveNextPage()");
-
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- boolean bScreenCheck = false;
- int nSubScreenTimeout = 20, SCREENTIMEOUT = 20;
- public void checkMainPage() {
- try {
- if (!bScreenCheck) {
- nSubScreenTimeout = SCREENTIMEOUT;
- return;
- }
- int nViewFlipperIndex = mViewFlipper.getDisplayedChild();
- if (nViewFlipperIndex != 0) {
- if (nSubScreenTimeout > 0) {
- nSubScreenTimeout--;
- }
- else {
- nSubScreenTimeout = SCREENTIMEOUT;
- mViewFlipper.setDisplayedChild(0);
- }
- Log.i(TAG, "[checkMainPage] nViewFlipperIndex [" + nViewFlipperIndex + "], nSubScreenTimeout [" + nSubScreenTimeout + "]");
- }
- else {
- if (nSubScreenTimeout <= 0) {
- nSubScreenTimeout = SCREENTIMEOUT;
- Log.i(TAG, "[checkMainPage] nViewFlipperIndex [" + nViewFlipperIndex + "], nSubScreenTimeout [" + nSubScreenTimeout + "]");
- }
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] checkMainPage()");
-
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- String strWallPadMainPakageName = "kr.co.icontrols.wallpadmain";
- private boolean isPackageTop(String strPackageName) {
- try {
- ActivityManager am = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
- Log.i(TAG, "[isPackageTop] Build.VERSION.SDK_INT [" + Build.VERSION.SDK_INT + "]");
- if (Build.VERSION.SDK_INT > 23) {
- // Android 7
- List<ActivityManager.RunningAppProcessInfo> runningProcesses = am.getRunningAppProcesses();
- for (ActivityManager.RunningAppProcessInfo processInfo : runningProcesses) {
- if (processInfo.importance == ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND) {
- for (String activeProcess : processInfo.pkgList) {
- if (activeProcess.equals(strPackageName)) {
- Log.i(TAG, "[isPackageTop] The top package is [" + strPackageName + "]");
- return true;
- }
- }
- }
- }
- }
- else {
- // Android 6
- List<ActivityManager.RunningTaskInfo> taskInfo = am.getRunningTasks(1);
- ComponentName componentInfo = taskInfo.get(0).topActivity;
- if (componentInfo.getPackageName().equals(strPackageName)) {
- Log.i(TAG, "[isPackageTop] The top package is [" + strPackageName + "]");
- return true;
- }
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] isPackageTop(String strPackageName)");
-
- LogUtil.errorLogInfo("", TAG, e);
- }
- return false;
- }
- // 부팅시에는 최초 DB에서 값을 읽어와서 변경하도록 한다.
- private boolean m_SetBookMarkMainScreen = false;
- private int m_CheckBookMarkReturnCount = 0 ;
- private final int BOOKMARK_SCREEN_RETURN_CHECK_TIME = 30;
- private boolean m_thisAcitivityRusume = false;
-
- // 즐겨찾기 메인화면을 항상 고정해서 쓸것인지 설정하는 함수
- public void SetBookMarkMainScreen(boolean Set)
- {
- m_SetBookMarkMainScreen = Set;
- try
- {
- WallpadStatusData wdb = new WallpadStatusData(this.getContext());
- if( wdb != null )
- {
- if( Set == true )
- {
- wdb.SetSelectedMainScreen( WallpadStatusData.MAIN_BOOKMARK_SCREEN);
- }
- else
- {
- wdb.SetSelectedMainScreen( WallpadStatusData.MAIN_DEFAULT_SCREEN);
- }
- wdb.closeDB();
- }
- }
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e )
- {
-
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
-
- public boolean CheckCurrentEnergyScreen()
- {
- int currentView = mViewFlipper.getDisplayedChild();
- Log.d(TAG, "-------> currentView : " + currentView);
- if( currentView == 1)
- return true;
- else
- return false;
- }
-
-
- private int nTouchDownPosX = 0;
- private int nTouchUpPosX = 0;
-
-
-
- @Override
- public boolean dispatchTouchEvent(MotionEvent ev) {
- boolean bReturn = false;
- //Log.d("Move" , "dispatchTouchEvent-----------1");
- try {
- if (ev.getAction() == MotionEvent.ACTION_DOWN) {
- nTouchDownPosX = (int)ev.getX();
- }
- else if (ev.getAction() == MotionEvent.ACTION_UP) {
- nTouchUpPosX = (int)ev.getX();
- Log.d(TAG, "[dispatchTouchEvent] nTouchDownPosX [" + nTouchDownPosX + "], nTouchUpPosX [" + nTouchUpPosX + "]");
- if (nTouchUpPosX < nTouchDownPosX - 50) {
- moveNextPage();
- setPageIndicator();
- }
- else if (nTouchUpPosX > nTouchDownPosX + 50) {
- movePreviousPage();
- setPageIndicator();
- }
- nTouchDownPosX = nTouchUpPosX;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] dispatchTouchEvent(MotionEvent ev)");
-
- LogUtil.errorLogInfo("", TAG, e);
- }
- bReturn = super.dispatchTouchEvent(ev);
- return bReturn;
- }
- private void setPageIndicator() {
- try {
- int nViewFlipperIndex = mViewFlipper.getDisplayedChild();
- int nChildCnt = mViewFlipper.getChildCount();
- Log.d(TAG, "[setPageIndicator] nViewFlipperIndex [" + nViewFlipperIndex + "], nChildCnt [" + nChildCnt + "]");
- if (Common.eGUIType == Common.GUI_TYPE.STANDARD) {
- Log.d(TAG, "[setPageIndicator] eGUIType == GUI_TYPE.STANDARD");
- ImageView[] IMG_INDICATOR;
- if (bEasyModeUsage) IMG_INDICATOR = new ImageView[] { (ImageView) findViewById(R.id.pageindex_main), (ImageView) findViewById(R.id.pageindex_sub1), (ImageView) findViewById(R.id.pageindex_sub2), (ImageView) findViewById(R.id.pageindex_easymain) };
- else IMG_INDICATOR = new ImageView[] { (ImageView) findViewById(R.id.pageindex_main), (ImageView) findViewById(R.id.pageindex_sub1), (ImageView) findViewById(R.id.pageindex_sub2) };
- for (int i = 0; i < nChildCnt; i++) {
- if (i == nViewFlipperIndex) {
- if (i == 0) IMG_INDICATOR[i].setSelected(true);
- else IMG_INDICATOR[i].setSelected(true);
- }
- else {
- if (i == 0) IMG_INDICATOR[i].setSelected(false);
- else IMG_INDICATOR[i].setSelected(false);
- }
- }
- }
- // else if (eGUIType == GUI_TYPE.METRO) {
- // ImageView[] IMG_INDICATOR = { (ImageView) findViewById(R.id.pageindex_sub1), (ImageView) findViewById(R.id.pageindex_sub2) };
- // if (nViewFlipperIndex == 0) {
- // for (int i = 0; i < nChildCnt; i++) {
- // if (i != 0) IMG_INDICATOR[i - 1].setVisibility(View.INVISIBLE);
- // }
- // }
- // else {
- // for (int i = 0; i < nChildCnt; i++) {
- // if (i != 0) {
- // IMG_INDICATOR[i - 1].setVisibility(View.VISIBLE);
- // if (i == nViewFlipperIndex) IMG_INDICATOR[i - 1].setSelected(true);
- // else IMG_INDICATOR[i - 1].setSelected(false);
- // }
- // }
- // }
- // }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] setPageIndicator()");
-
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
-
-
- /**
- * (임시코드) WallPadAPI 초기생성시 Connect 에 시간이 걸리며, <br>
- * WallPadAPI 초기화후 바로 Get_GasValveController 등을 사용하여 API 를 가져올수 없기에, <br>
- * 본 딜레이 코드를 임시로 적용한다.
- */
- @SuppressLint("HandlerLeak")
- protected Handler mWallPadApiCheckHandler = new Handler()
- {
- @SuppressLint("HandlerLeak")
- @Override
- public void handleMessage(Message msg)
- {
- if (msg.what == 0) {
- if (mWallPadAPI != null) {
- if (mWallPadAPI.Check_Connect()) mWallPadApiCheckHandler.sendEmptyMessageDelayed(1, 10);
- else mWallPadApiCheckHandler.sendEmptyMessageDelayed(0, 10);
- }
- }
- else if (msg.what == 1) {
- // 현산향
- AutoIGALStatusReleaseSinario();
- if (Version.getModelType() == Version.MODEL_TYPE.IHN_D101 || Version.getModelType() == Version.MODEL_TYPE.IHN_D101_I || Version.getModelType() == MODEL_TYPE.IHN_D101_I_LX2
- || Version.getModelType() == Version.MODEL_TYPE.IHN_D101K || Version.getModelType() == Version.MODEL_TYPE.IHN_D101K_I
- || Version.getModelType() == MODEL_TYPE.IHN_D101_I_OCF) {
- mSdb_LivingRoomLightAPI = mWallPadAPI.Get_Sdb_LivingRoomLightAPI();
- mSdbAPI = mWallPadAPI.Get_SdbController();
- if (mSdb_LivingRoomLightAPI == null) Log.d(TAG , "[mWallPadApiCheckHandler] Get_Sdb_LivingRoomLightAPI Fail %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
- else Log.d(TAG , "[mWallPadApiCheckHandler] Get_Sdb_LivingRoomLightAPI Success !");
- if (mSdbAPI == null) Log.d(TAG , "[mWallPadApiCheckHandler] Get_SdbController Fail %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
- else Log.d(TAG , "[mWallPadApiCheckHandler] Get_SdbController Success !");
- // ChangeLEDButtonLevel();
- }
- else if (Version.getModelType() == MODEL_TYPE.IHN_1010GL || Version.getModelType() == MODEL_TYPE.IHN_1010GL_I
- || Version.getModelType() == MODEL_TYPE.IHN_1010GL_I_2443 || Version.getModelType() == MODEL_TYPE.IHN_1010GL_I_6410) {
- mIntLightAPI = mWallPadAPI.Get_IntLightController();
- if (mIntLightAPI == null) Log.d(TAG , "[mWallPadApiCheckHandler] Get_IntLightController Fail %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
- else Log.d(TAG , "[mWallPadApiCheckHandler] Get_IntLightController Success !");
- // ChangeLEDButtonLevel();
- }
- else {
- // 대외향
- WallpadDeviceSet devDB = new WallpadDeviceSet( getApplicationContext() );
- int[] retArray = devDB.Get_Light_info();
- devDB.closeDB();
- if (retArray!= null && retArray[0] == 1) {
- if (retArray[1] == WallpadDeviceSet.LIGHT_TYPE_LIVING) {
- // 거실 스위치
- m_LightCtrl = mWallPadAPI.Get_LightController();
- if (m_LightCtrl == null) Log.d(TAG , "Get_LightController Fail %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
- else Log.d(TAG , "Get_LightController Success !");
- }
- else {
- // 멀티스위치
- m_MultiSwitch = mWallPadAPI.Get_MultiSwitchController();
- if (m_MultiSwitch == null) Log.d(TAG , "Get_MultiSwitchController Fail %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
- else Log.d(TAG , "Get_MultiSwitchController Success !");
- }
- }
- }
- // 스마트현관카메라
- if (getDoorCamType() == WallpadDeviceSet.DOORTYPE_IOT_SMART || getDoorCamType() == WallpadDeviceSet.DOORTYPE_HYOSUNG_SMART || getDoorCamType() == WallpadDeviceSet.DOORTYPE_DAEWOO_SMART) {
- mSmartKeyRfDoorAPI = mWallPadAPI.Get_SmartKeyRfDoorController();
- String ret = mSmartKeyRfDoorAPI.SetSensorConfig((byte) 0x05, getSmartDoorCamDuration());
- Log.i(TAG, "[mWallPadApiCheckHandler] ret [" + ret + "]");
- // 초기화를 위해 스마트 IoT 현관카메라의 상태를 정리한다. (상태 Off, LED Off)
- ctrlSmartIOTCamStatusMode(Common.SmartRFCamStatusMode.STATUS_AUTO_OFF);
- ctrlSmartIOTCamLEDMode(Common.SmartRFCamLEDMode.LED_AUTO_OFF);
- }
- }
- else if (msg.what == 10) {
- // 부트업 실패시 5초 간격으로 보내도록 수정
- Log.d(TAG , "NOTIFY_SENDBOOTUP_FAIL Retry!!!!");
- Intent Newintent = new Intent();
- Newintent.setAction(define.NOTIFY_ACNAME);
- Newintent.putExtra(define.NOTIBR_KIND,Common.DEVICE_BOOTUP_RETRY);
- sendBroadcast(Newintent);
- }
- }
- };
-
-
- private void ChangeLEDButtonLevel()
- {
- if( Version.getModelType() == Version.MODEL_TYPE.IHN_1020GL )
- {
- try
- {
- String filename = "/sdcard/led_button_reset.txt";
-
- File savefile = new File(filename);
-
- Log.d(TAG, "8888888888888888888888 savefile : " + savefile.exists());
- if(savefile.exists())
- {
- Log.d(TAG, "try file is exist... ");
- if( mIntLightAPI != null)
- {
- int ret = mIntLightAPI.LedBrightCtrl((byte)0x01);
-
- if( ret >= 0 )
- {
- WallpadStatusData wd = new WallpadStatusData( getApplicationContext());
- wd.SetLEDButtonBrightnessLevel(1); // DB 저장이 실패하게 되면 초기값을 2로 셋팅하기 때문에 다시 한번 셋팅해준다.
- int level = wd.GetLEDButtonBrightnessLevel();
- wd.closeDB();
- Log.d(TAG, "88888888 button brightness Level 1 == " + level);
-
- WallpadStatusData wd1 = new WallpadStatusData( getApplicationContext());
- wd1.SetLEDButtonBrightnessLevel(1);
- level = wd1.GetLEDButtonBrightnessLevel();
- wd1.closeDB();
-
-
- FileDelete(savefile);//.delete();
-
- // 생산 기술팀 요청사항
- // LED 버튼 보디 교체로 레벨이 너무 밝아 디폴트값 변경을 요청함 ,,
- Log.d(TAG, "8888888888888888888888 button brightness Level 1 == " + level);
- }
- }
- }
- }
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e )
- {
-
- LogUtil.errorLogInfo("", TAG, e);
- }
-
- }
- }
-
- private void AutoIGALStatusReleaseSinario()
- {
- // 에너지미터 설정에 따라 조명 상태 변경시 일괄소등 해제 처리 시나리오를 설정하도록 한다.
- // 일괄소등 해제 시나리오 적용시...
- try
- {
- WallpadDeviceSet devset = new WallpadDeviceSet(getApplicationContext());
- int setIparkEnergy = devset.Get_Energy_Devices_Info();
- Log.d(TAG , "Get_IPark_Energy_Info bSet: setIparkEnergy : " + setIparkEnergy);
- if( setIparkEnergy == 1 )
- {
- mWallPadAPI.SetAutoIGALStatusClear(true);
- Log.d(TAG , "AutoIGALStatusReleaseSinario bSet: true");
- }
- devset.closeDB();
- }
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e )
- {
- Log.e(TAG, e.toString());
-
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /**
- * onDestroy
- */
- @Override
- protected void onDestroy() {
- // 이걸 왜 넣었지?
- setChangeScreen(mCurrentScreenId, true, false);
- unregisterBroadcastReceiver();
- super.setFinishTimerDestroy();
- Log.i(TAG, "*************************************************************");
- Log.i(TAG, "****************** [END - MainActivity] *******************");
- Log.i(TAG, "*************************************************************");
- super.onDestroy();
- }
- /**
- * onResume
- */
- @Override
- protected void onResume() {
- super.onResume();
- m_thisAcitivityRusume = true;
- if (mWallPadAPI != null) {
- if (mWallPadAPI.Check_Connect()) Log.w(TAG, "[onResume] mWallPadAPI.Check_Connect() = true!!!");
- else Log.w(TAG, "[onResume] mWallPadAPI.Check_Connect() = false!!!");
- mWallPadAPI.Resume();
- }
-
- //CallDataChecker();
- try {
- if (m_ModelHouseSleepModeRelease) {
- // PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
- // pm.userActivity(1, true);
- // pm.userActivity(2, true);1qn
- // LCD 항상 ON
- ((Activity)this.getContext()).getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
-
- LogUtil.errorLogInfo("", TAG, e);
- }
-
- if (MAINStatus == MAIN_WAIT_SETIP) {
- try {
- WallpadStatusData SetData = new WallpadStatusData(getApplicationContext());
- AddressSet addc = SetData.getAddressMGR();
- SetData.closeDB();
- Log.i("MAINSCREEN", "onResume MAIN_WAIT_SETIP "+addc.IPAddress);
- if (addc.IPAddress!=null && !addc.IPAddress.equals("NONE")) {
- Log.i("MAINSCREEN", "onResume Start Server");
- EthernetManager mEthManager = (EthernetManager) getSystemService("ethernet");
- mEthManager.setEthernetState(EthernetManager.ETH_STATE_DISABLED);
- mEthManager.setEthernetState(EthernetManager.ETH_STATE_ENABLING);
- Intent intent = new Intent(getApplicationContext(), iMapServer.class);
- Log.w("MAINSCREEN", "Call Start iMapServer");
- startService(intent);
- //impaserver에 멀티 정보 제공을 위해 통신으로 추가
- bindService(new Intent(this, iMapServer.class), mConnection, Context.BIND_AUTO_CREATE);
- mIsBound = true;
- WallpadDeviceSet devSet = new WallpadDeviceSet(getApplicationContext());
- String[] sitecode = devSet.GetSettingData("site_code");
- try {
- if (sitecode != null) {
- Intent sipServiceLauncher = new Intent ("cm.sip.hns.SIPStun.StartService");
- getApplicationContext().startService(sipServiceLauncher);
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Common.DebugLog("SIP StartServerice Error!!!!!!!!!!!!!!");
- }
- devSet.closeDB();
- MAINStatus = MAIN_NORMAL;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e ) {
-
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
-
- //CheckMainScreen();
-
- //refreshUserCtr();
- //reloadData();
- try {
- WallPadInterface wpdifc = new WallPadInterface();
- AudioManager amanager = (AudioManager) getApplicationContext().getSystemService(Context.AUDIO_SERVICE);
- amanager.setMode(WallPadInterface.AUDIO_MODE_NORMAL);
- wpdifc.DoControl(WallPadInterface.IOCTL_DOOR_POWERONOFF, 0);
-
- Intent intent = new Intent(Common.MAIN_SCREEN_NOW_UPDATE, null);
- getContext().sendBroadcast(intent);
- mGetCallHistoryCheckHandler.sendEmptyMessageDelayed(0, 1000);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
-
- LogUtil.errorLogInfo("", TAG, e);
- }
- bScreenCheck = true;
- DebugLogOutput("@@@@@@@@ [onResume] @@@@@@@@");
- }
-
- protected String getForegroundAPK() {
- try {
- ActivityManager am = (ActivityManager) getApplicationContext().getSystemService(Context.ACTIVITY_SERVICE);
- List<RunningTaskInfo> taskInfo = am.getRunningTasks(1);
- ComponentName topActivity=taskInfo.get(0).topActivity;
- String str=topActivity.getPackageName();
-
- return str;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return " ";
- }
- catch (Exception e) {
-
- LogUtil.errorLogInfo("", TAG, e);
- return " ";
- }
- }
-
- /**
- * onPause
- */
- @Override
- protected void onPause() {
- //테스트
- sendMessageToService(4, "111");
- m_thisAcitivityRusume = false;
- if(mWallPadAPI != null) mWallPadAPI.Pause();
- bScreenCheck = false;
- DebugLogOutput("@@@@@@@@ [onPause] @@@@@@@@");
- super.onPause();
- }
-
-
- /* ================================================================================================
- * [BroadcastReceiver] Section
- ================================================================================================ */
- /**
- * BroadcastReceiver.onReceive for [WpadActivity]
- */
- @Override
- protected void onBrReceive(Intent intent) {
- try {
- String strAction = intent.getAction();
- Log.i(TAG, "[onBrReceive] Action [" + strAction + "]");
- if (strAction.equals(BR_CTRL_LIGHT_LIVINGROOM)) {
- Log.d(TAG, "[onBrReceive] (BR) BR_CTRL_LIGHT_LIVINGROOM");
- mLightInfo.nLightPresetNo = 0;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] onBrReceive(Intent intent)");
-
- LogUtil.errorLogInfo("", TAG, e);
- }
- super.onBrReceive(intent);
- }
-
-
- /* ================================================================================================
- * [Touch & Key Event] Section
- ================================================================================================ */
- /**
- * TouchEvent for [WpadActivity]
- */
- @Override
- protected void onTouchEvent(View v, MotionEvent event) {
- super.onTouchEvent(v, event);
-
- int TargetId = v.getId();
- int MoveEvent = event.getAction();
- Log.i(TAG, "[onTouchEvent] TargetId [" + TargetId + "], MoveEvent [" + MoveEvent + "]");
- if (MoveEvent == MotionEvent.ACTION_UP) {
- }
- }
-
- /**
- * H/W Key Event
- */
- @Override
- public boolean onKeyDown(int keyCode, KeyEvent event) {
- Log.i(TAG, "[onKeyDown] keyCode : " + keyCode + ", Action : " + event.getAction());
- // sendKeyEventBR(keyCode);
- return super.onKeyDown(keyCode, event);
- }
-
-
-
- @Override
- public boolean onKeyUp(int keyCode, KeyEvent event) {
- // TODO Auto-generated method stub
- Log.i(TAG, "[onKeyUp] keyCode : " + keyCode + ", Action : " + event.getAction());
- return super.onKeyUp(keyCode, event);
- }
- @Override
- public boolean onKeyLongPress(int keyCode, KeyEvent event) {
- // TODO Auto-generated method stub
- DebugLogOutput("onKeyLongPress - " + " / keyCode : " + keyCode + " / Action : " + event.getAction());
- return super.onKeyLongPress(keyCode, event);
- }
- /* ================================================================================================
- * [Popup Activity] Section
- ================================================================================================ */
- /**
- * Popup Activity 를 시작시킨다.
- *
- * @param ScreenId - 팝업시작시 Screen ID_OLD
- * @return (boolean) true : 성공, false : 실패
- */
- public boolean StartPopup(int ScreenId){
- try {
- if (ID.POPUPS.POPUP_INTERFLOORNOISEOCCURED <= ScreenId && ScreenId <= ID.POPUPS.POPUP_POSTRECEIVED) { // 알림 팝업에 한하여
- if (Common.bWallPadCallLive) {
- Log.w(TAG, "[StartPopup] StartPopup denied!!! === WallPadCall is running!! ScreenId [" + ScreenId + "]");
- return false; // 통화 앱이 실행되어 있는 경우, 팝업 출력 안함
- }
- WallpadStatusData WsDB = new WallpadStatusData(getApplicationContext());
- int AlarmStatus = WsDB.GetAlarmStatus();
- WsDB.closeDB();
- if (AlarmStatus == WallpadStatusData.ALARM_ARISE || AlarmStatus == WallpadStatusData.GUARD_OUT || AlarmStatus == WallpadStatusData.GUARD_OUT_WAIT) {
- Log.w(TAG, "[StartPopup] StartPopup denied!!! === AlarmStatus [" + AlarmStatus + "]");
- return false; // 방범모드 실행중인 경우, 팝업 출력 안함
- }
- }
- if (getPopupActivityRun()) {
- if (ScreenId == ID.POPUPS.POPUP_NOTICESTRANGER) return ((WpadActivity)(PopupActivity.getContext())).ChangeScreen(ScreenId);
- else return false;
- }
- else {
- setPopupActivityRun(true);
- Intent intent = new Intent(mContext, PopupActivity.class);
- intent.putExtra("ScreenId", ScreenId);
- overridePendingTransition(0, 0);
- startActivityForResult(intent, 0);
- return true;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] StartPopup(int ScreenId)");
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
-
- /**
- * Popup Activity 를 시작시킨다. (시작시 Intent Type 데이터를 전달한다)
- *
- * @param ScreenId - 팝업시작시 Screen ID_OLD
- * @param data - 전달할 데이터
- * @return (boolean) true : 성공, false : 실패
- */
- public boolean StartPopup(int ScreenId, Intent data) {
- try {
- if (ID.POPUPS.POPUP_INTERFLOORNOISEOCCURED <= ScreenId && ScreenId <= ID.POPUPS.POPUP_POSTRECEIVED) { // 알림 팝업에 한하여
- if (Common.bWallPadCallLive) {
- Log.w(TAG, "[StartPopup] StartPopup denied!!! === WallPadCall is running!! ScreenId [" + ScreenId + "]");
- return false; // 통화 앱이 실행되어 있는 경우, 팝업 출력 안함
- }
- WallpadStatusData WsDB = new WallpadStatusData(getApplicationContext());
- int AlarmStatus = WsDB.GetAlarmStatus();
- WsDB.closeDB();
- if (AlarmStatus == WallpadStatusData.ALARM_ARISE || AlarmStatus == WallpadStatusData.GUARD_OUT || AlarmStatus == WallpadStatusData.GUARD_OUT_WAIT) {
- Log.w(TAG, "[StartPopup] StartPopup denied!!! === AlarmStatus [" + AlarmStatus + "]");
- return false; // 방범모드 실행중인 경우, 팝업 출력 안함
- }
- }
- if (getPopupActivityRun()) {
- if (ScreenId == ID.POPUPS.POPUP_NOTICESTRANGER) return ((WpadActivity)(PopupActivity.getContext())).ChangeScreen(ScreenId);
- else 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;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] StartPopup(int ScreenId, Intent data)");
-
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
-
- /**
- * Activity Result Reception
- */
- @Override
- protected void onActivityResult(int requestCode, int resultCode, Intent data) {
- super.onActivityResult(requestCode, resultCode, data);
- try {
- Log.d(TAG, "@@@@@@@@ [onActivityResult] @@@@@@@@");
-
- // int screenId = data.getIntExtra("SCREENS", -1);
- // Log.d(TAG, "@@@@@@@@ [onActivityResult] @@@@@@@@ screenId : " + screenId );
- //if( mViewFlipper)
-
- if (requestCode == UNINSTALL_REQUEST_CODE) {
- if (resultCode == RESULT_OK) {
- Log.w(TAG, "[onActivityResult] user accepted the uninstall");
- } else if (resultCode == RESULT_CANCELED) {
- Log.w(TAG, "[onActivityResult] user canceled the uninstall");
- } else if (resultCode == RESULT_FIRST_USER) {
- Log.w(TAG, "[onActivityResult] failed to uninstall");
- }
- }
- else {
- if (data != null) {
- int nSenderScreenID = data.getIntExtra(Common.BR_SENDER_SCREEN, -1);
- int nReceiveScreenID = data.getIntExtra(Common.BR_RECEIVE_SCREEN, -1);
- int nCallSubMenuScreen = data.getIntExtra(Common.CALL_SUBMAIN_SCREEN, -1);
- if (nCallSubMenuScreen > 0) {
- CallSubMenuScreen(nCallSubMenuScreen);
- }
- else {
- Log.d(TAG, "[onActivityResult] nSenderScreenID : " + nSenderScreenID + " , nReceiveScreenID : " + nReceiveScreenID );
- if (nSenderScreenID == ID.POPUPS.POPUP_DELETESHORTCUT) {
- if (nReceiveScreenID == ID.SCREENS.SCREEN_MAIN) {
- boolean bResult = data.getBooleanExtra(Common.BR_WIDGET_DELETE, false);
- int nDeleteShortcutID = data.getIntExtra(Common.BR_DELETE_WIDGET_ID, -1);
- Log.d(TAG, "[onActivityResult] bResult : " + bResult + ", nDeleteShortcutID : " + nDeleteShortcutID);
- MainScreen.procDeleteShortcutPopupResult(bResult, nDeleteShortcutID);
- return;
- }
- else if (nReceiveScreenID == ID.SCREENS.SCREEN_HYOSUNGUI_MAIN_HN) {
- boolean bResult = data.getBooleanExtra(Common.BR_WIDGET_DELETE, false);
- int nDeleteShortcutID = data.getIntExtra(Common.BR_DELETE_WIDGET_ID, -1);
- Log.d(TAG, "[onActivityResult] bResult : " + bResult + ", nDeleteShortcutID : " + nDeleteShortcutID);
- Hyosung_HN_MainScreen.procDeleteShortcutPopupResult(bResult, nDeleteShortcutID);
- return;
- }
- else if (nReceiveScreenID == ID.SCREENS.SCREEN_METROUI_MAIN) {
- boolean bResult = data.getBooleanExtra(Common.BR_WIDGET_DELETE, false);
- int nDeleteShortcutID = data.getIntExtra(Common.BR_DELETE_WIDGET_ID, -1);
- Log.d(TAG, "[onActivityResult] bResult : " + bResult + ", nDeleteShortcutID : " + nDeleteShortcutID);
- MetroUI_MainScreen.procDeleteShortcutPopupResult(bResult, nDeleteShortcutID);
- return;
- }
- }
- else if (nSenderScreenID == ID.POPUPS.POPUP_ADDSHORTCUT) {
- if (nReceiveScreenID == ID.SCREENS.SCREEN_MAIN) {
- boolean bResult = data.getBooleanExtra(Common.BR_WIDGET_INSERT, false);
- int nAddShortcutID = data.getIntExtra(Common.BR_INSERT_WIDGET_ID, -1);
- Log.d(TAG, "[onActivityResult] bResult : " + bResult + ", nAddShortcutID : " + nAddShortcutID);
- MainScreen.procAddShortcutPopupResult(bResult, nAddShortcutID);
- return;
- }
- else if (nReceiveScreenID == ID.SCREENS.SCREEN_HYOSUNGUI_MAIN_HN) {
- boolean bResult = data.getBooleanExtra(Common.BR_WIDGET_INSERT, false);
- int nAddShortcutID = data.getIntExtra(Common.BR_INSERT_WIDGET_ID, -1);
- Log.d(TAG, "[onActivityResult] bResult : " + bResult + ", nAddShortcutID : " + nAddShortcutID);
- Hyosung_HN_MainScreen.procAddShortcutPopupResult(bResult, nAddShortcutID);
- return;
- }
- else if (nReceiveScreenID == ID.SCREENS.SCREEN_METROUI_MAIN) {
- boolean bResult = data.getBooleanExtra(Common.BR_WIDGET_INSERT, false);
- int nAddShortcutID = data.getIntExtra(Common.BR_INSERT_WIDGET_ID, -1);
- Log.d(TAG, "[onActivityResult] bResult : " + bResult + ", nAddShortcutID : " + nAddShortcutID);
- MetroUI_MainScreen.procAddShortcutPopupResult(bResult, nAddShortcutID);
- return;
- }
- }
- else if (nSenderScreenID == ID.POPUPS.POPUP_CONFIGUREPRESET && nReceiveScreenID == ID.SCREENS.SCREEN_MAIN) {
- String strLivinglightPresetInfo = data.getStringExtra(Common.BR_LIVINGLIGHT_PRESET_INFO);
- Log.d(TAG, "[onActivityResult] strLivinglightPresetInfo [" + strLivinglightPresetInfo + "]");
- savePresetValue(strLivinglightPresetInfo);
- return;
- }
- else if ((ID.POPUPS.POPUP_GROUP_CTRL <= nSenderScreenID && nSenderScreenID <= ID.POPUPS.POPUP_GROUP_SETTING) && nReceiveScreenID == ID.SCREENS.SCREEN_METROUI_GROUP) {
- boolean bRun = data.getBooleanExtra(Common.BR_RUN_WIDGET, false);
- int nIconID = data.getIntExtra(Common.BR_RUN_WIDGET_ID, 0);
- Log.d(TAG, "[onPopupResult] bRun [" + bRun + "], nIconID [" + nIconID + "]") ;
- if (bRun) runIcon(nIconID);
- }
- }
- }
- if (resultCode == RESULT_OK) {
- // // 팝업을 종료하고 다른 팝업을 띄울경우가 있다.
- // int screenIdCode = data.getExtras().getInt("CHANGE_POPUP" );
- // int popupKind = data.getExtras().getInt("POPUP_KIND");
- //
- // Log.d(TAG, "@@@ CHANGE_POPUP : " + screenIdCode + " , popupKind : " +popupKind);
- // if( screenIdCode > 0 )
- // {
- // setPopupActivityRun(false);
- // Intent intent = new Intent();
- // intent.putExtra("POPUP_KIND", popupKind );
- // StartPopup(screenIdCode , intent);
- // }
- }
- }
- }
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e )
- {
- Log.e(TAG, e.toString());
-
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
-
- /* ================================================================================================
- * [Info Activity] Section
- ================================================================================================ */
- public static ManualActivity mManualActivity;
-
- /**
- * Info Activity를 시작시킨다.
- *
- * @param screenId - 매뉴얼 시작시 Screen ID_OLD
- * @return (boolean) true : 성공, false : 실패
- */
- public boolean startManualPopup(int screenId) {
- Log.d(TAG, "[startManualPopup] ScreenId [" + screenId +"], mCurrentInfoScreenId [" + mCurrentInfoScreenId + "]" );
- if (getInfoActivityRun() == true) {
- mCurrentInfoScreenId = screenId;
- return ((WpadActivity)(ManualActivity.getContext())).ChangeScreen(screenId);
- } else {
- if (mCurrentInfoScreenId == screenId) return false;
- mCurrentInfoScreenId = screenId;
- setInfoActivityRun(true);
- Intent intent = new Intent(mContext, ManualActivity.class);
- intent.putExtra("ScreenId", screenId);
-
- overridePendingTransition(0, 0);
- startActivityForResult(intent, 0);
- return true;
- }
- }
-
- public static void resetCurrentInfoScreenID() {
- try {
- mCurrentInfoScreenId = -1;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] resetCurrentInfoScreenID()");
-
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
-
- /**
- * 매뉴얼 버튼 사용 유무
- *
- * @return boolean 타입 - true:사용, false:미사용
- */
- public boolean GetManualUse() {
- 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");
- return false;
- }
- }
- else {
- //미사용
- return false;
- }
- }
-
-
- /* ================================================================================================
- * [Screen] Section
- ================================================================================================ */
- /**
- * Screen 에서 Screen 변경을 요청할 경우 호출된다.<br>
- * Override 사용하여 Screen 변경을 처리한다.<br>
- *
- * @param nScreenId - 변경할 Screen ID_OLD
- * @return (boolean) true : 성공, false : 실패
- */
- @Override
- protected boolean onChangeScreen(int nScreenId) {
- super.onChangeScreen(nScreenId);
-
- return setChangeScreen(nScreenId, false, false);
- }
-
- /**
- * Screen 등록자<br>
- * MainScreenLayout 에 현재 Screen 을 삭제하고, 새로운 Screen 을 등록시킨다.
- *
- * @param nScreenId - 변경할 Screen ID_OLD
- * @param OnlyRemove - 현재 Screen 을 삭제만 할 경우 (onDestroy 에서 사용)
- * @return (boolean) true : 성공, false : 실패
- */
- private boolean setChangeScreen(int nScreenId, boolean OnlyRemove, boolean setAnimation) {
- DebugLogOutput("setChangeScreen - " + "CurrentSelectDeviceId : " + mCurrentScreenId + " / NextLayoutId : " + nScreenId + " / OnlyRemove : " + OnlyRemove);
-
- // 1. 현재 Layout 삭제
- boolean remove = false;
- if (mCurrentScreenId > 0) {
- remove = true;
- MainScreenLayout.removeAllViews();
- super.setCurrentScreen(null);
- }
-
- if (OnlyRemove) return true;
-
- mCurrentScreenId = nScreenId;
-
- // 2. 새로운 Layout 표시
- try {
- switch (nScreenId) {
- case ID.SCREENS.SCREEN_MAIN:
- MainScreen = new MAIN(getContext(), MainScreenLayout, mWallPadAPI, m_CallSubMenuScreen, DEVICE_OPERATION_MODE);
- super.setCurrentScreen(MainScreen);
- break;
- case ID.SCREENS.SCREEN_SUB_01:
- SUB_01Screen = new SUB_01(getContext(), MainScreenLayout, mWallPadAPI);
- super.setCurrentScreen(SUB_01Screen);
- break;
- case ID.SCREENS.SCREEN_SUB_02:
- SUB_02Screen = new SUB_02(getContext(), MainScreenLayout, mWallPadAPI);
- super.setCurrentScreen(SUB_02Screen);
- break;
- case ID.SCREENS.SCREEN_METROUI_MAIN:
- MetroUI_MainScreen = new METROUI_MAIN(getContext(), MainScreenLayout, mWallPadAPI, m_CallSubMenuScreen);
- super.setCurrentScreen(MetroUI_MainScreen);
- break;
- case ID.SCREENS.SCREEN_METROUI_SUB_01:
- MetroUI_SUB_01Screen = new METROUI_SUB_01(getContext(), MainScreenLayout, mWallPadAPI);
- super.setCurrentScreen(MetroUI_SUB_01Screen);
- break;
- case ID.SCREENS.SCREEN_METROUI_SUB_02:
- MetroUI_SUB_02Screen = new METROUI_SUB_02(getContext(), MainScreenLayout, mWallPadAPI);
- super.setCurrentScreen(MetroUI_SUB_02Screen);
- break;
- default:
- Log.e(TAG, "[Error] setChangeScreen - nScreenId Not found!!! (" + mCurrentScreenId + ")");
- mCurrentScreenId = -1;
- return false;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- }
- catch (Exception e) {
- Log.e(TAG, "[ExceptionError] - setChangeScreen->Screen Create : " + e);
- return false;
- }
- return true;
- }
-
- /////////////////////////////////////////////////////////////////////////////////
-
- private void runDeviceService() {
- try {
- Log.i(TAG, "[runDeviceService] ===== START =====");
- /* 2018.01.30 속초 아이파크 RF현관카메라 연동으로 인하여 수정
- // 우선 제어기기 연동 기능이 없음
- if( Version.getModelType() == Version.MODEL_TYPE.IHN_750 )
- return;
- */
- if (!getIsSubWallpad()) {
- ActivityManager mActivityManager = (ActivityManager)getApplicationContext().getSystemService(Context.ACTIVITY_SERVICE);
- List<ActivityManager.RunningAppProcessInfo> RunningAppList = mActivityManager.getRunningAppProcesses();
- Common.DebugLog("[runDeviceService] -----> RunningAppProcessInfo : " + RunningAppList.size() + " +++ Version : " + this.getAppVersion());
- for (int i = 0; i < RunningAppList.size(); i++) {
- ActivityManager.RunningAppProcessInfo RunningAppListInfo = RunningAppList.get(i);
- Common.DebugLog("[runDeviceService] -----> RunningAppListInfo.processName : " + RunningAppListInfo.processName);
- if (RunningAppListInfo.processName.equals("com.artncore.deviceservice")) {
- Log.w(TAG, "[runDeviceService] DevService is already running");
- return;
- }
- }
- Log.i(TAG, "[runDeviceService] Start DevService!!");
- Intent mIntent = new Intent("wallpaddevservice.ServiceMain");
- startService(mIntent);
- }
- else {
- Log.w(TAG, "[runDeviceService] This wallpad is sub-wallpad. not need DevService!!!");
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] runDeviceService()");
-
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private void runOcfService() {
- Log.i(TAG, "[runOcfService] Start LightControlService!!");
- ActivityManager mActivityManager = (ActivityManager)getApplicationContext().getSystemService(Context.ACTIVITY_SERVICE);
- List<ActivityManager.RunningAppProcessInfo> RunningAppList = mActivityManager.getRunningAppProcesses();
- Common.DebugLog("[runOcfService] -----> RunningAppProcessInfo : " + RunningAppList.size() + " +++ Version : " + this.getAppVersion());
- for (int i = 0; i < RunningAppList.size(); i++) {
- ActivityManager.RunningAppProcessInfo RunningAppListInfo = RunningAppList.get(i);
- Common.DebugLog("[runOcfService] -----> RunningAppListInfo.processName : " + RunningAppListInfo.processName);
- if (RunningAppListInfo.processName.equals("kr.co.icontrols.ocfservice")) {
- Log.w(TAG, "[runOcfService] DevService is already running");
- return;
- }
- }
- Intent mIntent = new Intent("kr.co.icontrols.ocfservice.LightControlService");
- mIntent.setAction(ILightControlService.class.getName());
- mIntent.putExtra("name", "test");
- startService(mIntent);
- }
- private void runMultiControlService() {
- ActivityManager mActivityManager = (ActivityManager)getApplicationContext().getSystemService(Context.ACTIVITY_SERVICE);
- List<ActivityManager.RunningAppProcessInfo> RunningAppList = mActivityManager.getRunningAppProcesses();
- Common.DebugLog("[runMultiControlService] -----> RunningAppProcessInfo : " + RunningAppList.size() + " +++ Version : " + this.getAppVersion());
- for (int i = 0; i < RunningAppList.size(); i++) {
- ActivityManager.RunningAppProcessInfo RunningAppListInfo = RunningAppList.get(i);
- Common.DebugLog("[runMultiControlService] -----> RunningAppListInfo.processName : " + RunningAppListInfo.processName);
- if (RunningAppListInfo.processName.equals("kr.co.icontrols.wallpadmulticontrolservice")) {
- Log.w(TAG, "[runMultiControlService] runMultiControlService is already running");
- return;
- }
- }
- Log.i(TAG, "[runMultiControlService] Start runMultiControlService!!");
- Intent mIntent = new Intent("wallpadmulticontrolservice.DataSenderService");
- startService(mIntent);
- }
- // 통신으로 들어오는 비상버튼 스킵하기 위한 딜레이 체크 변수
- private long EmerCommDelayTime = 0;
- public static String WALLPAD_ALERT = "WALLPAD_ALERT";
- BroadcastReceiver mWallPadAlertBR = new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- Log.i(TAG, "[mWallPadAlertBR] Receive alert BR");
- String strAction = intent.getAction();
- Log.d(TAG, "[mWallPadAlertBR] strAction [" + strAction + "]");
- if (strAction.equalsIgnoreCase(WALLPAD_ALERT)) {
- int kind = intent.getIntExtra("KIND",0);
- Log.i(TAG, "[mWallPadAlertBR] " + String.format("Receive alert BR [%d][tag:%s]", kind,String.valueOf(Alert_App_On)));
- // 제주 아이파크 스위트현장의 비상발생 증상을 디버깅하기 위한 코드 (JEFF, 2019.09.26)
- // if (kind == 4) {
- // try {
- // byte hFrom = intent.getByteExtra("FROM", (byte) 0xFF);
- // if (hFrom != (byte) 0xFF) {
- // if (hFrom % 10 == 3) {
- // Log.w(TAG, "[mWallPadAlertBR] Emergency from BathPhone!!!");
- // int nDstPort = 10000;
- // sendAlarmOperationToMainServer("10.0.1.1", nDstPort, EMER_STATE.FIRE, EMER_DETAIL_INFO.EMERGENCY_COMM);
- // return;
- // }
- // }
- // } catch (RuntimeException re) {
- // LogUtil.errorLogInfo("", TAG, re);
- // }
- // catch (Exception e) {
- // Log.e(TAG, "[Exception] mWallPadAlertBR - 1");
- // e.printStackTrace();
- // }
- // }
- if (kind == 30) Alert_App_On = true;
- else if (kind == 40) Alert_App_On = false;
- else {
- WallpadStatusData wdb = new WallpadStatusData(getApplicationContext());
- int alarmState = wdb.GetAlarmStatus();
- wdb.closeDB();
- if (alarmState == WallpadStatusData.ALARM_ARISE || alarmState == WallpadStatusData.ALARM_STOP) {
- // 알람화면이 현재 실행중이면 스킵
- Log.d(TAG, "Skip BR ==> Current Alarm state : "+ alarmState );
- return;
- }
- if (kind == 4 && ( Math.abs(System.currentTimeMillis()-EmerCommDelayTime) < 1000)) {
- // 통신 비상알람의 경우 중복으로 날라오는 경우가 있어서 필터링
- Log.d(TAG, "Skip BR ==> deleayTime :" + String.valueOf( Math.abs(System.currentTimeMillis()-EmerCommDelayTime)));
- return;
- }
- EmerCommDelayTime = System.currentTimeMillis();
- SendAppFinishReqBR();
- Log.i(TAG, "[mWallPadAlertBR] before Call Alert App");
- int base = 7000;
- int [] Menu_Id_List = { base+11, base+21 , base+31 , base+41, base+51};
- int Menu_Start_Id = base+21;
- int Menu_Start_Option = 1;
- String Cause = "none";
- if (kind == 1) Cause = "gas";
- else if (kind == 2) Cause = "fire";
- else if (kind == 4) Cause = "emergency_Comm";
- else if (kind == 5) {
- Cause = "heating_Leak";
- Menu_Start_Id = base + 51;
- }
- else {
- Cause = "unknown(" + kind + ")";
- }
- Intent newintent = new Intent(Intent.ACTION_MAIN);
- newintent.putExtra("MENU_ID_LIST", Menu_Id_List); // KEY : MENU_ID_LIST
- newintent.putExtra("MENU_START_ID", Menu_Start_Id); // KEY : MENU_START_ID
- newintent.putExtra("MENU_START_OPTION", Menu_Start_Option); // KEY : MENU_START_OPTION
- newintent.putExtra("MENU_DETAIL_INFO", Cause);
- newintent.setComponent(new ComponentName("kr.co.icontrols.wallpademergency", "kr.co.icontrols.wallpademergency.MainActivity"));
- newintent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
- startActivity(newintent);
- }
- }
- }
- };
- private void sendAlarmOperationToMainServer(String DstIP, int DstPort, EMER_STATE alarm_mode, EMER_DETAIL_INFO cause) {
- Log.d(TAG, "[sendAlarmOperationToMainServer] DstIP [" + DstIP + "], DstPort [" + DstPort + "], alarm_mode [" + EMER_STATE.GetXMLData(alarm_mode) + "], cause [" + EMER_DETAIL_INFO.GetXMLData(cause) + "]");
- WallpadStatusData wdb = new WallpadStatusData(this.getContext());
- AddressSet addc = wdb.getAddressMGR(); //DB에서 동호 정보 받아옴
- wdb.closeDB();
- final iMAPAlarmOperation imapAlarmOperation = new iMAPAlarmOperation(getContext() , addc);
- imapAlarmOperation.SetServerIPcfg(DstIP, DstPort);
- imapAlarmOperation.DoWork(alarm_mode, cause);
- imapAlarmOperation.SetRetCtr(new RetProci(){
- @Override
- public void ProcSuccess() {
- // TODO Auto-generated method stub
- Log.i(TAG, "[sendAlarmOperationToMainServer] ProcSuccess()");
- String result = imapAlarmOperation.GetAttributeVal(0, "result");
- Log.i(TAG, "[sendAlarmOperationToMainServer] result [" + result +"]");
- if (result.equalsIgnoreCase("ok")) {
- Log.i(TAG, "[sendAlarmOperationToMainServer] result [" + result +"]");
- }
- }
- @Override
- public void ProcError() {
- // TODO Auto-generated method stub
- Log.i(TAG, "[sendAlarmOperationToMainServer] ProcError() -> " + APIErrorCode.GetLogPrefix());
- }
- @Override
- public void ProcDoing() {
- // TODO Auto-generated method stub
- Log.i(TAG, "[sendAlarmOperationToMainServer] ProcDoing()");
- }
- });
- }
- private String getMainVersion() {
- return this.getAppVersion();
- }
-
- private int m_LiveImapServer = 0;
- private int m_LiveMainActivity = 0;
- private boolean m_IPActivity = false;
-
- BroadcastReceiver mWallPadNotifyBR = new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- String strAction = intent.getAction();
- int item = 0;
- Log.i(TAG, "[mWallPadNotifyBR] strAction [" + strAction + "]");
- if (strAction.equals(define.NOTIFY_ACNAME)) {
- int kind = intent.getIntExtra(Common.BR_MAIN_NOTI.KIND,0);
- Log.d(TAG, "[mWallPadNotifyBR] define.NOTIFY_ACNAME -> kind : " + kind);
- switch (kind) {
- case define.NOTIFY_GET_ELEC_CHARGE:
- String strState = intent.getStringExtra("sCharging_Status");
- String strCarNum = intent.getStringExtra("sCar_Num");
- String strChargerNum = intent.getStringExtra("sCharger_Num");
- if (strState.equals("start")) {
- try {
- WallpadStatusData SetData = new WallpadStatusData(getContext());
- boolean soundOut = SetData.GetSoundOutputOfEventAlarm();
- SetData.closeDB();
- if (soundOut) Sound().Play(SND.effect.EFFECT1);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
-
- LogUtil.errorLogInfo("", TAG, e);
- }
- // 충전시작
- Intent data = new Intent();
- data.putExtra("CarNum", strCarNum);
- data.putExtra("ChargerNum", strChargerNum);
- data.putExtra("Msg", "충전을 시작합니다.");
- mIOInterface.ctrlLcdWakeUp();
- StartPopup(ID.POPUPS.POPUP_CHARGINGELECTRICVEHICLE, data);
- }
- else if (strState.equals("stop")) {
- try {
- WallpadStatusData SetData = new WallpadStatusData(getContext());
- boolean soundOut = SetData.GetSoundOutputOfEventAlarm();
- SetData.closeDB();
- if (soundOut) Sound().Play(SND.effect.EFFECT1);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
-
- LogUtil.errorLogInfo("", TAG, e);
- }
- // 충전 종료
- Intent data = new Intent();
- data.putExtra("CarNum", strCarNum);
- data.putExtra("ChargerNum", strChargerNum);
- data.putExtra("Msg", "충전이 종료되었습니다.");
- mIOInterface.ctrlLcdWakeUp();
- StartPopup(ID.POPUPS.POPUP_CHARGINGELECTRICVEHICLE, data);
- }
- break;
- case define.NOTIFY_INTERLAYTER_NOISE_ALARM:
- if (checkInterFloorNoiseFuncUsage()) {
- mIOInterface.ctrlLcdWakeUp();
- StartPopup(ID.POPUPS.POPUP_INTERFLOORNOISEOCCURED);
- }
- break;
- case define.NOTIFY_INTERLAYTER_SENSOR_STATUS_CHANGE :
- if (checkInterFloorNoiseFuncUsage() && checkInterFloorNoiseError()) {
- mIOInterface.ctrlLcdWakeUp();
- StartPopup(ID.POPUPS.POPUP_INTERFLOORNOISEERROR);
- }
- break;
- case define.NOTIFY_AUTOPICTURE_FINISH:
- Log.d(TAG, "[mWallPadNotifyBR] define.NOTIFY_AUTOPICTURE_FINISH");
- // 전자액자 종료 BR 수신시 LCD ON Flag 제거
- ctrlLCDOnOff(false);
- break;
- case define.NOTIFY_ALARM_CHANGE:
- Log.d(TAG, "[mWallPadNotifyBR] define.NOTIFY_ALARM_CHANGE");
- // WallpadStatusData SetData = new WallpadStatusData(getApplicationContext());
- // int nAlarmStatus = SetData.GetAlarmStatus();
- // SetData.closeDB();
- //
- // Log.d(TAG, "[mWallPadNotifyBR] nAlarmStatus = " + nAlarmStatus);
- // if (nAlarmStatus == WallpadStatusData.GUARD_IN) {
- // mSound.PlayMent(SND.mode.INMODE_SETTING);
- // }
- // else if (nAlarmStatus == WallpadStatusData.GUARD_OUT) {
- // mSound.PlayMent(SND.mode.OUTMODE_SETTING);
- // }
- // else if (nAlarmStatus == WallpadStatusData.ALARM_NONE) {
- // mSound.PlayMent(SND.mode.NORMALMODE_COMEBACK);
- // }
- break;
- case define.NOTIFY_PLAYMENT:
- int sndidx = intent.getIntExtra(define.NOTIBR_CONTENT,0);
- Sound().PlayMent(sndidx);
- case define.NOTIFY_DEVICE_INIT_COMPLETION:
- Log.i(TAG, "[mWallPadNotifyBR] NOTIFY_DEVICE_INIT_COMPLETION: bLCDKeeperUsage [" + bLCDKeeperUsage +"]");
- if (bLCDKeeperUsage) registerLCDKeeper();
- if (getStrangerRecordingManagerSetting() && getStrangerRecordingUserSetting()) {
- registerNoticeStrangerRecord();
- }
- break;
- default:
- Log.w(TAG, "[mWallPadNotifyBR] (BR.nKind) Not support!! -> " + kind);
- break;
- }
- }
- else if (strAction.equals(Common.BR_ACK_WALLPADCALL_LIVE)) {
- Log.d(TAG, "[mWallPadNotifyBR] Common.BR_ACK_WALLPADCALL_LIVE");
- return;
- }
- else if (strAction.equals(define.DRIVER_VENTIL_BR)) {
- Log.d(TAG, "[mWallPadNotifyBR] define.DRIVER_VENTIL_BR");
- return;
- }
- else if (strAction.equals(Common.BR_MAIN_NOTI.ACNAME_MAIN_NOTI)) {
- try {
- int kind = intent.getIntExtra(Common.BR_MAIN_NOTI.KIND,0);
- Log.d(TAG, "[mWallPadNotifyBR] ACNAME_MAIN_NOTI -> kind : " + kind);
- switch (kind) {
- case Common.BR_MAIN_NOTI.ARRIVED_CAR:
- StartPopup(ID.POPUPS.POPUP_VEHICLEARRIVED, intent);
- // StartPopup(ID_OLD.SCREENS.ArrivedCarPopupScreen);
- break;
- case Common.BR_MAIN_NOTI.UI_UPDATE_PARCEL:
- StartPopup(ID.POPUPS.POPUP_PARCELRECEIVED);
- // StartPopup(ID_OLD.SCREENS.DeliveryBox);
- break;
- case Common.BR_MAIN_NOTI.SMARTKEY_ALARM_BR:
- StartPopup(ID.POPUPS.POPUP_SMARTKEYEMERGENCY, intent);
- // StartPopup(ID_OLD.SCREENS.SmartKeyAlarmPopupScreen, intent);
- break;
- case Common.BR_MAIN_NOTI.UI_BANDLOCATION_ALARM:
- int nCardNum = intent.getIntExtra(Common.BR_MAIN_NOTI.CARD_NUM,0);
- Intent mIntent = new Intent();
- mIntent.putExtra(Common.BR_MAIN_NOTI.CARD_NUM, nCardNum);
- StartPopup(ID.POPUPS.POPUP_BANDLOCATIONALARM, mIntent);
- break;
- case Common.BR_MAIN_NOTI.UI_UPDATE_POST:
- StartPopup(ID.POPUPS.POPUP_POSTRECEIVED);
- break;
- case Common.BR_MAIN_NOTI.NOTICE_DETECT_STRANGER:
- // 알람 상태 확인
- int doorCamType = intent.getIntExtra("DOORCAM_TYPE", -1);
- Intent data = new Intent();
- data.putExtra("DOORCAM_TYPE", doorCamType);
- // StartPopup(ID.POPUPS.POPUP_NOTICESTRANGER, data); // 시나리오 변경: 거동수상자 알림 팝업 삭제 (바로 녹화 시작)
- // 메인 앱으로 BR 전송
- Intent notiIntent = new Intent();
- notiIntent.setAction(define.NOTIFY_ACNAME);
- notiIntent.putExtra(define.NOTIBR_KIND, define.NOTIFY_ACCEPT_RECORD_STRANGER);
- mContext.sendBroadcast(notiIntent);
- break;
- case Common.BR_MAIN_NOTI.ACCEPT_RECORDING:
- checkRecordTimer();
- int nEmerState = intent.getIntExtra("EMERGENCY_STATE", -1);
- Log.d(TAG, "[mWallPadNotifyBR] nEmerState [" + nEmerState + "], bRecordStatus [" + bRecordStatus + "]");
- // m_CallSubMenuScreen.callStartCallAPK(ID.LINKEDSCREEN.SubCall.Door_Record, nEmerState); // 거동수상자 발생시 통화 앱에서 녹화
- if (!bRecordDelay) {
- if (!bRecordStatus) {
- if (nEmerState == WallpadStatusData.GUARD_OUT) {
- Log.d(TAG, "[mWallPadNotifyBR] ===== NOTIFY_GUARD_OUT_RECORDING =====");
- Intent GIntent = new Intent(); // 외출방범 중 거동수상자 녹화 알림 -> 외출방범 앱 종료시 방범 상태를 해제하지 않음
- GIntent.setAction("Alarm Running");
- GIntent.putExtra(define.NOTIBR_KIND, define.NOTIFY_GUARD_OUT_RECORDING);
- mContext.sendBroadcast(GIntent);
- }
- Common.SendAppFinishReqBR(getApplicationContext());
- startStrangerRecord(); // 시나리오 수정 -> 메인 앱에서 바로 녹화
- }
- } else {
- Log.w(TAG, "[mWallPadNotifyBR] Block Stranger Record!!! bRecordDelay [" + bRecordDelay + "]");
- }
- break;
- case Common.BR_MAIN_NOTI.NOTICE_DOORCAM_BTN:
- // 거동수상자 녹화 중 현관카메라 호출되는 경우
- Log.d(TAG, "[mWallPadNotifyBR] NOTICE_DOORCAM_BTN === bRecordStatus [" + bRecordStatus + "] ===");
- stopStrangerRecord(true);
- showFrontCam(false);
- runNoticeStrangerRecord(false);
- break;
- case Common.BR_MAIN_NOTI.NOTICE_FRONT_MONITOR_BTN:
- // 거동수상자 녹화 중 하단 LED 버튼을 통해 현관 모니터링 실행되는 경우
- Log.d(TAG, "[mWallPadNotifyBR] NOTICE_FRONT_MONITOR_BTN === bRecordStatus [" + bRecordStatus + "] ===");
- stopStrangerRecord(true);
- runNoticeStrangerRecord(false);
- break;
- case Common.BR_MAIN_NOTI.ONOFF_CAMERA_BTN:
- // Camera_ONOFF 설정.
- int ret = mIOInterface.getCameraOnOFF();
- break;
- default:
- Log.w(TAG, "[mWallPadNotifyBR] (BR.nKind) Not support!! -> " + kind);
- break;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- e.toString();
- }
- return;
- }
- else if(strAction.equals(BR_MAIN_LIVE_CHECKER.ACNAME_MAIN_LIVE_CHECKER )) {
- int kind = intent.getIntExtra(BR_MAIN_LIVE_CHECKER.KIND,0);
- Log.d(TAG, "[mWallPadNotifyBR] BR_MAIN_LIVE_CHECKER.ACNAME_MAIN_LIVE_CHECKER -> kind : " + kind + ", m_LiveImapServer [" + m_LiveImapServer + "], m_LiveMainActivity [" + m_LiveMainActivity + "]");
- if (kind == BR_MAIN_LIVE_CHECKER.IMAP_SERVER) {
- Log.d(TAG, "[mWallPadNotifyBR] received Imap Server Live !");
- m_LiveImapServer++;
- }
- else if( kind == BR_MAIN_LIVE_CHECKER.MAIN_ACTIVITY) {
- Log.d(TAG, "[mWallPadNotifyBR] received Main Activity Live !");
- m_LiveMainActivity++;
- if (m_IPActivity == false) {
- Log.d(TAG, "[mWallPadNotifyBR] IP is not set");
- m_LiveImapServer++;
- }
- }
- Log.d(TAG, "[mWallPadNotifyBR] m_LiveImapServer [" + m_LiveImapServer + "], m_LiveMainActivity [" + m_LiveMainActivity +"]");
- return;
- }
- int kind = intent.getIntExtra("KIND",0);
- Log.d(TAG, "MainActivity mWallPadNotifyBR Receive Notify BR "+kind+" "/*+electr.isActive()*/);
- switch (kind) {
- case define.NOTIFY_ELE_MOVE:
- // if (electr!= null /*&& electr.isActive()*/)
- // {
- // Log.i("MAINSCREEN", "Receive NOTIFY_ELE_MOVE");
- // electr.updateUI(intent.getStringExtra("FLOOR"), intent.getByteExtra("UPDOWN",(byte)-1));
- // }
- break;
- case define.NOTIFY_ELE_ARRIVAL_UP:
- Log.i("AIDLTEST", "Receive NOTIFY_ELE_ARRIVAL_UP");
- Sound().Play(SND.elevator.UP_ARRIVED);
- break;
- case define.NOTIFY_ELE_ARRIVAL_DOWN:
- try {
- WallpadDeviceSet devset = new WallpadDeviceSet(getApplicationContext());
- int eleinfo = devset.Get_Elevator_Info();
- devset.closeDB();
- if (WallpadDeviceSet.ELEVATOR_SIMPLE == eleinfo) Sound().Play(SND.elevator.ORG_ARRIVED);
- else if (WallpadDeviceSet.ELEVATOR_FLOOR == eleinfo) Sound().Play(SND.elevator.DN_ARRIVED);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
-
- LogUtil.errorLogInfo("", TAG, e);
- }
- break;
- case define.NOTIFY_UPDATE_START:
- try {
- String updateFile = intent.getStringExtra("PATH");
- Log.i("WALLPADAPI","Call Update App :" + updateFile);
- if (updateFile==null) return;
- ComponentName cn = new ComponentName("com.telechips.android.systemupdater","com.telechips.android.systemupdater.SystemUpdate");
- Intent Uintent = new Intent(Intent.ACTION_MAIN);
- Uintent.addCategory(Intent.CATEGORY_LAUNCHER);
- Uintent.putExtra("updatefile",updateFile);
- Uintent.setComponent(cn);
- startActivity(Uintent);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
-
- LogUtil.errorLogInfo("", TAG, e);
- }
- break;
- case define.NOTIFY_DEVSERVICE_START:
- mWallPadAPI = new WallPadAPI(getApplicationContext());
- break;
- case define.NOTIFY_DEVICECONNECTED:
- //DevLockCtr.ReleaseLock(define.DEVICE_LOCK_SVC_INIT);
- break;
- case define.NOTIFY_SENDBOOTUP_FAIL:
- // 부트업 실패시 5초 간격으로 다시 시도하도록 수정.
- mWallPadApiCheckHandler.sendEmptyMessageDelayed(10, 10000);
- break;
- case define.NOTIFY_IMAPSERVER_START:
- case Common.DEVICE_BOOTUP_RETRY:
- Log.i(TAG, "Try Send Boot up MSG kind : " + kind );
- bootupretryCNT++;
- if (bootupretryCNT > MAX_BOOTUP_RETRY_COUNT) break;
- try {
- WallpadStatusData SetData = new WallpadStatusData(getApplicationContext());
- if (SetData != null) {
- // AnC 기존 코드는 네트워크 연결이 안된경우 DB Close를 50회를 안 하도록 되어있어서 수정함.
- String strServerIP = SetData.GetServerIP();
- int nServerPort = SetData.GetServerPort();
- String svrVersion = SetData.GetServerVer();
- Log.d(TAG, "DB Server Version : " + svrVersion );
- if (svrVersion == null) svrVersion = "1.0";
-
- //설정정보 버전 가져오기
- StringBuilder result = new StringBuilder();
- result.append(SetData.GetSettingVer());
- SetData.closeDB();
- String Setting_Version = result.toString();
- Log.i(TAG, "Setting's Version :"+Setting_Version);
- boolean mNewDanjiServer = false;
- try {
- WallpadDeviceSet wallpadDeviceSet = new WallpadDeviceSet(getApplicationContext());
- mNewDanjiServer = wallpadDeviceSet.GetNewDanjiServer();
- wallpadDeviceSet.closeDB();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- mNewDanjiServer = false;
- }
- catch (Exception e) {
- Log.e(TAG, "[iMapSverSocket] - GetNewDanjiServer ExceptionError !!!");
-
- LogUtil.errorLogInfo("", TAG, e);
- mNewDanjiServer = false;
- }
- if (mNewDanjiServer == true) {
- // DB 값하고 , 신형단지서버 사용 설정이 동일 하다면 DB값을 전달한다.
- // 나중에 2.X 이상 버전이 갱신될 경우를 위해서
- }
- else {
- svrVersion = "1.0";
- }
- //Main App 버전정보 가져오기
- WallPadiMAPNotifyAPI notify = new WallPadiMAPNotifyAPI(getApplicationContext());
- notify.SetSocketWaitCount(3000);
- notify.SetServerIPcfg(strServerIP, nServerPort);
- notify.Send_Device_BootUP(getMainVersion(), Setting_Version , svrVersion );
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- Intent Newintent = new Intent();
- Newintent.setAction(define.NOTIFY_ACNAME);
- Newintent.putExtra(define.NOTIBR_KIND,define.NOTIFY_SENDBOOTUP_FAIL);
- sendBroadcast(Newintent);
- }
- catch (Exception e) {
-
- LogUtil.errorLogInfo("", TAG, e);
- Intent Newintent = new Intent();
- Newintent.setAction(define.NOTIFY_ACNAME);
- Newintent.putExtra(define.NOTIBR_KIND,define.NOTIFY_SENDBOOTUP_FAIL);
- sendBroadcast(Newintent);
- }
- break;
- case define.NOTIFY_SUBDEVCALLBUSY:
- /*
- callbtn = (Button)findViewById(R.id.Callbtn);
- callbtn.setBackgroundResource(R.drawable.but_call_on);
- MAIN_CALL_LOCK = true;
- */
- break;
-
- case define.NOTIFY_SUBDEVCALLEND:
- /*
- callbtn = (Button)findViewById(R.id.Callbtn);
- callbtn.setBackgroundResource(R.drawable.but_call);
- MAIN_CALL_LOCK = false;
- */
- break;
- case define.NOTIFY_UPDATECALLDATA:
- try{
- String[] UpdateCallData = intent.getStringExtra(define.NOTIBR_CONTENT).split(define.DEVCTR_CMD_SPLITER);
- Log.i(APIErrorCode.GetLogPrefix(),"Receive NOTIFY_UPDATECALLDATA "+UpdateCallData[0]+";"+UpdateCallData[1]);
- int IncallCnt = 0;
- int VisitorCNT = 0;
- try {
- IncallCnt = Integer.parseInt(UpdateCallData[0]);
- VisitorCNT = Integer.parseInt(UpdateCallData[1]);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
-
- LogUtil.errorLogInfo("", TAG, e);
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
-
- LogUtil.errorLogInfo("", TAG, e);
- }
- break;
- case define.NOTIFY_UPDATENOTICE:
- Common.DebugLog("Main Activity Receive Br=== . define.NOTIFY_UPDATENOTICE ");
- try {
- WallpadStatusData SetData = new WallpadStatusData(getApplicationContext());
- boolean soundOut = SetData.GetSoundOutputOfEventAlarm();
- SetData.closeDB();
- if (soundOut) {
- Sound().PlayMent(SND.effect.EFFECT1);
- }
- mIOInterface.ctrlLcdWakeUp();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) { LogUtil.errorLogInfo("", TAG, e);
-
- }
- break;
- case define.NOTIFY_UPDATEPARCEL:
- try {
-
- String type = intent.getStringExtra(define.NOTIBR_CONTENT);
- int itemcnt = intent.getIntExtra("REMAIN_CNT",-1);
-
- WallpadStatusData SetData = new WallpadStatusData(getApplicationContext());
- boolean soundOut = SetData.GetSoundOutputOfEventAlarm();
- if (itemcnt !=-1) SetData.SetParcelCNT(itemcnt);
- SetData.closeDB();
-
- Common.DebugLog("Main Activity Receive Br=== . define.NOTIFY_UPDATEPARCEL itemcnt : " + itemcnt);
- // if (soundOut) {
- // if (type.equals("parcel_in")) {
- // PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
- // pm.userActivity(1, true);
- // Sound().PlayMent(SND.mode.BOX_ARRIVED);
- // }
- // }
-
- Log.d(TAG, "Send BR --> Common.BR_MAIN_NOTI.UI_UPDATE_PARCEL");
- Intent Newintent = new Intent();
- Newintent.setAction(Common.BR_MAIN_NOTI.ACNAME_MAIN_NOTI);
- Newintent.putExtra(Common.BR_MAIN_NOTI.KIND, Common.BR_MAIN_NOTI.UI_UPDATE_PARCEL);
- getApplicationContext().sendBroadcast(Newintent);
-
- //NoticeIconOnoff(true);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
-
- LogUtil.errorLogInfo("", TAG, e);
- }
-
- // if (type.equals("parcel_in"))
- // {
- // PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
- // pm.userActivity(1, true);
- // PlayNotiSound(WpadSound.SND.mode.BOX_ARRIVED);
- // }
- //
- // if (itemcnt!=-1){
- // if (itemcnt > 0)
- // ParcelIconOnoff(true);
- // else
- // ParcelIconOnoff(false);
- // WallpadStatusData ParData = new WallpadStatusData(getApplicationContext());
- // ParData.SetParcelCNT(itemcnt);
- // ParData.closeDB();
- // if (ParcelMGR!=null) ParcelMGR.updateParcel();
- // }
-
- break;
- case define.NOTIFY_UPDATEPOST:
- try {
- int nItemCnt = intent.getIntExtra("ITEM",-1);
- Log.d(TAG, "[UI_UPDATE_POST] nItemCnt [" + nItemCnt + "]");
- WallpadStatusData SetData = new WallpadStatusData(getApplicationContext());
- if (nItemCnt != -1) SetData.SetPostCNT(nItemCnt);
- SetData.closeDB();
- Common.DebugLog("Main Activity Receive Br=== . define.NOTIFY_UPDATEPOST nItemCnt : " + nItemCnt);
- Log.d(TAG, "Send BR --> Common.BR_MAIN_NOTI.UI_UPDATE_POST");
- Intent Newintent = new Intent();
- Newintent.setAction(Common.BR_MAIN_NOTI.ACNAME_MAIN_NOTI);
- Newintent.putExtra(Common.BR_MAIN_NOTI.KIND, Common.BR_MAIN_NOTI.UI_UPDATE_POST);
- getApplicationContext().sendBroadcast(Newintent);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] mWallPadNotifyBR.onReceive()");
-
- LogUtil.errorLogInfo("", TAG, e);
- }
- break;
- case define.NOTIFY_UPDATEPARKING:
- Common.DebugLog("Main Activity Receive Br=== . define.NOTIFY_UPDATEPARKING ");
-
- /*
- WallpadParkInfo parkdb = new WallpadParkInfo(getApplicationContext());
- List<String[]> parkList = parkdb.GetParkInfo();
-
- if(parkList != null)
- {
- for(int j= 0; j<parkList.size(); j++)
- {
- for(int i = 0; i<4; i++)
- {
- Common.DebugLog("parkList.get("+j+")["+i+"]:"+ parkList.get(j)[i]);
- }
-
- }
- }
- parkdb.closeDB();
- */
- break;
- case define.NOTIFY_DEVICEREBOOT:
- try {
- //[Model]
- // if (Version.getPlatformType() == Version.PLATFORM_TYPE.A20) {
- // // A20
- // PowerManager pm = (PowerManager)getSystemService(Context.POWER_SERVICE);
- // pm.userActivity(8, true);
- // }
- // else if (Version.getPlatformType() == Version.PLATFORM_TYPE.A40i) {
- if (Version.getPlatformType() == Version.PLATFORM_TYPE.A40i) {
- // V40
- V40IOInterface mV40IOInterface = new V40IOInterface();
- mV40IOInterface.setV40Reboot(5);
- }
- else {
- // TCC8935
- SendAppFinishReqBR();
- ComponentName cnA = new ComponentName("com.artncore.updater","com.artncore.updater.MainActivity");
- intent = new Intent(Intent.ACTION_MAIN);
- intent.addCategory(Intent.CATEGORY_LAUNCHER);
- intent.putExtra("updatesystem", "no");
- intent.putExtra("updateapp", " no ");
- intent.putExtra("rebootcmd", "reboot");
- intent.setComponent(cnA);
- startActivity(intent);
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
-
- LogUtil.errorLogInfo("", TAG, e);
- }
- break;
- case define.NOTIFY_DEVICEDEEPSLEEP:
- try {
- Log.d(TAG, "[mWallPadAlertBR] NOTIFY_DEVICEDEEPSLEEP");
- WallpadStatusData sdb = new WallpadStatusData(getApplicationContext());
- String[] getstate = sdb.GetSystemUpdateStatus();
- for (int i = 0; i < getstate.length; i++) {
- Log.d(TAG, "[mWallPadAlertBR] getstate[" + i + "] = " + getstate[i]);
- }
- if (getstate[0].equalsIgnoreCase("SET")) {
- sdb.SetSystemUpdate(null, null);
- sdb.SetUpgradeState(true);
- ComponentName cnn = new ComponentName("com.artncore.updater","com.artncore.updater.MainActivity");
- intent = new Intent(Intent.ACTION_MAIN);
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- intent.addCategory(Intent.CATEGORY_LAUNCHER);
- intent.putExtra("updatesystem", getstate[1]);
- intent.putExtra("updateapp", getstate[2]);
- intent.setComponent(cnn);
- Log.e("MAINSCREEN","Call Upgrade Request BSP : "+getstate[1]+" APP : "+getstate[2]);
- startActivity(intent);
- }
- sdb.closeDB();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
-
- LogUtil.errorLogInfo("", TAG, e);
- }
- break;
- case define.NOTIFY_SYSTEMTIMESETTED:
- try {
- Common.DebugLog("MainActivity ---------- > define.NOTIFY_SYSTEMTIMESETTED");
- Calendar caldata = new GregorianCalendar();
- // refreshdate(caldata);
- // refreshclock(caldata);
- if (SYSTEM_TIME_SET == false) {
- SYSTEM_TIME_SET = true;
- if (SCManager != null) {
- if (SCManager.isSetted != true) SCManager.refreshSchedule();
- }
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
-
- LogUtil.errorLogInfo("", TAG, e);
- }
- break;
- case define.NOTIFY_SCHEDULEUPDATED:
- // item = intent.getIntExtra("ITEM",0);
- // if (item == ScheduleManager.SCHEDULE_TYPE_SCHEDULER && SYSTEM_TIME_SET)
- // SCManager.refreshSchedulerData();
- // else if (item == ScheduleManager.SCHEDULE_TYPE_SYSRESET && SYSTEM_TIME_SET)
- // SCManager.refreshsysreset();
- // else if (item == ScheduleManager.SCHEDULE_TYPE_MORNINGCALL && SYSTEM_TIME_SET)
- // SCManager.refreshMorningCall();
- // break;
- case define.NOTIFY_ALARMSTAUSCHANGED:
- try {
- item = intent.getIntExtra("ITEM",0);
- if (item == WallpadStatusData.GUARD_OUT) {
- int base = 8000;
- int [] Menu_Id_List = { base+11};
- int Menu_Start_Id = base+11;
- int Menu_Start_Option = -1;
- Intent iintent = new Intent(Intent.ACTION_MAIN);
- iintent.putExtra("MENU_ID_LIST", Menu_Id_List); // KEY : MENU_ID_LIST
- iintent.putExtra("MENU_START_ID", Menu_Start_Id); // KEY : MENU_START_ID
- iintent.putExtra("MENU_START_OPTION", Menu_Start_Option); // KEY : MENU_START_OPTION
- iintent.setComponent(new ComponentName("kr.co.icontrols.wallpadoutmoderun","kr.co.icontrols.wallpadoutmoderun.MainActivity"));
- startActivity(iintent);
- }
- else if (item == WallpadStatusData.GUARD_IN) {
- WallpadStatusData SettData = new WallpadStatusData(getApplicationContext());
- // Button callBtn = (Button)findViewById(R.id.GuardBtn);
- // callBtn.setBackgroundResource((SettData.GetAlarmStatus() == WallpadStatusData.GUARD_IN)?R.drawable.but_guard_on:R.drawable.but_guard);
- SettData.closeDB();
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
-
- LogUtil.errorLogInfo("", TAG, e);
- }
- break;
- case define.NOTIFY_ENERGYUPDATE:
- try
- {
- Calendar caldata = new GregorianCalendar();
- String[] getData = intent.getStringExtra(define.NOTIBR_CONTENT).split(define.DEVCTR_CMD_SPLITER);
- String checkDate = String.format("%04d%02d%02d",caldata.get(Calendar.YEAR),caldata.get(Calendar.MONTH)+1,caldata.get(Calendar.DAY_OF_MONTH));
- WallpadStatusData energyData = new WallpadStatusData(getApplicationContext());
- energyData.SetEnergyData(intent.getStringExtra(define.NOTIBR_CONTENT));
- energyData.SetEnergyCheckDate(checkDate);
- energyData.closeDB();
- //if (NeedCheckEnergy)
- // CheckEnergyUsage(getData);
- // if (EnergyMGR!=null)
- // EnergyMGR.UpdateData(getData);
- }
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e )
- {
-
- LogUtil.errorLogInfo("", TAG, e);
- }
- break;
- case define.NOTIFY_STARTEFRAME:
- try
- {
- Log.w("MAINSCREEN"," Receive NOTIFY_STARTEFRAME Start StartAutoPictureAPP ");
- WallpadStatusData SettData = new WallpadStatusData(getApplicationContext());
-
- if (SettData.DecideAutoPictureAppStartOrNot(new GregorianCalendar()))
- {
- if (!SettData.StartAutoPictureAPP())
- {
- // PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
- // pm.userActivity(3, true);
- }
- }
- else
- {
- // PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
- // pm.userActivity(3, true);
- }
- SettData.closeDB();
- }
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e )
- {
- LogUtil.errorLogInfo("", TAG, e);
- }
- break;
- case define.NOTIFY_ADDDEVICELOCK:
- Log.w("MAINSCREEN"," Receive NOTIFY_ADDDEVICELOCK Start ");
- //DevLockCtr.AddLock(intent.getIntExtra(define.NOTIBR_CONTENT, 0));
- break;
- case define.NOTIFY_RELEASEDEVICELOCK:
- Log.w("MAINSCREEN"," Receive NOTIFY_RELEASEDEVICELOCK Start ");
- //DevLockCtr.ReleaseLock(intent.getIntExtra(define.NOTIBR_CONTENT, 0));
- break;
- case define.NOTIFY_PLAYMENT:
- {
- int sndidx = intent.getIntExtra(define.NOTIBR_CONTENT,0);
- Sound().PlayMent(sndidx);
-
- if (sndidx == WpadSound.SND.elevator.CALL) {
- byte floorInfo = intent.getByteExtra(define.NOTIBR_FLOOR,(byte)0);
- Log.e("MANUAL_MAIN", " PLAY MENT Get Ele Call : "+floorInfo);
- }
- }
- break;
-
- case define.NOTIFY_ENERGY_DATA:
- {
- try
- {
- Log.w("MAINSCREEN"," Receive NOTIFY_ENERGY DATA Start ");
-
- //에너지 데이터 개수 - 3종 또는 5종
- EnergyAlramPopupMgr.m_EnergyInfoCount = intent.getIntExtra(Common.ENERGY_INTENT_ENERGY_COUNT, -1);
- Log.w("MAINSCREEN"," ENERGY_INTENT_ENERGY_COUNT :"+ EnergyAlramPopupMgr.m_EnergyInfoCount);
-
- //에너지 단지서버에서 받아온 시간
- EnergyAlramPopupMgr.m_ReceiveYear = intent.getIntExtra(Common.ENERGY_INTENT_GETDATA_TIME_YEAR, -1);
- Log.w("MAINSCREEN"," ENERGY_INTENT_GETDATA_TIME_YEAR :"+ EnergyAlramPopupMgr.m_ReceiveYear);
-
- EnergyAlramPopupMgr.m_ReceiveMonth = intent.getIntExtra(Common.ENERGY_INTENT_GETDATA_TIME_MONTH, -1);
- Log.w("MAINSCREEN"," ENERGY_INTENT_GETDATA_TIME_MONTH :"+ EnergyAlramPopupMgr.m_ReceiveMonth);
-
- EnergyAlramPopupMgr.m_ReceiveDay = intent.getIntExtra(Common.ENERGY_INTENT_GETDATA_TIME_DAY, -1);
- Log.w("MAINSCREEN"," ENERGY_INTENT_GETDATA_TIME_DAY :"+ EnergyAlramPopupMgr.m_ReceiveDay );
-
- Log.w("MAINSCREEN"," ENERGY_INTENT_GETDATA_TIME_HOUR :"+ intent.getIntExtra(Common.ENERGY_INTENT_GETDATA_TIME_HOUR, -1));
-
- Log.w("MAINSCREEN"," ENERGY_INTENT_GETDATA_TIME_MINUTE :"+ intent.getIntExtra(Common.ENERGY_INTENT_GETDATA_TIME_MINUTE, -1));
-
- //전기 에너지 정보
- String Vaule = "";
- Vaule = intent.getStringExtra(Common.ENERGY_INTENT_USE_ELECTRIC);
- if( Vaule != null && Vaule.length() > 0 )
- EnergyAlramPopupMgr.m_Elec_UseValue = Double.parseDouble(Vaule);
-
- Vaule = intent.getStringExtra(Common.ENERGY_INTENT_GOAL_ELECTRIC);
- if( Vaule != null && Vaule.length() > 0 )
- EnergyAlramPopupMgr.m_Elec_GoalValue = Double.parseDouble(Vaule);
-
- //수도 에너지 정보
- Vaule = intent.getStringExtra(Common.ENERGY_INTENT_USE_WATER);
- if( Vaule != null && Vaule.length() > 0 )
- EnergyAlramPopupMgr.m_Water_UseValue = Double.parseDouble(Vaule);
-
- Vaule = intent.getStringExtra(Common.ENERGY_INTENT_GOAL_WATER);
- if( Vaule != null && Vaule.length() > 0 )
- EnergyAlramPopupMgr.m_Water_GoalValue = Double.parseDouble(Vaule);
-
- //가스 에너지 정보
- Vaule = intent.getStringExtra(Common.ENERGY_INTENT_USE_GAS);
- if( Vaule != null && Vaule.length() > 0 )
- EnergyAlramPopupMgr.m_Gas_UseValue = Double.parseDouble(Vaule);
-
- Vaule = intent.getStringExtra(Common.ENERGY_INTENT_GOAL_GAS);
- if( Vaule != null && Vaule.length() > 0 )
- EnergyAlramPopupMgr.m_Gas_GoalValue = Double.parseDouble(Vaule);
-
-
- //온수 에너지 정보
- if( EnergyAlramPopupMgr.m_EnergyInfoCount >= 5 )
- {
- Vaule = intent.getStringExtra(Common.ENERGY_INTENT_USE_HOTWATER);
- if( Vaule != null && Vaule.length() > 0 )
- EnergyAlramPopupMgr.m_HotWater_UseValue = Double.parseDouble(Vaule);
-
- Vaule = intent.getStringExtra(Common.ENERGY_INTENT_GOAL_HOTWATER);
- if( Vaule != null && Vaule.length() > 0 )
- EnergyAlramPopupMgr.m_HotWater_GoalValue = Double.parseDouble(Vaule);
-
- //난방 에너지 정보
- Vaule = intent.getStringExtra(Common.ENERGY_INTENT_USE_HEATING);
- if( Vaule != null && Vaule.length() > 0 )
- EnergyAlramPopupMgr.m_Heating_UseValue = Double.parseDouble(Vaule);
-
- Vaule = intent.getStringExtra(Common.ENERGY_INTENT_GOAL_HEATING);
- if( Vaule != null && Vaule.length() > 0 )
- EnergyAlramPopupMgr.m_Heating_GoalValue = Double.parseDouble(Vaule);
- }
- }
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e )
- {
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- break;
-
- case define.NOTIFY_GET_CAR_PARKING:
- try
- {
- if(bUseofNot_ParkingInfo == true)
- {
- bSetMSG_GetParkingInfo = true;
- LoadParkingDataFromServer();
- }
- else
- {
- DebugLogOutput("bUseofNot_ParkingInfo == false");
- }
-
- }
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e )
- {
- LogUtil.errorLogInfo("", TAG, e);
- }
- break;
-
- case define.NOTIFY_ENERGY_TARGET_INFO_ALARM_FROM_SERVER:
-
- String tempFromWhere = intent.getStringExtra("FromWhere");
- if(tempFromWhere == null)
- {
- ResultGetIntent = true;
- }
-
- String tempElect_target = intent.getStringExtra("elect_target");
- if(tempElect_target != null)
- {
- elect_target = tempElect_target;
- }
-
- String tempElect_used = intent.getStringExtra("elect_used");
- if(tempElect_used != null)
- {
- elect_used = tempElect_used;
- }
-
- String tempElect_info = intent.getStringExtra("elect_info");
- if(tempElect_info != null)
- {
- elect_info = tempElect_info;
- }
-
- String tempWater_target = intent.getStringExtra("water_target");
- if(tempWater_target != null)
- {
- water_target = tempWater_target;
- }
-
- String tempWater_used = intent.getStringExtra("water_used");
- if(tempWater_used != null)
- {
- water_used = tempWater_used;
- }
-
- String tempWater_info = intent.getStringExtra("water_info");
- if(tempWater_info != null)
- {
- water_info = tempWater_info;
- }
-
- String tempGas_target = intent.getStringExtra("gas_target");
- if(tempGas_target != null)
- {
- gas_target = tempGas_target;
- }
- String tempGas_used = intent.getStringExtra("gas_used");
- if(tempGas_used != null)
- {
- gas_used = tempGas_used;
- }
-
- String tempGas_info = intent.getStringExtra("gas_info");
- if(tempGas_info != null)
- {
- gas_info = tempGas_info;
- }
-
- String tempHotwater_target = intent.getStringExtra("hotwater_target");
- if(tempHotwater_target != null)
- {
- hotwater_target = tempHotwater_target;
- }
-
- String tempHotwater_used = intent.getStringExtra("hotwater_used");
- if(tempHotwater_used != null)
- {
- hotwater_used = tempHotwater_used;
- }
-
- String tempHotwater_info = intent.getStringExtra("hotwater_info");
- if(tempHotwater_info != null)
- {
- hotwater_info = tempHotwater_info;
- }
-
- String tempHeating_target = intent.getStringExtra("heating_target");
- if(tempHeating_target != null)
- {
- heating_target = tempHeating_target;
- }
- String tempHeating_used = intent.getStringExtra("heating_used");
- if(tempHeating_used != null)
- {
- heating_used = tempHeating_used;
- }
-
- String tempHeatin_info = intent.getStringExtra("heating_info");
- if(tempHeatin_info != null)
- {
- heating_info = tempHeatin_info;
- }
- break;
- case define.NOTIFY_DOORLOCK_OPEN_RECORDING:
- Log.d(TAG, "[mWallPadNotifyBR] NOTIFY_DOORLOCK_OPEN_RECORDING");
- // 통화 중 현관 문열림 알림
- // 거동수상자 녹화 중 현관 통화 문열림이 발생되면 저장된 파일을 삭제한다.
- deleteTempRecordFile();
- break;
- case define.NOTIFY_FRONTCALL_END_RECORDING:
- Log.d(TAG, "[mWallPadNotifyBR] NOTIFY_FRONTCALL_END_RECORDING");
- // 현관 통화 종료 알림
- // 거동수상자 녹화 중 현관 통화가 문열림 없이 종료되면 임시 저장 파일을 옮긴 후 디렉터리 삭제한다.
- moveTempRecordFile();
- break;
- }
- }
- };
-
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- private void ctrlLCDOnOff(boolean bOn) {
- try {
- if (bOn) {
- PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
- Log.d(TAG, "[ctrlLCDOnOff] Screen On: " + pm.isScreenOn());
- if (getCompareBSPVersion("2020.09.18")) {
- if (!checkLCDOnByCMD()) {
- Log.d(TAG, "[ctrlLCDOnOff] V40Interface LcdWakeUp Call!!");
- mIOInterface.ctrlLcdWakeUp(); // 절전상태일 경우, jni LcdWakeUp 먼저 호출
- }
- }
- else {
- if (!pm.isScreenOn()) {
- Log.d(TAG, "[ctrlLCDOnOff] V40Interface LcdWakeUp Call!!");
- mIOInterface.ctrlLcdWakeUp(); // 절전상태일 경우, jni LcdWakeUp 먼저 호출
- }
- }
- getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
- } else
- getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] ctrlLCDOnOff(boolean bOn)");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- protected void refreshUserCtr() {
- Intent intent = new Intent();
- intent.setAction(define.DRIVER_LIGHT_BR);
- Log.i("HIGH","StatusChanged BR Send "+define.DRIVER_LIGHT_BR);
- sendBroadcast(intent);
-
- intent = new Intent();
- intent.setAction(define.DRIVER_BATCHLIGHT_BR);
- Log.i("HIGH","StatusChanged BR Send "+define.DRIVER_BATCHLIGHT_BR);
- sendBroadcast(intent);
-
- intent = new Intent();
- intent.setAction(define.DRIVER_VENTIL_BR);
- Log.i("HIGH","StatusChanged BR Send "+define.DRIVER_VENTIL_BR);
- sendBroadcast(intent);
-
- // intent = new Intent();
- // intent.setAction(HEATERBR);
- // Log.i("HIGH","StatusChanged BR Send "+HEATERBR);
- // sendBroadcast(intent);
- }
-
-
- private void Check_Upgrade_File() {
- try {
- WallpadStatusData sdb = new WallpadStatusData(getApplicationContext());
- String[] getstate = sdb.GetSystemUpdateStatus();
- if (getstate[0].equalsIgnoreCase("SET")) {
- for (int i = 1; i < 3; i++) {
- if (!getstate[i].equals("no")) {
- String filePath = "/sdcard/"+getstate[i];
- File updradef = new File(filePath);
- if (updradef.exists()) FileDelete(updradef);//.delete();
- }
- }
- sdb.SetSystemUpdate(null, null);
- }
- sdb.closeDB();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] Check_Upgrade_File()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
-
- protected void SendAppFinishReqBR() {
- try {
- Log.e("MANUAL_MAIN", "Send Finish BR");
- // PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
- // pm.userActivity(1, true);
- // LCD Always ON
- getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
- Intent notiIntent = new Intent();
- notiIntent.setAction(define.BR_APP_FINISH);
- getApplicationContext().sendBroadcast(notiIntent);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] SendAppFinishReqBR()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
-
- private void registerBroadcastReceiver() {
- try {
- IntentFilter mIntentFilter = new IntentFilter();
- mIntentFilter.addAction("WALLPAD_ALERT");
- registerReceiver(mWallPadAlertBR, mIntentFilter);
- mIntentFilter = new IntentFilter();
- mIntentFilter.addAction("WALLPAD_NOTIFY");
- mIntentFilter.addAction(define.DRIVER_VENTIL_BR);
- mIntentFilter.addAction(Common.BR_MAIN_NOTI.ACNAME_MAIN_NOTI); // ACC 꺼와 구분되는 Noti 추가
- mIntentFilter.addAction(BR_MAIN_LIVE_CHECKER.ACNAME_MAIN_LIVE_CHECKER);
- mIntentFilter.addAction(Common.BR_ACK_WALLPADCALL_LIVE);
- registerReceiver(mWallPadNotifyBR, mIntentFilter);
- registerMainActivityBR();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] registerBroadcastReceiver()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private void unregisterBroadcastReceiver() {
- try {
- unregisterReceiver(mWallPadAlertBR);
- unregisterReceiver(mWallPadNotifyBR);
- unregisterReceiver(MainActivityBroadcastReceiver);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] unregisterBroadcastReceiver()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
-
- private void MainScrLog(String msg) {
- Log.e("MAINSCREEN",APIErrorCode.GetLogPrefix()+msg);
- }
- protected void CheckEnv() {
- try {
- File dnDIC = new File(BESTIN_LOCATION);
- if (!dnDIC.exists()) dnDIC.mkdir();
- dnDIC = new File(ALBUM_PICTURE_LOCATION);
- if (!dnDIC.exists()) dnDIC.mkdir();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] CheckEnv()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public void FileCopy(String Target, String Source) {
- FileInputStream input = null;
- FileOutputStream output = null;
- try {
- input = new FileInputStream(Source);
- long size = input.available();
- byte buff[] = new byte[(int)size];
- input.read(buff);
- output = new FileOutputStream(Target);
- output.write(buff);
- output.flush();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e ) {
- Log.e(TAG, "[Exception] FileCopy(String Target, String Source)");
- LogUtil.errorLogInfo("", TAG, e);
- }
- finally {
- if(input!=null) {
- try {
- input.close( );
- } catch (IOException e) {
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- input = null;
- if(output!=null) {
- try {
- output.close();
- } catch (IOException e) {
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- output = null;
- }
- }
- public void checkEventNotifications() {
- try {
- Log.d(TAG,"[checkEventNotifications] ========== START ==========)");
- // 스마트우편함, 전기차충전 연동 여부 확인
- int nRetElecVehicle = -1;
- WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(this.getContext());
- bSmartPostUsage = mWallpadDeviceSet.Get_SmartPostUse();
- nRetElecVehicle = mWallpadDeviceSet.GetDeviceSetted("전기차충전");
- mWallpadDeviceSet.closeDB();
- if (nRetElecVehicle == WallpadDeviceSet.DEV_DATA_ENABLE) bElecVehicleUsage = true;
- else bElecVehicleUsage = false;
- Log.d(TAG, "[checkEventNotifications] bSmartPostUsage [" + bSmartPostUsage + "], nRetElecVehicle [" + nRetElecVehicle + "], bElecVehicleUsage [" + bElecVehicleUsage + "]");
- // 부재중 통화
- WallpadCallHistoryData mWallpadCallHistoryData = new WallpadCallHistoryData(getContext());
- try {
- nMissedCallCnt = mWallpadCallHistoryData.RowCallHistoryCountData();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] checkEventNotifications() -> mWallpadCallHistoryData");
- LogUtil.errorLogInfo("", TAG, e);
- }
- mWallpadCallHistoryData.closeDB();
- // 방문자 사진
- WallpadVisitorPicData_A20 mWallpadVisitorPicData_A20 = new WallpadVisitorPicData_A20(getContext());
- try {
- nVisitorPicCnt = mWallpadVisitorPicData_A20.RowVisitorPictureCountData();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] checkEventNotifications() -> mWallpadVisitorPicData_A20");
- LogUtil.errorLogInfo("", TAG, e);
- }
- mWallpadVisitorPicData_A20.closeDB();
- // 공지사항, 택배, 스마트 우편
- WallpadStatusData mWallpadStatusData = new WallpadStatusData(this.getContext());
- try {
- nNoticeCnt = mWallpadStatusData.GetNoticeCNT();
- nParcelCnt = mWallpadStatusData.GetParcelCNT();
- nPostCnt = mWallpadStatusData.GetPostCNT();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] checkEventNotifications() -> mWallpadStatusData");
- LogUtil.errorLogInfo("", TAG, e);
- }
- mWallpadStatusData.closeDB();
- if (0 > nMissedCallCnt) {
- Log.w(TAG,"[checkEventNotifications] out of range!! nMissedCallCnt [" + nMissedCallCnt + "]");
- nMissedCallCnt = 0;
- }
- if (0 > nVisitorPicCnt) {
- Log.w(TAG,"[checkEventNotifications] out of range!! nVisitorPicCnt [" + nVisitorPicCnt + "]");
- nVisitorPicCnt = 0;
- }
- if (0 > nNoticeCnt) {
- Log.w(TAG,"[checkEventNotifications] out of range!! nNoticeCnt [" + nNoticeCnt + "]");
- nNoticeCnt = 0;
- }
- if (0 > nParcelCnt) {
- Log.w(TAG,"[checkEventNotifications] out of range!! nParcelCnt [" + nParcelCnt + "]");
- nParcelCnt = 0;
- }
- if (0 > nPostCnt) {
- Log.w(TAG,"[checkEventNotifications] out of range!! nPostCnt [" + nPostCnt + "]");
- nPostCnt = 0;
- }
- if (0 > nElecVehicleChangingCnt) {
- Log.w(TAG,"[checkEventNotifications] out of range!! nElecVehicleChangingCnt [" + nElecVehicleChangingCnt + "]");
- nElecVehicleChangingCnt = 0;
- }
- if (!bSmartPostUsage) {
- Log.w(TAG,"[checkEventNotifications] bSmartPostUsage is not supported!! -> bSmartPostUsage [" + bSmartPostUsage + "]");
- nPostCnt = 0;
- }
- if (!bElecVehicleUsage) {
- Log.w(TAG,"[checkEventNotifications] bElecVehicleUsage is not supported!! -> bElecVehicleUsage [" + bElecVehicleUsage + "]");
- nElecVehicleChangingCnt = 0;
- }
- Log.d(TAG,"[checkEventNotifications] nMissedCallCnt [" + nMissedCallCnt + "], nVisitorPicCnt [" + nVisitorPicCnt + "], nNoticeCnt [" + nNoticeCnt + "], nParcelCnt [" + nParcelCnt + "], nPostCnt [" + nPostCnt + "], nElecVehicleChangingCnt [" + nElecVehicleChangingCnt + "]");
- sendEventNotiBR(nMissedCallCnt, nVisitorPicCnt, nNoticeCnt, nParcelCnt, nPostCnt, nElecVehicleChangingCnt);
- Send_NotiSmartSwitch(MainActivity.nNoticeCnt, MainActivity.nParcelCnt, MainActivity.nVisitorPicCnt);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] checkEventNotifications()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public String getEventNotificationInfo() {
- try {
- Log.d(TAG,"[getEventNotificationInfo] ========== START ==========)");
- // 부재중 통화, 방문자 사진, 공지사항, 택배
- int nMissedCallCnt = 0, nVisitorPicCnt = 0, nNoticeCnt = 0, nParcelCnt = 0, nPostCnt = 0;
- // 부재중 통화
- WallpadCallHistoryData mWallpadCallHistoryData = new WallpadCallHistoryData(getContext());
- try {
- nMissedCallCnt = mWallpadCallHistoryData.RowCallHistoryCountData();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] getEventNotificationInfo() -> mWallpadCallHistoryData");
- LogUtil.errorLogInfo("", TAG, e);
- }
- mWallpadCallHistoryData.closeDB();
- // 방문자 사진
- WallpadVisitorPicData_A20 mWallpadVisitorPicData_A20 = new WallpadVisitorPicData_A20(getContext());
- try {
- nVisitorPicCnt = mWallpadVisitorPicData_A20.RowVisitorPictureCountData();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] getEventNotificationInfo() -> mWallpadVisitorPicData_A20");
- LogUtil.errorLogInfo("", TAG, e);
- }
- mWallpadVisitorPicData_A20.closeDB();
- // 공지사항, 택배
- WallpadStatusData mWallpadStatusData = new WallpadStatusData(this.getContext());
- try {
- nNoticeCnt = mWallpadStatusData.GetNoticeCNT();
- nParcelCnt = mWallpadStatusData.GetParcelCNT();
- nPostCnt = mWallpadStatusData.GetPostCNT();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] getEventNotificationInfo() -> mWallpadStatusData");
- LogUtil.errorLogInfo("", TAG, e);
- }
- mWallpadStatusData.closeDB();
- if (0 > nMissedCallCnt) {
- Log.w(TAG,"[getEventNotificationInfo] out of range!! nMissedCallCnt [" + nMissedCallCnt + "]");
- nMissedCallCnt = 0;
- }
- if (0 > nVisitorPicCnt) {
- Log.w(TAG,"[getEventNotificationInfo] out of range!! nVisitorPicCnt [" + nVisitorPicCnt + "]");
- nVisitorPicCnt = 0;
- }
- if (0 > nNoticeCnt) {
- Log.w(TAG,"[getEventNotificationInfo] out of range!! nNoticeCnt [" + nNoticeCnt + "]");
- nNoticeCnt = 0;
- }
- if (0 > nParcelCnt) {
- Log.w(TAG,"[getEventNotificationInfo] out of range!! nParcelCnt [" + nParcelCnt + "]");
- nParcelCnt = 0;
- }
- if (0 > nPostCnt) {
- Log.w(TAG,"[getEventNotificationInfo] out of range!! nPostCnt [" + nPostCnt + "]");
- nPostCnt = 0;
- }
- Log.d(TAG,"[getEventNotificationInfo] nMissedCallCnt [" + nMissedCallCnt + "], nVisitorPicCnt [" + nVisitorPicCnt + "], nNoticeCnt [" + nNoticeCnt + "], nParcelCnt [" + nParcelCnt + "], nPostCnt [" + nPostCnt + "]");
- if (bSmartPostUsage) return nMissedCallCnt + define.DEVCTR_CMD_SPLITER + nVisitorPicCnt + define.DEVCTR_CMD_SPLITER + nNoticeCnt + define.DEVCTR_CMD_SPLITER + nParcelCnt + define.DEVCTR_CMD_SPLITER + nPostCnt;
- else return nMissedCallCnt + define.DEVCTR_CMD_SPLITER + nVisitorPicCnt + define.DEVCTR_CMD_SPLITER + nNoticeCnt + define.DEVCTR_CMD_SPLITER + nParcelCnt;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return null;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] getEventNotificationInfo()");
- LogUtil.errorLogInfo("", TAG, e);
- return null;
- }
- }
- private void sendEventNotiBR(int missedcall, int visitorpic, int notice, int parcel) {
- try {
- Log.d(TAG,"[sendEventNotiBR] missedcall [" + missedcall + "], visitorpic [" + visitorpic + "], notice [" + notice + "], parcel [" + parcel + "]");
- String strResult = String.valueOf(missedcall) + define.DEVCTR_CMD_SPLITER + String.valueOf(visitorpic) + define.DEVCTR_CMD_SPLITER + String.valueOf(notice) + define.DEVCTR_CMD_SPLITER + String.valueOf(parcel);
- Log.d(TAG,"[sendEventNotiBR] strResult [" + strResult + "]");
- Intent mIntent = new Intent();
- mIntent.setAction(define.NOTIFY_ACNAME);
- mIntent.putExtra(define.NOTIBR_KIND, define.NOTIFY_UPDATECALLDATA);
- mIntent.putExtra(define.NOTIBR_CONTENT, strResult);
- getApplicationContext().sendBroadcast(mIntent);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] sendEventNotiBR(int missedcall, int visitorpic, int notice, int parcel)");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private void sendEventNotiBR(int missedcall, int visitorpic, int notice, int parcel, int post) {
- try {
- Log.d(TAG,"[sendEventNotiBR] missedcall [" + missedcall + "], visitorpic [" + visitorpic + "], notice [" + notice + "], parcel [" + parcel + "], post [" + post + "]");
- String strResult = String.valueOf(missedcall) + define.DEVCTR_CMD_SPLITER + String.valueOf(visitorpic) + define.DEVCTR_CMD_SPLITER + String.valueOf(notice) + define.DEVCTR_CMD_SPLITER + String.valueOf(parcel) + define.DEVCTR_CMD_SPLITER + String.valueOf(post);
- Log.d(TAG,"[sendEventNotiBR] strResult [" + strResult + "]");
- Intent mIntent = new Intent();
- mIntent.setAction(define.NOTIFY_ACNAME);
- mIntent.putExtra(define.NOTIBR_KIND, define.NOTIFY_UPDATECALLDATA);
- mIntent.putExtra(define.NOTIBR_CONTENT, strResult);
- getApplicationContext().sendBroadcast(mIntent);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] sendEventNotiBR(int missedcall, int visitorpic, int notice, int parcel, int post)");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private void sendEventNotiBR(int missedcall, int visitorpic, int notice, int parcel, int post, int elecvehiclecharging) {
- try {
- Log.d(TAG,"[sendEventNotiBR] missedcall [" + missedcall + "], visitorpic [" + visitorpic + "], notice [" + notice + "], parcel [" + parcel + "], post [" + post + "], elecvehiclecharging [" + elecvehiclecharging +"]");
- String strResult = String.valueOf(missedcall) + define.DEVCTR_CMD_SPLITER + String.valueOf(visitorpic) + define.DEVCTR_CMD_SPLITER + String.valueOf(notice)
- + define.DEVCTR_CMD_SPLITER + String.valueOf(parcel) + define.DEVCTR_CMD_SPLITER + String.valueOf(post) + define.DEVCTR_CMD_SPLITER + String.valueOf(elecvehiclecharging);
- Log.d(TAG,"[sendEventNotiBR] strResult [" + strResult + "]");
- Intent mIntent = new Intent();
- mIntent.setAction(define.NOTIFY_ACNAME);
- mIntent.putExtra(define.NOTIBR_KIND, define.NOTIFY_UPDATECALLDATA);
- mIntent.putExtra(define.NOTIBR_CONTENT, strResult);
- getApplicationContext().sendBroadcast(mIntent);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] sendEventNotiBR(int missedcall, int visitorpic, int notice, int parcel, int post, int elecvehiclecharging)");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private void CheckCallData_CalledCountAndVisitorCount() {
- try {
- int Vcount = 0;
- int Ccount = 0;
- try {
- //DB정보 읽어서 처리
- Log.d(TAG,"CheckCallData_CalledCountAndVisitorCount Start");
- WallpadCallHistoryData mWallpadCallHistoryData = new WallpadCallHistoryData(getContext());
- int TempCcount = mWallpadCallHistoryData.RowCallHistoryCountData();
- mWallpadCallHistoryData.closeDB();
- Log.d(TAG,"RowCallHistoryCountData() :" + TempCcount);
- if (TempCcount != -999) {
- Ccount = TempCcount;
- }
- WallpadVisitorPicData_A20 mWallpadVisitorPicData_A20 = new WallpadVisitorPicData_A20(getContext());
- int TempVcount = mWallpadVisitorPicData_A20.RowVisitorPictureCountData();
- mWallpadVisitorPicData_A20.closeDB();
- Log.d(TAG,"RowVisitorPictureCountData() :" + TempVcount);
- if (TempVcount != -999) {
- Vcount = TempVcount;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- LogUtil.errorLogInfo("", TAG, e);
- }
- Log.d(TAG," Call Count Check Receive Ccount :" + Ccount + " , Photo Count : " + Vcount );
- String Retdata = String.valueOf(Ccount)+define.DEVCTR_CMD_SPLITER+String.valueOf(Vcount);
- Intent intent = new Intent();
- intent.setAction(define.NOTIFY_ACNAME);
- intent.putExtra(define.NOTIBR_KIND, define.NOTIFY_UPDATECALLDATA);
- intent.putExtra(define.NOTIBR_CONTENT, Retdata);
- getApplicationContext().sendBroadcast(intent);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] CheckCallData_CalledCountAndVisitorCount()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
-
-
- class ScheduleManager {
- public static final int SCHEDULE_TYPE_GETINFO = 5000;
- public static final int SCHEDULE_TYPE_MORNINGCALL = 5001;
- public static final int SCHEDULE_TYPE_SCHEDULER = 5002;
- public static final int SCHEDULE_TYPE_SYSRESET = 5003;
- public static final int SCHEDULE_TYPE_NONE = 5004;
-
- public boolean isSetted = false;
-
- List<TimeScheduleUnit> SchedulerData = new ArrayList<TimeScheduleUnit>();
- List<TimeScheduleUnit> GeneralData = new ArrayList<TimeScheduleUnit>();
- public ScheduleManager() {
- }
- public class TimeScheduleUnit {
- int type;
- Calendar TimeSet;
- String message;
- TimeScheduleUnit(int sctype, Calendar target) {
- type = sctype;
- TimeSet = target;
- }
- TimeScheduleUnit(int sctype, Calendar target, String msg) {
- Log.i("MAINSCREEN","TimeScheduleUnit Create "+sctype+" : MSG : "+msg);
- type = sctype;
- TimeSet = target;
- message = msg;
- }
-
- public boolean isOver() {
- Calendar cal_now = new GregorianCalendar();
- if (cal_now.after(TimeSet)) {
- return true;
- }
- return false;
- }
- }
- private void CheckSysResetData() {
- try {
- Calendar today = new GregorianCalendar();
- Log.i("MAINSCREEN","CheckSysResetData Schedule");
- WallpadStatusData WsDB = new WallpadStatusData(getApplicationContext());
- String[] ResetData = WsDB.GetResetSchedule();
- if (!ResetData[0].equals("NONE")) {
- int type = Integer.parseInt(ResetData[0]);
- Log.i("MAINSCREEN","CheckSysResetData Schedule check typr : "+type + " Week : "+today.get(Calendar.DAY_OF_WEEK)+" Set Week : "+ResetData[1]);
- if ((type == WallpadStatusData.RESET_MONTH && today.get(Calendar.DAY_OF_MONTH)+1 == Integer.parseInt(ResetData[1])) ||
- (type == WallpadStatusData.RESET_WEEK && today.get(Calendar.DAY_OF_WEEK) == (Integer.parseInt(ResetData[1]))+1) )
- {
- if (today.get(Calendar.HOUR_OF_DAY) == Integer.parseInt(ResetData[2]) && today.get(Calendar.MINUTE) < 2) {
- SendAppFinishReqBR();
- ComponentName cn = new ComponentName("com.artncore.updater","com.artncore.updater.MainActivity");
- Intent intent = new Intent(Intent.ACTION_MAIN);
- intent.addCategory(Intent.CATEGORY_LAUNCHER);
- intent.putExtra("updatesystem", "no");
- intent.putExtra("updateapp", " no ");
- intent.putExtra("rebootcmd", "reboot");
- intent.setComponent(cn);
- startActivity(intent);
- }
- }
- }
- WsDB.closeDB();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] CheckSysResetData()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private boolean checkMorningCall() {
- try {
- WallpadStatusData WsDB = new WallpadStatusData(getApplicationContext());
- int AlarmStatus = WsDB.GetAlarmStatus();
-
- if (AlarmStatus != WallpadStatusData.ALARM_NONE && AlarmStatus != WallpadStatusData.GUARD_IN && AlarmStatus != WallpadStatusData.ALARM_STOP) {
- WsDB.closeDB();
- return false;
- }
- Calendar today = new GregorianCalendar();
-
- int MCStatus = WsDB.GetMorningCallStatus();
- Log.i(TAG,"[checkMorningCall] GetMorningCallStatus : "+MCStatus);
- if (MCStatus==WallpadStatusData.MORNINGCALL_ON) {
- int MCPer = WsDB.GetMorningCallPeriod();
- Log.i(TAG,"[checkMorningCall] GetMorningCallPeriod : "+MCPer);
- int TodatofWeek = today.get(Calendar.DAY_OF_WEEK);
- if ((MCPer == WallpadStatusData.MORNINGCALL_EWORKDAY && TodatofWeek != Calendar.SUNDAY) ||
- (MCPer == WallpadStatusData.MORNINGCALL_WORKDAY && TodatofWeek!=Calendar.SUNDAY && TodatofWeek != Calendar.SATURDAY) ||
- (MCPer == WallpadStatusData.MORNINGCALL_ONCE || MCPer == WallpadStatusData.MORNINGCALL_EVERYDAY )) {
- Log.i(TAG,"[checkMorningCall] "+today.get(Calendar.HOUR_OF_DAY)+";"+WsDB.MorningHour + " -- " +today.get(Calendar.MINUTE)+":"+WsDB.MorningMin);
- if (today.get(Calendar.HOUR_OF_DAY) == WsDB.MorningHour && today.get(Calendar.MINUTE) == WsDB.MorningMin) {
- SendAppFinishReqBR();
- mIOInterface.ctrlLcdWakeUp();
-
- StartPopup(ID.POPUPS.POPUP_MORNINGCALL);
-
- int[] MC_Doing = WsDB.GetMorningCallReserve();
- if (MC_Doing != null && MC_Doing.length > 0) {
- for (int k=0;k<MC_Doing.length;k++) {
- switch (MC_Doing[k]) {
- case WallpadStatusData.MCALLR_VENTIL_ON:
- mWallPadAPI.DeviceBatchControl(WallPadAPI.DEV_BATCH_CTRL__TYPE.VENTI, true);
- break;
- case WallpadStatusData.MCALLR_LIGHT_ON:
- //에너지 미터인 경우 안방 조명을 켜도록 하고
- //에너지 미터가 안 달린 경우 거실 조명을 켜도록 한다
- if (Version.getModelType() == Version.MODEL_TYPE.IHN_D101 || Version.getModelType() == Version.MODEL_TYPE.IHN_D101_I || Version.getModelType() == MODEL_TYPE.IHN_D101_I_LX2
- || Version.getModelType() == Version.MODEL_TYPE.IHN_D101K || Version.getModelType() == Version.MODEL_TYPE.IHN_D101K_I
- || Version.getModelType() == MODEL_TYPE.IHN_D101_I_OCF) {
- // 안방조명에 1번 조명만 제어하도록 한다
- // 모닝콜이 울리면 일괄소등시나리오에 의해 일괄소등이 해제가 되겠네 ? 음.....이건 아닌데
- // 모닝콜이 울리는 동안만 켜고 끄자 일괄소등 시나리오를 해제할까나? 그러면 팝업 화면에서 제어처리를?
- Log.d(TAG, "[checkMorningCall] mSdbAPI Room 2 - Lamp 1 On");
- if (mSdbAPI != null) {
- int nResult = mSdbAPI.SetLightOnOff((byte) 0x01, (byte) 0x00, true);
- Log.d(TAG, "[checkMorningCall] mSdbAPI nResult = " + nResult);
- }
- }
- else if (Version.getModelType() == MODEL_TYPE.IHN_1010GL || Version.getModelType() == MODEL_TYPE.IHN_1010GL_I
- || Version.getModelType() == MODEL_TYPE.IHN_1010GL_I_2443 || Version.getModelType() == MODEL_TYPE.IHN_1010GL_I_6410) {
- Log.d(TAG, "[checkMorningCall] mIntLightAPI Living Room - Lamp 1 On");
- if (mIntLightAPI != null) {
- int nResult = mIntLightAPI.LightControl((byte) 0x01, true);
- Log.d(TAG, "[checkMorningCall] mIntLightAPI nResult = " + nResult);
- }
- }
- else {
- // 대외향 구분하여 처리
- WallpadDeviceSet devDB = new WallpadDeviceSet( getApplicationContext() );
- int[] retArray = devDB.Get_Light_info();
- devDB.closeDB();
- if (retArray!= null && retArray[0] == 1) {
- if (retArray[1] == WallpadDeviceSet.LIGHT_TYPE_LIVING) {
- // 거실 스위치
- if (m_LightCtrl != null) {
- m_LightCtrl.Refresh(false);
- m_LightCtrl.SetLightOnOff((byte)0x01, true);
- }
- }
- else {
- // 멀티 스위치
- if (m_MultiSwitch != null) {
- m_MultiSwitch.Refresh((byte)0x00, false);
- if (m_MultiSwitch.data.DeviceCnt > 1) {
- m_MultiSwitch.SetLightOnOff((byte)0x01 ,(byte)0x00 , true);
- }
- else if(m_MultiSwitch.data.DeviceCnt == 1) {
- m_MultiSwitch.SetLightOnOff((byte)0x00 ,(byte)0x00 , true);
- }
- }
- }
- }
- }
- break;
- case WallpadStatusData.MCALLR_CURTAIN_OPEN: //fill lather
- break;
- }
- }
- }
-
- if (MCPer == WallpadStatusData.MORNINGCALL_ONCE) {
- // Button morning = (Button)findViewById(R.id.top_alarm);
- // morning.setVisibility(View.INVISIBLE);
- WsDB.SetMorningCall(WallpadStatusData.MORNINGCALL_OFF, WsDB.MorningHour, WsDB.MorningMin);
- }
- }
- }
- }
- WsDB.closeDB();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- LogUtil.errorLogInfo("", TAG, e);
- }
- return false;
- }
-
- private void scheduleCheck()
- {
- try
- {
- Log.d("scheduleCheck", "++++++++++++++++++++++++++++++++++++++++");
- Log.d("scheduleCheck", "Enter scheduleCheck "+GeneralData.size()+" : "+SchedulerData.size());
- checkMorningCall();
- if (GeneralData.size() > 0)
- {
- for (int i = 0;i < GeneralData.size(); i++)
- {
- TimeScheduleUnit scUnit = GeneralData.get(i);
-
-
- if (scUnit.isOver())
- {
- switch (scUnit.type)
- {
- case SCHEDULE_TYPE_SYSRESET:
- GeneralData.remove(scUnit);
- Log.d("scheduleCheck", "++++++++++++++++++++++++++++++++++++++++ SCHEDULE_TYPE_SYSRESET");
- SendAppFinishReqBR();
- ComponentName cn = new ComponentName("com.artncore.updater","com.artncore.updater.MainActivity");
- Intent intent = new Intent(Intent.ACTION_MAIN);
- intent.addCategory(Intent.CATEGORY_LAUNCHER);
- intent.putExtra("updatesystem", "no");
- intent.putExtra("updateapp", "no");
- intent.putExtra("rebootcmd", "reboot");
- intent.setComponent(cn);
- startActivity(intent);
- break;
- case SCHEDULE_TYPE_GETINFO:
- GeneralData.remove(scUnit);
- Log.d("scheduleCheck", "++++++++++++++++++++++++++++++++++++++++ SCHEDULE_TYPE_GETINFO");
- WallPadiMAPNotifyAPI notifyAPI = new WallPadiMAPNotifyAPI(getApplicationContext());
- notifyAPI.ReqGetSet();
- break;
- }
- }
- }
-
- Log.d("scheduleCheck", "after scheduleCheck "+GeneralData.size() );
- }
- }
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e)
- {
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
-
- public void doSchedule(String mess, int cnt)
- {
- // SendAppFinishReqBR();
- // Intent intent = new Intent(getApplicationContext(), schedulepopup.class);
- // String SendMSG = mess;
- // if (cnt > 1) SendMSG+=(" 외 "+cnt+"건을 알려드립니다.");
- // intent.putExtra("MESSAGE", SendMSG);
- // Log.i("MAINSCREEN","Call Schedule POPUP");
- // startActivity(intent);
- }
-
- public void refreshSchedulerData()
- {
- try
- {
- SchedulerData.clear();
- WallpadScheduleData schedata = new WallpadScheduleData(getApplicationContext());
- List<WallpadScheduleData.ScheduleData> scheduledata = schedata.GetTodaySchedule();
- Log.i("MAINSCREEN","refreshSchedulerData "+scheduledata.size());
- for(int i=0;i<scheduledata.size();i++)
- {
- WallpadScheduleData.ScheduleData ScUnit = scheduledata.get(i);
- int hour;
- int min;
- Log.i("MAINSCREEN","refreshSchedulerData "+ScUnit.inqatype+" : "+ScUnit.inqhour+" : ");
- if (ScUnit.inqatype.equals("no")) continue;
- else if (ScUnit.inqatype.equals("intime")||ScUnit.inqatype.equals("day"))
- {
- hour = ScUnit.inqhour;
- min = 0;
- }
- else if (ScUnit.inqatype.equals("hour"))
- {
- hour = ScUnit.inqhour-1;
- if (hour < 0) continue;
- min = 0;
- }
- else if (ScUnit.inqatype.equals("min"))
- {
- hour = ScUnit.inqhour-1;
- if (hour < 0) continue;
- min = 50;
- }
- else
- continue;
- Calendar today = new GregorianCalendar();
- int MoonM = 0;
- int MoonD = 0;
- try
- {
- String Moon = schedata.GetLunarDate(String.format("%04d%02d%02d", today.get(Calendar.YEAR),today.get(Calendar.MONTH)+1,today.get(Calendar.DAY_OF_MONTH) ));
- if(Moon!=null)
- {
- MoonM = Integer.parseInt(Moon.substring(4, 6));
- MoonD = Integer.parseInt(Moon.substring(6, 8));
- Log.i("MAINSCREEN", " Get Lunar Date "+Moon+" : "+MoonM+"/"+MoonD);
- }
- }
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e)
- {
- LogUtil.errorLogInfo("", TAG, e);
- MoonM = 0;
- MoonD = 0;
- }
- today.set(Calendar.HOUR_OF_DAY, hour);
- today.set(Calendar.MINUTE, min);
-
-
- String Mesg = String.format("%04d년 %02d월 %02d일 (음 %02d/%02d)\n",today.get(Calendar.YEAR),today.get(Calendar.MONTH)+1,today.get(Calendar.DAY_OF_MONTH), MoonM, MoonD)+ScUnit.inqmsg;
- Log.i("MAINSCREEN","refreshSchedulerData add "+ScUnit.inqatype+" : "+ScUnit.inqhour+" : "+Mesg);
- TimeScheduleUnit newUnit = new TimeScheduleUnit(SCHEDULE_TYPE_SCHEDULER, today, Mesg);
- isSetted = true;
- SchedulerData.add(newUnit);
- }
- schedata.closeDB();
-
- }
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e)
- {
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
-
- public void refreshMorningCall()
- {
- try
- {
- for (int i = 0; i < GeneralData.size(); i++)
- {
- TimeScheduleUnit scUnit = SchedulerData.get(i);
- if (scUnit.type == SCHEDULE_TYPE_MORNINGCALL)
- {
- SchedulerData.remove(i);
- break;
- }
- }
- SetMorningCallData();
- }
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e)
- {
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private void SetMorningCallData()
- {
- try
- {
- Log.i("MAINSCREEN","SetMorningCallData Schedule");
- Calendar today = new GregorianCalendar();
- WallpadStatusData WsDB = new WallpadStatusData(getApplicationContext());
- int MCStatus = WsDB.GetMorningCallStatus();
- if (MCStatus==WallpadStatusData.MORNINGCALL_ON)
- {
- int MCPer = WsDB.GetMorningCallPeriod();
- int TodatofWeek = today.get(Calendar.DAY_OF_WEEK);
- if ((MCPer == WallpadStatusData.MORNINGCALL_EWORKDAY && TodatofWeek != Calendar.SUNDAY) &&
- (MCPer == WallpadStatusData.MORNINGCALL_WORKDAY && TodatofWeek!=Calendar.SUNDAY && TodatofWeek != Calendar.SATURDAY) &&
- (MCPer == WallpadStatusData.MORNINGCALL_ONCE || MCPer == WallpadStatusData.MORNINGCALL_EVERYDAY ))
- {
- today.set(Calendar.HOUR_OF_DAY, WsDB.MorningHour);
- today.set(Calendar.MINUTE, WsDB.MorningMin);
- today.set(Calendar.SECOND, 0);
- TimeScheduleUnit scUnit = new TimeScheduleUnit(SCHEDULE_TYPE_MORNINGCALL, today);
- if (!scUnit.isOver())
- {
- isSetted = true;
- // Button morning = (Button)findViewById(R.id.top_alarm);
- // morning.setVisibility(View.VISIBLE);
- GeneralData.add(scUnit);
- }
- else
- {
- // Button morning = (Button)findViewById(R.id.top_alarm);
- // morning.setVisibility(View.INVISIBLE);
- }
- }
- }
- WsDB.closeDB();
- }
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e)
- {
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
-
- public void refreshsysreset()
- {
- try
- {
- Log.i("MAINSCREEN","refreshsysreset Schedule");
- for (int i = 0; i < GeneralData.size(); i++)
- {
- TimeScheduleUnit scUnit = SchedulerData.get(i);
- if (scUnit.type == SCHEDULE_TYPE_SYSRESET)
- {
- SchedulerData.remove(i);
- break;
- }
- }
- SetSysResetData();
- }
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e)
- {
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
-
- private void SetSysResetData()
- {
- try
- {
- Calendar today = new GregorianCalendar();
- Log.i("MAINSCREEN","SetSysResetData Schedule");
- WallpadStatusData WsDB = new WallpadStatusData(getApplicationContext());
- String[] ResetData = WsDB.GetResetSchedule();
- if (!ResetData[0].equals("NONE"))
- {
-
- int type = Integer.parseInt(ResetData[0]);
- if ((type == WallpadStatusData.RESET_MONTH && today.get(Calendar.DAY_OF_MONTH) == Integer.parseInt(ResetData[1])) ||
- (type == WallpadStatusData.RESET_WEEK && today.get(Calendar.DAY_OF_WEEK) == Integer.parseInt(ResetData[1])) )
- {
- Log.i("MAINSCREEN","SetSysResetData Setted");
- today.set(Calendar.HOUR_OF_DAY, Integer.parseInt(ResetData[2]));
- today.set(Calendar.MINUTE, 0);
- today.set(Calendar.SECOND, 0);
- TimeScheduleUnit scUnit = new TimeScheduleUnit(SCHEDULE_TYPE_SYSRESET, today);
- if (!scUnit.isOver())
- {
- isSetted = true;
- GeneralData.add(scUnit);
- }
- }
- }
- WsDB.closeDB();
- }
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e)
- {
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public void refreshSchedule()
- {
- try
- {
- Log.i("MAINSCREEN","Refresh Schedule");
- GeneralData.clear();
- Calendar today = new GregorianCalendar();
- // 하루에 한번 가져오는 걸로 변경함
- //if (today.get(Calendar.DAY_OF_WEEK)==Calendar.SUNDAY)
- {
- WallpadStatusData SetData = new WallpadStatusData(getApplicationContext());
- AddressSet addc = SetData.getAddressMGR();
- SetData.closeDB();
- int dong = Integer.parseInt(addc.Dong);
-
- int ho = 101;
- if(addc.UseOrNotRentHouse == true)
- {
- ho = addc.Ho_Integer;
- }
- else
- {
- ho = Integer.parseInt(addc.Ho);
- }
-
- int interval = (dong-(dong/100)*100) * 100 + ho/100;
- int hour;
- int min;
- int sec;
- if (interval/3600 > 0)
- {
- hour = 3+interval/3600;
- interval=interval%3600;
- }
- else hour = 3;
-
- if (interval/60 > 0)
- {
- min = interval/60;
- sec = interval%60;
- }
- else
- {
- min = 0;
- sec = interval;
- }
- today.set(Calendar.HOUR_OF_DAY, hour);
- today.set(Calendar.MINUTE, min);
- today.set(Calendar.SECOND, sec);
- TimeScheduleUnit scUnit = new TimeScheduleUnit(SCHEDULE_TYPE_GETINFO, today);
- if (!scUnit.isOver())
- GeneralData.add(scUnit);
- }
-
- SetMorningCallData();
- SetSysResetData();
- refreshSchedulerData();
- }
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e)
- {
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- }
- class runCallServices extends Thread {
- public runCallServices() {
- super();
- }
-
- public void run() {
- try {
- if (Version.getPlatformType() == Version.PLATFORM_TYPE.A40i) {
- if (getIsSubWallpad()) {
- Log.w(TAG, "[runCallServices.run()] ############### This wallpad is set as a sub-wallpad ###############");
- Intent SubWallpadServiceLauncher = new Intent ("kr.co.icontrols.callengine.subwallpad.SubWallPadSerialManager.StartService");
- getApplicationContext().startService(SubWallpadServiceLauncher);
- }
- else {
- Log.w(TAG, "[runCallServices.run()] ############### This wallpad is set as a main-wallpad ###############");
- // SIP/Subphone 서비스 실행
- Intent SIPServiceLauncher = new Intent ("kr.co.icontrols.callengine.sip.SIPStun.StartService");
- getApplicationContext().startService(SIPServiceLauncher);
- Intent SubPhoneServiceLauncher = new Intent ("kr.co.icontrols.callengine.subphone.SubPhoneSerialManager.StartService");
- getApplicationContext().startService(SubPhoneServiceLauncher);
- if (GetRemoteCallUseInfo()) {
- Intent remoteCallServiceLauncher = new Intent ("kr.co.icontrols.callengine.remotecall.RemoteCallManager.StartService");
- getApplicationContext().startService(remoteCallServiceLauncher);
- }
- }
- }
- else {
- int nModelType = Version.getModelType();
- if (nModelType == MODEL_TYPE.IHN_750) {
- // SIP 서비스만 실행
- Intent sipServiceLauncher = new Intent ("kr.co.icontrols.callengine.sip.SIPStun.StartService");
- getApplicationContext().startService(sipServiceLauncher);
- }
- else {
- // SIP/PSTN/Subphone 서비스 실행
- Intent sipServiceLauncher = new Intent ("kr.co.icontrols.callengine.sip.SIPStun.StartService");
- getApplicationContext().startService(sipServiceLauncher);
- Intent PSTNServiceLauncher = new Intent ("kr.co.icontrols.callengine.pstn.PSTNSerialManager.StartService");
- getApplicationContext().startService(PSTNServiceLauncher);
- Intent SubPhoneServiceLauncher = new Intent ("kr.co.icontrols.callengine.subphone.SubPhoneSerialManager.StartService");
- getApplicationContext().startService(SubPhoneServiceLauncher);
- }
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] runCallServices().run()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- }
- // 방문객원격통화 솔루션 사용여부 판별
- private boolean GetRemoteCallUseInfo() {
- try {
- WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(this);
- if (mWallpadDeviceSet != null) {
- String[] astrRemoteCall = mWallpadDeviceSet.GetSettingData("방문객원격통화");
- if (astrRemoteCall != null) {
- if (astrRemoteCall[1].contains("사용함"))
- return true;
- } else {
- Log.d(TAG, "[GetRemoteCallUseInfo] astrRemoteCall is null!!");
- }
- }
- mWallpadDeviceSet.closeDB();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] GetRemoteCallUseInfo()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- return false;
- }
- int UNINSTALL_REQUEST_CODE = 1;
- private void uninstallAnCCallApp(String strAPK) {
- try {
- Log.w(TAG, "[uninstallAnCCallApp] strAPK [" + strAPK + "]");
- if (checkAppInstalled(strAPK)) {
- // Intent mIntent = new Intent(Intent.ACTION_DELETE);
- Intent mIntent = new Intent(Intent.ACTION_UNINSTALL_PACKAGE);
- mIntent.setData(Uri.parse("package:" + strAPK));
- mIntent.putExtra(Intent.EXTRA_RETURN_RESULT, true);
- startActivityForResult(mIntent, UNINSTALL_REQUEST_CODE);
- }
- else {
- Log.w(TAG, "[uninstallAnCCallApp] Not installed [" + strAPK + "]");
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {;
- Log.e(TAG, "[Exception] uninstallAnCCallApp()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private boolean checkAppInstalled(String strAPK) {
- try {
- PackageManager mPackageManager = getPackageManager();
- try {
- mPackageManager.getPackageInfo(strAPK, PackageManager.GET_ACTIVITIES);
- return true;
- } catch (PackageManager.NameNotFoundException pne) {
- Log.w(TAG, "[checkAppInstalled] No Package [" + strAPK + "]");
- }
- return false;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] checkAppInstalled(String strAPK)");
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- private boolean MainSubScreenLoadingComplite = false;
- public boolean getMainSubScreenLoadingComplite() {
- return MainSubScreenLoadingComplite;
- }
- /**
- * 설치된 모든 어플의 이름/버전정보 Version DB에 저장하는 쓰레드. <br>
- * main Activity 생성 시 최초 1회 실행 후 die
- */
- class getInstalledPackageInfo extends Thread {
- @Override
- public void run() {
- super.run();
- try {
- Log.d(TAG, "[getInstalledPackageInfo] Started getting installed package infomation");
- ArrayList<PackageVersionInfo> PackageVersionInfos = new ArrayList<PackageVersionInfo>();
- List<PackageInfo> PackageInfoList = getPackageManager().getInstalledPackages(PackageManager.PERMISSION_GRANTED);
- while (true) {
- Log.d(TAG, "[getInstalledPackageInfo.run()] Get installed packages start!!");
- try {
- for (PackageInfo pack : PackageInfoList) {
- Log.d(TAG, "# PackageName : " + pack.packageName);
- Log.d(TAG, "# VersionName : " + pack.versionName);
- if ((pack.packageName.contains("icontrols")) || (pack.packageName.contains("artncore")) || (pack.packageName.contains("dadam"))) {
- PackageVersionInfos.add(new PackageVersionInfo(pack.packageName, pack.versionName));
- }
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- break;
- }
- catch (Exception e) {
- LogUtil.errorLogInfo("", TAG, e);
- break;
- }
- Log.d(TAG, "[getInstalledPackageInfo.run()] Get installed packages end!!");
- break;
- }
- Log.d(TAG, "[getInstalledPackageInfo.run()] Save installed packages start!!");
- wallpaddbmgr WallpadDBMGR = new wallpaddbmgr(getApplicationContext());
- if (PackageVersionInfos != null) {
- for (int i = 0; i < PackageVersionInfos.size(); i++) {
- WallpadDBMGR.UpdateVersionData(PackageVersionInfos.get(i).getPackageName(), PackageVersionInfos.get(i).getPackageVersion());
- }
- }
- WallpadDBMGR.closeDB();
- Log.d(TAG, "[getInstalledPackageInfo.run()] Save installed packages end!!");
- try {
- Thread.sleep(1500);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- LogUtil.errorLogInfo("", TAG, e);
- }
- if (Version.getModelType() == Version.MODEL_TYPE.IHN_1020B_C || Version.getModelType() == Version.MODEL_TYPE.IHN_1030_D) {
- try {
- Thread.sleep(1000);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- runOnUiThread(new Runnable() {
- @Override
- public void run() {
- registerSubScreen();
- }
- });
-
- try
- {
- WallpadScheduleData schedb = new WallpadScheduleData(getApplicationContext());
- boolean bLunarTableExist = schedb.CheckLunarTable();
- schedb.closeDB();
-
- if (!bLunarTableExist) {
- try {
- Log.d(TAG, "DB File Copy Start");
- copyDataBase(wallpaddbmgr.dblocation + "/" + wallpaddbmgr.Schedule_LunaDB);
- Log.d(TAG, "DB File Copy End");
- } catch (IOException e) {
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- LogUtil.errorLogInfo("", TAG, e);
- }
-
- // if (Version.getModelType() == Version.MODEL_TYPE.IHN_1020B_C || Version.getModelType() == Version.MODEL_TYPE.IHN_1030_D) checkDongHoSetting();
- checkDongHoSetting();
-
- if (Common.GetElevatorSampleMode(getApplicationContext())) {
- int retCount = EnergyAlramPopupMgr.get_WallPadRebootingCount( getApplicationContext()) + 1;
- EnergyAlramPopupMgr.set_WallPadRebootingCount(getApplicationContext(), retCount);
- Log.d(TAG, "################################# rebooting Count : " + retCount );
- }
-
- // 하드웨어 키 샘플 모드 동작 여부 설정
- WallpadSalesSampleData sdata = new WallpadSalesSampleData(getApplicationContext());
- int salsesampleHWBtn = sdata.getSalesSampleData(WallpadSalesSampleData.SALES_SAMPLE_MODE_HW_BUTTON_OPERATION);
- sdata.closeDB();
-
- WallPadInterface wpdifc = new WallPadInterface();
- if (salsesampleHWBtn == WallpadSalesSampleData.SALES_SAMPLE_MODE_DO_NOT_USED)
- wpdifc.DoControl(WallPadInterface.IOCTL_KEY_ONOFF_SET, 0);
-
- CheckEnv();
- }
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e)
- {
- LogUtil.errorLogInfo("", TAG, e);
- }
-
- try {Thread.sleep(5000);}
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- MainSubScreenLoadingComplite = true;
- }
- catch (Exception e){LogUtil.errorLogInfo("", TAG, e);}
- MainSubScreenLoadingComplite = true;
- }
- }
-
- public static String DB_WALLPAD_WIDGET_INIT = "DB_WALLPAD_WIDGET_INIT";
-
- public void set_WallPadWidgetInit(Context context) {
- try {
- wallpaddbmgr mgr = new wallpaddbmgr(context);
- boolean bRet = mgr.UpdateWallPADData(DB_WALLPAD_WIDGET_INIT, String.valueOf(1));
- if (bRet == false ) {
- Log.d(TAG, "----- DB_WALLPAD_WIDGET_INIT insert ==> false ");
- mgr.insertWallPADDB(DB_WALLPAD_WIDGET_INIT, "1");
- }
- mgr.closeDB();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
-
- public int get_WallPadWidgetInit(Context context) {
- int ret = 0;
- try {
- wallpaddbmgr mgr = new wallpaddbmgr(context);
- String strRet = mgr.GetWallPADData(DB_WALLPAD_WIDGET_INIT);
- if (strRet == null) {
- Log.d(TAG, "----- get_WallPadRebootingCount strRet == null && insert ==> false ");
- mgr.insertWallPADDB(DB_WALLPAD_WIDGET_INIT, "0");
- return 0;
- }
-
- ret = Integer.parseInt(strRet);
- mgr.closeDB();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- LogUtil.errorLogInfo("", TAG, e);
- }
- return ret;
- }
-
-
- /**
- * 스케줄 관련 처리 핸들러 추가
- * 모닝콜, 일정관리, 엘리베이터 호출상태, 에너지 사용량 확인
- * 현재는 사용하지 않음. checkTimeTasks()로 대체
- */
- private int nDay, nHour, nMin;
- Handler Checker = new Handler() {
- public void handleMessage(Message msg) {
- super.handleMessage(msg);
- Calendar cal = new GregorianCalendar();
- if (cal.get(Calendar.DAY_OF_MONTH) != nDay) {
- // 날짜가 바뀌었을때...
- nDay = cal.get(Calendar.DAY_OF_MONTH);
- Log.d(TAG , "-----------------day change repeat");
- if (SCManager != null) {
- if (SYSTEM_TIME_SET)SCManager.refreshSchedule();
- }
- //
- // Intent intent = new Intent();
- // intent.setAction(define.NOTIFY_ACNAME);
- // intent.putExtra(define.NOTIBR_KIND, define.NOTIFY_DAYCHANGED);
- // getApplicationContext().sendBroadcast(intent);
- //에너지사용량 알림 초기화
- ClearEnergyUsage();
- Log.d(TAG , "cal.get(Calendar.YEAR) :" + cal.get(Calendar.YEAR) );
- if ((bUseofNot_ZeroEnergyHouseInfo == true) && (cal.get(Calendar.YEAR) > 2016) && (SYSTEM_TIME_SET == true)) {
- //어제 시간 재입력
- Log.d(TAG , "/**********************************************/");
- Log.d(TAG , "GetZeroEnergyHouseInfo_RandomCheckHandler(true);");
- Log.d(TAG , "/**********************************************/");
- DayofLastSecond = StringUtil.GetDayofLastSecondTimeString(cal); //하루전 날짜의 마지막 시간 입력
- Log.d(TAG , "DayofLastSecond : "+ DayofLastSecond);
- }
- }
- if (cal.get(Calendar.HOUR_OF_DAY) != nHour) {
- nHour = cal.get(Calendar.HOUR_OF_DAY);
- DoScheduleHourUnit(cal);
- }
- if (cal.get(Calendar.MINUTE) != nMin) {
- nMin = cal.get(Calendar.MINUTE);
- /**
- * A20월패드 BSP는 전자액자 실행을 시키지 않기때문에 main app에서 전자액자 실행 여부 확인하여
- * 실행시킴
- * **/
- if (Version.getPlatformType() == Version.PLATFORM_TYPE.A20) {
- Log.i(TAG, "[Checker handler] ========== JEFF 1 ========== m_LiveMainActivity : " + m_LiveMainActivity);
- if (m_LiveMainActivity > 0) {
- String LCD_Sleep_Status = null;
- Runtime runtime = Runtime.getRuntime();
- Process process;
- try {
- String cmd = "getprop persist.sys.display.lcdoff";
- process = runtime.exec(cmd);
- BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream()));
- String line;
- while ((line = br.readLine()) != null) {
- LCD_Sleep_Status = line;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- e.fillInStackTrace();
- Log.e("Process Manager", "Unable to execute top command");
- }
- if (LCD_Sleep_Status != null) {
- Log.d(TAG, "The LCD_Sleep_Status : " + LCD_Sleep_Status);
- if (LCD_Sleep_Status.equals("1") == true) {
- // LCD 꺼져있음
- WallpadStatusData SettData = new WallpadStatusData(getApplicationContext());
- if (SettData.DecideAutoPictureAppStartOrNot(new GregorianCalendar())) {
- if (SettData.StartAutoPictureAPP() == true) {
- Log.d(TAG, "StartAutoPictureAPP is true");
- // PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
- // pm.userActivity(2, true);
- // LCD backlight normal
- getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
- Log.d(TAG, "PowerManager will be set");
- }
- else {
- Log.d(TAG, "StartAutoPictureAPP is false");
- }
- }
- else {
- Log.d(TAG, "DecideAutoPictureAppStartOrNot is false");
- }
- SettData.closeDB();
- }
- }
- else {
- Log.e(TAG, "The LCD_Sleep_Status is null");
- }
- }
- }
- if (Version.getPlatformType() == Version.PLATFORM_TYPE.A40i) {
- Log.i(TAG, "[Checker handler] ========== JEFF 2 ========== m_LiveMainActivity : " + m_LiveMainActivity);
- if (m_LiveMainActivity > 0) {
- boolean bisScreenOn = false;
- if (getCompareBSPVersion("2020.09.18")) {
- bisScreenOn = checkLCDOnByCMD();
- }
- else {
- PowerManager mPowerManager = (PowerManager)getSystemService(Context.POWER_SERVICE);
- bisScreenOn = mPowerManager.isScreenOn();
- }
- Log.i(TAG, "[Checker handler] bisScreenOn : " + bisScreenOn);
- if (!bisScreenOn) {
- if (getBlackoutStatus()) {
- Log.i(TAG, "[Checker handler] getBlackoutStatus is true!!!");
- sendBlackoutScreenRunBR();
- }
- else {
- WallpadStatusData SettData = new WallpadStatusData(getApplicationContext());
- if (SettData.DecideAutoPictureAppStartOrNot(new GregorianCalendar())) {
- if (SettData.StartAutoPictureAPP() == true) {
- Log.d(TAG, "StartAutoPictureAPP is true");
- mIOInterface.ctrlLcdWakeUp();
- getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
- Log.d(TAG, "PowerManager will be set");
- }
- else {
- Log.d(TAG, "StartAutoPictureAPP is false");
- }
- }
- else {
- Log.d(TAG, "DecideAutoPictureAppStartOrNot is false");
- }
- SettData.closeDB();
- }
- }
- }
- }
- if ((nMin == 50) || (nMin == 0)) {
- try {
- checkScheduleReminder();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- LogUtil.errorLogInfo("", TAG, e);
- }
- // 스케줄 일정 알람 팝업을 띄우도록 한다.
- // Intent intent = new Intent(getApplicationContext(), schedulepopup.class);
- // String SendMSG = doSchedule.get(0).inqmsg;
- // if (doSchedule.size() > 1) SendMSG+=(" 외 "+doSchedule.size()+"건을 알려드립니다.");
- // intent.putExtra("MESSAGE", SendMSG);
- //
- // startActivity(intent);
- }
- if (SCManager != null) SCManager.scheduleCheck();
- //CheckElevator();
- if (MAX_BOOTUP_RETRY_COUNT < bootupretryCNT && SYSTEM_TIME_SET == false) {
- try {
- WallPadiMAPNotifyAPI iMAPMethod = new WallPadiMAPNotifyAPI(getApplicationContext());
- iMAPMethod.ReqGetSet();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- // 중복.... 이게 왜 있는겨....
- // if ( cal.get(Calendar.DAY_OF_WEEK)==Calendar.SUNDAY && SYSTEM_TIME_SET && cal.get(Calendar.DAY_OF_MONTH)!=LastTimeSync)
- // {
- // Calendar checktime = GetTimeSyncTime();
- // if (checktime != null)
- // {
- // if (cal.after(checktime))
- // {
- // LastTimeSync = cal.get(Calendar.DAY_OF_MONTH);
- // WallpadStatusData wpd = new WallpadStatusData(getApplicationContext());
- // wpd.SetLastTimeSyncDate(LastTimeSync);
- // wpd.closeDB();
- // WallPadiMAPNotifyAPI iMAPMethod = new WallPadiMAPNotifyAPI(getApplicationContext());
- // iMAPMethod.ReqGetSet();
- // }
- // }
- // }
- //주차정보 관련 20분 마다 얻어오기
- if (bUseofNot_ParkingInfo == true) {
- cGetParkingMin++;
- //테스트
- /*
- bSetMSG_GetParkingInfo = true;
- LoadParkingDataFromServer();
- */
- if (cGetParkingMin >= 20) {
- // 20분으로 고정
- cGetParkingMin = 0;
- //아이콘트롤스 일때도 처리하지 않도록 수정필요
- //넥스파인 경우는 협의후 처리
- switch (nParkingSystemType) {
- case Common.PARKING_SYSTEM_ICONTROLS:
- case Common.PARKING_SYSTEM_NEXPA:
- case Common.PARKING_SYSTEM_UPIS:
- case Common.PARKING_SYSTEM_IES_100:
- break;
- case Common.PARKING_SYSTEM_BASIC:
- case Common.PARKING_SYSTEM_ETC:
- GetParkingInfo_RandomCheckHandler(); //주차 정보 얻어오기
- break;
- default:
- break;
- }
- }
- }
- // 필요없는 코드 삭제 ( yskim 2015.03.31 )
- // String checkDate = String.format("%04d%02d%02d",cal.get(Calendar.YEAR),cal.get(Calendar.MONTH)+1,cal.get(Calendar.DAY_OF_MONTH));
- // WallpadStatusData energyData = new WallpadStatusData(getApplicationContext());
- // String EnergyCheckData = energyData.GetEnergyCheckDate();
- // energyData.closeDB();
- // if (SYSTEM_TIME_SET)
- // {
- // Calendar checktime = GetEnergyDataLoadingTime();
- // if (!checkDate.equals(EnergyCheckData))
- // {
- // if (checktime != null)
- // {
- //
- // if (cal.after(checktime))
- // {
- // WallPadiMAPNotifyAPI iMAPMethod = new WallPadiMAPNotifyAPI(getApplicationContext());
- // iMAPMethod.GetEnergyUsage();
- // WallPadiMAPNotifyAPI iMAPMethod2 = new WallPadiMAPNotifyAPI(getApplicationContext());
- // iMAPMethod2.GetEnergyUsageMonth();
- // }
- // }
- // }
- // }
- }
- // checkMainPage();
- Checker.sendEmptyMessageDelayed(0, 1000);
- }
- };
- /**
- * JEFF, 2019.12.25
- * 매 1초마다 실행되면서 스케쥴 확인하여 각 기능을 동작시킨다 (시간업데이트, 전자액자 등)
- */
- Handler handlerEverySecond = new Handler() {
- public void handleMessage(Message msg) {
- super.handleMessage(msg);
- checkTimeTasks();
- handlerEverySecond.sendEmptyMessageDelayed(0, 1000);
- }
- };
- private void checkTimeTasks() {
- try {
- // Log.d(TAG , "[checkTimeTasks] ===== START =====");
- Calendar cal = new GregorianCalendar();
- if (cal.get(Calendar.DAY_OF_MONTH) != nDay) {
- // 날짜 변경시
- Log.d(TAG , "[checkTimeTasks] day changed!!");
- nDay = cal.get(Calendar.DAY_OF_MONTH);
- if (SCManager != null) {
- if (SYSTEM_TIME_SET) SCManager.refreshSchedule();
- }
- else {
- Log.w(TAG , "[checkTimeTasks] SYSTEM_TIME_SET is null!!");
- }
- // 모바일연동 서비스로 원격검침 데이터를 전송
- // getTelemeteringDataOnRandomTime();
- // // 에너지사용량 알림 초기화
- // ClearEnergyUsage();
- Log.d(TAG , "[checkTimeTasks] Calendar.YEAR = " + cal.get(Calendar.YEAR) );
- if ((bUseofNot_ZeroEnergyHouseInfo == true) && (cal.get(Calendar.YEAR) > 2016) && (SYSTEM_TIME_SET == true)) {
- //어제 시간 재입력
- Log.i(TAG , "[checkTimeTasks] GetZeroEnergyHouseInfo_RandomCheckHandler(true);");
- DayofLastSecond = StringUtil.GetDayofLastSecondTimeString(cal); //하루전 날짜의 마지막 시간 입력
- Log.d(TAG , "[checkTimeTasks] DayofLastSecond : "+ DayofLastSecond);
- }
- }
- if (cal.get(Calendar.HOUR_OF_DAY) != nHour) {
- nHour = cal.get(Calendar.HOUR_OF_DAY);
- // 원격검침 데이터를 서버로부터 가져와 관련 기능모듈에 알린다.
- getTelemeteringDataOnRandomTime();
- DoScheduleHourUnit(cal);
- }
- if (getBlackoutStatus()) {
- Log.i(TAG, "[checkTimeTasks] getBlackoutStatus is true!!!");
- sendBlackoutScreenRunBR();
- }
- if (cal.get(Calendar.MINUTE) != nMin) {
- nMin = cal.get(Calendar.MINUTE);
- /**
- * main app에서 전자액자 실행 여부 확인하여 실행시킴
- * **/
- if (Version.getPlatformType() == Version.PLATFORM_TYPE.A40i) {
- Log.i(TAG, "[checkTimeTasks] m_LiveMainActivity : " + m_LiveMainActivity);
- if (m_LiveMainActivity > 0) {
- boolean bScreenOn = false;
- if (getCompareBSPVersion("2020.09.18")) {
- bScreenOn = checkLCDOnByCMD();
- }
- else {
- PowerManager mPowerManager = (PowerManager)getSystemService(Context.POWER_SERVICE);
- bScreenOn = mPowerManager.isScreenOn();
- }
- Log.i(TAG, "[checkTimeTasks] bScreenOn : " + bScreenOn);
- if (!bScreenOn && !getBlackoutStatus()) {
- WallpadStatusData SettData = new WallpadStatusData(getApplicationContext());
- if (SettData.DecideAutoPictureAppStartOrNot(new GregorianCalendar())) {
- if (SettData.StartAutoPictureAPP() == true) {
- Log.d(TAG, "[checkTimeTasks] StartAutoPictureAPP() is true");
- mIOInterface.ctrlLcdWakeUp();
- getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
- Log.d(TAG, "[checkTimeTasks] PowerManager will be set");
- }
- else {
- Log.d(TAG, "[checkTimeTasks] StartAutoPictureAPP() is false");
- }
- }
- else {
- Log.d(TAG, "[checkTimeTasks] DecideAutoPictureAppStartOrNot(...) is false");
- }
- SettData.closeDB();
- }
- }
- }
- if ((nMin == 50) || (nMin == 0)) {
- try {
- checkScheduleReminder();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- if (SCManager != null) SCManager.scheduleCheck();
- if (MAX_BOOTUP_RETRY_COUNT < bootupretryCNT && SYSTEM_TIME_SET == false) {
- try {
- WallPadiMAPNotifyAPI iMAPMethod = new WallPadiMAPNotifyAPI(getApplicationContext());
- iMAPMethod.ReqGetSet();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- //주차정보 관련 20분 마다 얻어오기
- if (bUseofNot_ParkingInfo == true) {
- cGetParkingMin++;
- //테스트
- /*
- bSetMSG_GetParkingInfo = true;
- LoadParkingDataFromServer();
- */
- if (cGetParkingMin >= 20) {
- // 20분으로 고정
- cGetParkingMin = 0;
- //아이콘트롤스 일때도 처리하지 않도록 수정필요
- //넥스파인 경우는 협의후 처리
- switch(nParkingSystemType) {
- case Common.PARKING_SYSTEM_ICONTROLS:
- case Common.PARKING_SYSTEM_NEXPA:
- case Common.PARKING_SYSTEM_UPIS:
- case Common.PARKING_SYSTEM_IES_100:
- break;
- case Common.PARKING_SYSTEM_BASIC:
- case Common.PARKING_SYSTEM_ETC:
- GetParkingInfo_RandomCheckHandler(); //주차 정보 얻어오기
- break;
- default:
- break;
- }
- }
- }
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] checkTimeTasks()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /**
- * 일정 알림 팝업창 생성하는 함수<br>
- * 김용성 과장님 이곳에서 팝업창 생성해주시기 바랍니다.
- * @param popup_msg 팝업창에 띄울 메시지.
- * **/
- private void MakePopup_Schedule(String popup_msg) {
- try {
- Log.e(TAG, "[MakePopup_Schedule] popup_msg [" + popup_msg + "]");
- DebugLogOutput("===================================");
- DebugLogOutput(popup_msg);
- DebugLogOutput("===================================");
- WallpadStatusData mWallpadStatusData = new WallpadStatusData(getApplicationContext());
- int AlarmStatus = mWallpadStatusData.GetAlarmStatus();
- boolean soundOut = mWallpadStatusData.GetSoundOutputOfEventAlarm();
- mWallpadStatusData.closeDB();
- Log.e(TAG, "[MakePopup_Schedule] ========== JEFF 1 ==========");
- if (AlarmStatus != WallpadStatusData.ALARM_ARISE && AlarmStatus != WallpadStatusData.GUARD_OUT && AlarmStatus != WallpadStatusData.GUARD_OUT_WAIT) {
- Log.e(TAG, "[MakePopup_Schedule] ========== JEFF 2 ==========");
- if (!Common.bWallPadCallLive) {
- Log.e(TAG, "[MakePopup_Schedule] ========== JEFF 3 ==========");
- Common.SendAppFinishReqBR(getApplicationContext());
- PowerManager mPowerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
- Log.d(TAG, "[MakePopup_Schedule] Screen On: " + mPowerManager.isScreenOn());
- if (getCompareBSPVersion("2020.09.18")) {
- if (!checkLCDOnByCMD()) {
- mIOInterface.ctrlLcdWakeUp(); // 절전상태일 경우, jni LcdWakeUp 먼저 호출
- }
- }
- else {
- if (!mPowerManager.isScreenOn()) {
- Log.d(TAG, "[MakePopup_Schedule] V40Interface LcdWakeUp Call!!");
- mIOInterface.ctrlLcdWakeUp(); // 절전상태일 경우, jni LcdWakeUp 먼저 호출
- }
- }
- ((MainActivity) mContext).getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
- // 알람 소리를 내준다.
- if (soundOut) {
- Log.e(TAG, "[MakePopup_Schedule] ========== JEFF 4 ==========");
- Sound().Play(SND.effect.EFFECT1);
- }
- Log.e(TAG, "[MakePopup_Schedule] ========== JEFF 5 ==========");
- EnergyAlramPopupMgr.SchedulePopupMsg = popup_msg;
- Log.e(TAG, "[MakePopup_Schedule] ========== JEFF 6 ==========");
- StartPopup(ID.POPUPS.POPUP_SCHEDULENOTIFICATION);
- Log.e(TAG, "[MakePopup_Schedule] ========== JEFF 7 ==========");
- }
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] MakePopup_Schedule(String popup_msg)");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /**
- * 일정 알림 시간 비교!
- * **/
- private void checkScheduleReminder() {
- try {
- Calendar ScheduleCal = Calendar.getInstance();
- Log.i(TAG, "[checkScheduleReminder] ScheduleCal: " + ScheduleCal.getTime());
- WallpadScheduleData SCData = new WallpadScheduleData(getApplicationContext());
- // List<WallpadScheduleData.ScheduleData> scheduleDataDB = SCData.NewGetScheduleDataForMainActivity(ScheduleCal.get(Calendar.YEAR), ScheduleCal.get(Calendar.MONTH) + 1, ScheduleCal.get(Calendar.DAY_OF_MONTH));
- List<WallpadScheduleData.ScheduleData> scheduleDataDB = SCData.getScheduledInfoforMainActivity();
- SCData.closeDB();
- if (scheduleDataDB != null) {
- Log.i(TAG, "scheduleDataDB.size() [" + scheduleDataDB.size() + "]");
- for (int i = 0; i < scheduleDataDB.size(); i++) {
- DebugLogOutput("[checkScheduleReminder] ===================================");
- DebugLogOutput("[checkScheduleReminder] index [" + i + "], year [" + scheduleDataDB.get(i).inqyear + "], month [" + scheduleDataDB.get(i).inqmonth + "], day [" + scheduleDataDB.get(i).inqday + "], hour [" + scheduleDataDB.get(i).inqhour + "]");
- DebugLogOutput("[checkScheduleReminder] msg [" + scheduleDataDB.get(i).inqmsg + "], seq [" + scheduleDataDB.get(i).seqnum + "]");
- /**
- * inqttype: 음력여부 - {"moon", "sun"}
- * inqctype: 주기 - no:없음 or month:매월주기 or year:매년주기
- * inqatype: 알림 - {"no","intime","min","hour","day"} := {안울림, 정각, 10분전, 1시간전, 하루전}
- * inqitype: 행사 - {"birth","memorial","appoint","trip","first","wedding","tax","meeting","car","ancestor"} := {생일,기념일,약속,여행,돌,결혼,공과금,차량점검,제사}
- */
- DebugLogOutput("[checkScheduleReminder] lunar [" + scheduleDataDB.get(i).inqttype + "], cycle [" + scheduleDataDB.get(i).inqctype + "], remindtime [" + scheduleDataDB.get(i).inqatype + "], event [" + scheduleDataDB.get(i).inqitype + "]");
- DebugLogOutput("[checkScheduleReminder] ===================================\n");
- Calendar alarmCalendar = Calendar.getInstance();
- if(scheduleDataDB.get(i).inqatype.equalsIgnoreCase("no") == true) {
- //알림 사용하지 않음.
- Log.i(TAG, "[checkScheduleReminder] ========== alarm off ==========");
- }
- else {
- Log.i(TAG, "[checkScheduleReminder] ========== alarm on ==========");
- if (scheduleDataDB.get(i).inqctype.equalsIgnoreCase("month")) {
- Log.i(TAG, "[checkScheduleReminder] ========== alarm on -> month ==========");
- if (scheduleDataDB.get(i).inqatype.equalsIgnoreCase("intime")) {
- //정각인 경우
- Log.i(TAG, "[checkScheduleReminder] ========== alarm on -> month -> intime ==========");
- alarmCalendar.set(scheduleDataDB.get(i).inqyear, scheduleDataDB.get(i).inqmonth - 1, scheduleDataDB.get(i).inqday, scheduleDataDB.get(i).inqhour, 0);
- if ((ScheduleCal.get(Calendar.DAY_OF_MONTH) == alarmCalendar.get(Calendar.DAY_OF_MONTH))
- && (ScheduleCal.get(Calendar.HOUR_OF_DAY) == alarmCalendar.get(Calendar.HOUR_OF_DAY))
- && (ScheduleCal.get(Calendar.MINUTE) == alarmCalendar.get(Calendar.MINUTE))) {
- AlarmScheduleCount++;
- if (bAlarmScheduleString == false) {
- bAlarmScheduleString = true;
- if (scheduleDataDB.get(i).inqttype.equalsIgnoreCase("moon")) {
- AlarmScheduleString = "[음력] "+ getScheduleEventType(scheduleDataDB.get(i).inqitype);
- }
- else {
- AlarmScheduleString = getScheduleEventType(scheduleDataDB.get(i).inqitype);
- }
- }
- }
- }
- else if (scheduleDataDB.get(i).inqatype.equalsIgnoreCase("min")) {
- //10분 전
- Log.i(TAG, "[checkScheduleReminder] ========== alarm on -> month -> 10 min before ==========");
- alarmCalendar.set(scheduleDataDB.get(i).inqyear, scheduleDataDB.get(i).inqmonth - 1, scheduleDataDB.get(i).inqday, scheduleDataDB.get(i).inqhour, 0);
- alarmCalendar.add(Calendar.MINUTE, -10);
- if ((ScheduleCal.get(Calendar.DAY_OF_MONTH) == alarmCalendar.get(Calendar.DAY_OF_MONTH))
- && (ScheduleCal.get(Calendar.HOUR_OF_DAY) == alarmCalendar.get(Calendar.HOUR_OF_DAY))
- && (ScheduleCal.get(Calendar.MINUTE) == alarmCalendar.get(Calendar.MINUTE))) {
- AlarmScheduleCount++;
- if (bAlarmScheduleString == false) {
- bAlarmScheduleString = true;
- if (scheduleDataDB.get(i).inqttype.equalsIgnoreCase("moon")) {
- AlarmScheduleString = "[음력] "+ getScheduleEventType(scheduleDataDB.get(i).inqitype);
- }
- else {
- AlarmScheduleString = getScheduleEventType(scheduleDataDB.get(i).inqitype);
- }
- }
- }
- }
- else if (scheduleDataDB.get(i).inqatype.equalsIgnoreCase("hour")) {
- //1시간 전
- Log.i(TAG, "[checkScheduleReminder] ========== alarm on -> month -> 1 hour before ==========");
- alarmCalendar.set(scheduleDataDB.get(i).inqyear, scheduleDataDB.get(i).inqmonth - 1, scheduleDataDB.get(i).inqday, scheduleDataDB.get(i).inqhour, 0);
- alarmCalendar.add(Calendar.HOUR_OF_DAY, -1);
- if ((ScheduleCal.get(Calendar.DAY_OF_MONTH) == alarmCalendar.get(Calendar.DAY_OF_MONTH))
- && (ScheduleCal.get(Calendar.HOUR_OF_DAY) == alarmCalendar.get(Calendar.HOUR_OF_DAY))
- && (ScheduleCal.get(Calendar.MINUTE) == alarmCalendar.get(Calendar.MINUTE))) {
- AlarmScheduleCount++;
- if (bAlarmScheduleString == false) {
- bAlarmScheduleString = true;
- if (scheduleDataDB.get(i).inqttype.equalsIgnoreCase("moon")) {
- AlarmScheduleString = "[음력] "+ getScheduleEventType(scheduleDataDB.get(i).inqitype);
- }
- else {
- AlarmScheduleString = getScheduleEventType(scheduleDataDB.get(i).inqitype);
- }
- }
- }
- }
- else if (scheduleDataDB.get(i).inqatype.equalsIgnoreCase("day")) {
- //하루전
- Log.i(TAG, "[checkScheduleReminder] ========== alarm on -> month -> 1 day before ==========");
- alarmCalendar.set(scheduleDataDB.get(i).inqyear, scheduleDataDB.get(i).inqmonth - 1, scheduleDataDB.get(i).inqday, scheduleDataDB.get(i).inqhour, 0);
- alarmCalendar.add(Calendar.DATE, -1);
- // Log.i(TAG, "[checkScheduleReminder] cal.get(Calendar.YEAR): " + ScheduleCal.get(Calendar.YEAR) + ", alarmCalendar.get(Calendar.YEAR): " + alarmCalendar.get(Calendar.YEAR));
- // Log.i(TAG, "[checkScheduleReminder] cal.get(Calendar.MONTH): " + ScheduleCal.get(Calendar.MONTH) + ", alarmCalendar.get(Calendar.MONTH): " + alarmCalendar.get(Calendar.MONTH));
- // Log.i(TAG, "[checkScheduleReminder] cal.get(Calendar.DAY_OF_MONTH): " + ScheduleCal.get(Calendar.DAY_OF_MONTH) + ", alarmCalendar.get(Calendar.DAY_OF_MONTH): " + alarmCalendar.get(Calendar.DAY_OF_MONTH));
- // Log.i(TAG, "[checkScheduleReminder] cal.get(Calendar.HOUR_OF_DAY): " + ScheduleCal.get(Calendar.HOUR_OF_DAY) + ", alarmCalendar.get(Calendar.HOUR_OF_DAY): " + alarmCalendar.get(Calendar.HOUR_OF_DAY));
- // Log.i(TAG, "[checkScheduleReminder] cal.get(Calendar.MINUTE): " + ScheduleCal.get(Calendar.MINUTE) + ", alarmCalendar.get(Calendar.MINUTE): " + alarmCalendar.get(Calendar.MINUTE));
- if ((ScheduleCal.get(Calendar.DAY_OF_MONTH) == alarmCalendar.get(Calendar.DAY_OF_MONTH))
- && (ScheduleCal.get(Calendar.HOUR_OF_DAY) == alarmCalendar.get(Calendar.HOUR_OF_DAY))
- && (ScheduleCal.get(Calendar.MINUTE) == alarmCalendar.get(Calendar.MINUTE))) {
- AlarmScheduleCount++;
- if (bAlarmScheduleString == false) {
- bAlarmScheduleString = true;
- if (scheduleDataDB.get(i).inqttype.equalsIgnoreCase("moon")) {
- AlarmScheduleString = "[음력] "+ getScheduleEventType(scheduleDataDB.get(i).inqitype);
- }
- else {
- AlarmScheduleString = getScheduleEventType(scheduleDataDB.get(i).inqitype);
- }
- }
- }
- }
- }
- else if (scheduleDataDB.get(i).inqctype.equalsIgnoreCase("year")) {
- Log.i(TAG, "[checkScheduleReminder] ========== alarm on -> year ==========");
- if (scheduleDataDB.get(i).inqatype.equalsIgnoreCase("intime")) {
- //정각인 경우
- Log.i(TAG, "[checkScheduleReminder] ========== alarm on -> year -> intime ==========");
- alarmCalendar.set(scheduleDataDB.get(i).inqyear, scheduleDataDB.get(i).inqmonth - 1, scheduleDataDB.get(i).inqday, scheduleDataDB.get(i).inqhour, 0);
- if ((ScheduleCal.get(Calendar.MONTH) == alarmCalendar.get(Calendar.MONTH))
- && (ScheduleCal.get(Calendar.DAY_OF_MONTH) == alarmCalendar.get(Calendar.DAY_OF_MONTH))
- && (ScheduleCal.get(Calendar.HOUR_OF_DAY) == alarmCalendar.get(Calendar.HOUR_OF_DAY))
- && (ScheduleCal.get(Calendar.MINUTE) == alarmCalendar.get(Calendar.MINUTE))) {
- AlarmScheduleCount++;
- if (bAlarmScheduleString == false) {
- bAlarmScheduleString = true;
- if (scheduleDataDB.get(i).inqttype.equalsIgnoreCase("moon")) {
- AlarmScheduleString = "[음력] "+ getScheduleEventType(scheduleDataDB.get(i).inqitype);
- }
- else {
- AlarmScheduleString = getScheduleEventType(scheduleDataDB.get(i).inqitype);
- }
- }
- }
- }
- else if (scheduleDataDB.get(i).inqatype.equalsIgnoreCase("min")) {
- //10분 전
- Log.i(TAG, "[checkScheduleReminder] ========== alarm on -> year -> 10 min before ==========");
- alarmCalendar.set(scheduleDataDB.get(i).inqyear, scheduleDataDB.get(i).inqmonth - 1, scheduleDataDB.get(i).inqday, scheduleDataDB.get(i).inqhour, 0);
- alarmCalendar.add(Calendar.MINUTE, -10);
- if ((ScheduleCal.get(Calendar.MONTH) == alarmCalendar.get(Calendar.MONTH))
- && (ScheduleCal.get(Calendar.DAY_OF_MONTH) == alarmCalendar.get(Calendar.DAY_OF_MONTH))
- && (ScheduleCal.get(Calendar.HOUR_OF_DAY) == alarmCalendar.get(Calendar.HOUR_OF_DAY))
- && (ScheduleCal.get(Calendar.MINUTE) == alarmCalendar.get(Calendar.MINUTE)))
- {
- AlarmScheduleCount++;
- if (bAlarmScheduleString == false) {
- bAlarmScheduleString = true;
- if (scheduleDataDB.get(i).inqttype.equalsIgnoreCase("moon")) {
- AlarmScheduleString = "[음력] "+ getScheduleEventType(scheduleDataDB.get(i).inqitype);
- }
- else {
- AlarmScheduleString = getScheduleEventType(scheduleDataDB.get(i).inqitype);
- }
- }
- }
- }
- else if (scheduleDataDB.get(i).inqatype.equalsIgnoreCase("hour")) {
- //1시간 전
- Log.i(TAG, "[checkScheduleReminder] ========== alarm on -> year -> 1 hour before ==========");
- alarmCalendar.set(scheduleDataDB.get(i).inqyear, scheduleDataDB.get(i).inqmonth - 1, scheduleDataDB.get(i).inqday, scheduleDataDB.get(i).inqhour, 0);
- alarmCalendar.add(Calendar.HOUR_OF_DAY, -1);
- if ((ScheduleCal.get(Calendar.MONTH) == alarmCalendar.get(Calendar.MONTH))
- && (ScheduleCal.get(Calendar.DAY_OF_MONTH) == alarmCalendar.get(Calendar.DAY_OF_MONTH))
- && (ScheduleCal.get(Calendar.HOUR_OF_DAY) == alarmCalendar.get(Calendar.HOUR_OF_DAY))
- && (ScheduleCal.get(Calendar.MINUTE) == alarmCalendar.get(Calendar.MINUTE)))
- {
- AlarmScheduleCount++;
- if (bAlarmScheduleString == false) {
- bAlarmScheduleString = true;
- if (scheduleDataDB.get(i).inqttype.equalsIgnoreCase("moon")) {
- AlarmScheduleString = "[음력] "+ getScheduleEventType(scheduleDataDB.get(i).inqitype);
- }
- else {
- AlarmScheduleString = getScheduleEventType(scheduleDataDB.get(i).inqitype);
- }
- }
- }
- }
- else if (scheduleDataDB.get(i).inqatype.equalsIgnoreCase("day")) {
- //하루전
- Log.i(TAG, "[checkScheduleReminder] ========== alarm on -> year -> 1 day before ==========");
- alarmCalendar.set(scheduleDataDB.get(i).inqyear, scheduleDataDB.get(i).inqmonth - 1, scheduleDataDB.get(i).inqday, scheduleDataDB.get(i).inqhour, 0);
- alarmCalendar.add(Calendar.DATE, -1);
- // Log.i(TAG, "[checkScheduleReminder] cal.get(Calendar.YEAR): " + ScheduleCal.get(Calendar.YEAR) + ", alarmCalendar.get(Calendar.YEAR): " + alarmCalendar.get(Calendar.YEAR));
- // Log.i(TAG, "[checkScheduleReminder] cal.get(Calendar.MONTH): " + ScheduleCal.get(Calendar.MONTH) + ", alarmCalendar.get(Calendar.MONTH): " + alarmCalendar.get(Calendar.MONTH));
- // Log.i(TAG, "[checkScheduleReminder] cal.get(Calendar.DAY_OF_MONTH): " + ScheduleCal.get(Calendar.DAY_OF_MONTH) + ", alarmCalendar.get(Calendar.DAY_OF_MONTH): " + alarmCalendar.get(Calendar.DAY_OF_MONTH));
- // Log.i(TAG, "[checkScheduleReminder] cal.get(Calendar.HOUR_OF_DAY): " + ScheduleCal.get(Calendar.HOUR_OF_DAY) + ", alarmCalendar.get(Calendar.HOUR_OF_DAY): " + alarmCalendar.get(Calendar.HOUR_OF_DAY));
- // Log.i(TAG, "[checkScheduleReminder] cal.get(Calendar.MINUTE): " + ScheduleCal.get(Calendar.MINUTE) + ", alarmCalendar.get(Calendar.MINUTE): " + alarmCalendar.get(Calendar.MINUTE));
- if ((ScheduleCal.get(Calendar.MONTH) == alarmCalendar.get(Calendar.MONTH))
- && (ScheduleCal.get(Calendar.DAY_OF_MONTH) == alarmCalendar.get(Calendar.DAY_OF_MONTH))
- && (ScheduleCal.get(Calendar.HOUR_OF_DAY) == alarmCalendar.get(Calendar.HOUR_OF_DAY))
- && (ScheduleCal.get(Calendar.MINUTE) == alarmCalendar.get(Calendar.MINUTE)))
- {
- AlarmScheduleCount++;
- if (bAlarmScheduleString == false) {
- bAlarmScheduleString = true;
- if (scheduleDataDB.get(i).inqttype.equalsIgnoreCase("moon")) {
- AlarmScheduleString = "[음력] "+ getScheduleEventType(scheduleDataDB.get(i).inqitype);
- }
- else {
- AlarmScheduleString = getScheduleEventType(scheduleDataDB.get(i).inqitype);
- }
- }
- }
- }
- }
- else {
- //반복 없는경우
- Log.i(TAG, "[checkScheduleReminder] ========== alarm on -> no repeat ==========");
- if (scheduleDataDB.get(i).inqatype.equalsIgnoreCase("intime")) {
- //정각인 경우
- Log.i(TAG, "[checkScheduleReminder] ========== alarm on -> no repeat -> intime ==========");
- alarmCalendar.set(scheduleDataDB.get(i).inqyear, scheduleDataDB.get(i).inqmonth - 1, scheduleDataDB.get(i).inqday, scheduleDataDB.get(i).inqhour, 0);
- if ((ScheduleCal.get(Calendar.YEAR) == alarmCalendar.get(Calendar.YEAR))
- && (ScheduleCal.get(Calendar.MONTH) == alarmCalendar.get(Calendar.MONTH))
- && (ScheduleCal.get(Calendar.DAY_OF_MONTH) == alarmCalendar.get(Calendar.DAY_OF_MONTH))
- && (ScheduleCal.get(Calendar.HOUR_OF_DAY) == alarmCalendar.get(Calendar.HOUR_OF_DAY))
- && (ScheduleCal.get(Calendar.MINUTE) == alarmCalendar.get(Calendar.MINUTE)))
- {
- AlarmScheduleCount++;
- if (bAlarmScheduleString == false) {
- bAlarmScheduleString = true;
- if (scheduleDataDB.get(i).inqttype.equalsIgnoreCase("moon")) {
- AlarmScheduleString = "[음력] "+ getScheduleEventType(scheduleDataDB.get(i).inqitype);
- }
- else {
- AlarmScheduleString = getScheduleEventType(scheduleDataDB.get(i).inqitype);
- }
- }
- }
- }
- else if (scheduleDataDB.get(i).inqatype.equalsIgnoreCase("min")) {
- //10분 전
- Log.i(TAG, "[checkScheduleReminder] ========== alarm on -> no repeat -> 10 min before ==========");
- alarmCalendar.set(scheduleDataDB.get(i).inqyear, scheduleDataDB.get(i).inqmonth - 1, scheduleDataDB.get(i).inqday, scheduleDataDB.get(i).inqhour, 0);
- alarmCalendar.add(Calendar.MINUTE, -10);
- if ((ScheduleCal.get(Calendar.YEAR) == alarmCalendar.get(Calendar.YEAR))
- && (ScheduleCal.get(Calendar.MONTH) == alarmCalendar.get(Calendar.MONTH))
- && (ScheduleCal.get(Calendar.DAY_OF_MONTH) == alarmCalendar.get(Calendar.DAY_OF_MONTH))
- && (ScheduleCal.get(Calendar.HOUR_OF_DAY) == alarmCalendar.get(Calendar.HOUR_OF_DAY))
- && (ScheduleCal.get(Calendar.MINUTE) == alarmCalendar.get(Calendar.MINUTE)))
- {
- AlarmScheduleCount++;
- if (bAlarmScheduleString == false) {
- bAlarmScheduleString = true;
- if (scheduleDataDB.get(i).inqttype.equalsIgnoreCase("moon")) {
- AlarmScheduleString = "[음력] "+ getScheduleEventType(scheduleDataDB.get(i).inqitype);
- }
- else {
- AlarmScheduleString = getScheduleEventType(scheduleDataDB.get(i).inqitype);
- }
- }
- }
- }
- else if(scheduleDataDB.get(i).inqatype.equalsIgnoreCase("hour")) {
- //1시간 전
- Log.i(TAG, "[checkScheduleReminder] ========== alarm on -> no repeat -> 1 hour before ==========");
- alarmCalendar.set(scheduleDataDB.get(i).inqyear, scheduleDataDB.get(i).inqmonth - 1, scheduleDataDB.get(i).inqday, scheduleDataDB.get(i).inqhour, 0);
- alarmCalendar.add(Calendar.HOUR_OF_DAY, -1);
- if ((ScheduleCal.get(Calendar.YEAR) == alarmCalendar.get(Calendar.YEAR))
- && (ScheduleCal.get(Calendar.MONTH) == alarmCalendar.get(Calendar.MONTH))
- && (ScheduleCal.get(Calendar.DAY_OF_MONTH) == alarmCalendar.get(Calendar.DAY_OF_MONTH))
- && (ScheduleCal.get(Calendar.HOUR_OF_DAY) == alarmCalendar.get(Calendar.HOUR_OF_DAY))
- && (ScheduleCal.get(Calendar.MINUTE) == alarmCalendar.get(Calendar.MINUTE)))
- {
- AlarmScheduleCount++;
- if (bAlarmScheduleString == false) {
- bAlarmScheduleString = true;
- if (scheduleDataDB.get(i).inqttype.equalsIgnoreCase("moon")) {
- AlarmScheduleString = "[음력] "+ getScheduleEventType(scheduleDataDB.get(i).inqitype);
- }
- else {
- AlarmScheduleString = getScheduleEventType(scheduleDataDB.get(i).inqitype);
- }
- }
- }
- }
- else if (scheduleDataDB.get(i).inqatype.equalsIgnoreCase("day")) {
- //하루전
- Log.i(TAG, "[checkScheduleReminder] ========== alarm on -> no repeat -> 1 day before ==========");
- alarmCalendar.set(scheduleDataDB.get(i).inqyear, scheduleDataDB.get(i).inqmonth - 1, scheduleDataDB.get(i).inqday, scheduleDataDB.get(i).inqhour, 0);
- alarmCalendar.add(Calendar.DATE, -1);
- // Log.i(TAG, "[checkScheduleReminder] cal.get(Calendar.YEAR): " + ScheduleCal.get(Calendar.YEAR) + ", alarmCalendar.get(Calendar.YEAR): " + alarmCalendar.get(Calendar.YEAR));
- // Log.i(TAG, "[checkScheduleReminder] cal.get(Calendar.MONTH): " + ScheduleCal.get(Calendar.MONTH) + ", alarmCalendar.get(Calendar.MONTH): " + alarmCalendar.get(Calendar.MONTH));
- // Log.i(TAG, "[checkScheduleReminder] cal.get(Calendar.DAY_OF_MONTH): " + ScheduleCal.get(Calendar.DAY_OF_MONTH) + ", alarmCalendar.get(Calendar.DAY_OF_MONTH): " + alarmCalendar.get(Calendar.DAY_OF_MONTH));
- // Log.i(TAG, "[checkScheduleReminder] cal.get(Calendar.HOUR_OF_DAY): " + ScheduleCal.get(Calendar.HOUR_OF_DAY) + ", alarmCalendar.get(Calendar.HOUR_OF_DAY): " + alarmCalendar.get(Calendar.HOUR_OF_DAY));
- // Log.i(TAG, "[checkScheduleReminder] cal.get(Calendar.MINUTE): " + ScheduleCal.get(Calendar.MINUTE) + ", alarmCalendar.get(Calendar.MINUTE): " + alarmCalendar.get(Calendar.MINUTE));
- if ((ScheduleCal.get(Calendar.YEAR) == alarmCalendar.get(Calendar.YEAR))
- && (ScheduleCal.get(Calendar.MONTH) == alarmCalendar.get(Calendar.MONTH))
- && (ScheduleCal.get(Calendar.DAY_OF_MONTH) == alarmCalendar.get(Calendar.DAY_OF_MONTH))
- && (ScheduleCal.get(Calendar.HOUR_OF_DAY) == alarmCalendar.get(Calendar.HOUR_OF_DAY))
- && (ScheduleCal.get(Calendar.MINUTE) == alarmCalendar.get(Calendar.MINUTE)))
- {
- AlarmScheduleCount++;
- if (bAlarmScheduleString == false) {
- bAlarmScheduleString = true;
- if (scheduleDataDB.get(i).inqttype.equalsIgnoreCase("moon")) {
- AlarmScheduleString = "[음력] "+ getScheduleEventType(scheduleDataDB.get(i).inqitype);
- }
- else {
- AlarmScheduleString = getScheduleEventType(scheduleDataDB.get(i).inqitype);
- }
- }
- }
- }
- else {
- Log.w(TAG, "[checkScheduleReminder] Unsupported alarm type!! -> " + scheduleDataDB.get(i).inqatype);
- }
- }
- }
- }
- Log.i(TAG, "[checkScheduleReminder] bAlarmScheduleString [" + bAlarmScheduleString + "], AlarmScheduleCount [" + AlarmScheduleCount + "]");
- if (bAlarmScheduleString == true) {
- if(AlarmScheduleCount == 1) {
- //일정이 1개인 경우
- AlarmScheduleString += " 일정이 있습니다.\r\n확인 하시겠습니까?";
- }
- else {
- //일정이 1개보다 많은 경우
- AlarmScheduleString += " 일정 외 "+(AlarmScheduleCount-1)+"건이 있습니다.\r\n확인 하시겠습니까?";
- }
- AlarmScheduleCount = 0;
- bAlarmScheduleString = false;
- MakePopup_Schedule(AlarmScheduleString);
- }
- }
- else {
- Log.w(TAG, "[checkScheduleReminder] scheduleDataDB is null!!");
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] checkScheduleReminder(Calendar cal)");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- // 프로토콜에 정의된 일정표 이벤트 종류를 변환하여 반환한다.
- private String getScheduleEventType(String strEvent) {
- try {
- Log.i(TAG, "[getScheduleEventType] strEvent [" + strEvent + "]");
- if (strEvent.equalsIgnoreCase("birth")) return "생일";
- else if (strEvent.equalsIgnoreCase("memorial")) return "기념일";
- else if (strEvent.equalsIgnoreCase("appoint")) return "약속";
- else if (strEvent.equalsIgnoreCase("trip")) return "여행";
- else if (strEvent.equalsIgnoreCase("first")) return "돌";
- else if (strEvent.equalsIgnoreCase("wedding")) return "결혼";
- else if (strEvent.equalsIgnoreCase("tax")) return "공과금";
- else if (strEvent.equalsIgnoreCase("meeting")) return "모임";
- else if (strEvent.equalsIgnoreCase("car")) return "생일";
- else if (strEvent.equalsIgnoreCase("ancestor")) return "제사";
- else return "알수없음";
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return "알수없음";
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] getScheduleEventType(String strEvent)");
- LogUtil.errorLogInfo("", TAG, e);
- return "알수없음";
- }
- }
-
- private void getParkedVehicleLocationSysInfo() {
- try {
- DebugLogOutput("getParkedVehicleLocationSysInfo Init");
- WallpadDeviceSet devSet = new WallpadDeviceSet(getContext());
- String[] ParkingDB = devSet.GetSettingData("주차확인");
- devSet.closeDB();
-
- if (ParkingDB!=null) {
- try {
- String devInfo = ParkingDB[1];
-
- devInfo = devInfo.replace('(', '_');
- devInfo = devInfo.replace(':', '_');
- devInfo = devInfo.replace(')', '_');
-
- String[] ParkingInfo = devInfo.split("_");
-
- //ParkingInfo[3] -> 사용여부 <사용함 / else>
- //ParkingInfo[5] -> 종류 <기본 / 아이콘트롤스 / NEXPA / UPIS / ETC / 비상벨 / else>
- //ParkingInfo[7] -> IP정보
- //ParkingInfo[8] -> 포트번호
-
- if (ParkingInfo[3].equalsIgnoreCase("사용함") == true) {
- bUseofNot_ParkingInfo = true;
- }
- if (ParkingInfo[5].equalsIgnoreCase("기본") == true) {
- nParkingSystemType = Common.PARKING_SYSTEM_BASIC;
- }
- else if (ParkingInfo[5].equalsIgnoreCase("아이콘트롤스") == true) {
- nParkingSystemType = Common.PARKING_SYSTEM_ICONTROLS;
- }
- else if (ParkingInfo[5].equalsIgnoreCase("넥스파") == true) {
- nParkingSystemType = Common.PARKING_SYSTEM_NEXPA;
- }
- else if (ParkingInfo[5].equalsIgnoreCase("NEXPA") == true) {
- nParkingSystemType = Common.PARKING_SYSTEM_NEXPA;
- }
- else if (ParkingInfo[5].equalsIgnoreCase("UPIS") == true) {
- nParkingSystemType = Common.PARKING_SYSTEM_UPIS;
- }
- else if (ParkingInfo[5].equalsIgnoreCase("ETC") == true) {
- nParkingSystemType = Common.PARKING_SYSTEM_ETC;
- }
- else if (ParkingInfo[5].equalsIgnoreCase("비상벨") == true) {
- nParkingSystemType = Common.PARKING_SYSTEM_IES_100;
- }
- else if (ParkingInfo[5].equalsIgnoreCase("다람정보") == true) {
- nParkingSystemType = Common.PARKING_SYSTEM_DARAM;
- }
-
- ParkingServerIP = ParkingInfo[7];
- ParkingServerPort = Integer.parseInt(ParkingInfo[8]);
-
- DebugLogOutput("[getParkedVehicleLocationSysInfo] bUseofNot_ParkingInfo [" + bUseofNot_ParkingInfo + ", nParkingSystemType ["+ nParkingSystemType + "]");
- DebugLogOutput("[getParkedVehicleLocationSysInfo] ParkingServerIP ["+ParkingServerIP + "], ParkingServerPort [" + ParkingServerPort + "]");
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- bUseofNot_ParkingInfo = false;
- }
- catch (Exception e) {
- LogUtil.errorLogInfo("", TAG, e);
- bUseofNot_ParkingInfo = false;
- }
- }
- else {
- bUseofNot_ParkingInfo = false;
- DebugLogOutput("[getParkedVehicleLocationSysInfo] bUseofNot_ParkingInfo ["+bUseofNot_ParkingInfo + "]");
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- //20분 마다 한번씩 호출되는 주차관련 함수!
- private void GetParkingInfo_RandomCheckHandler() {
- int DelayTime = StringUtil.GetDelayTimeBaseIP(getContext());
- if (DelayTime < 1) {
- return;
- }
-
- DebugLogOutput("[GetParkingInfo] DelayTime : "+ DelayTime);
- bSetMSG_GetParkingInfo = true;
- mGetParkInfoRandomCheckHandler.sendEmptyMessageDelayed(0, 1000 * DelayTime);
- }
- private Handler mGetParkInfoRandomCheckHandler = new Handler()
- {
- @Override
- public void handleMessage(Message msg)
- {
- if (msg.what == 0) {
- DebugLogOutput("[GetParkingInfo] mGetParkInfoRandomCheckHandler() will be called");
- //얻어오기
- LoadParkingDataFromServer();
- }
- }
- };
-
- /**
- * @description 주차정보 서버로부터 얻어오기<br>
- * 호출 시에는 bSetMSG_GetParkingInfo = true 하고 호출해야함.
- * **/
- private void LoadParkingDataFromServer() {
- try {
- WallpadStatusData SetData = new WallpadStatusData(getApplicationContext());
- final AddressSet addc = SetData.getAddressMGR();
- SetData.closeDB();
- if (bSetMSG_GetParkingInfo == false) {
- return;
- }
- if ((nParkingSystemType == Common.PARKING_SYSTEM_BASIC)
- || (nParkingSystemType == Common.PARKING_SYSTEM_ICONTROLS)
- || (nParkingSystemType == Common.PARKING_SYSTEM_NEXPA)
- || (nParkingSystemType == Common.PARKING_SYSTEM_IES_100))
- {
- boolean bSSLEnable = true;
- if (!ParkingServerIP.equals("10.0.1.1")) bSSLEnable = false;
- iMAPcarParking = new iMAPCarParking(mContext, bSSLEnable);
- iMAPcarParking.SetServerIPcfg(ParkingServerIP, ParkingServerPort);
- DebugLogOutput("ParkingServerIP :"+ParkingServerIP+", ParkingServerPort : "+ParkingServerPort);
- DebugLogOutput("iMAPcarParking.DoWork()");
- iMAPcarParking.DoWork();
- iMAPcarParking.SetRetCtr(new RetProci(){
- @Override
- public void ProcSuccess() {
- DebugLogOutput("Load EMData From Server - ProcSuccess");
- try {
- iMAPcarParking.SetItem("home_info");
- int home_info_count = Integer.parseInt(iMAPcarParking.GetAttributeVal(0, "count"));
- int park_info_count = iMAPcarParking.SetItem("park_info");
- if (home_info_count != park_info_count) {
- DebugLogOutput("home_info_count != park_info_count -->"+ home_info_count+" != "+ park_info_count);
- cGetParkingMin = 0;
- bSetMSG_GetParkingInfo = false;
- return;
- }
- if (park_info_count == 0) {
- DebugLogOutput("park_info_count :" + park_info_count);
- WallpadParkInfo parkdb = new WallpadParkInfo(getApplicationContext());
- parkdb.DeleteAllParkInfo();
- parkdb.closeDB();
- cGetParkingMin = 0;
- bSetMSG_GetParkingInfo = false;
- /*
- parkdb = new WallpadParkInfo(getApplicationContext());
- int countRow = parkdb.RowCountCarParking();
- parkdb.closeDB();
- DebugLogOutput("countRow :" + countRow);
- */
- Intent intent = new Intent();
- intent.setAction(define.NOTIFY_ACNAME);
- intent.putExtra(define.NOTIBR_KIND, define.NOTIFY_UPDATEPARKING);
- getApplicationContext().sendBroadcast(intent);
- return;
- }
- WallpadParkInfo parkdb = new WallpadParkInfo(getApplicationContext());
- parkdb.DeleteAllParkInfo();
- parkdb.closeDB();
- for (int i = 0; i < park_info_count; i++) {
- if ((addc.Dong.equalsIgnoreCase(iMAPcarParking.GetAttributeVal(i, "dong"))) && (addc.Ho.equalsIgnoreCase(iMAPcarParking.GetAttributeVal(i, "ho")))) {
- parkdb = new WallpadParkInfo(getApplicationContext());
- parkdb.InputParkInfo(
- iMAPcarParking.GetAttributeVal(i, "index"),
- iMAPcarParking.GetAttributeVal(i, "dong"),
- iMAPcarParking.GetAttributeVal(i, "ho"),
- iMAPcarParking.GetAttributeVal(i, "card_num"),
- iMAPcarParking.GetAttributeVal(i, "uid"),
- iMAPcarParking.GetAttributeVal(i, "sn"),
- iMAPcarParking.GetAttributeVal(i, "card_type"),
- iMAPcarParking.GetAttributeVal(i, "time"),
- iMAPcarParking.GetAttributeVal(i, "location_text"),
- iMAPcarParking.GetAttributeVal(i, "location_map"),
- iMAPcarParking.GetAttributeVal(i, "vehicle_info"),
- iMAPcarParking.GetAttributeVal(i, "ftp_path"),
- iMAPcarParking.GetAttributeVal(i, "ftp_info"),
- iMAPcarParking.GetAttributeVal(i, "message"));
- parkdb.closeDB();
- }
- }
- //테스트
- parkdb = new WallpadParkInfo(getApplicationContext());
- CarParkingData carParkingData[] = parkdb.getCarParkingData();
- parkdb.closeDB();
- if (carParkingData != null) {
- for (int j = 0; j < carParkingData.length; j++) {
- DebugLogOutput(carParkingData[j].ToDebugString());
- }
- }
- //테스트
- Intent intent = new Intent();
- intent.setAction(define.NOTIFY_ACNAME);
- intent.putExtra(define.NOTIBR_KIND, define.NOTIFY_UPDATEPARKING);
- getApplicationContext().sendBroadcast(intent);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- cGetParkingMin = 0;
- bSetMSG_GetParkingInfo = false;
- }
- catch (Exception e) {
- cGetParkingMin = 0;
- bSetMSG_GetParkingInfo = false;
- Log.e(TAG, "[Exception] iMAPcarParking.ProcSuccess()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- cGetParkingMin = 0;
- bSetMSG_GetParkingInfo = false;
- }
- @Override
- public void ProcError() {
- cGetParkingMin = 0;
- bSetMSG_GetParkingInfo = false;
- DebugLogOutput("Load EMData From Server - ProcError");
- }
- @Override
- public void ProcDoing() {
- }
- });
- }
- else if (nParkingSystemType == Common.PARKING_SYSTEM_DARAM) {
- iMAPcarParking = new iMAPCarParking(mContext, false);
- iMAPcarParking.SetServerIPcfg(ParkingServerIP, ParkingServerPort);
- DebugLogOutput("ParkingServerIP :"+ParkingServerIP+", ParkingServerPort : "+ParkingServerPort);
- DebugLogOutput("iMAPcarParking.DoWork()");
- iMAPcarParking.DoWork();
- iMAPcarParking.SetRetCtr(new RetProci(){
- @Override
- public void ProcSuccess() {
- DebugLogOutput("Load EMData From Server - ProcSuccess");
- try {
- iMAPcarParking.SetItem("home_info");
- int home_info_count = Integer.parseInt(iMAPcarParking.GetAttributeVal(0, "count"));
- int park_info_count = iMAPcarParking.SetItem("park_info");
- if (home_info_count != park_info_count) {
- DebugLogOutput("home_info_count != park_info_count -->"+ home_info_count+" != "+ park_info_count);
- cGetParkingMin = 0;
- bSetMSG_GetParkingInfo = false;
- return;
- }
- if (park_info_count == 0) {
- DebugLogOutput("park_info_count :" + park_info_count);
- WallpadParkInfo parkdb = new WallpadParkInfo(getApplicationContext());
- parkdb.DeleteAllParkInfo();
- parkdb.closeDB();
- cGetParkingMin = 0;
- bSetMSG_GetParkingInfo = false;
- /*
- parkdb = new WallpadParkInfo(getApplicationContext());
- int countRow = parkdb.RowCountCarParking();
- parkdb.closeDB();
- DebugLogOutput("countRow :" + countRow);
- */
- Intent intent = new Intent();
- intent.setAction(define.NOTIFY_ACNAME);
- intent.putExtra(define.NOTIBR_KIND, define.NOTIFY_UPDATEPARKING);
- getApplicationContext().sendBroadcast(intent);
- return;
- }
- WallpadParkInfo parkdb = new WallpadParkInfo(getApplicationContext());
- parkdb.DeleteAllParkInfo();
- parkdb.closeDB();
- for (int i = 0; i < park_info_count; i++) {
- if ((addc.Dong.equalsIgnoreCase(iMAPcarParking.GetAttributeVal(i, "dong"))) && (addc.Ho.equalsIgnoreCase(iMAPcarParking.GetAttributeVal(i, "ho")))) {
- parkdb = new WallpadParkInfo(getApplicationContext());
- parkdb.InputParkInfo(
- iMAPcarParking.GetAttributeVal(i, "index"),
- iMAPcarParking.GetAttributeVal(i, "dong"),
- iMAPcarParking.GetAttributeVal(i, "ho"),
- iMAPcarParking.GetAttributeVal(i, "card_num"),
- iMAPcarParking.GetAttributeVal(i, "uid"),
- iMAPcarParking.GetAttributeVal(i, "sn"),
- iMAPcarParking.GetAttributeVal(i, "card_type"),
- iMAPcarParking.GetAttributeVal(i, "time"),
- iMAPcarParking.GetAttributeVal(i, "location_text"),
- iMAPcarParking.GetAttributeVal(i, "location_map"),
- iMAPcarParking.GetAttributeVal(i, "vehicle_info"),
- iMAPcarParking.GetAttributeVal(i, "ftp_path"),
- iMAPcarParking.GetAttributeVal(i, "ftp_info"),
- iMAPcarParking.GetAttributeVal(i, "message"));
- parkdb.closeDB();
- }
- }
- //테스트
- parkdb = new WallpadParkInfo(getApplicationContext());
- CarParkingData carParkingData[] = parkdb.getCarParkingData();
- parkdb.closeDB();
- if (carParkingData != null) {
- for (int j = 0; j < carParkingData.length; j++) {
- DebugLogOutput(carParkingData[j].ToDebugString());
- }
- }
- //테스트
- Intent intent = new Intent();
- intent.setAction(define.NOTIFY_ACNAME);
- intent.putExtra(define.NOTIBR_KIND, define.NOTIFY_UPDATEPARKING);
- getApplicationContext().sendBroadcast(intent);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- cGetParkingMin = 0;
- bSetMSG_GetParkingInfo = false;
- }
- catch (Exception e) {
- cGetParkingMin = 0;
- bSetMSG_GetParkingInfo = false;
- Log.e(TAG, "[Exception] iMAPcarParking.ProcSuccess()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- cGetParkingMin = 0;
- bSetMSG_GetParkingInfo = false;
- }
- @Override
- public void ProcError() {
- cGetParkingMin = 0;
- bSetMSG_GetParkingInfo = false;
- DebugLogOutput("Load EMData From Server - ProcError");
- }
- @Override
- public void ProcDoing() {
- }
- });
- }
- else if (nParkingSystemType == Common.PARKING_SYSTEM_UPIS) {
- iMapcarParking_UPIS = new iMAPCarParking_UPIS(mContext, false);
- iMapcarParking_UPIS.SetServerIPcfg(ParkingServerIP, ParkingServerPort);
- DebugLogOutput("ParkingServerIP :"+ParkingServerIP+", ParkingServerPort : "+ParkingServerPort);
- DebugLogOutput("iMapcarParking_UPIS.DoWork()");
- iMapcarParking_UPIS.DoWork();
- iMapcarParking_UPIS.SetRetCtr(new RetProci(){
- @Override
- public void ProcSuccess() {
- DebugLogOutput("Load EMData From Server - ProcSuccess");
- try {
- iMapcarParking_UPIS.SetItem("home_info");
- int home_info_count = Integer.parseInt(iMapcarParking_UPIS.GetAttributeVal(0, "count"));
- int park_info_count = iMapcarParking_UPIS.SetItem("park_info");
- if (home_info_count != park_info_count) {
- DebugLogOutput("home_info_count != park_info_count -->"+ home_info_count+" != "+ park_info_count);
- cGetParkingMin = 0;
- bSetMSG_GetParkingInfo = false;
- return;
- }
- if (park_info_count == 0) {
- DebugLogOutput("park_info_count :" + park_info_count);
- WallpadParkInfo parkdb = new WallpadParkInfo(getApplicationContext());
- parkdb.DeleteAllParkInfo();
- parkdb.closeDB();
- cGetParkingMin = 0;
- bSetMSG_GetParkingInfo = false;
- /*
- parkdb = new WallpadParkInfo(getApplicationContext());
- int countRow = parkdb.RowCountCarParking();
- parkdb.closeDB();
- DebugLogOutput("countRow :" + countRow);
- */
- Intent intent = new Intent();
- intent.setAction(define.NOTIFY_ACNAME);
- intent.putExtra(define.NOTIBR_KIND, define.NOTIFY_UPDATEPARKING);
- getApplicationContext().sendBroadcast(intent);
- return;
- }
- WallpadParkInfo parkdb = new WallpadParkInfo(getApplicationContext());
- parkdb.DeleteAllParkInfo();
- parkdb.closeDB();
- for (int i = 0; i < park_info_count; i++) {
- if ((addc.Dong.equalsIgnoreCase(iMapcarParking_UPIS.GetAttributeVal(i, "dong"))) && (addc.Ho.equalsIgnoreCase(iMapcarParking_UPIS.GetAttributeVal(i, "ho")))) {
- parkdb = new WallpadParkInfo(getApplicationContext());
- parkdb.InputParkInfo(
- iMapcarParking_UPIS.GetAttributeVal(i, "index"),
- iMapcarParking_UPIS.GetAttributeVal(i, "dong"),
- iMapcarParking_UPIS.GetAttributeVal(i, "ho"),
- "null",
- iMapcarParking_UPIS.GetAttributeVal(i, "uid"),
- iMapcarParking_UPIS.GetAttributeVal(i, "sn"),
- iMapcarParking_UPIS.GetAttributeVal(i, "card_type"),
- iMapcarParking_UPIS.GetAttributeVal(i, "time"),
- iMapcarParking_UPIS.GetAttributeVal(i, "location_2"),
- iMapcarParking_UPIS.GetAttributeVal(i, "location_1"),
- iMapcarParking_UPIS.GetAttributeVal(i, "car_info"),
- "null",
- "null",
- iMapcarParking_UPIS.GetAttributeVal(i, "message"));
- parkdb.closeDB();
- }
- }
- //테스트
- parkdb = new WallpadParkInfo(getApplicationContext());
- CarParkingData carParkingData[] = parkdb.getCarParkingData();
- parkdb.closeDB();
- if (carParkingData != null) {
- for (int j = 0; j < carParkingData.length; j++) {
- DebugLogOutput(carParkingData[j].ToDebugString());
- }
- }
- Intent intent = new Intent();
- intent.setAction(define.NOTIFY_ACNAME);
- intent.putExtra(define.NOTIBR_KIND, define.NOTIFY_UPDATEPARKING);
- getApplicationContext().sendBroadcast(intent);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- cGetParkingMin = 0;
- bSetMSG_GetParkingInfo = false;
- }
- catch (Exception e) {
- cGetParkingMin = 0;
- bSetMSG_GetParkingInfo = false;
- Log.e(TAG, "[Exception] iMAPcarParking.ProcSuccess()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- cGetParkingMin = 0;
- bSetMSG_GetParkingInfo = false;
- }
- @Override
- public void ProcError() {
- cGetParkingMin = 0;
- bSetMSG_GetParkingInfo = false;
- DebugLogOutput("Load EMData From Server - ProcError");
- }
- @Override
- public void ProcDoing() {
- }
- });
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] LoadParkingDataFromServer()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
-
- // 한시간에 한번식 호출되는 함수임
- private void DoScheduleHourUnit(Calendar cal) {
- nHour = cal.get(Calendar.HOUR_OF_DAY);
- // 매시 7시부터 매시간 정각에 계속해서 알려준다. 사용자가 확인하기 전까지...
- // 사용자가 확인하게 되면 알림을 중지한다.
- // 목표값 팝업 알림에 필요한 DB 정보
- // 각각의 항목에 대한 초기화, 근접알림 발생, 근접알림 확인, 초과 알림 발생 , 초과알림 확인 5단계 구분 필요
- // 달이 넘어가게 되면 초괴하 한다.
- try {
- if (nHour == GetEnergyAlarmTime()) {
- if (GetEnergyAlarm() == true) {
- if (bUseofNot_EnergyServer == true) {
- if (ResultGetIntent == true) {
- ResultGetIntent = false;
- Intent intent = new Intent();
- intent.setAction(define.NOTIFY_ACNAME);
- intent.putExtra(define.NOTIBR_KIND, define.NOTIFY_ENERGY_TARGET_INFO_ALARM_FROM_MAIN_ACTIVIVY);
-
- intent.putExtra("elect_target", elect_target);
- intent.putExtra("elect_used", elect_used);
- intent.putExtra("elect_info", elect_info);
- intent.putExtra("water_target", water_target);
- intent.putExtra("water_used", water_used);
- intent.putExtra("water_info", water_info);
- intent.putExtra("gas_target", gas_target);
- intent.putExtra("gas_used", gas_used);
- intent.putExtra("gas_info", gas_info);
- intent.putExtra("heating_target", heating_target);
- intent.putExtra("heating_used", heating_used);
- intent.putExtra("heating_info", heating_info);
- intent.putExtra("hotwater_target", hotwater_target);
- intent.putExtra("hotwater_used", hotwater_used);
- intent.putExtra("hotwater_info", hotwater_info);
-
- sendBroadcast(intent);
- }
- }
- else {
- CheckEnergyUsage();
- }
- }
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- LogUtil.errorLogInfo("", TAG, e);
- }
-
- if (SCManager != null ) SCManager.CheckSysResetData();
- }
- static boolean NeedCheckEnergy = false;
-
- //에너지 사용량 확인
- public void CheckEnergyUsage() {
- Log.d(TAG, "***********************************************");
- Log.d(TAG, "[CheckEnergyUsage] CheckEnergyUsage Function in");
- Log.d(TAG, "***********************************************");
- try {
- WallpadStatusData SetData = new WallpadStatusData(getApplicationContext());
- int alarmstate = SetData.GetAlarmStatus();
- SetData.closeDB();
-
- if (alarmstate == WallpadStatusData.ALARM_ARISE || alarmstate == WallpadStatusData.GUARD_OUT)
- return;
-
- String strNear = "";
- String strOver = "";
-
- if (EnergyAlramPopupMgr.m_Elec_UseValue > 0 && EnergyAlramPopupMgr.m_Elec_GoalValue > 0 && EnergyAlramPopupMgr.CheckAlramPopupCreate( getContext(), EnergyAlramPopupMgr.DB_ELEC_ALAM_POPUP_STEP)) {
- if (EnergyAlramPopupMgr.m_Elec_UseValue >= EnergyAlramPopupMgr.m_Elec_GoalValue) {
- strOver += "전기 ";
- EnergyAlramPopupMgr.setAlramOverStep(getContext(), EnergyAlramPopupMgr.DB_ELEC_ALAM_POPUP_STEP);
- }
- else {
- double nNearValue = EnergyAlramPopupMgr.m_Elec_GoalValue * 0.9;
- if (EnergyAlramPopupMgr.m_Elec_UseValue > nNearValue) {
- strNear += "전기 ";
- EnergyAlramPopupMgr.setAlramNearStep(getContext(), EnergyAlramPopupMgr.DB_ELEC_ALAM_POPUP_STEP);
- }
- }
- }
-
- if (EnergyAlramPopupMgr.m_Water_UseValue > 0 && EnergyAlramPopupMgr.m_Water_GoalValue > 0 && EnergyAlramPopupMgr.CheckAlramPopupCreate( getContext(), EnergyAlramPopupMgr.DB_WATER_ALAM_POPUP_STEP)) {
- if (EnergyAlramPopupMgr.m_Water_UseValue >= EnergyAlramPopupMgr.m_Water_GoalValue) {
- strOver += "수도 ";
- EnergyAlramPopupMgr.setAlramOverStep(getContext(), EnergyAlramPopupMgr.DB_WATER_ALAM_POPUP_STEP);
- }
- else {
- double nNearValue = EnergyAlramPopupMgr.m_Water_GoalValue * 0.9;
- if (EnergyAlramPopupMgr.m_Water_UseValue > nNearValue) {
- strNear += "수도 ";
- EnergyAlramPopupMgr.setAlramNearStep(getContext(), EnergyAlramPopupMgr.DB_WATER_ALAM_POPUP_STEP);
- }
- }
- }
-
- if (EnergyAlramPopupMgr.m_Gas_UseValue > 0 && EnergyAlramPopupMgr.m_Gas_GoalValue > 0 && EnergyAlramPopupMgr.CheckAlramPopupCreate( getContext(), EnergyAlramPopupMgr.DB_GAS_ALAM_POPUP_STEP)) {
- if (EnergyAlramPopupMgr.m_Gas_UseValue >= EnergyAlramPopupMgr.m_Gas_GoalValue) {
- strOver += "가스 ";
- EnergyAlramPopupMgr.setAlramOverStep(getContext(), EnergyAlramPopupMgr.DB_GAS_ALAM_POPUP_STEP);
- }
- else {
- double nNearValue = EnergyAlramPopupMgr.m_Gas_GoalValue * 0.9;
- if (EnergyAlramPopupMgr.m_Gas_UseValue > nNearValue) {
- strNear += "가스 ";
- EnergyAlramPopupMgr.setAlramNearStep(getContext(), EnergyAlramPopupMgr.DB_GAS_ALAM_POPUP_STEP);
- }
- }
- }
-
- if (EnergyAlramPopupMgr.m_HotWater_UseValue > 0 && EnergyAlramPopupMgr.m_HotWater_GoalValue > 0 && EnergyAlramPopupMgr.CheckAlramPopupCreate( getContext(), EnergyAlramPopupMgr.DB_HOTWATER_ALAM_POPUP_STEP)) {
- if (EnergyAlramPopupMgr.m_HotWater_UseValue >= EnergyAlramPopupMgr.m_HotWater_GoalValue) {
- strOver += "온수 ";
- EnergyAlramPopupMgr.setAlramOverStep(getContext(), EnergyAlramPopupMgr.DB_HOTWATER_ALAM_POPUP_STEP);
- }
- else {
- double nNearValue = EnergyAlramPopupMgr.m_HotWater_GoalValue * 0.9;
- if (EnergyAlramPopupMgr.m_HotWater_UseValue > nNearValue) {
- strNear += "온수 ";
- EnergyAlramPopupMgr.setAlramNearStep(getContext(), EnergyAlramPopupMgr.DB_HOTWATER_ALAM_POPUP_STEP);
- }
- }
- }
-
- if (EnergyAlramPopupMgr.m_Heating_UseValue > 0 && EnergyAlramPopupMgr.m_Heating_GoalValue > 0 && EnergyAlramPopupMgr.CheckAlramPopupCreate( getContext(), EnergyAlramPopupMgr.DB_HEATING_ALAM_POPUP_STEP)) {
- if (EnergyAlramPopupMgr.m_Heating_UseValue >= EnergyAlramPopupMgr.m_Heating_GoalValue) {
- strOver += "난방 ";
- EnergyAlramPopupMgr.setAlramOverStep(getContext(), EnergyAlramPopupMgr.DB_HEATING_ALAM_POPUP_STEP);
- }
- else {
- double nNearValue = EnergyAlramPopupMgr.m_Heating_GoalValue * 0.9;
- if (EnergyAlramPopupMgr.m_Heating_UseValue > nNearValue) {
- strNear += "난방 ";
- EnergyAlramPopupMgr.setAlramNearStep(getContext(), EnergyAlramPopupMgr.DB_HEATING_ALAM_POPUP_STEP);
- }
- }
- }
- if (strNear.length() > 8) EnergyAlramPopupMgr.PopupMsg01 = strNear + "사용량이\n목표값에 가까워지고 있습니다.\n확인 하시겠습니까?";
- else if (0 < strNear.length() && strNear.length() <= 8) EnergyAlramPopupMgr.PopupMsg01 = strNear + "사용량이 목표값에 가까워지고 있습니다.\n확인 하시겠습니까?";
- else EnergyAlramPopupMgr.PopupMsg01 = "";
- if (strOver.length() > 10) {
- EnergyAlramPopupMgr.PopupMsg02 = strOver + "사용량이\n목표값을 초과하였습니다.\n확인 하시겠습니까?";
- }
- else if (0 < strOver.length() && strOver.length() <= 10) {
- EnergyAlramPopupMgr.PopupMsg02 = strOver + "사용량이 목표값을 초과하였습니다.\n확인 하시겠습니까?";
- }
- else if(strOver.length() < 0){
- EnergyAlramPopupMgr.PopupMsg02 = "";
- }
- if (EnergyAlramPopupMgr.PopupMsg01.length() > 0 || EnergyAlramPopupMgr.PopupMsg02.length() > 0) {
- mIOInterface.ctrlLcdWakeUp();
- StartPopup(ID.POPUPS.POPUP_ENERGYUSAGEALERT);
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] CheckEnergyUsage()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
-
-
- //시간 동기화를 위한 getinfo 실행 시간을 구함
- protected Calendar GetTimeSyncTime()
- {
- Calendar retTime = new GregorianCalendar();
-
- WallpadStatusData SetData = new WallpadStatusData(getApplicationContext());
- AddressSet addc = SetData.getAddressMGR();
- SetData.closeDB();
- try {
- int dong = Integer.parseInt(addc.Dong);
- int ho = 101;
-
- if(addc.UseOrNotRentHouse == true)
- {
- ho = addc.Ho_Integer;
- }
- else
- {
- ho = Integer.parseInt(addc.Ho);
- }
-
- int interval = (dong-(dong/100)*100) * 100 + ho/100;
- int hour;
- int min;
- int sec;
- if (interval/3600 > 0)
- {
- hour = 3+interval/3600;
- interval=interval%3600;
- }
- else hour = 6;
-
- if (interval/60 > 0)
- {
- min = interval/60;
- sec = interval%60;
- }
- else
- {
- min = 0;
- sec = interval;
- }
- retTime.set(Calendar.HOUR_OF_DAY, hour);
- retTime.set(Calendar.MINUTE, min);
- retTime.set(Calendar.SECOND, sec);
- }
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return null;
- }
- catch (Exception e)
- {
- LogUtil.errorLogInfo("", TAG, e);
- return null;
- }
-
- return retTime;
- }
-
- //에너지 사용량 확인을 위한 데이터 로딩 시간을 가져옴
- protected Calendar GetEnergyDataLoadingTime()
- {
- Calendar retTime = new GregorianCalendar();
-
- WallpadStatusData SetData = new WallpadStatusData(getApplicationContext());
- AddressSet addc = SetData.getAddressMGR();
- SetData.closeDB();
- try {
- int dong = Integer.parseInt(addc.Dong);
- int ho = 201;
-
- if(addc.UseOrNotRentHouse == true)
- {
- ho = addc.Ho_Integer;
- }
- else
- {
- ho = Integer.parseInt(addc.Ho);
- }
-
- int interval = (dong-(dong/100)*100) * 100 + ho/100;
- int hour;
- int min;
- int sec;
- if (interval/3600 > 0)
- {
- hour = 6+interval/3600;
- interval=interval%3600;
- }
- else hour = 6;
-
- if (interval/60 > 0)
- {
- min = interval/60;
- sec = interval%60;
- }
- else
- {
- min = 0;
- sec = interval;
- }
- retTime.set(Calendar.HOUR_OF_DAY, hour);
- retTime.set(Calendar.MINUTE, min);
- retTime.set(Calendar.SECOND, sec);
- }
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return null;
- }
- catch (Exception e)
- {
- LogUtil.errorLogInfo("", TAG, e);
- return null;
- }
-
- return retTime;
- }
-
-
- private void setNetworkAddr(int secNum, int thirdNum, int forthNum) {
- try
- {
- String IPAddress = String.format("10.%d.%d.%d", secNum, thirdNum, forthNum);
- String gateWayIPAddress = String.format("10.%d.%d.%d", secNum, Common.DEFAULT_GATEWAY_IP_THIRD, Common.DEFAULT_GATEWAY_IP_FORTH);
- String MacAddr = String.format("00:0A:%02x:%02x:%02x:00", secNum, thirdNum, forthNum);
-
- String serverIP = Common.DEFAULT_SERVER_IP;
- int serverPort = Common.DEFAULT_SERVER_PORT;
-
- String managePCIP = Common.DEFAULT_MANAGER_PC_IP;
- int managePCPort = Common.DEFAULT_MANAGER_PC_PORT;
-
- wallpaddbmgr dbmgr = new wallpaddbmgr(this);
- AddressSet addc = dbmgr.getAddressMGR();
- String mDong = String.format("%d%02d", 1, secNum);
- String mHo = String.format("%d%02d", thirdNum, forthNum);
- addc.setAddress(mDong, mHo);
- addc.setIPAddress(IPAddress);
- dbmgr.closeDB();
-
- WallpadStatusData wallpadStatusData = new WallpadStatusData(this);
- wallpadStatusData.SetServerIP(serverIP, serverPort);
- wallpadStatusData.SetManagePC(managePCIP, managePCPort);
- wallpadStatusData.closeDB();
-
- EthernetDevInfo info = new EthernetDevInfo();
-
- info.setIfName("eth0");
- info.setConnectMode(EthernetDevInfo.ETH_CONN_MODE_MANUAL);
- info.setIpAddress(IPAddress);
- info.setRouteAddr(gateWayIPAddress);
- info.setDnsAddr(Common.DNS_IP);
- info.setNetMask(Common.SUBNET_MASK);
-
- EthernetManager mEthManager = (EthernetManager) getSystemService("ethernet");
- mEthManager.setEthernetState(EthernetManager.ETH_STATE_DISABLED);
- mEthManager.UpdateEthDevInfo(info);
- mEthManager.setEthernetState(EthernetManager.ETH_STATE_ENABLING);
- WallPadInterface wallPadInterface = new WallPadInterface();;
- wallPadInterface.setMacAddr(MacAddr);
- Log.d("MANAGERSETTING", " IP : "+IPAddress+" Mac : "+ MacAddr);
-
- writeMacAddress(MacAddr);
- }
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e)
- {
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
-
- private final String NETWORK_SETTING = "network_setting";
- private final String MAC_ADDRESS_FILE_PATH = Common.CONTENTS_ROOT + NETWORK_SETTING + ".inc";
-
- private boolean writeMacAddress(String MacAddr) {
- boolean ret = false;
- String read = null;
- BufferedWriter bufferWriter = null;
- try {
- FileOutputStream fos = new FileOutputStream(MAC_ADDRESS_FILE_PATH, false);
- OutputStreamWriter osr = new OutputStreamWriter(fos, "UTF-8");
- bufferWriter = new BufferedWriter(osr, 1024);
- if ((bufferWriter != null) && (MacAddr != null)) {
- bufferWriter.write(MacAddr, 0, MacAddr.length());
- bufferWriter.newLine();
- bufferWriter.flush();
- ret = true;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- LogUtil.errorLogInfo("", TAG, e);
- } finally {
- try {
- if (bufferWriter != null) {
- bufferWriter.close();
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- Log.d(TAG, "writeMacAddress() path : " + MAC_ADDRESS_FILE_PATH
- + ", MacAddr : " + MacAddr
- + ", ret : " + ret
- );
- return ret;
- }
- private void GetElectricCarInfo() {
- try {
- Log.d(TAG, "[GetElectricCarInfo] ===== START =====");
- int retInt = -1;
- WallpadDeviceSet mWallpadDeviceSet = null;
- mWallpadDeviceSet = new WallpadDeviceSet(getApplicationContext());
- retInt = mWallpadDeviceSet.GetDeviceSetted("전기차충전");
- mWallpadDeviceSet.closeDB();
- Log.d(TAG, "[GetElectricCarInfo] retInt = " + retInt);
- if (retInt == WallpadDeviceSet.DEV_DATA_ENABLE) {
- Log.i(TAG, "[GetElectricCarInfo] Electronic car changing enabled!!");
- GetElectricCarInfo_RandomCheckHandler();
- }
- else Log.i(TAG, "[GetElectricCarInfo] Electronic car changing disabled!!");
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] GetElectricCarInfo()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private void GetElectricCarInfo_RandomCheckHandler() {
- try {
- Log.d(TAG, "[GetElectricCarInfo_RandomCheckHandler] ===== START =====");
- int nDelayTime = StringUtil.GetDelayTimeBaseIP(getContext());
- Log.d(TAG, "[GetElectricCarInfo_RandomCheckHandler] nDelayTime : "+ nDelayTime);
- if (nDelayTime < 1) {
- Log.w(TAG, "[GetElectricCarInfo_RandomCheckHandler] DelayTime error!! -> nDelayTime = " + nDelayTime);
- return;
- }
- mGetElecricCarRandomCheckHandler.sendEmptyMessageDelayed(0, 1000 * nDelayTime);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] GetElectricCarInfo_RandomCheckHandler()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private Handler mGetElecricCarRandomCheckHandler = new Handler()
- {
- @Override
- public void handleMessage(Message msg)
- {
- if (msg.what == 0) {
- Log.i(TAG, "[GetElectricCarInfo] mGetElecricCarRandomCheckHandler() will be called!!");
- //얻어오기
- imapElecCarChargingInfo = new iMAPElecCarChargingInfo(getApplicationContext());
- LoadElectricCarDataFromServer();
- }
- }
- };
- void LoadElectricCarDataFromServer() {
- DebugLogOutput("LoadElectricCarDataFromServer");
- imapElecCarChargingInfo.DoWork();
- imapElecCarChargingInfo.SetRetCtr(new RetProci() {
- @Override
- public void ProcSuccess() {
- Log.i(TAG, "[LoadElectricCarDataFromServer] ProcSuccess");
- try {
- int SetItemResult = imapElecCarChargingInfo.SetItem("charging_cnt");
- if(SetItemResult != 1) {
- Log.w(TAG, "[LoadElectricCarDataFromServer.ProcSuccess()] Error1 - SetItemResult : "+ SetItemResult);
- nElecVehicleChangingCnt = 0;
- return;
- }
- String sChargingCount = imapElecCarChargingInfo.GetItemVal(0);
- int intChargingCount = Integer.parseInt(sChargingCount);
- if (intChargingCount < 1) {
- Log.w(TAG, "[LoadElectricCarDataFromServer.ProcSuccess()] Error1 - intChargingCount : "+ intChargingCount);
- nElecVehicleChangingCnt = 0;
- return;
- }
- SetItemResult = imapElecCarChargingInfo.SetItem("charger_info");
-
- if (SetItemResult != intChargingCount) {
- Log.w(TAG, "[LoadElectricCarDataFromServer.ProcSuccess()] Error1 - SetItemResult : "+ SetItemResult);
- nElecVehicleChangingCnt = 0;
- return;
- }
- if (intChargingCount > 0) {
- nElecVehicleChangingCnt = intChargingCount;
- Intent intent = new Intent();
- intent.setAction(define.NOTIFY_ACNAME);
- intent.putExtra(define.NOTIBR_KIND, define.NOTIFY_GET_ELEC_CHARGE);
-
- intent.putExtra("sCard_Num", imapElecCarChargingInfo.GetAttributeVal(0, "card_num"));
- intent.putExtra("sCar_Num", imapElecCarChargingInfo.GetAttributeVal(0, "car_num"));
- intent.putExtra("sCharger_Num", imapElecCarChargingInfo.GetAttributeVal(0, "charger_num"));
- intent.putExtra("sCharger_Loc", imapElecCarChargingInfo.GetAttributeVal(0, "charger_loc"));
- intent.putExtra("sCharging_Status", "charging");
- intent.putExtra("sCharger_sort", imapElecCarChargingInfo.GetAttributeVal(0, "charger_sort"));
- intent.putExtra("sCharging_Ratio", imapElecCarChargingInfo.GetAttributeVal(0, "charging_ratio"));
- intent.putExtra("sStart_Time", imapElecCarChargingInfo.GetAttributeVal(0, "start_time"));
- intent.putExtra("sRemain_Time", imapElecCarChargingInfo.GetAttributeVal(0, "remain_time"));
- intent.putExtra("sMessage", imapElecCarChargingInfo.GetAttributeVal(0, "c_msg"));
-
- getApplicationContext().sendBroadcast(intent);
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] LoadElectricCarDataFromServer() -> ProcSuccess");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- @Override
- public void ProcError()
- {
- Log.i(TAG, "[LoadElectricCarDataFromServer] ProcError");
- }
- @Override
- public void ProcDoing()
- {
- Log.i(TAG, "[LoadElectricCarDataFromServer] ProcDoing");
- }
-
- });
- }
- /**
- * 대외향 Call 버튼 점멸 및 On Off 처리
- */
- @SuppressLint("HandlerLeak")
- protected Handler mLedFlickerHandler = new Handler()
- {
- boolean Flicker = false;
-
- @SuppressLint("HandlerLeak")
- @Override
- public void handleMessage(Message msg)
- {
- if(msg.what == 0) // 콜 수신시 또는 발신시 ...
- {
- // 점멸 시작 CallButton LED On
- Flicker = true;
- mLedFlickerHandler.sendEmptyMessageDelayed(1, 500);
- WallPadInterface wpdifc = new WallPadInterface();
- wpdifc.callLEDControll(true);
- }
- else if(msg.what == 1)
- {
-
- mLedFlickerHandler.sendEmptyMessageDelayed(0, 500);
- WallPadInterface wpdifc = new WallPadInterface();
- wpdifc.callLEDControll(false);
-
- }
- else if(msg.what == 2) // 통화중
- {
- Flicker = false;
- }
- else if(msg.what == 4) // 통화종료
- {
- Flicker = false;
- }
- }
- };
- public void GetEnergyServerInfo()
- {
- WallpadDeviceSet devSet = new WallpadDeviceSet(getContext());
- String[] MetringDB = devSet.GetSettingData("에너지관리서버");
- devSet.closeDB();
- if (MetringDB != null)
- {
- try
- {
- String devInfo = MetringDB[1];
- devInfo = devInfo.replace('(', '_');
- devInfo = devInfo.replace(':', '_');
- devInfo = devInfo.replace(')', '_');
- String[] MetringInfo = devInfo.split("_");
- // MetringInfo[1] -> 회로수
- // MetringInfo[3] -> 에너지관리서버 사용여부 사용함 or 사용안함
- // MetringInfo[4] -> IP
- // MetringInfo[5] -> IP정보
- // MetringInfo[6] -> 검침일사용자설정
- // MetringInfo[7] -> 사용함 또는 사용안함
-
- if(MetringInfo[3].equals("사용함") == true)
- {
- bUseofNot_EnergyServer = true;
- }
- }
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e)
- {
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- else
- {
-
- }
- Log.d(TAG, "[bUseofNot_EnergyServer] bUseofNot_EnergyServer :"+bUseofNot_EnergyServer);
- }
- /**
- * 카카오 사용 여부 체크
- * @return
- */
- public boolean getKakaoHomeCheck()
- {
- boolean result = false;
- WallpadDeviceSet mWallpadDeviceSet = null;
- mWallpadDeviceSet = new WallpadDeviceSet(getContext());
- try {
- result = mWallpadDeviceSet.Get_KakaoUse();
- }
- catch (SQLException e)
- {
- LogUtil.errorLogInfo("", TAG, e);
- }
- mWallpadDeviceSet.closeDB();
- return result;
- }
- /**
- * 사용자 설정(카카오를 볼것인지 아닌지를 설정)
- * @return
- */
- public boolean getShowKakaoCheck()
- {
- boolean result = false;
- WallpadDeviceSet mWallpadDeviceSet = null;
- mWallpadDeviceSet = new WallpadDeviceSet(getContext());
- try {
- result = mWallpadDeviceSet.Get_KakaoShow();
- }
- catch (SQLException e)
- {
- LogUtil.errorLogInfo("", TAG, e);
- }
- return result;
- }
-
- public boolean GetEnergyAlarm()
- {
- boolean ret = false;
-
- WallpadStatusData DBMGR = null;
- DBMGR = new WallpadStatusData(getContext());
-
- if( DBMGR != null )
- {
- try
- {
- ret = DBMGR.GetRemoteMetering_Alarm();
- }
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- ret = false;
- DBMGR.insertWallPADDB(WallpadStatusData.REMOTE_METERING_ALARM_USE, WallpadStatusData.REMOTE_METERING_ALARM_USE_DEFAULT);
- }
- catch (Exception e)
- {
- LogUtil.errorLogInfo("", TAG, e);
- ret = false;
- DBMGR.insertWallPADDB(WallpadStatusData.REMOTE_METERING_ALARM_USE, WallpadStatusData.REMOTE_METERING_ALARM_USE_DEFAULT);
- }
-
- DBMGR.closeDB();
- }
-
- bUseofNot_EnergyAlarm = ret;
- Log.d(TAG, "[bUseofNot_EnergyAlarm] bUseofNot_EnergyAlarm :"+bUseofNot_EnergyAlarm);
- return ret;
- }
-
- /**
- * @description
- * 에너지 사용량 알림 시간 얻어오기
- * @return int Hour시간 값
- */
- public int GetEnergyAlarmTime()
- {
- int ret = 12;
-
- WallpadStatusData DBMGR = null;
- DBMGR = new WallpadStatusData(getContext());
-
- try
- {
- ret = DBMGR.GetRemoteMetering_AlarmTime();
- }
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e)
- {
- LogUtil.errorLogInfo("", TAG, e);
- }
-
- DBMGR.closeDB();
-
- Log.d(TAG, "[GetEnergyAlarmTime] GetEnergyAlarmTime :"+ret);
- return ret;
- }
-
- public void ClearEnergyUsage()
- {
- ResultGetIntent = false;
-
- elect_target = "Error";
- elect_used = "Error";
- elect_info = "Error";
- water_target = "Error";
- water_used = "Error";
- water_info = "Error";
- gas_target = "Error";
- gas_used = "Error";
- gas_info = "Error";
- hotwater_target = "Error";
- hotwater_used = "Error";
- hotwater_info = "Error";
- heating_target = "Error";
- heating_used = "Error";
- heating_info = "Error";
- }
-
- // 신규 통화어플 실행을 위한 코드 (JEFF, 2016.05.23)
- // 통화주체를 다루는 enum
- public enum CALLOWNER {
- NONE,
- WALLPAD,
- MOBILE,
- SUB_WALLPAD,
- KITCHEN_TV,
- BATH_PHONE,
- BATH_TV,
- UNIVERSAL_DEVICE,
- ERROR;
- }
- public enum CALLEVENTTYPE {
- RECEIVE_CALL, // 호출 수신 (호출 수신)
- TRYING_CALL, // 호출 시도중 (호출 발신)
- RECEIVE_CALL_2ND, // 멀티콜 수신 (호출 수신)
- RECEIVE_CALL_ACK, // 호출응답 수신 (호출 발신)
- REQUEST_FRONT_MONITORING, // 호출응답 수신 (호출 발신)
- CONNECT_CALL, // 통화 시작
- TERMINATE_CALL, // 통화 종료
- CANCEL_CALL, // 호출 취소
- CANCEL_CALL_2ND, // 멀티콜 호출 취소
- REJECT_CALL, // 호출수신 거절
- REJECT_BUSY_CALL, // 통화중 호출수신 거절
- FORWARD_CALL, // 착신전환 설정
- CALLERID, // Caller ID_OLD
- TIMEOUT_1STCALL, // 1st Call Timeout
- TIMEOUT_2NDCALL, // 2nd Call Timeout
- TIMEOUT_3RDCALL, // 3rd Call Timeout
- MOIP_VIDEO_SET, // MoIP 영상통화 설정
- DOOR_OPEN, // 문열림 설정
- DETECT_STRANGER, // 거동수상자 발생
- NONE;
- }
- public enum CALLTYPE {
- NONE,
- FRONT,
- RESIDENCE,
- LOBBY,
- GUARD,
- PSTN,
- IHUB,
- HISTORY_CALL,
- HISTORY_VISITORPIC,
- FRONT_RECORD, // 현관_영상녹화
- FRONT_TAKEPIC, // 현관_사진촬영
- ERROR,
- }
- public static class CALLTRIGGER {
- public static String CALLOWNER = "CALLOWNER";
- public static String CALLEVENTTYPE = "CALLEVENTTYPE";
- public static String CALLTYPE = "CALLTYPE";
- public enum SOURCE {
- USER,
- CALL_RECEIVE,
- SUBPHONE
- }
- public enum TYPE {
- MENU,
- FRONT,
- LOBBY,
- GUARD,
- RESIDENCE,
- PSTN
- }
- }
- String strWallPadCallPakageName = "kr.co.icontrols.wallpadcall";
-
- public void runWallPadCallAPKByUX(int nScreen) {
- try {
- Log.i(TAG, "[runWallPadCallAPKByUX] nScreen [" + nScreen + "]");
-
- CALLOWNER eCallOwner = CALLOWNER.NONE;
- CALLEVENTTYPE eEventType = CALLEVENTTYPE.NONE;
- CALLTYPE eCallType = CALLTYPE.GUARD;
-
- if (nScreen == ID.LINKEDSCREEN.SubCall.Door) {
- if (getIsSubWallpad()) eCallOwner = CALLOWNER.SUB_WALLPAD;
- else eCallOwner = CALLOWNER.WALLPAD;
- eEventType = CALLEVENTTYPE.REQUEST_FRONT_MONITORING;
- eCallType = CALLTYPE.FRONT;
- }
- else if (nScreen == ID.LINKEDSCREEN.SubCall.Door_Record) {
- eCallType = CALLTYPE.FRONT;
- eEventType = CALLEVENTTYPE.DETECT_STRANGER;
- }
- else if (nScreen == ID.LINKEDSCREEN.SubCall.Lobby) eCallType = CALLTYPE.LOBBY;
- else if (nScreen == ID.LINKEDSCREEN.SubCall.Guard) eCallType = CALLTYPE.GUARD;
- else if (nScreen == ID.LINKEDSCREEN.SubCall.Neighboor) eCallType = CALLTYPE.RESIDENCE;
- else if (nScreen == ID.LINKEDSCREEN.SubCall.Pstn) eCallType = CALLTYPE.PSTN;
- else if (nScreen == ID.LINKEDSCREEN.SubCall.CallList) eCallType = CALLTYPE.HISTORY_CALL;
- else if (nScreen == ID.LINKEDSCREEN.SubCall.Visitor) eCallType = CALLTYPE.HISTORY_VISITORPIC;
- else {
- Log.w(TAG, "[runWallPadCallAPKByUX] NOT Supported nScreen!! [" + nScreen + "]");
- }
- Log.i(TAG, "[runWallPadCallAPKByUX] eCallOwner [" + eCallOwner + "], eEventType [" + eEventType + "], eCallType [" + eCallType + "]");
- if (getIsSubWallpad()) {
- // 서브월패드는 국선 기능을 제공하지 않는다.
- if (eCallType != CALLTYPE.PSTN) runCallMainActivity(eCallOwner, eEventType, eCallType);
- }
- else {
- runCallMainActivity(eCallOwner, eEventType, eCallType);
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] runWallPadCallAPKByUX(int nScreen)");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public void runWallPadCallAPKByUX(int nScreen, int nEmerState) {
- try {
- Log.i(TAG, "[runWallPadCallAPKByUX] nScreen [" + nScreen + "], nEmerState [" + nEmerState + "]");
- CALLOWNER eCallOwner = CALLOWNER.NONE;
- CALLEVENTTYPE eEventType = CALLEVENTTYPE.NONE;
- CALLTYPE eCallType = CALLTYPE.GUARD;
- if (nScreen == ID.LINKEDSCREEN.SubCall.Door) {
- if (getIsSubWallpad()) eCallOwner = CALLOWNER.SUB_WALLPAD;
- else eCallOwner = CALLOWNER.WALLPAD;
- eEventType = CALLEVENTTYPE.REQUEST_FRONT_MONITORING;
- eCallType = CALLTYPE.FRONT;
- }
- else if (nScreen == ID.LINKEDSCREEN.SubCall.Door_Record) {
- eCallType = CALLTYPE.FRONT;
- eEventType = CALLEVENTTYPE.DETECT_STRANGER;
- }
- else if (nScreen == ID.LINKEDSCREEN.SubCall.Lobby) eCallType = CALLTYPE.LOBBY;
- else if (nScreen == ID.LINKEDSCREEN.SubCall.Guard) eCallType = CALLTYPE.GUARD;
- else if (nScreen == ID.LINKEDSCREEN.SubCall.Neighboor) eCallType = CALLTYPE.RESIDENCE;
- else if (nScreen == ID.LINKEDSCREEN.SubCall.Pstn) eCallType = CALLTYPE.PSTN;
- else if (nScreen == ID.LINKEDSCREEN.SubCall.CallList) eCallType = CALLTYPE.HISTORY_CALL;
- else if (nScreen == ID.LINKEDSCREEN.SubCall.Visitor) eCallType = CALLTYPE.HISTORY_VISITORPIC;
- else {
- Log.w(TAG, "[runWallPadCallAPKByUX] NOT Supported nScreen!! [" + nScreen + "]");
- }
- Log.i(TAG, "[runWallPadCallAPKByUX] eCallOwner [" + eCallOwner + "], eEventType [" + eEventType + "], eCallType [" + eCallType + "]");
- if (getIsSubWallpad()) {
- // 서브월패드는 국선 기능을 제공하지 않는다.
- if (eCallType != CALLTYPE.PSTN) runCallMainActivity(eCallOwner, eEventType, eCallType, nEmerState);
- }
- else {
- runCallMainActivity(eCallOwner, eEventType, eCallType, nEmerState);
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] runWallPadCallAPKByUX(int nScreen, int nEmerState)");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
-
- public void runCallMainActivity(CALLOWNER eCallOwner, CALLEVENTTYPE eEventType, CALLTYPE eCallType) {
- try {
- Log.i(TAG, "[runCallMainActivity] Common.bWallPadCallLive [" + Common.bWallPadCallLive + "], eCallOwner [" + eCallOwner + "], eEventType [" + eEventType + "], eCallType [" + eCallType + "]");
- if (!Common.bWallPadCallLive) {
- // 통화어플을 실행시킨다.
- sendLCDBacklightStatus(true);
- if (bRecordStatus) {
- if (eEventType == CALLEVENTTYPE.REQUEST_FRONT_MONITORING) {
- Log.d(TAG, "[runCallMainActivity] Now Stranger Recording!!! bRecordStatus [" + bRecordStatus + "]");
- // 거동수상자 녹화 중 현관 모니터링 실행하는 경우
- stopStrangerRecord(true);
- runNoticeStrangerRecord(false);
- }
- }
- ComponentName mComponentName = new ComponentName("kr.co.icontrols.wallpadcall", "kr.co.icontrols.wallpadcall.MainActivity");
- Intent mIntent = new Intent(Intent.ACTION_MAIN);
- // mIntent.addCategory(Intent.CATEGORY_LAUNCHER);
- mIntent.putExtra(CALLTRIGGER.CALLOWNER, eCallOwner.toString());
- mIntent.putExtra(CALLTRIGGER.CALLEVENTTYPE, eEventType.toString());
- mIntent.putExtra(CALLTRIGGER.CALLTYPE, eCallType.toString());
- mIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- mIntent.setComponent(mComponentName);
- startActivity(mIntent);
- }
- else {
- Log.w(TAG, "[runCallMainActivity] WallPadCall is already running!!");
- }
-
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] runCallMainActivity()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /**
- * Edited by jeff (2020.06.22)
- * LCD 잔상 현장 복구/보호를 위해 실행되고 있는 LCD Keeper를 종료하기 위해, 통화 App이 실행되면서
- * backlight를 On하기 전에 이를 알리는 BR를 수신하여 LCD Keeper를 종료한다.
- * @param bOn
- */
- private void sendLCDBacklightStatus(boolean bOn) {
- try {
- Log.d(TAG,"[sendLCDBacklightStatus] bOn [" + bOn + "]");
- Intent mIntent = new Intent();
- if (bOn) mIntent.setAction(define.NOTIFY_ACNAME_LCD_BACKLIGHT_ON);
- else mIntent.setAction(define.NOTIFY_ACNAME_LCD_BACKLIGHT_OFF);
- getApplicationContext().sendBroadcast(mIntent);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] sendLCDBacklightStatus(boolean bOn)");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public void runCallMainActivity(CALLOWNER eCallOwner, CALLEVENTTYPE eEventType, CALLTYPE eCallType, int nEmerState) {
- try {
- Log.i(TAG, "[runCallMainActivity] Common.bWallPadCallLive [" + Common.bWallPadCallLive + "], eCallOwner [" + eCallOwner + "], eEventType [" + eEventType + "], eCallType [" + eCallType + "], nEmerState [" + nEmerState + "]");
- if (!Common.bWallPadCallLive) {
- // 통화어플을 실행시킨다.
- sendLCDBacklightStatus(true);
- if (eEventType == CALLEVENTTYPE.DETECT_STRANGER) {
- if (nEmerState >= 0) {
- if (nEmerState != WallpadStatusData.GUARD_OUT)
- Common.SendAppFinishReqBR(getApplicationContext());
- }
- }
- ComponentName mComponentName = new ComponentName("kr.co.icontrols.wallpadcall", "kr.co.icontrols.wallpadcall.MainActivity");
- Intent mIntent = new Intent(Intent.ACTION_MAIN);
- // mIntent.addCategory(Intent.CATEGORY_LAUNCHER);
- mIntent.putExtra(CALLTRIGGER.CALLOWNER, eCallOwner.toString());
- mIntent.putExtra(CALLTRIGGER.CALLEVENTTYPE, eEventType.toString());
- mIntent.putExtra(CALLTRIGGER.CALLTYPE, eCallType.toString());
- mIntent.putExtra("EMERGENCY_STATE", nEmerState);
- if (nEmerState != WallpadStatusData.GUARD_OUT) Common.SendAppFinishReqBR(getApplicationContext());
- mIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- mIntent.setComponent(mComponentName);
- startActivity(mIntent);
- }
- else {
- Log.w(TAG, "[runCallMainActivity] WallPadCall is already running!!");
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] runCallMainActivity(CALLOWNER eCallOwner, CALLEVENTTYPE eEventType, CALLTYPE eCallType, int nEmerState)");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private String getTopActivity() {
- try {
- ActivityManager mActivityManager = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
- List<ActivityManager.RunningTaskInfo> mTaskInfo = mActivityManager.getRunningTasks(1);
- // LOG_INFO("[isMainActivityTop] getClassName = " + mTaskInfo.get(0).topActivity.getClassName());
- ComponentName mComponentName = mTaskInfo.get(0).topActivity;
- // LOG_INFO("[isMainActivityTop] getPackageName = " + mComponentName.getPackageName());
- return mComponentName.getPackageName();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return null;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] getTopActivity()");
- LogUtil.errorLogInfo("", TAG, e);
- return null;
- }
- }
- /**
- * 월패드에 설치된 APP들의 패키지 명 및 버전을 저장하는 클래스
- * **/
- class PackageVersionInfo {
- protected String strPackageName;
- protected String strPackageVersion;
-
- public PackageVersionInfo(String strName, String strVersion) {
- strPackageName = strName;
- strPackageVersion = strVersion;
- }
-
- public String getPackageName() {
- return strPackageName;
- }
- public String getPackageVersion() {
- return strPackageVersion;
- }
- }
-
- /**
- * 통화 타임아웃 DB정보 초기화 (무조건 사용함으로 변경)
- * **/
- public void setCallAppTimeoutAsDefault() {
- WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(getContext());
- try {
- mWallpadDeviceSet.Set_CallAppCallTimeout(true);
- mWallpadDeviceSet.closeDB();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- if (mWallpadDeviceSet != null) mWallpadDeviceSet.closeDB();
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] setCallAppTimeoutAsDefault()");
- LogUtil.errorLogInfo("", TAG, e);
- if (mWallpadDeviceSet != null) mWallpadDeviceSet.closeDB();
- }
- }
-
- /**
- * 동호 설정 화면 나오게 처리
- * **/
- private void startManagerSettingSetAddress() {
- try {
- Intent mIntent = new Intent(Intent.ACTION_MAIN);
- MAINStatus = MAIN_WAIT_SETIP;
- mIntent.setComponent(new ComponentName("com.artncore.managersetting", "com.artncore.managersetting.ui.activities.SetAddress"));
- mIntent.putExtra("KIND", "SOLO");
- startActivity(mIntent);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] startManagerSettingSetAddress()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private Handler mGetCallHistoryCheckHandler = new Handler() {
- @Override
- public void handleMessage(Message msg) {
- if (msg.what == 0) {
- // CheckCallData_CalledCountAndVisitorCount();
- checkEventNotifications();
- }
- }
- };
-
- /**
- * 음력 데이터를 raw resource에서 wallpaddata폴더 밑으로 복사한다.
- * **/
- private void copyDataBase(String OutputDBPath) throws IOException {
- // Open your local db as the input stream
- //InputStream myInput = this.getAssets().open("luna_db.db");
- InputStream myInput = getResources().openRawResource(R.raw.luna_db);
- // Path to the just created empty db
- String outFileName = OutputDBPath;
- // Open the empty db as the output stream
- OutputStream myOutput = new FileOutputStream(outFileName);
- try {
- // transfer bytes from the inputfile to the outputfile
- byte[] buffer = new byte[1024];
- int length;
- while ((length = myInput.read(buffer)) > 0)
- {
- myOutput.write(buffer, 0, length);
- }
- // Close the streams
- myOutput.flush();
- }
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e)
- {
- LogUtil.errorLogInfo("", TAG, e);
- }
- finally {
- if(myOutput!=null)
- myOutput.close();
- myOutput = null;
- if(myInput!=null)
- myInput.close();
- myInput = null;
- }
- }
-
- @SuppressLint("HandlerLeak")
- protected Handler mLCD_SleepHandler = new Handler()
- {
- @SuppressLint("HandlerLeak")
- @Override
- public void handleMessage(Message msg)
- {
- if (msg.what == 0) {
- try {
- if (m_ModelHouseSleepModeRelease == true) {
- if (Version.getPlatformType() == Version.PLATFORM_TYPE.A40i) {
- getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
- }
- else {
- getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
- }
- Log.i(TAG, "[SAMPLE SLEEP MODE] Never Sleep Run ~~~");
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- LogUtil.errorLogInfo("", TAG, e);
- }
-
- }
- }
- };
- public void runIcon(int nIconID) {
- try {
- Log.d(TAG, "[runIcon] nIconID [" + nIconID + "]");
- if (nIconID == ID.ICONS.MENUS.MAIN_ELEVATOR.getID()) {
- // DB를 체크해서 층표시이면 팝업을 띄우고 아니면 바로 호출하도록 한다
- String strElevShortEnabled = Common.getSubDevListItem(this.getContext() ,Common.SETTING_ITEM_SUB_DEVICE_ELEVATOR);
- if(strElevShortEnabled!=null)
- {
- Log.d(TAG, "[runIcon] strElevShortEnabled [" + strElevShortEnabled + "]");
- if (strElevShortEnabled.contains("사용함") && strElevShortEnabled.contains("기본")) {
- Sound().Play(SND.effect.TOUCH_LATCHED);
- Intent intent = new Intent(Common.BR_MAIN_NOTI.ACNAME_MAIN_NOTI, null);
- intent.putExtra(Common.BR_MAIN_NOTI.KIND, Common.BR_MAIN_NOTI.CALL_ELEVATOR_DOWN);
- getContext().sendBroadcast(intent);
- }
- else {
- ((MainActivity)(getContext())).StartPopup(ID_OLD.SCREENS.ElevatorPopupScreen);
- }
- }
- }
- else if (nIconID == ID.ICONS.MENUS.MAIN_LIGHTS_OUT.getID()) {
- ((MainActivity)(getContext())).StartPopup(ID.POPUPS.POPUP_COLLECTIVELIGHTCTRL);
- }
- else if (nIconID == ID.ICONS.MENUS.MAIN_CALRENDAR.getID()) {
- m_CallSubMenuScreen.callStartConfigAPK(ID.LINKEDSCREEN.SubMenuConfig.TimeSetting);
- }
- else if (nIconID == ID.ICONS.MENUS.MAIN_WEATHER.getID()) {
- m_CallSubMenuScreen.callStartAddServiceAPK(ID.LINKEDSCREEN.SubMenuAddService.Weather);
- }
- else if (nIconID == ID.ICONS.MENUS.TALK_FRONT.getID()) {
- // Common.command_iGW200( this.getContext(), Common.IGW200_DOOR_MONITERING );
- m_CallSubMenuScreen.callStartCallAPK(ID.LINKEDSCREEN.SubCall.Door);
- }
- else if (nIconID == ID.ICONS.MENUS.TALK_LOBBY.getID()) {
- // 로비는 수신시에만 출력되는 화면이므로 해당코드 없음
- }
- else if (nIconID == ID.ICONS.MENUS.TALK_NEIGHBOR.getID()) {
- m_CallSubMenuScreen.callStartCallAPK(ID.LINKEDSCREEN.SubCall.Neighboor);
- }
- else if (nIconID == ID.ICONS.MENUS.TALK_GUARD.getID()) {
- m_CallSubMenuScreen.callStartCallAPK(ID.LINKEDSCREEN.SubCall.Guard);
- }
- else if (nIconID == ID.ICONS.MENUS.TALK_PHONE.getID()) {
- m_CallSubMenuScreen.callStartCallAPK(ID.LINKEDSCREEN.SubCall.Pstn);
- }
- else if (nIconID == ID.ICONS.MENUS.TALK_CALLHISTORY.getID()) {
- m_CallSubMenuScreen.callStartCallAPK(ID.LINKEDSCREEN.SubCall.CallList);
- }
- else if (nIconID == ID.ICONS.MENUS.TALK_VISITORPIC.getID()) {
- m_CallSubMenuScreen.callStartCallAPK(ID.LINKEDSCREEN.SubCall.Visitor);
- }
- else if (nIconID == ID.ICONS.MENUS.CTRL_LIGHT.getID()) {
- // 모델별 설정에 따라 구분하여 호출하는 기능 추가해야함
- WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(mContext);
- int[] naLightEnable = mWallpadDeviceSet.Get_Light_info(); // 조명설정 확인
- if (mWallpadDeviceSet != null) mWallpadDeviceSet.closeDB();
- // for (int i = 0; i < naLightEnable.length; i++) Log.i(TAG, "[runIcon] naLightEnable[" + i + "] = " + naLightEnable[i]);
- if (naLightEnable[1] == WallpadDeviceSet.LIGHT_TYPE_HDC_INTLIGHT_ADD_BATCHLIGHT_MULTISWITCH) {
- m_CallSubMenuScreen.callStartHomeCtrlAPK(ID.LINKEDSCREEN.SubMenuCtrl.HDCLivingNEach_Lamp);
- }
- else {
- m_CallSubMenuScreen.callStartHomeCtrlAPK(ID.LINKEDSCREEN.SubMenuCtrl.HDC_EachLamp);
- }
- }
- else if (nIconID == ID.ICONS.MENUS.CTRL_HEATING.getID()) {
- m_CallSubMenuScreen.callStartHomeCtrlAPK(ID.LINKEDSCREEN.SubMenuCtrl.Heating_V1);
- }
- else if (nIconID == ID.ICONS.MENUS.CTRL_GAS.getID()) {
- m_CallSubMenuScreen.callStartHomeCtrlAPK(ID.LINKEDSCREEN.SubMenuCtrl.Gas);
- }
- else if (nIconID == ID.ICONS.MENUS.CTRL_DOORLOCK.getID()) {
- m_CallSubMenuScreen.callStartHomeCtrlAPK(ID.LINKEDSCREEN.SubMenuCtrl.DoorLockWL);
- }
- else if (nIconID == ID.ICONS.MENUS.CTRL_VENT.getID()) {
- m_CallSubMenuScreen.callStartHomeCtrlAPK(ID.LINKEDSCREEN.SubMenuCtrl.ChangAir_Normal);
- }
- else if (nIconID == ID.ICONS.MENUS.CTRL_OUTLET.getID()) {
- WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(mContext);
- int[] naLightEnable = mWallpadDeviceSet.Get_Light_info(); // 조명설정 확인
- if (mWallpadDeviceSet != null) mWallpadDeviceSet.closeDB();
- if (naLightEnable[1] == WallpadDeviceSet.LIGHT_TYPE_HDC_INTLIGHT_ADD_BATCHLIGHT_MULTISWITCH) {
- m_CallSubMenuScreen.callStartHomeCtrlAPK(ID.LINKEDSCREEN.SubMenuCtrl.HDCLivingNEach_Concent);
- }
- else {
- m_CallSubMenuScreen.callStartHomeCtrlAPK(ID.LINKEDSCREEN.SubMenuCtrl.Concent);
- }
- }
- else if (nIconID == ID.ICONS.MENUS.CTRL_LIVINGLIGHT.getID()) {
- m_CallSubMenuScreen.callStartHomeCtrlAPK(ID.LINKEDSCREEN.SubMenuCtrl.HDC_LivingLamp);
- }
- else if (nIconID == ID.ICONS.MENUS.CTRL_AIRQUALTY.getID()) {
- m_CallSubMenuScreen.callStartHomeCtrlAPK(ID.LINKEDSCREEN.SubMenuCtrl.AirQualty);
- }
- else if (nIconID == ID.ICONS.MENUS.CTRL_ELECCOOKTOP.getID()) {
- m_CallSubMenuScreen.callStartHomeCtrlAPK(ID.LINKEDSCREEN.SubMenuCtrl.ElecCooktop);
- }
- else if (nIconID == ID.ICONS.MENUS.CTRL_PARKINGDOOR.getID()) {
- m_CallSubMenuScreen.callStartHomeCtrlAPK(ID.LINKEDSCREEN.SubMenuCtrl.ParkingDoor);
- }
- else if (nIconID == ID.ICONS.MENUS.CTRL_COOKTOPOUTLET.getID()) {
- m_CallSubMenuScreen.callStartHomeCtrlAPK(ID.LINKEDSCREEN.SubMenuCtrl.CooktopOutlet);
- }
- else if (nIconID == ID.ICONS.MENUS.CTRL_SYSTEMAIRCON.getID()) {
- m_CallSubMenuScreen.callStartHomeCtrlAPK(ID.LINKEDSCREEN.SubMenuCtrl.SystemAircon);
- }
- else if (nIconID == ID.ICONS.MENUS.ADD_NOTICE.getID()) {
- m_CallSubMenuScreen.callStartAddServiceAPK(ID.LINKEDSCREEN.SubMenuAddService.Notice);
- }
- else if (nIconID == ID.ICONS.MENUS.ADD_WEATHER.getID()) {
- m_CallSubMenuScreen.callStartAddServiceAPK(ID.LINKEDSCREEN.SubMenuAddService.Weather);
- }
- else if (nIconID == ID.ICONS.MENUS.ADD_MEMO.getID()) {
- m_CallSubMenuScreen.callStartAddServiceAPK(ID.LINKEDSCREEN.SubMenuAddService.Memo);
- }
- else if (nIconID == ID.ICONS.MENUS.ADD_E_FRAME.getID()) {
- m_CallSubMenuScreen.callStartAddServiceAPK(ID.LINKEDSCREEN.SubMenuAddService.AutoPicture);
- }
- else if (nIconID == ID.ICONS.MENUS.ADD_SCHEDULE.getID()) {
- m_CallSubMenuScreen.callStartAddServiceAPK(ID.LINKEDSCREEN.SubMenuAddService.Schedule);
- }
- else if (nIconID == ID.ICONS.MENUS.ADD_CCTV.getID()) {
- m_CallSubMenuScreen.callStartAddServiceAPK(ID.LINKEDSCREEN.SubMenuAddService.Cctv);
- }
- else if (nIconID == ID.ICONS.MENUS.ADD_PARKING.getID()) {
- m_CallSubMenuScreen.callStartAddServiceAPK(ID.LINKEDSCREEN.SubMenuAddService.Parking);
- }
- else if (nIconID == ID.ICONS.MENUS.ADD_PARKINGLIST.getID()) {
- m_CallSubMenuScreen.callStartAddServiceAPK(ID.LINKEDSCREEN.SubMenuAddService.ParkingList);
- }
- else if (nIconID == ID.ICONS.MENUS.ADD_ELECTRICCAR.getID()) {
- m_CallSubMenuScreen.callStartAddServiceAPK(ID.LINKEDSCREEN.SubMenuAddService.ElecCar);
- }
- else if (nIconID == ID.ICONS.MENUS.ADD_INTERLAYERNOISE.getID()) {
- m_CallSubMenuScreen.callStartAddServiceAPK(ID.LINKEDSCREEN.SubMenuAddService.InterlayerNoiseHistory);
- }
- else if (nIconID == ID.ICONS.MENUS.ADD_VISITEDVEHICLEREGI.getID()) {
- m_CallSubMenuScreen.callStartAddServiceAPK(ID.LINKEDSCREEN.SubMenuAddService.VisitedVehicleRegi);
- }
- else if (nIconID == ID.ICONS.MENUS.ADD_BANDLOCATION.getID()) {
- m_CallSubMenuScreen.callStartAddServiceAPK(ID.LINKEDSCREEN.SubMenuAddService.BandLocation);
- }
- else if (nIconID == ID.ICONS.MENUS.ADD_GUARDINGSTREETLAMP.getID()) {
- m_CallSubMenuScreen.callStartAddServiceAPK(ID.LINKEDSCREEN.SubMenuAddService.GuardingStreetLamp);
- }
- else if (nIconID == ID.ICONS.MENUS.SECURITY_SETARMED.getID()) {
- runSecurityAPK(ID.LINKEDSCREEN.SubMenuSecurity.SecurityMain);
- }
- else if (nIconID == ID.ICONS.MENUS.SECURITY_DEVICELINK.getID()) {
- runSecurityAPK(ID.LINKEDSCREEN.SubMenuSecurity.LinkDeviceSet);
- }
- else if (nIconID == ID.ICONS.MENUS.SECURITY_DEVICELINKSLEEP.getID()) {
- runSecurityAPK(ID.LINKEDSCREEN.SubMenuSecurity.lnkBedDeviceSet);
- }
- else if (nIconID == ID.ICONS.MENUS.SECURITY_ACCESSHISTORY.getID()) {
- runSecurityAPK(ID.LINKEDSCREEN.SubMenuSecurity.AccessHistoryDoor);
- }
- else if (nIconID == ID.ICONS.MENUS.SECURITY_VISITORVIDEO.getID()) {
- runSecurityAPK(ID.LINKEDSCREEN.SubMenuSecurity.VisitorVideo);
- }
- else if (nIconID == ID.ICONS.MENUS.ENERGY_SMARTPANEL.getID()) {
- m_CallSubMenuScreen.callStartEnergyAPK(ID.LINKEDSCREEN.SubMenuEnergy.SmartPanel);
- }
- else if (nIconID == ID.ICONS.MENUS.ENERGY_SMARTLIGHT.getID()) {
- m_CallSubMenuScreen.callStartEnergyAPK(ID.LINKEDSCREEN.SubMenuEnergy.SmartLight);
- }
- else if (nIconID == ID.ICONS.MENUS.ENERGY_SMARTOUTLET.getID()) {
- m_CallSubMenuScreen.callStartEnergyAPK(ID.LINKEDSCREEN.SubMenuEnergy.SmartOutlet);
- }
- else if (nIconID == ID.ICONS.MENUS.ENERGY_ENERGYMETER.getID()) {
- m_CallSubMenuScreen.callStartEnergyAPK(ID.LINKEDSCREEN.SubMenuEnergy.IEnergy);
- }
- else if (nIconID == ID.ICONS.MENUS.ENERGY_REMOTEMETER.getID()) {
- m_CallSubMenuScreen.callStartEnergyAPK(ID.LINKEDSCREEN.SubMenuEnergy.RemoteMeter);
- }
- else if (nIconID == ID.ICONS.MENUS.ENERGY_ENERGYCONSUMPTION.getID()) {
- m_CallSubMenuScreen.callStartEnergyAPK(ID.LINKEDSCREEN.SubMenuEnergy.EnergyMgr);
- }
- else if (nIconID == ID.ICONS.MENUS.ENERGY_ENERGYCOSTTABLE.getID()) {
- m_CallSubMenuScreen.callStartEnergyAPK(ID.LINKEDSCREEN.SubMenuEnergy.CostTable);
- }
- else if (nIconID == ID.ICONS.MENUS.SETTING_CONFIG.getID()) {
- m_CallSubMenuScreen.callStartConfigAPK(ID.LINKEDSCREEN.SubMenuConfig.Configuration);
- }
- else if (nIconID == ID.ICONS.MENUS.SETTING_CLREANSCREEN.getID()) {
- m_CallSubMenuScreen.callStartConfigAPK(ID.LINKEDSCREEN.SubMenuConfig.CleanLcd);
- }
- else if (nIconID == ID.ICONS.MENUS.SETTING_PWCHANGE.getID()) {
- m_CallSubMenuScreen.callStartConfigAPK(ID.LINKEDSCREEN.SubMenuConfig.PassWordChange);
- }
- else if (nIconID == ID.ICONS.MENUS.SETTING_MORNINGCALL.getID()) {
- m_CallSubMenuScreen.callStartConfigAPK(ID.LINKEDSCREEN.SubMenuConfig.MoningCall);
- }
- else if (nIconID == ID.ICONS.MENUS.SETTING_SMARTKEY.getID()) {
- m_CallSubMenuScreen.callStartConfigAPK(ID.LINKEDSCREEN.SubMenuConfig.SmartKey);
- }
- else if (nIconID == ID.ICONS.MENUS.SETTING_SMARTBAND.getID()) {
- m_CallSubMenuScreen.callStartConfigAPK(ID.LINKEDSCREEN.SubMenuConfig.SmartBand);
- }
- else if (nIconID == ID.ICONS.MENUS.SETTING_ACCESSCARD.getID()) {
- m_CallSubMenuScreen.callStartConfigAPK(ID.LINKEDSCREEN.SubMenuConfig.RfCard);
- }
- else if (nIconID == ID.ICONS.MENUS.SETTING_CALENDAR.getID()) {
- m_CallSubMenuScreen.callStartConfigAPK(ID.LINKEDSCREEN.SubMenuConfig.TimeSetting);
- }
- else if (nIconID == ID.ICONS.MENUS.SETTING_REMOTECALLUSER.getID()) {
- m_CallSubMenuScreen.callStartConfigAPK(ID.LINKEDSCREEN.SubMenuConfig.RemoteCallUser);
- }
- else if (nIconID == ID.ICONS.MENUS.SETTING_REMOTECTRL.getID()) {
- m_CallSubMenuScreen.callStartConfigAPK(ID.LINKEDSCREEN.SubMenuConfig.MobileDeviceReg);
- }
- else if (nIconID == ID.ICONS.MENUS.SETTING_OCCUPANCYSENSOR.getID()) {
- m_CallSubMenuScreen.callStartConfigAPK(ID.LINKEDSCREEN.SubMenuConfig.OccupancySensorConfig);
- }
- else if (nIconID == ID.ICONS.MENUS.SETTING_HSPLATFORM.getID()) {
- m_CallSubMenuScreen.callStartConfigAPK(ID.LINKEDSCREEN.SubMenuConfig.HSPlatform);
- }
- else if (nIconID == ID.ICONS.MENUS.OCF_WIFI.getID()) {
- m_CallSubMenuScreen.callStartOcfAPK(ID.LINKEDSCREEN.SubMenuOcf.WIFI);
- }
- else if (nIconID == ID.ICONS.MENUS.OCF_BRIDGE.getID()) {
- m_CallSubMenuScreen.callStartOcfBridgeAPK();
- }
- else if (nIconID == ID.ICONS.MENUS.KAKAOI_SETTING.getID()) {
- mContext.sendBroadcast(new Intent("com.kakao.i.hdc.service.setting"));
- }
- else {
- Log.w(TAG, "[runShortcut] nIconID is not supported!! [" + nIconID + "]");
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] runShortcut(int nIconID)");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public void runSecurityAPK(int nScreenID) {
- try {
- WallpadStatusData wdb = new WallpadStatusData(this.getContext());
- int nSecurityMode = wdb.GetAlarmStatus();
- wdb.closeDB();
- Log.w(TAG, "[runSecurityAPK] nSecurityMode [" + nSecurityMode + "]");
- if (nSecurityMode == WallpadStatusData.GUARD_IN) {
- // 팝업 띄워서 재택모드 해제 유도
- StartPopup(ID.POPUPS.POPUP_RELEASEINMODE);
- // ((MainActivity)(getContext())).StartPopup(ID_OLD.SCREENS.SecurityReleasePopupScreen);
- }
- else if (nSecurityMode == WallpadStatusData.OUT_MODE) {
- // 팝업 띄워서 외출모드 해제 유도
- StartPopup(ID.POPUPS.POPUP_RELEASEOUTMODE);
- // ((MainActivity)(getContext())).StartPopup(ID_OLD.SCREENS.OutModeReleasePopupScreen);
- }
- else if (nSecurityMode == WallpadStatusData.ALARM_STOP) {
- // 알람 화면을 띄우도록 한다.
- runEmergencyAPK(this, getAlarmType(), 2 , "모름");
- }
- else {
- m_CallSubMenuScreen.callStartSecurityAPK(nScreenID);
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] runSecurityAPK(int nScreenID)");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public void runEmergencyAPK(Context context, int nScreenID, int startOption, String detailInfo) {
- try {
- // DB 체크 해서 띄우 도록 한다.
- int [] m_EmerMenuList = new int[4];
- m_EmerMenuList[0] = ID.LINKEDSCREEN.SubEmergency.EMER_ALARM;
- m_EmerMenuList[1] = ID.LINKEDSCREEN.SubEmergency.FIRE_ALARM;
- m_EmerMenuList[2] = ID.LINKEDSCREEN.SubEmergency.BREAKIN_ALARM;
- m_EmerMenuList[3] = ID.LINKEDSCREEN.SubEmergency.LADDER_ALARM;
- Intent intent = new Intent(Intent.ACTION_MAIN);
- intent.putExtra(Common.MENU_ID_LIST, m_EmerMenuList); // KEY : MENU_ID_LIST
- intent.putExtra(Common.MENU_START_ID, nScreenID); // KEY : MENU_START_ID
- intent.putExtra(Common.MENU_START_OPTION, startOption); // KEY : MENU_START_OPTION
- intent.putExtra(Common.MENU_DETAIL_INFO, detailInfo);
- intent.setComponent(new ComponentName(Common.EMER_ALARM_APK, Common.EMER_ALARM_APK + Common.MAIN_ACTIVITY ));
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- context.startActivity(intent);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] runEmergencyAPK(Context context, int nScreenID, int startOption, String detailInfo)");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public int getAlarmType() {
- WallpadStatusData SetData = new WallpadStatusData(this.getContext());
- int alarmtype = SetData.GetAlarmType();
- SetData.closeDB();
- int Menu_Start_Option = ID.LINKEDSCREEN.SubEmergency.EMER_ALARM;
- switch (alarmtype) {
- case WallpadStatusData.ALARM_ALERT:
- Menu_Start_Option = ID.LINKEDSCREEN.SubEmergency.FIRE_ALARM;
- break;
- case WallpadStatusData.ALARM_EMM:
- Menu_Start_Option = ID.LINKEDSCREEN.SubEmergency.EMER_ALARM;
- break;
- case WallpadStatusData.ALARM_EVAC:
- Menu_Start_Option = ID.LINKEDSCREEN.SubEmergency.LADDER_ALARM;
- break;
- case WallpadStatusData.ALARM_INVADE:
- Menu_Start_Option = ID.LINKEDSCREEN.SubEmergency.BREAKIN_ALARM;
- break;
- }
- return Menu_Start_Option;
- }
- public void runGoogleLauncher() {
- try {
- ComponentName mComponentName = new ComponentName("com.android.launcher3", "com.android.launcher3.Launcher");
- Intent mIntent = new Intent(Intent.ACTION_MAIN);
- mIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
- mIntent.setComponent(mComponentName);
- startActivity(mIntent);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] runGoogleLauncher()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public void setCallAppRunning(boolean bRunning) {
- try {
- Log.i(TAG, "[setCallAppRunning] bRunning [" + bRunning + "]");
- WallpadStatusData DBMGR = new WallpadStatusData(getApplicationContext());
- DBMGR.SetCallAPKStatus(bRunning);
- DBMGR.closeDB();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] setCallAppRunning(boolean bRunning)");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private void registerMainActivityBR() {
- try {
- IntentFilter filter = new IntentFilter();
- filter.addAction(Common.BR_REQUEST_APK_RUN);
- filter.addAction(ACTION_TIME_TICK);
- filter.addAction(Common.BR_PLAY_SOUND);
- filter.addAction(define.NOTIFY_ACNAME_LCD_BACKLIGHT_ON);
- filter.addAction(define.NOTIFY_ACNAME_LCD_BACKLIGHT_OFF);
- mContext.registerReceiver(MainActivityBroadcastReceiver, filter);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] registerMainActivityBR()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- String strAPKType = "APKType";
- String strMenuType = "MenuType";
- String strSoundID = "SoundID";
- BroadcastReceiver MainActivityBroadcastReceiver = new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- try {
- if (((MainActivity)(getContext())).getMainSubScreenLoadingComplite() == false)
- return;
- String strActionName = intent.getAction();
- Log.d(TAG,"[MainActivityBroadcastReceiver] strActionName [" + strActionName + "]");
- if (strActionName.equals(Common.BR_REQUEST_APK_RUN)) {
- Log.d(TAG, "[MainActivityBroadcastReceiver] (BR.Action) BR_REQUEST_APK_RUN");
- int nAPKType = intent.getIntExtra(strAPKType,0);
- int nMenuType = intent.getIntExtra(strMenuType,0);
- int nCardNum = intent.getIntExtra(Common.BR_MAIN_NOTI.CARD_NUM, 0);
- Log.d(TAG, "[MainActivityBroadcastReceiver] nAPKType [" + nAPKType + "], nMenuType [" + nMenuType + "], nCardNum [" + nCardNum + "]");
- if (nAPKType == ID.LINKEDSCREEN.SubCall.BASE) {
- m_CallSubMenuScreen.callStartCallAPK(nMenuType);
- }
- else if (nAPKType == ID.LINKEDSCREEN.SubMenuAddService.BASE) {
- m_CallSubMenuScreen.callStartAddServiceAPK(nMenuType, nCardNum);
- }
- }
- else if (strActionName.equals(ACTION_TIME_TICK)) {
- // checkTimeTasks();
- if (bLCDKeeperUsage) ctrlLCDKeeper();
- }
- else if (strActionName.equals(Common.BR_PLAY_SOUND)) {
- int nSoundID = intent.getIntExtra(strSoundID,0);
- Sound().Play(nSoundID);
- }
- else if (strActionName.equals(define.NOTIFY_ACNAME_LCD_BACKLIGHT_ON)) {
- Log.d(TAG, "[MainActivityBroadcastReceiver] (BR.Action) NOTIFY_ACNAME_LCD_BACKLIGHT_ON: bLCDKeeperUsage [" + bLCDKeeperUsage + "], nLCDKeeperType [" + getLCDKeeperType(nLCDKeeperType) + "]");
- if (bLCDKeeperUsage) {
- bLCDBacklightPower = true;
- ctrlLCDKeeper();
- }
- }
- else if (strActionName.equals(define.NOTIFY_ACNAME_LCD_BACKLIGHT_OFF)) {
- Log.d(TAG, "[MainActivityBroadcastReceiver] (BR.Action) NOTIFY_ACNAME_LCD_BACKLIGHT_OFF: bLCDKeeperUsage [" + bLCDKeeperUsage + "], nLCDKeeperType [" + getLCDKeeperType(nLCDKeeperType) + "]");
- if (bLCDKeeperUsage) {
- bLCDBacklightPower = false;
- ctrlLCDKeeper();
- }
- }
- else {
- Log.w(TAG,"[MainActivityBroadcastReceiver] Not supported strActionName [" + strActionName + "]");
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] MainActivityBroadcastReceiver()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- };
- public Common.GUI_TYPE checkGUIType(Context context) {
- try {
- WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(context);
- String strGUIType = mWallpadDeviceSet.GetMainGUISelect();
- mWallpadDeviceSet.closeDB();
- if (strGUIType.equalsIgnoreCase(WallpadDeviceSet.MAIN_GUI_TYPE_DEFAULT)) return Common.GUI_TYPE.STANDARD;
- else if (strGUIType.equalsIgnoreCase(WallpadDeviceSet.MAIN_GUI_TYPE_METRO)) return Common.GUI_TYPE.METRO;
- else if (strGUIType.equalsIgnoreCase(WallpadDeviceSet.MAIN_GUI_TYPE_HYOSUNG)) return Common.GUI_TYPE.HYOSUNG;
- else if (strGUIType.equalsIgnoreCase(WallpadDeviceSet.MAIN_GUI_TYPE_HIMCHAN)) return Common.GUI_TYPE.HIMCHAN;
- else return Common.GUI_TYPE.STANDARD;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return Common.GUI_TYPE.STANDARD;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] checkGUIType(Context context)");
- LogUtil.errorLogInfo("", TAG, e);
- return Common.GUI_TYPE.STANDARD;
- }
- }
- public void finishActivity() {
- try {
- Log.i(TAG, "[finishActivity]");
- super.finish();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] finishActivity()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- // MainActivity Handler
- public final class HANDLERMSG {
- public final static int CHECK_FLIPPER_MAINSCREEN_ID = 100;
- public final static int CHECK_WALLPAD_CAMERA_INIT = 200;
- public final static int CHECK_WALLPAD_CAMERA_REMOVE = 300;
- public final static int CHECK_WALLPAD_CAMERA_RESET = 400;
- public final static int CHECK_WALLPAD_CAMERA_CHECK = 500;
- public final static int MEDIA_RECORD_START = 600;
- public final static int MEDIA_RECORD_START_REMOTECALL = 700;
- public final static int FINISH_ACTIVITY = 999;
- }
- public Handler MainHandler = new Handler(Looper.getMainLooper()) {
- public void handleMessage(Message msg) {
- Log.d(TAG, "[MainHandler] MainHandler : what [" + msg.what + "], arg1 [" + msg.arg1 + "], arg2 [" + msg.arg2 + "]");
- switch (msg.what) {
- case HANDLERMSG.CHECK_FLIPPER_MAINSCREEN_ID:
- // checkMainPage();
- break;
- case HANDLERMSG.CHECK_WALLPAD_CAMERA_INIT:
- if (getWallPadCameraUsage()) {
- initMyVideoSurfaceLayout();
- sendHandlerMsgDelayed(HANDLERMSG.CHECK_WALLPAD_CAMERA_REMOVE, 0, 0, 3000); // 월패드 카메라 영상을 띄우고 5초뒤에 없앤다.
- }
- break;
- case HANDLERMSG.CHECK_WALLPAD_CAMERA_REMOVE:
- if (getWallPadCameraUsage()) removeMyVideoSurfaceLayout();
- break;
- case HANDLERMSG.CHECK_WALLPAD_CAMERA_RESET:
- if (getWallPadCameraUsage()) resetCameraService();
- break;
- case HANDLERMSG.CHECK_WALLPAD_CAMERA_CHECK:
- checkCameraLoading();
- break;
- case HANDLERMSG.FINISH_ACTIVITY:
- finishActivity();
- break;
- case HANDLERMSG.MEDIA_RECORD_START:
- Log.d(TAG, "[TalkFrontHandler] MEDIA_RECORD_START");
- showFrontCam(true);
- mediaStartRecord();
- break;
- case HANDLERMSG.MEDIA_RECORD_START_REMOTECALL:
- Log.d(TAG, "[TalkFrontHandler] MEDIA_RECORD_START_REMOTECALL");
- bRecordStatus = true;
- showFrontCam(true);
- runNoticeStrangerRecord(true);
- if (mRecordTimer != null) mRecordTimer.start();
- break;
- default:
- Log.d(TAG, "MainHandler : " + msg.what);
- break;
- }
- }
- };
- public void sendHandlerMsg(int what, int arg1, int arg2) {
- try {
- Log.i(TAG, "[sendHandlerMsg] what [" + what + "], arg1 [" + arg1 + "], arg2 [" + arg2 + "]");
- Message HandleMsg = MainHandler.obtainMessage();
- HandleMsg.what = what;
- HandleMsg.arg1 = arg1;
- HandleMsg.arg2 = arg2;
- MainHandler.sendMessage(HandleMsg);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] sendHandlerMsg(msg)");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public void sendHandlerMsgDelayed(int what, int arg1, int arg2, long delay) {
- try {
- Log.i(TAG, "[sendHandlerMsgDelayed] what [" + what + "], arg1 [" + arg1 + "], arg2 [" + arg2 + "], delay [" + delay + "]");
- Message HandleMsg = MainHandler.obtainMessage();
- HandleMsg.what = what;
- HandleMsg.arg1 = arg1;
- HandleMsg.arg2 = arg2;
- MainHandler.sendMessageDelayed(HandleMsg, delay);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] sendHandlerMsgDelayed(msg)");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private boolean savePresetValue(String strPresetValues) {
- try {
- Log.i(TAG, "[savePresetValue] strPresetValues [" + strPresetValues + "]");
- String[] strParse_01 = strPresetValues.split("/");
- int presetid = Integer.parseInt(strParse_01[0]);
- String[] strParse_02 = strParse_01[1].split(":");
- String onoff = strParse_02[0];
- int dim = Integer.parseInt(strParse_02[1]);
- int color = Integer.parseInt(strParse_02[2]);
- WallpadStatusData mWallpadStatusData = new WallpadStatusData(mContext);
- boolean result = mWallpadStatusData.setLivinglightModeCtrlUnitValues(presetid, 0, "on", dim, color);
- mWallpadStatusData.closeDB();
- Log.d(TAG, "[savePresetValue] result [" + result + "], onoff [" + onoff + "], dim [" + dim + "], color [" + color + "]");
- if (result) {
- mLightInfo.mPreset[presetid].mLights[0].ONOFF = onoff;
- mLightInfo.mPreset[presetid].mLights[0].DIM = dim;
- mLightInfo.mPreset[presetid].mLights[0].COLOR = color;
- Log.d(TAG,"[savePresetValue] OnOff [" + mLightInfo.mPreset[presetid].mLights[0].ONOFF + "], Level [" + mLightInfo.mPreset[presetid].mLights[0].DIM + "], Color [" + mLightInfo.mPreset[presetid].mLights[0].COLOR + "]");
- return true;
- }
- else {
- Log.w(TAG,"[savePresetValue] Fail to save light preset values!!");
- return false;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] savePresetValue(String strPresetValues)");
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- private void initProximitySensor() {
- try {
- WallpadStatusData mWallpadStatusData = new WallpadStatusData(this);
- int nProximitySensorLevel = mWallpadStatusData.GetCloseSensorValue();
- mWallpadStatusData.closeDB();
- Log.i(TAG, "[initProximitySensor] nProximitySensorLevel = " + nProximitySensorLevel);
- if (nProximitySensorLevel < 0 || 5 < nProximitySensorLevel) {
- Log.w(TAG, "[initProximitySensor] nProximitySensorLevel is out of range!!");
- nProximitySensorLevel = 5;
- }
- int nResult = mIOInterface.setProximitySensorLevel(nProximitySensorLevel * 3);
- Log.i(TAG, "[initProximitySensor] nResult = " + nResult);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] initProximitySensor()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private boolean checkInterFloorNoiseError() {
- try {
- WallpadStatusData wsd = new WallpadStatusData(getContext());
- String stSensorStatus = wsd.Get_InterlayerSensor_Status();
- wsd.closeDB();
- // 센서 정상 : false, 센서 이상 : true
- Log.i(TAG, "[checkInterFloorNoiseError] stSensorStatus : " + stSensorStatus);
- if (stSensorStatus.equalsIgnoreCase(define.INTERLAYER_NOISE_STATUS_NORMAL)) return false;
- else return true;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] checkInterFloorNoiseError()");
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- private boolean checkInterFloorNoiseFuncUsage() {
- try {
- WallpadStatusData wsd = new WallpadStatusData(getContext());
- boolean bUsage = wsd.GetNoisePopupUse();
- wsd.closeDB();
- return bUsage;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] checkInterFloorNoiseFuncUsage()");
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- /**
- * 현관호출 or 전화호출시 사용되는 keycode - Broadcast 을 송신한다.
- *
- * @param nKeyCode - (int) 송신할 keycode
- * @return (int) - >=0 : 성공, <0 : 실패
- */
- private int sendKeyEventBR(int nKeyCode) {
- try {
- Log.i(TAG, "[sendKeyEventBR] nKeyCode [" + nKeyCode +"] -> EVENT_DEVICE_CONTROL");
- KeyEvent event = new KeyEvent(KeyEvent.ACTION_UP, nKeyCode);
- Intent intent = new Intent("EVENT_DEVICE_CONTROL", null);
- intent.putExtra(Intent.EXTRA_KEY_EVENT, event);
- intent.putExtra("keycode",nKeyCode);
- sendBroadcast(intent);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -100;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] sendKeyEventBR(int nKeyCode) [" + nKeyCode + "]");
- LogUtil.errorLogInfo("", TAG, e);
- return -100;
- }
- return 0;
- }
- // 카카오 연동 관련
- public static boolean bKakaoiEnable = false;
- /**
- * 이진규
- * kakaohome 서비스 사용 유무 판단
- */
- protected boolean bKakaoHomeEnable = false;
- // run Kakao i floating button 실행
- private void startKakaoiFloatingBTN() {
- try {
- Log.i(TAG, "[startKakaoiFloatingBTN] ========== Run Kakao i floating button ==========");
- ComponentName mComponentName = new ComponentName("kr.co.icontrols.wallpadglobalbutton", "kr.co.icontrols.wallpadglobalbutton.MainActivity");
- Intent mIntent = new Intent(Intent.ACTION_MAIN);
- mIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- mIntent.setComponent(mComponentName);
- startActivity(mIntent);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] startKakaoiFloatingBTN()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public void Send_NotiSmartSwitch(int nNoticeCnt, int nParcelCnt, int nVisitorPicCnt)
- {
- try
- {
- Intent intentBR = new Intent();
- intentBR.setAction(define.DRIVER_ISD_NOTIINFO);
- //if( m_NoticeCNT > 0 || m_ParcelCNT > 0 || m_InCallCNT > 0 || m_VisitorCNT > 0 )
- {
- // 아이콘 활성화
- if( nNoticeCnt > 0 )
- {
- Log.d(TAG, "LOG : NOTICE CNT INCREASED ++");
- intentBR.putExtra(define.NOTIBR_ISD_NOTICECNT, nNoticeCnt);
- Log.d(TAG, "NoticeCNT BroadCast Added");
- }
- else
- {
- intentBR.putExtra(define.NOTIBR_ISD_NOTICECNT, 0);
- Log.d(TAG, "NoticeCNT ZERO Added");
- }
- if( nParcelCnt > 0 )
- {
- Log.d(TAG, "LOG : Parcel CNT INCREASED ++");
- intentBR.putExtra(define.NOTIBR_ISD_PARCELCNT, nParcelCnt);
- Log.d(TAG, "ParcelCNT BroadCast Added");
- }
- else
- {
- intentBR.putExtra(define.NOTIBR_ISD_PARCELCNT, 0);
- Log.d(TAG, "ParcelCNT ZERO Added");
- }
- if( nVisitorPicCnt > 0 )
- {
- Log.d(TAG, "LOG : VISITOR CNT INCREASED ++");
- intentBR.putExtra(define.NOTIBR_ISD_VISITORCNT, nVisitorPicCnt);
- Log.d(TAG, "VisitorCNT BroadCast Added");
- }
- else
- {
- intentBR.putExtra(define.NOTIBR_ISD_VISITORCNT, nVisitorPicCnt);
- Log.d(TAG, "VisitorCNT ZERO Added");
- }
- // 알림정보 intent BroadCast
- getContext().sendBroadcast(intentBR);
- }
- }
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e)
- {
- Log.e(TAG, e.toString());
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- // private void startKakaoiVoiceAgent() {
- // try {
- // Log.i(TAG, "[startKakaoiVoiceAgent] ========== Start Kakao i Voice Agent ==========");
- // Intent mIntent = new Intent("com.kakao.i.agent.START_SERVICE").setPackage("com.kakao.i.test.sandbox");
- // ContextCompat.startForegroundService(this, mIntent);
- // } catch (RuntimeException re) {
- // LogUtil.errorLogInfo("", TAG, re);
- // }
- // catch (Exception e) {
- // Log.e(TAG, "[Exception] startKakaoiVoiceAgent()");
- // e.printStackTrace();
- // }
- // }
- //
- // private void enableKakaoiVoiceAgent() {
- // try {
- // Log.i(TAG, "[enableKakaoiVoiceAgent] ========== Enable Kakao i Voice Agent ==========");
- // Intent mIntent = new Intent("com.kakao.i.agent.ENABLE_KAKAO_I").setPackage("com.kakao.i.test.sandbox");
- // ContextCompat.startForegroundService(this, mIntent);
- // } catch (RuntimeException re) {
- // LogUtil.errorLogInfo("", TAG, re);
- // }
- // catch (Exception e) {
- // Log.e(TAG, "[Exception] enableKakaoiVoiceAgent()");
- // e.printStackTrace();
- // }
- // }
- //
- // private void diableKakaoiVoiceAgent() {
- // try {
- // Log.i(TAG, "[diableKakaoiVoiceAgent] ========== Disable Kakao i Voice Agent ==========");
- // Intent mIntent = new Intent("com.kakao.i.agent.DISABLE_KAKAO_I").setPackage("com.kakao.i.test.sandbox");
- // ContextCompat.startForegroundService(this, mIntent);
- // } catch (RuntimeException re) {
- // LogUtil.errorLogInfo("", TAG, re);
- // }
- // catch (Exception e) {
- // Log.e(TAG, "[Exception] diableKakaoiVoiceAgent()");
- // e.printStackTrace();
- // }
- // }
- /**
- * JEFF, 2019.08.06
- * 동탄현장 월패드 죽는 이슈 원인 분석을 위한 월패드 App 삭제 코드
- * 메인App만 남기고 모두 삭제
- */
- UninstallAPKs mUninstallAPKs = new UninstallAPKs();
- class UninstallAPKs extends Thread {
- @Override
- public void run() {
- super.run();
- try {
- Log.d(TAG, "[UninstallAPKs.run()] Started getting installed package infomation");
- ArrayList<PackageVersionInfo> PackageVersionInfos = new ArrayList<PackageVersionInfo>();
- List<PackageInfo> PackageInfoList = getPackageManager().getInstalledPackages(PackageManager.PERMISSION_GRANTED);
- while (true) {
- Log.d(TAG, "[UninstallAPKs.run()] Get installed packages start!!");
- try {
- for (PackageInfo pack : PackageInfoList) {
- // Log.d(TAG, "[UninstallAPKs.run()] Package Name [" + pack.packageName + "]");
- // Log.d(TAG, "[UninstallAPKs.run()] Version Name [" + pack.versionName + "]");
- if ((pack.packageName.contains("icontrols")) || (pack.packageName.contains("artncore"))) {
- PackageVersionInfos.add(new PackageVersionInfo(pack.packageName, pack.versionName));
- }
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- break;
- } catch (Exception e) {
- LogUtil.errorLogInfo("", TAG, e);
- break;
- }
- Log.d(TAG, "[getInstalledPackageInfo.run()] Get installed packages end!!");
- break;
- }
- for (int i = 0; i < PackageVersionInfos.size(); i++) {
- Log.d(TAG, "[UninstallAPKs.run()] Package Name [" + PackageVersionInfos.get(i).getPackageName() + "]");
- Log.d(TAG, "[UninstallAPKs.run()] Version Name [" + PackageVersionInfos.get(i).strPackageVersion + "]");
- uninstallWallPadApp(PackageVersionInfos.get(i).getPackageName());
- try {
- Thread.sleep(5000);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] UninstallAPKs.run()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- // try {Thread.sleep(5000);}catch (RuntimeException re) { LogUtil.errorLogInfo("", TAG, re);}catch (Exception e){e.printStackTrace();}
- }
- }
- private void uninstallWallPadApp(String strAPK) {
- try {
- Log.w(TAG, "[uninstallWallPadApp] strAPK [" + strAPK + "]");
- if (checkAppInstalled(strAPK)) {
- // Intent mIntent = new Intent(Intent.ACTION_DELETE);
- Intent mIntent = new Intent(Intent.ACTION_UNINSTALL_PACKAGE);
- mIntent.setData(Uri.parse("package:" + strAPK));
- mIntent.putExtra(Intent.EXTRA_RETURN_RESULT, true);
- startActivityForResult(mIntent, UNINSTALL_REQUEST_CODE);
- }
- else {
- Log.w(TAG, "[uninstallWallPadApp] Not installed [" + strAPK + "]");
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {;
- Log.e(TAG, "[Exception] uninstallWallPadApp()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- iMAPRemotemeter miMAPRemotemeter;
- boolean mEMS_Enable;
- int nEnergyTypeCnt;
- private boolean mCostInfo_Enable = false;
- private Calendar nowCal, HourCal, DateCal, MonthCal, YearCal, EnergyDataGetCal;
- int CalendarYear;
- int CalendarMonth;
- int CalendarDate;
- int ShowNowEnergyIndex = 0;
- String[] ShowListEnergyType_String = {
- "전기",
- "수도",
- "가스",
- "온수",
- "난방",
- "탄소"
- };
- // 원격검침 월사용량 데이터 클래스
- MonthTableClass monthTableClass[] = new MonthTableClass[6];
- class MonthTableClass {
- private String Use;
- private String SamePyungUse;
- private String Rank;
- private String Goal;
- private String Price;
- public MonthTableClass (String Use, String SamePyungUse, String Rank, String Goal) {
- this.Use = Use;
- this.SamePyungUse = SamePyungUse;
- this.Rank = Rank;
- this.Goal = Goal;
- }
- public String getUse(){return Use;}
- public String getSamePyungUse(){return SamePyungUse;}
- public String getRank(){return Rank;}
- public String getGoal(){return Goal;}
- public String getPrice(){return Price;}
- }
- public void GetMeteringCount()
- {
- WallpadDeviceSet devSet = new WallpadDeviceSet(getContext());
- String[] MetringDB = devSet.GetSettingData("원격검침");
- devSet.closeDB();
- if (MetringDB != null)
- {
- try
- {
- String devInfo = MetringDB[1];
- devInfo = devInfo.replace('(', '_');
- devInfo = devInfo.replace(':', '_');
- devInfo = devInfo.replace(')', '_');
- String[] MetringInfo = devInfo.split("_");
- // MetringInfo[1] -> 회로수
- // MetringInfo[5] -> EMS 사용여부 사용함 or 사용안함
- if ((Integer.parseInt(MetringInfo[1]) == 2) || (Integer.parseInt(MetringInfo[1]) == 3) || (Integer.parseInt(MetringInfo[1]) == 5) || (Integer.parseInt(MetringInfo[1]) == 6))
- {
- nEnergyTypeCnt = Integer.parseInt(MetringInfo[1]);
- }
- else
- {
- nEnergyTypeCnt = 5;
- }
- if (MetringInfo[5].equals("사용함"))
- {
- mEMS_Enable = true;
- }
- else
- {
- mEMS_Enable = false;
- }
- if(MetringInfo[7].equals("사용함"))
- {
- mCostInfo_Enable = true;
- }
- else
- {
- mCostInfo_Enable = false;
- }
- }
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- nEnergyTypeCnt = 5;
- mEMS_Enable = true;
- }
- catch (Exception e)
- {
- LogUtil.errorLogInfo("", TAG, e);
- nEnergyTypeCnt = 5;
- mEMS_Enable = true;
- }
- }
- else
- {
- nEnergyTypeCnt = 5;
- mEMS_Enable = true;
- }
- }
- /**
- * @description
- * 서버로 부터 데이터를 받아와 분석하고 표현하는 함수<br>
- * @param
- * InputType 0 당월, 1 일별<br>
- * @param
- * //year - 연도<br>
- * @param
- * //month - 월<br>
- * @param
- * //energy - 0 전기, 1 수도, 2 가스, 3 온수, 4 열량, 5 탄소<br>
- */
- private void LoadRemotemeterDataFromServer(int InputType, int Year, int Month, int Energy, final boolean bSendToMobile) {
- final int inputType = InputType;
- final int year = Year;
- final int month = (Month+1);
- try {
- Log.i(TAG, "[LoadRemotemeterDataFromServer] InputType [" + InputType + "], Year [" + Year + "], Month [" + Month + "], Energy [" + Energy + "], bSendToMobile [" + bSendToMobile + "]");
- Log.i(TAG, "[LoadRemotemeterDataFromServer] inputType [" + inputType + "], year [" + year + "], month [" + month + "]");
- miMAPRemotemeter = new iMAPRemotemeter(getApplicationContext());
- switch(inputType) {
- case 0: //당월
- miMAPRemotemeter.DoWork(true, true, true, true, true, true, true, mEMS_Enable, year, month);
- break;
- case 1: //일별
- miMAPRemotemeter.DoWork(false, true, true, true, true, true, false, false, year, month);
- break;
- default:
- break;
- }
- miMAPRemotemeter.SetRetCtr(new RetProci() {
- @Override
- public void ProcSuccess() {
- String TempString = null;
- // DB
- WallpadStatusData StatusDBMGR = null;
- try {
- StatusDBMGR = new WallpadStatusData(getApplicationContext());
- Log.i(TAG, "[LoadRemotemeterDataFromServer.ProcSuccess] inputType [" + inputType + "]");
- boolean result = false;
- switch (inputType) {
- case 0: // 당월
- EnergyDataGetCal = Calendar.getInstance();
- int NumberOfValuelist = miMAPRemotemeter.SetItem("valuelist");
- if (NumberOfValuelist != 0) {
- for (int i = 0; i < NumberOfValuelist; i++) {
- //DebugLogOutput("NumberOfValuelist " + Integer.toString(NumberOfValuelist));
- //DebugLogOutput("GetAttributeVal(i, month) " + imapRemotemeter.GetAttributeVal(i, "month"));
- //DebugLogOutput("CalendarMonth " + (CalendarMonth + 1));
- if ((Integer.parseInt(miMAPRemotemeter.GetAttributeVal(i, "month")) == (CalendarMonth + 1)) && (Integer.parseInt(miMAPRemotemeter.GetAttributeVal(i, "year")) == (CalendarYear))) {
- result = true;
- int Temp_mNumberOfEnergy = nEnergyTypeCnt;
- if (Temp_mNumberOfEnergy == 2) {
- Temp_mNumberOfEnergy = 3;
- }
- for (int j = 0; j < Temp_mNumberOfEnergy; j++) {
- switch (j) {
- case 0:
- monthTableClass[j] = new MonthTableClass("", "", "", "");
- if (miMAPRemotemeter.GetAttributeVal(i, "elect_used") != null) {
- if (miMAPRemotemeter.GetAttributeVal(i, "elect_used").equals("1000000") == true) {
- monthTableClass[j].Use = "0";
- }
- else {
- monthTableClass[j].Use = miMAPRemotemeter.GetAttributeVal(i, "elect_used");
- }
- }
- if (miMAPRemotemeter.GetAttributeVal(i, "elect_average_used_samesize") != null) {
- if (miMAPRemotemeter.GetAttributeVal(i, "elect_average_used_samesize").equals("null") == true) {
- monthTableClass[j].SamePyungUse = "0";
- }
- else {
- monthTableClass[j].SamePyungUse = miMAPRemotemeter.GetAttributeVal(i, "elect_average_used_samesize");
- }
- }
- if ((miMAPRemotemeter.GetAttributeVal(i, "elect_ranking_samesize") != null) && (miMAPRemotemeter.GetAttributeVal(i, "count_samesize") != null)) {
- if (miMAPRemotemeter.GetAttributeVal(i, "elect_ranking_samesize").equals("null") == true) {
- TempString = "- / ";
- }
- else {
- TempString = miMAPRemotemeter.GetAttributeVal(i, "elect_ranking_samesize") + " / ";
- }
- if (miMAPRemotemeter.GetAttributeVal(i, "count_samesize").equals("null") == true) {
- TempString = TempString + "-";
- }
- else {
- TempString = TempString + miMAPRemotemeter.GetAttributeVal(i, "count_samesize");
- }
- monthTableClass[j].Rank = TempString;
- }
- //가격정보
- if (mCostInfo_Enable == true) {
- if (miMAPRemotemeter.GetAttributeVal(i, "elect_price") != null) {
- if (miMAPRemotemeter.GetAttributeVal(i, "elect_price").equals("null") == true) {
- monthTableClass[j].Price = "";
- }
- else {
- monthTableClass[j].Price = miMAPRemotemeter.GetAttributeVal(i, "elect_price");
- }
- }
- }
- monthTableClass[j].Goal = StatusDBMGR.GetRemoteMeteringTargetValue(j);
- //DebugLogOutput("전기");
- //DebugLogOutput("Homeuse: " + monthTableClass[j].Use);
- //DebugLogOutput("SamePyungUse: " + monthTableClass[j].SamePyungUse);
- break;
- case 1:
- monthTableClass[j] = new MonthTableClass("", "", "", "");
- if (miMAPRemotemeter.GetAttributeVal(i, "water_used") != null) {
- if (miMAPRemotemeter.GetAttributeVal(i, "water_used").equals("1000000") == true) {
- monthTableClass[j].Use = "0";
- }
- else {
- monthTableClass[j].Use = miMAPRemotemeter.GetAttributeVal(i, "water_used");
- }
- }
- if (miMAPRemotemeter.GetAttributeVal(i, "water_average_used_samesize") != null) {
- if (miMAPRemotemeter.GetAttributeVal(i, "water_average_used_samesize").equals("null") == true) {
- monthTableClass[j].SamePyungUse = "0";
- }
- else {
- monthTableClass[j].SamePyungUse = miMAPRemotemeter.GetAttributeVal(i, "water_average_used_samesize");
- }
- }
- if ((miMAPRemotemeter.GetAttributeVal(i, "water_ranking_samesize") != null) && (miMAPRemotemeter.GetAttributeVal(i, "count_samesize") != null)) {
- if (miMAPRemotemeter.GetAttributeVal(i, "water_ranking_samesize").equals("null") == true) {
- TempString = "- / ";
- }
- else {
- TempString = miMAPRemotemeter.GetAttributeVal(i, "water_ranking_samesize") + " / ";
- }
- if (miMAPRemotemeter.GetAttributeVal(i, "count_samesize").equals("null") == true) {
- TempString = TempString + "-";
- }
- else {
- TempString = TempString + miMAPRemotemeter.GetAttributeVal(i, "count_samesize");
- }
- monthTableClass[j].Rank = TempString;
- }
- //가격정보
- if (mCostInfo_Enable == true) {
- if (miMAPRemotemeter.GetAttributeVal(i, "water_price") != null) {
- if (miMAPRemotemeter.GetAttributeVal(i, "water_price").equals("null") == true) {
- monthTableClass[j].Price = "";
- }
- else {
- monthTableClass[j].Price = miMAPRemotemeter.GetAttributeVal(i, "water_price");
- }
- }
- }
- monthTableClass[j].Goal = StatusDBMGR.GetRemoteMeteringTargetValue(j);
- //DebugLogOutput("수도");
- //DebugLogOutput("Homeuse: " + monthTableClass[j].Use);
- //DebugLogOutput("SamePyungUse: " + monthTableClass[j].SamePyungUse);
- break;
- case 2:
- monthTableClass[j] = new MonthTableClass("", "", "", "");
- if (miMAPRemotemeter.GetAttributeVal(i, "gas_used") != null) {
- if (miMAPRemotemeter.GetAttributeVal(i, "gas_used").equals("1000000") == true) {
- monthTableClass[j].Use = "0";
- }
- else {
- monthTableClass[j].Use = miMAPRemotemeter.GetAttributeVal(i, "gas_used");
- }
- }
- if (miMAPRemotemeter.GetAttributeVal(i, "gas_average_used_samesize") != null) {
- if (miMAPRemotemeter.GetAttributeVal(i, "gas_average_used_samesize").equals("null") == true) {
- monthTableClass[j].SamePyungUse = "0";
- }
- else {
- monthTableClass[j].SamePyungUse = miMAPRemotemeter.GetAttributeVal(i, "gas_average_used_samesize");
- }
- }
- if ((miMAPRemotemeter.GetAttributeVal(i, "gas_ranking_samesize") != null) && (miMAPRemotemeter.GetAttributeVal(i, "count_samesize") != null)) {
- if (miMAPRemotemeter.GetAttributeVal(i, "gas_ranking_samesize").equals("null") == true) {
- TempString = "- / ";
- }
- else {
- TempString = miMAPRemotemeter.GetAttributeVal(i, "gas_ranking_samesize") + " / ";
- }
- if (miMAPRemotemeter.GetAttributeVal(i, "count_samesize").equals("null") == true) {
- TempString = TempString + "-";
- }
- else {
- TempString = TempString + miMAPRemotemeter.GetAttributeVal(i, "count_samesize");
- }
- monthTableClass[j].Rank = TempString;
- }
- //가격정보
- if (mCostInfo_Enable == true) {
- if (miMAPRemotemeter.GetAttributeVal(i, "gas_price") != null) {
- if (miMAPRemotemeter.GetAttributeVal(i, "gas_price").equals("null") == true) {
- monthTableClass[j].Price = "";
- }
- else {
- monthTableClass[j].Price = miMAPRemotemeter.GetAttributeVal(i, "gas_price");
- }
- }
- }
- monthTableClass[j].Goal = StatusDBMGR.GetRemoteMeteringTargetValue(j);
- //DebugLogOutput("가스");
- //DebugLogOutput("Homeuse: " + monthTableClass[j].Use);
- //DebugLogOutput("SamePyungUse: " + monthTableClass[j].SamePyungUse);
- break;
- case 3:
- monthTableClass[j] = new MonthTableClass("", "", "", "");
- if (miMAPRemotemeter.GetAttributeVal(i, "hotwater_used") != null) {
- if (miMAPRemotemeter.GetAttributeVal(i, "hotwater_used").equals("1000000") == true) {
- monthTableClass[j].Use = "0";
- }
- else {
- monthTableClass[j].Use = miMAPRemotemeter.GetAttributeVal(i, "hotwater_used");
- }
- }
- if (miMAPRemotemeter.GetAttributeVal(i, "hotwater_average_used_samesize") != null) {
- if (miMAPRemotemeter.GetAttributeVal(i, "hotwater_average_used_samesize").equals("null") == true) {
- monthTableClass[j].SamePyungUse = "0";
- }
- else {
- monthTableClass[j].SamePyungUse = miMAPRemotemeter.GetAttributeVal(i, "hotwater_average_used_samesize");
- }
- }
- if ((miMAPRemotemeter.GetAttributeVal(i, "hotwater_ranking_samesize") != null) && (miMAPRemotemeter.GetAttributeVal(i, "count_samesize") != null)) {
- if (miMAPRemotemeter.GetAttributeVal(i, "hotwater_ranking_samesize").equals("null") == true) {
- TempString = "- / ";
- }
- else {
- TempString = miMAPRemotemeter.GetAttributeVal(i, "hotwater_ranking_samesize") + " / ";
- }
- if (miMAPRemotemeter.GetAttributeVal(i, "count_samesize").equals("null") == true) {
- TempString = TempString + "-";
- }
- else {
- TempString = TempString + miMAPRemotemeter.GetAttributeVal(i, "count_samesize");
- }
- monthTableClass[j].Rank = TempString;
- }
- //가격정보
- if (mCostInfo_Enable == true) {
- if (miMAPRemotemeter.GetAttributeVal(i, "hotwater_price") != null) {
- if (miMAPRemotemeter.GetAttributeVal(i, "hotwater_price").equals("null") == true) {
- monthTableClass[j].Price = "";
- }
- else {
- monthTableClass[j].Price = miMAPRemotemeter.GetAttributeVal(i, "hotwater_price");
- }
- }
- }
- monthTableClass[j].Goal = StatusDBMGR.GetRemoteMeteringTargetValue(j);
- //DebugLogOutput("온수");
- //DebugLogOutput("Homeuse: " + monthTableClass[j].Use);
- //DebugLogOutput("SamePyungUse: " + monthTableClass[j].SamePyungUse);
- break;
- case 4:
- monthTableClass[j] = new MonthTableClass("", "", "", "");
- if (miMAPRemotemeter.GetAttributeVal(i, "energy_used") != null) {
- if (miMAPRemotemeter.GetAttributeVal(i, "energy_used").equals("1000000") == true) {
- monthTableClass[j].Use = "0";
- }
- else {
- monthTableClass[j].Use = miMAPRemotemeter.GetAttributeVal(i, "energy_used");
- }
- }
- if (miMAPRemotemeter.GetAttributeVal(i, "energy_average_used_samesize") != null) {
- if (miMAPRemotemeter.GetAttributeVal(i, "energy_average_used_samesize").equals("null") == true) {
- monthTableClass[j].SamePyungUse = "0";
- }
- else {
- monthTableClass[j].SamePyungUse = miMAPRemotemeter.GetAttributeVal(i, "energy_average_used_samesize");
- }
- }
- if ((miMAPRemotemeter.GetAttributeVal(i, "energy_ranking_samesize") != null) && (miMAPRemotemeter.GetAttributeVal(i, "count_samesize") != null)) {
- if (miMAPRemotemeter.GetAttributeVal(i, "energy_ranking_samesize").equals("null") == true) {
- TempString = "- / ";
- }
- else {
- TempString = miMAPRemotemeter.GetAttributeVal(i, "energy_ranking_samesize") + " / ";
- }
- if (miMAPRemotemeter.GetAttributeVal(i, "count_samesize").equals("null") == true) {
- TempString = TempString + "-";
- }
- else {
- TempString = TempString + miMAPRemotemeter.GetAttributeVal(i, "count_samesize");
- }
- monthTableClass[j].Rank = TempString;
- }
- //가격정보
- if (mCostInfo_Enable == true) {
- if (miMAPRemotemeter.GetAttributeVal(i, "energy_price") != null) {
- if (miMAPRemotemeter.GetAttributeVal(i, "energy_price").equals("null") == true) {
- monthTableClass[j].Price = "";
- }
- else {
- monthTableClass[j].Price = miMAPRemotemeter.GetAttributeVal(i, "energy_price");
- }
- }
- }
- monthTableClass[j].Goal = StatusDBMGR.GetRemoteMeteringTargetValue(j);
- //DebugLogOutput("열량");
- //DebugLogOutput("Homeuse: " + monthTableClass[j].Use);
- //DebugLogOutput("SamePyungUse: " + monthTableClass[j].SamePyungUse);
- break;
- case 5:
- monthTableClass[j] = new MonthTableClass("", "", "", "");
- if (miMAPRemotemeter.GetAttributeVal(i, "carbon_used") != null) {
- if (miMAPRemotemeter.GetAttributeVal(i, "carbon_used").equals("1000000") == true) {
- monthTableClass[j].Use = "0";
- }
- else {
- monthTableClass[j].Use = miMAPRemotemeter.GetAttributeVal(i, "carbon_used");
- }
- }
- if (miMAPRemotemeter.GetAttributeVal(i, "carbon_average_used_samesize") != null) {
- if (miMAPRemotemeter.GetAttributeVal(i, "carbon_average_used_samesize").equals("null") == true) {
- monthTableClass[j].SamePyungUse = "0";
- }
- else {
- monthTableClass[j].SamePyungUse = miMAPRemotemeter.GetAttributeVal(i, "carbon_average_used_samesize");
- }
- }
- if ((miMAPRemotemeter.GetAttributeVal(i, "carbon_ranking_samesize") != null) && (miMAPRemotemeter.GetAttributeVal(i, "count_samesize") != null)) {
- if (miMAPRemotemeter.GetAttributeVal(i, "carbon_ranking_samesize").equals("null") == true) {
- TempString = "- / ";
- }
- else {
- TempString = miMAPRemotemeter.GetAttributeVal(i, "carbon_ranking_samesize") + " / ";
- }
- if (miMAPRemotemeter.GetAttributeVal(i, "count_samesize").equals("null") == true) {
- TempString = TempString + "-";
- }
- else {
- TempString = TempString + miMAPRemotemeter.GetAttributeVal(i, "count_samesize");
- }
- monthTableClass[j].Rank = TempString;
- }
- //가격정보
- if (mCostInfo_Enable == true) {
- if (miMAPRemotemeter.GetAttributeVal(i, "carbon_price") != null) {
- if (miMAPRemotemeter.GetAttributeVal(i, "carbon_price").equals("null") == true) {
- monthTableClass[j].Price = "";
- }
- else {
- monthTableClass[j].Price = miMAPRemotemeter.GetAttributeVal(i, "carbon_price");
- }
- }
- }
- monthTableClass[j].Goal = StatusDBMGR.GetRemoteMeteringTargetValue(j);
- //DebugLogOutput("탄소");
- //DebugLogOutput("Homeuse: " + monthTableClass[j].Use);
- //DebugLogOutput("SamePyungUse: " + monthTableClass[j].SamePyungUse);
- break;
- default:
- break;
- }
- }
- }
- }
- if (result) {
- if (1 < nEnergyTypeCnt && nEnergyTypeCnt < 6) {
- Intent intent = new Intent();
- intent.setAction(define.NOTIFY_ACNAME);
- intent.putExtra(define.NOTIBR_KIND, define.NOTIFY_ENERGY_TARGET_INFO_ALARM_FROM_SERVER);
- intent.putExtra("FromWhere", "IcEnergyMgrScreen");
- if (nEnergyTypeCnt == 2) {
- elect_target = monthTableClass[0].Goal;
- elect_used = monthTableClass[0].Use;
- water_target = monthTableClass[1].Goal;
- water_used = monthTableClass[1].Use;
- }
- else if (nEnergyTypeCnt == 3) {
- elect_target = monthTableClass[0].Goal;
- elect_used = monthTableClass[0].Use;
- water_target = monthTableClass[1].Goal;
- water_used = monthTableClass[1].Use;
- gas_target = monthTableClass[2].Goal;
- gas_used = monthTableClass[2].Use;
- }
- else if (nEnergyTypeCnt == 4) {
- elect_target = monthTableClass[0].Goal;
- elect_used = monthTableClass[0].Use;
- water_target = monthTableClass[1].Goal;
- water_used = monthTableClass[1].Use;
- hotwater_target = monthTableClass[2].Goal;
- hotwater_used = monthTableClass[2].Use;
- heating_target = monthTableClass[3].Goal;
- heating_used = monthTableClass[3].Use;
- }
- else if (nEnergyTypeCnt == 5) {
- elect_target = monthTableClass[0].Goal;
- elect_used = monthTableClass[0].Use;
- water_target = monthTableClass[1].Goal;
- water_used = monthTableClass[1].Use;
- gas_target = monthTableClass[2].Goal;
- gas_used = monthTableClass[2].Use;
- hotwater_target = monthTableClass[3].Goal;
- hotwater_used = monthTableClass[3].Use;
- heating_target = monthTableClass[4].Goal;
- heating_used = monthTableClass[4].Use;
- }
- else {
- Log.w(TAG, "[LoadRemotemeterDataFromServer.ProcSuccess] Out of range!! =1 = mNumberOfEnergy -> " + nEnergyTypeCnt);
- return;
- }
- getApplicationContext().sendBroadcast(intent);
- if (bSendToMobile) sendRemotemeterDataToMobile();
- }
- else {
- Log.w(TAG, "[LoadRemotemeterDataFromServer.ProcSuccess] Out of range!! =2 = mNumberOfEnergy -> " + nEnergyTypeCnt);
- }
- return;
- }
- else {
- Log.w(TAG, "[LoadRemotemeterDataFromServer.ProcSuccess] result [" + result + "]");
- }
- }
- break;
- default:
- break;
- }
- StatusDBMGR.closeDB();
- } catch (RuntimeException re) {
- if (StatusDBMGR != null) {
- StatusDBMGR.closeDB();
- }
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- if (StatusDBMGR != null) {
- StatusDBMGR.closeDB();
- }
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- @Override
- public void ProcError() {
- Log.w(TAG, "[LoadRemotemeterDataFromServer.ProcError] Error!!!");
- }
- @Override
- public void ProcDoing() {
- Log.w(TAG, "[LoadRemotemeterDataFromServer.ProcDoing] Processing!!!");
- }
- });
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] LoadRemotemeterDataFromServer(int InputType, int Year, int Month, int Energy)");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /**
- * @description
- * 서버로 부터 데이터를 받아와 분석하고 표현하는 함수<br>
- * @param
- * //year - 연도<br>
- * @param
- * //month - 월<br>
- * @param
- * //energy - 0 전기, 1 수도, 2 가스, 3 온수, 4 열량, 5 탄소<br>
- */
- private void getTelemeringDailyUsageData(final int nYear, final int nMonth, final int nDate) {
- try {
- Log.i(TAG, "[getTelemeringDailyUsageData] nYear [" + nYear + "], nMonth [" + nMonth + "], nDate [" + nDate + "]");
- miMAPRemotemeter = new iMAPRemotemeter(getApplicationContext());
- miMAPRemotemeter.DoWork(false, true, true, true, true, true, false, false, nYear, nMonth);
- miMAPRemotemeter.SetRetCtr(new RetProci() {
- @Override
- public void ProcSuccess() {
- String strTempValue = null;
- int nEnergyTypeCnt = 5;
- try {
- boolean bResult = false;
- String strElecUsage = "", strGasUsage = "", strWaterUsage = "", strHotwaterUsage = "", strHeatingUsage = "";
- int nDataCnt = miMAPRemotemeter.SetItem("valuelist");
- if (nDataCnt != 0) {
- Log.i(TAG, "[getTelemeringDailyData] nDataCnt [" + nDataCnt + "]");
- for (int i = 0; i < nDataCnt; i++) {
- if ((Integer.parseInt(miMAPRemotemeter.GetAttributeVal(i, "year")) == nYear)
- && (Integer.parseInt(miMAPRemotemeter.GetAttributeVal(i, "month")) == nMonth)
- && (Integer.parseInt(miMAPRemotemeter.GetAttributeVal(i, "day")) == nDate)) {
- bResult = true;
- Log.i(TAG, "[getTelemeringDailyUsageData] Find!!! nYear [" + nYear + "], nMonth [" + nMonth + "], nDate [" + nDate + "]");
- for (int j = 0; j < nEnergyTypeCnt; j++) {
- if (j == 0) {
- if (miMAPRemotemeter.GetAttributeVal(i, "elect_used") != null) {
- if (miMAPRemotemeter.GetAttributeVal(i, "elect_used").equals("1000000")) {
- strElecUsage = "0";
- }
- else {
- strElecUsage = miMAPRemotemeter.GetAttributeVal(i, "elect_used");
- }
- }
- }
- else if (j == 1) {
- if (miMAPRemotemeter.GetAttributeVal(i, "water_used") != null) {
- if (miMAPRemotemeter.GetAttributeVal(i, "water_used").equals("1000000") == true) {
- strWaterUsage = "0";
- }
- else {
- strWaterUsage = miMAPRemotemeter.GetAttributeVal(i, "water_used");
- }
- }
- }
- else if (j == 2) {
- if (miMAPRemotemeter.GetAttributeVal(i, "gas_used") != null) {
- if (miMAPRemotemeter.GetAttributeVal(i, "gas_used").equals("1000000") == true) {
- strGasUsage = "0";
- }
- else {
- strGasUsage = miMAPRemotemeter.GetAttributeVal(i, "gas_used");
- }
- }
- }
- else if (j == 3) {
- if (miMAPRemotemeter.GetAttributeVal(i, "hotwater_used") != null) {
- if (miMAPRemotemeter.GetAttributeVal(i, "hotwater_used").equals("1000000") == true) {
- strHotwaterUsage = "0";
- }
- else {
- strHotwaterUsage = miMAPRemotemeter.GetAttributeVal(i, "hotwater_used");
- }
- }
- }
- else if (j == 4) {
- if (miMAPRemotemeter.GetAttributeVal(i, "energy_used") != null) {
- if (miMAPRemotemeter.GetAttributeVal(i, "energy_used").equals("1000000") == true) {
- strHeatingUsage = "0";
- }
- else {
- strHeatingUsage = miMAPRemotemeter.GetAttributeVal(i, "energy_used");
- }
- }
- }
- }
- }
- }
- if (bResult) {
- Intent mIntent = new Intent();
- mIntent.setAction(define.NOTIFY_ACNAME);
- mIntent.putExtra(define.NOTIBR_KIND, define.NOTIFY_TELEMETERING_DAILY_USAGE);
- mIntent.putExtra("elect_used", strElecUsage);
- mIntent.putExtra("water_used", strWaterUsage);
- mIntent.putExtra("gas_used", strGasUsage);
- mIntent.putExtra("hotwater_used", strHotwaterUsage);
- mIntent.putExtra("heating_used", strHeatingUsage);
- getApplicationContext().sendBroadcast(mIntent);
- }
- else {
- Log.w(TAG, "[getTelemeringDailyUsageData.ProcSuccess] bResult [" + bResult + "]");
- }
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] getTelemeringDailyData.ProcSuccess");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- @Override
- public void ProcError() {
- Log.w(TAG, "[getTelemeringDailyData.ProcError] Error!!!");
- }
- @Override
- public void ProcDoing() {
- Log.w(TAG, "[getTelemeringDailyData.ProcDoing] Processing!!!");
- }
- });
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] getTelemeringDailyData(int nYear, int nMonth)");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public void sendRemotemeterDataToMobile() {
- try {
- Log.i(TAG, "[sendRemotemeterDataToMobile] ========== START ==========");
- Intent intent = new Intent();
- intent.setAction(define.NOTIFY_ACNAME);
- intent.putExtra("KIND", define.NOTIFY_ENERGY_DATA);
- intent.putExtra(Common.ENERGY_INTENT_ENERGY_COUNT, nEnergyTypeCnt);
- intent.putExtra(Common.ENERGY_INTENT_GETDATA_TIME_YEAR, EnergyDataGetCal.get(Calendar.YEAR));
- intent.putExtra(Common.ENERGY_INTENT_GETDATA_TIME_MONTH, (EnergyDataGetCal.get(Calendar.MONTH)+1));
- intent.putExtra(Common.ENERGY_INTENT_GETDATA_TIME_DAY, EnergyDataGetCal.get(Calendar.DATE));
- intent.putExtra(Common.ENERGY_INTENT_GETDATA_TIME_HOUR, EnergyDataGetCal.get(Calendar.HOUR_OF_DAY));
- intent.putExtra(Common.ENERGY_INTENT_GETDATA_TIME_MINUTE, EnergyDataGetCal.get(Calendar.MINUTE));
- if (nEnergyTypeCnt == 2) {
- intent.putExtra(Common.ENERGY_INTENT_USE_ELECTRIC, elect_used); //전기
- intent.putExtra(Common.ENERGY_INTENT_GOAL_ELECTRIC, elect_target);
- intent.putExtra(Common.ENERGY_INTENT_USE_WATER, water_used); //수도
- intent.putExtra(Common.ENERGY_INTENT_GOAL_WATER, water_target);
- }
- else if (nEnergyTypeCnt == 3) {
- intent.putExtra(Common.ENERGY_INTENT_USE_ELECTRIC, elect_used); //전기
- intent.putExtra(Common.ENERGY_INTENT_GOAL_ELECTRIC, elect_target);
- intent.putExtra(Common.ENERGY_INTENT_USE_WATER, water_used); //수도
- intent.putExtra(Common.ENERGY_INTENT_GOAL_WATER, water_target);
- intent.putExtra(Common.ENERGY_INTENT_USE_GAS, gas_used); //가스
- intent.putExtra(Common.ENERGY_INTENT_GOAL_GAS, gas_target);
- }
- else if (nEnergyTypeCnt == 4) {
- intent.putExtra(Common.ENERGY_INTENT_USE_ELECTRIC, elect_used); //전기
- intent.putExtra(Common.ENERGY_INTENT_GOAL_ELECTRIC, elect_target);
- intent.putExtra(Common.ENERGY_INTENT_USE_WATER, water_used); //수도
- intent.putExtra(Common.ENERGY_INTENT_GOAL_WATER, water_target);
- intent.putExtra(Common.ENERGY_INTENT_USE_HOTWATER, hotwater_used); //온수
- intent.putExtra(Common.ENERGY_INTENT_GOAL_HOTWATER, hotwater_target);
- intent.putExtra(Common.ENERGY_INTENT_USE_HEATING, heating_used); //열량
- intent.putExtra(Common.ENERGY_INTENT_GOAL_HEATING, heating_target);
- }
- else if (nEnergyTypeCnt == 5) {
- intent.putExtra(Common.ENERGY_INTENT_USE_ELECTRIC, elect_used); //전기
- intent.putExtra(Common.ENERGY_INTENT_GOAL_ELECTRIC, elect_target);
- intent.putExtra(Common.ENERGY_INTENT_USE_WATER, water_used); //수도
- intent.putExtra(Common.ENERGY_INTENT_GOAL_WATER, water_target);
- intent.putExtra(Common.ENERGY_INTENT_USE_GAS, gas_used); //가스
- intent.putExtra(Common.ENERGY_INTENT_GOAL_GAS, gas_target);
- intent.putExtra(Common.ENERGY_INTENT_USE_HOTWATER, hotwater_used); //온수
- intent.putExtra(Common.ENERGY_INTENT_GOAL_HOTWATER, hotwater_target);
- intent.putExtra(Common.ENERGY_INTENT_USE_HEATING, heating_used); //열량
- intent.putExtra(Common.ENERGY_INTENT_GOAL_HEATING, heating_target);
- }
- getContext().sendBroadcast(intent);
- Log.i(TAG, "[sendRemotemeterDataToMobile] Sent ENERGY_INTENT_ BR "+define.NOTIFY_ENERGY_DATA);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] sendRemotemeterDataToMobile()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private void getTelemeteringDataOnRandomTime() {
- try {
- int DelayTime = StringUtil.GetDelayTimeBaseIP(getContext());
- if (DelayTime < 1) {
- return;
- }
- Log.i(TAG, "[getTelemeteringDataOnRandomTime] DelayTime : "+ DelayTime);
- getTelemeteringDataHandler.sendEmptyMessageDelayed(0, 1000 * DelayTime);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] getTelemeteringDataOnRandomTime()");
- LogUtil.errorLogInfo("", TAG, e);
- return;
- }
- }
- @SuppressLint("HandlerLeak")
- private Handler getTelemeteringDataHandler = new Handler() {
- @SuppressLint("HandlerLeak")
- @Override
- public void handleMessage(Message msg) {
- if (msg.what == 0) {
- getRemoteMeterDataFromServer(true);
- }
- }
- };
- boolean bTelemeteringToISS = false;
- private void checkISSEnergyType() {
- try {
- WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(getApplication());
- int nEnergyKind = mWallpadDeviceSet.Get_SmartSwitchEnergy_Kind();
- mWallpadDeviceSet.closeDB();
- if (nEnergyKind == WallpadDeviceSet.SMARTSWITCH_ENERGY_REMOTE) bTelemeteringToISS = true;
- else bTelemeteringToISS = false;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] checkISSEnergyType()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public void getRemoteMeterDataFromServer(boolean bSendToMobile) {
- try {
- nowCal = Calendar.getInstance();
- CalendarYear = nowCal.get(Calendar.YEAR);
- CalendarMonth = nowCal.get(Calendar.MONTH);
- CalendarDate = nowCal.get(Calendar.DATE);
- GetMeteringCount();
- LoadRemotemeterDataFromServer(0, CalendarYear, CalendarMonth, ShowNowEnergyIndex, bSendToMobile);
- if (bTelemeteringToISS) getTelemeringDailyUsageData(CalendarYear, CalendarMonth + 1, CalendarDate);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] getRemoteMeterDataFromServer()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private boolean getBlackoutStatus() {
- try {
- SharedPreferences mSharedPreferences = getSharedPreferences("BlackoutStatus", MODE_PRIVATE);
- return mSharedPreferences.getBoolean("status", false);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] getBlackoutStatus()");
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- private void sendBlackoutScreenRunBR() {
- try {
- Log.i(TAG, "[sendBlackoutScreenRunBR] ========== START ==========");
- Intent mIntent = new Intent(Common.BR_BLACKOUT_SCREEN_RUN, null);
- mContext.sendBroadcast(mIntent);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] sendBlackoutScreenRunBR()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /**
- * 월패드 타입 판별
- * @return bResult
- * false: 메인월패드
- * true: 서브월패드
- */
- public boolean getIsSubWallpad() {
- boolean bResult = false;
- try {
- WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(this);
- String[] DBinfo = mWallpadDeviceSet.GetSettingData("서브월패드");
- mWallpadDeviceSet.closeDB();
- if (DBinfo == null) bResult = false;
- else {
- if (DBinfo[1].indexOf("사용함") > 0) bResult = true;
- else bResult = false;
- }
- Log.d(TAG, "[getIsSubWallpad] bResult [" + bResult + "]");
- return bResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] getIsSubWallpad()");
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- /**
- * JEFF, 2020.01.14
- * 월패드 카메라의 초기화를 위한 코드 삽입
- * 월패드 카메라 preview 실행시, 최초 1회에 한하여 카메라 화면에 녹색이 보이는 증상을 해결하기 위함
- */
- /* ================================================================================================
- * 내 영상
- ================================================================================================ */
- // SurfaceLayout 구성
- RelativeLayout MyVideoLayout; // MoIP 카메라 영상
- SurfaceHolder MyVideoHolder;
- SurfaceView MyVideoSurface;
- RelativeLayout SurfaceLayout; // 영상표시 화면
- public Camera mMyCamera;
- public void toggleMyVideo() {
- try {
- if (MyVideoLayout == null) {
- Log.e(TAG, "[toggleMyVideo] Show My Video!!!");
- initMyVideoSurfaceLayout();
- }
- else {
- Log.e(TAG, "[toggleMyVideo] Remove My Video!!!");
- removeMyVideoSurfaceLayout();
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] toggleMyVideo()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public void initMyVideoSurfaceLayout() {
- try {
- // LOG_INFO("[initMyVideoSurfaceLayout] MyVideoLayout = " + MyVideoLayout);
- if (MyVideoLayout != null) {
- MyVideoSurface.getHolder().removeCallback(MyVideoCallback);
- MyVideoLayout.removeAllViews();
- MyVideoLayout = null;
- }
- MyVideoLayout = new RelativeLayout(mContext);
- WpadUtil.LayoutRegistration(SurfaceLayout, MyVideoLayout, 1024, 600, 0, 0, ID.MAINACTIVITY.LAYOUT.MYVIDEO);
- MyVideoSurface = new SurfaceView(mContext);
- MyVideoHolder = MyVideoSurface.getHolder();
- WpadRelativeLayoutParams MyVideoParams = new WpadRelativeLayoutParams(320, 240);
- // MyVideoParams.setMargins(10, 10, 0, 0); // 보이게
- MyVideoParams.setMargins(1300, 112, 0, 0); // 안보이게
- MyVideoLayout.addView(MyVideoSurface, MyVideoParams);
- MyVideoSurface.getHolder().addCallback(MyVideoCallback);
- MyVideoSurface.setZOrderOnTop(true);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] initMyVideoSurfaceLayout()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public void removeMyVideoSurfaceLayout() {
- try {
- Log.i(TAG, "[removeMyVideoSurfaceLayout] MyVideoLayout = " + MyVideoLayout);
- if (MyVideoLayout != null) {
- MyVideoLayout.removeAllViews();
- MyVideoLayout = null;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] removeRemoteVideoSurfaceLayout()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private SurfaceHolder.Callback MyVideoCallback = new SurfaceHolder.Callback() {
- @Override
- public void surfaceCreated(SurfaceHolder holder) {
- try {
- Log.i(TAG, "[MyVideoCallback] surfaceCreated!!");
- if (Common.CurrentBoardType == Common.BOARD_TYPE.V40 || Common.CurrentBoardType == Common.BOARD_TYPE.V40_NOUGAT) {
- mIOInterface.ctrlWallPadCamPower(true);
- mMyCamera = Camera.open(Camera.CameraInfo.CAMERA_FACING_FRONT);
- Camera.Parameters params = mMyCamera.getParameters();
- params.setPictureSize(320, 240);
- mMyCamera.setParameters(params);
- mMyCamera.setPreviewDisplay(holder);
- } else {
- Log.w(TAG, "[MyVideoCallback] surfaceCreated!! -> NOT Supported Common.CurrentBoardType [" + Common.CurrentBoardType + "]");
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] MyVideoCallback -> surfaceCreated(SurfaceHolder holder)");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- @Override
- public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
- try {
- Log.i(TAG, "[MyVideoCallback] surfaceChanged!!");
- if (Common.CurrentBoardType == Common.BOARD_TYPE.V40 || Common.CurrentBoardType == Common.BOARD_TYPE.V40_NOUGAT) {
- mMyCamera.startPreview();
- } else {
- Log.w(TAG, "[MyVideoCallback] surfaceChanged!! -> NOT Supported Common.CurrentBoardType [" + Common.CurrentBoardType + "]");
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] MyVideoCallback -> surfaceChanged(SurfaceHolder holder, int format, int width, int height)");
- LogUtil.errorLogInfo("", TAG, e);
- // if (getWallPadCameraUsage()) sendHandlerMsgDelayed(HANDLERMSG.CHECK_WALLPAD_CAMERA_RESET, 0, 0, 3000); // 3초후 카메라 서비스를 재실행한다.
- }
- }
- @Override
- public void surfaceDestroyed(SurfaceHolder holder) {
- try {
- Log.i(TAG, "[MyVideoCallback] surfaceDestroyed!!");
- if (Common.CurrentBoardType == Common.BOARD_TYPE.V40 || Common.CurrentBoardType == Common.BOARD_TYPE.V40_NOUGAT) {
- mIOInterface.ctrlWallPadCamPower(false);
- if (mMyCamera != null) {
- mMyCamera.stopPreview();
- mMyCamera.release();
- mMyCamera = null;
- }
- } else {
- Log.w(TAG, "[MyVideoCallback] surfaceDestroyed!! -> NOT Supported Common.CurrentBoardType [" + Common.CurrentBoardType + "]");
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] MyVideoCallback -> surfaceDestroyed(SurfaceHolder holder)");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- };
- private boolean getWallPadCameraUsage() {
- boolean bResult = false;
- try {
- WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(this.getContext());
- int nResult = mWallpadDeviceSet.GetDeviceSetted("월패드카메라");
- mWallpadDeviceSet.closeDB();
- if (nResult == WallpadDeviceSet.DEV_DATA_ENABLE) bResult = true;
- else bResult = false;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] getWallPadCameraUsage()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- Log.i(TAG, "[getWallPadCameraUsage] bResult [" + bResult + "]");
- return bResult;
- }
- private void forceCtrlStrangerRecordingUserSettingDisable(boolean bEnable) {
- try {
- WallpadStatusData DBMGR = new WallpadStatusData(getContext());
- DBMGR.SetStrangerRecordingOnOff(bEnable);
- DBMGR.closeDB();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] forceCtrlStrangerRecordingUserSettingDisable(boolean bEnable)");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private void registerLCDKeeper() {
- try {
- Log.i(TAG, "[registerLCDKeeper] ===== START =====");
- if (!bLCDKeeperUsage) {
- Log.w(TAG, "[registerLCDKeeper] bLCDKeeperUsage is false!!!");
- return;
- }
- if (Build.VERSION.SDK_INT < 24) {
- Log.w(TAG, "[registerLCDKeeper] not support LCDKeeper!! Build.VERSION.SDK_INT -> " + Build.VERSION.SDK_INT);
- return;
- }
- IMG_LCD_KEEPER = (ImageView) findViewById(R.id.view_lcdkeeper);
- IMG_LCD_KEEPER.setVisibility(View.INVISIBLE);
- Log.i(TAG, "[registerLCDKeeper] ===== END =====");
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] registerLCDKeeper()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- int LCDKEEPER_MODE_NONE = 0; // 동작중 아님
- int LCDKEEPER_MODE_RESTROE = 1; // 복구모드
- int LCDKEEPER_MODE_PROTECT = 2; // 보호모드
- boolean bLCDBacklightPower = true; // LCD backlight on/off 여부 (true: on, false: off)
- int nLCDKeeperRunMode = LCDKEEPER_MODE_NONE; // LCD Keeper 동작 모드 (0: 동작중 아님, 1: 복구모드, 2: 예방모드)
- private void runLCDKeeper(int nKeeperMode) {
- try {
- if (!bLCDKeeperUsage) {
- Log.w(TAG, "[registerLCDKeeper] bLCDKeeperUsage is false!!!");
- return;
- }
- Log.i(TAG, "[runLCDKeeper] nKeeperMode [" + nKeeperMode +"], bLCDBacklightPower [" + bLCDBacklightPower +"]");
- if (Build.VERSION.SDK_INT < 24) {
- Log.w(TAG, "[registerLCDKeeper] not support LCDKeeper!! Build.VERSION.SDK_INT -> " + Build.VERSION.SDK_INT);
- return;
- }
- if (IMG_LCD_KEEPER == null) {
- Log.w(TAG, "[runLCDKeeper] IMG_LCD_KEEPER is null!!");
- return;
- }
- // check run mode
- if (nLCDKeeperRunMode == nKeeperMode) {
- // already run LCDKeeper!!
- Log.w(TAG, "[runLCDKeeper] LCD Keeper mode is same -> Asis [" + nLCDKeeperRunMode + "], Tobe [" + nKeeperMode + "]");
- return;
- }
- nLCDKeeperRunMode = nKeeperMode;
- if (nKeeperMode == LCDKEEPER_MODE_NONE) {
- IMG_LCD_KEEPER.setVisibility(View.INVISIBLE);
- }
- else if (nKeeperMode == LCDKEEPER_MODE_RESTROE) {
- if (Common.SCREEN_TYPE == Common.SCREEN_TYPE_1280x800) {
- Glide.with(this).asGif().load(R.drawable.lcd_restore_1280).diskCacheStrategy(DiskCacheStrategy.RESOURCE).into(IMG_LCD_KEEPER);
- }
- else {
- Glide.with(this).asGif().load(R.drawable.lcd_restore_1024).diskCacheStrategy(DiskCacheStrategy.RESOURCE).into(IMG_LCD_KEEPER);
- }
- IMG_LCD_KEEPER.setVisibility(View.VISIBLE);
- }
- else if (nKeeperMode == LCDKEEPER_MODE_PROTECT) {
- IMG_LCD_KEEPER.setBackgroundColor(Color.BLACK);
- IMG_LCD_KEEPER.setVisibility(View.VISIBLE);
- }
- else {
- Log.w(TAG, "[runLCDKeeper] Not supported mode!! -> " + nKeeperMode);
- IMG_LCD_KEEPER.setVisibility(View.INVISIBLE);
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] runLCDKeeper(int nKeeperMode)");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private void ctrlLCDKeeper() {
- try {
- if (!bLCDKeeperUsage) {
- Log.w(TAG, "[ctrlLCDKeeper] bLCDKeeperUsage is false!!");
- return;
- }
- if (Build.VERSION.SDK_INT < 24) {
- Log.w(TAG, "[ctrlLCDKeeper] not support LCDKeeper!! Build.VERSION.SDK_INT -> " + Build.VERSION.SDK_INT);
- return;
- }
- if (IMG_LCD_KEEPER == null) {
- Log.w(TAG, "[ctrlLCDKeeper] IMG_LCD_KEEPER is null!!");
- return;
- }
- Log.i(TAG, "[ctrlLCDKeeper] bLCDBacklightPower [" + bLCDBacklightPower +"]");
- if (bLCDBacklightPower) {
- // backlight on시 lcd keeper를 비활성화 한다.
- runLCDKeeper(LCDKEEPER_MODE_NONE);
- }
- else {
- if (nLCDKeeperType == WallpadDeviceSet.LCDKEEPER_PROTECT) {
- // LCD backlight off시, LCD protect 화면을 구동한다.
- runLCDKeeper(LCDKEEPER_MODE_PROTECT);
- }
- else if (nLCDKeeperType == WallpadDeviceSet.LCDKEEPER_RECOVER) {
- // LCD backlight off시, LCD restore 화면을 구동한다.
- runLCDKeeper(LCDKEEPER_MODE_RESTROE);
- }
- else if (nLCDKeeperType == WallpadDeviceSet.LCDKEEPER_PROTECT_RECOVER) {
- // 새벽 2:00 ~ 3:59까지 LCD restore 화면을 구동하고, 나머지 시간에는 LCD protect 화면을 구동한다.
- // 화면에 스모그 또는 미러 글라스 적용이 아닌 경우에는 LCD 보호모드(블랙)만 사용을 권장한다. (LCD RGBW rolling시 컬러가 화면에 비침)
- Calendar LCDCal = Calendar.getInstance();
- int nYear = LCDCal.get(Calendar.YEAR);
- int nMonth = LCDCal.get(Calendar.MONTH) + 1;
- int nDay = LCDCal.get(Calendar.DAY_OF_MONTH);
- int nHour = LCDCal.get(Calendar.HOUR_OF_DAY);
- Log.i(TAG, "[ctrlLCDKeeper] nYear [" + nYear +"], nMonth [" + nMonth +"], nDay [" + nDay +"], nHour [" + nHour +"]");
- if (3 >= nHour && nHour >= 2) {
- // 새벽 2:00 ~ 3:59까지 LCD restore 화면을 구동한다.
- runLCDKeeper(LCDKEEPER_MODE_RESTROE);
- }
- else {
- // 새벽 2:00 ~ 3:59 이외의 시간에는 LCD protect 화면을 구동한다.
- if (nYear == 2020 && ((nMonth < 8 && nDay < 20) || (nMonth < 7))) {
- // 단, 이미 증상이 발생한 현장의 LCD 복구를 위해 2020년 7월 19일까지는 protection 화면 대신 restore 화면을 구동한다.
- runLCDKeeper(LCDKEEPER_MODE_RESTROE);
- }
- else {
- runLCDKeeper(LCDKEEPER_MODE_PROTECT);
- }
- }
- }
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] ctrlLCDKeeper()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private boolean checkTranslucentGlassUsage() {
- try {
- if (Version.getModelType() == MODEL_TYPE.IHN_D101 || Version.getModelType() == MODEL_TYPE.IHN_D101_I || Version.getModelType() == MODEL_TYPE.IHN_D101_I_LX2
- || Version.getModelType() == MODEL_TYPE.IHN_D101K || Version.getModelType() == MODEL_TYPE.IHN_D101K_I
- || Version.getModelType() == MODEL_TYPE.IHN_1010 || Version.getModelType() == MODEL_TYPE.IHN_1010_I || Version.getModelType() == MODEL_TYPE.IHN_1010_I_LX2
- || Version.getModelType() == MODEL_TYPE.IHN_1010GL || Version.getModelType() == MODEL_TYPE.IHN_1010GL_I
- || Version.getModelType() == MODEL_TYPE.IHN_1010GL_I_2443 || Version.getModelType() == MODEL_TYPE.IHN_1010GL_I_6410
- || Version.getModelType() == MODEL_TYPE.IHN_T1010 || Version.getModelType() == MODEL_TYPE.IHN_T1010_I
- || Version.getModelType() == MODEL_TYPE.IHN_1303_I || Version.getModelType() == MODEL_TYPE.IHN_D101_I_OCF) {
- return true;
- }
- else return false;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] checkTranslucentGlassUsage()");
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- /**
- * LCD backlight off시 센서값 keyevent가 발생하지 않는 증상 해결을 위한 임시코드
- * 우선 IHN-1020B-I에만 적용 후, 결과를 보고 다른 일체형 월패드에도 적용 예정
- * Jeff, 2020.09.07
- * @return true: LCD backlight On, false: LCD backlight Off
- */
- public boolean checkLCDOnByCMD() {
- try {
- Runtime mRuntime = Runtime.getRuntime();
- Process mProcess;
- String cmd = "getprop persist.sys.lcdcon";
- mProcess = mRuntime.exec(cmd);
- BufferedReader br = new BufferedReader(new InputStreamReader(mProcess.getInputStream()));
- String line;
- String strResult = null;
- while ((line = br.readLine()) != null) {
- strResult = line;
- }
- if(strResult!=null)
- {
- if (strResult.equals("0")) {
- Log.e(TAG, "[checkLCDOnByCMD] LCD On");
- return true;
- }
- else if (strResult.equals("1")) {
- Log.e(TAG, "[checkLCDOnByCMD] LCD Off");
- return false;
- }
- else {
- Log.e(TAG, "[checkLCDOnByCMD] Unknown value [" + strResult + "], return false!!!");
- return false;
- }
- }
- else return false;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] checkLCDOnByCMD()");
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- /**
- * 절전모드에서 백라이트를 키는 경우, BSP에서 PowerManager 또는 속성값으로 상태를 구분하는데
- * BSP 버전에 따라 상이하게 동작하므로 BSP 버전 구분하여 절전모드 판별 필요
- * @return true: 기준 BSP 이후 버전, false: 기준 BSP 이전 버전
- */
- public boolean getCompareBSPVersion(String strVer) {
- try {
- StringBuilder strBSPVersion = new StringBuilder();
- StringBuffer sysInfoBuffer = new StringBuffer();
- sysInfoBuffer.append(Build.DISPLAY);
- strBSPVersion.append(sysInfoBuffer.toString());
- String result = strBSPVersion.toString();
- Log.d(TAG, "[getCompareBSPVersion] result [" + result + "]");
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy.MM.dd");
- Date date = simpleDateFormat.parse(result);
- Date standardDate = simpleDateFormat.parse(strVer); // 비교 기준 BSP 버전
- if (date.compareTo(standardDate) >= 0) {
- Log.d(TAG, "[getCompareBSPVersion] BSP VERSION OVER!");
- return true;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] getCompareBSPVersion()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- return false;
- }
- /**
- * 월패드 부팅시 카메라서비스 로딩이 실패하는 경우가 생겨 카메라 화면이 안나오는 경우 발생
- * WallPadMain에서 부팅시 카메라를 확인하여 Exception이 발생하는 경우
- * 카메라 서비스를 재실행한다.
- * (Edited by jeff, 2020.09.08)
- */
- public void resetCameraService() {
- try {
- Log.e(TAG, "[resetCameraService] start!!");
- Runtime mRuntime = Runtime.getRuntime();
- String cmd = "setprop persist.sys.fakeactivitydel 1";
- mRuntime.exec(cmd);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] resetCameraService()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /**
- * 월패드 부팅시 카메라서비스 로딩이 실패하는 경우가 발생하여
- * 카메라서비스 정상동작 여부를 확인하기위한 함수를 정의한다.
- * 카메라서비스 정상: 정상적으로 카메라가 open되며, camera object가 null이 아니면 카메라를 release한다.
- * 카메라 서비스 비정상: 카메라 open시 Exception이 발생하며 resetCameraService() 함수를 실행하여 카메라서비스를 재실행한다.
- * (Edited by jeff, 2020.09.08)
- */
- public void checkCameraLoading() {
- try {
- Camera checkCamera = Camera.open();
- if (checkCamera != null) {
- Log.e(TAG, "[checkCameraLoading] checkCamera is not null!!");
- checkCamera.release();
- }
- else {
- Log.e(TAG, "[checkCameraLoading] checkCamera is null!!");
- resetCameraService();
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- resetCameraService();
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] checkCameraLoading()");
- LogUtil.errorLogInfo("", TAG, e);
- resetCameraService();
- }
- }
- private synchronized void FileDelete(File file)
- {
- if(file!=null && file.exists())
- {
- file.delete();
- }
- }
- /***************************************************************************************
- * 거동수상자 녹화 시나리오 수정 (통화 앱 => 메인 앱에서 녹화)
- * > 거동수상자 발생시 반투명 이미지 위에 거동수상자 녹화중 문구 표기 + 화면보기 버튼
- * > 화면보기 버튼 클릭시 숨어있던 영상 (SurfaceView) 이동 (사용자에게 보이도록)
- **************************************************************************************/
- public boolean getStrangerRecordingManagerSetting() {
- boolean bResult = false;
- WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(getApplicationContext());
- try {
- int[] nFrontCam = mWallpadDeviceSet.Get_RFDoorCAM_Info();
- boolean bRecord = mWallpadDeviceSet.Get_Stranger_RecordUse();
- mWallpadDeviceSet.closeDB();
- if (nFrontCam[0] == 1) {
- if (nFrontCam[1] == WallpadDeviceSet.DOORTYPE_IOT_SMART || nFrontCam[1] == WallpadDeviceSet.DOORTYPE_HYOSUNG_SMART || nFrontCam[1] == WallpadDeviceSet.DOORTYPE_DAEWOO_SMART) {
- if (bRecord) bResult = true;
- else bResult = false;
- }
- else bResult = false;
- }
- else bResult = false;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- mWallpadDeviceSet.closeDB();
- }
- catch (Exception e) {
- mWallpadDeviceSet.closeDB();
- Log.e(TAG, "[Exception] getStrangerRecordingManagerSetting()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- Log.d(TAG, "[getStrangerRecordingManagerSetting] bResult [" + bResult + "]");
- return bResult;
- }
- private boolean getStrangerRecordingUserSetting() {
- boolean bResult = false;
- WallpadStatusData DBMGR = new WallpadStatusData(this);
- try {
- bResult = DBMGR.GetStrangerRecordingOnOff();
- DBMGR.closeDB();
- Log.d(TAG, "[getStrangerRecordingUserSetting] bResult [" + bResult + "]");
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- DBMGR.closeDB();
- bResult = false;
- }
- catch (Exception e) {
- DBMGR.closeDB();
- Log.e(TAG, "[Exception] getStrangerRecordingUserSetting()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- bResult = false;
- }
- return bResult;
- }
- private void registerNoticeStrangerRecord() {
- try {
- Log.d(TAG, "[registerNoticeStrangerRecord]");
- IMG_NOTICE_STRANGER_RECORD = (ImageView) findViewById(R.id.view_noticerecord);
- IMG_NOTICE_STRANGER_RECORD.setVisibility(View.INVISIBLE);
- IMG_NOTICE_STRANGER_RECORD.setClickable(true);
- TXT_NOTICE_STRANGER_RECORD = (TextView) findViewById(R.id.text_noticerecord);
- TXT_NOTICE_STRANGER_RECORD.setVisibility(View.INVISIBLE);
- BTN_STRANGER_RECORD_VIEW = (Button) findViewById(R.id.btn_noticerecord_ok);
- BTN_STRANGER_RECORD_VIEW.setVisibility(View.INVISIBLE);
- BTN_STRANGER_RECORD_VIEW.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- Log.d(TAG, "BTN_STRANGER_RECORD_VIEW Click!!");
- showFrontVideo(true);
- }
- });
- BTN_STRANGER_RECORD_CANCEL = (Button) findViewById(R.id.btn_noticerecord_cancel);
- BTN_STRANGER_RECORD_CANCEL.setVisibility(View.INVISIBLE);
- BTN_STRANGER_RECORD_CANCEL.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- Log.d(TAG, "BTN_STRANGER_RECORD_CANCEL Click!!");
- stopStrangerRecord(false);
- showFrontCam(false);
- runNoticeStrangerRecord(false);
- Intent intent = new Intent(); // 녹화 종료 BR 전송
- intent.setAction(define.NOTIFY_ACNAME);
- intent.putExtra(define.NOTIBR_KIND, define.NOTIFY_FINISH_RECORD_STRANGER);
- getApplicationContext().sendBroadcast(intent);
- intent.setAction(Common.BR_MAIN_NOTI.ACNAME_MAIN_NOTI);
- intent.putExtra(Common.BR_MAIN_NOTI.KIND, Common.BR_MAIN_NOTI.APK_EXIT_MAIN_CHECK);
- getApplicationContext().sendBroadcast(intent);
- }
- });
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] registerNoticeStrangerRecord()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private void runNoticeStrangerRecord(boolean bRun) {
- try {
- Log.d(TAG, "[runNoticeStrangerRecord] === START === bRun [" + bRun + "]");
- if (IMG_NOTICE_STRANGER_RECORD == null || TXT_NOTICE_STRANGER_RECORD == null || BTN_STRANGER_RECORD_VIEW == null || BTN_STRANGER_RECORD_CANCEL == null) {
- Log.w(TAG, "[runNoticeStrangerRecord] NoticeView is null!!");
- registerNoticeStrangerRecord();
- }
- if (bRun) {
- IMG_NOTICE_STRANGER_RECORD.setVisibility(View.VISIBLE);
- TXT_NOTICE_STRANGER_RECORD.setVisibility(View.VISIBLE);
- BTN_STRANGER_RECORD_VIEW.setVisibility(View.VISIBLE);
- BTN_STRANGER_RECORD_CANCEL.setVisibility(View.VISIBLE);
- } else {
- IMG_NOTICE_STRANGER_RECORD.setVisibility(View.INVISIBLE);
- TXT_NOTICE_STRANGER_RECORD.setVisibility(View.INVISIBLE);
- BTN_STRANGER_RECORD_VIEW.setVisibility(View.INVISIBLE);
- BTN_STRANGER_RECORD_CANCEL.setVisibility(View.INVISIBLE);
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] runNoticeStrangerRecord()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- // 영상 녹화 시작
- private boolean startStrangerRecord() {
- try {
- Log.d(TAG, "[startStrangerRecord] bRecordStatus [" + bRecordStatus + "]");
- if (mRecordTimer != null) {
- mRecordTimer.cancel();
- mIOInterface.ctrlLcdWakeUp(); // 녹화 시작시 LCD On
- WallpadStatusData SetData = new WallpadStatusData(mContext);
- boolean soundOut = SetData.GetSoundOutputOfEventAlarm();
- SetData.closeDB();
- if (soundOut) Sound().Play(SND.effect.EFFECT1);
- // 녹화 시작
- if (getRemoteCallUse()) sendHandlerMsgDelayed(HANDLERMSG.MEDIA_RECORD_START_REMOTECALL, 0, 0, 0);
- else sendHandlerMsgDelayed(HANDLERMSG.MEDIA_RECORD_START, 0, 0, 0);
- return true;
- } else Log.w(TAG, "[startStrangerRecord] mRecordTime is null!");
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] startStrangerRecord()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- return false;
- }
- /** 영상 녹화 종료
- * - 녹화 중 문열림 발생시 영상을 저장하지 않으므로 임시 폴더에 저장 후 추후 판별함
- * @param bTemp 임시 폴더 저장 여부
- */
- private void stopStrangerRecord(boolean bTemp) {
- try {
- Log.d(TAG, "[stopStrangerRecord] bRecordStatus [" + bRecordStatus + "], bTemp [" + bTemp + "]");
- if (bRecordStatus) {
- bRecordStatus = false;
- mediaStopRecord();
- if (mCurRecordTime <= 3) {
- File tempFile = new File(VIDEO_TEMP_PATH);
- if (tempFile.isFile()) {
- tempFile.delete();
- }
- }
- saveStrangerRecordFile(bTemp);
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] stopStrangerRecord(boolean bSave)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- // 영상 녹화 파일 저장
- private void saveStrangerRecordFile(boolean bTemp) {
- try {
- Log.d(TAG, "[saveStrangerRecordFile] bTemp [" + bTemp + "]");
- if (!getRemoteCallUse()) { // 방문객원격통화를 사용하는 경우에는 월패드에서 파일 저장하지 않음
- reOrderRecordFile(); // 최신순으로 정렬하여 오래된 영상 삭제
- File tempFile = new File(VIDEO_TEMP_PATH);
- Calendar data = Calendar.getInstance();
- String strDate = String.format("%04d%02d%02d", data.get(Calendar.YEAR), data.get(Calendar.MONTH) + 1, data.get(Calendar.DATE));
- int nHour = 0;
- if (data.get(Calendar.AM_PM) == 1) nHour = 12;
- String strTime = String.format("%02d%02d%02d", data.get(Calendar.HOUR) + nHour, data.get(Calendar.MINUTE), data.get(Calendar.SECOND));
- String strPath = "";
- if (bTemp) strPath = VISITOR_VIDEO_TEMP_PATH + "VisitorVideo_" + strDate + "_" + strTime + ".mp4";
- else strPath = VISITOR_VIDEO_PATH + "VisitorVideo_" + strDate + "_" + strTime + ".mp4";
- File recordingFile = new File(strPath);
- if (tempFile.isFile()) moveRecordFile(tempFile, recordingFile);
- }
- Intent intent = new Intent(); // 녹화 종료 BR 전송
- intent.setAction(define.NOTIFY_ACNAME);
- intent.putExtra(define.NOTIBR_KIND, define.NOTIFY_FINISH_RECORD_STRANGER);
- getContext().sendBroadcast(intent);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] saveRecordingFile()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private void moveRecordFile(File fOri, File fTarget) {
- try {
- Log.d(TAG, "[moveRecordFile] fOri.getPath [" + fOri.getPath() + "], fTarget.getPath [" + fTarget.getPath() + "]");
- if (!fTarget.isFile()) {
- File fParent = new File(fTarget.getParent());
- if (!fParent.exists()) {
- fParent.mkdir();
- }
- } else Log.w(TAG, "[moveRecordFile] " + fTarget.getPath() + " is not File!!");
- fOri.renameTo(fTarget);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] moveRecordFile(File fOri, File fTarget)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private void reOrderRecordFile() {
- try {
- String MAKE_BESTIN_PATH = define.BESTIN_LOCATION;
- File makeFolder = new File(MAKE_BESTIN_PATH);
- if (!makeFolder.isDirectory()) {
- boolean bRet = makeFolder.mkdir();
- Log.d(TAG, "[reOrderRecordFile] makeFolder [bRet1] " + bRet);
- }
- makeFolder = new File(VISITOR_VIDEO_PATH);
- if (!makeFolder.isDirectory()) {
- boolean bRet = makeFolder.mkdir();
- Log.d(TAG, "[reOrderRecordFile] makeFolder [bRet2] " + bRet);
- }
- File folderCheck = new File(VISITOR_VIDEO_PATH);
- if (folderCheck.isDirectory()) {
- File[] arrFile = folderCheck.listFiles();
- if (arrFile != null) {
- if (arrFile.length < VISITOR_VIDEO_MAX_COUNT) return;
- else {
- Date[] tempFile = new Date[arrFile.length];
- Log.d(TAG, "[reOrderRecordFile(1)] arrFile.length [" + arrFile.length + "]");
- for (int i = 0; i < arrFile.length; i++) {
- File file = arrFile[i];
- int startPos = file.getName().indexOf("_");
- int endPos = file.getName().indexOf(".");
- String strDate = file.getName().substring(startPos + 1, endPos).replace("_", "");
- Calendar calendar = Calendar.getInstance();
- calendar.set(Integer.parseInt(strDate.substring(0, 4)), Integer.parseInt(strDate.substring(4, 6)), Integer.parseInt(strDate.substring(6, 8)), Integer.parseInt(strDate.substring(8, 10)), Integer.parseInt(strDate.substring(10, 12)), Integer.parseInt(strDate.substring(12, 14)));
- tempFile[i] = calendar.getTime();
- }
- Date min = tempFile[0];
- int idx = 0;
- for (int i = 0; i < tempFile.length; i++) {
- if (tempFile[i].compareTo(min) < 0) {
- idx = i;
- Log.d(TAG, "[reOrderRecordFile] idx [" + idx + "]");
- }
- }
- File file = new File(arrFile[idx].getPath());
- if (file.isFile()) {
- file.delete();
- Log.d(TAG, "[reOrderRecordFile] FILE [" + arrFile[idx].getPath() + "] is deleted!!");
- }
- }
- }
- } else {
- Log.w(TAG, "[reOrderRecordFile] " + folderCheck.getPath() + " is not directory!!");
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] reOrderRecordFile()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /**
- * 임시 폴더에 있는 거동수상자 영상 삭제
- * 현관 통화 중 문열림 발생시 영상 삭제
- */
- private void deleteTempRecordFile() {
- try {
- Log.d(TAG, "[deleteTempRecordFile]");
- File folder = new File(VISITOR_VIDEO_TEMP_PATH);
- if (folder.exists()) {
- File[] listFiles = folder.listFiles();
- int fileCnt = listFiles.length;
- Log.d(TAG, "[deleteTempRecordFile] fileCnt [" + fileCnt + "]");
- for (int i = 0; i < fileCnt; i++) {
- Log.d(TAG, "[deleteTempRecordFile] listFiles [" + i + "] is deleted!!!");
- listFiles[i].delete();
- }
- if (folder.isDirectory()) {
- Log.d(TAG, "[deleteTempRecordFile] Directory Deleted!!!");
- folder.delete();
- }
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] deleteTempRecordFile()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /**
- * 임시 폴더에 있는 거동수상자 영상 옮기기
- * 현관 통화가 문열림 없이 종료되는 경우 임시 폴더에서 일반 폴더로 파일 이동
- */
- private void moveTempRecordFile() {
- try {
- Log.d(TAG, "[moveTempRecordFile]");
- File tempFolder = new File(VISITOR_VIDEO_TEMP_PATH);
- if (tempFolder.exists()) {
- File[] listFiles = tempFolder.listFiles();
- int fileCnt = listFiles.length;
- Log.d(TAG, "[moveTempRecordFile] fileCnt [" + fileCnt + "]");
- for (int i = 0; i < fileCnt; i++) {
- String filePath = listFiles[i].getPath().replace("/temp", "");
- Log.d(TAG, "[moveTempRecordFile] filePath [" + filePath + "]");
- File file = new File(filePath);
- listFiles[i].renameTo(file);
- }
- if (tempFolder.isDirectory()) {
- Log.d(TAG, "[moveTempRecordFile] Directory Deleted!!!");
- tempFolder.delete();
- }
- } else {
- Log.w(TAG, "[moveTempRecordFile] " + VISITOR_VIDEO_TEMP_PATH + " directory not exist!!!");
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] moveTempRecordFile()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- // 영상 녹화시간 타이머 구동
- private void checkRecordTimer() {
- try {
- WallpadStatusData DBMGR = new WallpadStatusData(getContext());
- RECORD_TIME = DBMGR.GetSmartDoorCamRecordTime();
- DBMGR.closeDB();
- Log.d(TAG, "[checkRecordTimer] RECORD_TIME [" + RECORD_TIME + "]");
- mCurRecordTime = 0;
- if (RECORD_TIME > 0) {
- mRecordTimer = new CountDownTimer((RECORD_TIME + 1) * 1000, 1000) {
- @Override
- public void onTick(long millisUntilFinished) {
- if (bRecordStatus) {
- mCurRecordTime++;
- Log.d(TAG, "[checkRecordTimer] mCurRecordTime [" + mCurRecordTime + "]");
- }
- }
- @Override
- public void onFinish() {
- Log.d(TAG, "[checkRecordTimer] onFinish!! bRemoteCall [" + getRemoteCallUse() + "]");
- if (getRemoteCallUse()) {
- mediaStopRecord();
- showFrontCam(false);
- } else {
- stopStrangerRecord(false);
- showFrontCam(false);
- runNoticeStrangerRecord(false);
- }
- Intent intent = new Intent(); // 녹화 종료 BR 전송
- intent.setAction(define.NOTIFY_ACNAME);
- intent.putExtra(define.NOTIBR_KIND, define.NOTIFY_FINISH_RECORD_STRANGER);
- getApplicationContext().sendBroadcast(intent);
- intent.setAction(Common.BR_MAIN_NOTI.ACNAME_MAIN_NOTI);
- intent.putExtra(Common.BR_MAIN_NOTI.KIND, Common.BR_MAIN_NOTI.APK_EXIT_MAIN_CHECK);
- getApplicationContext().sendBroadcast(intent);
- }
- };
- } else {
- Log.w(TAG, "[checkRecordTimer] Invalid RECORD TIME!! [" + RECORD_TIME + "]");
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] checkRecordTimer()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- // 영상 녹화 타이머 해제
- private void resetRecordTimer() {
- try {
- Log.d(TAG, "[resetRecordTimer]");
- if (mRecordTimer != null) {
- mRecordTimer.cancel();
- mRecordTimer = null;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] resetRecordTimer()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private void mediaStartRecord() {
- try {
- Log.d(TAG, "[mediaStartRecord]");
- if (mMediaRecorder != null) {
- mMediaRecorder.stop();
- mMediaRecorder.reset();
- mMediaRecorder.release();
- mMediaRecorder = null;
- }
- mFrontCamOpenCheckHandler.sendEmptyMessage(0); // camera open check 이후 녹화 시작
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG,re);
- bRecordStatus = false;
- } catch (Throwable t) {
- bRecordStatus = false;
- Log.e(TAG, "[Exception] mediaStartRecord()");
- //t.printStackTrace();
- LogUtil.errorLogInfo("", TAG, t);
- }
- }
- private void mediaStopRecord() {
- try {
- Log.d(TAG, "[mediaStopRecord]");
- bRecordDelay = true;
- Message msg = recordDelayHandler.obtainMessage();
- recordDelayHandler.sendMessageDelayed(msg, 90 * 1000); // 녹화 종료 후 1분 30초 동안 녹화를 막는다.
- bRecordStatus = false; // 녹화 종료
- resetRecordTimer();
- if (mMediaRecorder != null) {
- mMediaRecorder.stop();
- mMediaRecorder.reset();
- mMediaRecorder.release();
- mMediaRecorder = null;
- }
- showFrontVideo(false);
- FrontVideoLayout.removeView(FrontVideoSurface);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] mediaStopRecord()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- // 영상 오류 발생하였을 경우 설정 초기화
- private void resetRecordSetting() {
- try {
- Log.d(TAG, "[resetRecordSetting]");
- runNoticeStrangerRecord(false);
- if (mMediaRecorder != null) {
- mMediaRecorder.release();
- mMediaRecorder = null;
- }
- resetRecordTimer();
- bRecordStatus = false;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] resetRecordSetting()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- // 현관카메라 종류
- private int getDoorCamType() {
- int doorCamType = WallpadDeviceSet.DOORTYPE_NONE;
- try {
- WallpadDeviceSet deviceSet = new WallpadDeviceSet(getContext());
- int[] anFrontCameraType = deviceSet.Get_RFDoorCAM_Info(); // 현관카메라 종류
- deviceSet.closeDB();
- if (anFrontCameraType != null) {
- doorCamType = anFrontCameraType[1];
- Log.d(TAG, "[mFrontCamOpenCheckHandler] doorCamType [" + doorCamType + "]");
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] getDoorCamType()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- return doorCamType;
- }
- // 현관카메라 거동수상자 감지시간
- private byte getSmartDoorCamDuration() {
- try {
- WallpadDeviceSet wallpadDeviceSet = new WallpadDeviceSet(getContext());
- byte duration = (byte) wallpadDeviceSet.Get_SmartDoorCam_Dutaion();
- wallpadDeviceSet.closeDB();
- Log.d(TAG, "[getSmartDoorCamDuration] duration [" + duration + "]");
- return duration;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] getSmartDoorCamDuration()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- return (byte) 0x05;
- }
- // 방문객원격통화 사용 여부
- private boolean getRemoteCallUse() {
- try {
- WallpadDeviceSet deviceSet = new WallpadDeviceSet(getContext());
- String[] astrRemoteCall = deviceSet.GetSettingData("방문객원격통화"); // 방문객 원격통화 솔루션
- deviceSet.closeDB();
- boolean bRemoteCall = false;
- if (astrRemoteCall != null) {
- if (astrRemoteCall[1].contains("방문객원격통화")) {
- if (astrRemoteCall[1].contains("사용함")) bRemoteCall = true;
- }
- }
- return bRemoteCall;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] getRemoteCallUse()");
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- SmartKeyRfDoorAPI mSmartKeyRfDoorAPI = null; // 스마트현관카메라
- // 스마트현관카메라 MODE 제어
- private void ctrlSmartIOTCamStatusMode(byte mode) {
- try {
- Log.d(TAG, "[ctrlSmartIOTCamStatusMode] mode [" + mode + "]");
- if (mSmartKeyRfDoorAPI != null) {
- int nResult = mSmartKeyRfDoorAPI.SetCAMERAmode(mode);
- Log.d(TAG, "[ctrlSmartIOTCamStatusMode] nResult -> " + nResult);
- }
- else Log.w(TAG, "[ctrlSmartIOTCamStatusMode] mSmartKeyRfDoorAPI is null!!");
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] ctrlSmartIOTCamStatusMode(byte mode)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- // 스마트현관카메라 LED 상태 제어
- private void ctrlSmartIOTCamLEDMode(byte mode) {
- try {
- Log.d(TAG, "[ctrlSmartIOTCamLEDMode] mode [" + mode + "]");
- if (mSmartKeyRfDoorAPI != null) {
- int nResult = mSmartKeyRfDoorAPI.SetLEDmode(mode);
- Log.d(TAG, "[ctrlSmartIOTCamLEDMode] nResult -> " + nResult);
- }
- else Log.w(TAG, "[ctrlSmartIOTCCamLEDMode] mSmartKeyRfDoorAPI is null!!");
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] ctrlSmartIOTCamLEDMode(byte mode)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- ////////////////////////////////////////////////
- // 현관카메라, Surfaceview 구성
- ////////////////////////////////////////////////
- Camera mFrontCamera;
- RelativeLayout FrontSurfaceLayout;
- RelativeLayout FrontVideoLayout;
- SurfaceHolder FrontVideoHolder;
- SurfaceView FrontVideoSurface;
- private void initFrontVideoLayout() {
- try {
- if (getDoorCamType() != WallpadDeviceSet.DOORTYPE_IOT_SMART && getDoorCamType() != WallpadDeviceSet.DOORTYPE_HYOSUNG_SMART && getDoorCamType() != WallpadDeviceSet.DOORTYPE_DAEWOO_SMART) return;
- int nViewFlipperIndex = mViewFlipper.getDisplayedChild();
- if (FrontSurfaceLayout == null) {
- Log.d(TAG, "[initFrontVideoLayout] FrontSurfaceLayout Created!!! === nViewFlipperIndex [" + nViewFlipperIndex + "]");
- FrontSurfaceLayout = new RelativeLayout(this);
- RelativeLayout layout = MainLayout;
- if (nViewFlipperIndex == 0) layout = MainLayout;
- else if (nViewFlipperIndex == 1) layout = SubLayout_01;
- else if (nViewFlipperIndex == 2) layout = SubLayout_02;
- WpadUtil.LayoutRegistration(layout, FrontSurfaceLayout, WpadScale.getWidthPixels(), WpadScale.getWidthPixels(), 0, 0, ID.MAINACTIVITY.LAYOUT.SURFACE);
- }
- FrontVideoLayout = new RelativeLayout(mContext);
- WpadUtil.LayoutRegistration(FrontSurfaceLayout, FrontVideoLayout, 1024, 600, 0, 0, ID.MAINACTIVITY.LAYOUT.FRONTVIDEO);
- FrontVideoSurface = new SurfaceView(mContext);
- FrontVideoHolder = FrontVideoSurface.getHolder();
- WpadRelativeLayoutParams FrontVideoParams;
- FrontVideoParams = new WpadRelativeLayoutParams(480, 360);
- FrontVideoParams.setMargins(280, 115, 0, 0);
- FrontVideoLayout.addView(FrontVideoSurface, FrontVideoParams);
- FrontVideoLayout.setVisibility(View.INVISIBLE);
- FrontVideoSurface.getHolder().addCallback(FrontVideoCallback);
- FrontVideoSurface.setZOrderOnTop(true);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] initFrontVideoLayout()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private void removeFrontVideoLayout() {
- try {
- Log.d(TAG, "[removeFrontVideoLayout]");
- if (FrontSurfaceLayout != null) {
- FrontSurfaceLayout.setVisibility(View.GONE);
- FrontSurfaceLayout = null;
- }
- if (FrontVideoSurface != null) {
- FrontVideoSurface.setVisibility(View.GONE);
- FrontVideoSurface.getHolder().removeCallback(FrontVideoCallback);
- FrontVideoSurface = null;
- }
- if (FrontVideoLayout != null) {
- FrontVideoLayout.setVisibility(View.GONE);
- FrontVideoLayout.removeAllViews();
- FrontVideoLayout = null;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] removeFrontVideoLayout()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private void showFrontVideo(boolean bShow) {
- try {
- Log.d(TAG, "[showFrontVideo] bShow [" + bShow + "]");
- if (FrontVideoSurface == null) {
- Log.w(TAG, "[showFrontVideo] FrontVideoSurface is null!!!");
- return;
- }
- WpadRelativeLayoutParams FrontVideoParams;
- FrontVideoParams = new WpadRelativeLayoutParams(480, 360);
- if (bShow) FrontVideoParams.setMargins(280, 115, 0, 0);
- else FrontVideoParams.setMargins(1300, 112, 0, 0); // 안보이게
- FrontVideoSurface.setLayoutParams(FrontVideoParams);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] showFrontVideo(boolean bShow)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private void showFrontCam(boolean bOn) {
- try {
- Log.d(TAG, "[showFrontCam] bOn [" + bOn + "]");
- if (getDoorCamType() != WallpadDeviceSet.DOORTYPE_IOT_SMART && getDoorCamType() != WallpadDeviceSet.DOORTYPE_HYOSUNG_SMART && getDoorCamType() != WallpadDeviceSet.DOORTYPE_DAEWOO_SMART) return;
- if (bOn) {
- // on
- mIOInterface.selectFrontCam(false);
- mIOInterface.ctrlFrontCamPower(bOn);
- ctrlSmartIOTCamStatusMode(Common.SmartRFCamStatusMode.STATUS_ON);
- ctrlSmartIOTCamLEDMode(Common.SmartRFCamLEDMode.LED_ON);
- mIOInterface.interfaceIGW300(Common.IGW300CMD.VIDEO_MOIP);
- initFrontVideoLayout();
- showFrontVideo(false);
- } else {
- // off
- showFrontVideo(false);
- removeFrontVideoLayout();
- mIOInterface.ctrlFrontCamPower(bOn);
- ctrlSmartIOTCamLEDMode(Common.SmartRFCamLEDMode.LED_OFF);
- ctrlSmartIOTCamStatusMode(Common.SmartRFCamStatusMode.STATUS_OFF);
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG,re);
- ctrlSmartIOTCamLEDMode(Common.SmartRFCamLEDMode.LED_OFF);
- ctrlSmartIOTCamStatusMode(Common.SmartRFCamStatusMode.STATUS_OFF);
- if (mIOInterface != null) {
- mIOInterface.selectFrontCam(false);
- mIOInterface.ctrlFrontCamPower(false);
- }
- } catch (Exception e) {
- Log.e(TAG, "[Exception] showFrontCam(boolean bOn)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- // 영상 오류 발생할 경우 카메라 전원 off
- ctrlSmartIOTCamLEDMode(Common.SmartRFCamLEDMode.LED_OFF);
- ctrlSmartIOTCamStatusMode(Common.SmartRFCamStatusMode.STATUS_OFF);
- if (mIOInterface != null) {
- mIOInterface.selectFrontCam(false);
- mIOInterface.ctrlFrontCamPower(false);
- }
- }
- }
- private SurfaceHolder.Callback FrontVideoCallback = new SurfaceHolder.Callback() {
- @Override
- public void surfaceCreated(SurfaceHolder holder) {
- try {
- Log.d(TAG, "[FrontVideoCallback] front camera surfaceCreated!!");
- boolean bAOS7 = false; // 한국생산(다담, AOS 6.0.1)과 중국생산(사니코, 7.1.1) 구분 (true: 중국생산, false: 한국생산)
- if (Build.VERSION.SDK_INT > 23) bAOS7 = true;
- Log.d(TAG, "[FrontVideoCallback] Version.getModelType() [" + Version.getModelType() + "], bAOS7 [" + bAOS7 + "]");
- if (Version.getModelType() == MODEL_TYPE.IHN_D101) {
- if (bAOS7) {
- // AOS 7.1.1
- mFrontCamera = Camera.open(Camera.CameraInfo.CAMERA_FACING_BACK);
- }
- else {
- // AOS 6.0.1
- if (getDoorCamType() == WallpadDeviceSet.DOORTYPE_IOT_SMART) mFrontCamera = Camera.open(Camera.CameraInfo.CAMERA_FACING_BACK);
- else mFrontCamera = Camera.open();
- }
- }
- else {
- if (bAOS7) {
- // AOS 7.1.1
- if (Version.getModelType() == MODEL_TYPE.IHN_1020B_I && !getCompareBSPVersion("2020.09.08")) mFrontCamera = Camera.open(Camera.CameraInfo.CAMERA_FACING_FRONT);
- else if (Version.getModelType() == MODEL_TYPE.IHN_HS101_I && !getCompareBSPVersion("2020.06.11")) mFrontCamera = Camera.open(Camera.CameraInfo.CAMERA_FACING_FRONT);
- else mFrontCamera = Camera.open(Camera.CameraInfo.CAMERA_FACING_BACK);
- }
- else {
- // AOS 6.0.1
- mFrontCamera = Camera.open(Camera.CameraInfo.CAMERA_FACING_FRONT);
- }
- }
- if (getDoorCamType() == WallpadDeviceSet.DOORTYPE_IOT_SMART) {
- Camera.Parameters params = mFrontCamera.getParameters();
- params.setPictureSize(1280, 720);
- mFrontCamera.setParameters(params);
- }
- else {
- Camera.Parameters params = mFrontCamera.getParameters();
- params.setPictureSize(640, 480);
- mFrontCamera.setParameters(params);
- }
- mFrontCamera.setPreviewDisplay(holder);
- mFrontCamera.setErrorCallback(FrontVideoErrorCallback);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] FrontVideoCallback -> surfaceCreated(SurfaceHolder holder)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- @Override
- public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
- try {
- Log.d(TAG, "[FrontVideoCallback] surfaceChanged!!");
- if (mFrontCamera != null) {
- mFrontCamera.startPreview();
- }
- if (Common.OPTION_TAB_ANMI_ENABLE) {
- Animation Anmi = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.screen_on);
- FrontVideoLayout.startAnimation(Anmi);
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] FrontVideoCallback -> surfaceChanged(SurfaceHolder holder)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- @Override
- public void surfaceDestroyed(SurfaceHolder holder) {
- try {
- Log.d(TAG, "[FrontVideoCallback] surfaceDestroyed!!");
- if (mFrontCamera != null) {
- mFrontCamera.stopPreview();
- mFrontCamera.release();
- mFrontCamera = null;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] FrontVideoCallback -> surfaceDestroyed(SurfaceHolder holder)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- };
- private Camera.ErrorCallback FrontVideoErrorCallback = new Camera.ErrorCallback() {
- @Override
- public void onError(int error, Camera camera) {
- switch (error) {
- case Camera.CAMERA_ERROR_SERVER_DIED:
- Log.e(TAG, "[FrontVideoErrorCallback] CAMERA_ERROR_SERVER_DIED");
- camera.stopPreview();
- camera.setPreviewCallback(null);
- camera.release();
- camera = null;
- break;
- case Camera.CAMERA_ERROR_UNKNOWN:
- Log.e(TAG, "[FrontVideoErrorCallback] CAMERA_ERROR_UNKNOWN");
- break;
- }
- }
- };
- int camOpenCheckCnt = 0;
- int handlerMaxCnt = 100;
- /**
- * 현관카메라 OPEN CHECK Handler!!!
- */
- private Handler mFrontCamOpenCheckHandler = new Handler() {
- @Override
- public void handleMessage(Message msg) {
- if (msg.what == 0) {
- camOpenCheckCnt++;
- if (camOpenCheckCnt > handlerMaxCnt) {
- Log.w(TAG, "[mFrontCamOpenCheckHandler] camOpenCheckCnt is over!! [" + camOpenCheckCnt + "]");
- mFrontCamOpenCheckHandler.removeMessages(0);
- mFrontCamOpenCheckHandler.removeMessages(1);
- camOpenCheckCnt = 0;
- resetRecordSetting();
- ctrlSmartIOTCamLEDMode(Common.SmartRFCamLEDMode.LED_OFF);
- ctrlSmartIOTCamStatusMode(Common.SmartRFCamStatusMode.STATUS_OFF);
- } else {
- if (mFrontCamera != null) mFrontCamOpenCheckHandler.sendEmptyMessageDelayed(1, 100);
- else mFrontCamOpenCheckHandler.sendEmptyMessageDelayed(0, 100);
- }
- } else if (msg.what == 1) {
- camOpenCheckCnt = 0;
- // ************ 스마트현관카메라 영상 녹화 시작!! ************
- Log.d(TAG, "[mFrontCamOpenCheckHandler] [CAMERA OPEN] STRANGER RECORD START");
- if (mFrontCamera != null) {
- if (getDoorCamType() == WallpadDeviceSet.DOORTYPE_IOT_SMART) mFrontCamera.stopPreview();
- mFrontCamera.unlock();
- mMediaRecorder = new MediaRecorder();
- mMediaRecorder.setCamera(mFrontCamera);
- mMediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
- mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
- if (getDoorCamType() == WallpadDeviceSet.DOORTYPE_IOT_SMART) {
- mMediaRecorder.setVideoSize(1280, 720);
- mMediaRecorder.setVideoEncodingBitRate(3000000);
- }
- else {
- mMediaRecorder.setVideoSize(640, 480);
- mMediaRecorder.setVideoFrameRate(24);
- }
- mMediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.DEFAULT);
- mMediaRecorder.setOutputFile(VIDEO_TEMP_PATH);
- mMediaRecorder.setPreviewDisplay(FrontVideoHolder.getSurface());
- try {
- Log.d(TAG, "[mFrontCamOpenCheckHandler] mMediaRecorder.prepare");
- mMediaRecorder.prepare();
- } catch (IllegalStateException e) {
- Log.e(TAG, "[IllegalStateException] mFrontCamOpenCheckHandler.prepare");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- resetRecordSetting();
- } catch (IOException e) {
- Log.e(TAG, "[IOException] mFrontCamOpenCheckHandler.prepare");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- resetRecordSetting();
- } catch (Exception e) {
- Log.e(TAG, "[Exception] mFrontCamOpenCheckHandler.prepare");
- LogUtil.errorLogInfo("", TAG, e);
- resetRecordSetting();
- }
- try {
- bRecordStatus = true;
- runNoticeStrangerRecord(true);
- if (mRecordTimer != null) mRecordTimer.start();
- Log.d(TAG, "[mFrontCamOpenCheckHandler] mMediaRecorder.start");
- mMediaRecorder.start();
- } catch (IllegalStateException e) {
- Log.e(TAG, "[IllegalStateException] mFrontCamOpenCheckHandler.start");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- resetRecordSetting();
- } catch (Exception e) {
- Log.e(TAG, "[Exception] mFrontCamOpenCheckHandler.start");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- resetRecordSetting();
- }
- }
- }
- }
- };
- public static int nResidentSafetyCheckSetting = WallpadDeviceSet.RESIDENT_SAFETY_CHECK_DISABLE;
- private void getResidentSafetyCheckSetting() {
- try {
- WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(getApplicationContext());
- nResidentSafetyCheckSetting = mWallpadDeviceSet.getResidentSafetyCheck();
- mWallpadDeviceSet.closeDB();
- Log.e(TAG, "[getResidentSafetyCheckSetting] nResidentSafetyCheckSetting: " + nResidentSafetyCheckSetting);
- if (nResidentSafetyCheckSetting == WallpadDeviceSet.RESIDENT_SAFETY_CHECK_ENABLE) Version.setResidentSafety();
- else Version.unsetResidentSafety();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getResidentSafetyCheckSetting()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /**
- * 멀티제어 관련.
- *
- * */
- //멀티기기 정보 제공을 위한 추가 madeinlab
- private Messenger mServiceMessenger = null;
- private boolean mIsBound;
- private ServiceConnection mConnection = new ServiceConnection() {
- @Override
- public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
- Log.d("test","onServiceConnected");
- mServiceMessenger = new Messenger(iBinder);
- try {
- Message msg = Message.obtain(null, iMapServer.MSG_REGISTER_CLIENT);
- msg.replyTo = mMessenger;
- mServiceMessenger.send(msg);
- }
- catch (RemoteException e) {
- }
- }
- @Override
- public void onServiceDisconnected(ComponentName componentName) {
- }
- };
- /** Service 로 부터 message를 받음 */
- private final Messenger mMessenger = new Messenger(new Handler(new Handler.Callback() {
- @Override
- public boolean handleMessage(Message msg) {
- Log.i("test","act : what "+msg.what);
- switch (msg.what) {
- case iMapServer.MSG_SEND_TO_ACTIVITY:
- int value1 = msg.getData().getInt("fromService");
- Log.i("test","act : value1 "+value1);
- //iMapService에 요청하면 디바이스 정보를 가져올 수 있도록 한다.
- for(int i=1; i<4; i++) {
- ((MainActivity) mContext).requestMultiControl(handler, Common.JSON.MENU.DEVICE_INFO, Common.JSON.REASON.DeviceInfo, i);
- }
- break;
- }
- return false;
- }
- }));
- /** Service 로 메시지를 보냄 */
- private void sendMessageToService(int index, String str) {
- if (mIsBound) {
- if (mServiceMessenger != null) {
- try {
- Message msg = null;
- if(index==1) {
- msg = Message.obtain(null, iMapServer.MSG_SEND_TO_SERVICE_DEVICES1, str);
- } else if(index==2) {
- msg = Message.obtain(null, iMapServer.MSG_SEND_TO_SERVICE_DEVICES2, str);
- } else if(index==3) {
- msg = Message.obtain(null, iMapServer.MSG_SEND_TO_SERVICE_DEVICES3, str);
- } else if(index==4) {
- msg = Message.obtain(null, 1111, str);
- }
- if(msg!=null) {
- msg.replyTo = mMessenger;
- mServiceMessenger.send(msg);
- }
- } catch (RemoteException e) {
- }
- }
- }
- }
- @SuppressLint("HandlerLeak")
- final Handler handler = new Handler() {
- Gson gson = new Gson();
- @Override
- public void handleMessage(Message msg) {
- switch (msg.what) {
- case 1000:
- try {
- Bundle bundle = msg.getData();
- String response = bundle.getString("response");
- int index = bundle.getInt("index");
- // 메시지를 서비스로 전달
- String test2 = "<devinfo name=\"livinglight\" value=\"0\" floor=\"2\"/>\r\n" +
- "<devinfo name=\"doorlock\" value=\"0\" floor=\"2\"/>\r\n" +
- "<devinfo name=\"light\" value=\"0\" floor=\"2\"/>\r\n" +
- "<devinfo name=\"ventil\" value=\"1\" floor=\"2\"/>\r\n" +
- "<devinfo name=\"thermostat\" value=\"8\" floor=\"2\"/>\r\n" +
- "<devinfo name=\"electric\" value=\"0\" floor=\"2\"/>\r\n" +
- "<devinfo name=\"gas\" value=\"1\" floor=\"2\"/>\r\n" +
- "<devinfo name=\"cooktop\" value=\"0\" floor=\"2\"/>\r\n" ;
- String test3 = "<devinfo name=\"livinglight\" value=\"0\" floor=\"3\"/>\r\n" +
- "<devinfo name=\"doorlock\" value=\"0\" floor=\"3\"/>\r\n" +
- "<devinfo name=\"light\" value=\"0\" floor=\"3\"/>\r\n" +
- "<devinfo name=\"ventil\" value=\"1\" floor=\"3\"/>\r\n" +
- "<devinfo name=\"thermostat\" value=\"8\" floor=\"3\"/>\r\n" +
- "<devinfo name=\"electric\" value=\"0\" floor=\"3\"/>\r\n" +
- "<devinfo name=\"gas\" value=\"1\" floor=\"3\"/>\r\n" +
- "<devinfo name=\"cooktop\" value=\"0\" floor=\"3\"/>\r\n" ;
- sendMessageToService(index, response);
- } catch (Exception e) {
- e.printStackTrace();
- }
- break;
- default:
- break;
- }
- }
- };
- public String millToDate(long mills) {
- String pattern = "yyyy-MM-dd'T'HH:mm:ss";
- SimpleDateFormat formatter = new SimpleDateFormat(pattern);
- String date = (String) formatter.format(new Timestamp(mills));
- return date;
- }
- class ClientThread extends Thread {
- private Handler handler;
- private int menu, reason, position;
- public ClientThread(Handler handler, int menu, int reason, int position) {
- this.handler = handler;
- this.menu = menu;
- this.reason = reason;
- this.position = position;
- }
- public void run() {
- //String host = "10.1.1.1";
- String host = "10.1."+position+".1";
- int port = 9998;
- String json = "";
- JSONObject jsonObject = new JSONObject();
- try {
- jsonObject.accumulate("type", "request");
- jsonObject.accumulate("timestamp", millToDate(System.currentTimeMillis()));
- jsonObject.accumulate("wallpadip", myIP);
- jsonObject.accumulate("menu", menu);
- jsonObject.accumulate("reason", reason);
- jsonObject.accumulate("position", position);
- } catch (JSONException e) {
- e.printStackTrace();
- }
- // convert JSONObject to JSON to String
- json = jsonObject.toString();
- try {
- Socket socket = new Socket();
- InetSocketAddress ipep = new InetSocketAddress(host, port); // 방법 2
- socket.connect(ipep);
- ObjectOutputStream outputStream = new ObjectOutputStream(socket.getOutputStream());
- outputStream.writeObject(json);
- Log.d("ClientThread", "서버로 보냄.");
- ObjectInputStream inputStream = new ObjectInputStream(socket.getInputStream());
- StringBuffer stb = new StringBuffer();
- String data;
- while (true) {
- try {
- socket.setSoTimeout(5000);
- data = (String) inputStream.readObject();
- if (data == null) {
- break;
- }
- stb.append(data);
- } catch (Exception e) {
- if (socket != null) {
- socket.close();
- }
- if (inputStream != null) {
- inputStream.close();
- }
- if (outputStream != null) {
- outputStream.close();
- }
- break;
- }
- }
- final String response = String.valueOf(stb);
- Log.d("ClientThread", "response=" + response);
- final String finalResponse = response;
- Message message = handler.obtainMessage();
- message.what = 1000;
- Bundle bundle = new Bundle();
- bundle.putString("response", finalResponse);
- bundle.putInt("index", position);
- message.setData(bundle);
- handler.sendMessage(message);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- String myIP = "NONE";
- int ho = 0;
- public void requestMultiControl(Handler handler, int menu, int reason, int position) {
- if(position!=ho) {
- ClientThread thread = new ClientThread(handler, menu, reason, position);
- thread.start();
- }
- }
- }
|