ソースを参照

[WallPadSecurity]
1. 거동 수상자 시나리오 적용(2세대 대체품과 동일)

jglee 2 年 前
コミット
b973d31ce1

+ 1 - 0
WallPadSecurity/src/main/java/kr/co/icontrols/wallpadsecurity/declare/ID.java

@@ -325,6 +325,7 @@ public final class ID
 		{
 			public static final int PAGE = BASE + 300;
 			public static final int INFO = BASE + 301;
+			public static final int ALARM = BASE + 302;
 		}
 	}
 

+ 74 - 21
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";
@@ -112,7 +115,7 @@ public class PopupSmartIOTCam extends WpadScreen {
 
             title = new WpadTextView(context, false, 990, 90, Gravity.CENTER, Color.WHITE, Common.fontsize._46, true, ID.SmartIOTCamPopup.text.TITLE);
             ViewRegistration(layout, title, 0, 0);
-            title.setText("스마트현관카메라 설정");
+            title.setText("현관카메라 설정");
 
             DrawContents();
         } catch (RuntimeException re) {
@@ -400,42 +403,82 @@ 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 =-1, led = -1;
+
+                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);
+
+                    cam = 1;
+                    led = 1;
+
+                }
+                else
+                {
+                    String[] retData = smartKeyRfDoorAPI.SetSensorConfig((byte)0x05, (byte)0x240).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);
                 }
 
-                // 상태, LED 제어
-                int cam, led;
-                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,7 +648,17 @@ public class PopupSmartIOTCam extends WpadScreen {
                     break;
 
                 case HANDLERMSG.SAVE_SMARTIOT_CONFIG:
+                    //거동 수상자 설정 적용
+                    SetIOTCamConfig();
+                    
                     if (SaveDBConfigValue()) {
+                        //DB 설정 저장 후, 초기화 신호 던져야 함
+                        if(bCurrentRecordingSet)
+                        {
+                            Intent Newintent = new Intent();
+                            Newintent.setAction("StrangeRecordDelayInit");
+                            mContext.sendBroadcast(Newintent);
+                        }
                         Sound().Play(WpadSound.SND.effect.TOUCH_LATCHED);
                         finish();
                    } else {