1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691 |
- 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.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.net.Uri;
- import android.net.ethernet.EthernetDevInfo;
- import android.net.ethernet.EthernetManager;
- import android.os.Build;
- import android.os.Bundle;
- import android.os.Handler;
- import android.os.Looper;
- import android.os.Message;
- import android.os.PowerManager;
- 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.ImageView;
- import android.widget.RelativeLayout;
- 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.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.util.LogUtil;
- 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.OutputStream;
- import java.io.OutputStreamWriter;
- import java.net.InetAddress;
- import java.net.NetworkInterface;
- 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.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;
- static Context mContext_call = 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;
-
- //주차정보 관련 변수
- 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() == 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_2443
- ) {
- 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();
-
- // 1. 변수 초기화
- DebugLogOutput("[Create] - Step1 : EMData Create");
- PopupActivityRun = false;
- InfoActivityRun = false;
- mContext = this;
- mContext_call = mContext;
- 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());
- 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);
- 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);
- 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)
- {
- Handler mHandler = new Handler();
- mHandler.postDelayed(mLaunchTaskKakao, 500);
- mHandler = null;
- }
- 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();
- Log.i(TAG, "[onCreate] ==================== onCreate end ====================");
- }
- /**
- * 카카오 실행 관련 핸들러
- */
- private Runnable mLaunchTaskKakao = new Runnable() {
- public void run() {
- String Packagename = "com.kakao.i.test.real.wallpad";
- //Handler를 이용하여 Timer 사용
- Intent mainIntent = mContext.getPackageManager().getLaunchIntentForPackage(Packagename);
- if (mainIntent != null) {
- boolean isShowKakao = getShowKakaoCheck();
- if(isShowKakao)
- mainIntent.putExtra("ShowKakao", true);
- 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() == 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 !");
- }
- }
- }
- }
- 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);
- 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() {
- 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 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");
- 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); // KEY : MENU_ID_LIST
- 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); // KEY : MENU_ID_LIST
- 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();
- 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:
- ctrlLCDOnOff(true);
- 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:
- ctrlLCDOnOff(true);
- 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);
- mIOInterface.ctrlLcdWakeUp();
- // StartPopup(ID.POPUPS.POPUP_NOTICESTRANGER, data); // 시나리오 변경: 거동수상자 알림 팝업 삭제 (바로 녹화 시작)
- WallpadStatusData SetData = new WallpadStatusData(mContext);
- boolean soundOut = SetData.GetSoundOutputOfEventAlarm();
- SetData.closeDB();
- if (soundOut) Sound().Play(SND.effect.EFFECT1);
- // 메인 앱으로 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:
- int nEmerState = intent.getIntExtra("EMERGENCY_STATE", -1);
- m_CallSubMenuScreen.callStartCallAPK(ID.LINKEDSCREEN.SubCall.Door_Record, nEmerState);
- 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();
- int danjiserverType = wallpadDeviceSet.GetNewDanjiServer();
- if(danjiserverType == 1)
- {
- mNewDanjiServer = false;
- }
- else if(danjiserverType == 2)
- {
- mNewDanjiServer = true;
- }
- else
- {
- mNewDanjiServer = true;
- }
- 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("ITEM",-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;
- }
- }
- };
-
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- 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()) {
- 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() == 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()) {
- 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()) {
- 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()) {
- 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))
- {
- iMAPcarParking = new iMAPCarParking(mContext, true);
- 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);
- }
- 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);
- 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_CURTAIN.getID()) {
- m_CallSubMenuScreen.callStartHomeCtrlAPK(ID.LINKEDSCREEN.SubMenuCtrl.Curtain);
- }
- 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_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 {
- 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 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;
- 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_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_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() {
- 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("2020.09.18"); // 비교 기준 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();
- }
- }
- public static void ReDirectCall(String ip)
- {
- Intent Intent = new Intent();
- Intent.setAction("CERES_CALL");
- Intent.putExtra("REMOTEINFO", ip);
- mContext_call.sendBroadcast(Intent);
- }
- }
|