wjc
2023-04-06 75a2f82f91d6568c0b3ea60ea93086e65f8a2e49
HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/CommonMethod.cs
@@ -2,7 +2,9 @@
using HDL_ON.Entity;
using System.Collections.Generic;
using Shared;
using HDL_ON.DAL.Server;
#if __IOS__
using Foundation;
#else
using Com.Videogo.Hdl;
#endif
@@ -49,34 +51,44 @@
            this.InitializationAndroidData((isEzChildAccessToken) =>
            {
                this.MainThread(() =>
                this.SunThread(() =>
                {
#if __IOS__
                    //跳转添加萤石设备
                    ezsdkDelegate = new IosIHdlInterface();
                    ezsdkDelegate.mAction += (serials) =>
                    var list = this.GetVideoDoorLockLockModelsList("notAllowedConfigNetworkModels");
                    this.MainThread(() =>
                    {
                        this.GetYingshiDeviceList(serials);
                    };
                    EZSDK.IOS.EZSDK.SharedInstance().Delegate = ezsdkDelegate;
                    EZSDK.IOS.EZSDK.SharedInstance().AddEzvizMonitorWithDeviceType(spk);
#if __IOS__
                        //跳转添加萤石设备
                        ezsdkDelegate = new IosIHdlInterface();
                        ezsdkDelegate.mAction += (serials) =>
                        {
                            this.GetYingshiDeviceList(serials);
                        };
                        EZSDK.IOS.EZSDK.SharedInstance().Delegate = ezsdkDelegate;
                        NSObject[] nSObject = new NSObject[list.Count];
                        for (int i = 0; i < list.Count; i++)
                        {
                            string strValue = list[i];
                            nSObject[i] = new NSString(strValue);
                        }
                        EZSDK.IOS.EZSDK.SharedInstance().ConnectTipModels = nSObject;
                        EZSDK.IOS.EZSDK.SharedInstance().AddEzvizMonitorWithDeviceType(spk);
#else
                HDLEzvizSdk.Instance.JumpToEZScanActivity(Application.Activity,spk);
                HDLEzvizSdk.SetAddCallback(new AndroidIHdlInterface((isBool, serials) =>
                {
                    if (isBool)
                    HDLEzvizSdk.Instance.JumpToEZScanActivity(Application.Activity, spk,list);
                        HDLEzvizSdk.SetAddCallback(new AndroidIHdlInterface((isBool, serials) =>
                    {
                        this.GetYingshiDeviceList(serials);
                    }
                        if (isBool)
                        {
                            this.GetYingshiDeviceList(serials);
                        }
                }));
                    }));
#endif
                    });
                });
            });
@@ -274,11 +286,69 @@
        /// 获取【门锁型号】列表
        /// </summary>
        /// <returns>返回结果不会为null</returns>
        public List<string> GetVideoDoorLockLockModelsList()
        public List<string> GetVideoDoorLockLockModelsList(string mode = "lockModels")
        {
            return VideDoorLockSend.Current.GetVideoDoorLockLockModelsList();
            return VideDoorLockSend.Current.GetVideoDoorLockLockModelsList(mode);
        }
        /// <summary>
        /// 门锁推送
        /// </summary>
        /// <param name="pushMessageType"></param>
        /// <param name="jPushMessageInfo"></param>
        public void DoorLockPush(JPushMessageInfo jpushMessageInfo)
        {
            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)
                {
                    return;
                }
                if (expantContent.spk != SPK.VideoDoorLock)
                {
                    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);
                }
            });
        }
        /// <summary>
        /// 更新开锁图标和电池状态
        /// </summary>
        private void UpdateDoorLockState(PushMessageType pushMessageType)
        {
            int childrenCount = MainPage.BasePageView.ChildrenCount - 1;
            for (int i = childrenCount; childrenCount > i; i--)
            {
                View view = MainPage.BasePageView.GetChildren(i);
                if (view is VideoDoorLockPage)
                {
                    VideoDoorLockPage videoDoorLockPage = (VideoDoorLockPage)view;
                    if (videoDoorLockPage != null)
                    {
                        videoDoorLockPage.UpdateState(pushMessageType);
                    }
                }
            }
        }
        /// <summary>
        /// 获取萤石视频【门锁】列表
        /// </summary>
@@ -292,37 +362,6 @@
#endif
            return list;
        }
        /// <summary>
        /// 更新开锁图标和电池状态
        /// </summary>
        public void UpdateDoorLockState(PushMessageType pushMessageType, string homeId, string spk, string stateContent)
        {
            if (spk != SPK.VideoDoorLock)
            {
                return;
            }
            this.MainThread(() =>
            {
                int childrenCount = MainPage.BasePageView.ChildrenCount - 1;
                for (int i = childrenCount; childrenCount > i; i--)
                {
                    View view = MainPage.BasePageView.GetChildren(i);
                    if (view is VideoDoorLockPage)
                    {
                        VideoDoorLockPage videoDoorLockPage = (VideoDoorLockPage)view;
                        if (videoDoorLockPage != null)
                        {
                            videoDoorLockPage.UpdateState(pushMessageType);
                        }
                    }
                }
            });
        }
        #region  --------- 功能文件保存,删除 --------
        /// <summary>
        /// 保存本地文件
@@ -482,6 +521,8 @@
                new PublicAssmebly().TipMsgAutoClose(msg, false, time * 1000);
            });
        }
        #endregion
        /// <summary>
        /// 弹框类型
@@ -501,6 +542,7 @@
            collect,//收藏
            room,//房间
            push,//推送
            sanfan,//三方
        }
#if __IOS__