| | |
| | | using HDL_ON.Entity; |
| | | using System.Collections.Generic; |
| | | using Shared; |
| | | #if __IOS__ |
| | | #else |
| | | using Com.Videogo.Hdl; |
| | | #endif |
| | | |
| | | namespace HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock |
| | | { |
| | |
| | | public class CommonMethod |
| | | { |
| | | private Loading loading; |
| | | private static CommonMethod commonMethod = null; |
| | | /// <summary> |
| | | /// 记录当前界面索引值 |
| | | /// </summary> |
| | | private int pageLayoutIndexValue; |
| | | |
| | | private static CommonMethod commonMethod = null; |
| | | /// <summary> |
| | | /// 获取对象 |
| | | /// </summary> |
| | | public static CommonMethod Current |
| | | { |
| | | get |
| | |
| | | |
| | | } |
| | | |
| | | #region --------- 跳转到Android那边的方法(萤石视频门锁) -------- |
| | | #region --------- 跳转到Android那边的方法(萤石视频门锁) -------- |
| | | /// <summary> |
| | | /// 添加设备到云端 |
| | | /// 读取云端的上设备列表(android源生添加设备到云端成功后) |
| | | /// <paramref name="devSerial"/>设备序列号</param> |
| | | /// </summary> |
| | | public void SkipAddDeviceActivity(string devSerial) |
| | | public void SkipAddDeviceActivity(string spk) |
| | | { |
| | | if (string.IsNullOrEmpty(devSerial)) return; |
| | | new System.Threading.Thread(() => |
| | | { |
| | | var list = VideDoorLockSend.Current.GetVideoDoorLockDeviceList(SPK.VideoDoorLock); |
| | | if (list.Count > 0) |
| | | { |
| | | var function = list.Find((o) => o.sid == devSerial); |
| | | if (function != null) |
| | | { |
| | | this.SaveFunctionFile(function); |
| | | } |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | //未实现 |
| | | #if __IOS__ |
| | | |
| | | #else |
| | | this.InitializationAndroidData((isBools) => |
| | | { |
| | | if (!isBools) { |
| | | this.MainThread(()=> { |
| | | this.ShowTip("先获取萤石云子账号token失败。"); |
| | | |
| | | }); |
| | | } |
| | | HDLEzvizSdk.Instance.JumpToEZScanActivity(Application.Activity,spk); |
| | | HDLEzvizSdk.SetAddCallback(new AndroidIHdlInterface((isBool, adnroidActionDevSerial) => |
| | | { |
| | | if (isBool) |
| | | { |
| | | |
| | | var list = VideDoorLockSend.Current.GetVideoDoorLockDeviceList(SPK.VideoDoorLock); |
| | | if (list.Count > 0) |
| | | { |
| | | var function = list.Find((o) => o.sid == adnroidActionDevSerial); |
| | | if (function != null) |
| | | { |
| | | this.SaveFunctionFile(function); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | })); |
| | | }); |
| | | |
| | | |
| | | |
| | | #endif |
| | | |
| | |
| | | /// <param name="spk">设备spk(云雀上定义好的)</param> |
| | | public void SkipRTVActivity(string deviceSerial, string deviceId, string spk) |
| | | { |
| | | Video.View.ShowDialog.Currnet.ClickBox(Language.StringByID(StringId.laizimenlinghujiao), (dialog) => |
| | | { |
| | | dialog.Close(); |
| | | }, (dialog) => |
| | | { |
| | | dialog.Close(); |
| | | }); |
| | | #if __IOS__ |
| | | #else |
| | | this.InitializationAndroidData((isBools) => |
| | | { |
| | | if (!isBools) |
| | | { |
| | | this.MainThread(() => { |
| | | this.ShowTip("先获取萤石云子账号token失败。"); |
| | | |
| | | }); |
| | | } |
| | | Video.View.ShowDialog.Currnet.ClickBox(Language.StringByID(StringId.laizimenlinghujiao), (dialog) => |
| | | { |
| | | dialog.Close(); |
| | | HDLEzvizSdk.Instance.JumpToEZRealPlayActivity(Application.Activity,deviceId,deviceSerial,spk); |
| | | }, (dialog) => |
| | | { |
| | | dialog.Close(); |
| | | }); |
| | | |
| | | }); |
| | | |
| | | |
| | | #endif |
| | | //jumpToEZRealPlayActivity(Shared.Application.Activity, deviceId, deviceSerial, spk) |
| | | } |
| | | /// <summary> |
| | | /// 浏览历史记录 |
| | | /// </summary> |
| | | public void SkipRecordActivity() |
| | | public void SkipRecordActivity(string deviceId) |
| | | { |
| | | this.InitializationAndroidData((s)=> { |
| | | |
| | | #if __IOS__ |
| | | #else |
| | | HDLEzvizSdk.Instance.JumpLockHistoryActivity(Application.Activity, deviceId); |
| | | #endif |
| | | |
| | | }); |
| | | //未实现 |
| | | //this.InitializationAndroidData(); |
| | | // |
| | | } |
| | | /// <summary> |
| | | /// 临时密码开门 |
| | | /// <paramref name="deviceId"/> |
| | | /// </summary> |
| | | public void SkipPSWActivity() |
| | | public void SkipPSWActivity(string deviceId) |
| | | { |
| | | //jumpTempPasswordActivity(Application.Activity, deviceId); |
| | | |
| | | this.InitializationAndroidData((isBools) => |
| | | { |
| | | if (!isBools) |
| | | { |
| | | this.MainThread(() => |
| | | { |
| | | this.ShowTip("先获取萤石云子账号token失败。"); |
| | | |
| | | }); |
| | | } |
| | | #if __IOS__ |
| | | #else |
| | | HDLEzvizSdk.Instance.JumpTempPasswordActivity(Application.Activity, deviceId); |
| | | #endif |
| | | |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | public void InitializationAndroidData(Action<bool> action) |
| | | { |
| | | |
| | | |
| | | bool isBool = true; |
| | | this.SunThread(() => |
| | | { |
| | |
| | | { |
| | | //Token |
| | | isBool = false; |
| | | return; |
| | | return; |
| | | } |
| | | Application.RunOnMainThread(() => |
| | | { |
| | |
| | | //初始化萤石云SDK,中文国内key、英文海外key 开发者账号使用应用包名申请的APPKEY,不同包名应用需配置不同的APPKEY |
| | | EZSDK.IOS.EZSDK.SharedInstance().InitLibWithAppKey("1aa98a90489b4838b966b57018b4b04b", "1aa98a90489b4838b966b57018b4b04b"); |
| | | //1.设置所需河东的AccessToken和RefreshToken、域名地址 |
| | | EZSDK.IOS.EZSDK.SharedInstance().SetHDlAccessToken(UserVideoDoorLockInfo.Current.LoginTokenString, UserVideoDoorLockInfo.Current.RefreshToken); |
| | | EZSDK.IOS.EZSDK.SharedInstance().SetHDlAccessToken(UserInfo.Current.LoginTokenString, UserInfo.Current.RefreshToken); |
| | | EZSDK.IOS.EZSDK.SharedInstance().SetRequestHttpsHostAndPlatform(OnAppConfig.Instance.RequestHttpsHost, 1, DB_ResidenceData.Instance.CurrentRegion.id); |
| | | //2.设置萤石子账号的AccessToken到SDK |
| | | EZSDK.IOS.EZSDK.SharedInstance().SetEZAccessToken(ezChildAccessToken); |
| | |
| | | //info.de |
| | | //EZSDK.IOS.EZSDK.Play(info); |
| | | #else |
| | | //Android |
| | | //1.设置所需河东的token、域名地址 |
| | | //2.设置萤石子账号的token |
| | | //3.打开摄像头设备列表页面 |
| | | ((BaseActivity)Shared.Application.Activity).SetCamera(b => |
| | | { |
| | | if (b) |
| | | { |
| | | ((BaseActivity)Shared.Application.Activity).SetPermission(result => |
| | | { |
| | | if (result) |
| | | { |
| | | Android.Content.Intent intent = new Android.Content.Intent(); |
| | | var bundle = new Android.OS.Bundle(); |
| | | //传递name参数为tinyphp |
| | | bundle.PutString("EzChildAccessToken", ezChildAccessToken); |
| | | bundle.PutString("HdlToken", UserInfo.Current.LoginTokenString); |
| | | bundle.PutString("HdlrefreshToken", UserInfo.Current.RefreshToken); |
| | | bundle.PutString("Url", OnAppConfig.Instance.RequestHttpsHost); |
| | | bundle.PutString("EzvizAppKey", "1aa98a90489b4838b966b57018b4b04b"); |
| | | bundle.PutInt("Platform", 1); |
| | | bundle.PutString("HomeId", DB_ResidenceData.Instance.CurrentRegion.id); |
| | | intent.PutExtras(bundle); |
| | | //intent.SetComponent(new Android.Content.ComponentName(Shared.Application.Activity, "com.videogo.MainActivity")); |
| | | //Shared.Application.Activity.StartActivity(intent); |
| | | } |
| | | }, "android.permission.RECORD_AUDIO"); |
| | | HDLEzvizSdk.Instance.Init(Application.Activity.Application, ezChildAccessToken, UserInfo.Current.LoginTokenString, UserInfo.Current.RefreshToken, OnAppConfig.Instance.RequestHttpsHost, "1aa98a90489b4838b966b57018b4b04b", 1, DB_ResidenceData.Instance.CurrentRegion.id); |
| | | |
| | | } |
| | | }); |
| | | #endif |
| | | }); |
| | | |
| | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 更换住宅 |
| | | /// </summary> |
| | |
| | | if (DB_ResidenceData.Instance.CurrentRegion.id == home.id || string.IsNullOrEmpty(home.id)) return; |
| | | |
| | | } |
| | | #endregion |
| | | #endregion |
| | | |
| | | /// <summary> |
| | | /// 萤石视频门锁的图标 |
| | |
| | | } |
| | | |
| | | } |
| | | #region --------- 功能文件保存,删除 -------- |
| | | #region --------- 功能文件保存,删除 -------- |
| | | /// <summary> |
| | | /// 保存本地文件 |
| | | /// </summary> |
| | |
| | | FunctionList.List.DeleteFunction(function); |
| | | MainPage.Log($"文件删除->{function.name}-->{function.spk}"); |
| | | } |
| | | #endregion |
| | | #endregion |
| | | /// <summary> |
| | | /// 获取Loading对象 |
| | | /// </summary> |
| | |
| | | { |
| | | get |
| | | { |
| | | if (loading == null) |
| | | this.MainThread(() => |
| | | { |
| | | loading = new Loading(); |
| | | } |
| | | if (MainPage.BasePageView.ChildrenCount < 1) |
| | | { |
| | | return loading; |
| | | } |
| | | View view = MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1); |
| | | if (view is FrameLayout) |
| | | { |
| | | ((FrameLayout)view).AddChidren(loading); |
| | | } |
| | | else if (view is PageLayout) |
| | | { |
| | | ((PageLayout)view).AddChidren(loading); |
| | | } |
| | | //if (loading != null && this.pageLayoutIndexValue == MainPage.BasePageView.ChildrenCount - 1) |
| | | //{ |
| | | // //防止二重添加对象 |
| | | // return; |
| | | //} |
| | | if (loading == null)//|| MainPage.BasePageView.ChildrenCount < 1) |
| | | { |
| | | loading = new Loading(); |
| | | } |
| | | //loading.BringToFront(); |
| | | Application.MainPage.AddChidren(loading); |
| | | //View view = MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1); |
| | | //if (view is ViewGroup) |
| | | //{ |
| | | // pageLayoutIndexValue = MainPage.BasePageView.ChildrenCount - 1; |
| | | // ((ViewGroup)view).AddChidren(loading); |
| | | //} |
| | | }); |
| | | return loading; |
| | | } |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取萤石视频门锁列表 |
| | | /// </summary> |
| | |
| | | #endif |
| | | return list; |
| | | } |
| | | #region ---------自定义线程(子线程,主线程)-------- |
| | | #region ---------自定义线程(子线程,主线程)-------- |
| | | /// <summary> |
| | | /// 子线程 |
| | | /// </summary> |
| | |
| | | }); |
| | | |
| | | } |
| | | #endregion |
| | | #region --------- 提示框,确认框 -------- |
| | | #endregion |
| | | #region --------- 提示框,确认框 -------- |
| | | /// <summary> |
| | | /// 对话框(只要程序报错的时候才用到) |
| | | /// </summary> |
| | |
| | | new PublicAssmebly().TipMsgAutoClose(msg, false, time * 1000); |
| | | }); |
| | | } |
| | | #endregion |
| | | #endregion |
| | | /// <summary> |
| | | /// 弹框类型 |
| | | /// </summary> |
| | |
| | | room,//房间 |
| | | push,//推送 |
| | | } |
| | | |
| | | #if __IOS__ |
| | | #else |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public class AndroidIHdlInterface : Java.Lang.Object, IHdlInterface |
| | | { |
| | | |
| | | Action<bool,string> mAction; |
| | | public AndroidIHdlInterface(Action<bool,string> action) |
| | | { |
| | | mAction = action; |
| | | } |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="p0">true是入网成功(源生回调返回)</param> |
| | | /// <param name="p1">设备的序列化(源生回调返回)</param> |
| | | public void AddCallback(bool p0, string p1) |
| | | { |
| | | mAction?.Invoke(p0,p1); |
| | | } |
| | | |
| | | |
| | | } |
| | | #endif |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | } |