From 3f6685c77beeb12baf840733fb890860f4c26e7c Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期四, 25 七月 2024 17:25:59 +0800
Subject: [PATCH] 2024年07月25日17:24:45

---
 HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/CommonMethod.cs |  109 +++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 82 insertions(+), 27 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/CommonMethod.cs b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/CommonMethod.cs
index e9cb4c6..e9393fd 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/CommonMethod.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/CommonMethod.cs
@@ -55,6 +55,7 @@
                 this.SunThread(() =>
                 {
                     var list = this.GetVideoDoorLockLockModelsList("notAllowedConfigNetworkModels");
+
                     this.MainThread(() =>
                     {
 #if __IOS__
@@ -76,7 +77,8 @@
 
 #else
                     HDLEzvizSdk.Instance.JumpToEZScanActivity(Application.Activity, spk,list);
-                        HDLEzvizSdk.SetAddCallback(new AndroidIHdlInterface((isBool, serials) =>
+                        HDLEzvizSdk.SetAddCallback(new
+                            AndroidIHdlInterface((isBool, serials) =>
                     {
                         if (isBool)
                         {
@@ -165,7 +167,27 @@
             EZSDK.IOS.EZSDK.SharedInstance().PlayWithDeviceSerial(deviceSerial, deviceId, spk);
 
 #else
-            HDLEzvizSdk.Instance.JumpToEZRealPlayActivity(Application.Activity,deviceId,deviceSerial,spk);
+            HDLEzvizSdk.Instance.JumpToEZRealPlayActivity(Application.Activity,deviceId,deviceSerial,spk,"");
+#endif
+
+
+        }
+        /// <summary>
+        /// 鎵撳紑瀹炴椂瑙嗛鐢婚潰
+        /// </summary>
+        /// <param name="deviceSerial">璁惧搴忓垪鍙�</param>
+        /// <param name="deviceId">璁惧id(浜戠涓奷eviceId)</param>
+        /// <param name="spk">璁惧spk(浜戦泙涓婂畾涔夊ソ鐨�)</param>
+        /// <param name="msgId">娑堟伅id</param>
+        private void SkipRTVActivity(string deviceSerial, string deviceId, string spk, string msgId)
+        {
+
+#if __IOS__
+            //鎵撳紑钀ょ煶瑙嗛鐣岄潰
+            EZSDK.IOS.EZSDK.SharedInstance().PlayWithDeviceSerial(deviceSerial, deviceId, spk, msgId);
+
+#else
+            HDLEzvizSdk.Instance.JumpToEZRealPlayActivity(Application.Activity,deviceId,deviceSerial,spk,msgId);
 #endif
 
 
@@ -256,7 +278,8 @@
                         //EZSDK.IOS.EZSDK.Play(info);
 #else
 
-                            HDLEzvizSdk.Instance.Init(Application.Activity.Application, ezChildAccessToken, UserInfo.Current.LoginTokenString, UserInfo.Current.RefreshToken, OnAppConfig.Instance.RequestHttpsHost, appKey, 1, DB_ResidenceData.Instance.CurrentRegion.id);
+                            HDLEzvizSdk.Instance.Init(Application.Activity.Application, ezChildAccessToken, UserInfo.Current.LoginTokenString, UserInfo.Current.RefreshToken, OnAppConfig.Instance.RequestHttpsHost, appKey, 1, DB_ResidenceData.Instance.CurrentRegion.id,
+                                HttpUtil.APP_KEY, HttpUtil.SECRET_KEY);
 
 #endif
 
@@ -289,6 +312,7 @@
 #if __IOS__
 #else
                 HDLEzvizSdk.Instance.SetHomeId(home.id);
+            
 #endif
 
         }
@@ -300,7 +324,15 @@
         /// <returns>杩斿洖缁撴灉涓嶄細涓簄ull</returns>
         public List<string> GetVideoDoorLockLockModelsList(string mode = "lockModels")
         {
-            return VideDoorLockSend.Current.GetVideoDoorLockLockModelsList(mode);
+            var lockModels = VideDoorLockSend.Current.GetVideoDoorLockLockModelsList();
+            if (mode == "lockModels")
+            {
+                return lockModels.lockModels;
+            }
+            else
+            {
+                return lockModels.notAllowedConfigNetworkModels;
+            }
         }
         /// <summary>
         /// 闂ㄩ攣鎺ㄩ��
@@ -312,30 +344,49 @@
             this.MainThread(() =>
             {
                 if (string.IsNullOrEmpty(jpushMessageInfo.expantContent)) return;
-                //{ "deviceSid":"J92513662","type":"opendoormsg","extDevId":"J92513662","deviceId":"1641010144999936001","spk":"security.door.ezviz"}
-                var expantContent = Newtonsoft.Json.JsonConvert.DeserializeObject<ExpantContent>(jpushMessageInfo.expantContent);
-                if (expantContent == null)
+                try
                 {
-                    return;
-                }
-                if (expantContent.spk != SPK.VideoDoorLock)
+                    //{ "deviceSid":"J92513662","type":"opendoormsg","extDevId":"J92513662","deviceId":"1641010144999936001","spk":"security.door.ezviz"}
+                    var expantContent = Newtonsoft.Json.JsonConvert.DeserializeObject<ExpantContent>(jpushMessageInfo.expantContent);
+                    if (expantContent == null)
+                    {
+                        return;
+                    }
+                    if (expantContent.spk == null)
+                    {
+                        return;
+                    }
+                    if ( expantContent.spk != SPK.VideoDoorLock)
+                    {
+                        return;
+                    }
+                    if (jpushMessageInfo.messageType.Contains(PushMessageType.DOOR_BELL.ToString()))
+                    {
+                        ///鎵撳紑瑙嗛闂ㄩ攣
+                        string currentTimeStr = Utlis.GetTimestamp();   // 褰撳墠鏃堕棿
+
+                        if (string.IsNullOrEmpty(expantContent.currentTime) && string.IsNullOrEmpty(currentTimeStr) && (long.Parse(currentTimeStr) - long.Parse(expantContent.currentTime)) > 30000)
+                        {    // 瓒呮椂30s
+                            this.SkipRTVActivity(expantContent.devSerial, expantContent.deviceId, expantContent.spk, true);
+                        }
+                        else
+                        {
+                            this.SkipRTVActivity(expantContent.devSerial, expantContent.deviceId, expantContent.spk, expantContent.msgId);
+                        }
+                    }
+                    else if (jpushMessageInfo.messageType.Contains(PushMessageType.Alarm.ToString()))
+                    {
+                        //浣庣數閲忔帹閫�
+                        this.UpdateDoorLockState(PushMessageType.Alarm);
+                    }
+                    else if (jpushMessageInfo.messageType.Contains(PushMessageType.Prompt.ToString()))
+                    {
+                        //寮�闂ㄦ帹閫�
+                        this.UpdateDoorLockState(PushMessageType.Prompt);
+                    }
+                }catch(Exception ex)
                 {
-                    return;
-                }
-                if (jpushMessageInfo.messageType.Contains(PushMessageType.DOOR_BELL.ToString()))
-                {
-                    ///鎵撳紑瑙嗛闂ㄩ攣
-                    this.SkipRTVActivity(expantContent.devSerial, expantContent.deviceId, expantContent.spk, true);
-                }
-                else if (jpushMessageInfo.messageType.Contains(PushMessageType.Alarm.ToString()))
-                {
-                    //浣庣數閲忔帹閫�
-                    this.UpdateDoorLockState(PushMessageType.Alarm);
-                }
-                else if (jpushMessageInfo.messageType.Contains(PushMessageType.Prompt.ToString()))
-                {
-                    //寮�闂ㄦ帹閫�
-                    this.UpdateDoorLockState(PushMessageType.Prompt);
+                    
                 }
             });
 
@@ -588,6 +639,7 @@
         {
 
             Action<bool,string> mAction;
+            Action<string> mDoorlockAnswer;
             public AndroidIHdlInterface(Action<bool,string> action)
             {
                 mAction = action;
@@ -602,7 +654,10 @@
                 mAction?.Invoke(p0,p1);
             }
 
-           
+            public void DoorlockAnswer(string p0)
+            {
+                mDoorlockAnswer?.Invoke(p0);
+            }
         }
 #endif
 

--
Gitblit v1.8.0