123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255 |
- package kr.co.icontrols.wallpadcall.declare;
- import android.content.Context;
- import android.content.Intent;
- import android.media.AudioManager;
- import android.os.Build;
- import android.provider.Settings;
- import android.util.Log;
- import android.view.WindowManager;
- import com.artncore.WallPadDataMgr.WallpadDeviceSet;
- import com.artncore.WallPadDataMgr.WallpadSalesSampleData;
- import com.artncore.WallPadDataMgr.WallpadStatusData;
- import com.artncore.WallPadDataMgr.wallpaddbmgr;
- import com.artncore.WallPadDataMgr.wallpaddbmgr.AddressSet;
- import com.artncore.commons.define;
- import com.util.LogUtil;
- import java.io.BufferedReader;
- import java.io.File;
- import java.io.FilenameFilter;
- import java.io.InputStreamReader;
- import java.net.InetAddress;
- import java.net.NetworkInterface;
- import java.text.SimpleDateFormat;
- import java.util.ArrayList;
- import java.util.Collections;
- import java.util.Date;
- import java.util.List;
- import java.util.regex.Pattern;
- import bssoft.stack.sip.SIPStack;
- import kr.co.icontrols.callengine.engine.CallManager.CALLOWNER;
- import kr.co.icontrols.callengine.engine.CallManager.CALLTYPE;
- import kr.co.icontrols.callengine.engine.MissedCallVisitorPicture;
- import kr.co.icontrols.callengine.subphone.SubPhoneCmds;
- import kr.co.icontrols.wallpadcall.MainActivity;
- import kr.co.icontrols.wallpadcall.declare.DataClasses.CallHistoryInfo;
- import kr.co.icontrols.wallpadcall.declare.DataClasses.CallLogUnit;
- import kr.co.icontrols.wallpadcall.declare.DataClasses.GuardListTable;
- import kr.co.icontrols.wallpadcall.declare.DataClasses.RemoteIDInfo;
- import kr.co.icontrols.wallpadcall.declare.Declare.DEVICENAME;
- import kr.co.icontrols.wallpadcall.declare.Declare.DeviceType;
- import kr.co.icontrols.wallpadcall.declare.Enumeration.TARGETINFOINPUTSTEP;
- import kr.co.icontrols.wallpadsupport.Version;
- import kr.co.icontrols.wallpadsupport.Version.MODEL_TYPE;
- import kr.co.icontrols.wallpadsupport.WpadSound.SND;
- import static android.provider.Settings.System.SCREEN_OFF_TIMEOUT;
- public final class Global {
- // 로비폰에서 공통으로 사용하는 함수 및 변수를 정의합니다.
- static final String TAG = "Global";
- static boolean bLOG = true;
- private static void LOG(String log) {
- if (bLOG) Log.v(TAG, log);
- }
- static boolean bLOG_DEBUG = true;
- private static void LOG_DEBUG(String log) {
- if (bLOG_DEBUG) Log.d(TAG, log);
- }
- static boolean bLOG_INFO = true;
- private static void LOG_INFO(String log) {
- if (bLOG_INFO) Log.i(TAG, log);
- }
- static boolean bLOG_WARN = true;
- private static void LOG_WARN(String log) {
- if (bLOG_WARN) Log.w(TAG, log);
- }
- static Context mContext;
- public static boolean bEnableDeviceInput = false; // 부팅이 완료되기 전까지 모든 입력(버튼, 시리얼, iMAP)을 차단하기 위한 변수
- public static boolean bEnablePSTN = false; // 부팅이 완료되기 전까지 모든 입력(버튼, 시리얼, iMAP)을 차단하기 위한 변수
- // public static boolean bFrontMonitoring = false; // 현관탭을 눌러 현관통화화면 진입시, 현관 모니터링 시작을 위한 변수
- public static boolean bEnablePSTN_SubWallPad = false;
- // public static boolean bFrontMonitoring_SubWallPad = false;
- public static String strDongInfo = "";
- public static String strHoInfo = "";
- // Context 전달
- public static boolean setGlobalContext(Context context) {
- try {
- mContext = context;
- return true;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] setGlobalContext(context) " + e);
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- public static int nCurrentScreenID = 0; // 현재 ScreenID를 저장하는 변수
- public static String strInputPW = ""; // 화면에서 입력하는 비밀번호를 저장한다.
- public static String strVisitorPictureID = ""; // 방문자 조회화면에서 방문자 사진을 확대하여 보는 경우, 해당 이미지의 ID를 뷰어 화면으로 전달한다.
- public static String[] makeDeviceName(String ipaddress) {
- String[] aDeviceName = new String[3];
- try {
- String dong = "101";
- String ho = "101";
- String type = DEVICENAME.strType_Resi;
- String[] IP_Parse = ipaddress.split("\\.");
- // Log.d(TAG, "[makeSIPID] IP_Parse.length = " + IP_Parse.length);
- // for (int i = 0; i < IP_Parse.length; i++)
- // {
- // Log.d(TAG, "IP_Parse[" + i + "] : " + IP_Parse[i]);
- // }
- dong = Integer.toString((((Integer.parseInt(getDongString()) / 100) * 100) + Integer.parseInt(IP_Parse[1])));
- if (IP_Parse[2] == "128") {
- // 경비실폰
- type = DEVICENAME.strType_Guard;
- ho = IP_Parse[3];
- } else if (IP_Parse[2] == "0") {
- // 로비폰
- type = DEVICENAME.strType_Lobby;
- ho = IP_Parse[3];
- } else {
- type = DEVICENAME.strType_Resi;
- ho = IP_Parse[2] + ZeroPadding_Head(2, IP_Parse[3]);
- }
- // Log.d(TAG, "[makeSIPID] dong = " + dong + ", ho = " + ho);
- aDeviceName[0] = type;
- aDeviceName[1] = dong;
- aDeviceName[2] = ho;
- return aDeviceName;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return aDeviceName;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getDeviceName(...) : " + e);
- return aDeviceName;
- }
- }
- public static String ZeroPadding_Head(int nOutLength, String strOriginalString) {
- String strResult = strOriginalString;
- // Log.d(TAG, "[ZeroPadding_Head] (Length) strOriginalString [" + strOriginalString.length() +"], nOutLength [" + nOutLength + "]");
- try {
- if (strOriginalString.length() < nOutLength) {
- for (int i = strOriginalString.length(); i < nOutLength; i++) {
- strResult = "0" + strResult;
- }
- // Log.d(TAG, "[ZeroPadding_Head] strResult : " + strResult);
- return strResult;
- } else if (strOriginalString.length() == nOutLength) {
- // Log.d(TAG, "[ZeroPadding_Head] same length!");
- return strResult;
- } else {
- Log.d(TAG, "[ZeroPadding_Head] strOriginalString(" + strOriginalString.length() + ") is longer than nOutLength(" + nOutLength + ")");
- return strResult;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return strResult;
- } catch (Exception e) {
- Log.e(TAG, "[ZeroPadding_Head] (Exception) ZeroPadding_Head(...) + e");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return strResult;
- }
- }
- // 사용금지 비밀번호 (해당 비밀번호를 사전에 차단한다)
- public static String[] astrBlockedPW = {" - - - - ", "0000", "1111", "2222", "3333", "4444", "5555", "6666", "7777", "8888", "9999", "1234"};
- // 관리자 메뉴의 세부설정메뉴에서 상위메뉴로 넘어갈때 이전페이지를 유지하기위해, 메뉴목록의 페이지 번호를 저장한다.
- public static int nAdminSetPageNumber = 1;
- // 동호입력단계를 저장하기위한 enum
- public static TARGETINFOINPUTSTEP TargetInputStep = TARGETINFOINPUTSTEP.DONG;
- // Byte배열을 출력하는 함수
- public static String printHexs(byte[] hdata) {
- try {
- String strResult = "";
- // Log.d(TAG, "[printHexs] hdata.length = " + hdata.length);
- for (int i = 0; i < hdata.length; i++) {
- if (i == 0) strResult += HextoString((byte) hdata[i]);
- else strResult += " " + HextoString((byte) hdata[i]);
- }
- return strResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return null;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] HextoString(hdata) : " + e);
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return null;
- }
- }
- // Byte배열을 출력하는 함수
- public static String printHexs(byte[] hdata, int nLength) {
- try {
- String strResult = "";
- int nDataLength = 0;
- if (hdata.length > nLength) nDataLength = nLength;
- else nDataLength = hdata.length;
- // Log.d(TAG, "[printHexs] nDataLength = " + nDataLength);
- for (int i = 0; i < nDataLength; i++) {
- strResult += HextoString((byte) hdata[i]) + " ";
- }
- return strResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return null;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] printHexs(hdata, nLength) : " + e);
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return null;
- }
- }
- // Byte를 String으로 변환
- public static String HextoString(byte data) {
- try {
- return String.format("%02X", data);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return null;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] HextoString(data) : " + e);
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return null;
- }
- }
- // String을 Byte배열로 변환
- public static byte[] StringToHex(String strTargetData) {
- try {
- if (strTargetData == null || strTargetData.length() == 0) {
- Log.d(TAG, "[StringToHex] strTargetData is null or it's length is 0!!");
- return null;
- }
- if ((strTargetData.length() % 2) != 0) {
- Log.d(TAG, "[StringToHex] The length of strTargetData is not even!!");
- return null;
- }
- byte[] hResult = new byte[strTargetData.length() / 2];
- for (int i = 0; i < hResult.length; i++) {
- hResult[i] = (byte) Integer.parseInt(strTargetData.substring(2 * i, 2 * i + 2), 16);
- }
- return hResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return null;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] StringToHex(TargetData) : " + e);
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return null;
- }
- }
- // Byte배열을 String으로 변환
- public static String HexToString(byte[] hTargetData) {
- try {
- if (hTargetData == null || hTargetData.length == 0) {
- Log.d(TAG, "[StringToHex] hTargetData is null or it's length is 0!!");
- return null;
- }
- StringBuffer mStringBuffer = new StringBuffer(hTargetData.length * 2);
- String strHexNum;
- for (int i = 0; i < hTargetData.length; i++) {
- strHexNum = "0" + Integer.toHexString(0xFF & hTargetData[i]).toUpperCase();
- mStringBuffer.append(strHexNum.substring(strHexNum.length() - 2));
- }
- return mStringBuffer.toString();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return null;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] HexToString(hTargetData) : " + e);
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return null;
- }
- }
- // 10진수를 Byte로 변환 ex)12 -> 0x12
- public static byte getDecToHex(String strDecNum) {
- try {
- int nDec = Integer.parseInt(strDecNum);
- byte result = 0;
- result += ((nDec / 10) << 4);
- result += (nDec % 10);
- // LOG("[getDexToHex] result [" + result + "]");
- return result;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return 0;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getDecToHex(String strDecNum)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return 0;
- }
- }
- public static byte getSignedHex(int num) {
- try {
- byte hResult = (byte) 0xFF;
- if (num >= 0) hResult = (byte) num;
- else hResult = (byte) ((byte) Math.abs(num) | (byte) 0x80);
- LOG("[getSignedHex] hResult [" + HextoString(hResult) + "]");
- return hResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return (byte) 0xFF;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getSignedHex(int num)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return (byte) 0xFF;
- }
- }
- // LCD Backlight Control
- public static boolean setLCDECOMode(int nMin) {
- try {
- LOG("[setLCDECOMode] nMin [" + nMin + "]");
- if (nMin == 0) {
- ((MainActivity) mContext).getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
- } else {
- ((MainActivity) mContext).getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
- boolean bResult = Settings.System.putInt(mContext.getContentResolver(), SCREEN_OFF_TIMEOUT, nMin * 60 * 1000);
- LOG("[setLCDECOMode] bResult [" + bResult + "]");
- }
- return true;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] setLCDECOMode(context, nMin) : " + e);
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- public static boolean ctrlLCDOnOff(boolean bOn) {
- try {
- // 절전모드 사용시 호출수신등의 이벤트로 LCD 화면을 ON한다.
- // 모든 이벤트가 끝나고, 메인화면으로 전환시 절전모드를 다시 동작시킨다.
- // LOG("[ctrlLCDOnOff] bOn [" + bOn + "]");
- if (bOn) {
- if (getCompareBSPVersion("2020.09.18")) {
- if (!checkLCDOnByCMD()) {
- Log.d(TAG, "[ctrlLCDOnOff] V40Interface LcdWakeUp Call!! === 1 ===");
- MainActivity.mIOInterface.ctrlLcdWakeUp(); // 절전상태일 경우, jni LcdWakeUp 먼저 호출
- }
- }
- else {
- if (!MainActivity.mPowerManager.isScreenOn()) {
- Log.d(TAG, "[ctrlLCDOnOff] V40Interface LcdWakeUp Call!! === 2 ===");
- MainActivity.mIOInterface.ctrlLcdWakeUp(); // 절전상태일 경우, jni LcdWakeUp 먼저 호출
- }
- }
- ((MainActivity) mContext).getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
- } else
- ((MainActivity) mContext).getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
- return true;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] ctrlLCDOnOff(boolean bOn)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- /**
- * LCD backlight off시 센서값 keyevent가 발생하지 않는 증상 해결을 위한 임시코드
- * 우선 IHN-1020B-I에만 적용 후, 결과를 보고 다른 일체형 월패드에도 적용 예정
- * Jeff, 2020.09.07
- * @return true: LCD backlight On, false: LCD backlight Off
- */
- public static boolean checkLCDOnByCMD() {
- try {
- Runtime mRuntime = Runtime.getRuntime();
- Process mProcess;
- String cmd = "getprop persist.sys.lcdcon";
- mProcess = mRuntime.exec(cmd);
- BufferedReader br = new BufferedReader(new InputStreamReader(mProcess.getInputStream()));
- String line;
- String strResult = null;
- while ((line = br.readLine()) != null) {
- strResult = line;
- }
- if (strResult!=null && strResult.equals("0")) {
- Log.e(TAG, "[checkLCDOnByCMD] LCD On");
- return true;
- }
- else if (strResult!=null &&strResult.equals("1")) {
- Log.e(TAG, "[checkLCDOnByCMD] LCD Off");
- return false;
- }
- else {
- Log.e(TAG, "[checkLCDOnByCMD] Unknown value [" + strResult + "], return false!!!");
- return false;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] checkLCDOnByCMD()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- /**
- * 절전모드에서 백라이트를 키는 경우, BSP에서 PowerManager 또는 속성값으로 상태를 구분하는데
- * BSP 버전에 따라 상이하게 동작하므로 BSP 버전 구분하여 절전모드 판별 필요
- * @return true: 기준 BSP 이후 버전, false: 기준 BSP 이전 버전
- */
- public static boolean getCompareBSPVersion(String version) {
- try {
- Log.d(TAG, "[getCompareBSPVersion] version [" + version + "]");
- StringBuilder strBSPVersion = new StringBuilder();
- StringBuffer sysInfoBuffer = new StringBuffer();
- sysInfoBuffer.append(Build.DISPLAY);
- strBSPVersion.append(sysInfoBuffer.toString());
- String result = strBSPVersion.toString();
- LOG_INFO("[getCompareBSPVersion] result [" + result + "]");
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy.MM.dd");
- Date date = simpleDateFormat.parse(result);
- Date standardDate = simpleDateFormat.parse(version); // 비교 기준 BSP 버전
- if (date.compareTo(standardDate) >= 0) {
- LOG("[getCompareBSPVersion] BSP VERSION OVER!");
- return true;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG,re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getCompareBSPVersion()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- return false;
- }
- public static String[] fineDirectoryFiles(String strDstDir, final String strKeyword, final String strExtention) {
- try {
- LOG("[fineDirectoryFiles] strDstDir [" + strDstDir + "], strKeyword [" + strKeyword + "], strExtention [" + strExtention + "]");
- String[] strResult = null;
- if (strDstDir == null) return null;
- File Directory = new File(strDstDir);
- if (Directory.exists()) {
- FilenameFilter mFilenameFilter = new FilenameFilter() {
- @Override
- public boolean accept(File dir, String filename) {
- if (strKeyword != null && strExtention != null) {
- return (filename.endsWith(strExtention) && filename.matches(".*" + strKeyword + ".*"));
- } else if (strKeyword != null && strExtention == null) {
- return filename.matches(".*" + strKeyword + ".*");
- } else if (strKeyword == null && strExtention != null) {
- return filename.endsWith(strExtention);
- } else if (strKeyword == null && strExtention == null) {
- return true;
- }
- return false;
- }
- };
- String[] mFiles = Directory.list(mFilenameFilter);
- if(mFiles!=null)
- {
- LOG("[fineDirectoryFiles] mFiles.length = " + mFiles.length);
- strResult = new String[mFiles.length];
- for (int i = 0; i < strResult.length; i++) {
- strResult[i] = mFiles[i];
- LOG("[fineDirectoryFiles] strResult[" + i + "] = " + strResult[i]);
- }
- }
- return strResult;
- } else {
- LOG("[fineDirectoryFiles] Directory is not exist!! [" + strDstDir + "]");
- return null;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return null;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] fineDirectoryFiles() : " + e);
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return null;
- }
- }
- // Volume control test
- // System volume control
- public static void setMusicStreamVolume(int nVolume) { // MAX : 15
- try {
- int nCurrentVolume = 0;
- int nMaxVolume = 0;
- LOG_INFO("[setMusicStreamVolume] nVolume = " + nVolume);
- nMaxVolume = MainActivity.mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
- nCurrentVolume = MainActivity.mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
- LOG_INFO("[setMusicStreamVolume] Before nCurrentVolume [" + nCurrentVolume + "], nMaxVolume [" + nMaxVolume + "]");
- MainActivity.mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, nVolume, 0);
- nCurrentVolume = MainActivity.mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
- LOG_INFO("[setMusicStreamVolume] After nCurrentVolume [" + nCurrentVolume + "], nMaxVolume [" + nMaxVolume + "]");
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] setMusicStreamVolume(nVolume) : " + e);
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public static void setSystemStreamVolume(int nVolume) { // MAX : 7
- try {
- int nCurrentVolume = 0;
- int nMaxVolume = 0;
- LOG_INFO("[setSystemStreamVolume] nVolume = " + nVolume);
- nMaxVolume = MainActivity.mAudioManager.getStreamMaxVolume(AudioManager.STREAM_SYSTEM);
- nCurrentVolume = MainActivity.mAudioManager.getStreamVolume(AudioManager.STREAM_SYSTEM);
- LOG_INFO("[setSystemStreamVolume] Before nCurrentVolume [" + nCurrentVolume + "], nMaxVolume [" + nMaxVolume + "]");
- MainActivity.mAudioManager.setStreamVolume(AudioManager.STREAM_SYSTEM, nVolume, 0);
- nCurrentVolume = MainActivity.mAudioManager.getStreamVolume(AudioManager.STREAM_SYSTEM);
- LOG_INFO("[setSystemStreamVolume] After nCurrentVolume [" + nCurrentVolume + "], nMaxVolume [" + nMaxVolume + "]");
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] setSystemStreamVolume(nVolume) : " + e);
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- static int MAX_VOLUME_LEVEL = 15;
- static int MIN_VOLUME_LEVEL = 0;
- static int nVolumeLevel = 0;
- public static void setSystemStreamVolume(boolean bUp) {
- try {
- int nMaxVolume = 0;
- int nSystemMaxVolume = MainActivity.mAudioManager.getStreamMaxVolume(AudioManager.STREAM_SYSTEM);
- MainActivity.mAudioManager.setStreamVolume(AudioManager.STREAM_SYSTEM, nSystemMaxVolume, 0);
- LOG_INFO("[setSystemStreamVolume] nSystemMaxVolume [" + nSystemMaxVolume + "]");
- int nRingMaxVolume = MainActivity.mAudioManager.getStreamMaxVolume(AudioManager.STREAM_RING);
- MainActivity.mAudioManager.setStreamVolume(AudioManager.STREAM_RING, nRingMaxVolume, 0);
- LOG_INFO("[setSystemStreamVolume] nRingMaxVolume [" + nRingMaxVolume + "]");
- nMaxVolume = MainActivity.mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
- nVolumeLevel = MainActivity.mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
- LOG_INFO("[setSystemStreamVolume] nVolumeLevel [" + nVolumeLevel + "], nMaxVolume [" + nMaxVolume + "]");
- if (bUp) {
- nVolumeLevel++;
- if (nVolumeLevel > MAX_VOLUME_LEVEL) nVolumeLevel = MAX_VOLUME_LEVEL;
- } else {
- nVolumeLevel--;
- if (nVolumeLevel < MIN_VOLUME_LEVEL) nVolumeLevel = MIN_VOLUME_LEVEL;
- }
- LOG_INFO("[setSystemStreamVolume] Before nVolumeLevel [" + nVolumeLevel + "], nMaxVolume [" + nMaxVolume + "]");
- MainActivity.mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, nVolumeLevel, 0);
- nVolumeLevel = MainActivity.mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
- LOG_INFO("[setSystemStreamVolume] After nVolumeLevel [" + nVolumeLevel + "], nMaxVolume [" + nMaxVolume + "]");
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] setSystemStreamVolume(bUp) : " + e);
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- static int MAX_MONOOUT_VOLUME_LEVEL = 79;
- static int MIN_MONOOUT_VOLUME_LEVEL = 0;
- static int nMonoVolumeLevel = 0;
- public static void setMonoOutVolume_Test(boolean bUp) {
- try {
- LOG_INFO("[setMonoOutVolume] bUp [" + bUp + "]");
- int nCurrentVolume = 0;
- if (bUp) {
- nCurrentVolume = MainActivity.mIOInterface.getSpeakerGain();
- nCurrentVolume++;
- if (nCurrentVolume > MAX_MONOOUT_VOLUME_LEVEL)
- nCurrentVolume = MAX_MONOOUT_VOLUME_LEVEL;
- MainActivity.mIOInterface.setSpeakerGain(nCurrentVolume);
- nCurrentVolume = MainActivity.mIOInterface.getSpeakerGain();
- } else {
- nCurrentVolume = MainActivity.mIOInterface.getSpeakerGain();
- nCurrentVolume--;
- if (nCurrentVolume < MIN_MONOOUT_VOLUME_LEVEL)
- nCurrentVolume = MIN_MONOOUT_VOLUME_LEVEL;
- MainActivity.mIOInterface.setSpeakerGain(nCurrentVolume);
- nCurrentVolume = MainActivity.mIOInterface.getSpeakerGain();
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] setMonoOutVolume() : " + e);
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- // Volume control test
- static int[] anSystemVolumeTable = new int[]{0, 44, 46, 48, 50, 53, 56, 60, 64, 68, 72};
- static int[] anMoIPVolumeTable = new int[]{0, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79};
- public static boolean setSystemVolume(int nLevel) {
- try {
- LOG("[setSystemVolume] nLevel = " + nLevel);
- if (MainActivity.mIOInterface.setSpeakerGain(anSystemVolumeTable[nLevel]) == 0)
- return true;
- else return false;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] setSystemVolume(nLevel) : " + e);
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- public static int getSystemVolume() {
- try {
- int nResult = MainActivity.mIOInterface.getSpeakerGain();
- for (int i = 0; i < anSystemVolumeTable.length; i++) {
- if (anSystemVolumeTable[i] == nResult) {
- LOG("[getSystemVolume] nLevel = " + i);
- return i;
- }
- }
- return -1;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -1;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getSystemVolume() : " + e);
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -1;
- }
- }
- public static boolean setMoIPVolume(int nLevel) {
- try {
- LOG("[setMoIPVolume] nLevel = " + nLevel);
- if (nLevel == getMoIPoVolume()) return true; // 현재 값이 동일하면 설정하지 않는다.
- if (MainActivity.mIOInterface.setSpeakerGain(anMoIPVolumeTable[nLevel]) == 0)
- return true;
- else return false;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] setMoIPVolume(nLevel) : " + e);
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- public static int getMoIPoVolume() {
- try {
- int nResult = MainActivity.mIOInterface.getSpeakerGain();
- for (int i = 0; i < anMoIPVolumeTable.length; i++) {
- if (anMoIPVolumeTable[i] == nResult) {
- LOG("[getMoIPoVolume] nLevel = " + i);
- return i;
- }
- }
- return -1;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -1;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] setSystemVolume(nLevel) : " + e);
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -1;
- }
- }
- public static int ctrlCameraBrightness(int nVolume) {
- try {
- return MainActivity.mIOInterface.ctrlCameraBrightness(nVolume * 2);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -1;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] ctrlCameraBrightness(int nVolume)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -1;
- }
- }
- // V40_300 / V40(현산) VOLUME TABLE
- private static String[] sV40WallPadVolumeTable = new String[]{"0x0036", "0x0036", "0x0040", "0x004c", "0x005a", "0x006b", "0x0080", "0x0098", "0x00b5", "0x00d7", "0x100"};
- private static String[] sV40WallPadVolumeTable_RESIDENCE = new String[]{"0x006b", "0x006b", "0x0080", "0x0098", "0x00b5", "0x00d7", "0x0100", "0x0130", "0x016a", "0x01ae", "0x200"};
- // IHN-1020B-I 전용 통화 음량 테이블 (AOS 7.1.1, MadeInLAB)
- private static String[] sV40WallPadVolumeTable_RESIDENCE_IHN1020B_I = new String[]{"0x0066", "0x0066", "0x00CC", "0x0132", "0x0198", "0x0200", "0x0233", "0x0266", "0x0299", "0x02CC", "0x0300"};
- private static String[] sV40WallPadVolumeTable_LOBBY_IHN1020B_I = new String[]{"0x0033", "0x0033", "0x0066", "0x0099", "0x00CC", "0x00FF", "0x0132", "0x0165", "0x0198", "0x01CB", "0x01FE"};
- private static String[] sV40WallPadVolumeTable_GUARD_IHN1020B_I = new String[]{"0x0033", "0x0033", "0x0066", "0x0099", "0x00CC", "0x00FF", "0x0132", "0x0165", "0x0198", "0x01CB", "0x01FE"};
- // V40(대외) 전용 볼륨테이블
- private static String[] sV40WallPadVolumeTable_PSTN = new String[]{"0x36", "0x36", "0x4c", "0x5a", "0x80", "0xb5", "0xd7", "0x130", "0x16a", "0x1ae", "0x200"};
- private static String[] sV40WallPadVolumeTable_GUARD = new String[]{"0x26", "0x26", "0x2d", "0x36", "0x40", "0x4c", "0x5a", "0x6b", "0x80", "0x98", "0xb5"};
- public static void setV40WallPadVolume(int nVolume) {
- try {
- Log.d(TAG, "[setV40WallPadVolume] nVolume: " + nVolume);
- MainActivity.mIOInterface.setWallPadVolume_V40(sV40WallPadVolumeTable[nVolume]);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] setV40WallPadVolume(int nVolume)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public static void setV40WallPadVolume_LOBBY(int nVolume) {
- try {
- Log.d(TAG, "[setV40WallPadVolume] nVolume: " + nVolume);
- if (Version.getModelType() == MODEL_TYPE.IHN_1020B_I) MainActivity.mIOInterface.setWallPadVolume_V40(sV40WallPadVolumeTable_LOBBY_IHN1020B_I[nVolume]);
- else MainActivity.mIOInterface.setWallPadVolume_V40(sV40WallPadVolumeTable[nVolume]);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] setV40WallPadVolume(int nVolume)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public static void setV40WallPadVolume_RESIDENCE(int nVolume) {
- try {
- Log.d(TAG, "[setV40WallPadVolume_RESIDENCE] nVolume: " + nVolume);
- if (Version.getModelType() == MODEL_TYPE.IHN_1020B_I) MainActivity.mIOInterface.setWallPadVolume_V40(sV40WallPadVolumeTable_RESIDENCE_IHN1020B_I[nVolume]);
- else MainActivity.mIOInterface.setWallPadVolume_V40(sV40WallPadVolumeTable_RESIDENCE[nVolume]);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] setV40WallPadVolume_RESIDENCE(int nVolume)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- // 대외향
- public static void setV40WallPadVolume_PSTN(int nVolume) {
- try {
- Log.d(TAG, "[setV40WallPadVolume_PSTN] nVolume: " + nVolume);
- MainActivity.mIOInterface.setWallPadVolume_V40(sV40WallPadVolumeTable_PSTN[nVolume]);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] setV40WallPadVolume_PSTN(int nVolume)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public static void setV40WallPadVolume_GUARD(int nVolume) {
- try {
- Log.d(TAG, "[setV40WallPadVolume_GUARD] nVolume: " + nVolume);
- if (Version.getModelType() == MODEL_TYPE.IHN_1020B_I) MainActivity.mIOInterface.setWallPadVolume_V40(sV40WallPadVolumeTable_GUARD_IHN1020B_I[nVolume]);
- else MainActivity.mIOInterface.setWallPadVolume_V40(sV40WallPadVolumeTable_GUARD[nVolume]);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] setV40WallPadVolume_GUARD(int nVolume)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public static int getWallPadMoIPVolume() {
- try {
- return MainActivity.mIOInterface.getWallPadSpeakerGain();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -1;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getWallPadMoIPVolume()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -1;
- }
- }
- public enum CALLDIRECTION {
- IN,
- OUT,
- UNKNOWN
- }
- public enum CALLACTION {
- TALK,
- TALK_DOOR,
- DOOR,
- HOMEVIEW,
- MISS,
- BUSY,
- REJECT,
- CANCEL,
- UNKNOWN
- }
- public enum CALLRESULT {
- IN,
- OUT,
- MISS,
- IN_MISS, // 부재중(호출왔는데 안받음)
- IN_REJECT, // 거절 (호출왔는데 거절)
- IN_TALK, // 수신
- IN_TALK_DOOR, // 수신(통화중 문열림)
- IN_DOOR, // 수신(문열림)
- OUT_MISS,
- OUT_DOOR, // 발신(문열림)
- OUT_TALK, // 발신
- OUT_HONEVIEW, // 모바일 홈뷰어
- OUT_BUSY,
- OUT_REJECT,
- OUT_CANCEL,
- UNKNOWN,
- ERROR
- }
- public static CallHistoryInfo Temp_1stCallHistoryInfo = null;
- public static CallLogUnit Temp_1stCallLogUnitInfo = null;
- public static boolean save1stCallHistory(String strRemoteIP, String strRemoteSIPID, CALLRESULT eCallResult) {
- try {
- LOG("[save1stCallHistory] strRemoteIP [" + strRemoteIP + "], strRemoteSIPID [" + strRemoteSIPID + "], eCallResult [" + eCallResult + "]");
- if (!make1stCallHistoryInfo(strRemoteIP, strRemoteSIPID, CALLDIRECTION.UNKNOWN, CALLACTION.UNKNOWN, eCallResult))
- return false;
- if (!add1stCallHistoryInfo(eCallResult)) return false;
- return true;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] save1stCallHistory(String strRemoteIP, String strRemoteSIPID, CALLRESULT eCallResult)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- public static boolean make1stCallHistoryInfo(String strRemoteIP, String strRemoteSIPID, CALLDIRECTION eDirection, CALLACTION eAction, CALLRESULT eCallResult) {
- try {
- LOG("[make1stCallHistoryInfo] strRemoteIP [" + strRemoteIP + "], strRemoteSIPID [" + strRemoteSIPID + "], eDirection [" + eDirection + "], eAction [" + eAction + "], eCallResult [" + eCallResult + "]");
- Temp_1stCallLogUnitInfo = new CallLogUnit();
- Temp_1stCallLogUnitInfo.clear();
- Temp_1stCallLogUnitInfo.setValue(eDirection, eAction, strRemoteSIPID);
- String strName = "NONE";
- if (strRemoteIP.contains("PSTN")) {
- strName = strRemoteIP + ":" + strRemoteSIPID;
- } else if (strRemoteIP.equals("FRONT")) {
- strName = "Front:" + strRemoteSIPID;
- } else if (strRemoteIP.equals("HOMEVIEW")) {
- strName = "HomeView";
- } else {
- strName = makeCallHistoryName(strRemoteSIPID);
- }
- Temp_1stCallHistoryInfo = new CallHistoryInfo();
- Temp_1stCallHistoryInfo.clear();
- Temp_1stCallHistoryInfo.setValue(strName, eCallResult.toString(), strRemoteIP, strRemoteSIPID, "FALSE", "null", "null");
- Temp_1stCallHistoryInfo.printValue();
- return true;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] make1stCallHistoryInfo(String strRemoteIP, String strRemoteSIPID, CALLDIRECTION eDirection, CALLACTION eAction, CALLRESULT eCallResult)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- public static boolean add1stCallHistoryInfo(CALLRESULT eCallResult) {
- try {
- LOG("[add1stCallHistoryInfo] eCallResult [" + eCallResult + "]");
- if (Temp_1stCallHistoryInfo == null) {
- LOG_INFO("[add1stCallHistoryInfo] Temp_1stCallHistoryInfo is null!!");
- return false;
- }
- if (Temp_1stCallLogUnitInfo != null) {
- Temp_1stCallLogUnitInfo.printValue();
- change1stCallHistoryLogInfo(Temp_1stCallLogUnitInfo);
- }
- if (eCallResult != CALLRESULT.UNKNOWN) {
- if (eCallResult == CALLRESULT.IN_MISS) {
- Temp_1stCallHistoryInfo.setValue(Temp_1stCallHistoryInfo.getName(), eCallResult.toString(), Temp_1stCallHistoryInfo.getRemoteIP(), Temp_1stCallHistoryInfo.getSIPID(), "FALSE", "null", "null");
- } else {
- Temp_1stCallHistoryInfo.setValue(Temp_1stCallHistoryInfo.getName(), eCallResult.toString(), Temp_1stCallHistoryInfo.getRemoteIP(), Temp_1stCallHistoryInfo.getSIPID(), "TRUE", "null", "null");
- }
- }
- MainActivity.mCallHistoryManager.addCallHistory(Temp_1stCallHistoryInfo);
- Temp_1stCallHistoryInfo = null;
- Temp_1stCallLogUnitInfo = null;
- return true;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] add1stCallHistoryInfo(CALLRESULT eCallResult)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- public static boolean add1stCallHistoryInfoFinal() {
- try {
- LOG("[add1stCallHistoryInfoFinal] ===== START =====");
- if (Temp_1stCallHistoryInfo != null) {
- if (Temp_1stCallLogUnitInfo != null) {
- Temp_1stCallLogUnitInfo.printValue();
- change1stCallHistoryLogInfo(Temp_1stCallLogUnitInfo);
- } else {
- LOG_WARN("[add1stCallHistoryInfoFinal] Temp_1stCallLogUnitInfo is null!!");
- }
- if (Temp_1stCallHistoryInfo.getCallResult().equals(CALLRESULT.IN_MISS.toString())) {
- MissedCallVisitorPicture.saveTakenPicture();
- } else {
- Temp_1stCallHistoryInfo.changeChecked("TRUE");
- MissedCallVisitorPicture.deleteTakenPicture mdeleteTakenPicture = new MissedCallVisitorPicture.deleteTakenPicture(MissedCallVisitorPicture.strMissedCallPicURI);
- mdeleteTakenPicture.start();
- }
- MainActivity.mCallHistoryManager.addCallHistory(Temp_1stCallHistoryInfo);
- Temp_1stCallHistoryInfo = null;
- Temp_1stCallLogUnitInfo = null;
- } else {
- LOG_WARN("[add1stCallHistoryInfoFinal] Temp_1stCallHistoryInfo is null!!");
- }
- return true;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] add1stCallHistoryInfoFinal()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- public static boolean change1stCallHistoryLogInfo(CallLogUnit LogInfo) {
- try {
- LOG("[change1stCallHistoryLogInfo]");
- if (LogInfo != null) LogInfo.printValue();
- if (Temp_1stCallHistoryInfo == null) {
- LOG_INFO("[change1stCallHistoryLogInfo] Temp_1stCallHistoryInfo is null!!");
- return false;
- }
- Temp_1stCallHistoryInfo.printValue();
- if (LogInfo!=null && LogInfo.getSIPID()!=null && LogInfo.getSIPID().contains("PSTN:"))
- Temp_1stCallHistoryInfo.changeCallName(LogInfo.getSIPID());
- if(LogInfo!=null && LogInfo.getSIPID()!=null)
- Temp_1stCallHistoryInfo.changeCallSIPID(LogInfo.getSIPID());
- Temp_1stCallHistoryInfo.changeCallResult(makeCallResult(Temp_1stCallLogUnitInfo).toString());
- return true;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] change1stCallHistoryLogInfo(CallLogUnit LogInfo)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- public static boolean change1stCallLogDirection(CALLDIRECTION eDirection) {
- try {
- if (Temp_1stCallLogUnitInfo == null) {
- LOG_WARN("[change1stCallLogDirection] Temp_1stCallLogUnitInfo is null!!");
- return false;
- }
- Temp_1stCallLogUnitInfo.changeValue(eDirection);
- return true;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] change1stCallLogDirection(CALLDIRECTION eDirection)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- public static boolean doorOpen = false; // 문열림 및 통화중 문열림인 경우 true (거동수상자 녹화 영상 판별을 위함)
- public static boolean change1stCallLogAction(CALLACTION eAction) {
- try {
- LOG("[change1stCallLogAction] eAction [" + eAction + "]");
- if (eAction == CALLACTION.DOOR || eAction == CALLACTION.TALK_DOOR) doorOpen = true;
- LOG("[change1stCallLogAction] doorOpen [" + doorOpen + "]");
- if (Temp_1stCallLogUnitInfo == null) {
- LOG_WARN("[change1stCallLogAction] Temp_1stCallLogUnitInfo is null!!");
- return false;
- }
- Temp_1stCallLogUnitInfo.changeValue(eAction);
- return true;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] change1stCallLogAction(CALLACTION eAction)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- public static boolean change1stCallLogSIPID(String strSIPID) {
- try {
- LOG("[change1stCallLogSIPID] strSIPID [" + strSIPID + "]");
- if (Temp_1stCallLogUnitInfo == null) {
- LOG_WARN("[change1stCallLogSIPID] Temp_1stCallLogUnitInfo is null!!");
- return false;
- }
- Temp_1stCallLogUnitInfo.changeValue(strSIPID);
- return true;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] change1stCallLogSIPID(String strSIPID)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- // 멀티콜 통화내역
- public static CallHistoryInfo Temp_2ndCallHistoryInfo = null;
- public static CallLogUnit Temp_2ndCallLogUnitInfo = null;
- public static boolean save2ndCallHistory(String strRemoteIP, String strRemoteSIPID, CALLRESULT eCallResult) {
- try {
- LOG("[save2ndCallHistory] strRemoteIP [" + strRemoteIP + "], strRemoteSIPID [" + strRemoteSIPID + "], eCallResult [" + eCallResult + "]");
- if (!make2ndCallHistoryInfo(strRemoteIP, strRemoteSIPID, CALLDIRECTION.UNKNOWN, CALLACTION.UNKNOWN, eCallResult))
- return false;
- if (!add2ndCallHistoryInfo(eCallResult)) return false;
- return true;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] save2ndCallHistory(String strRemoteIP, String strRemoteSIPID, CALLRESULT eCallResult)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- public static boolean make2ndCallHistoryInfo(String strRemoteIP, String strRemoteSIPID, CALLDIRECTION eDirection, CALLACTION eAction, CALLRESULT eCallResult) {
- try {
- Log.w(TAG, "[make2ndCallHistoryInfo]");
- LOG("[make2ndCallHistoryInfo] strRemoteIP [" + strRemoteIP + "], strRemoteSIPID [" + strRemoteSIPID + "], eDirection [" + eDirection + "], eAction [" + eAction + "], eCallResult [" + eCallResult + "]");
- Temp_2ndCallLogUnitInfo = new CallLogUnit();
- Temp_2ndCallLogUnitInfo.setValue(eDirection, eAction, strRemoteSIPID);
- String strName = "NONE";
- if (strRemoteIP.equals("PSTN")) {
- strName = strRemoteIP + ":" + strRemoteSIPID;
- } else if (strRemoteIP.equals("FRONT")) {
- strName = "Front:" + strRemoteSIPID;
- } else {
- strName = makeCallHistoryName(strRemoteSIPID);
- }
- Temp_2ndCallHistoryInfo = new CallHistoryInfo();
- Temp_2ndCallHistoryInfo.setValue(strName, eCallResult.toString(), strRemoteIP, strRemoteSIPID, "FALSE", "null", "null");
- return true;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] make2ndCallHistoryInfo(String strRemoteIP, String strRemoteSIPID, CALLDIRECTION eDirection, CALLACTION eAction, CALLRESULT eCallResult)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- public static boolean add2ndCallHistoryInfo(CALLRESULT eCallResult) {
- try {
- LOG("[add2ndCallHistoryInfo] eCallResult [" + eCallResult + "]");
- if (Temp_2ndCallHistoryInfo == null) {
- LOG_INFO("[add2ndCallHistoryInfo] Temp_2ndCallHistoryInfo is null!!");
- return false;
- }
- if (Temp_2ndCallLogUnitInfo != null) {
- Temp_2ndCallLogUnitInfo.printValue();
- change2ndCallHistoryLogInfo(Temp_2ndCallLogUnitInfo);
- }
- if (eCallResult != CALLRESULT.UNKNOWN) {
- if (eCallResult == CALLRESULT.IN_MISS) {
- Temp_2ndCallHistoryInfo.setValue(Temp_2ndCallHistoryInfo.getName(), eCallResult.toString(), Temp_2ndCallHistoryInfo.getRemoteIP(), Temp_2ndCallHistoryInfo.getSIPID(), "FALSE", "null", "null");
- } else {
- Temp_2ndCallHistoryInfo.setValue(Temp_2ndCallHistoryInfo.getName(), eCallResult.toString(), Temp_2ndCallHistoryInfo.getRemoteIP(), Temp_2ndCallHistoryInfo.getSIPID(), "TRUE", "null", "null");
- }
- }
- MainActivity.mCallHistoryManager.addCallHistory(Temp_2ndCallHistoryInfo);
- Temp_2ndCallHistoryInfo = null;
- Temp_2ndCallLogUnitInfo = null;
- return true;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] add2ndCallHistoryInfo(CALLRESULT eCallResult)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- public static boolean add2ndCallHistoryInfoFinal() {
- try {
- LOG("[add2ndCallHistoryInfoFinal]");
- if (Temp_2ndCallHistoryInfo != null) {
- if (Temp_2ndCallLogUnitInfo != null) {
- Temp_2ndCallLogUnitInfo.printValue();
- change2ndCallHistoryLogInfo(Temp_2ndCallLogUnitInfo);
- } else {
- LOG_WARN("[add2ndCallHistoryInfoFinal] Temp_2ndCallLogUnitInfo is null!!");
- }
- if (!Temp_1stCallHistoryInfo.getCallResult().equals(CALLRESULT.IN_MISS.toString()))
- Temp_2ndCallHistoryInfo.changeChecked("TRUE");
- MainActivity.mCallHistoryManager.addCallHistory(Temp_2ndCallHistoryInfo);
- Temp_2ndCallHistoryInfo = null;
- Temp_2ndCallLogUnitInfo = null;
- }
- return true;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] add2ndCallHistoryInfoFinal() : " + e);
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- public static boolean change2ndCallHistoryLogInfo(CallLogUnit LogInfo) {
- try {
- LOG("[change2ndCallHistoryLogInfo]");
- if (LogInfo != null) LogInfo.printValue();
- if (Temp_2ndCallHistoryInfo == null) {
- LOG_INFO("[change2ndCallHistoryLogInfo] Temp_2ndCallHistoryInfo is null!!");
- return false;
- }
- if (LogInfo!=null && LogInfo.getSIPID()!=null && LogInfo.getSIPID().contains("PSTN:"))
- Temp_2ndCallHistoryInfo.changeCallName(LogInfo.getSIPID());
- if(LogInfo!=null && LogInfo.getSIPID()!=null)
- Temp_2ndCallHistoryInfo.changeCallSIPID(LogInfo.getSIPID());
- Temp_2ndCallHistoryInfo.changeCallResult(makeCallResult(Temp_2ndCallLogUnitInfo).toString());
- return true;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] change2ndCallHistoryLogInfo(CallLogUnit LogInfo)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- public static boolean change2ndCallLogDirection(CALLDIRECTION eDirection) {
- try {
- if (Temp_2ndCallLogUnitInfo == null) {
- LOG_WARN("[change2ndCallLogDirection] Temp_2ndCallLogUnitInfo is null!!");
- return false;
- }
- Temp_2ndCallLogUnitInfo.changeValue(eDirection);
- return true;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] change2ndCallLogDirection(CALLDIRECTION eDirection)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- public static boolean change2ndCallLogAction(CALLACTION eAction) {
- try {
- if (Temp_2ndCallLogUnitInfo == null) {
- LOG_WARN("[change2ndCallLogAction] Temp_2ndCallLogUnitInfo is null!!");
- return false;
- }
- Temp_2ndCallLogUnitInfo.changeValue(eAction);
- return true;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] change2ndCallLogAction(CALLACTION eAction)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- public static boolean change2ndCallLogSIPID(String strSIPID) {
- try {
- LOG_INFO("[change2ndCallLogSIPID] strSIPID [" + strSIPID + "]");
- if (Temp_2ndCallLogUnitInfo == null) {
- LOG_WARN("[change2ndCallLogSIPID] Temp_2ndCallLogUnitInfo is null!!");
- return false;
- }
- Temp_2ndCallLogUnitInfo.changeValue(strSIPID);
- Temp_2ndCallLogUnitInfo.printValue();
- return true;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] change2ndCallLogSIPID(String strSIPID)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- public static boolean replace1stBy2ndCallHistory() {
- try {
- LOG_INFO("[replace1stBy2ndCallHistory]");
- if (Temp_2ndCallHistoryInfo != null) Temp_1stCallHistoryInfo = Temp_2ndCallHistoryInfo;
- else {
- LOG_WARN("[replace1stBy2ndCallHistory] Temp_2ndCallHistoryInfo is null!!");
- return false;
- }
- if (Temp_2ndCallLogUnitInfo != null) Temp_1stCallLogUnitInfo = Temp_2ndCallLogUnitInfo;
- else {
- LOG_WARN("[replace1stBy2ndCallHistory] Temp_2ndCallLogUnitInfo is null!!");
- return false;
- }
- return true;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] replace1stBy2ndCallHistory()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- private static CALLRESULT makeCallResult(CallLogUnit LogInfo) {
- try {
- LOG("[makeCallResult] LogInfo.getDirection [" + LogInfo.getDirection() + "], LogInfo.getAction [" + LogInfo.getAction() + "]");
- LOG("[makeCallResult] LogInfo.getSIPID [" + LogInfo.getSIPID() + "]");
- if (LogInfo.getDirection() == CALLDIRECTION.IN) {
- if (LogInfo.getAction() == CALLACTION.TALK) {
- return CALLRESULT.IN_TALK;
- } else if (LogInfo.getAction() == CALLACTION.TALK_DOOR) {
- return CALLRESULT.IN_TALK_DOOR;
- } else if (LogInfo.getAction() == CALLACTION.DOOR) {
- return CALLRESULT.IN_DOOR;
- } else if (LogInfo.getAction() == CALLACTION.MISS) {
- return CALLRESULT.IN_MISS;
- } else if (LogInfo.getAction() == CALLACTION.BUSY) {
- return CALLRESULT.UNKNOWN;
- } else if (LogInfo.getAction() == CALLACTION.REJECT) {
- return CALLRESULT.IN_REJECT;
- } else if (LogInfo.getAction() == CALLACTION.CANCEL) {
- return CALLRESULT.UNKNOWN;
- } else if (LogInfo.getAction() == CALLACTION.UNKNOWN) {
- return CALLRESULT.UNKNOWN;
- } else {
- return CALLRESULT.UNKNOWN;
- }
- } else if (LogInfo.getDirection() == CALLDIRECTION.OUT) {
- if (LogInfo.getAction() == CALLACTION.TALK) {
- return CALLRESULT.OUT_TALK;
- } else if (LogInfo.getAction() == CALLACTION.TALK_DOOR) {
- return CALLRESULT.OUT_DOOR;
- } else if (LogInfo.getAction() == CALLACTION.DOOR) {
- return CALLRESULT.OUT_DOOR;
- } else if (LogInfo.getAction() == CALLACTION.HOMEVIEW) {
- return CALLRESULT.OUT_HONEVIEW;
- } else if (LogInfo.getAction() == CALLACTION.MISS) {
- return CALLRESULT.OUT_MISS;
- } else if (LogInfo.getAction() == CALLACTION.BUSY) {
- return CALLRESULT.OUT_BUSY;
- } else if (LogInfo.getAction() == CALLACTION.REJECT) {
- return CALLRESULT.OUT_REJECT;
- } else if (LogInfo.getAction() == CALLACTION.CANCEL) {
- return CALLRESULT.OUT_CANCEL;
- } else if (LogInfo.getAction() == CALLACTION.UNKNOWN) {
- return CALLRESULT.UNKNOWN;
- } else {
- return CALLRESULT.UNKNOWN;
- }
- } else {
- LOG_INFO("[makeCallResult] Invalid CALLDIRECTION!!");
- return CALLRESULT.UNKNOWN;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return CALLRESULT.ERROR;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] makeCallResult(CallLogUnit LogInfo) : " + e);
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return CALLRESULT.ERROR;
- }
- }
- public static String makeCallHistoryName(String strSIPID) {
- try {
- Log.d(TAG, "[makeCallHistoryName] strSIPID: " + strSIPID);
- String[] strParse_01 = strSIPID.split("_");
- String strResult = "NONE";
- if (strParse_01[1].equals(DEVICENAME.strType_Lobby)) {
- strResult = DEVICENAME.strType_Lobby + "/" + Integer.parseInt(strParse_01[2]) + "-" + Integer.parseInt(strParse_01[3]);
- } else if (strParse_01[1].equals(DEVICENAME.strType_Guard)) {
- strResult = DEVICENAME.strType_Guard + "/" + Integer.parseInt(strParse_01[2]) + "-" + Integer.parseInt(strParse_01[3]);
- } else if (strParse_01[1].equals(DEVICENAME.strType_Resi)) {
- strResult = DEVICENAME.strType_Resi + "/" + Integer.parseInt(strParse_01[2]) + "-" + Integer.parseInt(strParse_01[3]);
- } else if (strParse_01[1].equals(DEVICENAME.strType_RentResi)) {
- strResult = DEVICENAME.strType_RentResi + "/" + Integer.parseInt(strParse_01[2]) + "-" + Integer.parseInt(strParse_01[3]) + "#1";
- } else {
- strResult = DEVICENAME.strType_Resi + "/" + Integer.parseInt(strParse_01[2]) + "-" + Integer.parseInt(strParse_01[3]);
- }
- Log.d(TAG, "[makeCallHistoryName] strResult: " + strResult);
- return strResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return "ERROR";
- } catch (Exception e) {
- Log.e(TAG, "[Exception] makeCallHistoryName(String strSIPID)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return "ERROR";
- }
- }
- public static String getSitecodeString() {
- try {
- String strResult = "";
- WallpadDeviceSet Devset = new WallpadDeviceSet(mContext);
- String[] getData = Devset.GetSettingData("site_code");
- Devset.closeDB();
- if ((getData != null) && getData.length > 1) {
- strResult = getData[1];
- }
- LOG("[getSitecodeString] strResult [" + strResult + "]");
- return strResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return null;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getSitecodeString()");
- return null;
- }
- }
- public static String getDongString() {
- try {
- String strResult = "";
- wallpaddbmgr DBMGR = new wallpaddbmgr(mContext);
- AddressSet Addr = DBMGR.getAddressMGR();
- DBMGR.closeDB();
- strResult = Addr.Dong;
- LOG("[getDongString] strResult [" + strResult + "]");
- return strResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return null;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getDongString()");
- return null;
- }
- }
- public static String getHoString() {
- try {
- String strResult = "";
- wallpaddbmgr DBMGR = new wallpaddbmgr(mContext);
- AddressSet Addr = DBMGR.getAddressMGR();
- DBMGR.closeDB();
- strResult = Addr.Ho;
- LOG("[getHoString] strResult [" + strResult + "]");
- return strResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return null;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getHoString()");
- return null;
- }
- }
- public static String makeIPAddress(DeviceType eDeviceType, String strDong, String strHo) {
- try {
- LOG("[makeIPAddress] eDeviceType [" + eDeviceType + "], strDong [" + strDong + "], strHo [" + strHo + "]");
- String strResult = null;
- String IP_01 = "10";
- String IP_02 = Integer.toString(Integer.parseInt(strDong) % 100);
- String IP_03 = "1";
- String IP_04 = "1";
- if (ConfigValues.bIPExpansion) {
- if (IP_02.equals("0")) IP_01 = "10"; // 장비동(0동)인 경우에는 IP의 A클래스를 "10"으로 고정한다.
- else IP_01 = Integer.toString(Integer.parseInt(strDong) / 100);
- }
- if (eDeviceType == DeviceType.RESIDENCE) {
- IP_03 = Integer.toString(Integer.parseInt(strHo) / 100);
- IP_04 = Integer.toString(Integer.parseInt(strHo) % 100);
- } else if (eDeviceType == DeviceType.RENTRESIDENCE) {
- IP_03 = Integer.toString(Integer.parseInt(strHo) / 100);
- IP_04 = Integer.toString((Integer.parseInt(strHo) % 100) + 200);
- } else if (eDeviceType == DeviceType.LOBBY) {
- IP_03 = "0";
- IP_04 = Integer.toString(Integer.parseInt(strHo) % 100);
- } else if (eDeviceType == DeviceType.GUARD) {
- IP_03 = "128";
- IP_04 = Integer.toString(Integer.parseInt(strHo) % 100);
- }
- if (!checkIPValidity(IP_01)) return null;
- if (!checkIPValidity(IP_02)) return null;
- if (!checkIPValidity(IP_03)) return null;
- if (!checkIPValidity(IP_04)) return null;
- strResult = IP_01 + "." + IP_02 + "." + IP_03 + "." + IP_04;
- LOG("[makeIPAddress] strResult [" + strResult + "]");
- return strResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return null;
- } catch (Exception e) {
- Log.d(TAG, "[Exception] makeIPAddress(eDeviceType, strDong, strHo) : " + e);
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return null;
- }
- }
- public static String makeIPAddress(String a, String b, String c, String d) {
- try {
- LOG("[makeIPAddress] a [" + a + "], b [" + b + "], c [" + c + "], d [" + d + "]");
- String strResult = null;
- if (!checkIPValidity(a)) return null;
- if (!checkIPValidity(b)) return null;
- if (!checkIPValidity(c)) return null;
- if (!checkIPValidity(d)) return null;
- strResult = a + "." + b + "." + c + "." + d;
- LOG("[makeIPAddress] strResult [" + strResult + "]");
- return strResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return null;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] makeIPAddress(a, b, c, d)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return null;
- }
- }
- public static String makeIPAddress(String[] aip) {
- try {
- LOG("[makeIPAddress] aip.length [" + aip.length + "]");
- String strResult = null;
- for (int i = 0; i < aip.length; i++) {
- LOG("[makeIPAddress] classes [" + i + "] = " + aip[i]);
- if (!checkIPValidity(aip[i])) return null;
- }
- strResult = aip[0] + "." + aip[1] + "." + aip[2] + "." + aip[3];
- LOG("[makeIPAddress] strResult [" + strResult + "]");
- return strResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return null;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] makeIPAddress(String[] aip)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return null;
- }
- }
- private static boolean checkIPValidity(String ip) {
- try {
- LOG("[checkIPValidity] ip [" + ip + "]");
- int nIP = Integer.parseInt(ip);
- if ((0 <= nIP) && (nIP <= 255)) return true;
- else return false;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] checkIPValidity(String ip)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- public static boolean playMelodyRepeat(CALLTYPE eCallType) {
- try {
- LOG("[playMelodyRepeat] eCallType [" + eCallType + "]");
- if (ConfigValues.bPlayBellUse) {
- if (eCallType == CALLTYPE.FRONT) {
- return MainActivity.mSound.PlayRepeat(SND.bell.FRONT, 0);
- } else if (eCallType == CALLTYPE.LOBBY) {
- return MainActivity.mSound.PlayRepeat(SND.bell.LOBBY, 0);
- } else if (eCallType == CALLTYPE.GUARD) {
- return MainActivity.mSound.PlayRepeat(SND.bell.GUARDROOM, 0);
- } else if (eCallType == CALLTYPE.RESIDENCE) {
- return MainActivity.mSound.PlayRepeat(SND.bell.NEIGHBOOR, 0);
- } else if (eCallType == CALLTYPE.PSTN) {
- return MainActivity.mSound.PlayRepeat(SND.bell.PSTN, 0);
- } else {
- stopMelodyRepeat();
- return false;
- }
- } else {
- Log.d(TAG, "[playMelodyRepeat] Do not Play Melody!! bPlayBellUse [" + ConfigValues.bPlayBellUse + "]");
- return false;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] playMelodyRepeat(CALLTYPE eCallType)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- public static boolean stopMelodyRepeat() {
- try {
- LOG("[stopMelodyRepeat]");
- if (MainActivity.mSound != null) {
- if (MainActivity.mSound.isPlayRepeating()) {
- return MainActivity.mSound.StopRepeat();
- }
- }
- return true;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] stopMelodyRepeat()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- public static int getFrontVolume() {
- try {
- WallpadStatusData DBMGR = new WallpadStatusData(mContext);
- int nResult = DBMGR.GetCallSound_DoorCamValue(WallpadStatusData.INDEX_CALL_DOORCAM_SOUND);
- DBMGR.closeDB();
- if (nResult < 0) {
- LOG_WARN("[getFrontVolume] Less than 0!! nResult [" + nResult + "]");
- nResult = 5;
- }
- return nResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return 5;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getFrontVolume()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return 5;
- }
- }
- public static boolean setFrontVolume(int nValue) {
- try {
- WallpadStatusData DBMGR = new WallpadStatusData(mContext);
- boolean bResult = DBMGR.SetCallSound_DoorCamValue(WallpadStatusData.INDEX_CALL_DOORCAM_SOUND, nValue);
- DBMGR.closeDB();
- return bResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] setFrontVolume(int nValue)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- public static int getLobbyVolume() {
- try {
- WallpadStatusData DBMGR = new WallpadStatusData(mContext);
- int nResult = DBMGR.GetCallSound_DoorCamValue(WallpadStatusData.INDEX_CALL_LOBBY_SOUND);
- DBMGR.closeDB();
- if (nResult < 0) {
- LOG_WARN("[getLobbyVolume] Less than 0!! nResult [" + nResult + "]");
- nResult = 5;
- }
- return nResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return 5;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getLobbyVolume()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return 5;
- }
- }
- public static boolean setLobbyVolume(int nValue) {
- try {
- WallpadStatusData DBMGR = new WallpadStatusData(mContext);
- boolean bResult = DBMGR.SetCallSound_DoorCamValue(WallpadStatusData.INDEX_CALL_LOBBY_SOUND, nValue);
- DBMGR.closeDB();
- return bResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] setLobbyVolume(int nValue)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- public static int getGuardVolume() {
- try {
- WallpadStatusData DBMGR = new WallpadStatusData(mContext);
- int nResult = DBMGR.GetCallSound_DoorCamValue(WallpadStatusData.INDEX_CALL_GUARD_SOUND);
- DBMGR.closeDB();
- if (nResult < 0) {
- LOG_WARN("[getGuardVolume] Less than 0!! nResult [" + nResult + "]");
- nResult = 5;
- }
- return nResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return 5;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getGuardVolume()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return 5;
- }
- }
- public static boolean setGuardVolume(int nValue) {
- try {
- WallpadStatusData DBMGR = new WallpadStatusData(mContext);
- boolean bResult = DBMGR.SetCallSound_DoorCamValue(WallpadStatusData.INDEX_CALL_GUARD_SOUND, nValue);
- DBMGR.closeDB();
- return bResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] setGuardVolume(int nValue)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- public static int getResidenceVolume() {
- try {
- WallpadStatusData DBMGR = new WallpadStatusData(mContext);
- int nResult = DBMGR.GetCallSound_DoorCamValue(WallpadStatusData.INDEX_CALL_NEIGHBOR_SOUND);
- DBMGR.closeDB();
- if (nResult < 0) {
- LOG_WARN("[getResidenceVolume] Less than 0!! nResult [" + nResult + "]");
- nResult = 5;
- }
- return nResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return 5;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getResidenceVolume()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return 5;
- }
- }
- public static boolean setResidenceVolume(int nValue) {
- try {
- WallpadStatusData DBMGR = new WallpadStatusData(mContext);
- boolean bResult = DBMGR.SetCallSound_DoorCamValue(WallpadStatusData.INDEX_CALL_NEIGHBOR_SOUND, nValue);
- DBMGR.closeDB();
- return bResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] setResidenceVolume(int nValue)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- public static int getPSTNVolume() {
- try {
- WallpadStatusData DBMGR = new WallpadStatusData(mContext);
- int nResult = DBMGR.GetCallSound_DoorCamValue(WallpadStatusData.INDEX_CALL_PSTN_SOUND);
- DBMGR.closeDB();
- if (nResult < 0) {
- LOG_WARN("[getPSTNVolume] Less than 0!! nResult [" + nResult + "]");
- nResult = 5;
- }
- return nResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return 5;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getPSTNVolume()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return 5;
- }
- }
- public static boolean setPSTNVolume(int nValue) {
- try {
- WallpadStatusData DBMGR = new WallpadStatusData(mContext);
- boolean bResult = DBMGR.SetCallSound_DoorCamValue(WallpadStatusData.INDEX_CALL_PSTN_SOUND, nValue);
- DBMGR.closeDB();
- return bResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] setPSTNVolume(int nValue)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- public static int getFrontCamBrightness() {
- try {
- WallpadStatusData DBMGR = new WallpadStatusData(mContext);
- int nResult = DBMGR.GetCallSound_DoorCamValue(WallpadStatusData.INDEX_CALL_DOORCAM_BRIGHTNESS);
- DBMGR.closeDB();
- LOG_INFO("[getFrontCamBrightness] nResult [" + nResult + "]");
- if (nResult < 0) {
- LOG_WARN("[getFrontCamBrightness] Less than 0!! nResult [" + nResult + "]");
- nResult = 5;
- }
- return nResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return 5;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getFrontCamBrightness()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return 5;
- }
- }
- public static boolean setFrontCamBrightness(int nValue) {
- try {
- LOG_INFO("[setFrontCamBrightness] nValue [" + nValue + "]");
- WallpadStatusData DBMGR = new WallpadStatusData(mContext);
- boolean bResult = DBMGR.SetCallSound_DoorCamValue(WallpadStatusData.INDEX_CALL_DOORCAM_BRIGHTNESS, nValue);
- DBMGR.closeDB();
- return bResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] setFrontCamBrightness(int nValue)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- public static String getMultiCallInfo(CALLTYPE eCallType) {
- try {
- String strMultiCall = null;
- if (eCallType == CALLTYPE.GUARD) strMultiCall = "관할 경비실";
- else if (eCallType == CALLTYPE.LOBBY) strMultiCall = "공동현관";
- else if (eCallType == CALLTYPE.RESIDENCE) {
- LOG("[getMultiCallInfo] strName [" + RemoteIDInfo.strName + "]");
- strMultiCall = RemoteIDInfo.strName;
- }
- else LOG_WARN("[getMultiCallInfo] Invalid CALLTYPE!! eCallType [" + eCallType + "]");
- return strMultiCall;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return null;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getMultiCallInfo(CALLTYPE eCallType)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return null;
- }
- }
- public static void getConfigValues() {
- try {
- setDeviceType();
- applyDerivedType(ConfigValues.DEVICE_MODELTYPE);
- getDeviceSetupInfo();
- getDeviceAddress();
- getWallPadStatus();
- ConfigValues.printConfigValues();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
-
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getConfigValues()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public static class ConfigValueKeys {
- public static String GUARD_VIDEOCALL = "경비실영상통화";
- public static String DIGITALDOORLOCK = "디지털도어락";
- public static String WALLPAD_CAMERA = "월패드카메라";
- public static String WIRELESSREMOCON = "무선리모컨";
- public static String PSTN_SUBPHONE = "서브폰국선연동"; // 국선지원 여부
- public static String ARS_CONTROL_DEVICE = "ARS_CONTROL_DEVICE";
- public static String IP_EXPANSION = "IP대역확장";
- public static String CTRL_LIGHT = "조명제어기";
- public static String CTRL_LIGHT_TYPE_LIVING_ROOM = "대외기본형";
- public static String CTRL_LIGHT_TYPE_ROOMS = "대외각실형";
- public static String CTRL_THERMOSTAT = "온도조절기";
- public static String CTRL_GASVALVE = "가스밸브";
- public static String PSTN = "국선";
- public static String WIRELESS = "무선";
- public static String WIRED = "유선";
- public static String FINGERPRINT = "지문인식";
- public static String ENABLE_HOUSEDIVISION = "단지내임대세대";
- public static String SET_RENTHOUSE = "임대세대";
- public static String SET_SUBWALLPAD = "서브월패드";
- public static String SET_SUBWALLPAD_PSTN_USE = "서브월패드국선전화연동";
- public static String RELIEF_CALL = "안심통화";
- public static String REMOTE_CALL = "방문객원격통화";
- public static String SMART_KITCHEN = "스마트키친";
- public static String BATHPHONE_VOLUME = "욕실폰통화음량값";
- public static String KITCHENTV_VOLUME = "주방TV통화음량값";
- public static String ENABLE = "사용함";
- public static String DISABLE = "사용안함";
- public static String ENABLE_ENG = "enable";
- public static String DISABLE_ENG = "disable";
- }
- public enum WALLPADTYPE {
- MAIN, // 메인월패드(기본)
- SUB, // 서브월패드
- }
- public enum FRONTCAMERATYPE {
- BASIC,
- RF,
- SMARTKEY,
- SMARTKEY_EXTERNAL, // 대외스마트키현관카메라
- UKS,
- SMARTIOT, // 스마트현관카메라(현산)
- SMART_HS, // 스마트현관카메라(효성)
- SMART_DW, // 스마트현관카메라(대우)
- HD, // 대내HD현관카메라
- ETC
- }
- public enum SUBWALLPAD_PSTNTYPE {
- // (0:사용안함, 1:직접연동(별도국선라인), 2:메인요청(메인월패드연동)
- NOT_USE,
- DIRECT,
- VIA_MAIN
- }
- public enum DOORLOCKTYPE {
- NOT_USE, // 사용안함
- WIRELESS, // 무선
- WIRED, // 유선
- FINGERPRINT, // 지문인식
- }
- public static class ConfigValues {
- public static int DEVICE_BOARDTYPE = 0; // 디바이스 보드 종류
- public static int DEVICE_MODELTYPE = 0; // 디바이스 모델 종류
- public static int AOS_VERSION = 0; // OS Version
- public static GuardListTable mGuardListTable; // 경비실 목록
- public static String strDeviceIPaddress; // IP
- public static String strDong = ""; // 동정보
- public static String strHo = ""; // 호정보 (메인세대 : 101호, 분리세대 : 101-1호)
- public static String strHo_Main = ""; // 메인 호정보 (분리세대 시 "101"만 저장)
- public static String strHo_Extension = ""; // 메인 호정보 (분리세대 시 "-1"만 저장)
- public static WALLPADTYPE eWallPadType = WALLPADTYPE.MAIN; // 월패드 종류
- public static FRONTCAMERATYPE eFrontCameraType = FRONTCAMERATYPE.BASIC; // 현관카메라 종류
- public static boolean bGuardVideoEnable = false; // 경비실 영상통화
- public static boolean bWallPadCameraEnable = false; // 월패드 카메라
- public static boolean bWirelessRemoconEnable = false; // 무선리모컨
- public static boolean bSubPhonePSTNEnable = false; // 서브폰 국선통화 지원
- public static boolean bARSEnable = false; // ARS 모드 사용
- public static boolean bIPExpansion = false; // IP 대역 확장
- public static boolean bUnoccupiedMode = false; // 착신전환 (외출, 방범)
- public static boolean bPSTNEnable = false; // PSTN 사용 유무
- public static boolean bSubPhoneEnable = false; // 서브통화기기 연동 유무
- public static DOORLOCKTYPE eDoorLockType = DOORLOCKTYPE.WIRED; // 도어락 종류
- public static int nCtrlLight = 0;/// 1 : 현산형, 2 : 대외기본형, 3 : 대외각실형
- public static boolean bCtrlThermostat = false; // 온도조절기 사용유무
- public static boolean bCtrlGasValve = false; // 가스밸브 사용유무
- public static boolean bEnableHouseDivision = false; // 부분 임대형 세대 적용 단지
- public static boolean bSetRentHouse = false; // 임대세대 월패스 설정
- public static SUBWALLPAD_PSTNTYPE eSubWallPadPSTNType = SUBWALLPAD_PSTNTYPE.NOT_USE; // 서브월패드 국선전화 연동 종류
- public static boolean bReliefCall = false; // 안심통화 솔루션
- public static boolean bRemoteCall = false; // 방문객 원격통화 솔루션
- public static boolean bSmartKitchenUse = false; // 스마트키친
- public static boolean bEasyModeUse = false; // 간편모드 UX
- public static boolean bPlayBellUse = false; // 방문객원격통화 사용시 호출음 설정
- public static boolean bSmartIOTCamFlip = false; // 스마트현관카메라좌우반전 사용 유무 (기존 현관카메라의 경우 카메라영상이 반전되어 나오므로 월패드에서 좌우반전 실행(사용함) / 개선된 펌웨어 적용 현관카메라의 경우 좌우반전 사용안함)
- //** 서브기기 통화 볼륨 테이블
- public static int BATHPHONE_CNT = 0; // 욕실폰 개수
- public static int KITCHENTV_CNT = 0; // 주방TV 개수
- public static int[] BATHPHONE_FRONT = {-1, -1}; // TX/RX
- public static int[] BATHPHONE_LOBBY = {-1, -1};
- public static int[] BATHPHONE_GUARD = {-1, -1};
- public static int[] BATHPHONE_RESI = {-1, -1};
- public static int[] BATHPHONE_PSTN = {-1, -1};
- public static int[] KITCHENTV_FRONT = {-1, -1}; // TX/RX
- public static int[] KITCHENTV_LOBBY = {-1, -1};
- public static int[] KITCHENTV_GUARD = {-1, -1};
- public static int[] KITCHENTV_RESI = {-1, -1};
- public static int[] KITCHENTV_PSTN = {-1, -1};
- public static void printConfigValues() {
- LOG_INFO("[printConfigValues] DEVICE_BOARDTYPE [" + DEVICE_BOARDTYPE + "]");
- LOG_INFO("[printConfigValues] DEVICE_MODELTYPE [" + DEVICE_MODELTYPE + "]");
- LOG_INFO("[printConfigValues] strDeviceIPaddress [" + strDeviceIPaddress + "]");
- LOG_INFO("[printConfigValues] strDong [" + strDong + "]");
- LOG_INFO("[printConfigValues] strHo [" + strHo + "]");
- LOG_INFO("[printConfigValues] strHo_Main [" + strHo_Main + "]");
- LOG_INFO("[printConfigValues] strHo_Extension [" + strHo_Extension + "]");
- LOG_INFO("[printConfigValues] eWallPadType [" + eWallPadType + "]");
- LOG_INFO("[printConfigValues] eFrontCameraType [" + eFrontCameraType + "]");
- LOG_INFO("[printConfigValues] bGuardVideoEnable [" + bGuardVideoEnable + "]");
- LOG_INFO("[printConfigValues] bWallPadCameraEnable [" + bWallPadCameraEnable + "]");
- LOG_INFO("[printConfigValues] bWirelessRemoconEnable [" + bWirelessRemoconEnable + "]");
- LOG_INFO("[printConfigValues] bSubPhonePSTNEnable [" + bSubPhonePSTNEnable + "]");
- LOG_INFO("[printConfigValues] bARSEnable [" + bARSEnable + "]");
- LOG_INFO("[printConfigValues] bIPExpansion [" + bIPExpansion + "]");
- LOG_INFO("[printConfigValues] bUnoccupiedMode [" + bUnoccupiedMode + "]");
- LOG_INFO("[printConfigValues] bPSTNEnable [" + bPSTNEnable + "]");
- LOG_INFO("[printConfigValues] bSubPhoneEnable [" + bSubPhoneEnable + "]");
- LOG_INFO("[printConfigValues] eDoorLockType [" + eDoorLockType + "]");
- LOG_INFO("[printConfigValues] nCtrlLight [" + nCtrlLight + "]");
- LOG_INFO("[printConfigValues] bCtrlThermostat [" + bCtrlThermostat + "]");
- LOG_INFO("[printConfigValues] bCtrlGasValve [" + bCtrlGasValve + "]");
- LOG_INFO("[printConfigValues] bEnableHouseDivision [" + bEnableHouseDivision + "]");
- LOG_INFO("[printConfigValues] bSetRentHouse [" + bSetRentHouse + "]");
- LOG_INFO("[printConfigValues] eSubWallPadPSTNType [" + eSubWallPadPSTNType + "]");
- LOG_INFO("[printConfigValues] bReliefCall [" + bReliefCall + "]");
- LOG_INFO("[printConfigValues] bRemoteCall [" + bRemoteCall + "]");
- LOG_INFO("[printConfigValues] INTERNAL_SERVER_IP [" + Declare.VISITORREMOTECALL.INTERNAL_SERVER_IP + "], INTERNAL_SERVER_PORT [" + Declare.VISITORREMOTECALL.INTERNAL_SERVER_PORT + "]");
- LOG_INFO("[printConfigValues] bSmartKitchenUse [" + bSmartKitchenUse + "]");
- LOG_INFO("[printConfigValues] bEasyModeUse [" + bEasyModeUse + "]");
- LOG_INFO("[printConfigValues] bPlayBellUse [" + bPlayBellUse + "]");
- LOG_INFO("[printConfigValues] bSmartIOTCamFlip [" + bSmartIOTCamFlip + "]");
- LOG_INFO("[printConfigValues] BATHPHONE_CNT [" + BATHPHONE_CNT + "]");
- LOG_INFO("[printConfigValues] BATHPHONE_FRONT TX [" + BATHPHONE_FRONT[0] + "], RX [" + BATHPHONE_FRONT[1] + "]");
- LOG_INFO("[printConfigValues] BATHPHONE_LOBBY TX [" + BATHPHONE_LOBBY[0] + "], RX [" + BATHPHONE_LOBBY[1] + "]");
- LOG_INFO("[printConfigValues] BATHPHONE_GUARD TX [" + BATHPHONE_GUARD[0] + "], RX [" + BATHPHONE_GUARD[1] + "]");
- LOG_INFO("[printConfigValues] BATHPHONE_RESI TX [" + BATHPHONE_RESI[0] + "], RX [" + BATHPHONE_RESI[1] + "]");
- LOG_INFO("[printConfigValues] BATHPHONE_PSTN TX [" + BATHPHONE_PSTN[0] + "], RX [" + BATHPHONE_PSTN[1] + "]");
- LOG_INFO("[printConfigValues] KITCHENTV_CNT [" + KITCHENTV_CNT + "]");
- LOG_INFO("[printConfigValues] KITCHENTV_FRONT TX [" + KITCHENTV_FRONT[0] + "], RX [" + KITCHENTV_FRONT[1] + "]");
- LOG_INFO("[printConfigValues] KITCHENTV_LOBBY TX [" + KITCHENTV_LOBBY[0] + "], RX [" + KITCHENTV_LOBBY[1] + "]");
- LOG_INFO("[printConfigValues] KITCHENTV_GUARD TX [" + KITCHENTV_GUARD[0] + "], RX [" + KITCHENTV_GUARD[1] + "]");
- LOG_INFO("[printConfigValues] KITCHENTV_RESI TX [" + KITCHENTV_RESI[0] + "], RX [" + KITCHENTV_RESI[1] + "]");
- LOG_INFO("[printConfigValues] KITCHENTV_PSTN TX [" + KITCHENTV_PSTN[0] + "], RX [" + KITCHENTV_PSTN[1] + "]");
- }
- }
- public class BOARD_TYPE {
- public static final int V40_IGW300 = 1;
- public static final int V40 = 2;
- public static final int V40_IGW300_NOUGAT = 3;
- public static final int V40_NOUGAT = 4;
- }
- public static void setDeviceType() {
- try {
- ConfigValues.AOS_VERSION = Integer.parseInt(Build.VERSION.RELEASE.substring(0, 1));
- ConfigValues.DEVICE_MODELTYPE = Version.getModelType();
- ConfigValues.DEVICE_BOARDTYPE = getBoardType(ConfigValues.DEVICE_MODELTYPE);
- LOG("[setDeviceType] AOS_VERSION [" + ConfigValues.AOS_VERSION + "], DEVICE_BOARDTYPE [" + ConfigValues.DEVICE_BOARDTYPE + "]");
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] setDeviceType()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public static int getBoardType(int nModelType) {
- try {
- Log.i(TAG, "[getBoardType] nModelType [" + nModelType + "]");
- switch (nModelType) {
- case MODEL_TYPE.IHN_D101:
- case MODEL_TYPE.IHN_D101_I:
- case MODEL_TYPE.IHN_D101_I_LX2:
- case MODEL_TYPE.IHN_1010GL:
- case MODEL_TYPE.IHN_1010GL_I:
- case MODEL_TYPE.IHN_D101K:
- case MODEL_TYPE.IHN_D101K_I:
- case MODEL_TYPE.IHN_D101_I_OCF:
- case MODEL_TYPE.IHN_1010GL_I_2443:
- case MODEL_TYPE.IHN_1010GL_I_6410:
- if (ConfigValues.AOS_VERSION >= 7) return BOARD_TYPE.V40_IGW300_NOUGAT;
- else return BOARD_TYPE.V40_IGW300;
- case MODEL_TYPE.IHN_1010:
- case MODEL_TYPE.IHN_1010_I:
- case MODEL_TYPE.IHN_1010_I_LX2:
- case MODEL_TYPE.IHN_1030_I:
- case MODEL_TYPE.IHN_1040:
- case MODEL_TYPE.IHN_1040_I:
- case MODEL_TYPE.IHN_1050:
- case MODEL_TYPE.IHN_1050_I:
- case MODEL_TYPE.IHN_T1010:
- case MODEL_TYPE.IHN_T1010_I:
- case MODEL_TYPE.IHN_HS101:
- case MODEL_TYPE.IHN_HS101_I:
- case MODEL_TYPE.IHN_430:
- case MODEL_TYPE.IHN_430_I:
- case MODEL_TYPE.IHN_DW101_I:
- case MODEL_TYPE.IHN_1020B_I:
- case MODEL_TYPE.IHN_1303_I:
- if (ConfigValues.AOS_VERSION >= 7) return BOARD_TYPE.V40_NOUGAT;
- else return BOARD_TYPE.V40;
- default:
- return -99;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -99;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getBoardType(int nModelType)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -99;
- }
- }
- public static void applyDerivedType(int nModelType) {
- try {
- Log.i(TAG, "[applyDerivedType] nModelType [" + nModelType + "]");
- // 모델에 따른 설정정보를 정의한다.
- if (nModelType == MODEL_TYPE.IHN_D101 || nModelType == MODEL_TYPE.IHN_D101_I
- || nModelType == MODEL_TYPE.IHN_D101K || nModelType == MODEL_TYPE.IHN_D101K_I
- || nModelType == MODEL_TYPE.IHN_1010GL || nModelType == MODEL_TYPE.IHN_1010GL_I
- || nModelType == MODEL_TYPE.IHN_1010GL_I_2443 || nModelType == MODEL_TYPE.IHN_1010GL_I_6410
- || nModelType == MODEL_TYPE.IHN_D101_I_OCF || nModelType == MODEL_TYPE.IHN_D101_I_LX2) {
- ConfigValues.bPSTNEnable = true;
- ConfigValues.bSubPhoneEnable = true;
- ConfigValues.bWallPadCameraEnable = false;
- }
- else if (nModelType == MODEL_TYPE.IHN_1010 || nModelType == MODEL_TYPE.IHN_1010_I
- || nModelType == MODEL_TYPE.IHN_1030_I
- || nModelType == MODEL_TYPE.IHN_1040 || nModelType == MODEL_TYPE.IHN_1040_I
- || nModelType == MODEL_TYPE.IHN_1050 || nModelType == MODEL_TYPE.IHN_1050_I
- || nModelType == MODEL_TYPE.IHN_T1010 || nModelType == MODEL_TYPE.IHN_T1010_I
- || nModelType == MODEL_TYPE.IHN_HS101 || nModelType == MODEL_TYPE.IHN_HS101_I
- || nModelType == MODEL_TYPE.IHN_DW101_I || nModelType == MODEL_TYPE.IHN_1020B_I
- || nModelType == MODEL_TYPE.IHN_1303_I || nModelType == MODEL_TYPE.IHN_1010_I_LX2) {
- ConfigValues.bPSTNEnable = true;
- ConfigValues.bSubPhoneEnable = true;
- ConfigValues.bWallPadCameraEnable = true;
- }
- else if (nModelType == MODEL_TYPE.IHN_430 || nModelType == MODEL_TYPE.IHN_430_I) {
- ConfigValues.bPSTNEnable = false;
- ConfigValues.bSubPhoneEnable = false;
- ConfigValues.bWallPadCameraEnable = false;
- }
- else {
- ConfigValues.bPSTNEnable = true;
- ConfigValues.bSubPhoneEnable = true;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] applyDerivedType(int nModelType)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public static void getGuardInfoList() {
- try {
- List<String[]> GuardList = null;
- WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(mContext);
- GuardList = mWallpadDeviceSet.GetGuardList();
- ConfigValues.mGuardListTable = new GuardListTable();
- ConfigValues.mGuardListTable.clearTable();
- for (int i = 0; i < GuardList.size(); i++) {
- LOG_DEBUG("[getGuardInfoList] GuardList(" + i + ") = " + GuardList.get(i)[0] + "/" + GuardList.get(i)[1]);
- ConfigValues.mGuardListTable.addGuardTable(GuardList.get(i)[0], makeGuardIP(GuardList.get(i)[1]), null);
- }
- ConfigValues.mGuardListTable.printValue();
- mWallpadDeviceSet.closeDB();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getGuardInfoList()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public static String makeGuardIP(String GuardInfo) {
- try {
- if (ConfigValues.bIPExpansion) return GuardInfo; // IP 대역 확장 사용시 경비시 IP 정보를 수신한다.
- int nGuardInfo = Integer.parseInt(GuardInfo);
- if (9999 < nGuardInfo) {
- LOG_INFO("[makeGuardIP] nGuardInfo is bigger than 9999!!! [" + nGuardInfo + "]");
- return "10.0.128.10";
- }
- int IP_Dong = nGuardInfo / 100;
- int IP_ID = nGuardInfo % 100;
- if (99 < IP_Dong) {
- LOG_INFO("[makeGuardIP] IP_Dong is bigger than 99!!! [" + IP_Dong + "]");
- return "10.0.128.10";
- }
- if (99 < IP_ID) {
- LOG_INFO("[makeGuardIP] IP_ID is bigger than 99!!! [" + IP_ID + "]");
- return "10.0.128.10";
- }
- String strGuardIP = "10.0.128.10";
- if (ConfigValues.bIPExpansion) {
- int nDong = Integer.parseInt(getDongString());
- strGuardIP = (nDong / 100) + "." + IP_Dong + ".128." + IP_ID;
- } else strGuardIP = "10." + IP_Dong + ".128." + IP_ID;
- // LOG_INFO("[makeGuardIP] strGuardIP [" + strGuardIP + "]");
- return strGuardIP;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return "10.0.128.10";
- } catch (Exception e) {
- Log.e(TAG, "[Exception] makeGuardIP(String GuardInfo)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return "10.0.128.10";
- }
- }
- public static void getDeviceSetupInfo() {
- try {
- WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(mContext);
- if (mWallpadDeviceSet != null) {
- boolean anWallPadType = mWallpadDeviceSet.GetSubWpdUse(); // 월패드 종류 (TRUE: Sub / FALSE: Main)
- int[] anFrontCameraType = mWallpadDeviceSet.Get_RFDoorCAM_Info(); // 현관카메라 종류
- String[] astrDigitalDoorLock = mWallpadDeviceSet.GetSettingData(ConfigValueKeys.DIGITALDOORLOCK); // 디지털 도어락
- String[] astrGuardVideo = mWallpadDeviceSet.GetSettingData(ConfigValueKeys.GUARD_VIDEOCALL); // 경비실 영상통화
- String[] astrWallPadCamera = mWallpadDeviceSet.GetSettingData(ConfigValueKeys.WALLPAD_CAMERA); // 월패드 카메라
- String[] astrWirelessRemocon = mWallpadDeviceSet.GetSettingData(ConfigValueKeys.WIRELESSREMOCON); // 무선리모컨
- String[] astrSubPhonePSTN = mWallpadDeviceSet.GetSettingData(ConfigValueKeys.PSTN_SUBPHONE); // 서브폰 국선 지원
- String[] astrIPExpansion = mWallpadDeviceSet.GetSettingData(ConfigValueKeys.IP_EXPANSION); // IP 주소 확장
- String[] astrCtrlLight = mWallpadDeviceSet.GetSettingData(ConfigValueKeys.CTRL_LIGHT); // 조명제어
- String[] astrCtrlThermostat = mWallpadDeviceSet.GetSettingData(ConfigValueKeys.CTRL_THERMOSTAT); // 난방제어
- String[] astrCtrlGasValve = mWallpadDeviceSet.GetSettingData(ConfigValueKeys.CTRL_GASVALVE); // 가스밸브
- String[] astrEnableHouseDivision = mWallpadDeviceSet.GetSettingData(ConfigValueKeys.ENABLE_HOUSEDIVISION); // 부분임대형 세대 적용 단지
- String[] astrSetRentHouse = mWallpadDeviceSet.GetSettingData(ConfigValueKeys.SET_RENTHOUSE); // 임대세대 월패드 설정
- String[] astrSetSubWallPadPSTNType = mWallpadDeviceSet.GetSettingData(ConfigValueKeys.SET_SUBWALLPAD_PSTN_USE); // 서브월패드국선전화연동
- String[] astrReliefCall = mWallpadDeviceSet.GetSettingData(ConfigValueKeys.RELIEF_CALL); // 안심통화 솔루션
- String[] astrRemoteCall = mWallpadDeviceSet.GetSettingData(ConfigValueKeys.REMOTE_CALL); // 방문객 원격통화 솔루션
- String[] astrSmartKitchen = mWallpadDeviceSet.GetSettingData(ConfigValueKeys.SMART_KITCHEN); // 스마트키친
- List<String[]> GuardList = mWallpadDeviceSet.GetGuardList(); // 경비실기 항목
- boolean bEasyModeSupport = mWallpadDeviceSet.Get_EasyModeUX_Support();
- ConfigValues.bSmartIOTCamFlip = mWallpadDeviceSet.Get_SmartIOTCamFlipUse(); // 스마트현관카메라좌우반전 사용 여부
- mWallpadDeviceSet.closeDB();
- WallpadStatusData mWallpadStatusData = new WallpadStatusData(mContext);
- ConfigValues.bARSEnable = mWallpadStatusData.GetArsControl(); // ARS 제어 사용 여부
- ConfigValues.bEasyModeUse = bEasyModeSupport & mWallpadStatusData.GetEasyModeUxUse(); // 간편모드 사용 여부
- ConfigValues.bPlayBellUse = mWallpadStatusData.GetCallSoundOfEventAlarm(); // 호출음 설정 여부
- mWallpadStatusData.closeDB();
- // ARS 사용 여부
- if (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40 || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
- ConfigValues.bARSEnable = false; // TODO ARS 설정여부 DB 수정 후 삭제
- }
- // 월패드 종류
- if (!anWallPadType) ConfigValues.eWallPadType = WALLPADTYPE.MAIN;
- else ConfigValues.eWallPadType = WALLPADTYPE.SUB;
- LOG_INFO("[getDeviceSetupInfo] ConfigValues.eWallPadType [" + ConfigValues.eWallPadType + "]");
- // 서브월패드일 경우에만(국선전화 연동 타입)
- if (ConfigValues.eWallPadType == WALLPADTYPE.SUB) {
- if (astrSetSubWallPadPSTNType != null) {
- if (astrSetSubWallPadPSTNType[1].contains(ConfigValueKeys.SET_SUBWALLPAD_PSTN_USE)) {
- if (astrSetSubWallPadPSTNType[1].equals("직접연동")) ConfigValues.eSubWallPadPSTNType = SUBWALLPAD_PSTNTYPE.DIRECT;
- else if (astrSetSubWallPadPSTNType[1].equals("메인요청")) ConfigValues.eSubWallPadPSTNType = SUBWALLPAD_PSTNTYPE.VIA_MAIN;
- }
- else {
- ConfigValues.eSubWallPadPSTNType = SUBWALLPAD_PSTNTYPE.NOT_USE;
- }
- } else {
- LOG_DEBUG("[getDeviceSetupInfo] astrSetSubWallPadPSTNUse is null!!");
- }
- }
- // 현관카메라 종류
- if (anFrontCameraType != null) {
- if ((anFrontCameraType[1] == WallpadDeviceSet.DOORTYPE_BASIC)) ConfigValues.eFrontCameraType = FRONTCAMERATYPE.BASIC;
- else if ((anFrontCameraType[1] == WallpadDeviceSet.DOORTYPE_RFCAM)) ConfigValues.eFrontCameraType = FRONTCAMERATYPE.RF;
- else if ((anFrontCameraType[1] == WallpadDeviceSet.DOORTYPE_SMARTKEY)) ConfigValues.eFrontCameraType = FRONTCAMERATYPE.SMARTKEY;
- else if ((anFrontCameraType[1] == WallpadDeviceSet.DOORTYPE_SMARTKEY_EXTERNAL)) ConfigValues.eFrontCameraType = FRONTCAMERATYPE.SMARTKEY_EXTERNAL;
- else if ((anFrontCameraType[1] == WallpadDeviceSet.DOORTYPE_IOT_SMART)) ConfigValues.eFrontCameraType = FRONTCAMERATYPE.SMARTIOT;
- else if ((anFrontCameraType[1] == WallpadDeviceSet.DOORTYPE_UKS)) ConfigValues.eFrontCameraType = FRONTCAMERATYPE.UKS;
- else if ((anFrontCameraType[1] == WallpadDeviceSet.DOORTYPE_HYOSUNG_SMART)) ConfigValues.eFrontCameraType = FRONTCAMERATYPE.SMART_HS;
- else if ((anFrontCameraType[1] == WallpadDeviceSet.DOORTYPE_DAEWOO_SMART)) ConfigValues.eFrontCameraType = FRONTCAMERATYPE.SMART_DW;
- else if ((anFrontCameraType[1] == WallpadDeviceSet.DOORTYPE_HDCAM)) ConfigValues.eFrontCameraType = FRONTCAMERATYPE.HD;
- else if ((anFrontCameraType[1] == WallpadDeviceSet.DOORTYPE_ETC)) ConfigValues.eFrontCameraType = FRONTCAMERATYPE.ETC;
- } else {
- LOG_DEBUG("[getDeviceSetupInfo] anFrontCameraType is null!!");
- }
- // 경비실 영상통화
- if (astrGuardVideo != null) {
- if (astrGuardVideo[1].contains(ConfigValueKeys.GUARD_VIDEOCALL)) {
- if (astrGuardVideo[1].contains(ConfigValueKeys.ENABLE)) ConfigValues.bGuardVideoEnable = true;
- else ConfigValues.bGuardVideoEnable = false;
- }
- else ConfigValues.bGuardVideoEnable = false;
- }
- else {
- LOG_DEBUG("[getDeviceSetupInfo] astrGuardVideo is null!!");
- }
- // 월패드 카메라
- if (astrWallPadCamera != null) {
- if (astrWallPadCamera[1].contains(ConfigValueKeys.WALLPAD_CAMERA)) {
- if (astrWallPadCamera[1].contains(ConfigValueKeys.ENABLE)) ConfigValues.bWallPadCameraEnable = true;
- else ConfigValues.bWallPadCameraEnable = false;
- }
- else ConfigValues.bWallPadCameraEnable = false;
- }
- else {
- LOG_DEBUG("[getDeviceSetupInfo] astrWallPadCamera is null!!");
- }
- // 디지털 도어락
- if (astrDigitalDoorLock != null) {
- if (astrDigitalDoorLock[1].contains(ConfigValueKeys.DIGITALDOORLOCK)) {
- if (astrDigitalDoorLock[1].contains(ConfigValueKeys.ENABLE)) {
- if (astrDigitalDoorLock[1].contains(ConfigValueKeys.WIRELESS))
- ConfigValues.eDoorLockType = DOORLOCKTYPE.WIRELESS;
- else if (astrDigitalDoorLock[1].contains(ConfigValueKeys.FINGERPRINT))
- ConfigValues.eDoorLockType = DOORLOCKTYPE.FINGERPRINT;
- else if (astrDigitalDoorLock[1].contains(ConfigValueKeys.WIRED))
- ConfigValues.eDoorLockType = DOORLOCKTYPE.WIRED;
- } else {
- ConfigValues.eDoorLockType = DOORLOCKTYPE.NOT_USE;
- }
- }
- } else {
- LOG_DEBUG("[getDeviceSetupInfo] astrDigitalDoorLock is null!!");
- }
- // 무선리모컨
- if (astrWirelessRemocon != null) {
- if (astrWirelessRemocon[1].contains(ConfigValueKeys.WIRELESSREMOCON)) {
- if (astrWirelessRemocon[1].contains(ConfigValueKeys.ENABLE)) ConfigValues.bWirelessRemoconEnable = true;
- else ConfigValues.bWirelessRemoconEnable = false;
- }
- else ConfigValues.bWirelessRemoconEnable = false;
- }
- else {
- LOG_DEBUG("[getDeviceSetupInfo] astrWirelessRemocon is null!!");
- }
- // 서브폰 국선연동(주방TV, 욕실폰, 욕실TV)
- if (astrSubPhonePSTN != null) {
- if (astrSubPhonePSTN[1].contains(ConfigValueKeys.PSTN_SUBPHONE)) {
- if (astrSubPhonePSTN[1].contains(ConfigValueKeys.ENABLE)) ConfigValues.bSubPhonePSTNEnable = true;
- else ConfigValues.bSubPhonePSTNEnable = false;
- }
- else ConfigValues.bSubPhonePSTNEnable = false;
- }
- else {
- LOG_DEBUG("[getDeviceSetupInfo] astrSubPhonePSTN is null!!");
- }
- // IP 주소 확장
- if (astrIPExpansion != null) {
- if (astrIPExpansion[1].contains(ConfigValueKeys.IP_EXPANSION)) {
- if (astrIPExpansion[1].contains(ConfigValueKeys.ENABLE)) ConfigValues.bIPExpansion = true;
- else ConfigValues.bIPExpansion = false;
- }
- else ConfigValues.bIPExpansion = false;
- }
- else {
- LOG_DEBUG("[getDeviceSetupInfo] astrIPExpansion is null!!");
- }
- // 조명제어
- if (ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_IGW300 || ConfigValues.DEVICE_BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
- ConfigValues.nCtrlLight = 1;
- }
- else {
- if (astrCtrlLight != null) {
- if (astrCtrlLight[1].contains(ConfigValueKeys.CTRL_LIGHT)) {
- if (astrCtrlLight[1].contains(ConfigValueKeys.ENABLE)) {
- if (astrCtrlLight[1].contains(ConfigValueKeys.CTRL_LIGHT_TYPE_LIVING_ROOM)) {
- ConfigValues.nCtrlLight = 2;
- } else if (astrCtrlLight[1].contains(ConfigValueKeys.CTRL_LIGHT_TYPE_ROOMS)) {
- ConfigValues.nCtrlLight = 3;
- } else {
- ConfigValues.nCtrlLight = 0;
- }
- } else ConfigValues.nCtrlLight = 0;
- } else ConfigValues.nCtrlLight = 0;
- } else {
- LOG_DEBUG("[getDeviceSetupInfo] astrCtrlLight is null!!");
- }
- }
- // 난방제어
- if (astrCtrlThermostat != null) {
- if (astrCtrlThermostat[1].contains(ConfigValueKeys.CTRL_THERMOSTAT)) {
- if (astrCtrlThermostat[1].contains(ConfigValueKeys.ENABLE)) ConfigValues.bCtrlThermostat = true;
- else ConfigValues.bCtrlThermostat = false;
- }
- else ConfigValues.bCtrlThermostat = false;
- }
- else {
- LOG_DEBUG("[getDeviceSetupInfo] astrCtrlThermostat is null!!");
- }
- // 가스밸브
- if (astrCtrlGasValve != null) {
- if (astrCtrlGasValve[1].contains(ConfigValueKeys.CTRL_GASVALVE)) {
- if (astrCtrlGasValve[1].contains(ConfigValueKeys.ENABLE)) ConfigValues.bCtrlGasValve = true;
- else ConfigValues.bCtrlGasValve = false;
- }
- else ConfigValues.bCtrlGasValve = false;
- }
- else {
- LOG_DEBUG("[getDeviceSetupInfo] astrCtrlGasValve is null!!");
- }
- // 부분임대형 세대 적용 단지
- if (astrEnableHouseDivision != null) {
- if (astrEnableHouseDivision[1].contains(ConfigValueKeys.ENABLE_HOUSEDIVISION)) {
- if (astrEnableHouseDivision[1].contains(ConfigValueKeys.ENABLE)) ConfigValues.bEnableHouseDivision = true;
- else ConfigValues.bEnableHouseDivision = false;
- }
- else ConfigValues.bEnableHouseDivision = false;
- }
- else {
- LOG_DEBUG("[getDeviceSetupInfo] astrEnableHouseDivision is null!!");
- }
- // 임대세대 월패드 설정
- if (astrSetRentHouse != null) {
- if (astrSetRentHouse[1].contains(ConfigValueKeys.SET_RENTHOUSE)) {
- if (astrSetRentHouse[1].contains(ConfigValueKeys.ENABLE)) ConfigValues.bSetRentHouse = true;
- else ConfigValues.bSetRentHouse = false;
- }
- else ConfigValues.bSetRentHouse = false;
- }
- else {
- LOG_DEBUG("[getDeviceSetupInfo] astrSetRentHouse is null!!");
- }
- // 안심통화 솔루션 설정
- if (astrReliefCall != null) {
- if (astrReliefCall[1].contains(ConfigValueKeys.RELIEF_CALL)) {
- if (astrReliefCall[1].contains(ConfigValueKeys.ENABLE)) ConfigValues.bReliefCall = true;
- else ConfigValues.bReliefCall = false;
- }
- else ConfigValues.bReliefCall = false;
- }
- else {
- LOG_DEBUG("[getDeviceSetupInfo] astrReliefCall is null!!");
- }
- // 방문객 원격통화 솔루션
- if (astrRemoteCall != null) {
- if (astrRemoteCall[1].contains(ConfigValueKeys.REMOTE_CALL)) {
- if (astrRemoteCall[1].contains(ConfigValueKeys.ENABLE)) ConfigValues.bRemoteCall = true;
- else ConfigValues.bRemoteCall = false;
- }
- else ConfigValues.bRemoteCall = false;
- }
- else {
- LOG_DEBUG("[getDeviceSetupInfo] astrRemoteCall is null!!");
- }
- // 스마트키친(레시피연동 주방TV) 사용여부
- if (astrSmartKitchen != null) {
- if (astrSmartKitchen[1].contains(ConfigValueKeys.SMART_KITCHEN)) {
- if (astrSmartKitchen[1].contains(ConfigValueKeys.ENABLE)) ConfigValues.bSmartKitchenUse = true;
- else ConfigValues.bSmartKitchenUse = false;
- }
- else ConfigValues.bSmartKitchenUse = false;
- }
- else {
- LOG_DEBUG("[getDeviceSetupInfo] astrSmartKitchen is null!!");
- }
- // 경비실기 항목
- ConfigValues.mGuardListTable = new GuardListTable();
- ConfigValues.mGuardListTable.clearTable();
- if (GuardList.size() > 0) {
- for (int i = 0; i < GuardList.size(); i++) {
- // LOG_DEBUG("[getDeviceSetupInfo] GuardList(" + i + ") = " + GuardList.get(i)[0] + "/" + GuardList.get(i)[1]);
- ConfigValues.mGuardListTable.addGuardTable(GuardList.get(i)[0], makeGuardIP(GuardList.get(i)[1]), null);
- }
- ConfigValues.mGuardListTable.printValue();
- } else {
- LOG_WARN("[getDeviceSetupInfo] NO GuardList!!");
- }
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getDeviceSetupInfo()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public static List<String> parseDevInfo(String devInfo) {
- List<String> result = null;
- if (devInfo == null)
- return null;
- try {
- int idx = devInfo.indexOf("(");
- if (idx > 0) {
- result = new ArrayList();
- String devNo = devInfo.substring(0, idx);
- result.add(devNo.trim());
- int startIdx = devInfo.indexOf(":", idx + 1);
- if (startIdx > 0) {
- String circuitCount = devInfo.substring(idx + 1, startIdx);
- result.add(circuitCount.trim());
- }
- idx = startIdx;
- int endIdx = devInfo.lastIndexOf(")");
- if ((startIdx > 0) && (endIdx > 0)) {
- int midIdx = devInfo.indexOf("(", startIdx + 1);
- Log.d(TAG, "midIdx : " + midIdx);
- while (midIdx > startIdx) {
- String title = devInfo.substring(startIdx + 1, midIdx);
- result.add(title.trim());
- idx = devInfo.indexOf(")", midIdx + 1);
- if (idx > 0) {
- String detail = devInfo.substring(midIdx + 1, idx);
- result.add(detail.trim());
- }
- startIdx = idx;
- midIdx = devInfo.indexOf("(", idx + 1);
- }
- }
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] parseDevInfo(String devInfo)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- return result;
- }
- public static void getDeviceAddress() {
- try {
- wallpaddbmgr DBMGR = new wallpaddbmgr(mContext);
- AddressSet mAddressSet = DBMGR.getAddressMGR();
- DBMGR.closeDB();
- ConfigValues.bSetRentHouse = mAddressSet.UseOrNotRentHouse;
- ConfigValues.strDong = mAddressSet.Dong;
- if (ConfigValues.bSetRentHouse) {
- ConfigValues.strHo = mAddressSet.Ho;
- String[] astrHo = mAddressSet.Ho.split("-");
- ConfigValues.strHo_Main = astrHo[0];
- ConfigValues.strHo_Extension = "-" + astrHo[1];
- } else {
- ConfigValues.strHo = mAddressSet.Ho;
- ConfigValues.strHo_Main = ConfigValues.strHo;
- ConfigValues.strHo_Extension = "";
- }
- ConfigValues.strDeviceIPaddress = getDeviceIPAddress();
- LOG_DEBUG("[getDeviceAddress] ConfigValues.strDeviceIPaddress [" + ConfigValues.strDeviceIPaddress + "], ConfigValues.bSetRentHouse [" + ConfigValues.bSetRentHouse + "], ConfigValues.strDong [" + ConfigValues.strDong + "]");
- LOG_DEBUG("[getDeviceAddress] ConfigValues.strHo [" + ConfigValues.strHo + "], ConfigValues.strHo_Main [" + ConfigValues.strHo_Main + "], ConfigValues.strHo_Extension [" + ConfigValues.strHo_Extension + "]");
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getDeviceAddress()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public static void getWallPadStatus() {
- try {
- WallpadStatusData wdb = new WallpadStatusData(mContext);
- int nStatus = wdb.GetAlarmStatus();
- wdb.closeDB();
- if (WallpadStatusData.GUARD_OUT == nStatus || WallpadStatusData.OUT_MODE == nStatus)
- ConfigValues.bUnoccupiedMode = true;
- else ConfigValues.bUnoccupiedMode = false;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getWallPadStatus()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public static int getConfigSystemVolume() {
- try {
- // 시스템 볼륨
- WallpadStatusData wd = new WallpadStatusData(mContext); // 셋팅 전 원래 시스템 볼륨값 저장
- int nVolumeLevel = wd.GetWallPadMasterVolume();
- wd.closeDB();
- Log.d(TAG, "[getConfigSystemVolume] nVolumeLevel: " + nVolumeLevel);
- return nVolumeLevel;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -1;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getConfigSystemVolume()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -1;
- }
- }
- private static String getIPAddress() {
- try {
- // LOG("[getIPAddress] START!");
- // 메이드인랩 김수진 선임 (A0S 7.0)
- if (ConfigValues.AOS_VERSION >= 7) {
- List<NetworkInterface> interfaces = Collections.list(NetworkInterface.getNetworkInterfaces());
- for (NetworkInterface intf : interfaces) {
- List<InetAddress> addrs = Collections.list(intf.getInetAddresses());
- for (InetAddress addr : addrs) {
- if (!addr.isLoopbackAddress()) {
- String sAddr = addr.getHostAddress();
- boolean isIPv4 = sAddr.indexOf(':') < 0;
- if (isIPv4)
- return sAddr;
- }
- }
- }
- }
- else {
- // 기존코드 (AOS 6.0)
- String strResult = "";
- String strNetInfo = "";
- if(NetworkInterface.getByName("eth0")!=null)
- strNetInfo = NetworkInterface.getByName("eth0").toString();
- LOG_DEBUG("strNetInfo " + strNetInfo);
- strNetInfo.trim();
- String[] Parse_01 = strNetInfo.split("\\]");
- String[] Parse_02 = Parse_01[Parse_01.length - 1].split("\\/");
- strResult = Parse_02[1];
- LOG("[getIPAddress] DONE! [IP Address : " + strResult + "]");
- return strResult;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getIPAddress()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- return "";
- }
- private static String getDeviceIPAddress() {
- try {
- String strIPResult = getIPAddress();
- LOG_INFO("[getDeviceIPAddress] strIPResult [" + strIPResult + "]");
- int nMaxTryCnt = 10;
- int nCnt = 0;
- while ((!validateIPAddress(strIPResult)) && (nCnt < nMaxTryCnt)) {
- Thread.sleep(1000);
- SIPStack.strLocalip = getIPAddress();
- nCnt++;
- }
- LOG_INFO("[getDeviceIPAddress] After while loof!! strIPResult [" + strIPResult + "], nCnt [" + nCnt + "]");
- return strIPResult;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return null;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getDeviceIPAddress()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return null;
- }
- }
- private static Pattern mPattern = Pattern.compile("^(([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.){3}([01]?\\d\\d?|2[0-4]\\d|25[0-5])$");
- private static boolean validateIPAddress(String IPAddress) {
- try {
- Log.i(TAG, "[validateIPAddress] IPAddress [" + IPAddress + "]");
- if (IPAddress == null) return false;
- return mPattern.matcher(IPAddress).matches();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] validateIPAddress(String IPAddress)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- public static CALLTYPE getCallType(String strIPAddress) {
- try {
- LOG_INFO("[getCallType] strIPAddress [" + strIPAddress + "]");
- if (strIPAddress.contains("FRONT")) return CALLTYPE.FRONT;
- else if (strIPAddress.contains("PSTN")) return CALLTYPE.PSTN;
- else if (strIPAddress.contains("HOMEVIEW")) return CALLTYPE.RESIDENCE;
- else {
- String[] IP_Parse = strIPAddress.split("\\.");
- if (IP_Parse[2].equals("128")) return CALLTYPE.GUARD;
- else if (IP_Parse[2].equals("0"))
- {
- if(IP_Parse[3].equals("11"))
- return CALLTYPE.FRONT;
- return CALLTYPE.LOBBY;
- }
- else if (IP_Parse[2].equals("201")) return CALLTYPE.IHUB;
- else if (IP_Parse[2].equals("129")) return CALLTYPE.FRONT;
- else return CALLTYPE.RESIDENCE;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return CALLTYPE.NONE;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getCallType(String strIPAddress)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return CALLTYPE.NONE;
- }
- }
- public static boolean ctrlFrontDoorOpen() {
- try {
- Log.i(TAG, "[ctrlFrontDoorOpen] eDoorLockType [" + ConfigValues.eDoorLockType + "]");
- if (((MainActivity) mContext).mWallPadAPI != null && ((MainActivity) mContext).mWallPadAPI.Check_Connect()) {
- if (ConfigValues.eDoorLockType == DOORLOCKTYPE.WIRED || ConfigValues.eDoorLockType == DOORLOCKTYPE.WIRELESS) {
- int nResult = ((MainActivity) mContext).mWallPadAPI.SetDoorLock_Open();
- Log.i(TAG, "[ctrlFrontDoorOpen] nResult [" + nResult + "]");
- if (0 <= nResult) {
- Log.i(TAG, "[ctrlFrontDoorOpen] Door open success!!");
- return true;
- } else {
- Log.w(TAG, "[ctrlFrontDoorOpen] Door open fail!!");
- return false;
- }
- } else if (ConfigValues.eDoorLockType == DOORLOCKTYPE.FINGERPRINT) {
- if (((MainActivity) mContext).fpDlockAPI != null) {
- int nResult = (((MainActivity) mContext).fpDlockAPI).SetDoorOpen();
- if (0 <= nResult) {
- Log.i(TAG, "[ctrlFrontDoorOpen] Door open success!!");
- return true;
- } else {
- Log.w(TAG, "[ctrlFrontDoorOpen] Door open fail!!");
- return false;
- }
- } else {
- Log.w(TAG, "[ctrlFrontDoorOpen] fpDlockAPI is null!!");
- return false;
- }
- } else {
- Log.w(TAG, "[ctrlFrontDoorOpen] Not Supported DOORLOCKTYPE [" + ConfigValues.eDoorLockType + "]");
- return false;
- }
- } else {
- if (((MainActivity) mContext).mWallPadAPI == null) Log.w(TAG, "[ctrlFrontDoorOpen] mWallPadAPI is null!!");
- if(((MainActivity) mContext).mWallPadAPI!=null)
- {
- if (!((MainActivity) mContext).mWallPadAPI.Check_Connect()) Log.w(TAG, "[ctrlFrontDoorOpen] mWallPadAPI did not connected!!");
- }
- return false;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] ctrlFrontDoorOpen()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- /**
- * 무선 도어락 문열림<br>
- * JNI 호출을 실행하는 함수<br>
- *
- * @return boolean (무선도어락 제어 실행 결과 : true | false)
- */
- public static boolean openWirleseDoorLock() {
- try {
- if (-1 < MainActivity.mIOInterface.openWirelessDoorlock()) {
- return true;
- } else {
- Log.i(TAG, "[openWirleseDoorLock] openWireless : false");
- return false;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] openWirleseDoorLock()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
- }
- /**
- * 현관 통화 중 문열림 알림을 보내는 함수
- */
- public static void notifyDoorLockOpen(boolean bOpen) {
- try {
- Log.d(TAG, "[notifyDoorLockOpen] bOpen [" + bOpen + "");
- int kind;
- if (bOpen) kind = define.NOTIFY_DOORLOCK_OPEN_RECORDING;
- else kind = define.NOTIFY_FRONTCALL_END_RECORDING;
- Intent mIntent = new Intent();
- mIntent.setAction(define.NOTIFY_ACNAME);
- mIntent.putExtra(define.NOTIBR_KIND, kind);
- mContext.sendBroadcast(mIntent);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] notifyDoorLockOpen()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /**
- * 제어기기 영업샘플모드 활성화 상태를 가져온다.
- *
- * @return (boolean) true : 활성 , false : 비활성 or 에러
- */
- public static boolean GetDeviceSampleMode() {
- try {
- WallpadSalesSampleData wssd = new WallpadSalesSampleData(mContext);
- int mode = wssd.getSalesSampleData(WallpadSalesSampleData.SALES_SAMPLE_MODE_DEVICE_CONTROLLER);
- wssd.closeDB();
- Log.d("Common", "[GetSampleMode] mode = " + mode);
- if (mode == 1) return true;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Excpetion] GetDeviceSampleMode(Context context)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- return false;
- }
- /**
- * 이통사 연동 서비스를 위한 BR
- * 방문자 사진이 발생 할때 BR 을 전송한다.
- *
- * @param kind (String) "lobby" or "home"
- * @param datetime (String) 20170821150431 or 20170821_150431 or 2017_08_21_15_04_31
- */
- public static void sendVisitorEventBRtoMobileVendor(String kind, String datetime) {
- try {
- Log.i(TAG, "[sendVisitorEventBRtoMobileVendor] kind [" + kind + "], datetime [" + datetime + "]");
- final String BR_ACTION_BASE = "kr.co.icontrols.mobileservice.BR_";
- final int BASE = define.BR_COM_MOBILE_SERVICE;
- final String BR_VISITOR_EVENT = BR_ACTION_BASE + "VISITOR_EVENT_HDC" + "(" + BASE + ")";
- Intent mIntent = new Intent();
- mIntent.setAction(BR_VISITOR_EVENT);
- mIntent.putExtra("KIND", kind);
- mIntent.putExtra("TIME", datetime);
- mContext.sendBroadcast(mIntent);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] sendVisitorEventBRtoMobileVendor(String kind , String datetime)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /**
- * CALLOWNER 정보를 토대로 주방TV Index값 얻기
- * @param eCallOwner: KITCHEN_TV_01 ~ KITCHEN_TV_10
- * @return 주방TV Index: 0 ~ 9
- */
- public static int getKitchenTVIdx(CALLOWNER eCallOwner) {
- try {
- if (eCallOwner == CALLOWNER.NONE || !isKitchenTV(eCallOwner)) return -1;
- int nIdx = Integer.parseInt(eCallOwner.toString().substring(11));
- LOG_DEBUG("[getKitchenTVIdx(eCallOwner)] nIdx [" + (nIdx-1) + "]");
- return nIdx -1;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -1;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getKitchenTVIdx(eCallOwner)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -1;
- }
- }
- /**
- * ID 정보를 토대로 주방TV Index값 얻기
- * @param hID: (byte) 0x02 ~ (byte) 0x92
- * @return 주방TV Index: 0 ~ 9
- */
- public static int getKitchenTVIdx(byte hID) {
- try {
- int nID = Integer.parseInt(HextoString(hID));
- if ((nID % 10 != 2) ||
- (nID < Integer.parseInt(HextoString(SubPhoneCmds.ID_KITCHENTV[0]))) ||
- (nID > Integer.parseInt(HextoString(SubPhoneCmds.ID_KITCHENTV[9])))) return -1;
- int nIdx = (int) HextoString(hID).charAt(0) - 48;
- LOG_DEBUG("[getKitchenTVIdx(hID)] nIdx [" + nIdx + "]");
- return nIdx;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -1;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getKitchenTVIdx(hID)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -1;
- }
- }
- private static boolean isKitchenTV(CALLOWNER eCallOwner) {
- boolean bResult = false;
- if (eCallOwner.toString().contains("KITCHEN_TV"))
- bResult = true;
- LOG_DEBUG("[isKitchenTV(eCallOwner)] bResult [" + bResult + "]");
- return bResult;
- }
- public static CALLOWNER getKitchenTVOwner(int idx) {
- LOG("[getKitchenTVOwner] idx [" + idx + "]");
- CALLOWNER eCallOwner;
- try {
- switch (idx) {
- case 0:
- eCallOwner = CALLOWNER.KITCHEN_TV_01;
- break;
- case 1:
- eCallOwner = CALLOWNER.KITCHEN_TV_02;
- break;
- case 2:
- eCallOwner = CALLOWNER.KITCHEN_TV_03;
- break;
- case 3:
- eCallOwner = CALLOWNER.KITCHEN_TV_04;
- break;
- case 4:
- eCallOwner = CALLOWNER.KITCHEN_TV_05;
- break;
- case 5:
- eCallOwner = CALLOWNER.KITCHEN_TV_06;
- break;
- case 6:
- eCallOwner = CALLOWNER.KITCHEN_TV_07;
- break;
- case 7:
- eCallOwner = CALLOWNER.KITCHEN_TV_08;
- break;
- case 8:
- eCallOwner = CALLOWNER.KITCHEN_TV_09;
- break;
- case 9:
- eCallOwner = CALLOWNER.KITCHEN_TV_10;
- break;
- default:
- eCallOwner = CALLOWNER.NONE;
- break;
- }
- LOG_DEBUG("[getKitchenTVOwner] eCallOwner = " + eCallOwner);
- return eCallOwner;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return CALLOWNER.NONE;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getKitchenTVOwner(idx)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return CALLOWNER.NONE;
- }
- }
- public static int getBathPhoneIdx(CALLOWNER eCallOwner) {
- try {
- if (eCallOwner == CALLOWNER.NONE || !isBathPhone(eCallOwner)) return -1;
- int nIdx = Integer.parseInt(eCallOwner.toString().substring(11));
- LOG_DEBUG("[getBathPhoneIdx(eCallOwner)] nIdx [" + (nIdx-1) + "]");
- return nIdx - 1;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -1;
- } catch (Exception e) {
- Log.e(TAG ,"[Exception] getBathPhoneIdx(eCallOwner)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -1;
- }
- }
- public static int getBathPhoneIdx(byte hID) {
- try {
- int nID = Integer.parseInt(HextoString(hID));
- if ((nID % 10 != 3) ||
- (nID < Integer.parseInt(HextoString(SubPhoneCmds.ID_BATHPHONE[0]))) ||
- (nID > Integer.parseInt(HextoString(SubPhoneCmds.ID_BATHPHONE[9])))) return -1;
- int nIdx = (int) HextoString(hID).charAt(0) - 48;
- LOG_DEBUG("[getBathPhoneIdx(hID)] nIdx [" + nIdx + "]");
- return nIdx;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -1;
- } catch (Exception e) {
- Log.e(TAG ,"[Exception] getBathPhoneIdx(hID)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -1;
- }
- }
- private static boolean isBathPhone(CALLOWNER eCallOwner) {
- boolean bResult = false;
- if (eCallOwner.toString().contains("BATH_PHONE"))
- bResult = true;
- LOG_DEBUG("[isBathPhone(eCallOwner)] bResult [" + bResult + "]");
- return bResult;
- }
- public static CALLOWNER getBathPhoneOwner(int idx) {
- LOG("[getBathPhoneOwner] idx [" + idx + "]");
- CALLOWNER eCallOwner;
- try {
- switch (idx) {
- case 0:
- eCallOwner = CALLOWNER.BATH_PHONE_01;
- break;
- case 1:
- eCallOwner = CALLOWNER.BATH_PHONE_02;
- break;
- case 2:
- eCallOwner = CALLOWNER.BATH_PHONE_03;
- break;
- case 3:
- eCallOwner = CALLOWNER.BATH_PHONE_04;
- break;
- case 4:
- eCallOwner = CALLOWNER.BATH_PHONE_05;
- break;
- case 5:
- eCallOwner = CALLOWNER.BATH_PHONE_06;
- break;
- case 6:
- eCallOwner = CALLOWNER.BATH_PHONE_07;
- break;
- case 7:
- eCallOwner = CALLOWNER.BATH_PHONE_08;
- break;
- case 8:
- eCallOwner = CALLOWNER.BATH_PHONE_09;
- break;
- case 9:
- eCallOwner = CALLOWNER.BATH_PHONE_10;
- break;
- default:
- eCallOwner = CALLOWNER.NONE;
- break;
- }
- LOG_DEBUG("[getBathPhoneOwner] eCallOwner = " + eCallOwner);
- return eCallOwner;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return CALLOWNER.NONE;
- } catch (Exception e) {
- Log.e(TAG ,"[Exception] getBathPhoneOwner");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return CALLOWNER.NONE;
- }
- }
- public static int getBathTVIdx(CALLOWNER eCallOwner) {
- try {
- if (eCallOwner == CALLOWNER.NONE || !isBathTV(eCallOwner)) return -1;
- int nIdx = Integer.parseInt(eCallOwner.toString().substring(8));
- LOG_DEBUG("[getBathTVIdx(eCallOwner)] nIdx [" + (nIdx-1) + "]");
- return nIdx - 1;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -1;
- } catch (Exception e) {
- Log.e(TAG ,"[Exception] getBathTVIdx(eCallOwner)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -1;
- }
- }
- public static int getBathTVIdx(byte hID) {
- try {
- int nID = Integer.parseInt(HextoString(hID));
- if ((nID % 10 != 8) ||
- (nID < Integer.parseInt(HextoString(SubPhoneCmds.ID_BATHTV[0]))) ||
- (nID > Integer.parseInt(HextoString(SubPhoneCmds.ID_BATHTV[9])))) return -1;
- int nIdx = (int) HextoString(hID).charAt(0) - 48;
- LOG_DEBUG("[getBathTVIdx(hID)] nIdx [" + nIdx + "]");
- return nIdx;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -1;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getBathTVIdx(byte hID)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -1;
- }
- }
- private static boolean isBathTV(CALLOWNER eCallOwner) {
- boolean bResult = false;
- if (eCallOwner.toString().contains("BATH_TV"))
- bResult = true;
- LOG_DEBUG("[isBathTV(eCallOwner)] bResult [" + bResult + "]");
- return bResult;
- }
- public static CALLOWNER getBathTVOwner(int idx) {
- LOG("[getBathTVOwner] idx [" + idx + "]");
- CALLOWNER eCallOwner;
- try {
- switch (idx) {
- case 0:
- eCallOwner = CALLOWNER.BATH_TV_01;
- break;
- case 1:
- eCallOwner = CALLOWNER.BATH_TV_02;
- break;
- case 2:
- eCallOwner = CALLOWNER.BATH_TV_03;
- break;
- case 3:
- eCallOwner = CALLOWNER.BATH_TV_04;
- break;
- case 4:
- eCallOwner = CALLOWNER.BATH_TV_05;
- break;
- case 5:
- eCallOwner = CALLOWNER.BATH_TV_06;
- break;
- case 6:
- eCallOwner = CALLOWNER.BATH_TV_07;
- break;
- case 7:
- eCallOwner = CALLOWNER.BATH_TV_08;
- break;
- case 8:
- eCallOwner = CALLOWNER.BATH_TV_09;
- break;
- case 9:
- eCallOwner = CALLOWNER.BATH_TV_10;
- break;
- default:
- eCallOwner = CALLOWNER.NONE;
- break;
- }
- LOG_DEBUG("[getBathTVOwner] eCallOwner = " + eCallOwner);
- return eCallOwner;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return CALLOWNER.NONE;
- } catch (Exception e) {
- Log.e(TAG ,"[Exception] getBathTVOwner");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return CALLOWNER.NONE;
- }
- }
- // 날씨코드 -> 스트링 맵핑
- private static String[] WEATHER_CODE = {"맑음", "구름조금", "구름많음", "흐림", "흐린후 차차 갬",
- "맑은후 차차 흐려짐", "소나기", "오전 한때 소나기", "오후 한때 소나기", "흐리고 비",
- "오전 한때 비", "오후 한때 비", "흐린후 비", "흐린후 오후 한때 비", "비온후 갬",
- "오전 한때 비온후 갬", "오후 한때 비온후 갬", "흐리고 눈", "오전 한때 눈", "오후 한때 눈",
- "흐린후 눈", "흐린후 오후 한때 눈", "눈온후 갬", "오전 한때 눈온후 갬", "오후 한때 눈온후 갬",
- "비 또는 눈", "오전 한때 비 또는 눈", "오후 한때 비 또는 눈", "흐린후 비 또는 눈", "흐린후 오후 한때 비 또는 눈",
- "눈 또는 비", "오전 한때 눈 또는 비", "오후 한때 눈 또는 비", "흐린후 눈 또는 비", "흐린 후 오후 한때 비 또는 눈",
- "비 또는 눈", "오전 한때 비 또는 눈온후 갬", "오후 한때 비 또는 눈온후 갬", "뇌우", "안개", "황사"};
- public static String getStrWeatherCode(String code) {
- try {
- LOG("[getStrWeatherCode] code [" + code + "]");
- String strWeatherCode = WEATHER_CODE[Integer.parseInt(code) - 1];
- return strWeatherCode;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return null;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getStrWeatherCode()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return null;
- }
- }
- public static int getNumSign(byte num) {
- try {
- LOG("[getNumSign] num [" + HextoString(num) + "]");
- int result;
- if (num == (byte) 0xFF) return -99;
- if (num < 0) result = -1;
- else result = 1;
- LOG("[getNumSign] result = " + result);
- return result;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return -99;
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getNumSign(byte num)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return -99;
- }
- }
- }
|