|
@@ -70,6 +70,7 @@ public class SmartKeyRfDoor_Controller extends DeviceManager {
|
|
|
private final long TIME_SYNC_TICK = (long) TIME_MINUTE;
|
|
private final long TIME_SYNC_TICK = (long) TIME_MINUTE;
|
|
|
|
|
|
|
|
private boolean firstSensor = true;
|
|
private boolean firstSensor = true;
|
|
|
|
|
+ private boolean bEnableStrangerDetect = true;
|
|
|
|
|
|
|
|
/** 도어락 문열림 대기모드 설정 시간*/
|
|
/** 도어락 문열림 대기모드 설정 시간*/
|
|
|
private final byte DLOCK_STANDBYMODE_SEC = (byte) 5;
|
|
private final byte DLOCK_STANDBYMODE_SEC = (byte) 5;
|
|
@@ -102,6 +103,13 @@ public class SmartKeyRfDoor_Controller extends DeviceManager {
|
|
|
|
|
|
|
|
private int mModelType = Version.getModelType();
|
|
private int mModelType = Version.getModelType();
|
|
|
|
|
|
|
|
|
|
+ /** 거동수상자 감지기준 시간 **/
|
|
|
|
|
+ private long STRANGEDETECT_DETECT_TIME = 1000 * 60 * 5 ;
|
|
|
|
|
+
|
|
|
|
|
+ /*** 거동수상자 감지 횟수 **/
|
|
|
|
|
+ private int STRANGEDETECT_CHEKC_COUNT = 5;
|
|
|
|
|
+ private boolean mBlockDetectStrange = false;
|
|
|
|
|
+
|
|
|
/////////////////////////////////////////////////////////////
|
|
/////////////////////////////////////////////////////////////
|
|
|
// 무선도어락 연동
|
|
// 무선도어락 연동
|
|
|
/////////////////////////////////////////////////////////////
|
|
/////////////////////////////////////////////////////////////
|
|
@@ -241,6 +249,10 @@ public class SmartKeyRfDoor_Controller extends DeviceManager {
|
|
|
private class StatusList {
|
|
private class StatusList {
|
|
|
/** 거동수상자 센서감지 : true:감지 , false:미감지 */
|
|
/** 거동수상자 센서감지 : true:감지 , false:미감지 */
|
|
|
private boolean bSensorDetect;
|
|
private boolean bSensorDetect;
|
|
|
|
|
+ /** 거동수상자 센서감지 횟수 체크 */
|
|
|
|
|
+ private int nStrangeDetectCount;
|
|
|
|
|
+ /** 거동수상자 센서감지 만료 시간 */
|
|
|
|
|
+ private long nStrangeDetectExpiryTime;
|
|
|
/** 카메라 센서감지 : true:동작중 , false:꺼짐 */
|
|
/** 카메라 센서감지 : true:동작중 , false:꺼짐 */
|
|
|
private boolean bCameraStatus;
|
|
private boolean bCameraStatus;
|
|
|
/** LED 상태 : true:동작중 , false:꺼짐 */
|
|
/** LED 상태 : true:동작중 , false:꺼짐 */
|
|
@@ -660,6 +672,9 @@ public class SmartKeyRfDoor_Controller extends DeviceManager {
|
|
|
Log.i(TAG, "getDoorLockType Error (ret:" + getDoorLockType + ")");
|
|
Log.i(TAG, "getDoorLockType Error (ret:" + getDoorLockType + ")");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ //jglee - 2023.03.29 거동수상자 시나리오 변경에 따른 횟수 및 시간정보 가져오기
|
|
|
|
|
+ getStrangeDetectSetting();
|
|
|
|
|
+
|
|
|
if (mDoorLockType == WallpadDeviceSet.DOORLOCK_TYPE_RF || mDoorLockType == WallpadDeviceSet.DOORLOCK_TYPE_FINGERPRINT) {
|
|
if (mDoorLockType == WallpadDeviceSet.DOORLOCK_TYPE_RF || mDoorLockType == WallpadDeviceSet.DOORLOCK_TYPE_FINGERPRINT) {
|
|
|
int getDoorOpenDelayUse = getDoorLockOpenDelayUse();
|
|
int getDoorOpenDelayUse = getDoorLockOpenDelayUse();
|
|
|
if (getDoorOpenDelayUse > 0) {
|
|
if (getDoorOpenDelayUse > 0) {
|
|
@@ -685,6 +700,11 @@ public class SmartKeyRfDoor_Controller extends DeviceManager {
|
|
|
/**
|
|
/**
|
|
|
* BroadcastReceiver
|
|
* BroadcastReceiver
|
|
|
*/
|
|
*/
|
|
|
|
|
+ public static boolean bStrangeDetect_TestMode = false; // jglee - 2023.03.22 거동수상자 감지 테스트 모드(관리자 설정 센서 감지에서 사용하는 모드)
|
|
|
|
|
+ public static final String BR_STRANGERRECORDSERVICE_NOTUSE = "StrangeRecordNotUseService"; // 해당 서비스 인경우 거동 수상자 BR을 전송하지 않게 함
|
|
|
|
|
+ public static final String BR_STRANGERRECORDSERVICE_USE = "StrangeRecordUseService"; // 해당 서비스 인경우 거동 수상자 BR을 전송
|
|
|
|
|
+ public static final String BR_STRANGEDETECT_TESTMODE = "Strange_TestMode"; // jglee - 2023.03.28 관리자 설정(점검) 구분하기 위해 추가
|
|
|
|
|
+ public static final String BR_STRANGEDETECT_SETTING = "StrangeRecordSetting"; // jglee - 2023.03.28 거동수상자 감지시간 및 횟수
|
|
|
private BroadcastReceiver mWallPadNotifyBR = new BroadcastReceiver()
|
|
private BroadcastReceiver mWallPadNotifyBR = new BroadcastReceiver()
|
|
|
{
|
|
{
|
|
|
public void onReceive(Context context, Intent intent)
|
|
public void onReceive(Context context, Intent intent)
|
|
@@ -700,6 +720,25 @@ public class SmartKeyRfDoor_Controller extends DeviceManager {
|
|
|
DeviceLog("Receive Notify BR " + define.NOTIFY_ACNAME + " : " + kind);
|
|
DeviceLog("Receive Notify BR " + define.NOTIFY_ACNAME + " : " + kind);
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+ //jglee - 2022.09.05 거동 수상자 사용 BR 처리(ISC-300 때문에 추가)
|
|
|
|
|
+ else if (acname.equals(BR_STRANGERRECORDSERVICE_NOTUSE)) {
|
|
|
|
|
+ bEnableStrangerDetect = false;
|
|
|
|
|
+ }
|
|
|
|
|
+ else if (acname.equals(BR_STRANGERRECORDSERVICE_USE)) {
|
|
|
|
|
+ bEnableStrangerDetect = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ //jglee - 2023.03.22 거동수상자 감지 테스트 모드
|
|
|
|
|
+ else if(acname.equals(BR_STRANGEDETECT_TESTMODE))
|
|
|
|
|
+ {
|
|
|
|
|
+ boolean isTestMode = false;
|
|
|
|
|
+ isTestMode = intent.getBooleanExtra("Value", false);
|
|
|
|
|
+ bStrangeDetect_TestMode = isTestMode;
|
|
|
|
|
+ }
|
|
|
|
|
+ //jglee - 2023.03.29 거동수상자 감지 시나리오 변경에 따른 설정 정보 BR
|
|
|
|
|
+ else if(acname.equals(BR_STRANGEDETECT_SETTING))
|
|
|
|
|
+ {
|
|
|
|
|
+ getStrangeDetectSetting();
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -721,6 +760,10 @@ public class SmartKeyRfDoor_Controller extends DeviceManager {
|
|
|
// 1. NOTIFY_ACNAME
|
|
// 1. NOTIFY_ACNAME
|
|
|
DeviceLog("Device_BrRegistration - filter.addAction - " + define.NOTIFY_ACNAME);
|
|
DeviceLog("Device_BrRegistration - filter.addAction - " + define.NOTIFY_ACNAME);
|
|
|
filter.addAction(define.NOTIFY_ACNAME);
|
|
filter.addAction(define.NOTIFY_ACNAME);
|
|
|
|
|
+ filter.addAction(BR_STRANGEDETECT_TESTMODE);
|
|
|
|
|
+ filter.addAction(BR_STRANGERRECORDSERVICE_NOTUSE);//해당 서비스 인경우 거동 수상자 BR을 전송하지 않게 함
|
|
|
|
|
+ filter.addAction(BR_STRANGERRECORDSERVICE_USE);//해당 서비스 인경우 거동 수상자 BR을 전송
|
|
|
|
|
+ filter.addAction(BR_STRANGEDETECT_SETTING);
|
|
|
|
|
|
|
|
ServiceMain.svcContext.registerReceiver(mWallPadNotifyBR, filter);
|
|
ServiceMain.svcContext.registerReceiver(mWallPadNotifyBR, filter);
|
|
|
|
|
|
|
@@ -2882,17 +2925,44 @@ public class SmartKeyRfDoor_Controller extends DeviceManager {
|
|
|
|
|
|
|
|
// 2. 거동수상자 감지
|
|
// 2. 거동수상자 감지
|
|
|
boolean sensorClear = false;
|
|
boolean sensorClear = false;
|
|
|
|
|
+ // jglee 거동수상자 감지 판별
|
|
|
|
|
+ boolean StrangeDetected = IsStrangeDetected(Status.bSensorDetect);
|
|
|
|
|
+ //jglee - 2023.03.22 거동수상자 감지 변경
|
|
|
|
|
+ //1. 조건 거동 수상자가 올라왔는지 확인
|
|
|
if (mDriver.Status.bSensorDetect != Status.bSensorDetect) {
|
|
if (mDriver.Status.bSensorDetect != Status.bSensorDetect) {
|
|
|
- Log.i(TAG, "[UpdateVariables] - Wpad sensor data : " + mDriver.Status.bSensorDetect);
|
|
|
|
|
- Log.i(TAG, "[UpdateVariables] - new receive sensor data : " + Status.bSensorDetect);
|
|
|
|
|
|
|
+ Log.i(TAG, "[updateVariables_DeviceStatus] bSensorDetect - old [" + mDriver.Status.bSensorDetect + "], new [" + Status.bSensorDetect + "]");
|
|
|
// (월패드 : 감지안됨) && (스마트현관 : 감지됨) 인 경우에만 동작 : 거동수상자 발생
|
|
// (월패드 : 감지안됨) && (스마트현관 : 감지됨) 인 경우에만 동작 : 거동수상자 발생
|
|
|
if ((!mDriver.Status.bSensorDetect) && (Status.bSensorDetect)) {
|
|
if ((!mDriver.Status.bSensorDetect) && (Status.bSensorDetect)) {
|
|
|
- Log.i(TAG, "[UpdateVariables] - Sensor Detect Occur !!!");
|
|
|
|
|
|
|
+ Log.i(TAG, "[updateVariables_DeviceStatus] Sensor Detect Occur !!!");
|
|
|
|
|
|
|
|
- Intent mIntent = new Intent();
|
|
|
|
|
- mIntent.setAction(define.NOTIFY_ACNAME);
|
|
|
|
|
- mIntent.putExtra(define.NOTIBR_KIND, define.NOTIFY_SMART_DCAM_DETECT);
|
|
|
|
|
- ServiceMain.svcContext.sendBroadcast(mIntent);
|
|
|
|
|
|
|
+ if (mBlockDetectStrange) {
|
|
|
|
|
+ Log.w(TAG, "[updateVariables_DeviceStatus] 'STRANGE DETECT' Blocked!! - mBlockDetectStrange[true]");
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ Log.w(TAG, "[updateVariables_DeviceStatus] send BR - NOTIFY_SMART_DCAM_DETECT. - mBlockDetectStrange[false]");
|
|
|
|
|
+ //jglee - 2023.04.10 ISC-300인 경우 때문에 테스트 모드인 경우는 무조건 동작하도록 수정
|
|
|
|
|
+ if ((bEnableStrangerDetect || bStrangeDetect_TestMode) && StrangeDetected) {
|
|
|
|
|
+ //여기서 더블 체크를 해야 함
|
|
|
|
|
+ Intent mIntent = new Intent();
|
|
|
|
|
+ mIntent.setAction(define.NOTIFY_ACNAME);
|
|
|
|
|
+
|
|
|
|
|
+ //2023.04.18 jglee - 관리자 설정일 경우, 거동수상자 감지만을 위하여 BR 추가
|
|
|
|
|
+ if(bStrangeDetect_TestMode)
|
|
|
|
|
+ {
|
|
|
|
|
+ mIntent.putExtra(define.NOTIBR_KIND, define.NOTIFY_SMART_DCAM_DETECT_MODE);
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ mIntent.putExtra(define.NOTIBR_KIND, define.NOTIFY_SMART_DCAM_DETECT);
|
|
|
|
|
+ ServiceMain.svcContext.sendBroadcast(mIntent);
|
|
|
|
|
+ mDriver.Status.bSensorDetect = Status.bSensorDetect;
|
|
|
|
|
+ Log.v(TAG, "[updateVariables_DeviceStatus] Changed!! mDriver.Status.bSensorDetect[" + mDriver.Status.bSensorDetect + "]");
|
|
|
|
|
+ }
|
|
|
|
|
+ else if(!bEnableStrangerDetect)
|
|
|
|
|
+ {
|
|
|
|
|
+ mDriver.Status.bSensorDetect = Status.bSensorDetect;
|
|
|
|
|
+ Log.v(TAG, "[updateVariables_DeviceStatus] Changed!! mDriver.Status.bSensorDetect[" + mDriver.Status.bSensorDetect + "]");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
sensorClear = true;
|
|
sensorClear = true;
|
|
|
|
|
|
|
@@ -2902,7 +2972,7 @@ public class SmartKeyRfDoor_Controller extends DeviceManager {
|
|
|
}
|
|
}
|
|
|
// (월패드 : 감지됨) && (스마트현관 : 감지안됨) 인 경우에만 동작 : 거동수상자 해소
|
|
// (월패드 : 감지됨) && (스마트현관 : 감지안됨) 인 경우에만 동작 : 거동수상자 해소
|
|
|
else if ((mDriver.Status.bSensorDetect) && (!Status.bSensorDetect)) {
|
|
else if ((mDriver.Status.bSensorDetect) && (!Status.bSensorDetect)) {
|
|
|
- Log.i(TAG, "[UpdateVariables] - Sensor Detect Release !!!");
|
|
|
|
|
|
|
+ Log.i(TAG, "[updateVariables_DeviceStatus] - Sensor Detect Release !!!");
|
|
|
|
|
|
|
|
Intent mIntent = new Intent();
|
|
Intent mIntent = new Intent();
|
|
|
mIntent.setAction(define.NOTIFY_ACNAME);
|
|
mIntent.setAction(define.NOTIFY_ACNAME);
|
|
@@ -2912,9 +2982,12 @@ public class SmartKeyRfDoor_Controller extends DeviceManager {
|
|
|
Log.i(TAG, "============================================");
|
|
Log.i(TAG, "============================================");
|
|
|
Log.i(TAG, " STRANGE RELEASE~~");
|
|
Log.i(TAG, " STRANGE RELEASE~~");
|
|
|
Log.i(TAG, "============================================");
|
|
Log.i(TAG, "============================================");
|
|
|
|
|
+
|
|
|
|
|
+ mDriver.Status.bSensorDetect = Status.bSensorDetect;
|
|
|
|
|
+ Log.v(TAG, "[updateVariables_DeviceStatus] Changed!! mDriver.Status.bSensorDetect[" + mDriver.Status.bSensorDetect + "]");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- mDriver.Status.bSensorDetect = Status.bSensorDetect;
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 3. LED 상태
|
|
// 3. LED 상태
|
|
@@ -2957,7 +3030,7 @@ public class SmartKeyRfDoor_Controller extends DeviceManager {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 3. 상태 클리어
|
|
// 3. 상태 클리어
|
|
|
- if (Status.bDoorBtnStatus || Status.bError || sensorClear) {
|
|
|
|
|
|
|
+ if (Status.bDoorBtnStatus || Status.bError || sensorClear || StrangeDetected) {
|
|
|
Send_SetStatusClr(Status);
|
|
Send_SetStatusClr(Status);
|
|
|
bChanged = true;
|
|
bChanged = true;
|
|
|
}
|
|
}
|
|
@@ -3583,6 +3656,28 @@ public class SmartKeyRfDoor_Controller extends DeviceManager {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 거동수상자 시나리오 변경에 따른 대기시간 및 횟수 가져오기
|
|
|
|
|
+ */
|
|
|
|
|
+ private void getStrangeDetectSetting()
|
|
|
|
|
+ {
|
|
|
|
|
+ try
|
|
|
|
|
+ {
|
|
|
|
|
+ WallpadDeviceSet wallpadDeviceSet = new WallpadDeviceSet(ServiceMain.svcContext);
|
|
|
|
|
+ STRANGEDETECT_DETECT_TIME = wallpadDeviceSet.Get_SmartDoorCam_Dutaion();
|
|
|
|
|
+ STRANGEDETECT_DETECT_TIME = STRANGEDETECT_DETECT_TIME * 1000; //1초 기준이기 때문에 값 변경
|
|
|
|
|
+ STRANGEDETECT_CHEKC_COUNT = wallpadDeviceSet.Get_SmartDoorCam_Check_Count();
|
|
|
|
|
+ wallpadDeviceSet.closeDB();
|
|
|
|
|
+ Log.d(TAG, "Receive Strange Setting STRANGEDETECT_DETECT_TIME : " + STRANGEDETECT_DETECT_TIME + ", STRANGEDETECT_CHEKC_COUNT : " + STRANGEDETECT_CHEKC_COUNT);
|
|
|
|
|
+ }
|
|
|
|
|
+ catch (Exception e)
|
|
|
|
|
+ {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 무선 도어락 문열림 대기모드 사용여부
|
|
* 무선 도어락 문열림 대기모드 사용여부
|
|
|
*
|
|
*
|
|
@@ -3769,4 +3864,58 @@ public class SmartKeyRfDoor_Controller extends DeviceManager {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 거동 수상자 횟수 비교
|
|
|
|
|
+ * @return 거동 수상자 발견
|
|
|
|
|
+ */
|
|
|
|
|
+ private boolean IsStrangeDetected(boolean isDetected) {
|
|
|
|
|
+ boolean result = false;
|
|
|
|
|
+ long now = System.currentTimeMillis();
|
|
|
|
|
+ //테스트 모드일 경우, 무조건 입력상태(실제 감지 상태 정보를 반환)
|
|
|
|
|
+ if(bStrangeDetect_TestMode) return isDetected;
|
|
|
|
|
+
|
|
|
|
|
+ //거동 수상자가 감지 된경우remote_register_new_device_auth_number
|
|
|
|
|
+ if (mDriver != null && mDriver.Status != null && isDetected) {
|
|
|
|
|
+ Log.d(TAG, "jglee - Now : " + now + ", ExpireTime :" + mDriver.Status.nStrangeDetectExpiryTime);
|
|
|
|
|
+ //기준 시간안에 감지 확인(기준 시간 : STRANGEDETECT_DETECT_TIME)
|
|
|
|
|
+ if (now < mDriver.Status.nStrangeDetectExpiryTime) {
|
|
|
|
|
+ Log.d(TAG, "jglee - DetectedCount : " + mDriver.Status.nStrangeDetectCount);
|
|
|
|
|
+ mDriver.Status.nStrangeDetectCount++;
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ InitStrangeDetectData();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //기준 횟수 안에 들어왔는지 확인(기준 횟수 : STRANGEDETECT_CHEKC_COUNT)
|
|
|
|
|
+ if (STRANGEDETECT_CHEKC_COUNT <= mDriver.Status.nStrangeDetectCount) {
|
|
|
|
|
+ result = true;
|
|
|
|
|
+ Log.d(TAG, "jglee - StrangeDetected");
|
|
|
|
|
+ InitStrangeDetectData();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ else if(!isDetected)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (now > mDriver.Status.nStrangeDetectExpiryTime) {
|
|
|
|
|
+ Log.d(TAG, "jglee - TimeOver : " + now);
|
|
|
|
|
+ InitStrangeDetectData();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 거동 수상자 변수 초기화
|
|
|
|
|
+ */
|
|
|
|
|
+ private void InitStrangeDetectData() {
|
|
|
|
|
+ if (mDriver != null && mDriver.Status != null) {
|
|
|
|
|
+ long now = System.currentTimeMillis();
|
|
|
|
|
+ mDriver.Status.nStrangeDetectExpiryTime = now + STRANGEDETECT_DETECT_TIME;
|
|
|
|
|
+ mDriver.Status.nStrangeDetectCount = 0;
|
|
|
|
|
+ mDriver.Status.nStrangeDetectCount++;
|
|
|
|
|
+ //Log.d(TAG, "jglee - Strange Init Time : " + mDriver.Status.nStrangeDetectExpiryTime);
|
|
|
|
|
+ }
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|