12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834 |
- package kr.co.icontrols.wallpadcall;
- import android.annotation.SuppressLint;
- import android.app.ActivityManager;
- import android.content.BroadcastReceiver;
- import android.content.Context;
- import android.content.Intent;
- import android.content.IntentFilter;
- import android.content.pm.PackageManager;
- import android.graphics.Bitmap;
- import android.graphics.BitmapFactory;
- import android.graphics.Color;
- import android.graphics.Matrix;
- import android.hardware.Camera;
- import android.hardware.Camera.ErrorCallback;
- import android.media.AudioManager;
- import android.media.CamcorderProfile;
- import android.media.MediaPlayer;
- import android.media.MediaRecorder;
- import android.os.Build;
- import android.os.Bundle;
- import android.os.CountDownTimer;
- import android.os.Handler;
- import android.os.Looper;
- import android.os.Message;
- import android.os.PowerManager;
- import android.util.Log;
- import android.view.Gravity;
- import android.view.KeyEvent;
- import android.view.MotionEvent;
- import android.view.SurfaceHolder;
- import android.view.SurfaceHolder.Callback;
- import android.view.SurfaceView;
- import android.view.View;
- import android.view.animation.AccelerateInterpolator;
- import android.view.animation.Animation;
- import android.view.animation.AnimationUtils;
- import android.view.animation.TranslateAnimation;
- import android.widget.Button;
- import android.widget.ExpandableListView;
- import android.widget.RelativeLayout;
- import com.artncore.WallPadDataMgr.WallpadDeviceSet;
- import com.artncore.WallPadDataMgr.WallpadSalesSampleData;
- import com.artncore.WallPadDataMgr.WallpadStatusData;
- import com.artncore.WallPadDataMgr.wallpaddbmgr;
- import com.artncore.commons.API_Menu;
- import com.artncore.commons.API_Menu.MenuListDataClass;
- import com.artncore.commons.API_Menu.MenuListDataClass.ChildIDMapping;
- import com.artncore.commons.define;
- import com.artncore.wallpadapi.FP_DlockAPI;
- import com.artncore.wallpadapi.IGW300API;
- import com.artncore.wallpadapi.Sdb_LivingRoomLightAPI;
- import com.artncore.wallpadapi.SmartKeyRfDoorAPI;
- import com.artncore.wallpadapi.WallPadAPI;
- import com.artncore.wallpadimap.RetProci;
- import com.util.LogUtil;
- import java.io.BufferedInputStream;
- import java.io.BufferedOutputStream;
- import java.io.File;
- import java.io.FileDescriptor;
- import java.io.FileInputStream;
- import java.io.FileNotFoundException;
- import java.io.FileOutputStream;
- import java.io.IOException;
- import java.io.InputStream;
- import java.io.OutputStream;
- import java.util.ArrayList;
- import java.util.Calendar;
- import java.util.Date;
- import java.util.List;
- import javax.crypto.Cipher;
- import javax.crypto.spec.SecretKeySpec;
- import de.re.easymodbus.exceptions.ModbusException;
- import de.re.easymodbus.modbusclient.ModbusClient;
- import kr.co.icontrols.ReliefCall.ReliefCallInterface;
- import kr.co.icontrols.callengine.engine.AudioRecordController;
- import kr.co.icontrols.callengine.engine.CallController;
- import kr.co.icontrols.callengine.engine.CallManager.CALLEVENTTYPE;
- import kr.co.icontrols.callengine.engine.CallManager.CALLOWNER;
- import kr.co.icontrols.callengine.engine.CallManager.CALLPATH;
- import kr.co.icontrols.callengine.engine.CallManager.CALLSTATUS;
- import kr.co.icontrols.callengine.engine.CallManager.CALLTYPE;
- import kr.co.icontrols.callengine.engine.RemoteCallController;
- import kr.co.icontrols.callengine.engine.VideoController;
- import kr.co.icontrols.callengine.history.CallHistoryManager;
- import kr.co.icontrols.callengine.history.VisitorPictureHistoryManager;
- import kr.co.icontrols.callengine.pstn.ATCmds.PSTNHANDLERMSG;
- import kr.co.icontrols.callengine.pstn.PSTNController;
- import kr.co.icontrols.callengine.remotecall.DataSender;
- import kr.co.icontrols.callengine.subphone.SubPhoneController;
- import kr.co.icontrols.callengine.subwallpad.SubWallPadController;
- import kr.co.icontrols.wallpadcall.declare.Common;
- import kr.co.icontrols.wallpadcall.declare.DataClasses.RemoteIDInfo;
- import kr.co.icontrols.wallpadcall.declare.DataClasses.SmartRFCamLEDMode;
- import kr.co.icontrols.wallpadcall.declare.DataClasses.SmartRFCamStatusMode;
- import kr.co.icontrols.wallpadcall.declare.Declare;
- import kr.co.icontrols.wallpadcall.declare.Declare.CALLTRIGGER;
- import kr.co.icontrols.wallpadcall.declare.Declare.IGW300CMD;
- import kr.co.icontrols.wallpadcall.declare.Global;
- import kr.co.icontrols.wallpadcall.declare.Global.BOARD_TYPE;
- import kr.co.icontrols.wallpadcall.declare.Global.ConfigValues;
- import kr.co.icontrols.wallpadcall.declare.Global.DOORLOCKTYPE;
- import kr.co.icontrols.wallpadcall.declare.Global.FRONTCAMERATYPE;
- import kr.co.icontrols.wallpadcall.declare.Global.SUBWALLPAD_PSTNTYPE;
- import kr.co.icontrols.wallpadcall.declare.Global.WALLPADTYPE;
- import kr.co.icontrols.wallpadcall.declare.ID;
- import kr.co.icontrols.wallpadcall.imap.Request_check_sip_activation;
- import kr.co.icontrols.wallpadcall.screen.InquiryCallHistory;
- import kr.co.icontrols.wallpadcall.screen.InquiryVisitorPictureHistory;
- import kr.co.icontrols.wallpadcall.screen.TalkFront;
- import kr.co.icontrols.wallpadcall.screen.TalkGuard;
- import kr.co.icontrols.wallpadcall.screen.TalkLobby;
- import kr.co.icontrols.wallpadcall.screen.TalkPSTN;
- import kr.co.icontrols.wallpadcall.screen.TalkResidence;
- import kr.co.icontrols.wallpadcall.screen.VisitorPictureViewer;
- import kr.co.icontrols.wallpadcall.subwallpadscreen.TalkFront_SubWallPad;
- import kr.co.icontrols.wallpadcall.subwallpadscreen.TalkGuard_SubWallPad;
- import kr.co.icontrols.wallpadcall.subwallpadscreen.TalkLobby_SubWallPad;
- import kr.co.icontrols.wallpadcall.subwallpadscreen.TalkPSTN_SubWallPad;
- import kr.co.icontrols.wallpadcall.subwallpadscreen.TalkResidence_SubWallPad;
- 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.WpadImageView;
- import kr.co.icontrols.wallpadsupport.WpadImageView.TOUCH_KIND;
- 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.WpadTextView;
- import kr.co.icontrols.wallpadsupport.WpadUtil;
- import static kr.co.icontrols.wallpadcall.declare.Declare.BR.ACNAME_MAIN_NOTI;
- /**
- * @description 월패드 [통화] 메인화면 이다.
- * 상단의 Top 메뉴, [홈] [돌아가기]
- * 좌측의 슬라이드 메뉴, [현관] [경비] [이웃] ... 등 선택 메뉴
- * 를 여기서 처리한다.
- */
- public class MainActivity extends WpadActivity {
- private final static String TAG = "MainActivity";
- /**
- * MoIP 영상통화시, FFMPEG 사용 여부 설정
- * true: FFMPEG 사용, MoIP 영상을 안드로이드 화면의 surface에 출력
- * false: FFMPEG 미사용, MoIP 영상을 OS에서 프레임버퍼에 직접 출력 (surface에 출력 안함)
- * FFMPEG 적용 모델
- * - IHN-1020B-I
- */
- public static boolean bFFMPEGEnable = false;
- boolean bLOG = true;
- private void LOG(String log) {
- if (bLOG) Log.v(TAG, log);
- }
- boolean bLOG_DEBUG = false;
- private void LOG_DEBUG(String log) {
- if (bLOG_DEBUG) Log.d(TAG, log);
- }
- boolean bLOG_INFO = true;
- private void LOG_INFO(String log) {
- if (bLOG_INFO) Log.i(TAG, log);
- }
- boolean bLOG_WARN = true;
- private void LOG_WARN(String log) {
- if (bLOG_WARN) Log.w(TAG, log);
- }
- // =================================================================================================
- // [[ Declaration ]] region
- // =================================================================================================
- protected Context mContext = null;
- public Context getContext() {
- return mContext;
- }
- public WallPadAPI mWallPadAPI = null;
- public SmartKeyRfDoorAPI smartKeyRfDoorAPI;
- Sdb_LivingRoomLightAPI sdbLivingRoomLightAPI;
- public FP_DlockAPI fpDlockAPI;
- private int OPERATION_MODE = Common.MODE;
- // Layout
- private RelativeLayout AllLayout; // 화면 전체
- private RelativeLayout TopLayout; // 상단 메뉴
- private RelativeLayout MenuLayout; // 메뉴 화면
- private RelativeLayout ScreenLayout; // 제어기기 화면
- RelativeLayout SurfaceLayout; // 영상표시 화면
- // SurfaceLayout 구성
- RelativeLayout MyVideoLayout; // MoIP 카메라 영상 (월패드 전면 카메라)
- // SurfaceHolder MyVideoHolder;
- SurfaceView MyVideoSurface;
- RelativeLayout RemoteVideoLayout; // MoIP 수신 영상 (로비/경비/이웃 영상)
- // SurfaceHolder RemoteVideoHolder;
- SurfaceView RemoteVideoSurface;
- WpadImageView IMG_REMOTE_VIDEO_PATCH;
- RelativeLayout FrontVideoLayout; // 현관 카메라 영상
- SurfaceHolder FrontVideoHolder;
- SurfaceView FrontVideoSurface;
- WpadTextView TXT_REMOTE_ID;
- WpadImageView ScreenBackground;
- private static final int REQUEST_EXTERNAL_STORAGE = 100;
- // Top
- private WpadImageView TopBackground;
- private WpadTextView TopTitle;
- private WpadTextView SampleModeTitle;
- private WpadTextView TopStrangerRecodingNotice;
- private WpadTextView TopRemoteCallNotice;
- public WpadImageView TopHomeBtn;
- public WpadImageView TopBackBtn;
- private WpadImageView TopMenuBtn;
- private WpadImageView TopManualBtn;
- private WpadImageView TopSetBtn;
- private WpadImageView TopHideBtn;
- // Menu
- private WpadImageView MenuBackground;
- private WpadImageView MenuClose;
- private WpadTextView MenuTitle;
- private static ExpandableListView mListView;
- private Menu_AdptMain adptMain;
- private MenuListDataClass menuListDataClass;
- private Menu mMenu = null; // WPadAPI의 Menu class
- private boolean MenuOpen = false;
- public boolean mNewDanjiServer = false;
- // PopupActivityRun
- private static boolean PopupActivityRun = false;
- public static boolean getPopupActivityRun() {
- Log.d(TAG, "[getPopupActivityRun] PopupActivityRun [" + PopupActivityRun + "]");
- return PopupActivityRun;
- }
- public static void setPopupActivityRun(boolean run) {
- PopupActivityRun = run;
- Log.d(TAG, "[setPopupActivityRun] PopupActivityRun [" + PopupActivityRun + "]");
- if (!PopupActivityRun) resetCurrentPopUpScreenID();
- }
- // ManualActivityRun
- private static boolean ManualActivityRun = false;
- public static boolean getManualActivityRun() {
- Log.d(TAG, "[getManualActivityRun] ManualActivityRun: " + ManualActivityRun);
- return ManualActivityRun;
- }
- public static void setManualActivityRun(boolean run) {
- ManualActivityRun = run;
- if (!ManualActivityRun) resetCurrentManualScreenID();
- }
- // CurrentScreenId
- private int mCurrentScreenId = -1;
- private int mTempCurrentScreenId = -1;
- private static int mCurrentPopUpScreenId = -1;
- private static int mCurrentManualScreenId = -1;
- int allWidth, allHeight, screenWidth, screenHeight, topHeight, fontSize;
- // System Volume
- int nSysVolume = 0;
- int nTempSysVolume = 7;
- int nTempDTMFVolume = 11;
- int nTempReliefVolume = 11;
- int nTempDingDongVolume = 12;
- int nTempDingDongVolume_IDCHS100 = 10;
- // Screen
- private TalkFront ScreenTalkFront = null; // 현관통화
- private TalkLobby ScreenTalkLobby = null; // 로비통화
- private TalkGuard ScreenTalkGuard = null; // 경비실통화
- private TalkResidence ScreenTalkResidence = null; // 세대통화
- private TalkPSTN ScreenTalkPSTN = null; // 국선통화
- private InquiryCallHistory ScreenInquiryCallHistory = null; // 통화내역
- private InquiryVisitorPictureHistory ScreenInquiryVisitorPictureHistory = null; // 방문자 사진
- private VisitorPictureViewer ScreenVisitorPictureViewer = null; // 방문자 사진 뷰어
- // SubWallPad Screen
- private TalkFront_SubWallPad ScreenTalkFrontSub = null;
- private TalkLobby_SubWallPad ScreenTalkLobbySub = null;
- private TalkGuard_SubWallPad ScreenTalkGuardSub = null;
- private TalkResidence_SubWallPad ScreenResidenceSub = null;
- private TalkPSTN_SubWallPad ScreenPSTNSub = null;
- public static IOInterface mIOInterface;
- public static AudioManager mAudioManager;
- public static PowerManager mPowerManager;
- public static CallHistoryManager mCallHistoryManager;
- public static VisitorPictureHistoryManager mVisitorPictureHistoryManager;
- public static CallController mCallController;
- public static VideoController mVideoController;
- public static AudioRecordController mAudioRecordController;
- public static WpadSound mSound;
- public static PSTNController mPSTNController;
- public static SubPhoneController mSubPhoneController;
- public static SubWallPadController mSubWallPadController;
- public static RemoteCallController mRemoteCallController;
- // ***** 방문객 원격통화 솔루션 관련 *****
- public static DataSender mDataSender; // 영상 데이터를 SendMedia API를 통해 모바일쪽에 전달
- // ***** 안심통화 솔루션 관련 *****
- public static ReliefCallInterface mReliefCallIF;
- public boolean bBlockHomeBTN = false;
- public boolean bLCDReverse = false;
- public boolean bDelCallTouch = false;
- public static boolean bFrontCallUse, bLobbyCallUse, bGuardCallUse, bResiCallUse, bPSTNCallUse, bCallHistoryUse, bVisitorPicUse;
- /* =================================================================================================
- * [ Activity Life Cycle ] region
- ================================================================================================ */
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- try {
- Log.i(TAG, "=============== [START - MainActivity] ===============");
- registerWallPadCallLiveBRReceiver();
- bDelCallTouch = false;
- Global.setGlobalContext(this);
- Global.getConfigValues(); // 디바이스 설정
- nSysVolume = Global.getConfigSystemVolume();
- if (ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_1020B_I) bFFMPEGEnable = true;
- else bFFMPEGEnable = false;
- Log.i(TAG, "[onCreate] bFFMPEGEnable [" + bFFMPEGEnable + "]");
- registerBRReceiver();
- if (ConfigValues.bReliefCall) {
- Log.i(TAG, "[onCreate] --------------- ReliefCallInterface ---------------");
- mReliefCallIF = new ReliefCallInterface();
- }
- // API 호출
- if (OPERATION_MODE == Common.MODE_NORMAL) {
- LOG_DEBUG("OperationMode = MODE_NORMAL");
- try {
- mWallPadAPI = new WallPadAPI(this);
- if (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_IGW300 || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
- // IHN-D101 일 경우, 스마트폰 조명제어 사용여부 설정 제어하기 위함 (거실에너지미터 BT-Wifi 모듈이 마이크에 무선 노이즈를 발생시키므로)
- mWallPadApiCheckHandler.sendEmptyMessage(2);
- }
- if (ConfigValues.eDoorLockType == DOORLOCKTYPE.FINGERPRINT) {
- // 지문인식 도어락일경우, API 로딩
- mWallPadApiCheckHandler.sendEmptyMessage(4);
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[ExceptionError] - new WallPadAPI : " + e);
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- else if (OPERATION_MODE == Common.MODE_BUSINESS_SAMPLE) {
- LOG_DEBUG("OperationMode = MODE_BUSINESS_SAMPLE");
- }
- checkDevService(); // 디바이스 서비스 실행여부를 확인하고, 실행중이 아니면 실행시킨다.
- initIOInterface(); // I/O 제어 JNI
- mSound = new WpadSound(this);
- if (ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_D101) LOG_INFO("[onCreate] Model Type [IHN_D101]");
- else if (ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_D101_I) LOG_INFO("[onCreate] Model Type [IHN_D101-I]");
- else if (ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_D101_I_LX2) LOG_INFO("[onCreate] Model Type [IHN_D101-I_LX2]");
- else if (ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_D101_I_OCF) LOG_INFO("[onCreate] Model Type [IHN_D101-I-OCF]");
- else if (ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_1010GL) LOG_INFO("[onCreate] Model Type [IHN_1010GL]");
- else if (ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_1010GL_I) LOG_INFO("[onCreate] Model Type [IHN_1010GL-I]");
- else if (ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_1010GL_I_2443) LOG_INFO("[onCreate] Model Type [IHN_1010GL-I-2443]");
- else if (ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_1010GL_I_6410) LOG_INFO("[onCreate] Model Type [IHN_1010GL-I-6410]");
- else if (ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_D101K) LOG_INFO("[onCreate] Model Type [IHN_D101K]");
- else if (ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_D101K_I) LOG_INFO("[onCreate] Model Type [IHN_D101K-I]");
- else if (ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_1010) {
- if (ConfigValues.eWallPadType == WALLPADTYPE.MAIN) LOG_INFO("[onCreate] Model Type [IHN_1010]");
- else LOG_INFO("[onCreate] Model Type [IHN_1010S]"); // 서브월패드
- }
- else if (ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_1010_I) {
- if (ConfigValues.eWallPadType == WALLPADTYPE.MAIN) LOG_INFO("[onCreate] Model Type [IHN_1010-I]");
- else LOG_INFO("[onCreate] Model Type [IHN_1010-IS]"); // 서브월패드
- }
- else if (ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_1030_I) LOG_INFO("[onCreate] Model Type [IHN_1030-I]");
- else if (ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_1040) LOG_INFO("[onCreate] Model Type [IHN_1040]");
- else if (ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_1040_I) LOG_INFO("[onCreate] Model Type [IHN_1040-I]");
- else if (ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_1050) LOG_INFO("[onCreate] Model Type [IHN_1050]");
- else if (ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_1050_I) LOG_INFO("[onCreate] Model Type [IHN_1050-I]");
- else if (ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_T1010) LOG_INFO("[onCreate] Model Type [IHN_T1010]");
- else if (ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_T1010_I) LOG_INFO("[onCreate] Model Type [IHN_T1010-I]");
- else if (ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_HS101) LOG_INFO("[onCreate] Model Type [IHN_HS101]");
- else if (ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_HS101_I) LOG_INFO("[onCreate] Model Type [IHN_HS101-I]");
- else if (ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_430) LOG_INFO("[onCreate] Model Type [IHN_430]");
- else if (ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_430_I) LOG_INFO("[onCreate] Model Type [IHN_430-I]");
- else if (ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_DW101_I) LOG_INFO("[onCreate] Model Type [IHN_DW101_I]");
- else if (ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_1020B_I) LOG_INFO("[onCreate] Model Type [IHN_1020B_I]");
- else if (ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_1303_I) LOG_INFO("[onCreate] Model Type [IHN_1303_I]");
- else if (ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_1010_I_LX2) LOG_INFO("[onCreate] Model Type [IHN_1010_I_LX2]");
- else LOG_INFO("[onCreate] ConfigValues.DEVICE_MODELTYPE [" + ConfigValues.DEVICE_MODELTYPE + "]");
- // @ AutoScale 설정
- WpadScale.setAutoScale(true);
- super.AppVersionLogOut(); // [APP Version] + [WallPadSupport Lib Version] 을 로그로 출력한다.
- LOG_INFO("[Create] WallPadAPI Version = [" + define.WALLPADAPI_VERSION + "]");
- mContext = this;
- ManualActivityRun = false;
- // setCallAppRunning(true);
- setPopupActivityRun(false);
- // checkMemoryUsage(); // 통화 앱 시작시 메모리 체크
- getCallFunctionUse();
- mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
- mPowerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
- Global.ctrlLCDOnOff(true);
- // ****************** VOLUME 값 확인 ******************
- Log.d(TAG, "[VOLUME TEST] nSysVolume [" + nSysVolume + "]");
- // Log.d(TAG, "[VOLUME TEST] STREAM_SYSTEM ---> Volume : " + mAudioManager.getStreamVolume(AudioManager.STREAM_SYSTEM));
- // Log.d(TAG, "[VOLUME TEST] STREAM_VOICE_CALL ---> Volume : " + mAudioManager.getStreamVolume(AudioManager.STREAM_VOICE_CALL));
- // Log.d(TAG, "[VOLUME TEST] STREAM_RING ---> Volume : " + mAudioManager.getStreamVolume(AudioManager.STREAM_RING));
- // Log.d(TAG, "[VOLUME TEST] STREAM_DTMF ---> Volume : " + mAudioManager.getStreamVolume(AudioManager.STREAM_DTMF));
- // 2. 자동 종료 셋팅
- LOG_INFO("[Create] - Step2 : Auto Finish Setting");
- // 2-1. 자동종료 타이머 셋팅
- super.setFinishTimerCreate(Common.FINISH_TIME_SEC);
- // 3. API 호출 -> 코드 이동
- // 4. Layout registration
- LOG_INFO("[Create] - Step4 : Layout registration");
- allWidth = WpadScale.getWidthPixels();
- allHeight = WpadScale.getHeightPixels();
- screenWidth = 1280;
- screenHeight = 800;
- topHeight = 110;
- fontSize = Common.fontsize._44;
- LOG("[Create] allWidth [" + allWidth + "], allHeight [" + allHeight + "]");
- // 4-1. mainLayout
- AllLayout = new RelativeLayout(this);
- RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(allWidth, allHeight);
- AllLayout.setLayoutParams(params);
- AllLayout.setId(ID.MAINACTIVITY.LAYOUT.ALL);
- super.setAllLayoutRegistration(AllLayout);
- // 4-2. TopLayout
- TopLayout = new RelativeLayout(this);
- WpadUtil.LayoutRegistration(AllLayout, TopLayout, screenWidth, topHeight, 0, 0, ID.MAINACTIVITY.LAYOUT.TOP);
- // 4-4. ScreenLayout
- ScreenLayout = new RelativeLayout(this);
- WpadUtil.LayoutRegistration(AllLayout, ScreenLayout, screenWidth, screenHeight - topHeight, 0, topHeight, ID.MAINACTIVITY.LAYOUT.SCREEN);
- ScreenBackground = new WpadImageView(this, TOUCH_KIND.NONE, screenWidth, screenHeight - topHeight, R.drawable.bg_body, R.drawable.bg_body, ID.MAINACTIVITY.IMAGE.SCREEN_BACKGROUND);
- ViewRegistration(ScreenLayout, ScreenBackground, 0, 0);
- SurfaceLayout = new RelativeLayout(this);
- WpadUtil.LayoutRegistration(AllLayout, SurfaceLayout, allWidth, allHeight, 0, 0, ID.MAINACTIVITY.LAYOUT.SURFACE);
- TXT_REMOTE_ID = new WpadTextView(this, false, 356, 50, Gravity.CENTER, Color.WHITE, 30, false, ID.MAINACTIVITY.TEXT.REMOTE_ID);
- ViewRegistration(AllLayout, TXT_REMOTE_ID, 273, 577);
- // Typeface typeface = Typeface.createFromAsset(getAssets(), "fonts/NanumGothicCoding.ttf");
- // TXT_REMOTE_ID.setTypeface(typeface);
- TXT_REMOTE_ID.setVisibility(View.INVISIBLE);
- initCallEngine();
- // if (ConfigValues.eWallPadType == WALLPADTYPE.MAIN) {
- // initCallHistoryDB();
- // initVisitorPictureHistoryDB();
- // }
- // 5. Top Menu - ImageView registration
- LOG_INFO("[Create] - Step5 : Top Menu - ImageView registration");
- TopBackground = new WpadImageView(this, TOUCH_KIND.NONE, screenWidth, topHeight, R.drawable.bg_topbar, 0, ID.TOP.IMAGE.TOP_BACKGROUND);
- ViewRegistration(TopLayout, TopBackground, 0, 0);
- TopTitle = new WpadTextView(this, false, 247 + 50, 80, Gravity.LEFT, Color.WHITE, fontSize, true, ID.TOP.TEXT.TITLE);
- ViewRegistration(TopLayout, TopTitle, 133, 15);
- TopHideBtn = new WpadImageView(this, TOUCH_KIND.BUTTON_LC, 110, 110, 0, 0, ID.TOP.BUTTON.HIDE);
- ViewRegistration(TopLayout, TopHideBtn, 250, 0);
- if (OPERATION_MODE == Common.MODE_BUSINESS_SAMPLE) {
- SampleModeTitle = new WpadTextView(this, false, 200, 72, Gravity.CENTER, Color.WHITE, Common.fontsize._26_DEFAULT, true, 0);
- ViewRegistration(TopLayout, SampleModeTitle, 316, 17);
- SampleModeTitle.setText("[영업샘플모드]");
- }
- else if (Common.MODE == Common.MODE_PRODUCTION) {
- SampleModeTitle = new WpadTextView(this, false, 200, 72, Gravity.CENTER, Color.WHITE, Common.fontsize._26_DEFAULT, true, 0);
- ViewRegistration(TopLayout, SampleModeTitle, 316, 17);
- SampleModeTitle.setText("[생산 검수 모드]");
- }
- if (getStrangerRecording()) {
- TopStrangerRecodingNotice = new WpadTextView(this, false, 640, 72, Gravity.CENTER, Color.parseColor("#FF8C00"), Common.fontsize._50, true, 0);
- ViewRegistration(TopLayout, TopStrangerRecodingNotice, 320, 17);
- TopStrangerRecodingNotice.setVisibility(View.INVISIBLE);
- }
- if (ConfigValues.bRemoteCall) {
- TopRemoteCallNotice = new WpadTextView(this, false, 640, 72, Gravity.CENTER, Color.parseColor("#FF8C00"), Common.fontsize._50, true, 0);
- ViewRegistration(TopLayout, TopRemoteCallNotice, 320, 17);
- TopRemoteCallNotice.setVisibility(View.INVISIBLE);
- }
- TopHomeBtn = new WpadImageView(this, TOUCH_KIND.BUTTON, 110, 110, R.drawable.topbar_icon_home_normal, R.drawable.topbar_icon_home_pressed, ID.TOP.BUTTON.HOME);
- ViewRegistration(TopLayout, TopHomeBtn, 1145, 0);
- TopBackBtn = new WpadImageView(this, TOUCH_KIND.BUTTON, 110, 110, R.drawable.topbar_icon_back_normal, R.drawable.topbar_icon_back_pressed, ID.TOP.BUTTON.BACK);
- ViewRegistration(TopLayout, TopBackBtn, 1019, 0);
- setTopBackBtnVisible(false);
- bBlockTopMenuBTN = true;
- sendHandlerMsgDelayed(HANDLERMSG.RELEASE_TOPMENUBTN_BLOCK, 0, 0, 2000);
- TopMenuBtn = new WpadImageView(this, TOUCH_KIND.BUTTON_LC, 110, 110, R.drawable.topbar_icon_menu_normal, R.drawable.topbar_icon_menu_pressed, ID.TOP.BUTTON.MENU);
- ViewRegistration(TopLayout, TopMenuBtn, 0, 0);
- setTopMenuBtnVisible(true);
- TopManualBtn = new WpadImageView(this, TOUCH_KIND.BUTTON, 110, 110, R.drawable.topbar_icon_manual_normal, R.drawable.topbar_icon_manual_pressed, ID.TOP.BUTTON.MANUAL);
- setManualBtnVisible(getManualUse(), 1019);
- setTopHideBtnVisible(false);
- // 6. Menu Loading
- LOG_INFO("[Create] - Step6 : Menu Loading");
- // 6-1. 메뉴 정보를 가져온다 (DB에서 가져온다)
- wallpaddbmgr mwallpaddbmgr = new wallpaddbmgr(getApplicationContext());
- mwallpaddbmgr.DeleteMenuList();
- ArrayList<ArrayList<Integer>> mGroupList = null;
- ArrayList<Integer> mChildList = null;
- mGroupList = new ArrayList<ArrayList<Integer>>();
- mChildList = new ArrayList<Integer>();
- if (ConfigValues.eWallPadType == WALLPADTYPE.MAIN) {
- if (bFrontCallUse) mChildList.add(API_Menu.SubMenuCall.Door);
- if (bLobbyCallUse) mChildList.add(API_Menu.SubMenuCall.Lobby);
- if (bGuardCallUse) mChildList.add(API_Menu.SubMenuCall.Guard);
- if (bResiCallUse) mChildList.add(API_Menu.SubMenuCall.Neighbor);
- if (bPSTNCallUse) mChildList.add(API_Menu.SubMenuCall.PSTN);
- if (bCallHistoryUse) mChildList.add(API_Menu.SubMenuCall.CallList);
- if (bVisitorPicUse) mChildList.add(API_Menu.SubMenuCall.Visitor);
- }
- else {
- if (bFrontCallUse) mChildList.add(ID.SCREEN.SCREEN_TALKFRONT_SUBWALLPAD);
- if (bLobbyCallUse) mChildList.add(ID.SCREEN.SCREEN_TALKLOBBY_SUBWALLPAD);
- if (bGuardCallUse) mChildList.add(ID.SCREEN.SCREEN_TALKGUARD_SUBWALLPAD);
- if (bResiCallUse) mChildList.add(ID.SCREEN.SCREEN_TALKRESIDENCE_SUBWALLPAD);
- }
- mGroupList.add(mChildList);
- mwallpaddbmgr.SetMenuList(mGroupList);
- menuListDataClass = mwallpaddbmgr.GetMenuList();
- mwallpaddbmgr.closeDB();
- if (menuListDataClass == null) {
- Log.e(TAG, "menueListDataClass == null, Load Default List");
- menuListDataClass = LoadDefaultMenuList();
- }
- // enableKaKaoiFunction(false);
- // 6-2. 시작 화면을 main APP으로 부터 받아서 처리한다.
- mMenu = StartMenuSetting();
- if (mMenu == null) {
- Log.w(TAG, "[onCreate] menu is null!!");
- mTempCurrentScreenId = API_Menu.SubMenuCall.Guard;
- if (!bGuardCallUse) {
- if (bFrontCallUse) mTempCurrentScreenId = API_Menu.SubMenuCall.Door;
- else if (bResiCallUse) mTempCurrentScreenId = API_Menu.SubMenuCall.Neighbor;
- else if (bPSTNCallUse) mTempCurrentScreenId = API_Menu.SubMenuCall.PSTN;
- else if (bCallHistoryUse) mTempCurrentScreenId = API_Menu.SubMenuCall.CallList;
- else if (bVisitorPicUse) mTempCurrentScreenId = API_Menu.SubMenuCall.Visitor;
- }
- setChangeScreen(mTempCurrentScreenId, false); // 시작화면: 경비실
- }
- else {
- mTempCurrentScreenId = mMenu.getStartId();
- mWallPadApiCheckHandler.sendEmptyMessage(0);
- /** (JEFF, 2020.04.02)
- * RS-485 통신을 이용하는 현관카메라의 경우에만 WallPadAPI 로딩 여부를 확인하게 되면, 일반 현관카메라의 경우에는
- * WallPadAPI 연결이 늦은 경우 에러가 발생하므로 모든 경우에 WallPadAPI 연결확인을 진행한다.
- * 여기에 구현되어 있던 현관카메라(통신) API 로딩 기능은 WallPadAPI 확인 핸들러에서 현관카메라 종류에 따라 API를 로딩하도록 수정함
- */
- // if (ConfigValues.eFrontCameraType == FRONTCAMERATYPE.SMARTIOT || ConfigValues.eFrontCameraType == FRONTCAMERATYPE.SMART_HS || ConfigValues.eFrontCameraType == FRONTCAMERATYPE.SMART_DW) {
- // mWallPadApiCheckHandler.sendEmptyMessage(0);
- // }
- // else {
- // boolean result = setChangeScreen(mTempCurrentScreenId, false);
- // if (!result) {
- // setChangeScreen(API_Menu.SubMenuCall.Guard, false);
- // }
- // }
- }
- // 7. Draw
- LOG_INFO("[Create] - Step7 : setContentView");
- setContentView(AllLayout);
- getCallTimeoutEnable();
- sendHandlerMsgDelayed(HANDLERMSG.CHECK_RECEIVINGCALL, 0, 0, 500);
- // 거주자 안전확인 서비스 사용여부 확인하고, 화면 WallPadSupport Lib.에 관련 설정을 한다.
- getResidentSafetyCheckSetting();
- // 8. Window Resize
- WallpadDeviceSet wallpadDeviceSet = new WallpadDeviceSet(getApplicationContext());
- mNewDanjiServer = wallpadDeviceSet.GetNewDanjiServer();
- wallpadDeviceSet.closeDB();
- setDeviceName();
- LOG_INFO("[Create] - Step8 : Window Resize");
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] onCreate(Bundle savedInstanceState)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private void setDeviceName()
- {
- String[] strEndIP = {"10.1.1.1", "10.1.2.1", "10.1.3.1", "10.1.3.2", "10.1.1.3", "10.1.1.2", "10.1.2.2"};
- String[] strEndName = {"1층", "2층", "3층", "마스터룸", "기사", "메이드", "주방"};
- for(int i = 0; i < strEndIP.length; i++)
- {
- if (ConfigValues.strDeviceIPaddress.equals(strEndIP[i])) {
- Global.strDeviceName = strEndName[i];
- break;
- }
- }
- }
- public boolean getKakaoHomeCheck()
- {
- boolean result = false;
- WallpadDeviceSet mWallpadDeviceSet = null;
- mWallpadDeviceSet = new WallpadDeviceSet(getContext());
- try {
- result = mWallpadDeviceSet.Get_KakaoUse();
- }
- catch (Exception e)
- {
- LogUtil.errorLogInfo("", TAG, e);
- }
- return result;
- }
- @Override
- protected void onDestroy() {
- LOG("=============== [onDestroy] ===============");
- sendBlockSIPCallBR();
- mSound.StopAll();
- mSound.Release();
- MainActivity.mAudioManager.setMode(AudioManager.MODE_NORMAL);
- finishPopUp(ID.POPUP.POPUP_ALL);
- finishManual(ID.MANUAL.MANUAL_ALL);
- sendHandlerMsg(HANDLERMSG.RECOVER_SYSTEM_VOLUME, 0, 0);
- if (sdbLivingRoomLightAPI != null) {
- Log.d(TAG, "[onDestroy] sdbLivingRoomLightAPI.SetWifiModuleOnOff [TRUE]");
- sdbLivingRoomLightAPI.SetWifiModuleOnOff(true);
- }
- Global.ctrlLCDOnOff(false); // 절전모드 해제
- Global.stopMelodyRepeat();
- //ctrlSmartIOTCamStatusMode(SmartRFCamStatusMode.STATUS_OFF);
- //ctrlSmartIOTCamLEDMode(SmartRFCamLEDMode.LED_OFF);
- setChangeScreen(mCurrentScreenId, true);
- releaseCallEngine();
- // if (ConfigValues.eWallPadType == WALLPADTYPE.MAIN) {
- // releaseCallHistoryDB();
- // releaseVisitorPictureHistoryDB();
- // }
- if (mIOInterface != null) {
- mIOInterface.releaseIOInterface();
- mIOInterface = null;
- }
- unregisterWallPadCallLiveBRReceiver();
- // Handler 해제
- if (mWallPadApiCheckHandler != null) {
- mWallPadApiCheckHandler.removeMessages(0);
- mWallPadApiCheckHandler.removeMessages(1);
- mWallPadApiCheckHandler.removeMessages(2);
- mWallPadApiCheckHandler.removeMessages(3);
- mWallPadApiCheckHandler.removeMessages(4);
- mWallPadApiCheckHandler.removeMessages(5);
- }
- if (mFrontCamOpenCheckHandler != null) {
- mFrontCamOpenCheckHandler.removeMessages(0);
- mFrontCamOpenCheckHandler.removeMessages(1);
- mFrontCamOpenCheckHandler.removeMessages(2);
- mFrontCamOpenCheckHandler.removeMessages(3);
- mFrontCamOpenCheckHandler.removeMessages(4);
- mFrontCamOpenCheckHandler.removeMessages(5);
- mFrontCamOpenCheckHandler.removeMessages(6);
- mFrontCamOpenCheckHandler.removeMessages(7);
- }
- if (mCallPathCheckHandler != null) {
- mCallPathCheckHandler.removeMessages(0);
- mCallPathCheckHandler.removeMessages(1);
- mCallPathCheckHandler.removeMessages(2);
- mCallPathCheckHandler.removeMessages(3);
- }
- super.setFinishTimerDestroy();
- notifyAppFinish();
- // setCallAppRunning(false);
- Log.i(TAG, "*************************************************************");
- Log.i(TAG, "******************* [END - MainActivity] ******************");
- Log.i(TAG, "*************************************************************");
- super.onDestroy();
- }
- @Override
- protected void onResume() {
- super.onResume();
- try {
- LOG_INFO("[onResume] ========== START ==========");
- if (mWallPadAPI != null) mWallPadAPI.Resume();
- registerBRReceiver();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] onResume()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- @Override
- protected void onPause() {
- try {
- LOG_INFO("[onPause] ========== START ==========");
- unregisterBRReceiver();
- if (mWallPadAPI != null) mWallPadAPI.Pause();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] onResume()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- super.onPause();
- }
- @Override
- protected void onActivityResult(int requestCode, int resultCode, Intent data) {
- super.onActivityResult(requestCode, resultCode, data);
- Log.d(TAG, "[onActivityResult] requestCode [" + requestCode +"], resultCode [" + resultCode +"]");
- if (mCallController.mCallInfo.getIDLECnt() != mCallController.mCallInfo.IDLECNT_MAX) {
- super.setFinishTimerDestroy();
- }
- if (resultCode == RESULT_OK) {
- try {
- // PopupActivity 에서 FinishTimer 로 인하여 종료가 되었을 경우
- // MainActivity 도 즉시 종료시킨다.
- String code = (String) data.getExtras().get("Finish_Kind");
- Log.d(TAG, "Finish_Kind : " + code);
- if (code.equals("FinishTimer")) {
- Log.d(TAG, "FinishTimer finish");
- finish();
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception Error] [onActivityResult] - data.getExtras().get");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- }
- @Override
- public boolean dispatchKeyEvent(KeyEvent event) {
- if (Common.MODE == Common.MODE_PRODUCTION) {
- int KeyCode = event.getKeyCode();
- if (KeyCode == 221) {
- int Action = event.getAction();
- if (Action == KeyEvent.ACTION_DOWN) {
- Log.i(TAG, "**************************");
- Log.i(TAG, " H/W Emergency BUTTON ");
- Log.i(TAG, "**************************");
- mSound.PlayMent(SND.emergency.DEFAULT); // "[비상 상황]이 발생되었습니다" 비상 경고음
- mTopBackgroundBlinkHandler.sendEmptyMessage(0);
- return true;
- }
- }
- }
- return super.dispatchKeyEvent(event);
- }
- @Override
- public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
- Log.d(TAG, "[onRequestPermissionsResult] requestCode: " + requestCode);
- super.onRequestPermissionsResult(requestCode, permissions, grantResults);
- switch (requestCode) {
- case REQUEST_EXTERNAL_STORAGE: {
- if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
- Log.d(TAG, "[onRequestPermissionsResult] PERMISSION_GRANTED");
- } else {
- Log.d(TAG, "[onRequestPermissionsResult] PERMISSION_NOT_GRANTED");
- }
- return;
- }
- }
- }
- protected Handler mTopBackgroundBlinkHandler = new Handler() {
- int Count = 0;
- @SuppressLint("HandlerLeak")
- @Override
- public void handleMessage(Message msg) {
- if (msg.what == 0) {
- TopBackground.setImageResource(0);
- TopBackground.setBackgroundColor(Color.RED);
- mTopBackgroundBlinkHandler.sendEmptyMessageDelayed(1, 500);
- Count = 0;
- } else if (msg.what == 1) {
- TopBackground.setImageResource(R.drawable.bg_topbar);
- TopBackground.setBackgroundColor(0);
- if (++Count <= 4) mTopBackgroundBlinkHandler.sendEmptyMessageDelayed(2, 500);
- } else if (msg.what == 2) {
- TopBackground.setImageResource(0);
- TopBackground.setBackgroundColor(Color.RED);
- mTopBackgroundBlinkHandler.sendEmptyMessageDelayed(1, 500);
- }
- }
- };
- /* ================================================================================================
- * [BroadcastReceiver] Section
- ================================================================================================ */
- /**
- * BroadcastReceiver.onReceive for [WpadActivity]
- */
- @Override
- protected void onBrReceive(Intent intent) {
- super.onBrReceive(intent);
- LOG_INFO("[onBrReceive] Action : " + intent.getAction());
- }
- /* ================================================================================================
- * [Touch & Key Event] Section
- ================================================================================================ */
- private int LONGKEY_THRESHOLD = 30;
- private int nLongKeyCnt = 0;
- private int nPreviousTargetID = 0;
- private boolean bBlockTopMenuBTN = true;
- @Override
- protected void onTouchEvent(View v, MotionEvent event) {
- super.onTouchEvent(v, event);
- int TargetId = v.getId();
- int MoveEvent = event.getAction();
- // Log.d(TAG, "[onTouchEvent] TargetId [" + TargetId + "], MoveEvent [" + MoveEvent + "]");
- if (MoveEvent == MotionEvent.ACTION_UP) {
- Log.d(TAG, "[onTouchEvent] ACTION UP");
- if (TargetId == ID.TOP.BUTTON.HOME) {
- LOG_INFO("[onTouchEvent] [HOME] BUTTON");
- if (bBlockHomeBTN) return;
- bBlockHomeBTN = true;
- if (mMainEventListener != null) mMainEventListener.onMainTouchEvent(MAINEVENT.BTN_HOME);
- sendHandlerMsgDelayed(HANDLERMSG.REFRESH_HOMEICON, 0, 0, 3000);
- } else if (TargetId == ID.TOP.BUTTON.BACK) {
- LOG_INFO("[onTouchEvent] [BACK] BUTTON");
- mSound.Play(SND.effect.TOUCH_LATCHED);
- if (mCurrentScreenId == ID.SCREEN.SCREEN_VISITORPICTUREVIEWER) {
- setChangeScreen(API_Menu.SubMenuCall.Visitor, false);
- }
- } else if (TargetId == ID.TOP.BUTTON.MENU) {
- LOG_INFO("[onTouchEvent] [MENU] BUTTON -> bBlockTopMenuBTN [" + bBlockTopMenuBTN + "], MenuOpen [" + MenuOpen + "]");
- if (bBlockTopMenuBTN) return;
- if (MenuOpen) {
- return;
- }
- mSound.Play(SND.effect.TOUCH_LATCHED);
- OpenMenuLayout();
- } else if (TargetId == ID.MENU.BUTTON.CLOSE) {
- LOG_INFO("[onTouchEvent] [CLOSE] BUTTON");
- if (MenuOpen) {
- mSound.Play(SND.effect.TOUCH_LATCHED);
- CloseMenuLayout();
- }
- }
- else if (TargetId == ID.TOP.BUTTON.MANUAL) {
- LOG_INFO("[onTouchEvent] [MANUAL] BUTTON [mCurrentScreenId = " + mCurrentScreenId + "]");
- if (mCallController.mCallInfo.getTalkingCnt() <= 0)
- mSound.Play(SND.effect.TOUCH_LATCHED); // 통화중인 경우 버튼 터치음 안나도록 설정
- if (mCurrentScreenId == API_Menu.SubMenuCall.Door) {
- StartManual(ID.MANUAL.MANUAL_TALKFRONT);
- } else if (mCurrentScreenId == API_Menu.SubMenuCall.Lobby) {
- StartManual(ID.MANUAL.MANUAL_TALKLOBBY);
- } else if (mCurrentScreenId == API_Menu.SubMenuCall.Guard) {
- StartManual(ID.MANUAL.MANUAL_TALKGUARD);
- } else if (mCurrentScreenId == API_Menu.SubMenuCall.Neighbor) {
- StartManual(ID.MANUAL.MANUAL_TALKRESIDENCE);
- } else if (mCurrentScreenId == API_Menu.SubMenuCall.PSTN) {
- StartManual(ID.MANUAL.MANUAL_TALKPSTN);
- } else if (mCurrentScreenId == API_Menu.SubMenuCall.CallList) {
- StartManual(ID.MANUAL.MANUAL_INQUIRYCALLHISTORY);
- } else if (mCurrentScreenId == API_Menu.SubMenuCall.Visitor) {
- StartManual(ID.MANUAL.MANUAL_INQUIRYVISITORPICTUREHISTORY);
- } else if (mCurrentScreenId == ID.SCREEN.SCREEN_VISITORPICTUREVIEWER) {
- StartManual(ID.MANUAL.MANUAL_VISITORPICTUREVIEWER);
- }
- }
- } else if (MoveEvent == MotionEvent.ACTION_POINTER_DOWN) {
- if (TargetId == ID.TOP.BUTTON.HIDE) {
- if (nPreviousTargetID == TargetId) {
- if (getPopupActivityRun()) return;
- else nLongKeyCnt++;
- Log.v(TAG, "[onTouchEvent] TargetId [" + TargetId + "], nLongKeyCnt [" + nLongKeyCnt + "]");
- if (nLongKeyCnt > LONGKEY_THRESHOLD) {
- nLongKeyCnt = 0;
- nPreviousTargetID = 0;
- startHideMenu();
- }
- } else {
- nPreviousTargetID = TargetId;
- nLongKeyCnt = 0;
- Log.v(TAG, "[onTouchEvent] nPreviousTargetID [" + nPreviousTargetID + "], TargetId [" + TargetId + "]");
- }
- }
- }
- }
- @Override
- public boolean onKeyDown(int keyCode, KeyEvent event) {
- Log.i(TAG, "[onKeyDown] keyCode : " + keyCode + ", Action : " + event.getAction());
- return super.onKeyDown(keyCode, event);
- }
- /* ================================================================================================
- * [TOP] Section
- ================================================================================================ */
- /**
- * TOP 돌아가기 버튼 활성화 & 비활성화
- *
- * @param Enabled - true : 활성화, false : 비활성화
- * @return (boolean) true : 성공, false : 실패
- */
- public boolean setTopBackBtnVisible(boolean Enabled) {
- if (Enabled) {
- if (TopBackBtn.getVisibility() != View.VISIBLE) TopBackBtn.setVisibility(View.VISIBLE);
- TopBackBtn.bringToFront();
- } else {
- if (TopBackBtn.getVisibility() != View.INVISIBLE)
- TopBackBtn.setVisibility(View.INVISIBLE);
- }
- return true;
- }
- /**
- * TOP 메뉴 버튼 활성화 & 비활성화
- *
- * @param Enabled - true : 활성화, false : 비활성화
- * @return (boolean) true : 성공, false : 실패
- * 2017.11.20 SEULKI
- */
- public boolean setTopMenuBtnVisible(boolean Enabled) {
- if (Enabled) {
- if (TopMenuBtn.getVisibility() != View.VISIBLE) TopMenuBtn.setVisibility(View.VISIBLE);
- TopMenuBtn.bringToFront();
- } else {
- if (TopMenuBtn.getVisibility() != View.INVISIBLE)
- TopMenuBtn.setVisibility(View.INVISIBLE);
- }
- return true;
- }
- public boolean setTopHideBtnVisible(boolean Enabled) {
- if (Enabled) {
- if (TopHideBtn.getVisibility() != View.VISIBLE) TopHideBtn.setVisibility(View.VISIBLE);
- TopHideBtn.bringToFront();
- } else {
- if (TopHideBtn.getVisibility() != View.INVISIBLE)
- TopHideBtn.setVisibility(View.INVISIBLE);
- }
- return true;
- }
- /* ================================================================================================
- * [Popup Activity] Section
- ================================================================================================ */
- public static PopupActivity mPopupActivity;
- /**
- * Popup Activity 를 시작시킨다.
- *
- * @param ScreenId - 팝업시작시 Screen ID
- * @return (boolean) true : 성공, false : 실패
- */
- public boolean StartPopup(int ScreenId) {
- Log.e(TAG, "[StartPopup] ScreenId [" + ScreenId + "], mCurrentPopUpScreenId [" + mCurrentPopUpScreenId + "]");
- if (getPopupActivityRun()) {
- mCurrentPopUpScreenId = ScreenId;
- return ((WpadActivity) (PopupActivity.getContext())).ChangeScreen(ScreenId);
- } else {
- if (mCurrentPopUpScreenId == ScreenId) return false;
- mCurrentPopUpScreenId = ScreenId;
- setPopupActivityRun(true);
- Intent intent = new Intent(mContext, PopupActivity.class);
- intent.putExtra("ScreenId", ScreenId);
- overridePendingTransition(0, 0);
- startActivityForResult(intent, 0);
- return true;
- }
- }
- /**
- * Popup Activity 를 시작시킨다. (시작시 Intent Type 데이터를 전달한다)
- *
- * @param ScreenId - 팝업시작시 Screen ID
- * @param data - 전달할 데이터
- * @return (boolean) true : 성공, false : 실패
- */
- public boolean startPopup(int ScreenId, Intent data) {
- if (getPopupActivityRun()) {
- return false;
- } else {
- if (mCurrentPopUpScreenId == ScreenId) return false;
- mCurrentPopUpScreenId = ScreenId;
- 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;
- }
- }
- public boolean startMultiCallPopup(int ScreenId) {
- LOG("[startMultiCallPopup] ScreenId [" + ScreenId + "]");
- if (getPopupActivityRun()) {
- return false;
- } else {
- if (mCurrentPopUpScreenId == ScreenId) return false;
- mCurrentPopUpScreenId = ScreenId;
- setPopupActivityRun(true);
- Intent intent = new Intent(mContext, PopupActivity.class);
- intent.putExtra("ScreenId", ScreenId);
- Intent data = new Intent();
- data.putExtra("BaseMultiCallType", mCallController.mCallInfo.getBaseMultiCallType().toString());
- data.putExtra("MultiCallType", mCallController.mCallInfo.getMultiCallType().toString());
- data.putExtra("MultiCallStatus", mCallController.mCallInfo.getMultiCallStatus().toString());
- data.putExtra("RemoteName", mCallController.mCallInfo.getMultiCall_Name());
- intent.putExtra("PopupScreenDataIntent", data);
- overridePendingTransition(0, 0);
- startActivityForResult(intent, 0);
- return true;
- }
- }
- public boolean startMultiCallPopup(int ScreenId, CALLSTATUS eCurrentCallStatus) {
- LOG("[startMultiCallPopup] ScreenId [" + ScreenId + "], eCurrentCallStatus [" + eCurrentCallStatus + "]");
- if (getPopupActivityRun()) {
- return false;
- } else {
- if (mCurrentPopUpScreenId == ScreenId) return false;
- mCurrentPopUpScreenId = ScreenId;
- setPopupActivityRun(true);
- Intent intent = new Intent(mContext, PopupActivity.class);
- intent.putExtra("ScreenId", ScreenId);
- Intent data = new Intent();
- data.putExtra("CurrentCallStatus", eCurrentCallStatus.toString());
- data.putExtra("MultiCallType", mCallController.mCallInfo.getMultiCallType().toString());
- data.putExtra("MultiCallStatus", mCallController.mCallInfo.getMultiCallStatus().toString());
- data.putExtra("RemoteName", mCallController.mCallInfo.getMultiCall_Name());
- intent.putExtra("PopupScreenDataIntent", data);
- overridePendingTransition(0, 0);
- startActivityForResult(intent, 0);
- return true;
- }
- }
- public static void resetCurrentPopUpScreenID() {
- try {
- mCurrentPopUpScreenId = -1;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] resetCurrentPopUpScreenID()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public void finishPopUp(int ScreenId) {
- try {
- Log.e(TAG, "[finishPopUp] mCurrentPopUpScreenId [" + mCurrentPopUpScreenId + "], ScreenId [" + ScreenId + "]");
- if (ScreenId == ID.POPUP.POPUP_ALL) FinishPopupActivity();
- else {
- if (mCurrentPopUpScreenId != ScreenId) return;
- if (ScreenId == ID.POPUP.POPUP_NOTICE_SUBPHONETALK) {
- Log.d(TAG, "[finishPopup] mCallController.mCallInfo.getCallOwner() [" + mCallController.mCallInfo.getCallOwner() + "]");
- if (mCallController.mCallInfo.getCallOwner() != CALLOWNER.WALLPAD)
- FinishPopupActivity();
- } else FinishPopupActivity();
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] finishPopUp(int ScreenId)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /**
- * Popup Activity 를 종료시킨다
- */
- public void FinishPopupActivity() {
- try {
- if (mPopupActivity != null) {
- Log.i(TAG, "[FinishPopupActivity]");
- mCurrentPopUpScreenId = -1;
- mPopupActivity.finish();
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] FinishPopupActivity()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /* ================================================================================================
- * [Manual Activity] Section
- ================================================================================================ */
- public static ManualActivity mManualActivity;
- public boolean StartManual(int screenId) {
- Log.d(TAG, "[StartManual] screenId [" + screenId + "], mCurrentManualScreenId [" + mCurrentManualScreenId + "]");
- if (getManualActivityRun()) {
- mCurrentManualScreenId = screenId;
- return ((WpadActivity) (ManualActivity.getContext())).ChangeScreen(screenId);
- }
- else {
- if (mCurrentManualScreenId == screenId) return false;
- mCurrentManualScreenId = screenId;
- setManualActivityRun(true);
- Intent intent = new Intent(mContext, ManualActivity.class);
- intent.putExtra("ScreenId", screenId);
- overridePendingTransition(0, 0);
- startActivityForResult(intent, 0);
- return true;
- }
- }
- public static void resetCurrentManualScreenID() {
- try {
- mCurrentManualScreenId = -1;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] resetCurrentManualScreenID()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public void finishManual(int screenId) {
- try {
- Log.d(TAG, "[finishManual] mCurrentManualScreenId [" + mCurrentManualScreenId +"], screenId [" + screenId +"]");
- if (screenId == ID.MANUAL.MANUAL_ALL) FinishManualActivity();
- else {
- if (mCurrentManualScreenId != screenId) return;
- FinishManualActivity();
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] finishManual(int screenId)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public static void FinishManualActivity() {
- Log.i(TAG, "[FinishManualActivity]");
- try {
- if (mManualActivity != null) {
- mCurrentManualScreenId = -1;
- mManualActivity.finish();
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] FinishManualActivity()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /**
- * 매뉴얼 버튼 사용 유무
- * @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 [1]");
- return false;
- }
- } else {
- // 미사용
- Log.d(TAG, "[getManualUse] Not Use Manual [2]");
- return false;
- }
- }
- public void setManualBtnVisible(boolean bUse, int marginLeft) {
- try {
- Log.d(TAG, "[setManualBtnVisible] bUse [" + bUse + "], marginLeft [" + marginLeft + "]");
- if (bUse) TopManualBtn.setVisibility(View.VISIBLE);
- else TopManualBtn.setVisibility(View.INVISIBLE);
- TopLayout.removeView(TopManualBtn);
- ViewRegistration(TopLayout, TopManualBtn, marginLeft, 0);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] setManualBtnVisible(boolean bEnable)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public void setTopSetBtnVisible(boolean Enabled) {
- if (TopSetBtn != null) {
- if (Enabled) {
- if (TopSetBtn.getVisibility() != View.VISIBLE) TopSetBtn.setVisibility(View.VISIBLE);
- TopSetBtn.bringToFront();
- if (TopSetBtn.getVisibility() == View.VISIBLE) {
- WpadUtil.ViewMove(TopManualBtn, 893, 0);
- }
- } else {
- if (TopSetBtn.getVisibility() != View.INVISIBLE)
- TopSetBtn.setVisibility(View.INVISIBLE);
- if (TopSetBtn.getVisibility() == View.INVISIBLE) {
- WpadUtil.ViewMove(TopManualBtn, 1019, 0);
- }
- }
- }
- }
- /* ================================================================================================
- * [Screen] Section
- ================================================================================================ */
- /**
- * Screen 에서 Screen 변경을 요청할 경우 호출된다.<br>
- * Override 사용하여 Screen 변경을 처리한다.<br>
- *
- * @param nScreenId - 변경할 Screen ID
- * @return (boolean) true : 성공, false : 실패
- */
- @Override
- protected boolean onChangeScreen(int nScreenId) {
- super.onChangeScreen(nScreenId);
- return setChangeScreen(nScreenId, false);
- }
- /**
- * Screen 등록자<br>
- * ScreenLayout 에 현재 Screen 을 삭제하고, 새로운 Screen 을 등록시킨다.
- *
- * @param nScreenId - 변경할 Screen ID
- * @param OnlyRemove - 현재 Screen 을 삭제만 할 경우 (onDestroy 에서 사용)
- * @return (boolean) true : 성공, false : 실패
- */
- public boolean setChangeScreen(int nScreenId, boolean OnlyRemove) {
- LOG_INFO("[setChangeScreen] OnlyRemove [" + OnlyRemove + "], CurrentLayoutId(mCurrentScreenId) [" + mCurrentScreenId + "], NextLayoutId(nScreenId) [" + nScreenId + "]");
- if (!OnlyRemove && mCurrentScreenId == nScreenId) {
- Log.w(TAG, "[setChangeScreen] mCurrentScreenId is same as nScreenId");
- setFinishTimerCreate(Common.FINISH_TIME_START_SCREEN);
- return true;
- }
- // 1. 현재 Layout 삭제
- if (mCurrentScreenId > 0) {
- ScreenLayout.removeAllViews();
- super.setCurrentScreen(null);
- }
- if (OnlyRemove) return true;
- mCurrentScreenId = nScreenId;
- // 2. 새로운 Layout 표시
- try {
- switch (nScreenId) {
- case API_Menu.SubMenuCall.Door:
- setTitleText(API_Menu.SubMenuCall.Name_Door);
- ScreenTalkFront = new TalkFront(this, ScreenLayout);
- super.setCurrentScreen(ScreenTalkFront);
- break;
- case API_Menu.SubMenuCall.Lobby:
- //modify KSJ 2022.04.26 통화 메뉴
- setTitleText("대문");
- //setTitleText(API_Menu.SubMenuCall.Name_Lobby);
- ScreenTalkLobby = new TalkLobby(this, ScreenLayout);
- super.setCurrentScreen(ScreenTalkLobby);
- break;
- case API_Menu.SubMenuCall.Guard:
- setTitleText(API_Menu.SubMenuCall.Name_Guard);
- ScreenTalkGuard = new TalkGuard(this, ScreenLayout);
- super.setCurrentScreen(ScreenTalkGuard);
- break;
- case API_Menu.SubMenuCall.Neighbor:
- setTitleText(API_Menu.SubMenuCall.Name_Neighbor);
- ScreenTalkResidence = new TalkResidence(this, ScreenLayout);
- super.setCurrentScreen(ScreenTalkResidence);
- break;
- case API_Menu.SubMenuCall.PSTN:
- setTitleText(API_Menu.SubMenuCall.Name_PSTN);
- ScreenTalkPSTN = new TalkPSTN(this, ScreenLayout, mWallPadAPI);
- super.setCurrentScreen(ScreenTalkPSTN);
- break;
- case API_Menu.SubMenuCall.CallList:
- setTitleText(API_Menu.SubMenuCall.Name_CallList);
- ScreenInquiryCallHistory = new InquiryCallHistory(this, ScreenLayout);
- super.setCurrentScreen(ScreenInquiryCallHistory);
- break;
- case API_Menu.SubMenuCall.Visitor:
- setTitleText(API_Menu.SubMenuCall.Name_Visitor);
- ScreenInquiryVisitorPictureHistory = new InquiryVisitorPictureHistory(this, ScreenLayout);
- super.setCurrentScreen(ScreenInquiryVisitorPictureHistory);
- break;
- case ID.SCREEN.SCREEN_VISITORPICTUREVIEWER:
- ScreenVisitorPictureViewer = new VisitorPictureViewer(this, ScreenLayout);
- super.setCurrentScreen(ScreenVisitorPictureViewer);
- break;
- case ID.SCREEN.SCREEN_TALKFRONT_SUBWALLPAD:
- setTitleText(API_Menu.SubMenuCall.Name_Door);
- ScreenTalkFrontSub = new TalkFront_SubWallPad(this, ScreenLayout);
- super.setCurrentScreen(ScreenTalkFrontSub);
- break;
- case ID.SCREEN.SCREEN_TALKLOBBY_SUBWALLPAD:
- //modify KSJ 2022.04.26 통화 메뉴
- setTitleText("대문");
- //setTitleText(API_Menu.SubMenuCall.Name_Lobby);
- ScreenTalkLobbySub = new TalkLobby_SubWallPad(this, ScreenLayout);
- super.setCurrentScreen(ScreenTalkLobbySub);
- break;
- case ID.SCREEN.SCREEN_TALKGUARD_SUBWALLPAD:
- setTitleText(API_Menu.SubMenuCall.Name_Guard);
- ScreenTalkGuardSub = new TalkGuard_SubWallPad(this, ScreenLayout);
- super.setCurrentScreen(ScreenTalkGuardSub);
- break;
- case ID.SCREEN.SCREEN_TALKRESIDENCE_SUBWALLPAD:
- setTitleText(API_Menu.SubMenuCall.Name_Neighbor);
- ScreenResidenceSub = new TalkResidence_SubWallPad(this, ScreenLayout);
- super.setCurrentScreen(ScreenResidenceSub);
- break;
- case ID.SCREEN.SCREEN_TALKPSTN_SUBWALLPAD:
- setTitleText(API_Menu.SubMenuCall.Name_PSTN);
- ScreenPSTNSub = new TalkPSTN_SubWallPad(this, ScreenLayout);
- super.setCurrentScreen(ScreenPSTNSub);
- break;
- default:
- Log.e(TAG, "[setChangeScreen] nScreenId Not found!!! [" + mCurrentScreenId + "]");
- mCurrentScreenId = -1;
- return false;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] setChangeScreen->Screen Create");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- return true;
- }
- private void setTitleText(String setText) {
- if (setText != null)
- TopTitle.setText(setText);
- }
- /**
- * 통화기능 사용여부 판별
- */
- private void getCallFunctionUse() {
- WallpadDeviceSet devSet = new WallpadDeviceSet(mContext);
- bFrontCallUse = devSet.Get_FrontCallUse();
- bLobbyCallUse = devSet.Get_LobbyCallUse();
- bGuardCallUse = devSet.Get_GuardCallUse();
- bResiCallUse = devSet.Get_ResidenceCallUse();
- bPSTNCallUse = devSet.Get_PSTNCallUse();
- bCallHistoryUse = devSet.Get_CallHistoryUse();
- bVisitorPicUse = devSet.Get_VisitorPicUse();
- devSet.closeDB();
- LOG("[getCallFunctionUse] bFrontCallUse [" + bFrontCallUse + "], bLobbyCallUse [" + bLobbyCallUse + "], bGuardCallUse [" + bGuardCallUse + "], " +
- "bResiCallUse [" + bResiCallUse + "], bPSTNCallUse [" + bPSTNCallUse + "], bCallHistoryUse [" + bCallHistoryUse + "], bVisitorPicUse [" + bVisitorPicUse + "]");
- }
- /* ================================================================================================
- * [Menu Layout] Section
- ================================================================================================ */
- /**
- * 콜 호출에 의한 화면 변경시에만 호출
- **/
- public void changeMenuNScreen(int nMenuID) {
- try {
- LOG("[changeMenuNScreen] nMenuID [" + nMenuID + "]");
- int nScreenId;
- if (ConfigValues.eWallPadType == WALLPADTYPE.MAIN) {
- switch (nMenuID) {
- case ID.MENU.MENU_TALKFRONT:
- nScreenId = API_Menu.SubMenuCall.Door;
- break;
- case ID.MENU.MENU_TALKLOBBY:
- nScreenId = API_Menu.SubMenuCall.Lobby;
- break;
- case ID.MENU.MENU_TALKGUARD:
- nScreenId = API_Menu.SubMenuCall.Guard;
- break;
- case ID.MENU.MENU_TALKRESIDENCE:
- nScreenId = API_Menu.SubMenuCall.Neighbor;
- break;
- case ID.MENU.MENU_TALKPSTN:
- nScreenId = API_Menu.SubMenuCall.PSTN;
- break;
- case ID.MENU.MENU_INQUIRYCALLHISTORY:
- nScreenId = API_Menu.SubMenuCall.CallList;
- break;
- case ID.MENU.MENU_INQUIRYVISITORPIC:
- nScreenId = API_Menu.SubMenuCall.Visitor;
- break;
- default:
- nScreenId = -1;
- break;
- }
- }
- else {
- switch (nMenuID) {
- case ID.MENU.MENU_TALKFRONT:
- nScreenId = ID.SCREEN.SCREEN_TALKFRONT_SUBWALLPAD;
- break;
- case ID.MENU.MENU_TALKLOBBY:
- nScreenId = ID.SCREEN.SCREEN_TALKLOBBY_SUBWALLPAD;
- break;
- case ID.MENU.MENU_TALKGUARD:
- nScreenId = ID.SCREEN.SCREEN_TALKGUARD_SUBWALLPAD;
- break;
- case ID.MENU.MENU_TALKRESIDENCE:
- nScreenId = ID.SCREEN.SCREEN_TALKRESIDENCE_SUBWALLPAD;
- break;
- case ID.MENU.MENU_TALKPSTN:
- nScreenId = ID.SCREEN.SCREEN_TALKPSTN_SUBWALLPAD;
- break;
- default:
- nScreenId = -1;
- break;
- }
- }
- if (nScreenId > 0) {
- setChangeScreen(nScreenId, false);
- }
- else LOG_WARN("[changeMenuNScreen] nScreen id is less than zero!");
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] changeMenuNScreen(int nMenuID)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private int getScreenId(CALLTYPE eCallType) {
- try {
- Log.d(TAG, "[getScreenId]");
- if (ConfigValues.eWallPadType == WALLPADTYPE.MAIN) {
- if (eCallType == CALLTYPE.FRONT) return API_Menu.SubMenuCall.Door;
- else if (eCallType == CALLTYPE.LOBBY) return API_Menu.SubMenuCall.Lobby;
- else if (eCallType == CALLTYPE.GUARD) return API_Menu.SubMenuCall.Guard;
- else if (eCallType == CALLTYPE.RESIDENCE) return API_Menu.SubMenuCall.Neighbor;
- else if (eCallType == CALLTYPE.PSTN) return API_Menu.SubMenuCall.PSTN;
- else if (eCallType == CALLTYPE.HISTORY_CALL) return API_Menu.SubMenuCall.CallList;
- else if (eCallType == CALLTYPE.HISTORY_VISITORPIC) return API_Menu.SubMenuCall.Visitor;
- else return API_Menu.SubMenuCall.Guard;
- }
- else {
- if (eCallType == CALLTYPE.FRONT) return ID.SCREEN.SCREEN_TALKFRONT_SUBWALLPAD;
- else if (eCallType == CALLTYPE.LOBBY) return ID.SCREEN.SCREEN_TALKLOBBY_SUBWALLPAD;
- else if (eCallType == CALLTYPE.GUARD) return ID.SCREEN.SCREEN_TALKGUARD_SUBWALLPAD;
- else if (eCallType == CALLTYPE.RESIDENCE) return ID.SCREEN.SCREEN_TALKRESIDENCE_SUBWALLPAD;
- else if (eCallType == CALLTYPE.PSTN) return ID.SCREEN.SCREEN_TALKPSTN_SUBWALLPAD;
- else return ID.SCREEN.SCREEN_TALKGUARD_SUBWALLPAD;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return API_Menu.SubMenuCall.Guard;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getScreenId");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return API_Menu.SubMenuCall.Guard;
- }
- }
- private int getConvertScreenId(int nScreenId) {
- try {
- switch (nScreenId) {
- case ID.SCREEN.SCREEN_TALKFRONT_SUBWALLPAD:
- return API_Menu.SubMenuCall.Door;
- case ID.SCREEN.SCREEN_TALKLOBBY_SUBWALLPAD:
- return API_Menu.SubMenuCall.Lobby;
- case ID.SCREEN.SCREEN_TALKGUARD_SUBWALLPAD:
- return API_Menu.SubMenuCall.Guard;
- case ID.SCREEN.SCREEN_TALKRESIDENCE_SUBWALLPAD:
- return API_Menu.SubMenuCall.Neighbor;
- default:
- return API_Menu.SubMenuCall.Guard;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return API_Menu.SubMenuCall.Guard;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] int getConvertScreenId(int nScreenId)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return API_Menu.SubMenuCall.Guard;
- }
- }
- private Menu StartMenuSetting() {
- Log.d(TAG, "[StartMenuSetting]");
- Menu mMenu = new Menu();
- Intent mIntent = getIntent();
- strCallOwner = mIntent.getStringExtra(CALLTRIGGER.CALLOWNER);
- strCallEvent = mIntent.getStringExtra(CALLTRIGGER.CALLEVENTTYPE);
- strCallType = mIntent.getStringExtra(CALLTRIGGER.CALLTYPE);
- strRemoteInfo = mIntent.getStringExtra(CALLTRIGGER.REMOTEINFO);
- int nStartScreenId = API_Menu.SubMenuCall.Guard;
- Log.d(TAG, "[StartMenuSetting] strCallOwner [" + strCallOwner + "], strCallEvent [" + strCallEvent + "], " + "strCallType [" + strCallType + "], strRemoteInfo [" + strRemoteInfo + "]");
- if (strCallEvent != null && strCallType != null) {
- nStartScreenId = getScreenId(CALLTYPE.getCALLTYPE(strCallType));
- Log.d(TAG, "[StartMenuSetting] strCallEvent [" + strCallEvent + "], nStartScreenId [" + nStartScreenId + "]");
- }
- mMenu.StartId = nStartScreenId;
- mMenu.Opiton = -1;
- return mMenu;
- }
- /**
- * 메뉴 레이아웃 생성
- **/
- private void OpenMenuLayout() {
- Log.d(TAG, "[OpenMenuLayout] MenuOpen [" + MenuOpen + "]");
- if (MenuOpen) {
- return;
- }
- if (menuListDataClass == null) {
- return;
- }
- //0. 현재 ID 및 리스트 불러오기
- String Title = null;
- String TempChildName = null;
- int ChooseGroup = 0;
- int ChooseChild = 0;
- if (ConfigValues.eWallPadType == WALLPADTYPE.MAIN) {
- Title = API_Menu.GetGroupNameByID((mCurrentScreenId / 1000) * 1000);
- for (int i = 0; i < menuListDataClass.arrayGroup.size(); i++) {
- if (menuListDataClass.arrayGroup.get(i).equals(Title)) {
- ChooseGroup = i;
- break;
- }
- }
- for (int i = 0; i < menuListDataClass.idMappingTable.length; i++) {
- if (menuListDataClass.idMappingTable[i].Id == mCurrentScreenId) {
- TempChildName = menuListDataClass.idMappingTable[i].Name;
- break;
- } else if (ID.SCREEN.SCREEN_VISITORPICTUREVIEWER == mCurrentScreenId) {
- // 방문자사진 상세보기 화면에서 메뉴 버튼 클릭 기능 구현 seulki
- Title = API_Menu.SubMenuCall.Name;
- TempChildName = API_Menu.SubMenuCall.Name_Visitor;
- break;
- }
- }
- }
- else {
- int convertScreenId = getConvertScreenId(mCurrentScreenId);
- Title = API_Menu.GetGroupNameByID((convertScreenId / 1000) * 1000);
- LOG("[OpenMenuLayout] mCurrentScreenId [" + convertScreenId + "], Title [" + Title + "]");
- for (int i = 0; i < menuListDataClass.arrayGroup.size(); i++) {
- if (menuListDataClass.arrayGroup.get(i).equals(Title)) {
- ChooseGroup = i;
- break;
- }
- }
- for (int i = 0; i < menuListDataClass.idMappingTable.length; i++) {
- if (menuListDataClass.idMappingTable[i].Id == mCurrentScreenId) {
- TempChildName = menuListDataClass.idMappingTable[i].Name;
- break;
- }
- }
- }
- if (TempChildName == null) {
- Log.e(TAG, "[OpenMenuLayout] TempChildName == null");
- return;
- }
- for (int i = 0; i < menuListDataClass.arrayChild.get(Title).size(); i++) {
- Log.d(TAG, "[OpenMenuLayout] menuListDataClass.arrayChild.get(Title).get(i): " + menuListDataClass.arrayChild.get(Title).get(i));
- if (menuListDataClass.arrayChild.get(Title).get(i).equals(TempChildName)) {
- ChooseChild = i;
- break;
- }
- }
- //1. 기존 화면 투명도 변경
- TopLayout.setAlpha(0.5f);
- ScreenLayout.setAlpha(0.5f);
- // 모티터링중 메뉴오픈시 겹침현상 해결 -> FRONT SurfaceView INVISIBLE
- if (FrontVideoSurface != null) {
- FrontVideoSurface.setVisibility(View.INVISIBLE);
- }
- //2. Layout 생성 및 처리 이벤트 등록
- MenuLayout = new RelativeLayout(this);
- WpadUtil.LayoutRegistration(AllLayout, MenuLayout, screenWidth, screenHeight, 0, 0, ID.MAINACTIVITY.LAYOUT.MENU);
- MenuLayout.setOnTouchListener(new Button.OnTouchListener() {
- @Override
- public boolean onTouch(View v, MotionEvent event) {
- if (event.getAction() == MotionEvent.ACTION_UP) {
- setFinishTimerReset();
- CloseMenuLayout();
- }
- return true;
- }
- });
- //3. 배경 이미지 생성 및 에니메이션 등록
- MenuBackground = new WpadImageView(this, TOUCH_KIND.BUTTON, 460, 800, R.drawable.bg_menu, R.drawable.bg_menu, ID.MENU.IMAGE.BACKGROUND);
- TranslateAnimation anim = new TranslateAnimation(WpadScale.getWidth(-460), 0, 0, 0);
- anim.setDuration(200);
- anim.setInterpolator(new AccelerateInterpolator());
- MenuLayout.setAnimation(anim);
- ViewRegistration(MenuLayout, MenuBackground, 0, 0);
- //4. 타이틀 등록
- MenuTitle = new WpadTextView(this, false, 247, 80, Gravity.LEFT, Color.WHITE, fontSize, true, ID.TOP.TEXT.TITLE);
- ViewRegistration(MenuLayout, MenuTitle, 133, 15);
- MenuTitle.setText(Title);
- //5. 종료 버튼 등록
- MenuClose = new WpadImageView(this, TOUCH_KIND.BUTTON, 80, 80, R.drawable.topbar_icon_close_normal, R.drawable.topbar_icon_close_pressed, ID.MENU.BUTTON.CLOSE);
- MenuClose.setTouchDelayMs(1000);
- ViewRegistration(MenuLayout, MenuClose, 380, 15);
- //6. 리스트뷰 초기화 및 등록
- mListView = new ExpandableListView(this);
- ExpandableListView.LayoutParams params = new ExpandableListView.LayoutParams(WpadScale.getWidth(460), WpadScale.getHeight(690));
- mListView.setLayoutParams(params);
- mListView.setX(WpadScale.getWidth(0));
- mListView.setY(WpadScale.getHeight(112));
- mListView.setBackgroundColor(Color.BLACK);
- mListView.setId(ID.MENU.VIEW.LISTVIEW);
- mListView.setGroupIndicator(null);
- mListView.setDividerHeight(0);
- mListView.setDivider(null);
- mListView.setFocusable(true);
- mListView.setSmoothScrollbarEnabled(true);
- mListView.setTranscriptMode(android.widget.AbsListView.TRANSCRIPT_MODE_DISABLED);
- mListView.setScrollbarFadingEnabled(true);
- MenuLayout.addView(mListView);
- adptMain = new Menu_AdptMain(this, menuListDataClass.arrayGroup, menuListDataClass.arrayChild, ChooseGroup, ChooseChild);
- mListView.setAdapter(adptMain);
- //7. 선택된 그룹 열기
- mListView.setSelectedGroup(ChooseGroup);
- mListView.expandGroup(ChooseGroup);
- // 8. 리스트뷰 터치 이벤트 등록
- mListView.setOnTouchListener(new View.OnTouchListener() {
- @Override
- public boolean onTouch(View v, MotionEvent event) {
- if ((event.getAction() == MotionEvent.ACTION_DOWN) ||
- (event.getAction() == MotionEvent.ACTION_UP)) {
- WpadActivity.setFinishTimerReset();
- }
- return false;
- }
- });
- // 9. 그룹 터치 이벤트 등록
- mListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
- @Override
- public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
- LOG_INFO("group click = " + groupPosition);
- WpadActivity.setFinishTimerReset();
- return false;
- }
- });
- /*
- // 10. 차일드 터치 이벤트 등록
- mListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
- @Override
- public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
- LOG_INFO("onChildClick");
- LOG_INFO("groupPosition = " + groupPosition);
- LOG_INFO("childPosition = " + childPosition);
- WpadActivity.setFinishTimerReset();
- return false;
- }
- });
- */
- // 11. 그룹 열리는 경우 이벤트
- mListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
- @Override
- public void onGroupExpand(int groupPosition) {
- LOG_INFO("groupPosition Open Event = " + groupPosition);
- mSound.Play(SND.effect.TOUCH_LATCHED);
- WpadActivity.setFinishTimerReset();
- }
- });
- // 12. 그룹 닫히는 경우 이벤트
- mListView.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener() {
- @Override
- public void onGroupCollapse(int groupPosition) {
- LOG_INFO("groupPosition Close Event = " + groupPosition);
- mSound.Play(SND.effect.TOUCH_LATCHED);
- WpadActivity.setFinishTimerReset();
- }
- });
- // 13. MenuOpen True 설정
- MenuOpen = true;
- }
- /**
- * 메뉴 layout 닫힘 처리
- **/
- private void CloseMenuLayout() {
- Log.d(TAG, "[CloseMenuLayout] MenuOpen [" + MenuOpen + "]");
- if (!MenuOpen) {
- return;
- }
- // 메뉴오픈시 INVISIBLE 처리했던 FRONT SurfaceView VISIBLE
- if (FrontVideoSurface != null) {
- FrontVideoSurface.setVisibility(View.VISIBLE);
- }
- TranslateAnimation anim = new TranslateAnimation(0, WpadScale.getWidth(-460), 0, 0);
- anim.setDuration(200);
- anim.setInterpolator(new AccelerateInterpolator());
- anim.setAnimationListener(new Animation.AnimationListener() {
- @Override
- public void onAnimationStart(Animation animation) {
- MenuOpen = false;
- }
- @Override
- public void onAnimationRepeat(Animation animation) {
- }
- @Override
- public void onAnimationEnd(Animation animation) {
- AllLayout.removeView(MenuLayout);
- TopLayout.setAlpha(1.0f);
- ScreenLayout.setAlpha(1.0f);
- }
- });
- MenuLayout.startAnimation(anim);
- }
- /**
- * 메뉴 그룹 터치시 처리 (Menu_AdptMain에서 호출)
- **/
- public static void SetListViewGroupExpand_Collapse(int GroupId, boolean ExpandEnable) {
- if (ExpandEnable) {
- mListView.expandGroup(GroupId);
- } else {
- mListView.collapseGroup(GroupId);
- }
- }
- /**
- * Menu정보가 DB에 없을 경우 불러올 스크린 로딩
- *
- * @return MenuListDataClass 타입의 초기정보
- **/
- private MenuListDataClass LoadDefaultMenuList() {
- MenuListDataClass Temp_menuListDataClass = new MenuListDataClass();
- Temp_menuListDataClass.SetArrayGroup(API_Menu.SubMenuCall.Name);
- ArrayList<String> arrayList = new ArrayList<String>();
- int ChildCount = 0;
- //[수정필요]
- //추가 또는 수정해야할 부분 1. - Menu정보가 DB에 없을 경우 불러올 스크린 종류(시작)
- arrayList.add(API_Menu.SubMenuCall.Name_Door);
- ChildCount++;
- arrayList.add(API_Menu.SubMenuCall.Name_Lobby);
- ChildCount++;
- arrayList.add(API_Menu.SubMenuCall.Name_Guard);
- ChildCount++;
- arrayList.add(API_Menu.SubMenuCall.Name_Neighbor);
- ChildCount++;
- Temp_menuListDataClass.SetArrayChild(API_Menu.SubMenuCall.Name, arrayList);
- //추가 또는 수정해야할 부분 1. - Menu정보가 DB에 없을 경우 불러올 스크린 종류(끝)
- Temp_menuListDataClass.idMappingTable = new ChildIDMapping[ChildCount];
- for (int i = 0; i < ChildCount; i++) {
- Temp_menuListDataClass.idMappingTable[i] = new ChildIDMapping();
- //추가 또는 수정해야할 부분 2. - 불러올 스크린의 Id를 임의로 입력(시작)
- if (arrayList.get(i).equals(API_Menu.SubMenuCall.Name_Door)) {
- // Temp_menuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCall.Door;
- Temp_menuListDataClass.idMappingTable[i].Id = ID.SCREEN.SCREEN_TALKFRONT_SUBWALLPAD;
- Temp_menuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCall.Name_Door;
- } else if (arrayList.get(i).equals(API_Menu.SubMenuCall.Name_Lobby)) {
- // Temp_menuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCall.Lobby;
- Temp_menuListDataClass.idMappingTable[i].Id = ID.SCREEN.SCREEN_TALKLOBBY_SUBWALLPAD;
- Temp_menuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCall.Name_Lobby;
- } else if (arrayList.get(i).equals(API_Menu.SubMenuCall.Name_Guard)) {
- // Temp_menuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCall.Guard;
- Temp_menuListDataClass.idMappingTable[i].Id = ID.SCREEN.SCREEN_TALKGUARD_SUBWALLPAD;
- Temp_menuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCall.Name_Guard;
- } else if (arrayList.get(i).equals(API_Menu.SubMenuCall.Name_Neighbor)) {
- // Temp_menuListDataClass.idMappingTable[i].Id = API_Menu.SubMenuCall.Neighbor;
- Temp_menuListDataClass.idMappingTable[i].Id = ID.SCREEN.SCREEN_TALKRESIDENCE_SUBWALLPAD;
- Temp_menuListDataClass.idMappingTable[i].Name = API_Menu.SubMenuCall.Name_Neighbor;
- }
- LOG("[LoadDefaultMenuList] Temp_menuListDataClass.idMappingTable[" + i + "].id = " + Temp_menuListDataClass.idMappingTable[i].Id);
- LOG("[LoadDefaultMenuList] Temp_menuListDataClass.idMappingTable[" + i + "].Name = " + Temp_menuListDataClass.idMappingTable[i].Name);
- //추가 또는 수정해야할 부분 2. - 불러올 스크린의 Id를 임의로 입력(끝)
- }
- return Temp_menuListDataClass;
- }
- /**
- * Menu Event intent filter 등록
- **/
- private void reg_Receiver() {
- try {
- IntentFilter filter = new IntentFilter();
- filter.addAction("MENU_EVENT");
- registerReceiver(mWallPadAlertBR, filter);
- filter = new IntentFilter();
- filter.addAction(define.NOTIFY_DAIL);
- filter.addAction("WALLPAD_DIAL_GLOBALSCREEN_TOUCH");
- registerReceiver(mWallPadJogBR, filter);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /**
- * 조그버튼 입력 받을 시 처리
- **/
- BroadcastReceiver mWallPadJogBR = new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- WpadActivity.setFinishTimerReset();
- }
- };
- /**
- * 메뉴에서 버튼 터치 처리
- **/
- BroadcastReceiver mWallPadAlertBR = new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- int groupPosition = intent.getIntExtra("groupPosition", -1);
- int childPosition = intent.getIntExtra("childPosition", -1);
- // 메뉴 터치에 의해 현관화면 진입시 모니터링을 바로 시작하기 위한 플래그 설정
- // if (childPosition == 0) {
- // if (ConfigValues.eWallPadType == WALLPADTYPE.MAIN) Global.bFrontMonitoring = true;
- // else Global.bFrontMonitoring_SubWallPad = true;
- // } else {
- // if (ConfigValues.eWallPadType == WALLPADTYPE.MAIN) Global.bFrontMonitoring = false;
- // else Global.bFrontMonitoring_SubWallPad = false;
- // }
- LOG_INFO("[mWallPadAlertBR] bEnablePSTN [" + Global.bEnablePSTN + "]");
- if (bLobbyCallUse && (childPosition == 1)) return; // 로비메뉴 화면전환 없음
- if (bPSTNCallUse && !Global.bEnablePSTN) return; // 국선통화 모뎀초기화 안될 경우 화면전환 없음
- if ((groupPosition >= 0) && (childPosition >= 0)) {
- if (MenuOpen) {
- mSound.Play(SND.effect.TOUCH_LATCHED);
- CloseMenuLayout();
- if (menuListDataClass == null) {
- return;
- }
- String childName = menuListDataClass.arrayChild.get(menuListDataClass.arrayGroup.get(groupPosition)).get(childPosition);
- for (int i = 0; i < menuListDataClass.idMappingTable.length; i++) {
- if (menuListDataClass.idMappingTable[i].Name.equals(childName)) {
- API_Menu api_Menu = new API_Menu();
- int TempId = api_Menu.GetMyGroupID(getApplicationContext().getPackageName());
- int ChildId = menuListDataClass.idMappingTable[i].Id;
- int ChildGroupId = (ChildId / 1000) * 1000;
- if (ConfigValues.eWallPadType == WALLPADTYPE.SUB) ChildGroupId = (getConvertScreenId(ChildId) / 1000) * 1000;
- Log.i(TAG, "[mWallPadAlertBR] Child Id [" + ChildId + "], ChildGroupId [" + ChildGroupId + "]");
- if (TempId == 0) {
- return;
- }
- if (ChildGroupId == TempId) {
- //해당 APP 내에서 스크린 전환 필요
- boolean bResult = setChangeScreen(ChildId, false);
- if (bResult) {
- if (API_Menu.SubMenuCall.Door == ChildId) {
- // 현관통화
- if (!bBlockFrontCall) {
- if (mCallController.mCallInfo.getFRONT() == CALLSTATUS.IDLE) {
- setBlockFrontCall();
- if (mCallController != null) mCallController.CallScenarioManager(CALLOWNER.WALLPAD, CALLEVENTTYPE.REQUEST_FRONT_MONITORING, CALLTYPE.FRONT, null, null, null);
- else Log.w(TAG, "[mWallPadAlertBR] mCallController is null!!");
- }
- else {
- Log.w(TAG, "[mWallPadAlertBR] Front call ignored!!! getFRONT() [" + mCallController.mCallInfo.getFRONT() + "]");
- }
- }
- else {
- Log.w(TAG, "[mWallPadAlertBR] Front call ignored!!! bBlockFrontCall [" + bBlockFrontCall + "]");
- }
- }
- }
- else {
- int nScreenID = API_Menu.SubMenuCall.Guard;
- if (!bGuardCallUse) {
- if (bFrontCallUse) nScreenID = API_Menu.SubMenuCall.Door;
- else if (bResiCallUse) nScreenID = API_Menu.SubMenuCall.Neighbor;
- else if (bPSTNCallUse) nScreenID = API_Menu.SubMenuCall.PSTN;
- else if (bCallHistoryUse) nScreenID = API_Menu.SubMenuCall.CallList;
- else if (bVisitorPicUse) nScreenID = API_Menu.SubMenuCall.Visitor;
- }
- setChangeScreen(nScreenID, false);
- }
- WpadActivity.setFinishTimerReset();
- }
- else {
- //외부 앱 호출 후, 본 APP Finish 필요
- api_Menu.startSubScreenActivity(getApplicationContext(), menuListDataClass.idMappingTable[i].Id, API_Menu.MENU_START_OPTION_1, api_Menu.GetAPK_Name_ByID(ChildGroupId));
- Intent mIntent = new Intent();
- mIntent.putExtra("Finish_Kind", "HomeButton");
- MainActivity.this.setResult(RESULT_OK, mIntent);
- finish();
- }
- break;
- }
- }
- }
- }
- }
- };
- // TAB 버튼 이벤트 -> MENU 버튼 이벤트 (2017.11.20 SEULKI)
- public void setMenuBTNEnable(boolean bEnable) {
- try {
- LOG("[setMenuBTNEnable] bEnable: " + bEnable);
- if (bEnable) TopMenuBtn.setButtonEventOffDisable();
- else TopMenuBtn.setButtonEventOffEnable();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] setMenuBTNEnable(boolean bEnable)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /**
- * 디바이스 서비스 APP 을 체크하여 실행되어있지 않을시 실행시킨다.
- */
- private void checkDevService() {
- try {
- class checkDeviceService extends Thread {
- @Override
- public void run() {
- super.run();
- boolean DevServiceExist = false;
- ActivityManager mActivityManager = (ActivityManager) getApplicationContext().getSystemService(Context.ACTIVITY_SERVICE);
- List<ActivityManager.RunningServiceInfo> mRunningServiceInfo = mActivityManager.getRunningServices(1000);
- for (int i = 0; i < mRunningServiceInfo.size(); i++) {
- ActivityManager.RunningServiceInfo rsi = mRunningServiceInfo.get(i);
- if (rsi.service.getPackageName().equals("com.artncore.deviceservice")) {
- Log.d(TAG, "[checkDevService] DeviceService already running!");
- DevServiceExist = true;
- break;
- }
- }
- Log.d(TAG, "[checkDevService] DevServiceExist: " + DevServiceExist);
- if (!DevServiceExist) {
- Log.d(TAG, "[checkDevService] DeviceService manually started!!!");
- Intent intent = new Intent("wallpaddevservice.ServiceMain");
- startService(intent);
- }
- }
- }
- checkDeviceService th_checkDeviceService = new checkDeviceService();
- th_checkDeviceService.run();
- // boolean DevServiceExist = false;
- //
- // ActivityManager mActivityManager = (ActivityManager) getApplicationContext().getSystemService(Context.ACTIVITY_SERVICE);
- // List<ActivityManager.RunningServiceInfo> mRunningServiceInfo = mActivityManager.getRunningServices(1000);
- //
- // for (int i = 0; i < mRunningServiceInfo.size(); i++) {
- // ActivityManager.RunningServiceInfo rsi = mRunningServiceInfo.get(i);
- // if (rsi.service.getPackageName().equals("com.artncore.deviceservice")) {
- // Log.d(TAG, "[checkDevService] DeviceService already running!");
- // DevServiceExist = true;
- // break;
- // }
- // }
- //
- // Log.d(TAG, "[checkDevService] DevServiceExist: " + DevServiceExist);
- // if (!DevServiceExist) {
- // Log.d(TAG, "[checkDevService] DeviceService StartManal");
- // Intent intent = new Intent("wallpaddevservice.ServiceMain");
- // startService(intent);
- //
- // try {
- // Thread.sleep(3000);
- // } catch (Exception e) {
- // Log.e(TAG, "[Exception] checkDevService.sleep()");
- // e.printStackTrace();
- // }
- // }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG,re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] checkDevService");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public boolean initIOInterface() {
- try {
- LOG("[initIOInterface] ");
- // I/O 제어를 위한 라이브러리 사용
- mIOInterface = new IOInterface(ConfigValues.DEVICE_BOARDTYPE, mWallPadAPI);
- return true;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] initIOInterface()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- public boolean initCallEngine() {
- try {
- LOG("[initCallEngine]");
- mCallController = new CallController(mContext, mWallPadAPI);
- if (ConfigValues.bRemoteCall || ConfigValues.bReliefCall) {
- mAudioRecordController = new AudioRecordController(mContext);
- if (ConfigValues.bRemoteCall) mVideoController = new VideoController(mContext);
- }
- if (ConfigValues.eWallPadType == WALLPADTYPE.MAIN) {
- if (ConfigValues.bPSTNEnable) mPSTNController = new PSTNController(mContext);
- if (ConfigValues.bSubPhoneEnable) mSubPhoneController = new SubPhoneController(mContext);
- if (ConfigValues.bRemoteCall) {
- mDataSender = new DataSender();
- mRemoteCallController = new RemoteCallController(mContext);
- }
- }
- else {
- mSubWallPadController = new SubWallPadController(mContext);
- if (ConfigValues.eSubWallPadPSTNType == SUBWALLPAD_PSTNTYPE.DIRECT) {
- mPSTNController = new PSTNController(mContext);
- LOG_WARN("[initCallEngine] PSTNController is run!!");
- }
- }
- initVideoSurfaceLayout();
- return true;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] initCallEngine()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- public boolean releaseCallEngine() {
- try {
- LOG("[releaseCallEngine]");
- // Call Engine End!
- removeVideoSurfaceLayout();
- if (mVideoController != null) mVideoController.releaseVideoController();
- mCallController.releaseCallEventListener();
- mCallController.releaseCallController();
- if (mAudioRecordController != null) mAudioRecordController.releaseAudioRecordController();
- if (ConfigValues.eWallPadType == WALLPADTYPE.MAIN) {
- if (ConfigValues.bPSTNEnable) mPSTNController.releasePSTNController();
- if (ConfigValues.bSubPhoneEnable) mSubPhoneController.releaseSubPhoneController();
- if (ConfigValues.bRemoteCall) {
- mRemoteCallController.releaseRemoteCallController();
- mDataSender.interrupt();
- mDataSender = null;
- }
- }
- else {
- mSubWallPadController.releaseSubWallPadController();
- }
- return true;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] releaseCallEngine()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- public boolean initCallHistoryDB() {
- try {
- LOG("[initCallHistoryDB]");
- mCallHistoryManager = new CallHistoryManager();
- return mCallHistoryManager.initCallHistory(mContext);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] initCallHistoryDB()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- public boolean releaseCallHistoryDB() {
- try {
- LOG("[releaseCallHistoryDB]");
- if (mCallHistoryManager != null) {
- return mCallHistoryManager.releaseCallHistory();
- }
- return false;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] releaseCallHistoryDB()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- public boolean initVisitorPictureHistoryDB() {
- try {
- LOG("[initVisitorPictureHistoryDB]");
- mVisitorPictureHistoryManager = new VisitorPictureHistoryManager();
- return mVisitorPictureHistoryManager.initVisitorPictureHistory(mContext);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] initVisitorPictureHistoryDB()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- public boolean releaseVisitorPictureHistoryDB() {
- try {
- LOG("[releaseVisitorPictureHistoryDB]");
- if (mVisitorPictureHistoryManager != null) {
- return mVisitorPictureHistoryManager.releaseVisitorPictureHistory();
- }
- return false;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] releaseVisitorPictureHistoryDB()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- private boolean send_check_sip_activation_request(final String strTargetIP) {
- try {
- Request_check_sip_activation check_sip_activation = new Request_check_sip_activation(mContext);
- if (check_sip_activation.send_check_sip_activation(strTargetIP, null)) {
- check_sip_activation.setResultCtrl(new RetProci() {
- @Override
- public void ProcSuccess() {
- LOG_INFO("[send_check_sip_activation_request] ProcSuccess()");
- mCallController.onSubPhoneEvent(CALLOWNER.KITCHEN_TV_01, CALLEVENTTYPE.REQUEST_FRONT_MONITORING, CALLTYPE.FRONT, strTargetIP, null);
- // MainActivity.mCallController.mSIPInterface.requestCallForwardToStun(MainActivity.mCallController.makeCallForwarInfo(strTargetIP));
- }
- @Override
- public void ProcError() {
- LOG_INFO("[send_check_sip_activation_request] ProcError()");
- mCallController.onSubPhoneEvent(CALLOWNER.KITCHEN_TV_01, CALLEVENTTYPE.REJECT_BUSY_CALL, CALLTYPE.FRONT, strTargetIP, null);
- // MainActivity.mCallController.mSIPInterface.cancelCallForwardToStun();
- }
- @Override
- public void ProcDoing() {
- LOG_INFO("[send_check_sip_activation_request] ProcDoing()");
- }
- });
- return true;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] send_check_sip_activation_request(String strTargetIP, String strMessage)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- MainActivity.mCallController.mSIPInterface.cancelCallForwardToStun();
- }
- return false;
- }
- String strCallOwner = "NONE";
- String strCallEvent = "NONE";
- String strCallType = "NONE";
- String strRemoteInfo = "NONE";
- private void generateCallEvent() {
- try {
- LOG_INFO("[generateCallEvent] ConfigValues.eWallPadType [" + ConfigValues.eWallPadType + "], strCallOwner [" + strCallOwner + "], strCallEvent [" + strCallEvent + "], strCallType [" + strCallType + "], strRemoteInfo [" + strRemoteInfo + "]");
- if (strCallEvent.equalsIgnoreCase("NONE")) setMenuBTNEnable(true);
- else setMenuBTNEnable(false);
- if (strCallOwner != null && strCallEvent != null && strCallType != null) {
- CALLOWNER callowner = CALLOWNER.getCALLOWNER(strCallOwner);
- CALLTYPE calltype = CALLTYPE.getCALLTYPE(strCallType);
- CALLEVENTTYPE calleventtype = CALLEVENTTYPE.getCALLEVENTTYPE(strCallEvent);
- Log.i(TAG, "[generateCallEvent] callowner [" + callowner + "], calltype [" + calltype + "], calleventtype [" + calleventtype + "]");
- if (ConfigValues.eWallPadType == WALLPADTYPE.MAIN) {
- // 메인월패드
- if (callowner == CALLOWNER.NONE) {
- if (calltype == CALLTYPE.FRONT) {
- if (calleventtype == CALLEVENTTYPE.RECEIVE_CALL) {
- String strRemoteSIPID = mCallController.makeSIPID(strRemoteInfo);
- if (mCallController != null) mCallController.CallScenarioManager(callowner, calleventtype, calltype, strRemoteInfo, strRemoteSIPID, null);
- //if (mCallController != null) mCallController.CallScenarioManager(callowner, calleventtype, calltype, null, null, null);
- else Log.w(TAG, "[generateCallEvent] mCallController is null!!");
- }
- else {
- Log.w(TAG, "[generateCallEvent] not supported callevent!! -> " + calleventtype);
- }
- }
- else if (calltype == CALLTYPE.PSTN) {
- if (calleventtype == CALLEVENTTYPE.RECEIVE_CALL) {
- if (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_IGW300 || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
- if (mCallController != null) mCallController.onPSTNEvent(CALLEVENTTYPE.RECEIVE_CALL, null, null);
- else Log.w(TAG, "[generateCallEvent] mCallController is null!!");
- if (ConfigValues.bPSTNEnable && ConfigValues.bARSEnable && ConfigValues.bUnoccupiedMode) {
- sendHandlerMsgDelayed(HANDLERMSG.SEND_PSTN_ARS_MODE, 0, 0, 3000);
- }
- }
- else {
- if (mPSTNController != null) mPSTNController.receivePSTNRing();
- else Log.w(TAG, "[generateCallEvent] mPSTNController is null!!");
- }
- }
- else {
- Log.w(TAG, "[generateCallEvent] not supported callevent!! -> " + calleventtype);
- }
- }
- else {
- if (calleventtype == CALLEVENTTYPE.RECEIVE_CALL) {
- String strRemoteSIPID = mCallController.makeSIPID(strRemoteInfo);
- if (mCallController != null) mCallController.CallScenarioManager(callowner, calleventtype, calltype, strRemoteInfo, strRemoteSIPID, null);
- else Log.w(TAG, "[generateCallEvent] mCallController is null!!");
- }
- else {
- Log.w(TAG, "[generateCallEvent] not supported callevent!! -> " + calleventtype);
- }
- Log.w(TAG, "[generateCallEvent] not supported calltype!! -> " + calltype);
- RemoteIDInfo.strIP = strRemoteInfo;
- }
- }
- else if (callowner == CALLOWNER.WALLPAD) {
- if (calltype == CALLTYPE.FRONT) {
- if (calleventtype == CALLEVENTTYPE.REQUEST_FRONT_MONITORING) {
- if (mCallController != null) {
- mCallController.mCallInfo.setCallOwner(callowner);
- // strRemoteInfo = "10.1.0.11";
- // String strRemoteSIPID = mCallController.makeSIPID(strRemoteInfo);
- // RemoteIDInfo.strIP = strRemoteInfo;
- //
- // if (send_check_sip_activation_request(strRemoteInfo))
- // mCallController.CallScenarioManager(callowner, calleventtype, calltype, strRemoteInfo, strRemoteSIPID, null);
- // else
- // Log.d(TAG, callowner.toString() + "REQUEST_FRONT_MONITORING check_sip_activation ERROR");
- mCallController.CallScenarioManager(callowner, calleventtype, calltype, null, null, null);
- }
- else Log.w(TAG, "[generateCallEvent] mCallController is null!!");
- }
- }
- else if (calltype == CALLTYPE.PSTN) {
- RemoteIDInfo.bAutoCall = true;
- RemoteIDInfo.strPSTNInfo = strRemoteInfo;
- if (mCallController != null) {
- mCallController.mCallInfo.setCallOwner(callowner);
- mCallController.CallScenarioManager(callowner, calleventtype, calltype, null, null, null);
- }
- else Log.w(TAG, "[generateCallEvent] mCallController is null!!");
- }
- // else if (calltype == CALLTYPE.LOBBY) {
- // if (mCallController != null) {
- // mCallController.mCallInfo.setCallOwner(callowner);
- // mCallController.CallScenarioManager(callowner, calleventtype, calltype, strRemoteInfo, null, null);
- // }
- // }
- }
- else if (callowner == CALLOWNER.MOBILE) {
- if (calltype == CALLTYPE.FRONT) {
- // [방문객원격통화] 스마트폰에서 현관모니터링 요청
- if (calleventtype == CALLEVENTTYPE.REQUEST_FRONT_MONITORING) {
- if (mCallController != null) {
- mCallController.mCallInfo.setCallOwner(callowner);
- strRemoteInfo = "10.1.0.11";
- String strRemoteSIPID = mCallController.makeSIPID(strRemoteInfo);
- RemoteIDInfo.strIP = strRemoteInfo;
- if (send_check_sip_activation_request(strRemoteInfo))
- mCallController.CallScenarioManager(callowner, calleventtype, calltype, strRemoteInfo, strRemoteSIPID, null);
- else
- Log.d(TAG, callowner.toString() + "REQUEST_FRONT_MONITORING check_sip_activation ERROR");
- }
- else Log.w(TAG, "[generateCallEvent] mCallController is null!!");
- }
- }
- else if (calltype == CALLTYPE.GUARD) {
- // [방문객원격통화] 스마트폰에서 경비발신 요청
- if (calleventtype == CALLEVENTTYPE.TRYING_CALL) {
- if (mCallController != null) {
- mCallController.mCallInfo.setCallOwner(callowner);
- mCallController.tryMoIPCall(CALLTYPE.GUARD, RemoteIDInfo.strDong, RemoteIDInfo.strHo);
- }
- else Log.w(TAG, "[generateCallEvent] mCallController is null!!");
- }
- }
- else if (calltype == CALLTYPE.RESIDENCE) {
- // [방문객원격통화] 모바일에서 홈뷰어 요청
- if (calleventtype == CALLEVENTTYPE.REQUEST_FRONT_MONITORING) {
- if (mCallController != null) {
- mCallController.mCallInfo.setCallOwner(callowner);
- mCallController.CallScenarioManager(callowner, calleventtype, calltype, null, null, null);
- }
- else Log.w(TAG, "[generateCallEvent] mCallController is null!!");
- }
- }
- }
- else if (Global.getKitchenTVIdx(callowner) >= 0 || Global.getBathPhoneIdx(callowner) >= 0 || callowner == CALLOWNER.SUB_WALLPAD || Global.getBathTVIdx(callowner) >= 0) {
- if (calltype == CALLTYPE.FRONT) {
- if (mCallController != null)
- {
- strRemoteInfo = "10.1.0.11";
- String strRemoteSIPID = mCallController.makeSIPID(strRemoteInfo);
- RemoteIDInfo.strIP = strRemoteInfo;
- send_check_sip_activation_request(strRemoteInfo);
- //mCallController.onSubPhoneEvent(callowner, calleventtype, calltype, null, null);
- // if (send_check_sip_activation_request(strRemoteInfo))
- // mCallController.onSubPhoneEvent(callowner, calleventtype, calltype, strRemoteSIPID, null);
- // else
- // Log.d(TAG, callowner.toString() + "REQUEST_FRONT_MONITORING check_sip_activation ERROR");
- }
- else Log.w(TAG, "[generateCallEvent] mCallController is null!!");
- }
- else if (calltype == CALLTYPE.GUARD || calleventtype == CALLEVENTTYPE.TRYING_CALL) {
- if (mCallController != null) mCallController.onSubPhoneEvent(callowner, calleventtype, calltype, strRemoteInfo, null);
- else Log.w(TAG, "[generateCallEvent] mCallController is null!!");
- }
- else if (calltype == CALLTYPE.RESIDENCE || calleventtype == CALLEVENTTYPE.REQUEST_RESIDENCE_CALL) {
- if (mCallController != null) mCallController.onSubPhoneEvent(callowner, calleventtype, calltype, strRemoteInfo, null);
- else Log.w(TAG, "[generateCallEvent] mCallController is null!!");
- }
- else {
- Log.w(TAG, "[generateCallEvent] nor supported calltype and callevent!! -> " + calltype + "/" + calleventtype);
- }
- }
- else {
- Log.w(TAG, "[generateCallEvent] not supported callowner!! -> " + callowner);
- }
- }
- else {
- // 서브월패드
- if (callowner == CALLOWNER.NONE) {
- if (calltype == CALLTYPE.FRONT || calltype == CALLTYPE.LOBBY || calltype == CALLTYPE.GUARD || calltype == CALLTYPE.RESIDENCE) {
- if (calleventtype == CALLEVENTTYPE.RECEIVE_CALL) {
- if (mCallController != null) mCallController.onSubWallPadEvent(callowner, calleventtype, calltype, null, null);
- else Log.w(TAG, "[generateCallEvent] mCallController is null!!");
- }
- else Log.w(TAG, "[generateCallEvent] not supported calleventtype!! -> " + calleventtype);
- }
- // else if(calltype == CALLTYPE.HISTORY_CALL)
- // {
- // strRemoteInfo = "10.1.0.110";
- // String strRemoteSIPID = mCallController.makeSIPID(strRemoteInfo);
- // RemoteIDInfo.strIP = strRemoteInfo;
- //
- // if (send_check_sip_activation_request(strRemoteInfo))
- // if (mCallController != null) mCallController.CallScenarioManager(callowner, calleventtype, calltype, strRemoteInfo, strRemoteSIPID, null);
- // else
- // Log.d(TAG, callowner.toString() + "REQUEST_FRONT_MONITORING check_sip_activation ERROR");
- // }
- else {
- Log.w(TAG, "[generateCallEvent] not supported calltype!! -> " + callowner);
- RemoteIDInfo.strIP = strRemoteInfo;
- }
- }
- else if (callowner == CALLOWNER.SUB_WALLPAD) {
- if (calleventtype == CALLEVENTTYPE.REQUEST_FRONT_MONITORING) {
- if (mCallController != null) {
- mCallController.mCallInfo.setCallOwner(callowner);
- mCallController.onSubWallPadEvent(callowner, calleventtype, calltype, null, null);
- mSubWallPadController.sendRequestFrontMonitoring(CALLOWNER.SUB_WALLPAD, CALLTYPE.FRONT);
- }
- else {
- Log.w(TAG, "[generateCallEvent] mCallController is null!!");
- }
- }
- }
- else {
- Log.w(TAG, "[generateCallEvent] not supported callowner!! -> " + callowner);
- }
- }
- }
- else {
- Log.w(TAG, "[generateCallEvent] strCallOwner, strCallEvent, strCallType are nul!!");
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] generateCallEvent()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- int nNoticeTextColor_White = Color.WHITE;
- int nNoticeTextColor_Orange = Color.parseColor("#FF8C00");
- int nNoticeTextColor = nNoticeTextColor_Orange;
- /**
- * SEULKI, 2020.09.15
- * 모바일 통화중 알림
- * 방문객원격통화 모바일 통화중 상태를 사용자에게 알리기 위해, 화면 상단에 "모바일 통화종"이라는 문구를 표시한다.
- * 모바일 통화중 알림 문구는 색을 반전하며 표시된다.
- */
- static long lRemoteConnectionPeriod = 0;
- static int REMOTECALL_CONNECT_TIMEOUT = 1000 * 60; // 통화 시간 최대 1분
- boolean bRemoteCallProcessNoticeRun = false;
- private void startRemoteCallProcessNotice() {
- try {
- Log.v(TAG, "[startRemoteCallProcessNotice] bRemoteCallProcessNoticeRun [" + bRemoteCallProcessNoticeRun + "]");
- if (mRemoteCallProcessNoticeThread == null && !bRemoteCallProcessNoticeRun) {
- bRemoteCallProcessNoticeRun = true;
- mRemoteCallProcessNoticeThread = new RemoteCallProcessNoticeThread();
- mRemoteCallProcessNoticeThread.start();
- }
- else Log.v(TAG, "[startRemoteCallProcessNotice] mRemoteCallProcessNoticeThread is not null!!!");
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] startRemoteCallProcessNotice()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private void stopRemoteCallProcessNotice() {
- try {
- Log.v(TAG, "[stopRemoteCallProcessNotice] bRemoteCallProcessNoticeRun [" + bRemoteCallProcessNoticeRun + "]");
- if (mRemoteCallProcessNoticeThread != null || bRemoteCallProcessNoticeRun) {
- lRemoteConnectionPeriod = -999;
- bRemoteCallProcessNoticeRun = false;
- mRemoteCallProcessNoticeThread = null;
- }
- else Log.v(TAG, "[stopRemoteCallProcessNotice] mRemoteCallProcessNoticeThread is null!!!");
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] stopRemoteCallProcessNotice()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public void showRemoteCallNoticeText(boolean bRun) {
- try {
- Log.i(TAG, "[showRemoteCallNoticeText] bRun [" + bRun + "]");
- if (bRun) {
- TopRemoteCallNotice.setText("모바일 통화중");
- TopRemoteCallNotice.setVisibility(View.VISIBLE);
- startRemoteCallProcessNotice();
- }
- else {
- TopRemoteCallNotice.setText("");
- TopRemoteCallNotice.setVisibility(View.INVISIBLE);
- stopRemoteCallProcessNotice();
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] showRemoteCallNoticeText(boolean bRun)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private RemoteCallProcessNoticeThread mRemoteCallProcessNoticeThread;
- private class RemoteCallProcessNoticeThread extends Thread {
- public RemoteCallProcessNoticeThread() {
- Log.i(TAG, "============ [RemoteCallProcessNoticeThread()] ============");
- }
- public void run() {
- try {
- Log.v(TAG, "[RemoteCallProcessNoticeThread().run()] bRemoteCallProcessNoticeRun [" + bRemoteCallProcessNoticeRun + "]");
- lRemoteConnectionPeriod = System.currentTimeMillis() + REMOTECALL_CONNECT_TIMEOUT;
- while ((System.currentTimeMillis() < lRemoteConnectionPeriod) && bRemoteCallProcessNoticeRun) {
- try {
- if (bRemoteCallProcessNoticeRun) Thread.sleep(500); // 500ms에 한번씩 색 반전
- } catch (InterruptedException e) {
- Log.e(TAG, "[RemoteCallProcessNoticeThread] Thread.sleep(500)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- if (nNoticeTextColor == nNoticeTextColor_Orange) {
- // Log.i(TAG, "[StrangerProcessNoticeThread().run().while()] ===== white =====");
- nNoticeTextColor = nNoticeTextColor_White;
- }
- else {
- // Log.i(TAG, "[RemoteCallProcessNoticeThread().run().while()] ===== orange =====");
- nNoticeTextColor = nNoticeTextColor_Orange;
- }
- sendHandlerMsg(HANDLERMSG.CHANGE_REMOTECALL_NOTICE_COLOR, 0, 0);
- }
- bRemoteCallProcessNoticeRun = false;
- Log.i(TAG, "[RemoteCallProcessNoticeThread().run()] ===== while end =====");
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] RemoteCallProcessNoticeThread.run()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- }
- /* ================================================================================================
- * 히든 메뉴 -> 통화시험모드 진입
- ================================================================================================ */
- private void startHideMenu() {
- try {
- TopBackground.setImageResource(0);
- TopBackground.setBackgroundColor(Color.RED);
- mSound.Play(SND.call.CALLSTART);
- super.setFinishTimerDestroy();
- Log.i(TAG, "================================");
- Log.i(TAG, "[startHideMenu] START !!!!!");
- Log.i(TAG, "================================");
- mCallController.set1stCallTimer(CALLTYPE.FRONT, 99999);
- if (SampleModeTitle == null) {
- SampleModeTitle = new WpadTextView(mContext, false, 200, 72, Gravity.CENTER, Color.DKGRAY, Common.fontsize._26_DEFAULT, true, 0);
- ViewRegistration(TopLayout, SampleModeTitle, 316, 17);
- }
- SampleModeTitle.setText("[통화시험모드]");
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] startHideMenu()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /* ================================================================================================
- * 원격지 영상
- ================================================================================================ */
- public void initRemoteVideoSurfaceLayout() {
- try {
- LOG_INFO("[initRemoteVideoSurfaceLayout] RemoteVideoLayout = " + RemoteVideoLayout);
- if (RemoteVideoLayout != null) {
- RemoteVideoSurface.getHolder().removeCallback(RemoteVideoCallback);
- RemoteVideoLayout.removeAllViews();
- RemoteVideoLayout = null;
- }
- RemoteVideoLayout = new RelativeLayout(mContext);
- WpadUtil.LayoutRegistration(SurfaceLayout, RemoteVideoLayout, screenWidth, screenHeight - topHeight, 0, 0, ID.MAINACTIVITY.LAYOUT.REMOTEVIDEO);
- RemoteVideoSurface = new SurfaceView(mContext);
- // RemoteVideoHolder = RemoteVideoSurface.getHolder();
- WpadRelativeLayoutParams RemoteVideoParams;
- if (bFFMPEGEnable) {
- RemoteVideoParams = new WpadRelativeLayoutParams(708, 540);
- // RemoteVideoParams.setMargins(107, 112, 0, 0);
- RemoteVideoParams.setMargins(1300, 112, 0, 0); // 안보이게
- }
- else {
- RemoteVideoParams = new WpadRelativeLayoutParams(1000, 800);
- RemoteVideoParams.setMargins(95, 112, 0, 0);
- }
- RemoteVideoLayout.addView(RemoteVideoSurface, RemoteVideoParams);
- RemoteVideoSurface.getHolder().addCallback(RemoteVideoCallback);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] initRemoteVideoSurfaceLayout()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public void showRemoteVideo(boolean bShow, boolean bResidenceCall) {
- try {
- LOG_INFO("[showRemoteVideo] bShow [" + bShow + "], bResidenceCall [" + bResidenceCall + "]");
- if (RemoteVideoSurface == null) {
- LOG_WARN("[showRemoteVideo] RemoteVideoSurface is null!!!");
- return;
- }
- WpadRelativeLayoutParams RemoteVideoParams;
- if (bFFMPEGEnable) {
- if (bShow) {
- if (bResidenceCall) {
- RemoteVideoParams = new WpadRelativeLayoutParams(720, 540);
- RemoteVideoParams.setMargins(144, 112, 0, 0);
- }
- else {
- RemoteVideoParams = new WpadRelativeLayoutParams(708, 540);
- RemoteVideoParams.setMargins(107, 112, 0, 0);
- }
- }
- else {
- RemoteVideoParams = new WpadRelativeLayoutParams(708, 540);
- RemoteVideoParams.setMargins(1300, 112, 0, 0); // 안보이게
- }
- }
- else {
- if (bShow) {
- RemoteVideoParams = new WpadRelativeLayoutParams(720, 540);
- RemoteVideoParams.setMargins(144, 112, 0, 0);
- }
- else {
- RemoteVideoParams = new WpadRelativeLayoutParams(720, 540);
- RemoteVideoParams.setMargins(1300, 112, 0, 0); // 안보이게
- }
- }
- RemoteVideoSurface.setLayoutParams(RemoteVideoParams);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] showRemoteVideo(boolean bShow)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public void removeRemoteVideoSurfaceLayout() {
- try {
- // LOG_INFO("[removeRemoteVideoSurfaceLayout] RemoteVideoSurface = " + RemoteVideoSurface + ", RemoteVideoLayout = " + RemoteVideoLayout);
- if (RemoteVideoLayout != null) {
- RemoteVideoSurface.getHolder().removeCallback(RemoteVideoCallback);
- RemoteVideoLayout.removeAllViews();
- RemoteVideoLayout = null;
- }
- else Log.d(TAG, "[removeRemoteVideoSurfaceLayout] RemoteVideoLayout is null!");
- // if (RemoteVideoSurface != null) {
- // RemoteVideoSurface.setVisibility(View.GONE);
- // RemoteVideoSurface.getHolder().removeCallback(RemoteVideoCallback);
- // RemoteVideoSurface = null;
- // }
- //
- // if (RemoteVideoLayout != null) {
- // RemoteVideoLayout.setVisibility(View.GONE);
- // RemoteVideoLayout.removeAllViews();
- // RemoteVideoLayout = null;
- // }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] removeRemoteVideoSurfaceLayout()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private Callback RemoteVideoCallback = new Callback() {
- @Override
- public void surfaceCreated(SurfaceHolder holder) {
- LOG_INFO("[RemoteVideoCallback] surfaceCreated!!");
- if (bFFMPEGEnable) {
- mCallController.mVideoJNI.setRemoteSurfaceview(holder.getSurface(), 708, 540);
- }
- }
- @Override
- public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
- LOG_INFO("[RemoteVideoCallback] surfaceChanged!!");
- }
- @Override
- public void surfaceDestroyed(SurfaceHolder holder) {
- LOG_INFO("[RemoteVideoCallback] surfaceDestroyed!!");
- if (RemoteVideoSurface != null) {
- LOG_INFO("[RemoteVideoCallback] RemoteVideoSurface is not null!!");
- RemoteVideoSurface.getHolder().removeCallback(RemoteVideoCallback);
- }
- }
- };
- public void displayRemoteID(String strRemoteID) {
- try {
- LOG("[displayRemoteID] strRemoteID = " + strRemoteID);
- if (strRemoteID != null) {
- // strRemoteID에 따른 좌표 적용 (2017.11.22 SEULKI)
- String strBlank = " ";
- if (strRemoteID.contains("로비")) {
- LOG_INFO("[displayRemoteID] LOBBY");
- } else if (strRemoteID.contains("동") && (strRemoteID.contains("호"))) {
- LOG_INFO("[displayRemoteID] NEIGHBOR");
- strRemoteID = strRemoteID.replace(strRemoteID, strBlank + strRemoteID);
- } else if (strRemoteID.contains("경비")) {
- LOG_INFO("[displayRemoteID] GUARD");
- }
- else {
- LOG_INFO("[displayRemoteID] etc");
- strRemoteID = "";
- }
- TXT_REMOTE_ID.setText(strRemoteID);
- TXT_REMOTE_ID.setVisibility(View.VISIBLE);
- } else {
- TXT_REMOTE_ID.setText("");
- TXT_REMOTE_ID.setVisibility(View.INVISIBLE);
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] displayRemoteID(strRemoteID)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public void displayRemoteID(CALLTYPE eCallType, CALLSTATUS eCallStatus) {
- try {
- LOG("[displayRemoteID] eCallType [" + eCallType + "], eCallStatus[" + eCallStatus + "]");
- String strTarget = "";
- String strInfoMent = "";
- String strCalled = " 호출입니다.";
- String strCalling = " 호출중입니다.";
- String strTalking = " 통화중입니다.";
- if (eCallStatus == CALLSTATUS.CALLED) strInfoMent = strCalled;
- else if (eCallStatus == CALLSTATUS.TRYING_CALL || eCallStatus == CALLSTATUS.CALLING) strInfoMent = strCalling;
- else if (eCallStatus == CALLSTATUS.TALKING) strInfoMent = strTalking;
- if (eCallType == CALLTYPE.LOBBY) strTarget = "공동현관";
- else if (eCallType == CALLTYPE.GUARD) strTarget = "경비실";
- if ((!strTarget.equals("")) && (!strInfoMent.equals(""))) {
- TXT_REMOTE_ID.setText(strTarget.concat(strInfoMent));
- TXT_REMOTE_ID.setVisibility(View.VISIBLE);
- } else {
- TXT_REMOTE_ID.setText("");
- TXT_REMOTE_ID.setVisibility(View.INVISIBLE);
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- Log.e(TAG, "[Exception] displayRemoteID(CALLTYPE eCallType, CALLSTATUS eCallStatus)");
- }
- }
- /* ================================================================================================
- * 내 영상
- ================================================================================================ */
- public Camera mMyCamera;
- 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, screenWidth, screenHeight - topHeight, 0, 0, ID.MAINACTIVITY.LAYOUT.MYVIDEO);
- MyVideoSurface = new SurfaceView(mContext);
- // MyVideoHolder = MyVideoSurface.getHolder();
- WpadRelativeLayoutParams MyVideoParams = new WpadRelativeLayoutParams(280, 210);
- 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()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public void removeMyVideoSurfaceLayout() {
- try {
- LOG_INFO("[removeMyVideoSurfaceLayout] MyVideoSurface = " + MyVideoSurface + ", MyVideoLayout = " + MyVideoLayout);
- if (MyVideoLayout != null) {
- // MyVideoSurface.getHolder().removeCallback(MyVideoCallback);
- MyVideoLayout.removeAllViews();
- MyVideoLayout = null;
- }
- // if (MyVideoSurface != null) {
- // MyVideoSurface.setVisibility(View.GONE);
- // MyVideoSurface.getHolder().removeCallback(MyVideoCallback);
- // MyVideoSurface = null;
- // }
- //
- // if (MyVideoLayout != null) {
- // MyVideoLayout.setVisibility(View.GONE);
- // MyVideoLayout.removeAllViews();
- // MyVideoLayout = null;
- // }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] removeRemoteVideoSurfaceLayout()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public void showMyVideo(boolean bShow, boolean bMobile) {
- try {
- LOG_INFO("[showMyVideo] bShow [" + bShow + "], bMobile [" + bMobile + "]");
- if (MyVideoSurface == null) {
- LOG_WARN("[showMyVideo] MyVideoSurface is null!!!");
- return;
- }
- WpadRelativeLayoutParams MyVideoParams;
- if (bShow) {
- if (bMobile) { // 방문객원격통화 홈뷰어일 경우
- MyVideoParams = new WpadRelativeLayoutParams(720, 540);
- } else {
- MyVideoParams = new WpadRelativeLayoutParams(280, 210);
- }
- MyVideoParams.setMargins(144, 112, 0, 0);
- MyVideoSurface.setLayoutParams(MyVideoParams);
- }
- else {
- MyVideoParams = new WpadRelativeLayoutParams(280, 210);
- MyVideoParams.setMargins(1300, 112, 0, 0); // 안보이게
- MyVideoSurface.setLayoutParams(MyVideoParams);
- }
- if (mCallController.mSIPInterface != null)
- mCallController.mSIPInterface.showMyVideo(bShow);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] showMyVideo(boolean bShow)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public void finishMyVideo() {
- try {
- LOG_INFO("[finishMyVideo]");
- if (mCallController.mSIPInterface != null)
- mCallController.mSIPInterface.videoSet(false, false, false);
- // mCallController.mVideoJNI.setComposite(false);
- showMyVideo(false, false);
- removeMyVideoSurfaceLayout();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] finishMyVideo()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private Callback MyVideoCallback = new Callback() {
- @Override
- public void surfaceCreated(SurfaceHolder holder) {
- try {
- LOG_INFO("[MyVideoCallback] surfaceCreated!!");
- if (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40 || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_NOUGAT
- || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
- mIOInterface.ctrlWallPadCamPower(true);
- boolean bAOS7 = false; // 한국생산(다담, AOS 6.0.1)과 중국생산(사니코, 7.1.1) 구분 (true: 중국생산, false: 한국생산)
- if (Build.VERSION.SDK_INT > 23) bAOS7 = true;
- if (ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_D101) {
- if (bAOS7) {
- // AOS 7.1.1
- mMyCamera = Camera.open(Camera.CameraInfo.CAMERA_FACING_FRONT); // 확인완료 (JEFF, 2020.09.02)
- }
- else {
- // AOS 6.0.1
- mMyCamera = Camera.open(Camera.CameraInfo.CAMERA_FACING_FRONT);
- }
- }
- else {
- if (bAOS7) {
- /**
- * 확인완료 (JEFF, 2020.09.02)
- * IHN-1020B-I, IHN-D101-I, IHN-1010-I
- * IHN-HS101-I (SEULKI, 2021.05.11)
- */
- // AOS 7.1.1
- if (ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_1020B_I && !Global.getCompareBSPVersion("2020.09.08")) mMyCamera = Camera.open(Camera.CameraInfo.CAMERA_FACING_BACK);
- else if (ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_HS101_I && !Global.getCompareBSPVersion("2020.06.11")) mFrontCamera = Camera.open(Camera.CameraInfo.CAMERA_FACING_BACK);
- else mMyCamera = Camera.open(Camera.CameraInfo.CAMERA_FACING_FRONT);
- }
- else {
- /**
- * 확인완료 (JEFF, 2020.09.02)
- * IHN-1010, IHN-HS101
- */
- // AOS 6.0.1
- mMyCamera = Camera.open(Camera.CameraInfo.CAMERA_FACING_BACK); // 확인완료 (JEFF, 2020.09.02)
- }
- }
- Camera.Parameters params = mMyCamera.getParameters();
- params.setPictureSize(320, 240);
- mMyCamera.setParameters(params);
- mMyCamera.setPreviewDisplay(holder);
- }
- else {
- LOG_WARN("[MyVideoCallback] surfaceCreated!! -> NOT Supported ConfigValues.DEVICE_BOARDTYPE [" + ConfigValues.DEVICE_BOARDTYPE + "]");
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] MyVideoCallback -> surfaceCreated(SurfaceHolder holder)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- @Override
- public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
- try {
- LOG_INFO("[MyVideoCallback] surfaceChanged!!");
- if (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40 || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_NOUGAT
- || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
- mMyCamera.startPreview();
- if (!bFFMPEGEnable && Common.OPTION_TAB_ANMI_ENABLE) {
- Animation Anmi = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.screen_on);
- MyVideoLayout.startAnimation(Anmi);
- }
- } else {
- LOG_WARN("[MyVideoCallback] surfaceChanged!! -> NOT Supported ConfigValues.DEVICE_BOARDTYPE [" + ConfigValues.DEVICE_BOARDTYPE + "]");
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] MyVideoCallback -> surfaceChanged(SurfaceHolder holder, int format, int width, int height)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- @Override
- public void surfaceDestroyed(SurfaceHolder holder) {
- try {
- LOG_INFO("[MyVideoCallback] surfaceDestroyed!!");
- if (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40 || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_NOUGAT
- || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
- mIOInterface.ctrlWallPadCamPower(false);
- if (mMyCamera != null) {
- mMyCamera.stopPreview();
- mMyCamera.release();
- mMyCamera = null;
- }
- } else {
- LOG_WARN("[MyVideoCallback] surfaceDestroyed!! -> NOT Supported ConfigValues.DEVICE_BOARDTYPE [" + ConfigValues.DEVICE_BOARDTYPE + "]");
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] MyVideoCallback -> surfaceDestroyed(SurfaceHolder holder)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- };
- /* ================================================================================================
- * 현관카메라 영상
- ================================================================================================ */
- public Camera mFrontCamera;
- public boolean initFrontVideoLayout() {
- try {
- Log.d(TAG, "[initFrontVideoLayout] front camera");
- FrontVideoLayout = new RelativeLayout(mContext);
- WpadUtil.LayoutRegistration(SurfaceLayout, FrontVideoLayout, screenWidth, screenHeight - topHeight, 0, 0, ID.MAINACTIVITY.LAYOUT.FRONTVIDEO);
- FrontVideoSurface = new SurfaceView(mContext);
- FrontVideoHolder = FrontVideoSurface.getHolder();
- WpadRelativeLayoutParams FrontVideoParams;
- FrontVideoParams = new WpadRelativeLayoutParams(720, 540);
- FrontVideoParams.setMargins(1300, 112, 0, 0);
- FrontVideoLayout.addView(FrontVideoSurface, FrontVideoParams);
- showFrontVideo(false);
- FrontVideoSurface.getHolder().addCallback(FrontVideoCallback);
- FrontVideoSurface.setZOrderOnTop(true);
- return true;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] initFrontVideoLayout()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- public boolean removeFrontVideoLayout() {
- try {
- // LOG_INFO("[removeFrontVideoLayout] FrontVideoSurface = " + FrontVideoSurface + ", FrontVideoLayout = " + FrontVideoLayout);
- if (FrontVideoSurface != null) {
- FrontVideoSurface.setVisibility(View.GONE);
- FrontVideoSurface.getHolder().removeCallback(FrontVideoCallback);
- FrontVideoSurface = null;
- }
- if (FrontVideoLayout != null) {
- FrontVideoLayout.setVisibility(View.GONE);
- FrontVideoLayout.removeAllViews();
- FrontVideoLayout = null;
- }
- return true;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] removeFrontVideoLayout()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- public void initFrontVideo() {
- try {
- LOG("[initFrontVideo]");
- FrontVideoLayout = new RelativeLayout(mContext);
- WpadUtil.LayoutRegistration(SurfaceLayout, FrontVideoLayout, screenWidth, screenHeight - topHeight, 0, 0, ID.MAINACTIVITY.LAYOUT.FRONTVIDEO);
- FrontVideoSurface = new SurfaceView(mContext);
- FrontVideoHolder = FrontVideoSurface.getHolder();
- WpadRelativeLayoutParams FrontVideoParams;
- FrontVideoParams = new WpadRelativeLayoutParams(720, 540);
- FrontVideoParams.setMargins(95, 112, 0, 0);
- FrontVideoLayout.addView(FrontVideoSurface, FrontVideoParams);
- FrontVideoLayout.setVisibility(View.INVISIBLE);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] initFrontVideo()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private Callback FrontVideoCallback = new Callback() {
- @Override
- public void surfaceCreated(SurfaceHolder holder) {
- try {
- LOG_INFO("[FrontVideoCallback] front camera surfaceCreated!!");
- boolean bAOS7 = false; // 한국생산(다담, AOS 6.0.1)과 중국생산(사니코, 7.1.1) 구분 (true: 중국생산, false: 한국생산)
- if (Build.VERSION.SDK_INT > 23) bAOS7 = true;
- Log.d(TAG, "[FrontVideoCallback] ConfigValues.DEVICE_MODELTYPE [" + ConfigValues.DEVICE_MODELTYPE + "], ConfigValues.eFrontCameraType [" + ConfigValues.eFrontCameraType + "], bAOS7 [" + bAOS7 + "]");
- if (ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_D101) {
- if (bAOS7) {
- // AOS 7.1.1
- mFrontCamera = Camera.open(Camera.CameraInfo.CAMERA_FACING_BACK); // 확인완료 (JEFF, 2020.09.02)
- }
- else {
- // AOS 6.0.1
- if (ConfigValues.eFrontCameraType == FRONTCAMERATYPE.SMARTIOT || ConfigValues.eFrontCameraType == FRONTCAMERATYPE.HD) mFrontCamera = Camera.open(Camera.CameraInfo.CAMERA_FACING_BACK);
- else mFrontCamera = Camera.open();
- }
- }
- else {
- if (bAOS7) {
- /**
- * 확인완료 (JEFF, 2020.09.02)
- * IHN-1020B-I, IHN-D101-I, IHN-1010 (중국)
- * IHN-HS101-I (SEULKI, 2021.05.11)
- */
- // AOS 7.1.1
- if (ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_1020B_I && !Global.getCompareBSPVersion("2020.09.08")) mFrontCamera = Camera.open(Camera.CameraInfo.CAMERA_FACING_FRONT);
- else if (ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_HS101_I && !Global.getCompareBSPVersion("2020.06.11")) mFrontCamera = Camera.open(Camera.CameraInfo.CAMERA_FACING_FRONT);
- else mFrontCamera = Camera.open(Camera.CameraInfo.CAMERA_FACING_BACK);
- }
- else {
- /**
- * 확인완료 (JEFF, 2020.09.02)
- * IHN-1010, IHN-HS101
- */
- // AOS 6.0.1
- mFrontCamera = Camera.open(Camera.CameraInfo.CAMERA_FACING_FRONT); // 확인완료 (JEFF, 2020.09.02)
- }
- }
- if (ConfigValues.eFrontCameraType == FRONTCAMERATYPE.SMARTIOT || ConfigValues.eFrontCameraType == FRONTCAMERATYPE.HD) {
- Camera.Parameters params = mFrontCamera.getParameters();
- params.setPictureSize(1280, 720);
- mFrontCamera.setParameters(params);
- }
- else {
- Camera.Parameters params = mFrontCamera.getParameters();
- params.setPictureSize(640, 480);
- mFrontCamera.setParameters(params);
- }
- mFrontCamera.setPreviewDisplay(holder);
- mFrontCamera.setErrorCallback(FrontVideoErrorCallback);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] FrontVideoCallback -> surfaceCreated(SurfaceHolder holder)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- @Override
- public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
- try {
- LOG_INFO("[FrontVideoCallback] surfaceChanged!!");
- if (mFrontCamera != null) {
- mFrontCamera.startPreview();
- }
- //add KSJ
- if(mCurrentScreenId != ID.SCREEN.SCREEN_TALKFRONT_SUBWALLPAD) {
- Handler mHandler = new Handler();
- mHandler.postDelayed(new Runnable() {
- public void run() {
- // 시간 지난 후 실행할 코딩
- showFrontVideo(true);
- }
- }, 500); // 0.5초후
- }
- if (Common.OPTION_TAB_ANMI_ENABLE) {
- Animation Anmi = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.screen_on);
- FrontVideoLayout.startAnimation(Anmi);
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] FrontVideoCallback -> surfaceChanged(SurfaceHolder holder)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- @Override
- public void surfaceDestroyed(SurfaceHolder holder) {
- try {
- LOG_INFO("[FrontVideoCallback] surfaceDestroyed!!");
- if (mFrontCamera != null) {
- mFrontCamera.stopPreview();
- mFrontCamera.release();
- mFrontCamera = null;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] FrontVideoCallback -> surfaceDestroyed(SurfaceHolder holder)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- };
- private ErrorCallback FrontVideoErrorCallback = new ErrorCallback() {
- @Override
- public void onError(int error, Camera camera) {
- switch (error) {
- case Camera.CAMERA_ERROR_SERVER_DIED:
- Log.e(TAG, "[FrontVideoErrorCallback] CAMERA_ERROR_SERVER_DIED");
- camera.stopPreview();
- camera.setPreviewCallback(null);
- camera.release();
- camera = null;
- break;
- case Camera.CAMERA_ERROR_UNKNOWN:
- Log.e(TAG, "[FrontVideoErrorCallback] CAMERA_ERROR_UNKNOWN");
- break;
- }
- }
- };
- public void showFrontVideo(boolean bShow) {
- try {
- LOG_INFO("[showFrontVideo] bShow [" + bShow + "]");
- if (FrontVideoSurface == null) {
- LOG_WARN("[showFrontVideo] FrontVideoSurface is null!!!");
- return;
- }
- WpadRelativeLayoutParams FrontVideoParams;
- FrontVideoParams = new WpadRelativeLayoutParams(720, 540);
- if (bShow) FrontVideoParams.setMargins(95, 112, 0, 0);
- else FrontVideoParams.setMargins(1300, 112, 0, 0); // 안보이게
- FrontVideoSurface.setLayoutParams(FrontVideoParams);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] showFrontVideo(boolean bShow)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /** 사진 암호화 관련 */
- public static final String ALGORITHM = "AES";
- public static final String TRANSFORMATION = ALGORITHM + "/ECB/PKCS5Padding";
- public static final String VISITOR_PICTURE_ENCRYPT_KEY = "VISITOR_PICTURE_ENCRYPT_KEY";
- private Cipher initCryptConfig(int mode) {
- Cipher cipher = null;
- try {
- byte[] hKey = getAESKey();
- if (hKey != null) {
- cipher = Cipher.getInstance(TRANSFORMATION);
- SecretKeySpec key = new SecretKeySpec(hKey, ALGORITHM);
- cipher.init(mode, key);
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] initCryptConfig(int mode)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- return cipher;
- }
- private byte[] getAESKey() {
- byte[] hKeyData = null;
- try {
- String strKey = VISITOR_PICTURE_ENCRYPT_KEY.substring(0, 16);
- hKeyData = new byte[16];
- byte[] b = strKey.getBytes("UTF-8");
- int len = b.length;
- if (len > hKeyData.length) {
- len = hKeyData.length;
- }
- System.arraycopy(b, 0, hKeyData, 0, len);
- return hKeyData;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getAESKey()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- return hKeyData;
- }
- public void encryptPictureFile(File sourceFile) {
- InputStream input = null;
- OutputStream output = null;
- try {
- // LOG("[encryptPictureFile] sourceFile [" + sourceFile.getPath() + "]");
- Cipher cipher = initCryptConfig(Cipher.ENCRYPT_MODE);
- if (cipher != null) {
- input = new BufferedInputStream(new FileInputStream(sourceFile));
- LOG("[encryptPictureFile] input.available [" + input.available() + "]");
- output = new BufferedOutputStream(new FileOutputStream(define.VISITOR_PICTURE_LOCATION + "/ENCRYPTED_" + sourceFile.getName()));
- byte[] buffer = new byte[1024];
- int read = -1;
- while((read = input.read(buffer)) != -1) {
- output.write(cipher.update(buffer, 0, read));
- }
- output.write(cipher.doFinal());
- sourceFile.delete(); // 암호화하기 이전 파일은 삭제
- } else {
- LOG_WARN("[encryptPictureFile] cipher is null!");
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] encryptPictureFile(Fie sourceFile)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- } finally {
- if (output != null) {
- try { output.close(); } catch (IOException ie) { Log.e(TAG, "[Exception] encryptPictureFile.output.close"); }
- }
- if (input != null) {
- try { input.close(); } catch (IOException ie) { Log.e(TAG, "[Exception] encryptPictureFile.input.close"); }
- }
- }
- }
- /**
- * 방문자사진 복호화 기능 수행
- * @param sourceFile 암호화된 파일 (/sdcrad/Bestin/VisitorPicture/ 폴더에 저장)
- * @param destFile 복호화 파일 (/sdcrad/Bestin/VisitorPicture/Decrypt/ 폴더에 저장)
- * @return destFile (사진을 복호화하여 파일 리턴)
- */
- public File decryptPictureFile(File sourceFile, File destFile) {
- InputStream input = null;
- OutputStream output = null;
- try {
- if (sourceFile.exists()) {
- Cipher cipher = initCryptConfig(Cipher.DECRYPT_MODE);
- if (cipher != null) {
- input = new BufferedInputStream(new FileInputStream(sourceFile));
- LOG("[decryptPictureFile] input.available [" + input.available() + "]");
- output = new BufferedOutputStream(new FileOutputStream(destFile.getPath()));
- byte[] buffer = new byte[1024];
- int read = -1;
- while ((read = input.read(buffer)) != -1) {
- output.write(cipher.update(buffer, 0, read));
- }
- output.write(cipher.doFinal());
- return destFile;
- } else {
- LOG_WARN("[decryptPictureFile] cipher is null!");
- }
- } else {
- // LOG("[decryptPictureFile] Do not need to decrypt File!! [" + destFile.getPath() + "]");
- return new File(define.VISITOR_PICTURE_LOCATION + "/" + destFile.getName()); // 기존에 암호화 안되어 저장했던 사진은 복호화 하면 안됨
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] decryptPictureFile(File sourceFile, File destFile)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- } finally {
- if (output != null) {
- try { output.close(); } catch (IOException ie) { Log.e(TAG, "[Exception] decryptPictureFile.output.close"); }
- }
- if (input != null) {
- try { input.close(); } catch (IOException ie) { Log.e(TAG, "[Exception] decryptPictureFile.input.close"); }
- }
- }
- return null;
- }
- int camOpenCheckCnt1 = 0, camOpenCheckCnt2 = 0, camOpenCheckCnt3 = 0, camOpenCheckCnt4 = 0;
- int handlerMaxCnt = 100;
- /**
- * 현관카메라 OPEN CHECK Handler!!!
- */
- public Handler mFrontCamOpenCheckHandler = new Handler() {
- @Override
- public void handleMessage(Message msg) {
- LOG("[mFrontCamOpenCheckHandler] msg.what = " + msg.what);
- if (msg.what == 0) {
- camOpenCheckCnt1++;
- if (camOpenCheckCnt1 > handlerMaxCnt) {
- Log.w(TAG, "[mFrontCamOpenCheckHandler] camOpenCheckCnt1 is over!! [" + camOpenCheckCnt1 + "]");
- mFrontCamOpenCheckHandler.removeMessages(0);
- mFrontCamOpenCheckHandler.removeMessages(1);
- } else {
- if (mFrontCamera != null)
- mFrontCamOpenCheckHandler.sendEmptyMessageDelayed(1, 100);
- else mFrontCamOpenCheckHandler.sendEmptyMessageDelayed(0, 100);
- }
- } else if (msg.what == 1) {
- // ************ 카메라 밝기 조절!! ************
- Log.d(TAG, "[mFrontCamOpenCheckHandler] [CAMERA OPEN] ctrlCameraBrightness");
- Global.ctrlCameraBrightness(nBrightness);
- } else if (msg.what == 2) {
- camOpenCheckCnt2++;
- if (camOpenCheckCnt2 > handlerMaxCnt) {
- Log.w(TAG, "[mFrontCamOpenCheckHandler] camOpenCheckCnt2 is over!! [" + camOpenCheckCnt2 + "]");
- mFrontCamOpenCheckHandler.removeMessages(2);
- mFrontCamOpenCheckHandler.removeMessages(3);
- } else {
- if (mFrontCamera != null) mFrontCamOpenCheckHandler.sendEmptyMessageDelayed(3, 100);
- else mFrontCamOpenCheckHandler.sendEmptyMessageDelayed(2, 100);
- }
- } else if (msg.what == 3) {
- // ************ 스마트현관카메라 영상 녹화 시작!! ************
- } else if (msg.what == 4) {
- camOpenCheckCnt3++;
- if (camOpenCheckCnt3 > handlerMaxCnt) {
- Log.w(TAG, "[mFrontCamOpenCheckHandler] camOpenCheckCnt3 is over!! [" + camOpenCheckCnt3 + "]");
- mFrontCamOpenCheckHandler.removeMessages(4);
- mFrontCamOpenCheckHandler.removeMessages(5);
- } else {
- if (mFrontCamera != null) mFrontCamOpenCheckHandler.sendEmptyMessageDelayed(5, 100);
- else mFrontCamOpenCheckHandler.sendEmptyMessageDelayed(4, 100);
- }
- } else if (msg.what == 5) {
- // ************ 서브폰 현관 TV Out 시작!! (IHN-D101 PR2000K / 대외향월패드 기본 현관카메라 호출시) ************
- Log.d(TAG, "[mFrontCamOpenCheckHandler] [CAMERA OPEN] SubPhone TV OUT");
- sendHandlerMsg(HANDLERMSG.SHOW_FRONTCAM_SUBPHONE, 0, 0);
- if (ConfigValues.bRemoteCall) {
- ((MainActivity) mContext).mFrontCamOpenCheckHandler.sendEmptyMessageDelayed(6, 100); // camera open check, Subphone TVout 이후 encoderStartOperation 시작 (방문객 원격통화 사용할 경우)
- }
- } else if (msg.what == 6) {
- camOpenCheckCnt4++;
- if (camOpenCheckCnt4 > handlerMaxCnt) {
- Log.w(TAG, "[mFrontCamOpenCheckHandler] camOpenCheckCnt4 is over!! [" + camOpenCheckCnt4 + "]");
- mFrontCamOpenCheckHandler.removeMessages(6);
- mFrontCamOpenCheckHandler.removeMessages(7);
- } else {
- if (mFrontCamera != null) mFrontCamOpenCheckHandler.sendEmptyMessageDelayed(7, 100);
- else mFrontCamOpenCheckHandler.sendEmptyMessageDelayed(6, 100);
- }
- } else if (msg.what == 7) {
- // ************방문객 원격통화 인코딩 시작!! ************
- Log.d(TAG, "[mFrontCamOpenCheckHandler] [CAMERA OPEN] encoderStart");
- startVideoEncoding(true, true, true); // 모바일로 현관 영상 전송 (방문객 원격통화)
- }
- }
- };
- // ============================== 영상 ==============================
- public void startVideoEncoding(boolean bSet, boolean bEncoding, boolean bDecoding) {
- try {
- Log.d(TAG, "[startVideoEncoding] bSet [" + bSet + "], bEncoding [" + bEncoding + "], bDecoding [" + bDecoding + "]");
- if (mVideoController == null) Log.w(TAG, "[startVideoEncoding] mVideoController is null!");
- if (mVideoController != null) {
- mVideoController.startVideoEncoding(bSet, bEncoding, bDecoding);
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] startVideoEncoding(boolean bSet, boolean bEncoding, boolean bDecoding)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- int apiCheckCnt1 = 0, apiCheckCnt2 = 0, apiCheckCnt3 = 0;
- protected Handler mWallPadApiCheckHandler = new Handler() {
- public void handleMessage(Message msg) {
- if (msg.what == 0) {
- apiCheckCnt1++;
- if (apiCheckCnt1 > (handlerMaxCnt * 10)) {
- Log.w(TAG, "[mFrontCamOpenCheckHandler] apiCheckCnt1 is over!! [" + apiCheckCnt1 + "]");
- mWallPadApiCheckHandler.removeMessages(0);
- mWallPadApiCheckHandler.removeMessages(1);
- } else {
- if (mWallPadAPI != null) {
- if (mWallPadAPI.Check_Connect()) mWallPadApiCheckHandler.sendEmptyMessageDelayed(1, 10);
- else mWallPadApiCheckHandler.sendEmptyMessageDelayed(0, 10);
- }
- else {
- Log.w(TAG, "[mFrontCamOpenCheckHandler] mWallPadAPI is null!!!");
- }
- }
- } else if (msg.what == 1) {
- // 스마트현관카메라 API 로딩
- Log.d(TAG, "[mWallPadApiCheckHandler.handleMessage] Handler finish!! mTempCurrentScreenId [" + mTempCurrentScreenId + "]");
- if (ConfigValues.eFrontCameraType == FRONTCAMERATYPE.SMARTIOT || ConfigValues.eFrontCameraType == FRONTCAMERATYPE.SMARTKEY_EXTERNAL || ConfigValues.eFrontCameraType == FRONTCAMERATYPE.SMART_HS || ConfigValues.eFrontCameraType == FRONTCAMERATYPE.SMART_DW) {
- smartKeyRfDoorAPI = mWallPadAPI.Get_SmartKeyRfDoorController();
- }
- boolean result = setChangeScreen(mTempCurrentScreenId, false);
- if (!result) {
- int nScreenID = API_Menu.SubMenuCall.Guard;
- if (!bGuardCallUse) {
- if (bFrontCallUse) nScreenID = API_Menu.SubMenuCall.Door;
- else if (bResiCallUse) nScreenID = API_Menu.SubMenuCall.Neighbor;
- else if (bPSTNCallUse) nScreenID = API_Menu.SubMenuCall.PSTN;
- else if (bCallHistoryUse) nScreenID = API_Menu.SubMenuCall.CallList;
- else if (bVisitorPicUse) nScreenID = API_Menu.SubMenuCall.Visitor;
- }
- setChangeScreen(nScreenID, false);
- }
- } else if (msg.what == 2) {
- apiCheckCnt2++;
- if (apiCheckCnt2 > (handlerMaxCnt * 10)) {
- Log.w(TAG, "[mFrontCamOpenCheckHandler] apiCheckCnt2 is over!! [" + apiCheckCnt2 + "]");
- mWallPadApiCheckHandler.removeMessages(2);
- mWallPadApiCheckHandler.removeMessages(3);
- } else {
- if (mWallPadAPI != null) {
- if (mWallPadAPI.Check_Connect())
- mWallPadApiCheckHandler.sendEmptyMessageDelayed(3, 10);
- else mWallPadApiCheckHandler.sendEmptyMessageDelayed(2, 10);
- }
- }
- } else if (msg.what == 3) {
- // 거실조명 API 로딩
- sdbLivingRoomLightAPI = mWallPadAPI.Get_Sdb_LivingRoomLightAPI();
- Log.d(TAG, "[mWallPadApiCheckHandler.handleMessage] ---------- sdbLivingRoomLightAPI is connected!!! ----------");
- } else if (msg.what == 4) {
- apiCheckCnt3++;
- if (apiCheckCnt3 > (handlerMaxCnt * 10)) {
- Log.w(TAG, "[mFrontCamOpenCheckHandler] apiCheckCnt3 is over!! [" + apiCheckCnt3 + "]");
- mWallPadApiCheckHandler.removeMessages(4);
- mWallPadApiCheckHandler.removeMessages(5);
- } else {
- if (mWallPadAPI != null) {
- if (mWallPadAPI.Check_Connect())
- mWallPadApiCheckHandler.sendEmptyMessageDelayed(5, 10);
- else mWallPadApiCheckHandler.sendEmptyMessageDelayed(4, 10);
- }
- }
- } else if (msg.what == 5) {
- // 지문인식 API 로딩
- fpDlockAPI = mWallPadAPI.Get_FP_DLockController();
- Log.d(TAG, "[mWallPadApiCheckHandler.handleMessage] ---------- fpDlockAPI is connected!!! ----------");
- }
- }
- };
- int pathCheckCnt1 = 0, pathCheckCnt2 = 0;
- public Handler mCallPathCheckHandler = new Handler() {
- public void handleMessage(Message msg) {
- try {
- if (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40 || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
- if (msg.what == 0) {
- pathCheckCnt1++;
- if (pathCheckCnt1 > 200) {
- Log.w(TAG, "[mCallPathCheckHandler] pathCheckCnt1 is over!! [" + pathCheckCnt1 + "]");
- sendHandlerMsg(HANDLERMSG.RECOVER_SYSTEM_VOLUME, 0, 0);
- mCallPathCheckHandler.removeMessages(0);
- mCallPathCheckHandler.removeMessages(1);
- } else {
- if (mCallController.getTalkPath() == CALLPATH.DOORMUSIC)
- mCallPathCheckHandler.sendEmptyMessageDelayed(1, 50);
- else mCallPathCheckHandler.sendEmptyMessageDelayed(0, 50);
- }
- } else if (msg.what == 1) {
- Log.d(TAG, "[mCallPathCheckHandler.handleMessage] Handler finish!! CALLPATH [" + mCallController.getTalkPath() + "]");
- mIOInterface.ctrlSetTalkPathDoor();
- sendHandlerMsg(HANDLERMSG.PLAY_DINGDONG, 0, 0); // [띵똥시나리오] 1. 현관카메라 띵똥~
- } else if (msg.what == 2) {
- pathCheckCnt2++;
- if (pathCheckCnt2 > 200) {
- Log.w(TAG, "[mCallPathCheckHandler] pathCheckCnt2 is over!! [" + pathCheckCnt2 + "]");
- sendHandlerMsg(HANDLERMSG.RECOVER_SYSTEM_VOLUME, 0, 0);
- mCallPathCheckHandler.removeMessages(2);
- mCallPathCheckHandler.removeMessages(3);
- } else {
- if (mCallController.getTalkPath() == CALLPATH.NORMAL)
- mCallPathCheckHandler.sendEmptyMessageDelayed(3, 50);
- else mCallPathCheckHandler.sendEmptyMessageDelayed(2, 50);
- }
- } else if (msg.what == 3) {
- Log.d(TAG, "[mCallPathCheckHandler.handleMessage] Handler finish!! CALLPATH [" + mCallController.getTalkPath() + "]");
- CALLSTATUS eCallStatus = mCallController.mCallInfo.getFRONT();
- Log.d(TAG, "[mCallPathCheckHandler.handleMessage] eCallStatus [" + eCallStatus + "]");
- if (eCallStatus == CALLSTATUS.CALLED) {
- sendHandlerMsg(HANDLERMSG.RECOVER_SYSTEM_VOLUME, 0, 0);
- sendHandlerMsgDelayed(HANDLERMSG.PLAY_FRONT_BELL, 0, 0, 200); // [띵똥시나리오] 3. W/P에서 현관호출음
- sendHandlerMsgDelayed(HANDLERMSG.SET_TALK_BTN_ENABLE, 0, 0, 1000);
- }
- }
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] mCallPathCheckHandler.handleMessage()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- sendHandlerMsg(HANDLERMSG.RECOVER_SYSTEM_VOLUME, 0, 0);
- }
- }
- };
- public boolean saveFrontPicture() {
- try {
- LOG_INFO("[saveFrontPicture]");
- if (mFrontCamera != null) {
- if (ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_D101 || ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_D101_I
- || ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_D101K || ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_D101K_I
- || ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_D101_I_OCF || ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_D101_I_LX2) {
- mFrontCamera.takePicture(null, null, mPicture_IHND101);
- }
- else {
- mFrontCamera.takePicture(null, null, mPicture);
- }
- return true;
- } else {
- Log.w(TAG, "[saveFrontPicture] mFrontCamera is null!");
- return false;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] saveFrontPicture()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- Camera.PictureCallback mPicture = new Camera.PictureCallback() {
- @Override
- public void onPictureTaken(byte[] data, Camera camera) {
- // JPEG 이미지가 byte[] 형태로 들어옵니다.
- try {
- if (mCallController.strVisitorPicturePath != null) {
- File mFile = new File(mCallController.strVisitorPicturePath);
- Bitmap mBitmap = BitmapFactory.decodeByteArray(data, 0, data.length);
- if (mBitmap != null) {
- mBitmap = getResizedBitmap(mBitmap, 325, 245);
- mBitmap = cropBitmap(mBitmap);
- // LOG("[onPictureTaken] After Resize!! mBitmap.Width [" + mBitmap.getWidth() + "], mBitmap.Height [" + mBitmap.getHeight() + "]");
- FileOutputStream mFileOutputStream = new FileOutputStream(mFile);
- if (!Version.getGatewayUsage() || ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_1010GL_I
- || ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_1010GL_I_2443 || ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_1010GL_I_6410) {
- if (Build.VERSION.SDK_INT > 23) { // 대외향 모델 중 AOS 7.1인 모델에 적용
- LOG("[onPictureTaken] apply YUV");
- byte [] yuv = getNV21(mBitmap.getWidth(), mBitmap.getHeight(), mBitmap);
- int[] anRGB8888 = decodeYUV420SP(yuv, mBitmap.getWidth(), mBitmap.getHeight());
- mBitmap = Bitmap.createBitmap(anRGB8888, mBitmap.getWidth(), mBitmap.getHeight(), Bitmap.Config.ARGB_8888);
- mBitmap.compress(Bitmap.CompressFormat.JPEG, 100, mFileOutputStream);
- }
- }
- else {
- mBitmap.compress(Bitmap.CompressFormat.JPEG, 100, mFileOutputStream);
- }
- mFileOutputStream.flush();
- mFileOutputStream.close();
- // 검은화면(카메라 고장 또는 영상 출력빠짐)일 경우 이미지 교체
- long fileSize = mFile.length();
- if (fileSize < 2000) {
- LOG_WARN("[onPictureTaken] fileSize is less than 2000 KB [" + fileSize + "]");
- mFile.delete();
- InputStream input = getResources().openRawResource(R.drawable.box_no_image);
- mFileOutputStream = new FileOutputStream(mFile);
- byte[] hData = new byte[1024];
- int length = 0;
- while ((length = input.read(hData)) > 0) {
- // Log.d(TAG, "[onPictureTaken] length [" + length + "]");
- mFileOutputStream.write(hData, 0, length);
- }
- mBitmap.compress(Bitmap.CompressFormat.JPEG, 100, mFileOutputStream);
- mFileOutputStream.flush();
- mFileOutputStream.close();
- input.close();
- }
- // encryptPictureFile(mFile); // TODO 추후 적용!!! 홈넷 AAA등급 인증을 위한 사진 암호화
- if (mFrontCamera != null) mFrontCamera.startPreview();
- } else {
- Log.w(TAG, "[onPictureTaken] mBitmap is null!");
- }
- } else {
- Log.w(TAG, "[onPictureTaken] strVisitorPicturePath is null!");
- }
- } catch (FileNotFoundException e) {
- Log.e(TAG, "[FileNotFoundException] File not found: " + e.getMessage());
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- mCallController.strVisitorPicturePath = null;
- } catch (IOException e) {
- Log.e(TAG, "[IOException] Error accessing file: " + e.getMessage());
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- mCallController.strVisitorPicturePath = null;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] onPictureTaken(byte[] data, Camera camera)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- mCallController.strVisitorPicturePath = null;
- }
- }
- };
- Camera.PictureCallback mPicture_IHND101 = new Camera.PictureCallback() {
- @Override
- public void onPictureTaken(byte[] data, Camera camera) {
- // JPEG 이미지가 byte[] 형태로 들어옵니다.
- try {
- if (mCallController.strVisitorPicturePath != null) {
- File mFile = new File(mCallController.strVisitorPicturePath);
- Bitmap mBitmap = BitmapFactory.decodeByteArray(data, 0, data.length);
- if (mBitmap != null) {
- FileOutputStream mFileOutputStream = new FileOutputStream(mFile);
- mBitmap = postprocTakenIMG(mBitmap);
- mBitmap.compress(Bitmap.CompressFormat.JPEG, 100, mFileOutputStream);
- Log.i(TAG, "[mPicture_IHND101.onPictureTaken] Width [" + mBitmap.getWidth() + "], Height [" + mBitmap.getHeight() + "]");
- mFileOutputStream.flush();
- mFileOutputStream.close();
- // 검은화면(카메라 고장 또는 영상 출력빠짐)일 경우 이미지 교체
- long fileSize = mFile.length();
- if (fileSize < 2000) {
- LOG_WARN("[mPicture_IHND101] fileSize is less than 2000 KB [" + fileSize + "]");
- mFile.delete();
- InputStream input = getResources().openRawResource(R.drawable.box_no_image);
- mFileOutputStream = new FileOutputStream(mFile);
- byte[] hData = new byte[1024];
- int length = 0;
- while ((length = input.read(hData)) > 0) {
- mFileOutputStream.write(hData, 0, length);
- }
- mBitmap.compress(Bitmap.CompressFormat.JPEG, 100, mFileOutputStream);
- mFileOutputStream.flush();
- mFileOutputStream.close();
- input.close();
- }
- // encryptPictureFile(mFile); // TODO 추후 적용!!! 홈넷 AAA등급 인증을 위한 사진 암호화
- if (mFrontCamera != null) mFrontCamera.startPreview();
- }
- else {
- Log.w(TAG, "[mPicture_IHND101] mBitmap is null!");
- }
- }
- else {
- Log.w(TAG, "[mPicture_IHND101] strVisitorPicturePath is null!");
- }
- } catch (FileNotFoundException e) {
- Log.e(TAG, "[FileNotFoundException] File not found: " + e.getMessage());
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- mCallController.strVisitorPicturePath = null;
- } catch (IOException e) {
- Log.e(TAG, "[IOException] Error accessing file: " + e.getMessage());
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- mCallController.strVisitorPicturePath = null;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] mPicture_IHND101.onPictureTaken(byte[] data, Camera camera)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- mCallController.strVisitorPicturePath = null;
- }
- }
- };
- public Bitmap reverseIMGColor(Bitmap bitmap) {
- try {
- int [] argb = new int[bitmap.getWidth() * bitmap.getHeight()];
- byte [] yuv = getNV21(bitmap.getWidth(), bitmap.getHeight(), bitmap);
- int[] anRGB8888 = decodeYUV420SP(yuv, bitmap.getWidth(), bitmap.getHeight());
- return Bitmap.createBitmap(anRGB8888, bitmap.getWidth(), bitmap.getHeight(), Bitmap.Config.ARGB_8888);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return null;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] reverseIMGColor(Bitmap bitmap)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return null;
- }
- }
- public Bitmap flipTakenIMG(Bitmap bitmap) {
- try {
- Matrix matrix = new Matrix();
- if (ConfigValues.bSmartIOTCamFlip) matrix.setScale(-1, 1);
- else matrix.setScale(1, 1);
- return Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, false);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return null;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] flipTakenIMG(Bitmap bitmap)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return null;
- }
- }
- public Bitmap cropBitmap(Bitmap Original) {
- try {
- Bitmap Result;
- Log.w(TAG, "[cropBitmap] ConfigValues.eFrontCameraType [" + ConfigValues.eFrontCameraType + "]");
- if (Build.VERSION.SDK_INT > 23) {
- // AOS 7.1.1 (메이드인랩 BSP)
- if (ConfigValues.eFrontCameraType == FRONTCAMERATYPE.SMARTIOT) {
- Matrix matrix = new Matrix();
- if (ConfigValues.bSmartIOTCamFlip) matrix.setScale(-1, 1);
- else matrix.setScale(1, 1);
- Result = Bitmap.createBitmap(Original, 5, 5, 320, 240, matrix, true);
- }
- else {
- Result = Bitmap.createBitmap(Original, 5, 5, 320, 240);
- }
- }
- else {
- // AOS 6.0.1 (다담 BSP)
- Log.i(TAG, "[cropBitmap] Width [" + Original.getWidth() + "], Height [" + Original.getHeight() + "]");
- Result = Bitmap.createBitmap(Original, 5, 5, 320, 240);
- }
- if (Result != Original) Original.recycle();
- return Result;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return null;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] cropBitmap(Bitmap Original)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return null;
- }
- }
- boolean bOriginalSize = false; // true: 원래 사이즈로 저장, false: 수정된 사이즈(320, 240)로 저장
- int nFixedIMGSize_Width = 320;
- int nFixedIMGSize_Height = 240;
- public Bitmap postprocTakenIMG(Bitmap Original) {
- try {
- Bitmap Result;
- if (Build.VERSION.SDK_INT > 23) {
- // AOS 7.1.1 (메이드인랩 BSP)
- if (bOriginalSize) {
- Result = Bitmap.createScaledBitmap(Original, Original.getWidth() + 5, Original.getHeight() + 5, false);
- Result = Bitmap.createBitmap(Result, 5, 5, Original.getWidth(), Original.getHeight());
- if (ConfigValues.eFrontCameraType == FRONTCAMERATYPE.SMARTIOT || ConfigValues.eFrontCameraType == FRONTCAMERATYPE.HD) {
- // 스마트IoT현관카메라의 경우 사진 색반전 코드 적용 (JEFF, 2020.08.11)
- Result = reverseIMGColor(Result);
- }
- }
- else {
- Result = getResizedBitmap(Original, nFixedIMGSize_Width + 5, nFixedIMGSize_Height + 5);
- Result = Bitmap.createBitmap(Result, 5, 5, nFixedIMGSize_Width, nFixedIMGSize_Height);
- Result = reverseIMGColor(Result);
- if (ConfigValues.eFrontCameraType == FRONTCAMERATYPE.SMARTIOT || ConfigValues.eFrontCameraType == FRONTCAMERATYPE.HD) {
- // 스마트IoT현관카메라의 경우 사진 색반전 코드 적용 (JEFF, 2020.08.11)
- Result = flipTakenIMG(Result);
- }
- }
- }
- else {
- // AOS 6.0.1 (다담 BSP)
- if (bOriginalSize) {
- Result = Bitmap.createScaledBitmap(Original, Original.getWidth() + 5, Original.getHeight() + 5, false);
- Result = Bitmap.createBitmap(Result, 5, 5, Original.getWidth(), Original.getHeight());
- }
- else {
- Result = getResizedBitmap(Original, nFixedIMGSize_Width + 5, nFixedIMGSize_Height + 5);
- Result = Bitmap.createBitmap(Result, 5, 5, nFixedIMGSize_Width, nFixedIMGSize_Height);
- }
- }
- if (Result != Original) Original.recycle();
- return Result;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return null;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] postprocTakenIMG(Bitmap Original)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return null;
- }
- }
- public Bitmap getResizedBitmap(Bitmap bitmap, int nNewWidth, int nNewHeight) {
- try {
- int nWidth = bitmap.getWidth();
- int nHeight = bitmap.getHeight();
- float scaleWidth = ((float) nNewWidth) / nWidth;
- float scaleHeight = ((float) nNewHeight) / nHeight;
- Matrix mMatrix = new Matrix();
- mMatrix.postScale(scaleWidth, scaleHeight);
- return Bitmap.createBitmap(bitmap, 0, 0, nWidth, nHeight, mMatrix, false);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return null;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getResizedBitmap(Bitmap bitmap, int nNewWidth, int nNewHeight)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return null;
- }
- }
- public int[] decodeYUV420SP(byte[] yuv420sp,int width,int height) {
- try {
- final int frameSize = width * height;
- int[] anPixels = new int[frameSize];
- for (int j =0, yp =0; j < height; j++) {
- int uvp = frameSize + (j >>1) * width, u =0, v =0;
- for (int i =0; i < width; i++, yp++) {
- int y = (0xff & ((int) yuv420sp[yp])) -16;
- if (y <0) y =0;
- if ((i &1) ==0) {
- v = (0xff & yuv420sp[uvp++]) -128;
- u = (0xff & yuv420sp[uvp++]) -128;
- }
- int y1192 =1192 * y;
- int r = (y1192 +1634 * v);
- int g = (y1192 -833 * v -400 * u);
- int b = (y1192 +2066 * u);
- if (r <0) r =0;else if (r >262143) r =262143;
- if (g <0) g =0;else if (g >262143) g =262143;
- if (b <0) b =0;else if (b >262143) b =262143;
- anPixels[yp] =0xff000000 | ((r <<6) &0xff0000) | ((g >>2) &0xff00) | ((b >>10) &0xff);
- }
- }
- return anPixels;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return null;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] decodeYUV420SP(byte[] yuv420sp,int width,int height)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return null;
- }
- }
- byte [] getNV21(int inputWidth, int inputHeight, Bitmap scaled) {
- try {
- int [] argb = new int[inputWidth * inputHeight];
- scaled.getPixels(argb, 0, inputWidth, 0, 0, inputWidth, inputHeight);
- byte [] yuv = new byte[inputWidth*inputHeight*3/2];
- yuv = encodeYUV420SP(argb, inputWidth, inputHeight);
- scaled.recycle();
- return yuv;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return null;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getNV21(int inputWidth, int inputHeight, Bitmap scaled)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return null;
- }
- }
- byte [] encodeYUV420SP(int[] argb, int width, int height) {
- try {
- final int frameSize = width * height;
- byte [] yuv = new byte[width*height*3/2];
- int yIndex = 0;
- int uvIndex = frameSize;
- int a, R, G, B, Y, U, V;
- int index = 0;
- for (int j = 0; j < height; j++) {
- for (int i = 0; i < width; i++) {
- a = (argb[index] & 0xff000000) >> 24; // a is not used obviously
- R = (argb[index] & 0xff0000) >> 16;
- G = (argb[index] & 0xff00) >> 8;
- B = (argb[index] & 0xff) >> 0;
- // well known RGB to YUV algorithm
- Y = ( ( 66 * R + 129 * G + 25 * B + 128) >> 8) + 16;
- //U = ( ( -38 * R - 74 * G + 112 * B + 128) >> 8) + 128;
- //V = ( ( 112 * R - 94 * G - 18 * B + 128) >> 8) + 128;
- V = ( ( -38 * R - 74 * G + 112 * B + 128) >> 8) + 128;
- U = ( ( 112 * R - 94 * G - 18 * B + 128) >> 8) + 128;
- // NV21 has a plane of Y and interleaved planes of VU each sampled by a factor of 2
- // meaning for every 4 Y pixels there are 1 V and 1 U. Note the sampling is every other
- // pixel AND every other scanline.
- yuv[yIndex++] = (byte) ((Y < 0) ? 0 : ((Y > 255) ? 255 : Y));
- if (j % 2 == 0 && index % 2 == 0) {
- yuv[uvIndex++] = (byte)((V<0) ? 0 : ((V > 255) ? 255 : V));
- yuv[uvIndex++] = (byte)((U<0) ? 0 : ((U > 255) ? 255 : U));
- }
- index ++;
- }
- }
- return yuv;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return null;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] encodeYUV420SP(int[] argb, int width, int height)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return null;
- }
- }
- public boolean getStrangerRecordingManagerSetting() {
- boolean bResult = false;
- WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(getApplicationContext());
- try {
- int[] nFrontCam = mWallpadDeviceSet.Get_RFDoorCAM_Info();
- boolean bRecord = mWallpadDeviceSet.Get_Stranger_RecordUse();
- mWallpadDeviceSet.closeDB();
- if (nFrontCam[0] == 1) {
- if (nFrontCam[1] == WallpadDeviceSet.DOORTYPE_IOT_SMART || nFrontCam[1] == WallpadDeviceSet.DOORTYPE_HYOSUNG_SMART || nFrontCam[1] == WallpadDeviceSet.DOORTYPE_DAEWOO_SMART) {
- if (bRecord) bResult = true;
- else bResult = false;
- }
- else bResult = false;
- }
- else bResult = false;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- mWallpadDeviceSet.closeDB();
- }
- catch (Exception e) {
- mWallpadDeviceSet.closeDB();
- Log.e(TAG, "[Exception] getStrangerRecordingManagerSetting()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- Log.d(TAG, "[getStrangerRecordingManagerSetting] bResult [" + bResult + "]");
- return bResult;
- }
- public void ctrlSmartIOTCamStatusMode(byte mode) {
- try {
- if (ConfigValues.eFrontCameraType == FRONTCAMERATYPE.SMARTIOT
- || ConfigValues.eFrontCameraType == FRONTCAMERATYPE.SMARTKEY_EXTERNAL
- || ConfigValues.eFrontCameraType == FRONTCAMERATYPE.SMART_HS
- || ConfigValues.eFrontCameraType == FRONTCAMERATYPE.SMART_DW) {
- LOG("[ctrlSmartIOTCamStatusMode] mode [" + Global.HextoString(mode) + "]");
- if (smartKeyRfDoorAPI != null) smartKeyRfDoorAPI.SetCAMERAmode(mode);
- else Log.w(TAG, "[ctrlSmartIOTCamStatusMode] smartKeyRfDoorAPI is null!!");
- } else {
- Log.w(TAG, "[ctrlSmartIOTCamStatusMode] Not Supported FRONTCAMERA!!");
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] ctrlSmartIOTCamStatusMode(byte mode)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public void ctrlSmartIOTCamLEDMode(byte mode) {
- try {
- if (ConfigValues.eFrontCameraType == FRONTCAMERATYPE.SMARTIOT
- || ConfigValues.eFrontCameraType == FRONTCAMERATYPE.SMARTKEY_EXTERNAL
- || ConfigValues.eFrontCameraType == FRONTCAMERATYPE.SMART_HS
- || ConfigValues.eFrontCameraType == FRONTCAMERATYPE.SMART_DW) {
- LOG("[ctrlSmartIOTCamLEDMode] mode [" + Global.HextoString(mode) + "]");
- if (smartKeyRfDoorAPI != null) smartKeyRfDoorAPI.SetLEDmode(mode);
- else Log.w(TAG, "[ctrlSmartIOTCCamLEDMode] smartKeyRfDoorAPI is null!!");
- } else {
- Log.w(TAG, "[ctrlSmartIOTCamLEDMode] Not Supported FRONTCAMERA!!");
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] ctrlSmartIOTCamLEDMode(byte mode)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /**
- * 스마트현관카메라 녹화 여부 판별
- */
- private boolean getStrangerRecording() {
- try {
- WallpadStatusData DBMGR = new WallpadStatusData(getContext());
- boolean bResult = DBMGR.GetStrangerRecordingOnOff();
- DBMGR.closeDB();
- Log.d(TAG, "[getStrangerRecording] bResult [" + bResult + "]");
- return bResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getStrangerRecording()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- // Surface manager
- public void initVideoSurfaceLayout() {
- try {
- Log.d(TAG, "[initVideoSurfaceLayout] bFFMPEGEnable = " + bFFMPEGEnable);
- if (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_IGW300) {
- mCallController.mVideoJNI.setDecoderInfo_V40(76, 85, 576, 405);
- initFrontVideo();
- }
- else if (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40) {
- mCallController.mVideoJNI.setDecoderInfo_V40(76, 85, 576, 405);
- initFrontVideo();
- }
- else if (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
- mCallController.mVideoJNI.setDecoderInfo_V40(76, 85, 576, 405);
- initFrontVideo();
- }
- else if (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
- mCallController.mVideoJNI.setDecoderInfo_V40(76, 85, 576, 405);
- if (bFFMPEGEnable) initRemoteVideoSurfaceLayout();
- initFrontVideo();
- }
- else {
- LOG_WARN("[initVideoSurfaceLayout] NOT Supported BOARDTYPE [" + ConfigValues.DEVICE_BOARDTYPE + "]");
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] initVideoSurfaceLayout()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public void removeVideoSurfaceLayout() {
- try {
- Log.i(TAG, "[removeVideoSurfaceLayout] start!!");
- if (bFFMPEGEnable) {
- mCallController.mVideoJNI.SWDecoderClose(2);
- mCallController.mVideoJNI.decoderStopOperation();
- }
- removeRemoteVideoSurfaceLayout();
- removeMyVideoSurfaceLayout();
- removeFrontVideoLayout();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] removeVideoSurfaceLayout()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private void getCallTimeoutEnable() {
- try {
- WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(mContext);
- boolean bResult = mWallpadDeviceSet.Get_CallAppCallTimeout();
- mWallpadDeviceSet.closeDB();
- Log.d(TAG, "[getCallTimeoutEnable] bResult [" + bResult + "]");
- if (bResult) {
- Log.i(TAG, "[getCallTimeoutEnable] Call timeout : Normal mode");
- mCallController.mCTT.setTalkNormalMode();
- } else {
- Log.i(TAG, "[getCallTimeoutEnable] Call timeout : Test mode");
- mCallController.mCTT.setTalkTestMode();
- SampleModeTitle = new WpadTextView(this, false, 200, 72, Gravity.CENTER, Color.DKGRAY, Common.fontsize._26_DEFAULT, true, 0);
- ViewRegistration(TopLayout, SampleModeTitle, 316, 17);
- SampleModeTitle.setText("[통화시험모드]");
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getCallTimeoutEnable()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public enum MAINEVENT {
- BTN_HOME,
- BTN_HOME_MOBILE
- }
- public interface MainEventListener {
- public void onMainTouchEvent(MAINEVENT eEvent);
- }
- MainEventListener mMainEventListener;
- public void setMainEventListener(MainEventListener MEL) {
- mMainEventListener = MEL;
- }
- public void releaseMainEventListener() {
- mMainEventListener = null;
- }
- // MainActivity Handler
- public final class HANDLERMSG {
- public final static int RELEASE_TOPMENUBTN_BLOCK = 10;
- public final static int CHECK_RECEIVINGCALL = 100;
- public final static int REMOVE_VIDEO_COVER = 110;
- public final static int SHOW_VIDEO_COVER = 120;
- public final static int CLEAR_ALL_CALL = 130;
- public final static int TAKE_PICTURE_FRONT = 140;
- public final static int CHANGESCREEN = 260;
- public final static int CHANGESCREEN_FRONT = 261;
- public final static int CHANGESCREEN_LOBBY = 262;
- public final static int CHANGESCREEN_GUARD = 263;
- public final static int CHANGESCREEN_RESIDENCE = 264;
- public final static int CHANGESCREEN_PSTN = 265;
- public final static int INIT_FRONTVIDEO = 310;
- public final static int REMOVE_FRONTVIDEO = 311;
- public final static int SHOW_FRONTVIDEO = 312;
- public final static int CTRL_FRONTVIDEO_BRIGHTNESS = 313;
- public final static int SET_TEMPSYSTEM_VOLUME = 400;
- public final static int RECOVER_SYSTEM_VOLUME = 410;
- public final static int SET_DTMF_VOLUME = 420;
- public final static int SET_RELIEFCALL_VOLUME = 430;
- public final static int SET_DINGDONG_VOLUME = 440;
- public final static int SETTALKPATH_DOORMUSIC = 450;
- public final static int SHOW_FRONTCAM_SUBPHONE = 500;
- public final static int CHANGE_STRANGER_NOTICE_COLOR = 600;
- public final static int CHANGE_REMOTECALL_NOTICE_COLOR = 650;
- public final static int SEND_REQUEST_PSTN_STATUS = 700;
- public final static int SEND_HOOK_ON = 710;
- public final static int SEND_PSTN_ARS_MODE = 720;
- public final static int PLAY_DINGDONG = 800;
- public final static int STOP_DINGDONG = 810;
- public final static int PLAY_FRONT_BELL = 820;
- public final static int SET_TALK_BTN_ENABLE = 830;
- public final static int CHECK_WALLPAD_CAMERA = 840;
- public final static int SEND_SUBWALLPAD_MOIP_FINISH = 850;
- public final static int RELEASE_BLOCK_FRONTCALL = 996;
- public final static int REFRESH_HOMEICON = 997;
- public final static int FINISH_WALLPADCALL = 998;
- public final static int FINISH_ACTIVITY = 999;
- }
- int nBrightness = 0;
- public Handler MainHandler = new Handler(Looper.getMainLooper()) {
- public void handleMessage(Message msg) {
- LOG("[MainHandler] MainHandler : what [" + msg.what + "], arg1 [" + msg.arg1 + "], arg2 [" + msg.arg2 + "]");
- switch (msg.what) {
- case HANDLERMSG.RELEASE_TOPMENUBTN_BLOCK:
- bBlockTopMenuBTN = false;
- break;
- case HANDLERMSG.CHECK_RECEIVINGCALL:
- generateCallEvent();
- break;
- case HANDLERMSG.REMOVE_VIDEO_COVER:
- break;
- case HANDLERMSG.SHOW_VIDEO_COVER:
- break;
- case HANDLERMSG.CLEAR_ALL_CALL:
- // mCallController.mCallInfo.resetAllCallInfo();
- // finishActivity();
- // mCallController.mCallInfo.resetAllCallInfo();
- setFinishTimerCreate(Common.FINISH_TIME_ALL_CALL_CLEAR);
- break;
- case HANDLERMSG.RELEASE_BLOCK_FRONTCALL:
- bBlockFrontCall = false;
- break;
- case HANDLERMSG.TAKE_PICTURE_FRONT:
- break;
- case HANDLERMSG.CHANGESCREEN:
- if (msg.arg1 == HANDLERMSG.CHANGESCREEN_FRONT) {
- changeMenuNScreen(ID.MENU.MENU_TALKFRONT);
- }
- else if (msg.arg1 == HANDLERMSG.CHANGESCREEN_LOBBY) {
- changeMenuNScreen(ID.MENU.MENU_TALKLOBBY);
- }
- else if (msg.arg1 == HANDLERMSG.CHANGESCREEN_GUARD) {
- changeMenuNScreen(ID.MENU.MENU_TALKGUARD);
- }
- else if (msg.arg1 == HANDLERMSG.CHANGESCREEN_RESIDENCE) {
- changeMenuNScreen(ID.MENU.MENU_TALKRESIDENCE);
- }
- else if (msg.arg1 == HANDLERMSG.CHANGESCREEN_PSTN) {
- changeMenuNScreen(ID.MENU.MENU_TALKPSTN);
- }
- else {
- LOG("[MainHandler] Invalid Screen Info!!");
- }
- break;
- case HANDLERMSG.INIT_FRONTVIDEO:
- initFrontVideoLayout();
- break;
- case HANDLERMSG.REMOVE_FRONTVIDEO:
- removeFrontVideoLayout();
- break;
- case HANDLERMSG.SHOW_FRONTVIDEO:
- showFrontVideo(true);
- break;
- case HANDLERMSG.CTRL_FRONTVIDEO_BRIGHTNESS:
- nBrightness = msg.arg1;
- Log.d(TAG, "[CTRL_FRONTVIDEO_BRIGHTNESS] nBrightness: " + nBrightness);
- if (mFrontCamOpenCheckHandler != null) mFrontCamOpenCheckHandler.sendEmptyMessage(0); // camera open check를 위한 핸들러 구현 (seulki)
- else Log.w(TAG, "[MainHandler] mFrontCamOpenCheckHandler is null!! -> HANDLERMSG.CTRL_FRONTVIDEO_BRIGHTNESS");
- break;
- case HANDLERMSG.SET_TEMPSYSTEM_VOLUME:
- if (mAudioManager != null) {
- mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, nTempSysVolume, 0);
- Log.d(TAG, "[MainHandler SET_TEMP_SYSTEM_VOLUME] Volume: " + mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC));
- }
- else Log.w(TAG, "[MainHandler] mAudioManager is null!! -> HANDLERMSG.SET_TEMPSYSTEM_VOLUME");
- break;
- case HANDLERMSG.RECOVER_SYSTEM_VOLUME:
- // 통화 종료 후 시스템 볼륨 원복 seulki
- if (nSysVolume > 0) {
- if (mAudioManager != null) {
- mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, nSysVolume, 0);
- Log.d(TAG, "[MainHandler RECOVER_SYSTEM_VOLUME] Volume: " + mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC));
- }
- else Log.w(TAG, "[MainHandler] mAudioManager is null!! -> HANDLERMSG.RECOVER_SYSTEM_VOLUME");
- }
- break;
- case HANDLERMSG.SET_DTMF_VOLUME:
- // IHN-1010 에서는 DTMF 발신시 볼륨 11로 셋팅
- if (mAudioManager != null) {
- mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, nTempDTMFVolume, 0);
- Log.d(TAG, "[MainHandler SET_DTMF_SYSTEM_VOLUME] Volume: " + mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC));
- }
- else Log.w(TAG, "[MainHandler] mAudioManager is null!! -> HANDLERMSG.SET_DTMF_VOLUME");
- break;
- case HANDLERMSG.SET_RELIEFCALL_VOLUME:
- // 안심통화시(오디오모드 19) 볼륨 11로 셋팅
- if (mAudioManager != null) {
- mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, nTempReliefVolume, 0);
- Log.d(TAG, "[MainHandler SET_RELIEFCALL_VOLUME] Volume: " + mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC));
- }
- else Log.w(TAG, "[MainHandler] mAudioManager is null!! -> HANDLERMSG.SET_RELIEFCALL_VOLUME");
- break;
- case HANDLERMSG.SET_DINGDONG_VOLUME:
- // 현관띵똥시 볼륨 12로 셋팅 / 효성카메라(IDC-HS100)일 경우 10
- int nVolume = nTempDingDongVolume;
- if (ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_HS101 || ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_HS101_I) {
- if (ConfigValues.eFrontCameraType == FRONTCAMERATYPE.BASIC) {
- nVolume = nTempDingDongVolume_IDCHS100;
- }
- }
- if (mAudioManager != null) {
- mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, nVolume, 0);
- Log.d(TAG, "[MainHandler SET_DINGDONG_VOLUME] Volume: " + mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC));
- }
- else Log.w(TAG, "[MainHandler] mAudioManager is null!! -> HANDLERMSG.SET_DINGDONG_VOLUME");
- break;
- case HANDLERMSG.SETTALKPATH_DOORMUSIC:
- Log.d(TAG, "[MainHandler] SETTALKPATH_DOORMUSIC");
- if (mCallController != null) mCallController.setTalkPath(CALLPATH.DOORMUSIC);
- break;
- case HANDLERMSG.SHOW_FRONTCAM_SUBPHONE:
- if (mCallController != null) mCallController.selectVideoSourceToSubPhone(CALLTYPE.FRONT, false);
- else Log.w(TAG, "[MainHandler] mCallController is null!! -> HANDLERMSG.SHOW_FRONTCAM_SUBPHONE");
- break;
- case HANDLERMSG.CHANGE_STRANGER_NOTICE_COLOR:
- if (TopStrangerRecodingNotice != null) TopStrangerRecodingNotice.setTextColor(nNoticeTextColor);
- else Log.w(TAG, "[MainHandler] TopStrangerRecodingNotice is null!! -> HANDLERMSG.CHANGE_STRANGER_NOTICE_COLOR");
- break;
- case HANDLERMSG.CHANGE_REMOTECALL_NOTICE_COLOR:
- if (TopRemoteCallNotice != null) TopRemoteCallNotice.setTextColor(nNoticeTextColor);
- else Log.w(TAG, "[MainHandler] TopRemoteCallNotice is null!! -> HANDLERMSG.CHANGE_REMOTECALL_NOTICE_COLOR");
- break;
- case HANDLERMSG.SEND_REQUEST_PSTN_STATUS:
- if (mPSTNController != null) mPSTNController.sendGetPSTNPath();
- else Log.w(TAG, "[MainHandler] mPSTNController is null!! -> HANDLERMSG.SEND_REQUEST_PSTN_STATUS");
- break;
- case HANDLERMSG.SEND_HOOK_ON:
- if (mPSTNController != null) mPSTNController.sendHookOn();
- else Log.w(TAG, "[MainHandler] mPSTNController is null!! -> HANDLERMSG.SEND_HOOK_ON");
- break;
- case HANDLERMSG.SEND_PSTN_ARS_MODE:
- if (mCallController != null) mCallController.onPSTNEvent(CALLEVENTTYPE.PSTN_RING, null, null);
- else Log.w(TAG, "[MainHandler] mCallController is null!! -> HANDLERMSG.SEND_PSTN_ARS_MODE");
- break;
- case HANDLERMSG.PLAY_DINGDONG:
- Log.d(TAG, "[MainHandler] PLAY_DINGDONG");
- int time = 0;
- if (mSound != null) time = mSound.PlayMent(SND.call.DINGDONG);
- LOG("[MainHandler] time [" + time + "]");
- if (time < 0) time = 2088;
- sendHandlerMsgDelayed(HANDLERMSG.STOP_DINGDONG, 0, 0, time + 500); // [띵똥시나리오] 2. 띵똥 stop / 패스 변경
- break;
- case HANDLERMSG.STOP_DINGDONG:
- Log.d(TAG, "[MainHandler] STOP_DINGDONG");
- if (mIOInterface != null) mIOInterface.ctrlSetTalkPathNormal();
- if (mAudioManager != null) mAudioManager.setMode(AudioManager.MODE_NORMAL);
- else Log.w(TAG, "[MainHandler] mAudioManager is null!! -> HANDLERMSG.STOP_DINGDONG");
- if (mCallPathCheckHandler != null) mCallPathCheckHandler.sendEmptyMessage(2);
- else Log.w(TAG, "[MainHandler] mCallPathCheckHandler is null!! -> HANDLERMSG.STOP_DINGDONG");
- break;
- case HANDLERMSG.PLAY_FRONT_BELL:
- LOG("[MainHandler] PLAY_FRONT_BELL");
- Global.playMelodyRepeat(CALLTYPE.FRONT);
- break;
- case HANDLERMSG.SET_TALK_BTN_ENABLE:
- Log.d(TAG, "[MainHandler] SET_TALK_BTN_ENABLE");
- // if (TalkFront.BTN_TALK != null) TalkFront.BTN_TALK.setButtonEventOffDisable();
- // else Log.w(TAG, "[MainHandler] TalkFront.BTN_TALK is null!! -> HANDLERMSG.SET_TALK_BTN_ENABLE");
- break;
- case HANDLERMSG.REFRESH_HOMEICON:
- bBlockHomeBTN = false;
- break;
- case HANDLERMSG.FINISH_WALLPADCALL:
- finishWallPadCall();
- break;
- case HANDLERMSG.FINISH_ACTIVITY:
- finishActivity();
- break;
- case IGW300CMD.AUDIO_OFF:
- Log.d(TAG, "[MainHandler] AUDIO_OFF ms.arg1 [" + msg.arg1 + "]");
- if (mIOInterface != null) mIOInterface.IGW300_CallPathCtrl(IGW300API.TEL_PATH.OFF);
- else Log.d(TAG, "[MainHandler] mIOInterface is null!! -> IGW300CMD.AUDIO_OFF");
- break;
- case IGW300CMD.AUDIO_PSTN_WALLPAD:
- Log.d(TAG, "[MainHandler] AUDIO_PSTN_WALLPAD");
- Log.d(TAG, "[MainHandler] ConfigValues.DEVICE_MODELTYPE [" + ConfigValues.DEVICE_MODELTYPE + "]");
- if (ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_D101 || ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_D101_I
- || ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_D101K || ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_D101K_I
- || ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_D101_I_OCF || ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_D101_I_LX2)
- {
- sendPSTNRingEndBR();
- }
- else {
- Log.d(TAG, "[MainHandler] ConfigValues.DEVICE_MODELTYPE [" + ConfigValues.DEVICE_MODELTYPE + "]");
- }
- if (mIOInterface != null) mIOInterface.IGW300_CallPathCtrl(IGW300API.TEL_PATH.WPAD_TEL);
- else Log.d(TAG, "[MainHandler] mIOInterface is null!! -> IGW300CMD.AUDIO_PSTN_WALLPAD");
- break;
- case IGW300CMD.AUDIO_PSTN_SUBPHONE:
- Log.d(TAG, "[MainHandler] AUDIO_PSTN_SUBPHONE");
- if (mIOInterface != null) mIOInterface.IGW300_CallPathCtrl(IGW300API.TEL_PATH.SUB_TEL);
- else Log.d(TAG, "[MainHandler] mIOInterface is null!! -> IGW300CMD.AUDIO_PSTN_SUBPHONE");
- break;
- case IGW300CMD.AUDIO_FRONT_WALLPAD:
- Log.d(TAG, "[MainHandler] AUDIO_FRONT_WALLPAD");
- if (mIOInterface != null) mIOInterface.IGW300_CallPathCtrl(IGW300API.TEL_PATH.WPAD_DOOR);
- else Log.d(TAG, "[MainHandler] mIOInterface is null!! -> IGW300CMD.AUDIO_FRONT_WALLPAD");
- break;
- case IGW300CMD.AUDIO_FRONT_SUBPHONE:
- Log.d(TAG, "[MainHandler] AUDIO_FRONT_SUBPHONE");
- if (mIOInterface != null) mIOInterface.IGW300_CallPathCtrl(IGW300API.TEL_PATH.SUB_DOOR);
- else Log.d(TAG, "[MainHandler] mIOInterface is null!! -> IGW300CMD.AUDIO_FRONT_SUBPHONE");
- break;
- case IGW300CMD.AUDIO_MOIP_SUBPHONE:
- Log.d(TAG, "[MainHandler] AUDIO_MOIP_SUBPHONE");
- if (mIOInterface != null) mIOInterface.IGW300_CallPathCtrl(IGW300API.TEL_PATH.MOIP_SUB);
- break;
- case IGW300CMD.AUDIO_PSTN_REJECT:
- Log.d(TAG, "[MainHandler] AUDIO_PSTN_REJECT");
- if (ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_D101 || ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_D101_I
- || ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_D101K || ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_D101K_I
- || ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_D101_I_OCF || ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_D101_I_LX2) {
- sendPSTNRingEndBR();
- }
- if (mIOInterface != null) mIOInterface.IGW300_CallPathCtrl(IGW300API.TEL_PATH.WPAD_TEL);
- else Log.d(TAG, "[MainHandler] mIOInterface is null!! -> IGW300API.TEL_PATH.WPAD_TEL");
- try { Thread.sleep(500); }
- catch (InterruptedException e) {
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- if (mIOInterface != null) mIOInterface.IGW300_CallPathCtrl(IGW300API.TEL_PATH.OFF);
- else Log.d(TAG, "[MainHandler] mIOInterface is null!! -> IGW300API.TEL_PATH.OFF");
- break;
- case HANDLERMSG.SEND_SUBWALLPAD_MOIP_FINISH:
- Intent mIntent = new Intent();
- mIntent.setAction(Declare.BR.APP_FINISH);
- mContext.sendBroadcast(mIntent);
- break;
- default:
- LOG("MainHandler : " + msg.what);
- break;
- }
- }
- };
- public void sendHandlerMsg(int what, int arg1, int arg2) {
- try {
- LOG("[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)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public void sendHandlerMsgDelayed(int what, int arg1, int arg2, long delay) {
- try {
- LOG("[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)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /**
- * JEFF, 2020.01.04
- * IGW-300연동시에는 국선 호출의 시작과 끝만 알려준다.
- * 또한, 월패드에서 통화를 수신한 경우에는 국선 호출의 끝을 알려주지 않으므로
- * 월패드에서 hookon하는 순간 국선 호출에 대한 링을 강제로 발생시키는 쓰레드를 종료하기위해 아래의 BR 메시지를 보낸다
- * 수신지는 iMapServer의 mWallPadNotifyBR -> kr.co.icontrols.wallpad.BR_MAIN_NOTI -> Common.BR_MAIN_NOTI.NOTICE_PSTN_RING_END
- */
- int NOTICE_PSTN_RING_END = 1025;
- public void sendPSTNRingEndBR() {
- try {
- Log.i(TAG, "[sendPSTNRingEndBR] ===== START =====");
- Intent mIntent = new Intent();
- mIntent.setAction(ACNAME_MAIN_NOTI);
- mIntent.putExtra("KIND", NOTICE_PSTN_RING_END);
- mContext.sendBroadcast(mIntent);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] sendPSTNRingEndBR()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public void setBlockFrontCall() {
- try {
- bBlockFrontCall = true;
- MainHandler.removeMessages(HANDLERMSG.RELEASE_BLOCK_FRONTCALL);
- ((MainActivity) mContext).sendHandlerMsgDelayed(HANDLERMSG.RELEASE_BLOCK_FRONTCALL, 0, 0, 3000);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] setBlockFrontCall()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private String KIND = "KIND";
- private boolean getBusinessSampleMode() {
- try {
- // 영업샘플모드인 경우, LCD를 항상 ON 시켜 놓는다.
- WallpadSalesSampleData mWallpadSalesSampleData = new WallpadSalesSampleData(mContext);
- int nMode = mWallpadSalesSampleData.getSalesSampleData(WallpadSalesSampleData.SALES_SAMPLE_MODE_SLEEP);
- mWallpadSalesSampleData.closeDB();
- if (nMode == 0) return true;
- else return false;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getBusinessSampleMode()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- private void getLCDReverse() {
- try {
- if (mIOInterface.getBoardRevision() != 0) bLCDReverse = true;
- else bLCDReverse = false;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- bLCDReverse = false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getLCDReverse()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- bLCDReverse = false;
- }
- }
- private void notifyAppFinish() {
- try {
- WallpadStatusData SetData = new WallpadStatusData(getApplicationContext());
- int nAlarmStatus = SetData.GetAlarmStatus();
- SetData.closeDB();
- LOG("[notifyAppFinish] nAlarmStatus [" + nAlarmStatus + "]");
- Intent intent = new Intent(ACNAME_MAIN_NOTI, null);
- intent.putExtra(KIND, Declare.BR.APK_EXIT_MAIN_CHECK);
- getContext().sendBroadcast(intent);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] notifyAppFinish()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private void notifyCallAppFinish() {
- try {
- WallpadStatusData SetData = new WallpadStatusData(getApplicationContext());
- int nAlarmStatus = SetData.GetAlarmStatus();
- SetData.closeDB();
- LOG("[notifyCallAppFinish] nAlarmStatus [" + nAlarmStatus + "]");
- Intent intent = new Intent(ACNAME_MAIN_NOTI, null);
- intent.putExtra(KIND, Declare.BR.NOTI_CALLAPP_FINISHING);
- getContext().sendBroadcast(intent);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] notifyCallAppFinish()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- boolean bBlockFrontCall = false; // 현관통화가 종료되고 통화앱이 종료되기까지 시간이 걸리므로 플래그를 세워 일정시간 현관콜을 막는다.
- BroadcastReceiver mMainExtraEventReceiver = new BroadcastReceiver() {
- String TAG = "MainExtraEventReceiver";
- @Override
- public void onReceive(Context context, Intent intent) {
- try {
- String strAction = intent.getAction();
- Log.d(this.TAG, "[onReceive] strAction [" + strAction + "]");
- if (strAction.equals(Declare.BR.APP_FINISH)) {
- mIOInterface.ctrlPopupGUI(true);
- mCallController.setTalkPath(CALLPATH.NORMAL); // Finish BR 수신시 통화패스 Normal로 변경
- if (mMainEventListener != null) {//
- String strCallOwner = intent.getStringExtra(CALLTRIGGER.CALLOWNER);
- Log.d(this.TAG, "[onReceive] strCallOwner [" + strCallOwner + "]");
- if (strCallOwner!= null) {
- if (strCallOwner.equals("MOBILE")) mMainEventListener.onMainTouchEvent(MAINEVENT.BTN_HOME_MOBILE);
- } else {
- bDelCallTouch = true;
- mMainEventListener.onMainTouchEvent(MAINEVENT.BTN_HOME);
- }
- }
- else {
- finishWallPadCall();
- }
- }
- else if (strAction.equals(Declare.BR.WALLPAD_ALERT)) {
- Log.d(this.TAG, "[onReceive] strAction [" + strAction + "]");
- int nKind = intent.getIntExtra(define.NOTIBR_KIND, 0);
- if (nKind == Declare.BR.NOTIFY_ALARM_FIRED) finishWallPadCall();
- }
- else if (strAction.equals(Declare.BR.EVENT_DEVICE_CONTROL)) {
- KeyEvent mKeyEvent = intent.getParcelableExtra(Intent.EXTRA_KEY_EVENT);
- Log.i(this.TAG, "[onReceive] mKeyEvent : " + mKeyEvent + ", mKeyEvent.getKeyCode() : " + mKeyEvent.getKeyCode());
- if (mKeyEvent.getKeyCode() == Declare.BTN.TALK || mKeyEvent.getKeyCode() == Declare.BTN.TALK_V40) {
- // if (mCallController.mCallInfo.getFRONT() == CALLSTATUS.IDLE && !bBlockFrontCall) {
- // setBlockFrontCall();
- // mCallController.onFrontEvent(CALLEVENTTYPE.RECEIVE_CALL, CALLTYPE.FRONT);
- // }
- // else Log.w(this.TAG, "[onReceive] Front call ignored!!! [" + mCallController.mCallInfo.getFRONT() + "], bBlockFrontCall [" + bBlockFrontCall + "]");
- }
- else if (mKeyEvent.getKeyCode() == Declare.BTN.FRONT || mKeyEvent.getKeyCode() == Declare.BTN.FRONT_V40) {
- Log.i(this.TAG, "[onReceive] mKeyEvent.getKeyCode() : " + mKeyEvent.getKeyCode());
- if (!bBlockFrontCall) {
- if (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40 || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
- if (mCallController.mCallInfo.getIDLECnt() == mCallController.mCallInfo.IDLECNT_MAX) {
- sendHandlerMsg(HANDLERMSG.SET_DINGDONG_VOLUME, 0, 0); // 현관띵똥 볼륨 고정(시스템 볼륨 따라가지 않도록)
- sendHandlerMsg(HANDLERMSG.SETTALKPATH_DOORMUSIC, 0, 0);
- mCallPathCheckHandler.sendEmptyMessage(0); // 통화앱이 실행되어 있으나 통화상태가 아닌 경우에도 띵똥 소리 나야함 (메인앱에서 현관 호출 BR 수신이 불가하므로 통화앱에서 처리)
- }
- }
- if (mCallController.mCallInfo.getFRONT() == CALLSTATUS.IDLE) {
- setBlockFrontCall();
- mCallController.onFrontEvent(CALLEVENTTYPE.RECEIVE_CALL, CALLTYPE.FRONT);
- }
- else {
- Log.w(this.TAG, "[onReceive] Front call ignored!!! getFRONT() [" + mCallController.mCallInfo.getFRONT() + "]");
- }
- }
- else {
- Log.w(this.TAG, "[onReceive] Front call ignored!!! bBlockFrontCall [" + bBlockFrontCall + "]");
- }
- }
- else if (mKeyEvent.getKeyCode() == Declare.BTN.IGW300_PSTN_RING_START) {
- /**
- * JEFF, 2020.01.04
- * IHN-D101 국선전화 링시작시 링이벤트를 주기적으로 발생시키는 쓰레드
- * IGW-300은 국선전화 링의 시작과 끝만 알려주므로, 통화시나리오를 처리하기에 어려움이 있다.
- * - 통화앱이 종료되는 시점에 링이 발생하는 경우, 국선전화 벨 안울릴 가능성 있음
- * - 국선전화 링 시작 신호를 놓치는 경우, 벨 안울림
- */
- if (mPSTNController != null) mPSTNController.sendMsgToLocalService(PSTNHANDLERMSG.RECEIVE_RING, null);
- // if (ConfigValues.DEVICE_MODELTYPE == MODEL_TYPE.IHN_D101) {
- // if (mPSTNController != null) mPSTNController.sendMsgToLocalService(PSTNHANDLERMSG.RECEIVE_RING, null);
- // }
- }
- else if (mKeyEvent.getKeyCode() == Declare.BTN.IGW300_PSTN_RING_END) {
- if (mPSTNController != null) mPSTNController.sendMsgToLocalService(PSTNHANDLERMSG.RECEIVE_RING_END, null);
- }
- else if (mKeyEvent.getKeyCode() == Declare.BTN.PSTN_RING_V40) {
- if (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40 || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
- if (mPSTNController != null) mPSTNController.sendMsgToLocalService(PSTNHANDLERMSG.RECEIVE_RING, null);
- }
- }
- }
- else if (strAction.equals(define.NOTIFY_ACNAME)) {
- int kind = intent.getIntExtra(define.NOTIBR_KIND,0);
- if (kind == define.NOTIFY_FINISH_FRONT_DINGDONG) {
- // 메인 App으로 부터 띵똥 종료 BR 수신 받을 경우 현관 호출음 재생
- sendHandlerMsgDelayed(HANDLERMSG.PLAY_FRONT_BELL, 0, 0, 200);
- sendHandlerMsgDelayed(HANDLERMSG.SET_TALK_BTN_ENABLE, 0, 0, 200);
- }
- }
- else if (strAction.equals(Declare.BR.BR_SHOW_REMOTEVIEW_TRUE)) {
- mCallController.onShowRemoteVideo(true);
- }
- else if (strAction.equals(Declare.BR.BR_SHOW_REMOTEVIEW_FALSE)) {
- mCallController.onShowRemoteVideo(false);
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(this.TAG, "[Exception] onReceive(Context context, Intent intent)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- };
- private void registerBRReceiver() {
- try {
- LOG_INFO("[registerBRReceiver] ========== START ==========");
- IntentFilter mIntentFilter = new IntentFilter();
- mIntentFilter.addAction(Declare.BR.APP_FINISH);
- mIntentFilter.addAction(Declare.BR.WALLPAD_ALERT);
- mIntentFilter.addAction(Declare.BR.EVENT_DEVICE_CONTROL);
- mIntentFilter.addAction(define.NOTIFY_ACNAME);
- mIntentFilter.addAction(Declare.BR.VISITOR_REMOTE_CALL);
- mIntentFilter.addAction(Declare.BR.BR_SHOW_REMOTEVIEW_TRUE);
- mIntentFilter.addAction(Declare.BR.BR_SHOW_REMOTEVIEW_FALSE);
- registerReceiver(mMainExtraEventReceiver, mIntentFilter, null, null);
- mIntentFilter = new IntentFilter();
- mIntentFilter.addAction("MENU_EVENT");
- registerReceiver(mWallPadAlertBR, mIntentFilter);
- mIntentFilter = new IntentFilter();
- mIntentFilter.addAction(define.NOTIFY_DAIL);
- mIntentFilter.addAction("WALLPAD_DIAL_GLOBALSCREEN_TOUCH");
- registerReceiver(mWallPadJogBR, mIntentFilter);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] registerBRReceiver()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private void unregisterBRReceiver() {
- try {
- LOG_INFO("[unregisterBRReceiver] ========== START ==========");
- unregisterReceiver(mMainExtraEventReceiver);
- unregisterReceiver(mWallPadAlertBR);
- unregisterReceiver(mWallPadJogBR);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] unregisterBRReceiver()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private void registerWallPadCallLiveBRReceiver() {
- try {
- LOG_INFO("[registerWallPadCallLiveBRReceiver] ========== START ==========");
- IntentFilter mIntentFilter = new IntentFilter();
- mIntentFilter.addAction(Declare.BR.BR_REQUEST_WALLPADCALL_LIVE);
- registerReceiver(WallPadCallLiveBRCheck, mIntentFilter);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] registerWallPadCallLiveBRReceiver()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private void unregisterWallPadCallLiveBRReceiver() {
- try {
- LOG_INFO("[unregisterBRReceiver] ========== START ==========");
- unregisterReceiver(WallPadCallLiveBRCheck);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] unregisterWallPadCallLiveBRReceiver()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /**
- * 부재중 방문자 사진을 단지서버에 전송할때
- * 해당 BR을 전송하여 메인App에서 방문자 사진의 전송을 처리한다.
- * 통화 App이 종료되는 시간 안에 전송을 완료하기 어려움
- */
- public void sendBRMissedVisitorPicture(String strDong, String strHo, String[] strMissedCallPicURI) {
- try {
- Log.i(TAG, "[sendBRMissedVisitorPicture] strDong [" + strDong + "], strHo [" + strHo + "], strMissedCallPicURI.length [" + strMissedCallPicURI.length + "]");
- Intent mIntent = new Intent();
- mIntent.setAction(ACNAME_MAIN_NOTI);
- mIntent.putExtra(KIND, Declare.BR.REQ_UPLOAD_MISSEDVISITORPIC);
- mIntent.putExtra("DONG", strDong);
- mIntent.putExtra("HO", strHo);
- mIntent.putExtra("CNT", strMissedCallPicURI.length);
- for (int i = 0; i < strMissedCallPicURI.length; i++) {
- Log.i(TAG, "[sendBRMissedVisitorPicture] strMissedCallPicURI[" + i + "] = [" + strMissedCallPicURI[i] + "]");
- mIntent.putExtra("URI_" + i, strMissedCallPicURI[i]);
- }
- getContext().sendBroadcast(mIntent);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] sendBRMissedVisitorPicture(String strDong, String strHo, String[] strMissedCallPicURI)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- boolean bFinishing = false;
- public void finishWallPadCall() {
- try {
- LOG("[finishWallPadCall] bFinishing [" + bFinishing + "]");
- if (bFinishing) {
- return;
- }
- bFinishing = true;
- sendBlockSIPCallBR();
- notifyCallAppFinish();
- if (sdbLivingRoomLightAPI != null) {
- Log.d(TAG, "[finishWallPadCall] sdbLivingRoomLightAPI.SetWifiModuleOnOff [TRUE]");
- sdbLivingRoomLightAPI.SetWifiModuleOnOff(true);
- sdbLivingRoomLightAPI = null;
- }
- Global.stopMelodyRepeat();
- Global.ctrlLCDOnOff(false);
- if (ConfigValues.eWallPadType == WALLPADTYPE.MAIN) {
- /**
- * 아래와 같은 증상으로 인해 주석처리 함 (JEFF, 2020.04.02)
- * 1. 국선 호출수신/통화중 홈버튼 눌러서 종료되는 경우 hook on, hook off가 반복되는 증상
- * - 내선 전화 사용시 플래시 효과가 되어 버림
- * 2. 국선 통화중 홈버튼 눌러서 종료시 PSTN 릴레이 딸각하는 소리가 두번 들림
- */
- // if (ConfigValues.bPSTNEnable) {
- // mPSTNController.sendReject();
- // mPSTNController.sendHookOffDelay();
- // }
- }
- else {
- if (ConfigValues.eSubWallPadPSTNType == SUBWALLPAD_PSTNTYPE.DIRECT) {
- mPSTNController.sendReject();
- mPSTNController.sendHookOffDelay();
- }
- }
- ctrlSmartIOTCamStatusMode(SmartRFCamStatusMode.STATUS_OFF);
- ctrlSmartIOTCamLEDMode(SmartRFCamLEDMode.LED_OFF);
- // if (mIOInterface != null) {
- // mIOInterface.releaseIOInterface();
- // mIOInterface = null;
- // }
- sendHandlerMsgDelayed(HANDLERMSG.FINISH_ACTIVITY, 0, 0, 500);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] finishWallPadCall()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public void finishActivity() {
- try {
- LOG_INFO("[finishActivity]");
- super.finish();
- // setCallAppRunning(false);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] finishActivity()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /**
- * 통화 앱 실행 여부 판별 임시 코드
- */
- public void setCallAppRunning(boolean bRunning) {
- try {
- 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)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public boolean getCallAppRunning() {
- boolean bRunning = false;
- try {
- WallpadStatusData DBMGR = new WallpadStatusData(getApplicationContext());
- bRunning = DBMGR.GetCallAPKStatusRunning();
- DBMGR.closeDB();
- Log.i(TAG, "[getCallAppRunning] bRunning [" + bRunning + "]");
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getCallAppRunning()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- return bRunning;
- }
- /**
- * 통화 앱 꼬임시 임시 보완 코드
- */
- public void killCallProcess() {
- try {
- LOG_INFO("[killCallProcess]");
- finishWallPadCall();
- int pid = android.os.Process.myPid();
- android.os.Process.killProcess(pid);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] killCallProcess()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /** 메모리 체크 코드 **/
- public void checkMemoryUsage() {
- try {
- Runtime.getRuntime().gc();
- long totalMem = Runtime.getRuntime().totalMemory();
- long freeMem = Runtime.getRuntime().freeMemory();
- long usedMem = totalMem - freeMem;
- Log.e(TAG, "**************** [checkMemoryUsage] *************");
- Log.e(TAG, "************ TOTAL MEM : " + totalMem + " bytes ***********");
- Log.e(TAG, "************ FREE MEM : " + freeMem + " bytes ***********");
- Log.e(TAG, "************ USED MEM : " + usedMem + " bytes ***********");
- Log.e(TAG, "*************************************************");
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] checkMemoryUsage()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private void sendWallPadCallLiveBR_ACK() {
- try {
- // Log.i(TAG, "[sendWallPadCallLiveBR_ACK] ===== START =====");
- Intent mIntent = new Intent();
- mIntent.setAction(Declare.BR.BR_ACK_WALLPADCALL_LIVE);
- mIntent.putExtra("WALLPADCALL_VIEW", mCurrentScreenId);
- getApplicationContext().sendBroadcast(mIntent);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] sendWallPadCallLiveBR_ACK()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- BroadcastReceiver WallPadCallLiveBRCheck = new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- try {
- String strActionName = intent.getAction();
- // Log.d(TAG,"[WallPadCallLiveBRCheck] strActionName [" + strActionName + "]");
- if (strActionName.equals(Declare.BR.BR_REQUEST_WALLPADCALL_LIVE)) {
- // Log.e(TAG,"[WallPadCallLiveBRCheck] Common.BR_ACK_WALLPADCALL_LIVE");
- sendWallPadCallLiveBR_ACK();
- }
- else {
- Log.w(TAG,"[WallPadCallLiveBRCheck] Not supported strActionName [" + strActionName + "]");
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] BroadcastReceiver -> WallPadCallLiveBRCheck");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- };
- private void sendBlockSIPCallBR() {
- try {
- Log.i(TAG, "[sendBlockSIPCallBR] ===== START =====");
- Intent mIntent = new Intent();
- mIntent.setAction(Declare.BR.BR_BLOCK_SIPCALL);
- getApplicationContext().sendBroadcast(mIntent);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] sendBlockSIPCallBR()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /**
- * Sound PlayMent 시험용 코드 (JEFF, 2020.03.09)
- */
- private static MediaPlayer mMentMediaPlayer = null;
- private static final String SOUND_PATH_ROOT = "/system/media/audio/wallpad/";
- @SuppressLint("HandlerLeak")
- public static int PlayMent_JeffTest(int SND_index) {
- FileInputStream fileInputStream = null;
- try {
- StopMent();
- String filepath = getFilePath(SND_index);
- if (filepath == null) {
- Log.e(TAG, "[PlayMent_JeffTest] - SND_index Not Found FilePath !!! (" + SND_index + ")");
- return -1;
- }
- Log.i(TAG, "[PlayMent_JeffTest] - filepath [" + filepath + "]");
- mMentMediaPlayer = new MediaPlayer();
- fileInputStream = null;
- try {
- fileInputStream = new FileInputStream(filepath);
- FileDescriptor fileDescriptor = fileInputStream.getFD();
- mMentMediaPlayer.setDataSource(fileDescriptor);
- // mMentMediaPlayer.setDataSource(filepath);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG,re);
- return -2;
- } catch (Exception e) {
- Log.e(TAG, "[ExceptionError] - PlayMent_JeffTest->setDataSource : " + e);
- return -2;
- }
- finally {
- if(fileInputStream!=null)
- fileInputStream.close();
- fileInputStream = null;
- }
- try {
- mMentMediaPlayer.prepare();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -3;
- } catch (Exception e) {
- Log.e(TAG, "[ExceptionError] - PlayMent_JeffTest->prepare : " + e);
- return -3;
- }
- float PlayVolume = getPlayVolume(AudioManager.STREAM_MUSIC);
- if(PlayVolume < 0) PlayVolume = 1;
- mMentMediaPlayer.setVolume(PlayVolume, PlayVolume);
- mMentMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
- try {
- mMentMediaPlayer.start();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -4;
- } catch (Exception e) {
- Log.e(TAG, "[ExceptionError] - PlayMent_JeffTest->start : " + e);
- return -4;
- }
- return mMentMediaPlayer.getDuration();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -5;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] PlayMent_JeffTest(int SND_index, int volume_kind)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -5;
- }
- }
- public static int PlayMent_JeffTest2(int SND_index) {
- try {
- StopMent();
- String filepath = getFilePath(SND_index);
- if (filepath == null) {
- Log.e(TAG, "[PlayMent_JeffTest] - SND_index Not Found FilePath !!! (" + SND_index + ")");
- return -1;
- }
- Log.i(TAG, "[PlayMent_JeffTest] - filepath [" + filepath + "]");
- mMentMediaPlayer = new MediaPlayer();
- mMentMediaPlayer.setDataSource(filepath);
- mMentMediaPlayer.prepare();
- mMentMediaPlayer.start();
- // mMentMediaPlayer = new MediaPlayer();
- // FileInputStream fileInputStream = null;
- // try {
- // fileInputStream = new FileInputStream(filepath);
- // FileDescriptor fileDescriptor = fileInputStream.getFD();
- // mMentMediaPlayer.setDataSource(fileDescriptor);
- // fileInputStream.close();
- //
- //// mMentMediaPlayer.setDataSource(filepath);
- // } catch (Exception e) {
- // Log.e(TAG, "[ExceptionError] - PlayMent_JeffTest->setDataSource : " + e);
- // return -2;
- // }
- //
- // try {
- // mMentMediaPlayer.prepare();
- // } catch (Exception e) {
- // Log.e(TAG, "[ExceptionError] - PlayMent_JeffTest->prepare : " + e);
- // return -3;
- // }
- //
- // float PlayVolume = getPlayVolume(AudioManager.STREAM_MUSIC);
- // if(PlayVolume < 0) PlayVolume = 1;
- //
- // mMentMediaPlayer.setVolume(PlayVolume, PlayVolume);
- // mMentMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
- // try {
- // mMentMediaPlayer.start();
- // } catch (RuntimeException re) {
- // LogUtil.errorLogInfo("", TAG, re);
- // } catch (Exception e) {
- // Log.e(TAG, "[ExceptionError] - PlayMent_JeffTest->start : " + e);
- // return -4;
- // }
- return mMentMediaPlayer.getDuration();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -5;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] PlayMent_JeffTest(int SND_index, int volume_kind)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -5;
- }
- }
- public static boolean StopMent() {
- if (mMentMediaPlayer == null) return false;
- mMentMediaPlayer.stop();
- mMentMediaPlayer.release();
- mMentMediaPlayer = null;
- return true;
- }
- /**
- * 사운드파일 상수(SND)로 하여 실제 사운드파일 Path 를 리턴한다.<br>
- * 내부메소드<br>
- *
- * @param index - 사운드 INDEX ({@link SND})
- * @return null 일경우 잘못된 index , null 이 아닐경우 FilePath
- */
- private static String getFilePath(int index) {
- String FileName = null;
- switch (index) {
- // [number]
- case SND.number.NUM0: FileName = "number/0.wav"; break;
- case SND.number.NUM1: FileName = "number/1.wav"; break;
- case SND.number.NUM2: FileName = "number/2.wav"; break;
- case SND.number.NUM3: FileName = "number/3.wav"; break;
- case SND.number.NUM4: FileName = "number/4.wav"; break;
- case SND.number.NUM5: FileName = "number/5.wav"; break;
- case SND.number.NUM6: FileName = "number/6.wav"; break;
- case SND.number.NUM7: FileName = "number/7.wav"; break;
- case SND.number.NUM8: FileName = "number/8.wav"; break;
- case SND.number.NUM9: FileName = "number/9.wav"; break;
- // [effect]
- case SND.effect.BUTTON: FileName = "effect/button.wav"; break;
- case SND.effect.TOUCH_LATCHED: FileName = "effect/touch-latched.wav"; break;
- case SND.effect.TOUCH_UNLATCHED: FileName = "effect/touch-unlatched.wav"; break;
- case SND.effect.EFFECT1: FileName = "effect/effect1.wav"; break;
- case SND.effect.END_2_MONO: FileName = "effect/end_2_mono.wav"; break;
- case SND.effect.WARNING005: FileName = "effect/Warning005.wav"; break;
- // [setting]
- case SND.setting.DONG: FileName = "setting/dong.wav"; break;
- case SND.setting.HO: FileName = "setting/ho.wav"; break;
- case SND.setting.HOUR: FileName = "setting/Hour.wav"; break;
- case SND.setting.MINUTE: FileName = "setting/Minute.wav"; break;
- case SND.setting.SETTING: FileName = "setting/Setting.wav"; break;
- case SND.setting.RETRY_ACTION: FileName = "setting/RetryAction.wav"; break;
- case SND.setting.RETRY_INPUT: FileName = "setting/RetryInput.wav"; break;
- // [bell]
- case SND.bell.FRONT: FileName = "bell/Bell_Front.wav"; break;
- case SND.bell.GUARDROOM: FileName = "bell/Bell_GuardRoom.wav"; break;
- case SND.bell.LOBBY: FileName = "bell/Bell_Lobby.wav"; break;
- case SND.bell.NEIGHBOOR: FileName = "bell/Bell_Neighboor.wav"; break;
- case SND.bell.PSTN: FileName = "bell/Bell_Pstn.wav"; break;
- case SND.bell.ALRAM: FileName = "bell/Alram.wav"; break;
- case SND.bell.MONINGCALL_01: FileName = "bell/MoningCall01.wav"; break;
- case SND.bell.MONINGCALL_02: FileName = "bell/MoningCall02.wav"; break;
- case SND.bell.MONINGCALL_03: FileName = "bell/MoningCall03.wav"; break;
- // [call]
- case SND.call.CALL_VOIP: FileName = "call/callVOIP.wav"; break;
- case SND.call.CALLSTART: FileName = "call/CallStart.wav"; break;
- case SND.call.DINGDONG: FileName = "call/DingDong.wav"; break;
- case SND.call.FRONTCALL: FileName = "call/FrontCallSound.wav"; break;
- case SND.call.RING_BUSY: FileName = "call/RingBusy.wav"; break;
- case SND.call.CONNECT_SUBPHONE: FileName = "call/ConnectSubPhone.wav"; break;
- case SND.call.RECEIVE_CALL: FileName = "call/MoipCallReceiveSound.wav"; break;
- case SND.call.SEND_CALL: FileName = "call/MoipCallSendSound.wav"; break;
- case SND.call.BUSY_TRY_LATER: FileName = "call/BusyTryLater.wav"; break;
- // [elevator]
- case SND.elevator.CALL: FileName = "elevator/CallElevator.wav"; break;
- case SND.elevator.DN_ARRIVED: FileName = "elevator/ElevatorArrived.wav"; break;
- case SND.elevator.UP_ARRIVED: FileName = "elevator/MoveUp.wav"; break;
- case SND.elevator.ORG_ARRIVED: FileName = "elevator/ORG_ElevatorArrived.wav"; break;
- // [emergency]
- case SND.emergency.DEFAULT: FileName = "emergency/Emergency.wav"; break;
- case SND.emergency.ALARM: FileName = "emergency/EmergencyAram.wav"; break;
- case SND.emergency.INVASION: FileName = "emergency/EmergencyInvasion.wav"; break;
- case SND.emergency.RELEASE_COMEBACK:FileName = "emergency/EmergencyRelease_Comeback.wav"; break;
- case SND.emergency.COMEBACK: FileName = "emergency/Comeback_Emergency.wav"; break;
- case SND.emergency.SIRLEN1: FileName = "emergency/sirlen1.wav"; break;
- case SND.emergency.STOP_SIREN: FileName = "emergency/StopSiren.wav"; break;
- case SND.emergency.SILENT: FileName = "emergency/silent.wav"; break;
- // [mode]
- case SND.mode.NORMALMODE_COMEBACK: FileName = "mode/NormalModeComeback.wav"; break;
- case SND.mode.HOME_DEVICE_CHECK: FileName = "mode/HomeDeviceCheck.wav"; break;
- case SND.mode.INMODE_SETTING: FileName = "mode/InModeSetting.wav"; break;
- case SND.mode.OUTMODE_SETTING: FileName = "mode/OutModeSetting.wav"; break;
- case SND.mode.OUTMODE_SETTING_LOW: FileName = "mode/OutModeSetting_low.wav"; break;
- case SND.mode.SENSOR_INVASION: FileName = "mode/SensorInvasion.wav"; break;
- case SND.mode.SENSORMOTION_RELEASE: FileName = "mode/SensorMotion_Release.wav"; break;
- case SND.mode.START_2_MONO: FileName = "mode/start_2_mono.wav"; break;
- case SND.mode.VISITOR_OUTMODERUN: FileName = "mode/Visitor_OutModeRun.wav"; break;
- case SND.mode.CAR_ARRIVED: FileName = "mode/ArrivedCar.wav"; break;
- case SND.mode.BOX_ARRIVED: FileName = "mode/BoxArrived.wav"; break;
- case SND.mode.OPENDOOR: FileName = "mode/OpenDoor.wav"; break;
- // [ars_ment]
- case SND.ars_ment.ARS1_1: FileName = "ars_ment/ARS1_1.wav"; break;
- case SND.ars_ment.ARS1_2: FileName = "ars_ment/ARS1_2.wav"; break;
- case SND.ars_ment.ARS1_3: FileName = "ars_ment/ARS1_3.wav"; break;
- case SND.ars_ment.ARS1_4: FileName = "ars_ment/ARS1_4.wav"; break;
- case SND.ars_ment.ARS2_3: FileName = "ars_ment/ARS2_3.wav"; break;
- case SND.ars_ment.ARS2_3_NOLIGHT: FileName = "ars_ment/ARS2_3_NoLight.wav"; break;
- case SND.ars_ment.ARS3_3: FileName = "ars_ment/ARS3_3.wav"; break;
- case SND.ars_ment.ARS3_4: FileName = "ars_ment/ARS3_4.wav"; break;
- case SND.ars_ment.ARS3_6: FileName = "ars_ment/ARS3_6.wav"; break;
- case SND.ars_ment.ARS4_1: FileName = "ars_ment/ARS4_1.wav"; break;
- case SND.ars_ment.ARS4_3: FileName = "ars_ment/ARS4_3.wav"; break;
- case SND.ars_ment.ARS4_4: FileName = "ars_ment/ARS4_4.wav"; break;
- case SND.ars_ment.ARS5_1: FileName = "ars_ment/ARS5_1.wav"; break;
- case SND.ars_ment.ARS5_2: FileName = "ars_ment/ARS5_2.wav"; break;
- case SND.ars_ment.ARS6_1: FileName = "ars_ment/ARS6_1.wav"; break;
- case SND.ars_ment.ARS7_1: FileName = "ars_ment/ARS7_1.wav"; break;
- case SND.ars_ment.ARS8_1: FileName = "ars_ment/ARS8_1.wav"; break;
- case SND.ars_ment.ARS9_1: FileName = "ars_ment/ARS9_1.wav"; break;
- case SND.ars_ment.ARS9_2: FileName = "ars_ment/ARS9_2.wav"; break;
- // [lobby]
- case SND.lobby.BELL_01: FileName = "lobby/bell_01.ogg"; break;
- case SND.lobby.BELL_02: FileName = "lobby/bell_02.ogg"; break;
- case SND.lobby.BELL_03: FileName = "lobby/bell_03.ogg"; break;
- case SND.lobby.BELL_04: FileName = "lobby/bell_04.ogg"; break;
- case SND.lobby.BELL_05: FileName = "lobby/bell_05.ogg"; break;
- case SND.lobby.BELL_06: FileName = "lobby/bell_06.ogg"; break;
- case SND.lobby.BOOTING: FileName = "lobby/booting.ogg"; break;
- case SND.lobby.BUSYTRYLATER: FileName = "lobby/busytrylater.ogg"; break;
- case SND.lobby.BUTTON: FileName = "lobby/button.ogg"; break;
- case SND.lobby.CALLED: FileName = "lobby/callend.ogg"; break;
- case SND.lobby.CALLSTART: FileName = "lobby/callstart.ogg"; break;
- case SND.lobby.CONFIRMSETTING: FileName = "lobby/confirmsetting.ogg"; break;
- case SND.lobby.DOOROPEN: FileName = "lobby/dooropen.ogg"; break;
- case SND.lobby.INPUTFAIL: FileName = "lobby/inputfail.ogg"; break;
- case SND.lobby.PACKAGEARRIVED: FileName = "lobby/packagearrived.ogg"; break;
- case SND.lobby.RESULTOK: FileName = "lobby/resultok.ogg"; break;
- case SND.lobby.RETRYINPUT: FileName = "lobby/retryinput.ogg"; break;
- case SND.lobby.SETTING: FileName = "lobby/setting.ogg"; break;
- case SND.lobby.TRYLATER: FileName = "lobby/trylater.ogg"; break;
- // [guard]
- case SND.guard.BELL_01: FileName = "guard/bell_01.ogg"; break;
- case SND.guard.BELL_02: FileName = "guard/bell_02.ogg"; break;
- case SND.guard.BELL_03: FileName = "guard/bell_03.ogg"; break;
- case SND.guard.BELL_04: FileName = "guard/bell_04.ogg"; break;
- case SND.guard.BELL_05: FileName = "guard/bell_05.ogg"; break;
- case SND.guard.BELL_06: FileName = "guard/bell_06.ogg"; break;
- case SND.guard.BOOTING: FileName = "guard/booting.ogg"; break;
- case SND.guard.BREAK: FileName = "guard/break.ogg"; break;
- case SND.guard.BUSYTRYLATER: FileName = "guard/busytrylater.ogg"; break;
- case SND.guard.BUTTON: FileName = "guard/button.ogg"; break;
- case SND.guard.CALLEND: FileName = "guard/callend.ogg"; break;
- case SND.guard.CALLRECEIVED: FileName = "guard/callreceived.ogg"; break;
- case SND.guard.CALLSTART: FileName = "guard/callstart.ogg"; break;
- case SND.guard.CONFIRMSETTING: FileName = "guard/confirmsetting.ogg"; break;
- case SND.guard.DOOROPEN: FileName = "guard/dooropen.ogg"; break;
- case SND.guard.EMER_COM: FileName = "guard/emer_com.ogg"; break;
- case SND.guard.EMERGENCY: FileName = "guard/emergency.ogg"; break;
- case SND.guard.FIRE: FileName = "guard/fire.ogg"; break;
- case SND.guard.GAS: FileName = "guard/gas.ogg"; break;
- case SND.guard.INPUTFAIL: FileName = "guard/inputfail.ogg"; break;
- case SND.guard.PACKAGEARRIVED: FileName = "guard/packagearrived.ogg"; break;
- case SND.guard.RELEASE: FileName = "guard/release.ogg"; break;
- case SND.guard.RESULTOK: FileName = "guard/resultok.ogg"; break;
- case SND.guard.RETRYINPUT: FileName = "guard/retryinput.ogg"; break;
- case SND.guard.SETTING: FileName = "guard/setting.ogg"; break;
- case SND.guard.TRYLATER: FileName = "guard/trylater.ogg"; break;
- case SND.guard.NOSOUND: FileName = "guard/no_sound.ogg"; break;
- default:
- Log.e(TAG, "[Error] getFileName - Index Not Found!!! (" + index + ")");
- break;
- }
- if (FileName == null) return null;
- Log.e(TAG, "[getFileName] Filepath (" + SOUND_PATH_ROOT + FileName + ")");
- return (String)(SOUND_PATH_ROOT + FileName);
- }
- /**
- * 사운드 출력할 볼륨 레벨을 정의한다.
- */
- public static final class VOLUME_KIND {
- /**
- * 안드로이드에서 제공하는 기본 볼륨 음량 테이블을 정의한다.
- */
- public static final class stream {
- /**
- * 알람 음량
- */
- public final static int ALARM = AudioManager.STREAM_ALARM;
- /**
- * DTMP 출력시 음량
- */
- public final static int DTMF = AudioManager.STREAM_DTMF;
- /**
- * 음악, 동영상, 게임 및 기타 미디어 재생 음량
- */
- public final static int MUSIC = AudioManager.STREAM_MUSIC;
- /**
- * 알림 음량
- */
- public final static int NOTIFICATION = AudioManager.STREAM_NOTIFICATION;
- /**
- * 벨소리 음량
- */
- public final static int RING = AudioManager.STREAM_RING;
- /**
- * 시스템 음량
- */
- public final static int SYSTEM = AudioManager.STREAM_SYSTEM;
- /**
- * 통화 대기음 음량
- */
- public final static int VOICE_CALL = AudioManager.STREAM_VOICE_CALL;
- }
- /**
- * 고정된 볼륨을 정의한다. ( MUTE포함 총 15단계)
- */
- public static final class fixed {
- /**
- * BASE 상수 (※ 사용하지 않는다. MUTE와 동일)
- */
- public final static int BASE = 100;
- /**
- * MUTE
- */
- public final static int MUTE = BASE + 0;
- public final static int LEV0 = BASE + 0;
- public final static int LEV1 = BASE + 1;
- public final static int LEV2 = BASE + 2;
- public final static int LEV3 = BASE + 3;
- public final static int LEV4 = BASE + 4;
- public final static int LEV5 = BASE + 5;
- public final static int LEV6 = BASE + 6;
- public final static int LEV7 = BASE + 7;
- public final static int LEV8 = BASE + 8;
- public final static int LEV9 = BASE + 9;
- public final static int LEV10 = BASE + 10;
- public final static int LEV11 = BASE + 11;
- public final static int LEV12 = BASE + 12;
- public final static int LEV13 = BASE + 13;
- public final static int LEV14 = BASE + 14;
- public final static int LEV15 = BASE + 15;
- /**
- * MAX
- */
- public final static int MAX = LEV15;
- }
- }
- /**
- * VOLUME_KIND 값에서 Play 시 사용할 Volume 값을 가져온다. <br>
- *
- * @param volume_kind - 재생시킬 볼륨 ({@link VOLUME_KIND} 참조)
- *
- * @return -1 : volume_kind Out of range , 0f ~ 1f : Play 용 볼륨값
- */
- private static float getPlayVolume(int volume_kind) {
- if (mAudioManager == null) return -1;
- // 1. 범위체크
- int streamNfixed = -1; // 1 : stream , 2 : fixed
- switch (volume_kind) {
- case VOLUME_KIND.stream.ALARM:
- case VOLUME_KIND.stream.DTMF:
- case VOLUME_KIND.stream.MUSIC:
- case VOLUME_KIND.stream.NOTIFICATION:
- case VOLUME_KIND.stream.RING:
- case VOLUME_KIND.stream.SYSTEM:
- case VOLUME_KIND.stream.VOICE_CALL:
- streamNfixed = 1;
- break;
- default:
- if ((volume_kind >= VOLUME_KIND.fixed.LEV0) && (volume_kind <= VOLUME_KIND.fixed.LEV15)) {
- streamNfixed = 2;
- }
- break;
- }
- if (streamNfixed == -1) {
- Log.e(TAG, "[getVolume] Parameters - volume_kind Out of range !!! (" + volume_kind + ")");
- return -1;
- }
- // 2. 볼륨값 계산
- float calcVolume = -1;
- if (streamNfixed == 1) {
- float nowVolume = (float)mAudioManager.getStreamVolume(volume_kind);
- float maxVolume = (float)mAudioManager.getStreamMaxVolume(volume_kind);
- calcVolume = nowVolume / maxVolume;
- //Log.d(TAG, "[getVolume] kind=stream(" + volume_kind + ")" + " nowVolume : " + nowVolume + " / maxVolume : " + maxVolume + " / calcVolume : " + calcVolume);
- }
- else if (streamNfixed == 2) {
- float fixedVolume = (float) volume_kind - VOLUME_KIND.fixed.BASE;
- float maxVolume = (float) VOLUME_KIND.fixed.MAX - VOLUME_KIND.fixed.BASE;
- calcVolume = fixedVolume / maxVolume;
- //Log.d(TAG, "[getVolume] kind=fixed(" + volume_kind + ")" + " fixedVolume : " + fixedVolume + " / maxVolume : " + maxVolume + " / calcVolume : " + calcVolume);
- }
- return calcVolume;
- }
- public void sendSoundPlayRequestBR(int nSoundID) {
- try {
- Intent intent = new Intent();
- intent.setAction(define.NOTIFY_ACNAME);
- intent.putExtra(define.NOTIBR_KIND, define.NOTIFY_PLAYMENT);
- intent.putExtra(define.NOTIBR_CONTENT, nSoundID);
- getContext().sendBroadcast(intent);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] sendSoundPlayRequestBR(int nSoundID)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public void setEncodingStopError() {
- try {
- LOG("[setEncodingStopError]");
- WallpadStatusData data = new WallpadStatusData(mContext);
- data.SetCameraEncodingError(true);
- data.closeDB();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] setEncodingStopError()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public void checkEncodingStopError() {
- try {
- WallpadStatusData DBMGR = new WallpadStatusData(getContext());
- boolean bError = DBMGR.GetCameraEncodingError();
- LOG("[checkEncodingStopError] bError [" + bError + "]");
- if (bError) {
- if (mCallController.mVideoJNI != null) {
- LOG_WARN("[checkEncodingStopError] mCallController.mVideoJNI.encoderStopOperation()");
- mCallController.mVideoJNI.encoderStopOperation();
- }
- DBMGR.SetCameraEncodingError(false);
- LOG("[checkEncodingStopError] GetCameraEncodingError [" + DBMGR.GetCameraEncodingError() + "]");
- }
- DBMGR.closeDB();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] checkEncodingStopError()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public static int nResidentSafetyCheckSetting = WallpadDeviceSet.RESIDENT_SAFETY_CHECK_DISABLE;
- private void getResidentSafetyCheckSetting() {
- try {
- WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(getApplicationContext());
- nResidentSafetyCheckSetting = mWallpadDeviceSet.getResidentSafetyCheck();
- mWallpadDeviceSet.closeDB();
- Log.e(TAG, "[getResidentSafetyCheckSetting] nResidentSafetyCheckSetting: " + nResidentSafetyCheckSetting);
- if (nResidentSafetyCheckSetting == WallpadDeviceSet.RESIDENT_SAFETY_CHECK_ENABLE) Version.setResidentSafety();
- else Version.unsetResidentSafety();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getResidentSafetyCheckSetting()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /**
- * 도어락에 열림 명령을 내린다.
- *
- * @return (int) - >=0 : 성공, <0 : 실패
- */
- public int Device_DoorOpen(final int address) {
- Log.d("TAG", "[Device_DoorOpen] - Start");
- final ModbusClient modbusClient = new ModbusClient("10.0.215.2", 502);
- modbusClient.setConnectionTimeout(5000);
- try {
- new Thread() {
- public void run() {
- try {
- modbusClient.Connect();
- modbusClient.WriteSingleCoil(address, true);
- Thread.sleep(2000);
- modbusClient.WriteSingleCoil(address, false);
- modbusClient.Disconnect();
- } catch (IOException | ModbusException | InterruptedException e) {
- e.printStackTrace();
- try {
- modbusClient.Disconnect();
- } catch (IOException ioException) {
- ioException.printStackTrace();
- }
- }
- }
- }.start();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -102;
- } catch (Exception e) {
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -102;
- }
- Log.d("TAG", "[Device_DoorOpen] - OK");
- return 0;
- }
- }
|