Преглед на файлове

[WallPadMain]
1. 거동 수상자 분석을 위해 로그 추가
2. 거동 수상자 기능 사용안함 BR 추가(BR_RECORD_NOT_USE)
3. 거동 수상자 딜레이(90초)동안 Camera Auto Off, Led Auto Off, 감지시간 10초 로 설정
4. 거동 수상자 딜레이 종료 후, Carmera Auto On, Led Auto On, 감지시간 1초로 설정
5. 현관 호출 시, 거동 수상자 딜레이 BR 전송 추가
6. 현관문 사용 인 경우, 거동 수상자 사용 안함 BR 전송
7. 현관문 사용 종료 시, 거동 수상자 딜레이 BR 전송

jglee преди 2 години
родител
ревизия
6d9e47b047

+ 175 - 15
WallPadMain/src/main/java/kr/co/icontrols/wallpadmain/MainActivity.java

@@ -10144,22 +10144,100 @@ public class MainActivity extends WpadActivity {
      */
     private void RecordDelayOn()
     {
+
         try {
+            Log.d(TAG, "[RecordDelayOn] Delay Start");
+            boolean isStrangeUse = false;
             recordDelayHandler.removeMessages(0);
-            Log.d(TAG, "[RecordDelay]");
-            Common.bRecordDelay = true;
-            //기존 핸들러 삭제 해야 함
-            Message msg = recordDelayHandler.obtainMessage();
-            msg.what = 0;
-            recordDelayHandler.sendMessageDelayed(msg, 90 * 1000); // 녹화 종료 후 90초 동안 녹화를 막는다.
-            //여기서 Auto Off 모드로 전송
 
-            if(mSmartKeyRfDoorAPI == null && mWallPadAPI!=null ) mSmartKeyRfDoorAPI = mWallPadAPI.Get_SmartKeyRfDoorController();
+            if (getStrangerRecordingManagerSetting()) {
+                if (getStrangerRecordingUserSetting()) {
+                    isStrangeUse = true;
+                    Log.d(TAG, "[RecordDelay]");
+                    Common.bRecordDelay = true;
+                    //기존 핸들러 삭제 해야 함
+                    Message msg = recordDelayHandler.obtainMessage();
+                    msg.what = 0;
+                    recordDelayHandler.sendMessageDelayed(msg, 90 * 1000); // 녹화 종료 후 90초 동안 녹화를 막는다.
+
+                    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);
+                    else Log.w(TAG, "[RecordDelayOn] Status LED Off smartKeyRfDoorAPI is null!!");
+
+                    if (mSmartKeyRfDoorAPI != null) mSmartKeyRfDoorAPI.SetCAMERAmode(Common.SmartRFCamStatusMode.STATUS_AUTO_OFF);
+                    else Log.w(TAG, "[RecordDelayOn] Status Auto Off smartKeyRfDoorAPI is null!!");
+
+                    //여기서 감지시간을 강제로 늘림
+                    if(mSmartKeyRfDoorAPI!=null)
+                    {
+                        String ret = mSmartKeyRfDoorAPI.SetSensorConfig((byte) 0x05, (byte)0x10);
+                        Log.i(TAG, "[recordDelayHandler SenSorConfig] - Test Setting result = " + ret);
+                    }
+                }
+            }
+
+            if(!isStrangeUse)
+            {
+                Common.bRecordDelay = false;
+                Log.i(TAG, "[RecordDelayOn] - Not Use Strange()");
+            }
+        }
+        catch (Exception e)
+        {
+
+        }
+    }
+
+    /**
+     * 거동 수상자 사용설정
+     */
+    private void RecordNotUse(boolean isUse)
+    {
+
+        try {
+            if (getStrangerRecordingManagerSetting()) {
+                if (getStrangerRecordingUserSetting()) {
+
+                    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);
+                        else Log.w(TAG, "[RecordDelayOn] Status LED Off smartKeyRfDoorAPI is null!!");
+
+                        if (mSmartKeyRfDoorAPI != null) mSmartKeyRfDoorAPI.SetCAMERAmode(Common.SmartRFCamStatusMode.STATUS_AUTO_ON);
+                        else Log.w(TAG, "[RecordDelayOn] Status Auto Off smartKeyRfDoorAPI is null!!");
+
+                        //여기서 감지시간을 강제로 늘림
+                        if(mSmartKeyRfDoorAPI!=null)
+                        {
+                            String ret = mSmartKeyRfDoorAPI.SetSensorConfig((byte) 0x05, (byte)0x01);
+                            Log.i(TAG, "[recordDelayHandler SenSorConfig] - Test Setting result = " + ret);
+                        }
+                    }
+                    else
+                    {
+                        if (mSmartKeyRfDoorAPI != null) mSmartKeyRfDoorAPI.SetLEDmode(Common.SmartRFCamLEDMode.LED_AUTO_OFF);
+                        else Log.w(TAG, "[RecordDelayOn] Status LED Off smartKeyRfDoorAPI is null!!");
+
+                        if (mSmartKeyRfDoorAPI != null) mSmartKeyRfDoorAPI.SetCAMERAmode(Common.SmartRFCamStatusMode.STATUS_AUTO_OFF);
+                        else Log.w(TAG, "[RecordDelayOn] Status Auto Off smartKeyRfDoorAPI is null!!");
+
+                        //여기서 감지시간을 강제로 늘림
+                        if(mSmartKeyRfDoorAPI!=null)
+                        {
+                            String ret = mSmartKeyRfDoorAPI.SetSensorConfig((byte) 0x05, (byte)0x10);
+                            Log.i(TAG, "[recordDelayHandler SenSorConfig] - Test Setting result = " + ret);
+                        }
+                    }
+
+                }
+            }
 
-            //jglee - 2022.07.27 시나리오 변경에 따른 추가 설정
-            //딜레이 기간동안 LED 자동 OFF 실행
-            if (mSmartKeyRfDoorAPI != null) mSmartKeyRfDoorAPI.SetLEDmode(Common.SmartRFCamLEDMode.LED_AUTO_OFF);
-            else Log.w(TAG, "[RecordDelayOn] smartKeyRfDoorAPI is null!!");
         }
         catch (Exception e)
         {
@@ -10174,6 +10252,7 @@ public class MainActivity extends WpadActivity {
     private void mediaStopRecord() {
         try {
             Log.d(TAG, "[mediaStopRecord]");
+            Log.d(TAG, "[mediaStopRecord] - RecordDelayOn()");
             RecordDelayOn();
             Common.bRecordStatus = false; // 녹화 종료
         } catch (RuntimeException re) {
@@ -10194,14 +10273,88 @@ public class MainActivity extends WpadActivity {
         public void handleMessage(Message msg) {
             Common.bRecordDelay = false;
 
+            Log.d(TAG, "[recordDelayHandler] RecordDelay Init");
             //jglee - 2022.07.27 시나리오 변경에 따른 추가 설정
             //딜레이가 해제 되면 LED 자동 ON 실행
-            if (mSmartKeyRfDoorAPI != null) mSmartKeyRfDoorAPI.SetLEDmode(Common.SmartRFCamLEDMode.LED_AUTO_ON);
-            else Log.w(TAG, "[ctrlSmartIOTCCamLEDMode]recordDelayHandler smartKeyRfDoorAPI is null!!");
+            if (getStrangerRecordingManagerSetting()) {
+                if (getStrangerRecordingUserSetting()) {
+
+                    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);
+                    }
+                }
+            }
         }
     };
 
 
+    /**
+     * 스마트현관카메라 녹화 여부 판별
+     * 사용자 화면에서 설정
+     */
+    private boolean getStrangerRecordingUserSetting() {
+        boolean bResult = false;
+        WallpadStatusData DBMGR = new WallpadStatusData(this);
+        try {
+            bResult = DBMGR.GetStrangerRecordingOnOff();
+            DBMGR.closeDB();
+            Log.d(TAG, "[getStrangerRecordingUserSetting] bResult [" + bResult + "]");
+        } catch (RuntimeException re) {
+            LogUtil.errorLogInfo("", TAG, re);
+            DBMGR.closeDB();
+            bResult = false;
+        }
+        catch (Exception e) {
+            DBMGR.closeDB();
+            Log.e(TAG, "[Exception] getStrangerRecordingUserSetting()");
+            //e.printStackTrace();
+            LogUtil.errorLogInfo("", TAG, e);
+            bResult = false;
+        }
+        return bResult;
+    }
+
+    public boolean getStrangerRecordingManagerSetting() {
+        boolean bResult = false;
+        WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(getApplicationContext());
+        try {
+            int[] nFrontCam = mWallpadDeviceSet.Get_RFDoorCAM_Info();
+            boolean bRecord = mWallpadDeviceSet.Get_Stranger_RecordUse();
+            mWallpadDeviceSet.closeDB();
+
+            if (nFrontCam[0] == 1) {
+                if (nFrontCam[1] == WallpadDeviceSet.DOORTYPE_IOT_SMART || nFrontCam[1] == WallpadDeviceSet.DOORTYPE_HYOSUNG_SMART || nFrontCam[1] == WallpadDeviceSet.DOORTYPE_DAEWOO_SMART) {
+                    if (bRecord) bResult = true;
+                    else bResult = false;
+                }
+                else bResult = false;
+            }
+            else bResult = false;
+
+        } catch (RuntimeException re) {
+            LogUtil.errorLogInfo("", TAG, re);
+            mWallpadDeviceSet.closeDB();
+        }
+        catch (Exception e) {
+            mWallpadDeviceSet.closeDB();
+            Log.e(TAG, "[Exception] getStrangerRecordingManagerSetting()");
+            //e.printStackTrace();
+            LogUtil.errorLogInfo("", TAG, e);
+        }
+        Log.d(TAG, "[getStrangerRecordingManagerSetting] bResult [" + bResult + "]");
+        return bResult;
+    }
+
+
     /**
      * 거동 수상자 관련 BR 등록
      */
@@ -10211,6 +10364,8 @@ public class MainActivity extends WpadActivity {
             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_USE);
             mContext.registerReceiver(StrangeRecordBroadcastReceiver, filter);
         } catch (RuntimeException re) {
             LogUtil.errorLogInfo("", TAG, re);
@@ -10230,7 +10385,7 @@ public class MainActivity extends WpadActivity {
         public void onReceive(Context context, Intent intent) {
             if(intent.getAction().equals(Common.BR_RECORD_EXCEPTION))
             {
-                Common.bRecordStatus = false;
+                mediaStopRecord();
             }
             else if(intent.getAction().equals(Common.BR_RECORD_STOP))
             {
@@ -10238,8 +10393,13 @@ public class MainActivity extends WpadActivity {
             }
             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))
+            {
+                RecordNotUse(false);
+            }
         }
     };
 }

+ 2 - 0
WallPadMain/src/main/java/kr/co/icontrols/wallpadmain/declare/Common.java

@@ -273,6 +273,8 @@ public final class Common {
     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_USE            = "StrangeRecordUse";        // jglee. 20220728 거동 수상자 사용함
 
     // 거실에너지미터 연동
     public static byte LIVINGEM_CTRL_NORMAL = (byte) 0x00;

+ 30 - 14
WallPadMain/src/main/java/kr/co/icontrols/wallpadmain/util/iMapServer.java

@@ -988,7 +988,7 @@ public class iMapServer extends Service {
                             if(Common.bWallPadCallFrontLive || bBlockFrontCall)
                             {
                                 //현관문일 경우만 return 함
-                                Log.i(TAG, "[mWallPadNotifyBR] define.NOTIFY_SMART_DCAM_DETECT -> bWallPadCallLive [" + bWallPadCallLive + "] 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);
@@ -996,6 +996,7 @@ public class iMapServer extends Service {
                                 return;
                             }
                             Log.i(TAG, "jglee - [mWallPadNotifyBR] define.NOTIFY_SMART_DCAM_DETECT -> bWallPadCallLive [" + bWallPadCallLive + "], bBlockFrontCall [" + bBlockFrontCall + "]");
+                            //Call앱이 실행되어 있지 않으면서, 현관호출이 아닌경우
                             if (!bWallPadCallLive && !bBlockFrontCall) {
                                 if (getStrangerRecordingManagerSetting()) {
                                     if (getStrangerRecordingUserSetting()) {
@@ -1018,6 +1019,13 @@ public class iMapServer extends Service {
                                             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);
@@ -1041,12 +1049,13 @@ public class iMapServer extends Service {
                                 ctrlSmartIOTCamStatusMode(Common.SmartRFCamStatusMode.STATUS_OFF);
                                 ctrlSmartIOTCamLEDMode(Common.SmartRFCamLEDMode.LED_OFF);
                                 //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 - StrangeRecord Delay by Call");
                                 }
                                 Log.w(TAG, "jglee - [mWallPadNotifyBR] define.NOTIFY_SMART_DCAM_DETECT -> Call Blocked!!");
                             }
@@ -2432,10 +2441,11 @@ public class iMapServer extends Service {
                                     mDingDongHandler.sendEmptyMessage(0); // 띵똥
                                 }
 
+                                Log.w(TAG, "jglee - 띵동 수신 거동수상자 딜레이 - BR_RECORD_DELAY");
                                 Intent Newintent = new Intent();
                                 Newintent.setAction(Common.BR_RECORD_DELAY);
                                 getApplicationContext().sendBroadcast(Newintent);
-                                Log.w(TAG, "jglee - 띵동 수신 거동수상자 딜레이");
+
                                 
                                 runCallMainActivity(CALLOWNER.NONE, CALLEVENTTYPE.RECEIVE_CALL, CALLTYPE.FRONT, AlarmStatus);
                             } catch (RuntimeException re) {
@@ -14275,9 +14285,6 @@ public class iMapServer extends Service {
             }
             else {
                 Log.w(TAG, "[runCallMainActivity] WallPadCall is already running!!");
-//                if (getUseSmartDoorCam()) {
-//                    sendHandlerMsgDelayed(HANDLERMSG.ENABLE_APP_RUN_WALLPADCALL, 0, 0, 3000);
-//                }
             }
 
         } catch (RuntimeException re) {
@@ -15569,14 +15576,6 @@ public class iMapServer extends Service {
             else {
                 bWallPadCallLive = false;
                 bWallPadRecoder  = false;
-                if(Common.bWallPadCallLive && !bWallPadCallLive)
-                {
-                    Log.i(TAG, "[sendWallPadCallLiveBR_Request]");
-                    Intent Newintent = new Intent();
-                    Newintent.setAction(Common.BR_RECORD_DELAY);
-                    getApplicationContext().sendBroadcast(Newintent);
-                    Log.w(TAG, "jglee - StrangeRecord Delay by sendWallPadCallLiveBR_Request");
-                }
                 Common.bWallPadCallLive = bWallPadCallLive;
                 //jglee - 현관문 변수 초기화
                 Common.bWallPadCallFrontLive = false;
@@ -15633,6 +15632,23 @@ public class iMapServer extends Service {
                     boolean isFront = false;
                     isFront = intent.getBooleanExtra("isFront", false);
                     Common.bWallPadCallFrontLive = isFront;
+
+                    if(Common.bWallPadCallFrontLive)
+                    {
+                        //현관문사용일 경우
+                        Log.i(TAG, "Common.bWallPadCallFrontLive true StrangeNotUse");
+                        Intent Newintent = new Intent();
+                        Newintent.setAction(Common.BR_RECORD_NOT_USE);
+                        getApplicationContext().sendBroadcast(Newintent);
+                    }
+                    else
+                    {
+                        //현관문사용일 경우
+                        Log.i(TAG, "Common.bWallPadCallFrontLive true StrangeUse - BR_RECORD_DELAY");
+                        Intent Newintent = new Intent();
+                        Newintent.setAction(Common.BR_RECORD_DELAY);
+                        getApplicationContext().sendBroadcast(Newintent);
+                    }
                 }
                 else {
                     Log.w(TAG,"[WallPadCallLiveBRCheck] Not supported strActionName [" + strActionName + "]");