Pārlūkot izejas kodu

[WallPadSecurity]
1. 거동 수상자 사용 설정 시, 설정에 따라 카메라 드라이브로 설정

jglee 2 gadi atpakaļ
vecāks
revīzija
851289f519

+ 62 - 20
WallPadSecurity/src/main/java/kr/co/icontrols/wallpadsecurity/screen/PopupSmartIOTCam.java

@@ -29,6 +29,9 @@ import kr.co.icontrols.wallpadsupport.WpadScreen;
 import kr.co.icontrols.wallpadsupport.WpadSound;
 import kr.co.icontrols.wallpadsupport.WpadTextView;
 
+/**
+ * 거동 수상자 감지 설정
+ */
 public class PopupSmartIOTCam extends WpadScreen {
 
     String TAG = "PopupSmartIOTCam";
@@ -400,42 +403,78 @@ public class PopupSmartIOTCam extends WpadScreen {
             Log.d(TAG, "[changeRecordingSet] bUse [" + bUse + "], bCurrentRecordingSet [" + bCurrentRecordingSet + "]");
             if (bUse == bCurrentRecordingSet) return;
             bCurrentRecordingSet = bUse;
+            DrawRecordingSet(bCurrentRecordingSet); // 통신 성공시에만 녹화 여부 설정되도록!
             Log.d(TAG, "[changeRecordingSet] bCurrentRecordingSet [" + bCurrentRecordingSet + "]");
+        } catch (RuntimeException re) {
+			LogUtil.errorLogInfo("", TAG, re);
+		}
+		catch (Exception e) {
+            Log.e(TAG, "[Exception] changeRecordingSet(boolean bUse)");
+            //e.printStackTrace();
+            LogUtil.errorLogInfo("", TAG, e);
+        }
+    }
 
+    /**
+     * 거동수상자 상태 정보 설정
+     */
+    protected void SetIOTCamConfig()
+    {
+        try {
+            Log.d(TAG, "[changeRecordingSet] bCurrentRecordingSet [" + bCurrentRecordingSet + "]");
+            boolean bRet = false;
             // API => 센서감도, 감지유지시간
             if (smartKeyRfDoorAPI != null) {
-                boolean bRet = false;
-//                String[] retData = smartKeyRfDoorAPI.SetSensorConfig(DEFINE_SENSOR_SENSITIVITY, DEFINE_SENSOR_DURATION).split(define.DEVCTR_CMD_SPLITER);
-//                if (retData != null) {
-//                    if (retData[0].contains("SUCCESS")) {
-//                        Log.d(TAG, "[changeRecordingSet] SetSensorConfig SUCCESS!!!");
-//                        bRet = true;
-//                    }
-//                }
+
+
 
                 // 상태, LED 제어
                 int cam, led;
-                cam = ctrlSmartIOTCamStatusMode(Common.SmartRFCamStatusMode.STATUS_AUTO_OFF);
-                led = ctrlSmartIOTCamLEDMode(Common.SmartRFCamLEDMode.LED_AUTO_OFF);
+
+                if(bCurrentRecordingSet)
+                {
+                    String[] retData = smartKeyRfDoorAPI.SetSensorConfig((byte)0x05, (byte)0x01).split(define.DEVCTR_CMD_SPLITER);
+                    if (retData != null) {
+                        if (retData[0].contains("SUCCESS")) {
+                            Log.d(TAG, "[changeRecordingSet] SetSensorConfig SUCCESS!!!");
+                            bRet = true;
+                        }
+                    }
+                    cam = ctrlSmartIOTCamStatusMode(Common.SmartRFCamStatusMode.STATUS_AUTO_ON);
+                    led = ctrlSmartIOTCamLEDMode(Common.SmartRFCamLEDMode.LED_AUTO_ON);
+                }
+                else
+                {
+                    String[] retData = smartKeyRfDoorAPI.SetSensorConfig((byte)0x05, (byte)0x10).split(define.DEVCTR_CMD_SPLITER);
+                    if (retData != null) {
+                        if (retData[0].contains("SUCCESS")) {
+                            Log.d(TAG, "[changeRecordingSet] SetSensorConfig SUCCESS!!!");
+                            bRet = true;
+                        }
+                    }
+                    cam = ctrlSmartIOTCamStatusMode(Common.SmartRFCamStatusMode.STATUS_AUTO_OFF);
+                    led = ctrlSmartIOTCamLEDMode(Common.SmartRFCamLEDMode.LED_AUTO_OFF);
+                }
+
                 Log.d(TAG, "[changeRecordingSet] cam [" + cam + "], led [" + led + "]");
                 if (cam >= 0 && led >= 0) bRet = true;
                 else bRet = false;
 
-                if (bRet) {
-                    Sound().Play(WpadSound.SND.effect.TOUCH_LATCHED);
-                    DrawRecordingSet(bCurrentRecordingSet); // 통신 성공시에만 녹화 여부 설정되도록!
-                    return;
-                }
+
             } else {
                 Log.w(TAG, "[changeRecordingSet] smartKeyRfDoorAPI is null!!");
             }
 
-            bCurrentRecordingSet = false;
-            Sound().Play(WpadSound.SND.effect.WARNING005); // 통신 실패시
+            if(!bRet)
+            {
+                bCurrentRecordingSet = false;
+                Sound().Play(WpadSound.SND.effect.WARNING005); // 통신 실패시
+            }
+
         } catch (RuntimeException re) {
-			LogUtil.errorLogInfo("", TAG, re);
-		}
-		catch (Exception e) {
+            LogUtil.errorLogInfo("", TAG, re);
+        }
+        catch (Exception e) {
             Log.e(TAG, "[Exception] changeRecordingSet(boolean bUse)");
             //e.printStackTrace();
             LogUtil.errorLogInfo("", TAG, e);
@@ -605,6 +644,9 @@ public class PopupSmartIOTCam extends WpadScreen {
                     break;
 
                 case HANDLERMSG.SAVE_SMARTIOT_CONFIG:
+                    //거동 수상자 설정 적용
+                    SetIOTCamConfig();
+                    
                     if (SaveDBConfigValue()) {
                         Sound().Play(WpadSound.SND.effect.TOUCH_LATCHED);
                         finish();