فهرست منبع

[WallPadMain]
1. 거동 수상자 시나리오 적용
- 2세대 대체품과 동일(메인소스)

jglee 2 سال پیش
والد
کامیت
b50755ebf3

+ 391 - 2
WallPadMain/src/main/java/kr/co/icontrols/wallpadmain/MainActivity.java

@@ -58,6 +58,7 @@ import com.artncore.wallpadapi.LightAPI;
 import com.artncore.wallpadapi.MultiSwitchAPI;
 import com.artncore.wallpadapi.SdbAPI;
 import com.artncore.wallpadapi.Sdb_LivingRoomLightAPI;
+import com.artncore.wallpadapi.SmartKeyRfDoorAPI;
 import com.artncore.wallpadapi.WallPadAPI;
 import com.artncore.wallpadimap.RetProci;
 import com.artncore.wallpadimap.WallPadiMAPNotifyAPI;
@@ -317,7 +318,11 @@ public class MainActivity extends WpadActivity {
     // 부재중 전화, 방문객 사진, 공지사항, 택배, 스마트 우편, 전기차 충전 이벤트 개수
     public static int nMissedCallCnt = 0, nVisitorPicCnt = 0, nNoticeCnt = 0, nParcelCnt = 0, nPostCnt = 0, nElecVehicleChangingCnt = 0;
 
-    
+    /**
+     * 카메라 API
+     */
+    SmartKeyRfDoorAPI mSmartKeyRfDoorAPI = null;// mWallPadAPI.Get_SmartKeyRfDoorController();
+
     // 끝
 
     IconManager mIconManager;
@@ -1797,6 +1802,9 @@ public class MainActivity extends WpadActivity {
         super.onDestroy();
     }
 
+    boolean cv_bStrangerVideoRecordUsage;
+    boolean cv_bStrangerUserVideoRecordUsage;
+
     /**
      * onResume
      */
@@ -1888,6 +1896,53 @@ public class MainActivity extends WpadActivity {
             LogUtil.errorLogInfo("", TAG, e);
 		}
         bScreenCheck = true;
+
+		//jglee - 거동 수상자 관련 flag 정보를 resume에서 받아오는것으로 수정
+        WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(getApplicationContext());
+        cv_bStrangerVideoRecordUsage = mWallpadDeviceSet.Get_Stranger_RecordUse();   // 거동수상자 녹화설정 (관리자 설정)
+        mWallpadDeviceSet.closeDB();
+
+        WallpadStatusData DBMGR = new WallpadStatusData(this);
+        try {
+            cv_bStrangerUserVideoRecordUsage = DBMGR.GetStrangerRecordingOnOff();
+            DBMGR.closeDB();
+            Log.d(TAG, "[getStrangerRecordingUserSetting] bResult [" + cv_bStrangerUserVideoRecordUsage + "]");
+        } catch (RuntimeException re) {
+            LogUtil.errorLogInfo("", TAG, re);
+            DBMGR.closeDB();
+            cv_bStrangerUserVideoRecordUsage = false;
+        } catch (Exception e) {
+            DBMGR.closeDB();
+            Log.e(TAG, "[Exception] getStrangerRecordingUserSetting()");
+            //e.printStackTrace();
+            LogUtil.errorLogInfo("", TAG, e);
+            cv_bStrangerUserVideoRecordUsage = false;
+        }
+
+        //jglee - 2022.08.26.01 녹색화면 방지를 위하여 그라운드를 상시 키는것으로 변경
+        try {
+            if (Version.getModelType() == Version.MODEL_TYPE.IHN_D101 || Version.getModelType() == Version.MODEL_TYPE.IHN_D101_I
+                    || Version.getModelType() == Version.MODEL_TYPE.IHN_D101K || Version.getModelType() == Version.MODEL_TYPE.IHN_D101K_I
+                    || Version.getModelType() == MODEL_TYPE.IHN_1010GL || Version.getModelType() == MODEL_TYPE.IHN_1010GL_I
+                    || Version.getModelType() == Version.MODEL_TYPE.IHN_1010GL_I_2443 || Version.getModelType() == Version.MODEL_TYPE.IHN_1010GL_I_6410
+                    || Version.getModelType() == MODEL_TYPE.IHN_D101_I_OCF) {
+
+                new Handler().postDelayed(new Runnable() {
+                    @Override
+                    public void run() {
+                        WallPadInterface wpdifc = new WallPadInterface();
+                        wpdifc.DoControl(WallPadInterface.IOCTL_VIDEOINPUT_DOORCAMERA, 0);   // 현관영상 선택
+                    }
+                }, 2000);
+
+
+            }
+        }
+        catch (Exception e)
+        {
+
+        }
+        
         DebugLogOutput("@@@@@@@@ [onResume] @@@@@@@@");
     }
   	
@@ -2747,7 +2802,52 @@ public class MainActivity extends WpadActivity {
 
                         case Common.BR_MAIN_NOTI.ACCEPT_RECORDING:
                             int nEmerState = intent.getIntExtra("EMERGENCY_STATE", -1);
-                            m_CallSubMenuScreen.callStartCallAPK(ID.LINKEDSCREEN.SubCall.Door_Record, nEmerState);
+                            //여기서 거동 수상자 녹화 시작 여부 확인
+                            Common.bRecordStatus = true;
+
+                            boolean bFromCall = intent.getBooleanExtra("FROMCALL", false);
+
+                            if (!bFromCall) {
+                                // yjyoon. 2443에서는 Call 앱에서 녹화 수행
+                                // 여기서 해당하는 br 정보를 저장 해야 함
+                                //jglee - 여기서 BR들을 관리하기 위하여
+//                                if(CallBrList == null)
+//                                    CallBrList = new ArrayList<Intent>();
+
+                                Intent brListIntent = new Intent();
+                                brListIntent.setAction(define.NOTIFY_ACNAME);
+                                brListIntent.putExtra(define.NOTIBR_KIND, define.NOTIFY_SMART_DCAM_DETECT);
+
+//                                if(CallBrList.size() > 1)
+//                                {
+//                                    if(CallBrList.get(0) != brListIntent)
+//                                    {
+//                                        CallBrList.add(brListIntent);
+//                                        Log.d(TAG, "jglee - Call 인텐트 추가 > size : " + CallBrList.size()  + ", Action : " + CallBrList.get(0).getAction());
+//                                    }
+//                                }
+//                                else {
+//                                    CallBrList.add(brListIntent);
+//                                    Log.d(TAG, "jglee - Call 인텐트 추가 > size : " + CallBrList.size()  + ", Action : " + CallBrList.get(0).getAction());
+//                                }
+//
+//                                //여기서 BrList에 남아 있는 갯수를 확인
+//                                if(CallBrList!=null && CallBrList.size() > 1)
+//                                {
+//                                    return;
+//                                }
+                                Log.d(TAG, "jglee - Call Record");
+                                m_CallSubMenuScreen.callStartCallAPK(ID.LINKEDSCREEN.SubCall.Door_Record, nEmerState);
+                            }
+                            break;
+
+                        case Common.BR_MAIN_NOTI.STOP_RECORDING:
+                            // yjyoon. 거동수상자 녹화중지 시 상태값 변경.
+                            Log.v("yjyoon", "Common.BR_MAIN_NOTI.STOP_RECORDING     Common.bWallPadRecoder = false");
+                            //Common.bWallPadRecoder = false;
+                            Common.bRecordStatus = false;
+
+                            mediaStopRecord();
                             break;
 
                         default:
@@ -3617,6 +3717,8 @@ public class MainActivity extends WpadActivity {
 
             registerMainActivityBR();
 
+            registerStrangeRecordBR();
+
 		} catch (RuntimeException re) {
             LogUtil.errorLogInfo("", TAG, re);
         }
@@ -3631,6 +3733,8 @@ public class MainActivity extends WpadActivity {
             unregisterReceiver(mWallPadAlertBR);
             unregisterReceiver(mWallPadNotifyBR);
             unregisterReceiver(MainActivityBroadcastReceiver);
+            //거동수상자 관련 리시버 해제
+            unregisterReceiver(StrangeRecordBroadcastReceiver);
         } catch (RuntimeException re) {
             LogUtil.errorLogInfo("", TAG, re);
         }
@@ -10075,5 +10179,290 @@ public class MainActivity extends WpadActivity {
     }
 
 
+    /**
+     * 거동 수상자 녹화 중지(MainActivity -> WallPadCall)
+     */
+    private void stopStrangerRecord() {
+        try {
+            Log.d(TAG, "[stopStrangerRecord] bRecordStatus [" + Common.bRecordStatus + "]");
+            if (Common.bRecordStatus) {
+                Common.bRecordStatus = false;
+
+                // yjyoon. 녹화 중지 브로드캐스트
+                Intent iIntent = new Intent();
+                iIntent.setAction(Common.BR_REQUEST_RECORD_STOP);
+                iIntent.putExtra(define.NOTIBR_KIND, 1);
+                getApplicationContext().sendBroadcast(iIntent);
+
+                mediaStopRecord();
+            }
+        } catch (RuntimeException re) {
+            LogUtil.errorLogInfo("", TAG, re);
+        } catch (Exception e) {
+            Log.e(TAG, "[Exception] stopStrangerRecord(boolean bSave)");
+            //e.printStackTrace();
+            LogUtil.errorLogInfo("", TAG, e);
+        }
+    }
+
+    Handler StrangeDelayHandler = null;
+
+    Runnable strangedelay_runnable = new Runnable() {
+        @Override
+        public void run() {
+            if (cv_bStrangerVideoRecordUsage) {
+                if (cv_bStrangerUserVideoRecordUsage) {
+                    Log.d(TAG, "[RecordDelay]");
+                    Common.bRecordDelay = true;
+
+
+                    if(mSmartKeyRfDoorAPI == null && mWallPadAPI!=null ) mSmartKeyRfDoorAPI = mWallPadAPI.Get_SmartKeyRfDoorController();
+                    //jglee - 2022.07.27 시나리오 변경에 따른 추가 설정
+                    //딜레이 기간동안 LED 자동 OFF 실행
+                    if (mSmartKeyRfDoorAPI != null) mSmartKeyRfDoorAPI.SetLEDmode(Common.SmartRFCamLEDMode.LED_AUTO_OFF);
+
+                    if (mSmartKeyRfDoorAPI != null) mSmartKeyRfDoorAPI.SetCAMERAmode(Common.SmartRFCamStatusMode.STATUS_AUTO_OFF);
+
+                    //여기서 감지시간을 강제로 늘림
+                    if(mSmartKeyRfDoorAPI!=null)
+                    {
+                        String ret = mSmartKeyRfDoorAPI.SetSensorConfig((byte) 0x05, (byte)0x240);
+                    }
+                }
+            }
+        }
+    };
+
+    /**
+     * 거동 수상자 연속 녹화 방지(10초간 막음)
+     */
+    private void RecordDelayOn()
+    {
+
+        try {
+            Log.d(TAG, "[RecordDelayOn] Delay Start bRecordDelay : " + Common.bRecordDelay);
+            boolean isStrangeUse = false;
+            recordDelayHandler.removeMessages(0);
+
+            if(StrangeDelayHandler == null)
+                StrangeDelayHandler = new Handler();
+
+            if(cv_bStrangerUserVideoRecordUsage  && cv_bStrangerUserVideoRecordUsage)
+            {
+                if(!Common.bRecordDelay) {
+                    StrangeDelayHandler.removeCallbacksAndMessages(null);
+                    StrangeDelayHandler.post(strangedelay_runnable);
+                }
+
+                //기존 핸들러 삭제 해야 함
+                Message msg = recordDelayHandler.obtainMessage();
+                msg.what = 0;
+                recordDelayHandler.sendMessageDelayed(msg, 90 * 1000); // 녹화 종료 후 90초 동안 녹화를 막는다.
+            }
+            else
+            {
+                Common.bRecordDelay = false;
+                Log.i(TAG, "[RecordDelayOn] - Not Use Strange()");
+            }
+
+
+        }
+        catch (Exception e)
+        {
+
+        }
+    }
+
+    /**
+     * 거동 수상자 사용설정
+     */
+    private void RecordNotUse(boolean isUse)
+    {
+
+        try {
+            if (cv_bStrangerVideoRecordUsage) {
+                if (cv_bStrangerUserVideoRecordUsage) {
+
+                    if(mSmartKeyRfDoorAPI == null && mWallPadAPI!=null ) mSmartKeyRfDoorAPI = mWallPadAPI.Get_SmartKeyRfDoorController();
+                    //jglee - 2022.07.27 시나리오 변경에 따른 추가 설정
+                    //딜레이 기간동안 LED 자동 OFF 실행
+
+                    if(isUse)
+                    {
+                        if (mSmartKeyRfDoorAPI != null) mSmartKeyRfDoorAPI.SetLEDmode(Common.SmartRFCamLEDMode.LED_AUTO_ON);
+
+                        if (mSmartKeyRfDoorAPI != null) mSmartKeyRfDoorAPI.SetCAMERAmode(Common.SmartRFCamStatusMode.STATUS_AUTO_ON);
+
+                        //여기서 감지시간을 강제로 늘림
+                        if(mSmartKeyRfDoorAPI!=null)
+                        {
+                            String ret = mSmartKeyRfDoorAPI.SetSensorConfig((byte) 0x05, (byte)0x01);
+                        }
+                    }
+                    else
+                    {
+                        if (mSmartKeyRfDoorAPI != null) mSmartKeyRfDoorAPI.SetLEDmode(Common.SmartRFCamLEDMode.LED_AUTO_OFF);
+
+                        if (mSmartKeyRfDoorAPI != null) mSmartKeyRfDoorAPI.SetCAMERAmode(Common.SmartRFCamStatusMode.STATUS_AUTO_OFF);
+
+                        //여기서 감지시간을 강제로 늘림
+                        if(mSmartKeyRfDoorAPI!=null)
+                        {
+                            String ret = mSmartKeyRfDoorAPI.SetSensorConfig((byte) 0x05, (byte)0x240);
+                        }
+                    }
+
+                }
+            }
+
+        }
+        catch (Exception e)
+        {
+
+        }
+    }
+
+
+    /**
+     * 거동 수상자 녹화 중지 관련 내부 변수 처리
+     */
+    private void mediaStopRecord() {
+        try {
+            Log.d(TAG, "[mediaStopRecord]");
+            Log.d(TAG, "[mediaStopRecord] - RecordDelayOn()");
+            RecordDelayOn();
+            Common.bRecordStatus = false; // 녹화 종료
+        } catch (RuntimeException re) {
+            LogUtil.errorLogInfo("", TAG, re);
+        } catch (Exception e) {
+            Log.e(TAG, "[Exception] mediaStopRecord()");
+            //e.printStackTrace();
+            LogUtil.errorLogInfo("", TAG, e);
+        }
+    }
+
+
+    /**
+     * 거동 수상자 역속 녹화를 막기 위한 Handler
+     */
+    Handler recordDelayHandler = new Handler() {
+        @Override
+        public void handleMessage(Message msg) {
+            Common.bRecordDelay = false;
+
+            Log.d(TAG, "[recordDelayHandler] RecordDelay Init + CallingStatus : " +Common.bWallPadCallingLive);
+
+            if (cv_bStrangerVideoRecordUsage) {
+                if (cv_bStrangerUserVideoRecordUsage) {
+
+                    //톨화중 딜레이 타임이 끝나는 것을 방지하기 위해서 한번더 확인
+                    if(!Common.bWallPadCallingLive)
+                    {
+                        if (mSmartKeyRfDoorAPI != null) mSmartKeyRfDoorAPI.SetLEDmode(Common.SmartRFCamLEDMode.LED_AUTO_ON);
+                        else Log.w(TAG, "[recordDelayHandler] Status LED ON smartKeyRfDoorAPI is null!!");
+
+                        if (mSmartKeyRfDoorAPI != null) mSmartKeyRfDoorAPI.SetCAMERAmode(Common.SmartRFCamStatusMode.STATUS_AUTO_ON);
+                        else Log.w(TAG, "[recordDelayHandler] Status Auto ON smartKeyRfDoorAPI is null!!");
+
+                        //여기서 감지시간을 원래대로 복구
+                        if(mSmartKeyRfDoorAPI!=null)
+                        {
+                            String ret = mSmartKeyRfDoorAPI.SetSensorConfig((byte) 0x05, (byte)0x01);
+                            Log.i(TAG, "[recordDelayHandler SenSorConfig] - Test Setting result = " + ret);
+                        }
+                    }
+
+
+                }
+            }
+        }
+    };
+
+
+
+
+    /**
+     * 거동 수상자 관련 BR 등록
+     */
+    private void registerStrangeRecordBR() {
+        try {
+            IntentFilter filter = new IntentFilter();
+            filter.addAction(Common.BR_RECORD_EXCEPTION);
+            filter.addAction(Common.BR_RECORD_STOP);
+            filter.addAction(Common.BR_RECORD_DELAY);
+            filter.addAction(Common.BR_RECORD_NOT_USE);
+            filter.addAction(Common.BR_RECORD_DELAY_INIT);
+            mContext.registerReceiver(StrangeRecordBroadcastReceiver, filter);
+        } catch (RuntimeException re) {
+            LogUtil.errorLogInfo("", TAG, re);
+        }
+        catch (Exception e) {
+            Log.e(TAG, "[Exception] registerMainActivityBR()");
+            LogUtil.errorLogInfo("", TAG, e);
+        }
+    }
+
+
+    /**
+     * 거동 수상자 관련 BR
+     */
+    BroadcastReceiver StrangeRecordBroadcastReceiver = new BroadcastReceiver() {
+        @Override
+        public void onReceive(Context context, Intent intent) {
+            if(intent.getAction().equals(Common.BR_RECORD_EXCEPTION))
+            {
+                mediaStopRecord();
+            }
+            else if(intent.getAction().equals(Common.BR_RECORD_STOP))
+            {
+                stopStrangerRecord();
+            }
+            else if(intent.getAction().equals(Common.BR_RECORD_DELAY))
+            {
+                Log.d(TAG, "BR - RecordDelayOn()");
+                RecordDelayOn();
+            }
+            else if(intent.getAction().equals(Common.BR_RECORD_NOT_USE))
+            {
+                //통화중일 경우 받는 BR
+                Log.d(TAG, "RecordDelay isCalling");
+                RecordNotUse(false);
+            }
+            else if(intent.getAction().equals(Common.BR_RECORD_DELAY_INIT))
+            {
+                //jglee - 거동수상자 초기화 
+                //시나리오에 따라 딜레이가 있는 경우, 딜레이가 완료 되고 해당 초기화 진행
+                //거동 수상자 설정(사용함)일 경우, 해당 BR 받음
+                Log.d(TAG, "Recrod Delay Init Config, RecordDelay Status :" + Common.bRecordDelay);
+                //여기서는 DB 정보를 다시 조회 해야 함
+                //jglee - Resume이 들어가지 않은 상태로 BR을 받을 수 있음
+                // 따라서 해당 BR을 받으면 다시 DB 값을 가져와야 함
+                WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(getApplicationContext());
+                cv_bStrangerVideoRecordUsage = mWallpadDeviceSet.Get_Stranger_RecordUse();   // 거동수상자 녹화설정 (관리자 설정)
+                mWallpadDeviceSet.closeDB();
+
+                WallpadStatusData DBMGR = new WallpadStatusData(getApplicationContext());
+                try {
+                    cv_bStrangerUserVideoRecordUsage = DBMGR.GetStrangerRecordingOnOff();
+                    DBMGR.closeDB();
+                    Log.d(TAG, "[getStrangerRecordingUserSetting] bResult [" + cv_bStrangerUserVideoRecordUsage + "]");
+                } catch (RuntimeException re) {
+                    LogUtil.errorLogInfo("", TAG, re);
+                    DBMGR.closeDB();
+                    cv_bStrangerUserVideoRecordUsage = false;
+                } catch (Exception e) {
+                    DBMGR.closeDB();
+                    Log.e(TAG, "[Exception] getStrangerRecordingUserSetting()");
+                    //e.printStackTrace();
+                    LogUtil.errorLogInfo("", TAG, e);
+                    cv_bStrangerUserVideoRecordUsage = false;
+                }
+
+                if(!Common.bRecordDelay)
+                    RecordNotUse(true);
+
+            }
+        }
+    };
 }
 

+ 27 - 4
WallPadMain/src/main/java/kr/co/icontrols/wallpadmain/declare/Common.java

@@ -25,6 +25,19 @@ public final class Common {
     public final static boolean DEBUG_LOG_ON = true;
 
     public static boolean bWallPadCallLive = false;
+    /**
+     * jglee 현재 통화 실행여부
+     */
+    public static boolean bWallPadCallingLive = false;
+    /***
+     * 거동 수상자 녹화 상태 확인 변수
+     */
+    public static boolean bRecordStatus = false;
+
+    /**
+     * 거동 수상자 연속 녹화 방지 변수
+     */
+    public static boolean bRecordDelay = false;
 
     public static int CurrentBoardType = BOARD_TYPE.V40_IGW300_NOUGAT;
 
@@ -253,9 +266,15 @@ public final class Common {
      * WallPadMain에서 WallPadCall의 Live 상태를 파악하기 위한 BR
      * WallPadMain에서 BR_REQUEST_WALLPADCALL_LIVE을 보내면 WallPadCall은 BR_ACK_WALLPADCALL_LIVE로 응답한다.
      */
-    public static final String BR_REQUEST_WALLPADCALL_LIVE       = "kr.co.icontrols.wallpad.BR_REQUEST_WALLPADCALL_LIVE";
-    public static final String BR_ACK_WALLPADCALL_LIVE       = "kr.co.icontrols.wallpad.BR_ACK_WALLPADCALL_LIVE";
-    public static final String PID_WALLPADCALL = "PID_WALLPADCALL";
+    public static final String BR_REQUEST_WALLPADCALL_LIVE  = "kr.co.icontrols.wallpad.BR_REQUEST_WALLPADCALL_LIVE";
+    public static final String BR_ACK_WALLPADCALL_LIVE      = "kr.co.icontrols.wallpad.BR_ACK_WALLPADCALL_LIVE";
+    public static final String PID_WALLPADCALL              = "PID_WALLPADCALL";
+	public static final String BR_REQUEST_RECORD_STOP       = "kr.co.icontrols.wallpad.BR_RECORDSTOP"; // yjyoon. 20220705 거동수상자 녹화 중지
+    public static final String BR_RECORD_DELAY              = "StrangeDelayOn"; // jglee. 20220706 거동수상자 Delay(내부사용)
+    public static final String BR_RECORD_STOP               = "StrangeRecordStop"; // jglee. 20220706 거동수상자 Stop(내부사용)
+    public static final String BR_RECORD_EXCEPTION          = "StrangeRecordStopException"; // jglee. 20220706 거동수상자 Exception
+    public static final String BR_RECORD_NOT_USE            = "StrangeRecordNotUse";        // jglee. 20220728 거동 수상자 사용안함
+    public static final String BR_RECORD_DELAY_INIT         = "StrangeRecordDelayInit";        // jglee. 20220803 거동 수상자 사용 설정 시, 전송 BR
 
     // 거실에너지미터 연동
     public static byte LIVINGEM_CTRL_NORMAL = (byte) 0x00;
@@ -317,7 +336,11 @@ public final class Common {
         public static final int NOTICE_DETECT_STRANGER              = 1022;
         public static final int ACCEPT_RECORDING                    = 1023;
         public static final int ACCEPT_TAKEPIC                      = 1024;
-        public static final int NOTICE_PSTN_RING_END                      = 1025;
+        public static final int NOTICE_PSTN_RING_END                = 1025;
+        /**
+         * 거동수상자 녹화 완료 및 중지 
+         */
+        public static final int STOP_RECORDING                      = 1027; // yjyoon. 20220705 거동수상자 녹화 중지
 
         public static final String CARD_NUM = "CARD_NUM";
     }

+ 8 - 0
WallPadMain/src/main/java/kr/co/icontrols/wallpadmain/util/WallPadiMAPUpgrade.java

@@ -12,6 +12,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 import kr.co.icontrols.v40ioctl.V40IOInterface;
+import kr.co.icontrols.wallpadmain.declare.Common;
 import kr.co.icontrols.wallpadsupport.Version;
 
 import org.apache.commons.net.ftp.FTP;
@@ -22,6 +23,7 @@ import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
 import android.content.Context;
+import android.content.Intent;
 import android.content.pm.PackageInfo;
 import android.os.Build;
 import android.os.Environment;
@@ -351,6 +353,12 @@ public class WallPadiMAPUpgrade {
 		        		if (Updatefilename == null) Updatefilename = "no";
 		        		if (UpdateAppfilename == null) UpdateAppfilename = "no";
 		        		
+		        		//jglee - 여기서 거동 수상자 녹화가 진행되면 안되기 때문에 거동수상자 사용않람을 실행 해야 함
+						//거동수상자 사용안함 설정
+						Intent Newintent = new Intent();
+						Newintent.setAction(Common.BR_RECORD_NOT_USE);
+						ThisCtx.sendBroadcast(Newintent);
+						
 		        		//String SetPP = System.setProperty("persist.sys.update.ready", "1");
 //		        		Log.e(TAG,APIErrorCode.GetLogPrefix()+" Before Call  PowerManager ");
 //		        		PowerManager pm = (PowerManager) ThisCtx.getSystemService(Context.POWER_SERVICE);

+ 223 - 6
WallPadMain/src/main/java/kr/co/icontrols/wallpadmain/util/iMapServer.java

@@ -985,33 +985,81 @@ public class iMapServer extends Service {
                         case define.NOTIFY_SMART_DCAM_DETECT:
                             // 스마트현관카메라 거동수상자 발생
 //                            Toast.makeText(getApplicationContext(), "Front camera sensor: DETECTED!!", Toast.LENGTH_SHORT).show();
-                            Log.i(TAG, "[mWallPadNotifyBR] define.NOTIFY_SMART_DCAM_DETECT -> bWallPadCallLive [" + bWallPadCallLive + "], bBlockFrontCall [" + bBlockFrontCall + "]");
+                            //jglee - 통화중일 경우
+                            if(Common.bWallPadCallingLive || bBlockFrontCall)
+                            {
+                                //현관문일 경우만 return 함
+                                Log.i(TAG, "[mWallPadNotifyBR] define.NOTIFY_SMART_DCAM_DETECT -> bWallPadCallLive [" + bWallPadCallLive + "] return - BR_RECORD_DELAY");
+                                Intent Newintent = new Intent();
+                                Newintent.setAction(Common.BR_RECORD_DELAY);
+                                getApplicationContext().sendBroadcast(Newintent);
+                                Log.w(TAG, "jglee - StrangeRecord Delay by Call");
+                                return;
+                            }
+
+                            if(Common.bRecordDelay)
+                            {
+                                Log.w(TAG, "jglee - [NOTIFY_SMART_DCAM_DETECT] bRecordDelay is return ");
+                                return;
+                            }
+
+                            Log.i(TAG, "jglee - [mWallPadNotifyBR] define.NOTIFY_SMART_DCAM_DETECT -> bWallPadCallLive [" + bWallPadCallLive + "], bBlockFrontCall [" + bBlockFrontCall + "]");
+                            //Call앱이 실행되어 있지 않으면서, 현관호출이 아닌경우
                             if (!bWallPadCallLive && !bBlockFrontCall) {
                                 if (getStrangerRecordingManagerSetting()) {
                                     if (getStrangerRecordingUserSetting()) {
                                         Log.d(TAG, "[mWallPadNotifyBR] Send BR --> Common.BR_MAIN_NOTI.NOTICE_DETECT_STRANGER");
+                                        //거동 수상자 감지 또는 딜레인 경우 처리
+                                        if(Common.bRecordStatus && !bWallPadCallLive)
+                                        {
+                                            Common.bRecordStatus = false;
+                                            Log.w(TAG, "jglee - [mWallPadNotifyBR] Stranger recording Status Error is Status -> false");
+                                        }
+                                        if(Common.bRecordDelay || Common.bRecordStatus)
+                                        {
+                                            Log.w(TAG, "jglee - [mWallPadNotifyBR] Stranger recording is return ");
+                                            return;
+                                        }
+
+                                        //거동 수상자 신호가 이중으로 빨리 오는 경우에 대한 처리가 필요
+                                        Log.d(TAG, "Strange Recording Start - BR_RECORD_DELAY");
+                                        Intent DelayIntent = new Intent();
+                                        DelayIntent.setAction(Common.BR_RECORD_DELAY);
+                                        getApplicationContext().sendBroadcast(DelayIntent);
+                                        Log.w(TAG, "jglee - Strange Record Start so Delay Start");
+                                        
                                         Intent Newintent = new Intent();
                                         Newintent.setAction(Common.BR_MAIN_NOTI.ACNAME_MAIN_NOTI);
                                         Newintent.putExtra(Common.BR_MAIN_NOTI.KIND, BR_MAIN_NOTI.NOTICE_DETECT_STRANGER);
                                         Newintent.putExtra("DOORCAM_TYPE", getSmartDoorCamType());
                                         getApplicationContext().sendBroadcast(Newintent);
+                                        Log.d(TAG, "Strange Recording Start");
                                     }
                                     else {
                                         ctrlSmartIOTCamStatusMode(Common.SmartRFCamStatusMode.STATUS_AUTO_OFF);
                                         ctrlSmartIOTCamLEDMode(Common.SmartRFCamLEDMode.LED_AUTO_OFF);
-                                        Log.w(TAG, "[mWallPadNotifyBR] Stranger recording setting is disabled by user!! ");
+                                        Log.w(TAG, "jglee - [mWallPadNotifyBR] Stranger recording setting is disabled by user!! ");
                                     }
                                 }
                                 else {
                                     ctrlSmartIOTCamStatusMode(Common.SmartRFCamStatusMode.STATUS_AUTO_OFF);
                                     ctrlSmartIOTCamLEDMode(Common.SmartRFCamLEDMode.LED_AUTO_OFF);
-                                    Log.w(TAG, "[mWallPadNotifyBR] Stranger recording setting is disabled by manager!!");
+                                    Log.w(TAG, "jglee - [mWallPadNotifyBR] Stranger recording setting is disabled by manager!!");
                                 }
                             }
                             else {
                                 ctrlSmartIOTCamStatusMode(Common.SmartRFCamStatusMode.STATUS_OFF);
                                 ctrlSmartIOTCamLEDMode(Common.SmartRFCamLEDMode.LED_OFF);
-                                Log.w(TAG, "[mWallPadNotifyBR] define.NOTIFY_SMART_DCAM_DETECT -> Call Blocked!!");
+                                //MOIP 통화 중, 거동 수상자 신호가 들어오는 경우 중복 신호 방지
+                                //MOIP 통화 중, 거동 수상자 신호 입력에 대해서는 Call 내부에서 처리됨
+                                if(Common.bWallPadCallLive)
+                                {
+                                    Log.w(TAG, "jglee - StrangeRecord Delay by Call - BR_RECORD_DELAY");
+                                    Intent Newintent = new Intent();
+                                    Newintent.setAction(Common.BR_RECORD_DELAY);
+                                    getApplicationContext().sendBroadcast(Newintent);
+                                }
+                                Log.w(TAG, "jglee - [mWallPadNotifyBR] define.NOTIFY_SMART_DCAM_DETECT -> Call Blocked!!");
                             }
                             break;
 
@@ -2342,12 +2390,92 @@ public class iMapServer extends Service {
 						// 현관 도어폰 벨 눌림 입력 상태
 						// Jeff added below codes for call app (2018.01.25)
                         Log.i(TAG, "[WallPadInterface.BTN_DOOR] bWallPadCallLive [" + bWallPadCallLive + "], bBlockFrontCall [" + bBlockFrontCall + "]");
+
                         if (!bWallPadCallLive && !bBlockFrontCall) {
+                            try {
+                                Log.w(TAG, "[WallPadInterface.BTN_DOOR] New Call App!!!");
+
+                                //여기서 확인
+//                                if(MainActivity.CallBrList == null)
+//                                    MainActivity.CallBrList = new ArrayList<Intent>();
+//                                Intent brListIntent = new Intent();
+//                                brListIntent = intent;
+//
+//                                if(MainActivity.CallBrList.size() > 1)
+//                                {
+//                                    if(MainActivity.CallBrList.get(0) != brListIntent)
+//                                    {
+//                                        MainActivity.CallBrList.add(brListIntent);
+//                                        Log.d(TAG, "jglee - Call 인텐트 추가 > size : " + MainActivity.CallBrList.size()  + "현관 딩동");
+//                                    }
+//                                }
+//                                else {
+//                                    MainActivity.CallBrList.add(brListIntent);
+//                                    Log.d(TAG, "jglee - Call 인텐트 추가 > size : " + MainActivity.CallBrList.size()  + "현관 딩동");
+//                                }
+//
+//                                //여기서 BrList에 남아 있는 갯수를 확인
+//                                if(MainActivity.CallBrList!=null && MainActivity.CallBrList.size() > 1)
+//                                {
+//                                    return;
+//                                }
+                                Log.d(TAG, "jglee - Call Front");
+
+                                bBlockFrontCall = true;
+                                handlerCallCtrl.removeMessages(CALLCTRLHANDLERMSG.RELEASE_BLOCK_FRONTCALL);
+                                handlerCallCtrl.sendEmptyMessageDelayed(CALLCTRLHANDLERMSG.RELEASE_BLOCK_FRONTCALL, 3000);
+                                mWallPadAPI.SetDevService_DoorCamUseOnOff(true);
+
+                                if (ModelType == MODEL_TYPE.IHN_1020GL) {
+                                    mIGW200.ctrlDeviceIO(IGW200dAPI.OUTPUT.DOOR_POWER, true);
+                                    mIGW200.ctrlDeviceIO(IGW200dAPI.OUTPUT.BELL_CONT, true);
+                                }
+                                else if (Version.getModelType() == Version.MODEL_TYPE.IHN_D101 || Version.getModelType() == Version.MODEL_TYPE.IHN_D101_I
+                                        || Version.getModelType() == Version.MODEL_TYPE.IHN_D101K || Version.getModelType() == Version.MODEL_TYPE.IHN_D101K_I
+                                        || Version.getModelType() == MODEL_TYPE.IHN_1010GL || Version.getModelType() == MODEL_TYPE.IHN_1010GL_I
+                                        || Version.getModelType() == Version.MODEL_TYPE.IHN_1010GL_I_2443 || Version.getModelType() == Version.MODEL_TYPE.IHN_1010GL_I_6410
+                                        || Version.getModelType() == MODEL_TYPE.IHN_D101_I_OCF) {
+                                    mIGW300.ctrlDeviceIO(IGW300API.OUTPUT.DOOR_POWER, true);
+                                    mIGW300.ctrlDeviceIO(IGW300API.OUTPUT.BELL_CONT, true);
+                                }
+
+                                if (!Version.getGatewayUsage()) {
+                                    mDingDongHandler.sendEmptyMessage(0); // 띵똥
+                                }
+
+                                Log.w(TAG, "jglee - 띵동 수신 거동수상자 딜레이 - BR_RECORD_DELAY");
+                                Intent Newintent = new Intent();
+                                Newintent.setAction(Common.BR_RECORD_DELAY);
+                                getApplicationContext().sendBroadcast(Newintent);
+
+                                
+                                runCallMainActivity(CALLOWNER.NONE, CALLEVENTTYPE.RECEIVE_CALL, CALLTYPE.FRONT, AlarmStatus);
+                            } catch (RuntimeException re) {
+                                LogUtil.errorLogInfo("", TAG, re);
+                            }
+                            catch (Exception e) {
+                                Log.e(TAG, "[Exception] onReceive().BTN_DOOR");
+                                //e.printStackTrace();
+                                LogUtil.errorLogInfo("", TAG, e);
+                            }
+                        }
+                        else if(Common.bRecordStatus)
+                        {
+                            //여기서 거동 수상자 확인이 필요함
+                            //녹화 여부 확인 후, 거동 수상자 녹화 중지 BR을 전송
+                            // 거동수상자 녹화 중 현관 띵똥 눌리는 경우 BR 전송 (녹화 여부 판별 위해)
+                            Log.d(TAG, "[WallPadInterface.BTN_DOOR] Now Stranger Recording!!! bRecordStatus [" + Common.bRecordStatus + "]");
+
                             bBlockFrontCall = true;
                             handlerCallCtrl.removeMessages(CALLCTRLHANDLERMSG.RELEASE_BLOCK_FRONTCALL);
                             handlerCallCtrl.sendEmptyMessageDelayed(CALLCTRLHANDLERMSG.RELEASE_BLOCK_FRONTCALL, 3000);
                             mWallPadAPI.SetDevService_DoorCamUseOnOff(true);
 
+                            // yjyoon. 녹화 중지 브로드캐스트
+                            Intent iIntent = new Intent();
+                            iIntent.setAction(Common.BR_RECORD_STOP);
+                            getApplicationContext().sendBroadcast(iIntent);
+
                             try {
                                 if (ModelType == MODEL_TYPE.IHN_1020GL) {
                                     mIGW200.ctrlDeviceIO(IGW200dAPI.OUTPUT.DOOR_POWER, true);
@@ -2366,8 +2494,27 @@ public class iMapServer extends Service {
                                     mDingDongHandler.sendEmptyMessage(0); // 띵똥
                                 }
 
-                                Log.w(TAG, "[WallPadInterface.BTN_DOOR] New Call App!!!");
-                                runCallMainActivity(CALLOWNER.NONE, CALLEVENTTYPE.RECEIVE_CALL, CALLTYPE.FRONT, AlarmStatus);
+                                // yjyoon. 현재 Call 앱이 켜진 상태.
+                                // WallPadCall > MainActivity > onCreate() 에서  generateCallEvent()를 통해 콜 이벤트를 생성.
+                                if (false) {
+                                    // yjyoon. 기존 소스코드. 주석처리
+                                    Log.w(TAG, "[WallPadInterface.BTN_DOOR] New Call App!!!");
+                                    runCallMainActivity(CALLOWNER.NONE, CALLEVENTTYPE.RECEIVE_CALL, CALLTYPE.FRONT, AlarmStatus);
+                                } else {
+                                    // yjyoon. 
+                                    // 현관 콜 이벤트 생성 및 전송. runCallMainActivity(CALLOWNER.NONE, CALLEVENTTYPE.RECEIVE_CALL, CALLTYPE.FRONT, AlarmStatus) 참조
+                                    sendLCDBacklightStatus(true);
+
+                                    Intent mIntent = new Intent();
+                                    mIntent.setAction(define.NOTIFY_ACNAME);
+                                    mIntent.putExtra(define.NOTIBR_KIND, 9999); // yjyoon. 임시로 9999로 설정.
+                                    mIntent.putExtra(CALLTRIGGER.CALLOWNER, CALLOWNER.NONE.toString());
+                                    mIntent.putExtra(CALLTRIGGER.CALLEVENTTYPE, CALLEVENTTYPE.RECEIVE_CALL.toString());
+                                    mIntent.putExtra(CALLTRIGGER.CALLTYPE, CALLTYPE.FRONT.toString());
+
+                                    getApplicationContext().sendBroadcast(mIntent);
+                                    playFrontBell(CALLOWNER.NONE, CALLEVENTTYPE.RECEIVE_CALL, CALLTYPE.FRONT);
+                                }
                             } catch (RuntimeException re) {
                                 LogUtil.errorLogInfo("", TAG, re);
                             }
@@ -2919,6 +3066,21 @@ public class iMapServer extends Service {
 
         checkDoorCamConfig(); // 현관카메라 설정정보 확인
 
+        //여기서 감지시간을 3초로 초기화 jglee
+        try
+        {
+            if (getStrangerRecordingManagerSetting()) {
+                if (mSmartKeyRfDoorAPI != null) {
+                    mSmartKeyRfDoorAPI.SetSensorConfig((byte) 0x05, (byte) 0x01);
+                }
+            }
+        }
+        catch (Exception e)
+        {
+
+        }
+
+
         getAirQualityUsage();
 
 		if (Version.getModelType() == Version.MODEL_TYPE.IHN_1020SA_A) {
@@ -14878,6 +15040,13 @@ public class iMapServer extends Service {
                 ctrlSmartIOTCamStatusMode(Common.SmartRFCamStatusMode.STATUS_OFF);
                 ctrlSmartIOTCamLEDMode(Common.SmartRFCamLEDMode.LED_OFF);
 
+                if (getStrangerRecordingManagerSetting()) {
+                    if (mSmartKeyRfDoorAPI != null) {
+                        mSmartKeyRfDoorAPI.SetSensorConfig((byte) 0x05, (byte) 0x01);
+                    }
+                }
+
+
                 if (getStrangerRecordingManagerSetting() && getStrangerRecordingUserSetting()) {
                     // 설정값을 확인하여 스마트 IoT 현관카메라의 상태를 전송한다. (거동수상자 녹화를 위한 자동 On 기능 활성화)
                     ctrlSmartIOTCamStatusMode(Common.SmartRFCamStatusMode.STATUS_AUTO_ON);
@@ -15523,6 +15692,7 @@ public class iMapServer extends Service {
     int MAX_WALLPADCALL_LIVE_CNT = 2;
     int nWallPadCallACKCnt = MAX_WALLPADCALL_LIVE_CNT;   // MAX_WALLPADCALL_LIVE_CNT회 이상 응답이 없으면 WallPadCall이 종료된것으로 판단한다.
     public static boolean bWallPadCallLive = false;   // WallPadCall의 Live 상태를 나타낸다.
+    public static boolean bWallPadRecoder = false;   // WallPadCall의 Live 상태를 나타낸다.
     int nWallPadCallPID = 0;   // WallPadCall을 강제 종료하기 위한 PID (WallPadCall로부터 BR로 수신한다.)
     Handler handlerCheckWallPadCallLive =  new Handler() {
         public void handleMessage(Message msg) {
@@ -15544,7 +15714,10 @@ public class iMapServer extends Service {
             }
             else {
                 bWallPadCallLive = false;
+                bWallPadRecoder  = false;
                 Common.bWallPadCallLive = bWallPadCallLive;
+                //jglee - 변수 초기화
+                Common.bWallPadCallingLive = false;
             }
 
             if (bWallPadCallLive != getCallAppRunning()) {
@@ -15571,8 +15744,52 @@ public class iMapServer extends Service {
                 if (strActionName.equals(Common.BR_ACK_WALLPADCALL_LIVE)) {
                     bWallPadCallLive = true;
                     Common.bWallPadCallLive = bWallPadCallLive;
+                    //여기서 삭제
+//                    if(MainActivity.CallBrList.size()>0) {
+//                        Log.d(TAG, "jglee - CallBR Remove");
+//                        MainActivity.CallBrList.remove(0);
+//                        if(MainActivity.CallBrList.size() > 0) {
+//                            //Log.d(TAG, "jglee - Call Next 호출 > Action : " + MainActivity.CallBrList.get(0).getAction() +  ", Extra : " + MainActivity.CallBrList.get(0).getIntExtra(Common.BR_MAIN_NOTI.KIND,0) );
+//                            //jglee - 내부 이슈가 수정이 되지 않으면, 아래 핸들러를 이용하여 사용 필요
+//                            if(false)
+//                            {
+//                                if(MainActivity.CallIntentHandler!=null)
+//                                    MainActivity.CallIntentHandler.sendMessageDelayed(MainActivity.CallIntentHandler.obtainMessage(), 1500);
+//                            }
+//                            else
+//                            {
+//                                getApplicationContext().sendBroadcast(MainActivity.CallBrList.get(0));
+//                                Log.d(TAG, "jglee - Call 직접 Next 호출");
+//                            }
+//
+//                        }
+//                    }
                     nWallPadCallACKCnt = MAX_WALLPADCALL_LIVE_CNT;
                     Log.w(TAG,"[WallPadCallLiveBRCheck] bWallPadCallLive [" + bWallPadCallLive + "]");
+
+                    //jglee 여기서 Extra변수값을 적용
+                    boolean isCalling = false;
+                    isCalling = intent.getBooleanExtra("isCalling", false);
+
+                    if(Common.bWallPadCallingLive != isCalling)
+                    {
+                        if(isCalling)
+                        {
+                            //현관문사용일 경우
+                            Intent Newintent = new Intent();
+                            Newintent.setAction(Common.BR_RECORD_NOT_USE);
+                            getApplicationContext().sendBroadcast(Newintent);
+                        }
+                        else
+                        {
+                            //현관문 사용안하는 경우
+                            Intent Newintent = new Intent();
+                            Newintent.setAction(Common.BR_RECORD_DELAY);
+                            getApplicationContext().sendBroadcast(Newintent);
+                            Log.w(TAG, "[WallPadCallLiveBRCheck] BR_RECORD_DELAY");
+                        }
+                    }
+                    Common.bWallPadCallingLive = isCalling;
                 }
                 else {
                     Log.w(TAG,"[WallPadCallLiveBRCheck] Not supported strActionName [" + strActionName + "]");