Просмотр исходного кода

[WallPadMain]
1. 거동수상자 딜레이 신호 중복에 대한 처리 추가
2. 거동수상자 사용 설정 Rsume에서 가져오는것으로 변경
3. 거동수상자 사용 BR 삭제

jglee 2 лет назад
Родитель
Сommit
e07fe4eb73

+ 47 - 90
WallPadMain/src/main/java/kr/co/icontrols/wallpadmain/MainActivity.java

@@ -1805,6 +1805,9 @@ public class MainActivity extends WpadActivity {
         super.onDestroy();
     }
 
+    boolean cv_bStrangerVideoRecordUsage;
+    boolean cv_bStrangerUserVideoRecordUsage;
+
     /**
      * onResume
      */
@@ -10139,50 +10142,67 @@ public class MainActivity extends WpadActivity {
         }
     }
 
-    /**
-     * 거동 수상자 연속 녹화 방지(10초간 막음)
-     */
-    private void RecordDelayOn()
-    {
-
-        try {
-            Log.d(TAG, "[RecordDelayOn] Delay Start");
-            boolean isStrangeUse = false;
-            recordDelayHandler.removeMessages(0);
+    Handler StrangeDelayHandler = null;
 
-            if (getStrangerRecordingManagerSetting()) {
-                if (getStrangerRecordingUserSetting()) {
-                    isStrangeUse = true;
+    Runnable strangedelay_runnable = new Runnable() {
+        @Override
+        public void run() {
+            if (cv_bStrangerVideoRecordUsage) {
+                if (cv_bStrangerUserVideoRecordUsage) {
                     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)
+    /**
+     * 거동 수상자 연속 녹화 방지(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)
         {
@@ -10197,8 +10217,8 @@ public class MainActivity extends WpadActivity {
     {
 
         try {
-            if (getStrangerRecordingManagerSetting()) {
-                if (getStrangerRecordingUserSetting()) {
+            if (cv_bStrangerVideoRecordUsage) {
+                if (cv_bStrangerUserVideoRecordUsage) {
 
                     if(mSmartKeyRfDoorAPI == null && mWallPadAPI!=null ) mSmartKeyRfDoorAPI = mWallPadAPI.Get_SmartKeyRfDoorController();
                     //jglee - 2022.07.27 시나리오 변경에 따른 추가 설정
@@ -10207,31 +10227,25 @@ public class MainActivity extends WpadActivity {
                     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);
                         }
                     }
 
@@ -10274,17 +10288,16 @@ public class MainActivity extends WpadActivity {
             Common.bRecordDelay = false;
 
             Log.d(TAG, "[recordDelayHandler] RecordDelay Init");
-            //jglee - 2022.07.27 시나리오 변경에 따른 추가 설정
-            //딜레이가 해제 되면 LED 자동 ON 실행
-            if (getStrangerRecordingManagerSetting()) {
-                if (getStrangerRecordingUserSetting()) {
+
+            if (cv_bStrangerVideoRecordUsage) {
+                if (cv_bStrangerUserVideoRecordUsage) {
 
                     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)
                     {
@@ -10297,62 +10310,6 @@ public class MainActivity extends WpadActivity {
     };
 
 
-    /**
-     * 스마트현관카메라 녹화 여부 판별
-     * 사용자 화면에서 설정
-     */
-    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;
-    }
 
 
     /**

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

@@ -274,7 +274,6 @@ public final class Common {
     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;

+ 17 - 15
WallPadMain/src/main/java/kr/co/icontrols/wallpadmain/util/iMapServer.java

@@ -15631,24 +15631,26 @@ public class iMapServer extends Service {
                     //jglee 여기서 Extra변수값을 적용
                     boolean isFront = false;
                     isFront = intent.getBooleanExtra("isFront", false);
-                    Common.bWallPadCallFrontLive = isFront;
 
-                    if(Common.bWallPadCallFrontLive)
+                    if(Common.bWallPadCallFrontLive != isFront)
                     {
-                        //현관문사용일 경우
-                        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);
+                        if(isFront)
+                        {
+                            //현관문사용일 경우
+                            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.bWallPadCallFrontLive = isFront;
                 }
                 else {
                     Log.w(TAG,"[WallPadCallLiveBRCheck] Not supported strActionName [" + strActionName + "]");