HDL-ON_Android/FengLinVideo/Form/ReverseCallFragment.cs
@@ -279,7 +279,7 @@ { string UserData = "user text"; //注意:RequestAudio 请求对方音频,RequestVideo请求对方视频 SendAudio发送本地音频 SendVideo 发送本地视频 一般门口不接收到视频,所以最好设置0,减少流量消耗 string param = string.Format("RequestAudio=1\r\n" + "RequestVideo=1\r\n" + "SendAudio=1\r\n" + "SendVideo=0r\n" + "UserData=%s\r\n", UserData); string param = string.Format("RequestAudio=1\r\n" + "RequestVideo=1\r\n" + "SendAudio=1\r\n" + "SendVideo=1r\n" + "UserData=%s\r\n", UserData); mPhone.AcceptRing(param); answerLayout.Visibility = ViewStates.Gone; PostAnswer(); HDL-ON_Android/Properties/AndroidManifest.xml
@@ -1,6 +1,17 @@ <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="202104011" android:versionName="1.2.202104011" package="com.hdl.onpro"> <uses-sdk android:minSdkVersion="26" android:targetSdkVersion="26" /> <!-- 可视对讲权限--> <uses-permission android:name="android.permission.CAMERA" /> <uses-feature android:name="android.hardware.camera" /> <uses-feature android:name="android.hardware.camera.autofocus" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.VIBRATE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.RECORD_AUDIO" /> <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> <!-- 定位权限--> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> HDL-ON_Android/VideoActivity.cs
@@ -169,7 +169,7 @@ mPhone.SetRemoteSurfaceHolder(mRemoteSurfaceHolder, "mRemoteSurfaceHolder!=null"); //设置来电窗口 } ViewGroup v = (ViewGroup)FindViewById(Resource.Id.localVideo); ViewGroup v = (ViewGroup)FindViewById(Resource.Id.locaVideo); mPhone.SetLocalVideoContainer(v);//设置本地视频窗口,一定要调用,不然后会出现没声音 } else HDL_ON/Common/ApiUtlis.cs
@@ -281,7 +281,7 @@ var flVideoInfo = HttpRequest.CheckFlVideo(); if(flVideoInfo.Code == StateCode.SUCCESS) { FunctionList.List.videoIntercom = Newtonsoft.Json.JsonConvert.DeserializeObject<UI.UI2.FuntionControlView.Video.VideoMethod.VideoClouds>(flVideoInfo.Data.ToString()); FunctionList.List.videoIntercom = Newtonsoft.Json.JsonConvert.DeserializeObject<UI.UI2.FuntionControlView.Video.VideoClouds>(flVideoInfo.Data.ToString()); } } HDL_ON/DAL/Server/HttpUtil.cs
@@ -17,8 +17,8 @@ /// 固定域名,正式环境 /// 公共域名就近解析 /// </summary> public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com"; //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com"; /// <summary> /// RegionMark /// </summary> HDL_ON/Entity/FunctionList.cs
@@ -131,7 +131,7 @@ /// <summary> /// 可视对讲列表 /// </summary> public UI.UI2.FuntionControlView.Video.VideoMethod.VideoClouds videoIntercom; public UI.UI2.FuntionControlView.Video.VideoClouds videoIntercom; /// <summary> /// 场景列表 HDL_ON/HDL_ON.projitems
@@ -380,7 +380,6 @@ <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\1ContorlPage\AcControlPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\1ContorlPage\FhControlPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\1ContorlPage\TvControlPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Video\MainView.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Video\View\FrameLayout50.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Video\View\FrameLayout60.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Video\View\ShowDialog.cs" /> @@ -394,6 +393,8 @@ <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\1ContorlPage\AirFreshControlPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Video\VideoMethod.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Video\VideoSend.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Video\VideoMainView.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Video\ObjectClass.cs" /> </ItemGroup> <ItemGroup> <Folder Include="$(MSBuildThisFileDirectory)DAL\" /> HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs
@@ -805,13 +805,10 @@ break; case ShowFunction.VideoIntercom: btnName.TextID = StringId.VideoIntercom; btnFunctionViewBg.MouseUpEventHandler = (sender, e) => { var mainView = new HDL_ON.UI.UI2.FuntionControlView.Video.MainView(); MainPage.BasePageView.AddChidren(mainView); mainView.Show(); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; var videoMethod = new UI2.FuntionControlView.Video.VideoMethod(); videoMethod.MianView(this,FunctionList.List.videoIntercom); }; break; HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs
@@ -286,6 +286,8 @@ { //清空之前数据 DeviceTypeList.Clear(); try { var jArray = Newtonsoft.Json.Linq.JArray.Parse(responsePackNew.Data.ToString()); for (int a = 0; a < jArray.Count; a++) { @@ -301,6 +303,11 @@ } } action(); } catch { } } else { @@ -325,6 +332,8 @@ { //清空之前数据 brandList.Clear(); try { var jArray = Newtonsoft.Json.Linq.JArray.Parse(responsePackNew.Data.ToString()); for (int a = 0; a < jArray.Count; a++) { @@ -339,7 +348,15 @@ } } } } catch { } finally { Application.RunOnMainThread(() => { actionBrand(brandList); }); } } else { HDL_ON/UI/UI2/FuntionControlView/Video/MainView.cs
File was deleted HDL_ON/UI/UI2/FuntionControlView/Video/ObjectClass.cs
New file @@ -0,0 +1,115 @@ using System; using System.Collections.Generic; namespace HDL_ON.UI.UI2.FuntionControlView.Video { public class ObjectClass { } [Serializable] public class VideoClouds { /// <summary> /// 丰林绑定id(flBindId)(userKey) /// </summary> public string id = string.Empty; /// <summary> /// 住宅id /// </summary> public string homeId = string.Empty; /// <summary> /// 虚拟手机号 /// </summary> public string phone = string.Empty; /// <summary> /// 虚拟身份证号码 /// </summary> public string idCard = string.Empty; /// <summary> /// 社区主键Id /// </summary> public string communtiyId = string.Empty; /// <summary> /// 丰林楼栋号 /// </summary> public string flBuildingId = string.Empty; /// <summary> /// 丰林楼栋名称 /// </summary> public string flBuildingName = string.Empty; /// <summary> /// 丰林房间名称 /// </summary> public string flRoomId = string.Empty; /// <summary> /// 丰林安全密钥 /// </summary> public string flSecretKey = string.Empty; /// <summary> /// 丰林的小区Id /// </summary> public string flCmtId = string.Empty; } [Serializable] public class Call { /// <summary> ///记录主键Id /// </summary> public string id = string.Empty; /// <summary> /// 住宅id /// </summary> public string homeId = string.Empty; /// <summary> /// 呼叫时间 /// </summary> public string callTime = string.Empty; /// <summary> /// 通话时长 /// </summary> public string callDuration = string.Empty; /// <summary> /// 呼叫状态(0:未接;1:已接;2:拒接) /// </summary> public string callStatus = string.Empty; /// <summary> /// 是否开锁 /// </summary> public bool isUnlock; /// <summary> /// 截图地址 /// </summary> public string screenshotUrl = string.Empty; /// <summary> ///丰林绑定主键id(门口机主键Id) /// </summary> public string flBindId = string.Empty; } [Serializable] public class CallView { /// <summary> ///年 /// </summary> public string year = string.Empty; public List<Call> callList = new List<Call>(); } [Serializable] public class FlVideo { /// <summary> /// 设备名称 /// </summary> public string aliasName = string.Empty; /// <summary> /// 设备类型:(1室内机,2室外机,3围墙机,4管理机,5二次确认机) /// </summary> public string devType = string.Empty; public string uuid = string.Empty; } } HDL_ON/UI/UI2/FuntionControlView/Video/VideoMainView.cs
New file @@ -0,0 +1,532 @@ using System; using HDL_ON.UI.Music; using System.Collections.Generic; using Shared; using HDL_ON.Stan; using ZXing.QrCode.Internal; using static HDL_ON.UI.UI2.FuntionControlView.Video.VideoMethod; namespace HDL_ON.UI.UI2.FuntionControlView.Video { public class VideoMainView : FrameLayout { /// <summary> /// 加载可视对讲UI /// </summary> /// <param name="listVideo">门口机列表</param> /// <param name="listCall">通话记录列表</param> /// <param name="video">当前的可视对讲</param> public void Show(List<FlVideo> listVideo, List<CallView> listCall, VideoClouds video) { #region 布局界面 this.BackgroundColor = MusicColor.ViewColor; var topView = new TopView(); this.AddChidren(topView.TopFLayoutView()); topView.topNameBtn.TextID = StringId.keshiduijiang; var pageView = new PageLayout() { Y = Application.GetRealHeight(64), Height = Application.GetRealHeight(667 - 64), IsShowPoint = false, }; this.AddChidren(pageView); var view1 = new FrameLayout(); pageView.AddChidren(view1); var view2 = new FrameLayout(); pageView.AddChidren(view2); View1(view1, listVideo, video); View2(view2, listCall, video); Button btn11 = new Button { X = Application.GetRealWidth(170), Y = Application.GetRealHeight(578), Width = Application.GetRealWidth(14), Height = Application.GetRealHeight(6), BackgroundColor = MusicColor.SelectedColor, Radius = (uint)Application.GetRealHeight(4), }; view1.AddChidren(btn11); Button btn12 = new Button { X = Application.GetRealWidth(192), Y = Application.GetRealHeight(578), Width = Application.GetRealWidth(14), Height = Application.GetRealHeight(6), BackgroundColor = 0x404484F4, Radius = (uint)Application.GetRealHeight(4), }; view1.AddChidren(btn12); Button btn21 = new Button { X = Application.GetRealWidth(170), Y = Application.GetRealHeight(578), Width = Application.GetRealWidth(14), Height = Application.GetRealHeight(6), BackgroundColor = 0x404484F4, Radius = (uint)Application.GetRealHeight(4), }; view2.AddChidren(btn21); Button btn22 = new Button { X = Application.GetRealWidth(192), Y = Application.GetRealHeight(578), Width = Application.GetRealWidth(14), Height = Application.GetRealHeight(6), BackgroundColor = MusicColor.SelectedColor, Radius = (uint)Application.GetRealHeight(4), }; view2.AddChidren(btn22); pageView.PageChange = (sender, e) => { if (pageView.PageIndex == 0) { topView.topNameBtn.TextID = StringId.keshiduijiang; } else { topView.topNameBtn.TextID = StringId.tonghuajilu; } }; topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { if (pageView.PageIndex == 1) { pageView.PageIndex = 0; } else { RemoveFromParent(); } }; #endregion } /// <summary> /// 第一个界面 /// </summary> /// <param name="view1">父控件</param> /// <param name="list">门口机列表</param> /// <param name="videoClouds">当前的可视对讲</param> void View1(FrameLayout view1, List<FlVideo> list, VideoClouds videoClouds) { #region 布局界面 var bjFl = new FrameLayout { Y = Application.GetRealHeight(24), X = Application.GetRealWidth(24), Height = Application.GetRealHeight(526), Width = Application.GetRealWidth(327), BackgroundImagePath = "MusicIcon/playBj.png", }; view1.AddChidren(bjFl); /// <summary> /// 汉字 /// </summary> Button nameBtn = new Button { X = Application.GetRealWidth(16), Y = Application.GetRealHeight(16), Width = Application.GetRealWidth(200), Height = Application.GetRealHeight(33), TextColor = MusicColor.MusicTxet14Color, TextSize = TextSize.Text24, TextAlignment = TextAlignment.CenterLeft, //Text = "可视对讲", TextID = StringId.keshiduijiang, }; bjFl.AddChidren(nameBtn); /// <summary> /// 区域名称 /// </summary> Button regionBtn = new Button { X = Application.GetRealWidth(16), Y = Application.GetRealHeight(53), Width = Application.GetRealWidth(270), Height = Application.GetRealHeight(17), TextColor = MusicColor.MusicNoTxetColor, TextSize = TextSize.Text12, TextAlignment = TextAlignment.CenterLeft, Text = "123456" }; // bjFl.AddChidren(regionBtn); /// <summary> ///收藏图标 /// </summary> Button collectIconBtn = new Button { X = Application.GetRealWidth(273), Y = Application.GetRealHeight(14), Width = Application.GetRealWidth(40), Height = Application.GetRealWidth(40), UnSelectedImagePath = "MusicIcon/collect.png", SelectedImagePath = "MusicIcon/collectSelected.png", }; // bjFl.AddChidren(collectIconBtn); ///可视对讲图标 Button intercomBtnIcon = new Button { X = Application.GetRealWidth(84), Y = Application.GetRealHeight(118), Width = Application.GetRealWidth(160), Height = Application.GetRealWidth(160), UnSelectedImagePath = "VideoIcon/keshiduijiang.png", }; bjFl.AddChidren(intercomBtnIcon); var vv = new VerticalScrolViewLayout { Y = Application.GetRealHeight(306), Height = Application.GetRealHeight(220), Width = Application.GetRealWidth(327), }; bjFl.AddChidren(vv); if (list.Count > 0) { //门禁二维码固定有的,虚拟一个出来 list.Add(new FlVideo { aliasName = Language.StringByID(StringId.menjinerweima), devType = "100" }); } //数组个数 //int value = 15; //先计算数据所需要的很高度; int l = 0; if (list.Count % 3 == 0) { l = list.Count / 3; } else { l = (list.Count / 3) + 1; } var fL = new FrameLayout { Height = Application.GetRealHeight((48 + 24) * l), }; vv.AddChidren(fL); int line = 0; #endregion for (int i = 1, j = 0; i <= list.Count; i++, j++) { var video = list[i - 1]; #region var fLayout = new FrameLayout { Width = Application.GetRealWidth(50), Height = Application.GetRealWidth(48), X = Application.GetRealWidth(31 + (58 + 50) * j), Y = Application.GetRealHeight(20 + (48 + 24) * line), }; fL.AddChidren(fLayout); var iconBtn = new Button { X = Application.GetRealWidth(11), Width = Application.GetRealWidth(28), Height = Application.GetRealWidth(28), UnSelectedImagePath = "VideoIcon/weiqiangji.png", }; fLayout.AddChidren(iconBtn); var deviceNameBtn = new Button { Y = iconBtn.Bottom + Application.GetRealHeight(6), Width = Application.GetRealWidth(50), Height = Application.GetRealHeight(14), TextSize = TextSize.Text10, TextColor = CSS.CSS_Color.TextualColor, TextAlignment = TextAlignment.Center, Text = video.aliasName, }; fLayout.AddChidren(deviceNameBtn); var clickBtn = new Button { Tag = video }; fLayout.AddChidren(clickBtn); if (i % 3 == 0) { //满一行重置j=0值; j = -1; line += 1; } getIconAndText(video, iconBtn); #endregion //门口机的点击事件 clickBtn.MouseUpEventHandler += (sender, e) => { var flVideo = clickBtn.Tag as FlVideo; if (flVideo.devType == "100") { //门禁二维码固定有的 VideoSend.GetQRcode(this, videoClouds, (tag, paw) => { if (tag) { //注意:密码有可能延时1分钟生效 View.ShowDialog showDialog = new View.ShowDialog(); showDialog.QRcode(paw); } }); } else { if (string.IsNullOrEmpty(flVideo.uuid)) { new Intelligence.Automation.LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.peizhicanshuyouyichang)); return; } ESVideoInfo eSVideoInfo = new ESVideoInfo { ESVideoUUID = getUuid(flVideo.uuid), DeviceName = flVideo.aliasName, roomno = videoClouds.flRoomId, unitno = videoClouds.flBuildingId, }; ESOnVideo.Current.ShowESVideoMonitor(eSVideoInfo); } }; } } /// <summary> /// 第二个界面 /// </summary> /// <param name="view2">父控件</param> /// <param name="listCall">通话记录列表</param> /// <param name="video">当前的可视对讲</param> void View2(FrameLayout view2, List<CallView> listCall, VideoClouds video) { var bjFl = new FrameLayout { Y = Application.GetRealHeight(24), X = Application.GetRealWidth(24), Height = Application.GetRealHeight(526), Width = Application.GetRealWidth(327), BackgroundImagePath = "MusicIcon/playBj.png", }; view2.AddChidren(bjFl); /// <summary> /// 汉字 /// </summary> Button nameBtn = new Button { X = Application.GetRealWidth(16), Y = Application.GetRealHeight(16), Width = Application.GetRealWidth(200), Height = Application.GetRealHeight(33), TextColor = MusicColor.MusicTxet14Color, TextSize = TextSize.Text24, TextAlignment = TextAlignment.CenterLeft, TextID = StringId.tonghuajilu, }; bjFl.AddChidren(nameBtn); /// <summary> /// 云端照片只保留30天 /// </summary> Button regionBtn = new Button { X = Application.GetRealWidth(16), Y = Application.GetRealHeight(53), Width = Application.GetRealWidth(270), Height = Application.GetRealHeight(17), TextColor = MusicColor.SelectedColor, TextSize = TextSize.Text12, TextAlignment = TextAlignment.CenterLeft, TextID = StringId.baolu30, }; bjFl.AddChidren(regionBtn); var vv = new VerticalRefreshLayout { X = Application.GetRealWidth(16), Y = Application.GetRealHeight(58 + 17), Height = Application.GetRealHeight(458 - 17), Width = Application.GetRealWidth(295), }; bjFl.AddChidren(vv); vv.BeginHeaderRefreshingAction += () => { VideoMethod videoMethod = new VideoMethod(); var list = videoMethod.GetCall(video.id); RefreshView(vv, list); //关闭刷新View; vv.EndHeaderRefreshing(); }; RefreshView(vv, listCall); } /// <summary> /// 通话记录刷新界面 /// </summary> /// <param name="vv">上下滑动控件</param> /// <param name="listCall">通话记录列表</param> public void RefreshView(VerticalRefreshLayout vv, List<CallView> listCall) { vv.RemoveAll(); for (int i = 0; i < listCall.Count; i++) { var year = listCall[i]; //年文本父控件 View.FrameLayout50 frameLayout50 = new View.FrameLayout50(); vv.AddChidren(frameLayout50.FLayoutView()); frameLayout50.btnText.Text = year.year + Language.StringByID(StringId.nian);//年 for (int j = 0; j < year.callList.Count; j++) { var call = year.callList[j]; //门口机状态父控件 View.FrameLayout60 frameLayout60 = new View.FrameLayout60(); vv.AddChidren(frameLayout60.FLayoutView()); ///呼叫时间 frameLayout60.btnTime.Text = getTime(call.callTime); ///呼叫状态(0:未接;1:已接;2:拒接);是否开锁; frameLayout60.btnStateText.Text = getStateText(call.callStatus) + "," + getUnlockText(call.isUnlock); } } } /// <summary> /// 显示图标 /// </summary> /// <param name="flVideo"></param> /// <param name="iconBtn">图标</param> private void getIconAndText(FlVideo flVideo, Button iconBtn) { //(1室内机,2室外机,3围墙机,4管理机,5二次确认机) string iconstr = ""; switch (flVideo.devType) { case "1": { iconstr = "VideoIcon/danyuanji.png"; } break; case "2": { iconstr = "VideoIcon/danyuanji.png"; } break; case "3": { iconstr = "VideoIcon/weiqiangji.png"; } break; case "4": { iconstr = "VideoIcon/weiqiangji.png"; } break; case "5": { iconstr = "VideoIcon/weiqiangji.png"; } break; case "100": { iconstr = "VideoIcon/menjin.png"; } break; default: { iconstr = "VideoIcon/weiqiangji.png"; } break; } iconBtn.UnSelectedImagePath = iconstr; } /// <summary> /// 获取显示时间文本 /// </summary> /// <param name="str">utcTime</param> /// <returns></returns> private string getTime(string str) { var utcTime = Convert.ToDateTime(str); var dateTime = TimeZoneInfo.ConvertTimeFromUtc(utcTime, TimeZoneInfo.Local); return dateTime.ToString("HH") + ":" + dateTime.ToString("mm"); } /// <summary> /// 获取呼叫状态文本 /// </summary> /// <param name="str">状态值0:未接;1:已接;2:拒接</param> /// <returns></returns> private string getStateText(string str) { string s = ""; switch (str) { case "0": { s = Language.StringByID(StringId.weijieting); } break; case "1": { s = Language.StringByID(StringId.yijieting); } break; case "2": { s = Language.StringByID(StringId.yijujue); } break; } return s; } /// <summary> /// 获取开锁状态文本 /// </summary> /// <param name="if_bool"></param> /// <returns></returns> private string getUnlockText(bool if_bool) { string s = ""; if (if_bool) { s = Language.StringByID(StringId.yikaisuo); } else { s = Language.StringByID(StringId.weikaisuo); } return s; } /// <summary> /// 获取uuid /// </summary> /// <param name="uuid"></param> /// <returns></returns> private string getUuid(string uuid) { if (uuid.Contains(",")) { var uuid1 = uuid.Split(','); return uuid1[0]; } else { return uuid; } } } } HDL_ON/UI/UI2/FuntionControlView/Video/VideoMethod.cs
@@ -8,66 +8,71 @@ { public class VideoMethod { ///// <summary> ///// 程序主入口 ///// </summary> ///// <param name="frameLayout">log父控件</param> ///// <param name="video">可视对讲对象</param> //public void MianView(FrameLayout frameLayout, VideoClouds video) //{ // //加载log // Loading loading = new Loading(); // frameLayout.AddChidren(loading); // loading.Start(); // List<VideoMethod.FlVideo> listESVideoInfo = new List<VideoMethod.FlVideo>(); // List<CallView> listCall = new List<CallView>(); // new System.Threading.Thread(() => // { // try // { // listESVideoInfo = VideoSend.GetVideoInfoList(video); // listCall = getCall(video.id); // } // catch // { // } // finally // { // Application.RunOnMainThread(() => // { // loading.Hide(); // var mainView = new HDL_ON.UI.UI2.FuntionControlView.Video.MainView(); // MainPage.BasePageView.AddChidren(mainView); // mainView.Show(); // MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; // }); // } // }) // { IsBackground = true }.Start(); //} ///// <summary> ///// 获取可视对讲 ///// </summary> ///// <param name="action">回调函数</param> ///// <param name="frame">log父控件</param> //public void getVideo(Action<VideoClouds> action, FrameLayout frame, bool tag) //{ // ThreadSend(null, (responsePackNew) => // { // try // { // var str = responsePackNew.Data.ToString(); // var videoObj = Newtonsoft.Json.JsonConvert.DeserializeObject<VideoClouds>(str); // action(videoObj); // } // catch { } // }, "获取可视对讲", "fram", frame, null, tag); //} /// <summary> /// 程序主入口 /// </summary> /// <param name="frameLayout">log父控件</param> /// <param name="video">可视对讲对象</param> public void MianView(FrameLayout frameLayout, VideoClouds video) { //加载log Loading loading = new Loading(); frameLayout.AddChidren(loading); loading.Start(); List<FlVideo> listESVideoInfo = new List<FlVideo>(); List<CallView> listCall = new List<CallView>(); new System.Threading.Thread(() => { try { listESVideoInfo = VideoSend.GetVideoInfoList(video); listCall = GetCall(video.id); } catch { } finally { Application.RunOnMainThread(() => { loading.Hide(); var mainView = new VideoMainView(); MainPage.BasePageView.AddChidren(mainView); mainView.Show(listESVideoInfo, listCall, video); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }); } }) { IsBackground = true }.Start(); } /// <summary> /// 获取可视对讲 /// </summary> /// <param name="action">回调函数</param> /// <param name="frame">log父控件</param> /// <param name="tag">是否要显示log(默认显示tag=true)</param> public void GetVideo(Action<VideoClouds> action, FrameLayout frame, bool tag) { VideoClouds videoObj =null; ThreadSend(null, (responsePackNew) => { try { var str = responsePackNew.Data.ToString(); videoObj = Newtonsoft.Json.JsonConvert.DeserializeObject<VideoClouds>(str); action(videoObj); } catch { action(videoObj); } }, "获取可视对讲", "fram", frame, null, tag); } /// <summary> /// 获取历史通话记录 /// </summary> /// <param name="id"></param> public List<CallView> getCall(string id) public List<CallView> GetCall(string id) { List<CallView> callViewList = new List<CallView>(); try @@ -137,9 +142,8 @@ /// <param name="frame">log父控件</param> /// <param name="dialog">log父控件</param> /// <param name="tag">是否要显示log</param> public void ThreadSend(VideoClouds videoObj, Action<ResponsePackNew> action, string str, string view, FrameLayout frame, Dialog dialog, bool tag = true) public static void ThreadSend(VideoClouds videoObj, Action<ResponsePackNew> action, string str, string view, FrameLayout frame, Dialog dialog, bool tag = true) { //加载log Loading loading = new Loading(); if (view == "dialog") @@ -202,114 +206,19 @@ } /// <summary> /// 随机密码6位 /// </summary> /// <returns></returns> public static string GetCode() { Random rand = new Random(); string code = ""; for (int ctr = 0; ctr < 6; ctr++) { code += rand.Next(10).ToString(); } return code; } /// <summary> /// 获取当前时间戳 /// </summary> /// <returns></returns> public static string GetCurrentTimeStamp() { //TimeSpan ts = DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0); //return Convert.ToInt64(ts.TotalSeconds).ToString(); System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1)); // 当地时区 [Serializable] public class VideoClouds { /// <summary> /// 丰林绑定id(flBindId)(userKey) /// </summary> public string id = string.Empty; /// <summary> /// 住宅id /// </summary> public string homeId = string.Empty; /// <summary> /// 虚拟手机号 /// </summary> public string phone = string.Empty; /// <summary> /// 虚拟身份证号码 /// </summary> public string idCard = string.Empty; /// <summary> /// 社区主键Id /// </summary> public string communtiyId = string.Empty; /// <summary> /// 丰林楼栋号 /// </summary> public string flBuildingId = string.Empty; /// <summary> /// 丰林楼栋名称 /// </summary> public string flBuildingName = string.Empty; /// <summary> /// 丰林房间名称 /// </summary> public string flRoomId = string.Empty; /// <summary> /// 丰林安全密钥 /// </summary> public string flSecretKey = string.Empty; /// <summary> /// 丰林的小区Id /// </summary> public string flCmtId = string.Empty; return ((long)(DateTime.Now - startTime).TotalSeconds).ToString(); // 相差秒数 } [Serializable] public class Call { /// <summary> ///记录主键Id /// </summary> public string id = string.Empty; /// <summary> /// 住宅id /// </summary> public string homeId = string.Empty; /// <summary> /// 呼叫时间 /// </summary> public string callTime = string.Empty; /// <summary> /// 通话时长 /// </summary> public string callDuration = string.Empty; /// <summary> /// 呼叫状态(0:未接;1:已接;2:拒接) /// </summary> public string callStatus = string.Empty; /// <summary> /// 是否开锁 /// </summary> public bool isUnlock; /// <summary> /// 截图地址 /// </summary> public string screenshotUrl = string.Empty; /// <summary> ///丰林绑定主键id(门口机主键Id) /// </summary> public string flBindId = string.Empty; /// <summary> /// 获取当前时间戳 /// </summary> /// <returns></returns> public static string GetTomorrowTimeStamp() { //当前时间的后一天 //TimeSpan ts = DateTime.Now.AddDays(1) - new DateTime(1970, 1, 1, 0, 0, 0, 0); //return Convert.ToInt64(ts.TotalSeconds).ToString(); System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1)); // 当地时区 return ((long)(DateTime.Now.AddDays(1) - startTime).TotalSeconds).ToString(); // 相差秒数 } [Serializable] public class CallView { /// <summary> ///年 /// </summary> public string year = string.Empty; public List<Call> callList = new List<Call>(); } [Serializable] public class FlVideo { /// <summary> /// 设备名称 /// </summary> public string aliasName = string.Empty; /// <summary> /// 设备类型:(1室内机,2室外机,3围墙机,4管理机,5二次确认机) /// </summary> public string devType = string.Empty; public string uuid = string.Empty; } } } HDL_ON/UI/UI2/FuntionControlView/Video/VideoSend.cs
@@ -12,8 +12,6 @@ public class VideoSend { /// <summary> /// 检查住宅是否绑定丰林,并获取门口机列表 /// </summary> @@ -24,23 +22,22 @@ var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_FL_Check); return responsePackNew; } /// <summary> /// 获取通话记录 /// </summary> /// <returns></returns> public static ResponsePackNew GetCall(string flBindId) { var jObject = new JObject { { "homeId", PirSend.HomeId }, { "flBindId", flBindId }, { "pageSize", 100 } }; var jObject = new JObject { { "homeId", PirSend.HomeId }, { "flBindId", flBindId }, { "pageSize", int.MaxValue } }; var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_FL_GetCallList); return responsePackNew; } /// <summary> /// 获取门口机列表(1室内机,2室外机,3围墙机,4管理机,5二次确认机) /// </summary> public static List<VideoMethod.FlVideo> GetVideoInfoList(VideoMethod.VideoClouds video) public static List<FlVideo> GetVideoInfoList(VideoClouds video) { List<VideoMethod.FlVideo> eSVideoInfosList = new List<VideoMethod.FlVideo>(); List<FlVideo> eSVideoInfosList = new List<FlVideo>(); var jobject = new JObject(); jobject.Add("cmtID", video.flCmtId); jobject.Add("unitno", video.flBuildingId); @@ -61,38 +58,27 @@ { return eSVideoInfosList; } eSVideoInfosList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<VideoMethod.FlVideo>>(json["list"].ToString()); eSVideoInfosList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<FlVideo>>(json["list"].ToString()); } catch { } return eSVideoInfosList; } /// <summary> /// 随机密码6位 /// </summary> /// <returns></returns> public static string getCode() { Random rand = new Random(); string code = ""; for (int ctr = 0; ctr < 6; ctr++) { code += rand.Next(10).ToString(); } return code; } /// <summary> /// 上报动态开锁密码(注意:密码有可能延时1分钟生效) /// </summary> public static void GetQRcode(FrameLayout frame, VideoMethod.VideoClouds video, Action<bool, string> action) public static void GetQRcode(FrameLayout frame, VideoClouds video, Action<bool, string> action) { System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1)); // 当地时区 var timeStamp = ((long)(DateTime.Now - startTime).TotalSeconds).ToString(); // 相差秒数 var timeStamp2 = ((long)(DateTime.Now.AddDays(1) - startTime).TotalSeconds).ToString(); // 相差秒数 ///标记是否成功 bool if_bool = false; //临时密码 string pwd = getCode(); string pwd = VideoMethod.GetCode(); var jobject = new JObject(); jobject.Add("communityID", video.flCmtId);//社区ID jobject.Add("fromTime", timeStamp);//开始时间 jobject.Add("validTime", timeStamp2);//有效时间 jobject.Add("fromTime", VideoMethod.GetCurrentTimeStamp());//开始时间 jobject.Add("validTime", VideoMethod.GetTomorrowTimeStamp());//有效时间 jobject.Add("unitno", video.flBuildingId);//单元号 jobject.Add("roomno", video.flRoomId);//房间号 jobject.Add("code", pwd); jobject.Add("userKey", video.id); jobject.Add("timestamp", timeStamp); jobject.Add("secretKey", video.flSecretKey); jobject.Add("method", "setdynamicpwd"); jobject.Add("numTimes", "5"); jobject.Add("code", pwd); jobject.Add("userKey", video.id); jobject.Add("timestamp", VideoMethod.GetCurrentTimeStamp()); jobject.Add("secretKey", video.flSecretKey); jobject.Add("method", "setdynamicpwd"); jobject.Add("numTimes", "5"); //加载log Loading loading = new Loading(); frame.AddChidren(loading);