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 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 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 parseDevInfo(String devInfo) { List 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 interfaces = Collections.list(NetworkInterface.getNetworkInterfaces()); for (NetworkInterface intf : interfaces) { List 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; } } /** * 무선 도어락 문열림
* JNI 호출을 실행하는 함수
* * @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; } } }