1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328 |
- 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 String strDeviceName = "";
- 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"};
- //private static String[] sV40WallPadVolumeTable_FRONT = new String[]{"0x0036", "0x0036", "0x0096", "0x0116", "0x0156", "0x0200", "0x0233", "0x025a", "0x270", "0x0296", "0x300"};
- private static String[] sV40WallPadVolumeTable_FRONT = new String[]{"0x0036", "0x0036", "0x0096", "0x0116", "0x0156", "0x0200", "0x0233", "0x025a", "0x270", "0x0296", "0x300"};
- // 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 setV40WallPadMicGain(String sVolume) {
- try {
- Log.d(TAG, "[setV40WallPadMicGain] nVolume: " + sVolume);
- MainActivity.mIOInterface.setWallPadMicGain_V40(sVolume);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] setV40WallPadMicGain(int nVolume)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public static void setV40WallPadVolume_Front(int nVolume) {
- try {
- Log.d(TAG, "[setV40WallPadVolume_Front] nVolume: " + nVolume);
- MainActivity.mIOInterface.setWallPadVolume_V40(sV40WallPadVolumeTable[nVolume]);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] setV40WallPadVolume_Front(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[] getIPadressDongHo()
- {
- String dong = "101";
- String ho = "101";
- String[] aDeviceName = new String[3];
- String strIPResult = getIPAddress();
- String[] IP_Parse = strIPResult.split("\\.");
- int iDong = Integer.parseInt(IP_Parse[0]);
- if(Integer.parseInt(IP_Parse[1]) < 10)
- {
- iDong = iDong * 10;
- }
- else if((Integer.parseInt(IP_Parse[1]) > 11) && (Integer.parseInt(IP_Parse[1]) < 100))
- {
- iDong = iDong * 100;
- }
- else if (Integer.parseInt(IP_Parse[1]) > 99)
- {
- iDong = iDong * 1000;
- }
- iDong = iDong + Integer.parseInt(IP_Parse[1]);
- dong = Integer.toString(((iDong / 100) * 100) + Integer.parseInt(IP_Parse[1]));
- ho = IP_Parse[2] + ZeroPadding_Head(2, IP_Parse[3]);
- aDeviceName[0] = strIPResult;
- aDeviceName[1] = dong;
- aDeviceName[2] = ho;
- return aDeviceName;
- }
- public static String getDongString() {
- try {
- String strResult = "";
- // wallpaddbmgr DBMGR = new wallpaddbmgr(mContext);
- // AddressSet Addr = DBMGR.getAddressMGR();
- // DBMGR.closeDB();
- // strResult = Addr.Dong;
- strResult = getIPadressDongHo()[1];
- 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;
- strResult = getIPadressDongHo()[2];
- 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;
- }
- }
- }
|