HDL-ON_Android/Assets/Language.ini
@@ -1290,6 +1290,24 @@ 1086=风速3档 4000=可视对讲 4001=通话记录 4002=*云端照片只保留30天 4003=门口机呼叫 4004=已接听 4005=已开锁 4006=年 4007=来自 4008=呼叫 4009=未开锁 4010=未接听 4011=已拒绝 4012=配置参数有异常! 4013=门禁二维码 4014=临时密码 5000=音乐 5001=组合 5002=设置 HDL-ON_Android/FengLinVideo/Form/MonitorFragment.cs
@@ -38,7 +38,7 @@ private TextView unlockText; // 更新线程 private Thread thread = null; public static Thread thread = null; public MonitorFragment(VideoPhone phone) { HDL-ON_Android/FengLinVideo/Form/ReverseCallFragment.cs
@@ -113,6 +113,7 @@ } } public static Thread unlockThread = null;//公开出来,关闭activity的时候要结束这个线程,不然会引起崩溃 /// <summary> /// 更新开锁按钮状态,开锁成功,15秒内不给再点击按钮 /// </summary> @@ -124,15 +125,28 @@ unlockImg.Enabled = false; new Thread(() => { Thread.Sleep(15 * 1000); Activity.RunOnUiThread(() => { if (unlockImg != null) unlockImg.Enabled = true; }); }).Start(); unlockThread = new Thread(() => { try { Thread.Sleep(15 * 1000); Activity.RunOnUiThread(() => { try { if (unlockImg != null) unlockImg.Enabled = true; } catch { } }); } catch { } });//.Start(); unlockThread.Start(); PostUnlock(); } catch { } } @@ -218,7 +232,7 @@ switch (event1) { case "EVT_RECV_CUSTOM_DATA": case "EVT_RECV_CUSTOM_DATA":// 开锁成功 string data = tp.GetString("data"); UpdataUnlockState(); break; @@ -317,7 +331,7 @@ Dictionary<string, object> d = new Dictionary<string, object>(); d.Add("callId", VideoActivity.CallId); d.Add("images", images); d.Add("imagesName", img_name); d.Add("imagesName", "_Android.jpg"); string jsonString = HttpUtil.GetSignRequestJson(d); string url = "/home-wisdom/app/fl/vi/screenshot"; @@ -400,5 +414,27 @@ }).Start(); } /// <summary> /// post 开锁记录 /// </summary> private void PostUnlock() { new Thread(() => { try { Dictionary<string, object> d = new Dictionary<string, object>(); d.Add("callId", VideoActivity.CallId);//呼叫记录id int string jsonString = HttpUtil.GetSignRequestJson(d); string url = "/home-wisdom/app/fl/vi/unlock"; ResponsePackNew response = HttpUtil.RequestHttpsPost(url, jsonString); Log.Info("FengLinVideo", "Post Reject Response code=" + response.Code); } catch { } }).Start(); } } } HDL-ON_Android/Resources/Resource.designer.cs
Diff too large HDL-ON_Android/VideoActivity.cs
@@ -43,7 +43,7 @@ public static int Tpye = 0;//类型,0 监控,1反呼 public static string UUId; public static int CallId;//callId 呼叫记录id public static string CallId;//callId 呼叫记录id public static string CmtID;//cmtID 丰林社区号 public static string Roomno;//roomno 丰林房间号 public static string Unitno;//unitno 丰林楼栋号 string @@ -60,7 +60,7 @@ ESVideoUUID = Intent.GetStringExtra("ESVideoUUID");//室外机UUID,例:JJY000007FSEYX DeviceName = Intent.GetStringExtra("DeviceName");//室外机的名称,例,室外机 UUId = Intent.GetStringExtra("uuid");// CallId = Intent.GetIntExtra("callId", 0); CallId = Intent.GetStringExtra("callId"); CmtID = Intent.GetStringExtra("cmtID"); Roomno = Intent.GetStringExtra("roomno"); Unitno = Intent.GetStringExtra("unitno"); @@ -215,6 +215,28 @@ mPhone = null; //mPhone.OnActivityDestroy(); } if (ReverseCallFragment.unlockThread != null) { try { // ReverseCallFragment.unlockThread.Interrupt(); } catch { } ReverseCallFragment.unlockThread = null; } if (MonitorFragment.thread != null) { try { // MonitorFragment.thread.Interrupt(); } catch { } MonitorFragment.thread = null; } } public override void OnBackPressed() HDL-ON_iOS/Resources/Language.ini
@@ -1288,6 +1288,22 @@ 1086=风速3档 4000=可视对讲 4001=通话记录 4002=*云端照片只保留30天 4003=门口机呼叫 4004=已接听 4005=已开锁 4006=年 4007=来自 4008=呼叫 4009=未开锁 4010=未接听 4011=已拒绝 4012=配置参数有异常! 4013=门禁二维码 4014=临时密码 5000=音乐 5001=组合 5002=设置 HDL_ON/Common/R.cs
@@ -782,6 +782,21 @@ public const int FanThreeGear = 1086; public const int keshiduijiang = 4000; public const int tonghuajilu = 4001; public const int baolu30 = 4002; public const int menkoujihujiao = 4003; public const int yijieting = 4004; public const int yikaisuo = 4005; public const int nian = 4006; public const int laizi = 4007; public const int hujiao = 4008; public const int weikaisuo = 4009; public const int weijieting = 4010; public const int yijujue = 4011; public const int peizhicanshuyouyichang = 4012; public const int menjinerweima = 4013; public const int linshimima = 4014; public const int a31Music = 5000; public const int merge = 5001; HDL_ON/DAL/Server/HttpServerRequest.cs
@@ -492,6 +492,11 @@ Address = mHome.homeAddress, isAllowCreateScene = mHome.isAllowCreateScene, }; #if DEBUG UserInfo.Current.regionList.Add(home); continue; #endif if (home.isBindGateway) { UserInfo.Current.regionList.Add(home); 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> @@ -157,7 +157,7 @@ ////**************测试************** //string requestFullUrl = GlobalRequestHttpsHost + apiPath; // string requestFullUrl = GlobalRequestHttpsHost + apiPath; ////**************测试************** RestClient client = new RestClient(requestFullUrl); HDL_ON/DAL/Server/NewAPI.cs
@@ -567,9 +567,17 @@ /// 删除通话记录 /// </summary> public const string API_POST_FL_DeleteCallInfo = "/home-wisdom/app/fl/vi/delete"; /// <summary> /// 获取门口机列表 /// </summary> public const string API_POST_FL_List = "http://112.74.164.111:180/api.php/Device/getmonitorUUID"; /// <summary> /// 动态密码/二维码开锁 /// </summary> public const string API_POST_FL_QRcode = "http://112.74.164.111:180/api.php/Device/setdynamicpwd"; #endregion } ///// <summary> HDL_ON/DAL/ThirdPartySdk/ESOnVideo.cs
@@ -59,12 +59,12 @@ /// <param name="mESVideoInfo"></param> public void ShowESVideoMonitor(ESVideoInfo mESVideoInfo) { this.esVideoInfo = mESVideoInfo; #if __IOS__ int roomID = 0; int.TryParse(mESVideoInfo.roomno, out roomID); ESOnMonitorViewController vc = new ESOnMonitorViewController(); vc.MESVideoID = mESVideoInfo.ESVideoUUID; //vc.MESRoomID = mESVideoInfo.ESRoomID; vc.MESRoomID =roomID; vc.DeviceName = mESVideoInfo.DeviceName; //vc.RoomName = mESVideoInfo.RoomName; vc.MESCallDelegate = new OnESCallDelegate(this); @@ -96,9 +96,11 @@ { this.esVideoInfo = mESVideoInfo; #if __IOS__ int roomID = 0; int.TryParse(mESVideoInfo.roomno, out roomID); ESOnIntercomViewController vc = new ESOnIntercomViewController(); vc.MESVideoID = mESVideoInfo.ESVideoUUID; //vc.MESRoomID = mESVideoInfo.ESRoomID; vc.MESRoomID = roomID; vc.DeviceName = mESVideoInfo.DeviceName; //vc.RoomName = mESVideoInfo.RoomName; //vc.MESCallDelegate = new OnESCallDelegate(this); @@ -415,27 +417,27 @@ /// <summary> /// 丰林请求的唯一id /// </summary> public string uuid; public string uuid = string.Empty; /// <summary> /// 丰林社区id /// </summary> public string cmtID; public string cmtID = string.Empty; /// <summary> /// 丰林房间号 /// </summary> public string roomno; public string roomno = string.Empty; /// <summary> /// 丰林楼栋号 /// </summary> public string unitno; public string unitno = string.Empty; ///// <summary> ///// 丰林住宅Id ///// </summary> //public string HomeID; //public string HomeID= string.Empty; /// <summary> /// 呼叫记录Id /// </summary> public string callId; public string callId = string.Empty; } HDL_ON/HDL_ON.projitems
@@ -388,11 +388,12 @@ <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\EnvironmentalScience\EchartsOption_Pie.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\SetPir.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\1ContorlPage\AcControlPage_AddIrButton.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Video\Send.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Energy\EnergyMainPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)DAL\ThirdPartySdk\ESOnVideo.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Energy\EchartsOption_Energy.cs" /> <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" /> </ItemGroup> <ItemGroup> <Folder Include="$(MSBuildThisFileDirectory)DAL\" /> HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs
@@ -260,6 +260,13 @@ { EventHandler<MouseEventArgs> eventHandler = (sender, e) => { HDL_ON.UI.UI2.FuntionControlView.Video.VideoMethod videoMethod = new UI2.FuntionControlView.Video.VideoMethod(); videoMethod.getVideo((device) => { videoMethod.MianView(this, device); }, this, true); return; var page = new BrandListPage();// AddThirdPartyBrandListpage(); // BrandListPage(); MainPage.BasePageView.AddChidren(page); page.LoadPage(); HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs
@@ -148,174 +148,6 @@ #endregion ///初始化界面 UIView(vv); } void GoToShowSortSelection(List<string> dataList) { Dictionary<string, List<string>> dict = new Dictionary<string, List<string>>(); foreach (var data in dataList) { //提取字符串第一位 //string s = data.Substring(0, 1); var key = GetCharSpellCode(data); if (dict.ContainsKey(key)) { var value = dict[key]; if (value == null) { value = new List<string>(); } value.Add(data); } else { var value = new List<string>(); value.Add(data); dict.Add(key, value); } } Application.RunOnMainThread(() => { JLCountrycode.CountryCodeView.Current.ShowSortSelection("选择红外品牌", dict, (countryName) => { //Console.WriteLine("countryName: " + countryName); Utlis.ShowTip("选中了:" + countryName); }); }); } /// <summary> /// 获取汉字首字母 /// </summary> /// <param name="textValue"></param> /// <returns></returns> private string GetCharSpellCode(string textValue) { long iCnChar; byte[] ZW = Encoding.GetEncoding("gb2312").GetBytes(textValue); //如果是字母,则直接返回 if (ZW.Length == 1) { return textValue.ToUpper(); } else { // get the array of byte from the single char int i1 = (short)(ZW[0]); int i2 = (short)(ZW[1]); iCnChar = i1 * 256 + i2; } // iCnChar match the constant if ((iCnChar >= 45217) && (iCnChar <= 45252)) { return "A"; } else if ((iCnChar >= 45253) && (iCnChar <= 45760)) { return "B"; } else if ((iCnChar >= 45761) && (iCnChar <= 46317)) { return "C"; } else if ((iCnChar >= 46318) && (iCnChar <= 46825)) { return "D"; } else if ((iCnChar >= 46826) && (iCnChar <= 47009)) { return "E"; } else if ((iCnChar >= 47010) && (iCnChar <= 47296)) { return "F"; } else if ((iCnChar >= 47297) && (iCnChar <= 47613)) { return "G"; } else if ((iCnChar >= 47614) && (iCnChar <= 48118)) { return "H"; } else if ((iCnChar >= 48119) && (iCnChar <= 49061)) { return "J"; } else if ((iCnChar >= 49062) && (iCnChar <= 49323)) { return "K"; } else if ((iCnChar >= 49324) && (iCnChar <= 49895)) { return "L"; } else if ((iCnChar >= 49896) && (iCnChar <= 50370)) { return "M"; } else if ((iCnChar >= 50371) && (iCnChar <= 50613)) { return "N"; } else if ((iCnChar >= 50614) && (iCnChar <= 50621)) { return "O"; } else if ((iCnChar >= 50622) && (iCnChar <= 50905)) { return "P"; } else if ((iCnChar >= 50906) && (iCnChar <= 51386)) { return "Q"; } else if ((iCnChar >= 51387) && (iCnChar <= 51445)) { return "R"; } else if ((iCnChar >= 51446) && (iCnChar <= 52217)) { return "S"; } else if ((iCnChar >= 52218) && (iCnChar <= 52697)) { return "T"; } else if ((iCnChar >= 52698) && (iCnChar <= 52979)) { return "W"; } else if ((iCnChar >= 52980) && (iCnChar <= 53640)) { return "X"; } else if ((iCnChar >= 53689) && (iCnChar <= 54480)) { return "Y"; } else if ((iCnChar >= 54481) && (iCnChar <= 55289)) { return "Z"; } else return (""); } /// <summary> HDL_ON/UI/UI2/FuntionControlView/Video/MainView.cs
@@ -1,17 +1,28 @@ 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 MainView : FrameLayout { public void Show() /// <summary> /// 加载可视对讲UI /// </summary> /// <param name="listVideo">门口机列表</param> /// <param name="listCall">通话记录列表</param> /// <param name="video">当前的可视对讲</param> public void Show(List<VideoMethod.FlVideo> listVideo, List<CallView> listCall, VideoClouds video) { #region 布局界面 this.BackgroundColor = MusicColor.ViewColor; var topView = new TopView(); this.AddChidren(topView.TopFLayoutView()); topView.topNameBtn.Text = "可视对讲"; topView.topNameBtn.TextID = StringId.keshiduijiang; topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { RemoveFromParent(); @@ -28,8 +39,8 @@ pageView.AddChidren(view1); var view2 = new FrameLayout(); pageView.AddChidren(view2); View1(view1); View2(view2); View1(view1, listVideo, video); View2(view2, listCall, video); Button btn11 = new Button { X = Application.GetRealWidth(170), @@ -78,22 +89,25 @@ if (pageView.PageIndex == 0) { topView.topNameBtn.Text = "可视对讲"; topView.topNameBtn.TextID = StringId.keshiduijiang; } else { topView.topNameBtn.Text = "通话记录"; topView.topNameBtn.TextID = StringId.tonghuajilu; } }; #endregion } /// <summary> /// 第一个界面 /// </summary> /// <param name="view1">父控件</param> void View1(FrameLayout view1) /// <param name="list">门口机列表</param> /// <param name="videoClouds">当前的可视对讲</param> void View1(FrameLayout view1, List<VideoMethod.FlVideo> list, VideoClouds videoClouds) { #region 布局界面 var bjFl = new FrameLayout { Y = Application.GetRealHeight(24), @@ -115,7 +129,8 @@ TextColor = MusicColor.MusicTxet14Color, TextSize = TextSize.Text24, TextAlignment = TextAlignment.CenterLeft, Text = "可视对讲", //Text = "可视对讲", TextID = StringId.keshiduijiang, }; bjFl.AddChidren(nameBtn); /// <summary> @@ -146,7 +161,7 @@ SelectedImagePath = "MusicIcon/collectSelected.png", }; bjFl.AddChidren(collectIconBtn); ///可视对讲图标 Button intercomBtnIcon = new Button { X = Application.GetRealWidth(84), @@ -158,24 +173,30 @@ }; bjFl.AddChidren(intercomBtnIcon); var vv = new VerticalScrolViewLayout { 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 VideoMethod.FlVideo { aliasName =Language.StringByID(StringId.menjinerweima), devType = "100" }); } //数组个数 int value = 15; //int value = 15; //先计算数据所需要的很高度; int l = 0; if (value % 3 == 0) if (list.Count % 3 == 0) { l = value / 3; l = list.Count / 3; } else { l = (value / 3) + 1; l = (list.Count / 3) + 1; } var fL = new FrameLayout { @@ -184,8 +205,11 @@ }; vv.AddChidren(fL); int line = 0; for (int i = 1, j = 0; i <= value; i++, j++) #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), @@ -205,7 +229,7 @@ }; fLayout.AddChidren(iconBtn); var iconNameBtn = new Button var deviceNameBtn = new Button { Y = iconBtn.Bottom + Application.GetRealHeight(6), Width = Application.GetRealWidth(50), @@ -213,11 +237,12 @@ TextSize = TextSize.Text10, TextColor = CSS.CSS_Color.TextualColor, TextAlignment = TextAlignment.Center, Text="查看单元机" Text = video.aliasName, }; fLayout.AddChidren(iconNameBtn); fLayout.AddChidren(deviceNameBtn); var clickBtn = new Button { Tag = i }; var clickBtn = new Button { Tag = video }; fLayout.AddChidren(clickBtn); if (i % 3 == 0) { @@ -225,38 +250,42 @@ j = -1; line += 1; } // GetIconAndText(i, deviceIconBtn, iconNameBtn); getIconAndText(video, iconBtn); #endregion //门口机的点击事件 clickBtn.MouseUpEventHandler += (sender, e) => { var flVideo = clickBtn.Tag as VideoMethod.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)); } ESVideoInfo eSVideoInfo = new ESVideoInfo { ESVideoUUID = getUuid(flVideo.uuid), DeviceName = flVideo.aliasName, roomno = videoClouds.flRoomId, unitno = videoClouds.flBuildingId, }; ESOnVideo.Current.ShowESVideoMonitor(eSVideoInfo); } ////1=空调;2=电视;3=风扇;4=机顶盒;5=DVD/EVD/VCD;6=投影仪;7=自定义; //int if_value = int.Parse(clickBtn.Tag.ToString()); //if (if_value == 7) //{ // Method method = new Method(); // method.AddControl(this, (control) => // { // AddButton addButton = new AddButton(); // MainPage.BasePageView.AddChidren(addButton); // addButton.Show(control); // MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; // }); //} //else //{ // if (DeviceTypeList.Count == 0) // { // GetDeviceTypeList(true, () => // { // DeviceTypeViewClick(if_value); // }); // } // else // { // DeviceTypeViewClick(if_value); // } //} }; } @@ -266,9 +295,11 @@ /// 第二个界面 /// </summary> /// <param name="view2">父控件</param> void View2(FrameLayout view2) /// <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), @@ -290,7 +321,7 @@ TextColor = MusicColor.MusicTxet14Color, TextSize = TextSize.Text24, TextAlignment = TextAlignment.CenterLeft, Text = "通话记录", TextID = StringId.tonghuajilu, }; bjFl.AddChidren(nameBtn); /// <summary> @@ -305,11 +336,11 @@ TextColor = MusicColor.SelectedColor, TextSize = TextSize.Text12, TextAlignment = TextAlignment.CenterLeft, Text = "*云端照片只保留30天" TextID = StringId.baolu30, }; bjFl.AddChidren(regionBtn); var vv = new VerticalScrolViewLayout var vv = new VerticalRefreshLayout { X = Application.GetRealWidth(16), Y = Application.GetRealHeight(58), @@ -317,24 +348,175 @@ Width = Application.GetRealWidth(295), }; bjFl.AddChidren(vv); for (int i = 0; i < 6; i++) vv.BeginHeaderRefreshingAction += () => { if (i == 0|| i == 2) { View.FrameLayout50 frameLayout50 = new View.FrameLayout50(); vv.AddChidren(frameLayout50.FLayoutView()); } else { View.FrameLayout60 frameLayout60 = new View.FrameLayout60(); vv.AddChidren(frameLayout60.FLayoutView()); } } 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": { Language.StringByID(StringId.yijieting); } break; case "2": { 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/Send.cs
File was deleted HDL_ON/UI/UI2/FuntionControlView/Video/VideoMethod.cs
New file @@ -0,0 +1,325 @@ using System; using HDL_ON.DAL.Server; using HDL_ON.UI.UI2.PersonalCenter.PirDevice; using System.Collections.Generic; using Shared; namespace HDL_ON.UI.UI2.FuntionControlView.Video { 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 MainView(); 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> 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="id"></param> public List<CallView> getCall(string id) { List<CallView> callViewList = new List<CallView>(); try { List<Call> listCall = new List<Call>(); var responsePackNew = VideoSend.GetCall(id); if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") { var jobject = Newtonsoft.Json.Linq.JObject.Parse(responsePackNew.Data.ToString()); string list = jobject["list"].ToString(); listCall = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Call>>(list); } List<string> strYear = new List<string>(); //查询年份 for (int i = 0; i < listCall.Count; i++) { var call = listCall[i]; if (string.IsNullOrEmpty(call.callTime)) { continue; } var dd = Convert.ToDateTime(call.callTime); var year = dd.ToString("yyyy"); if (null == strYear.Find((c) => c == year)) { strYear.Add(year); } } //重新存储 for (int j = 0; j < strYear.Count; j++) { var year = strYear[j]; CallView callView = new CallView(); callView.year = year; for (int i = 0; i < listCall.Count; i++) { var call = listCall[i]; if (string.IsNullOrEmpty(call.callTime)) { continue; } var dd = Convert.ToDateTime(call.callTime); var y = dd.ToString("yyyy"); if (y == year) { callView.callList.Add(call); } } callViewList.Add(callView); } } catch { } return callViewList; } /// <summary> /// 发送命令线程 /// </summary> /// <param name="videoObj">数据对象</param> /// <param name="action">回调函数</param> /// <param name="str">判断字符</param> /// <param name="view">判断log父控件</param> /// <param name="frame">log父控件</param> /// <param name="dialog">log父控件</param> /// <param name="tag">是否要显示log</param> 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") { dialog.AddChidren(loading); } else { frame.AddChidren(loading); } if (tag) { loading.Start(); } ResponsePackNew responsePackNew = null; new System.Threading.Thread(() => { try { if (str == "获取可视对讲") { responsePackNew = VideoSend.GetVideo(); } else if (str == "获取通话记录") { responsePackNew = VideoSend.GetCall(videoObj.id); } } catch { } finally { Application.RunOnMainThread(() => { if (tag) { loading.Hide(); } if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") { action(responsePackNew); } else { Method method = new Method(); //自定义错误提示文本 string eorroText = ""; if (str == "获取可视对讲") { } method.ErrorShow(responsePackNew, eorroText); } }); } }) { IsBackground = true }.Start(); } /// <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)); // 当地时区 return ((long)(DateTime.Now - startTime).TotalSeconds).ToString(); // 相差秒数 } /// <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 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/VideoSend.cs
New file @@ -0,0 +1,210 @@ using System; using System.Collections.Generic; using System.IO; using System.Net; using HDL_ON.DAL.Server; using HDL_ON.UI.UI2.PersonalCenter.PirDevice; using Newtonsoft.Json.Linq; using Shared; namespace HDL_ON.UI.UI2.FuntionControlView.Video { public class VideoSend { /// <summary> /// 检查住宅是否绑定丰林,并获取门口机列表 /// </summary> /// <returns></returns> public static ResponsePackNew GetVideo() { var jObject = new JObject { { "homeId", PirSend.HomeId } }; 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 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) { List<VideoMethod.FlVideo> eSVideoInfosList = new List<VideoMethod.FlVideo>(); var jobject = new JObject(); jobject.Add("cmtID", video.flCmtId); jobject.Add("unitno", video.flBuildingId); jobject.Add("method", "getUUIDList"); try { var str = HttpWebRequest(NewAPI.API_POST_FL_List, jobject.ToString(), "POST"); if (string.IsNullOrEmpty(str)) { return eSVideoInfosList; } var json = JObject.Parse(str); if (json == null) { return eSVideoInfosList; } if (json["resCode"].ToString() != "0") { return eSVideoInfosList; } eSVideoInfosList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<VideoMethod.FlVideo>>(json["list"].ToString()); } catch { } return eSVideoInfosList; } /// <summary> /// 上报动态开锁密码(注意:密码有可能延时1分钟生效) /// </summary> public static void GetQRcode(FrameLayout frame, VideoMethod.VideoClouds video, Action<bool, string> action) { ///标记是否成功 bool if_bool = false; //临时密码 string pwd = VideoMethod.getCode(); var jobject = new JObject(); jobject.Add("communityID", video.flCmtId);//社区ID 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", VideoMethod.GetCurrentTimeStamp()); jobject.Add("secretKey", video.flSecretKey); jobject.Add("method", "setdynamicpwd"); jobject.Add("numTimes", "5"); //加载log Loading loading = new Loading(); frame.AddChidren(loading); loading.Start(); new System.Threading.Thread(() => { try { var str = HttpWebRequest(NewAPI.API_POST_FL_QRcode, jobject.ToString(), "POST"); if (!string.IsNullOrEmpty(str)) { var json = JObject.Parse(str); if (json != null) { var stateCode = json["status"].ToString(); if (stateCode == "0") { if_bool = true; } } } } catch { } finally { Application.RunOnMainThread(() => { loading.Hide(); action(if_bool, pwd); }); } }) { IsBackground = true }.Start(); } /// <summary> /// 下载图片 /// </summary> public static void GetIcon(FrameLayout frame,string url) { Loading loading = new Loading(); frame.AddChidren(loading); loading.Start(); new System.Threading.Thread(() => { try { var responsePackNew = RequestServerhomeId(null, url); } catch { } finally { Application.RunOnMainThread(() => { loading.Hide(); }); } }) { IsBackground = true }.Start(); } /// <summary> /// 请求服务器的方法(支持请求方式为POST/GET) /// </summary> /// <param name="getUrl">请求的地址</param> /// <param name="str">请求数据</param> /// <param name="method">请求方式为POST/GET</param> /// <param name="second">超时时间</param> /// <returns></returns> public static string HttpWebRequest(string getUrl, string str, string method, int second = 3) { try { HttpWebRequest request = WebRequest.Create(getUrl) as HttpWebRequest; //创建请求 request.Method = method; //请求方式为POST/GET request.ContentType = "application/json"; request.Timeout = second * 1000;//超时时间 if (method == "POST") { byte[] jsonbyte = System.Text.Encoding.UTF8.GetBytes(str); request.ContentLength = jsonbyte.Length; Stream postStream = request.GetRequestStream(); postStream.Write(jsonbyte, 0, jsonbyte.Length); postStream.Close(); } //发送请求并获取相应回应数据 HttpWebResponse res; try { res = (HttpWebResponse)request.GetResponse(); } catch (WebException ex) { res = (HttpWebResponse)ex.Response; } StreamReader sr = new StreamReader(res.GetResponseStream(), System.Text.Encoding.UTF8); string content = sr.ReadToEnd(); //获得响应字符串 return content; } catch { return null; } } /// <summary> ///请求服务器(与住宅有关:例如;homeId) /// </summary> /// <returns></returns> public static ResponsePackNew RequestServerhomeId(object o, string api_Url, int mTimeout = 20) { var requestJson = HttpUtil.GetSignRequestJson(o); return HttpUtil.RequestHttpsPostFroHome(api_Url, requestJson, mTimeout); } } class FlResponsePackNew {// public string status = string.Empty; public string desc = string.Empty; } } HDL_ON/UI/UI2/FuntionControlView/Video/View/FrameLayout50.cs
@@ -25,7 +25,7 @@ TextSize = TextSize.text16, TextAlignment = TextAlignment.CenterLeft, IsBold = true, Text= "2020年", Text= "2020"+Language.StringByID(StringId.nian), }; public Button btnClick = new Button HDL_ON/UI/UI2/FuntionControlView/Video/View/FrameLayout60.cs
@@ -24,7 +24,8 @@ Height = Application.GetRealHeight(20), TextColor = CSS.CSS_Color.textColor, TextSize = TextSize.text14, Text= "门口机呼叫", //Text= "门口机呼叫", TextID=StringId.menkoujihujiao, TextAlignment = TextAlignment.CenterLeft, }; /// <summary> @@ -42,9 +43,9 @@ Text = "15:01", }; /// <summary> /// 编辑文本 /// 状态文本 /// </summary> public Button btnEditText = new Button public Button btnStateText = new Button { Y = Application.GetRealHeight(32), Width = Application.GetRealWidth(260), @@ -91,7 +92,7 @@ { frameLayout.AddChidren(btnText); frameLayout.AddChidren(btnTime); frameLayout.AddChidren(btnEditText); frameLayout.AddChidren(btnStateText); frameLayout.AddChidren(btnNextIcon); btnLine.Y = frameLayout.Height - 1; frameLayout.AddChidren(btnLine); HDL_ON/UI/UI2/FuntionControlView/Video/View/ShowDialog.cs
@@ -87,5 +87,96 @@ } /// <summary> /// 生成二维码 /// </summary> /// <param name="str1">标题</param> public void QRcode(string str1) { Dialog dialog = new Dialog() { BackgroundColor = CSS.CSS_Color.viewTrans60lucence, }; FrameLayout frameLayout = new FrameLayout { }; dialog.AddChidren(frameLayout); FrameLayout whiteView = new FrameLayout() { X = Application.GetRealWidth(56), Y = Application.GetRealHeight(199), Width = Application.GetRealWidth(282), Height = Application.GetRealHeight(316), BackgroundColor = MusicColor.WhiteColor, Radius = (uint)Application.GetRealHeight(16), }; frameLayout.AddChidren(whiteView); //临时密码 Button btnTitle = new Button() { Y = Application.GetRealHeight(32), Height = Application.GetRealHeight(22), TextColor = MusicColor.TextColor, TextSize = TextSize.Text16, TextAlignment = TextAlignment.Center, IsBold = true, TextID=StringId.linshimima, }; whiteView.AddChidren(btnTitle); //密码 Button btnpaw = new Button() { X=Application.GetRealWidth(100), Y = Application.GetRealHeight(62), Height = Application.GetRealHeight(32), Width = Application.GetRealWidth(82), TextColor = MusicColor.SelectedColor, TextSize =24, TextAlignment = TextAlignment.Center, IsBold = true, Text = str1, }; whiteView.AddChidren(btnpaw); Button iconBtn = new Button { X = Application.GetRealWidth(194), Y = Application.GetRealHeight(68), Width = Application.GetRealWidth(20), Height = Application.GetRealWidth(20), UnSelectedImagePath = "LoginIcon/ShowPasswordIcon.png", SelectedImagePath = "LoginIcon/HidePasswordIcon.png", }; whiteView.AddChidren(iconBtn); //二维码 int codeWidth = Application.GetRealWidth(142); ImageView codeImage = new ImageView() { X = Application.GetRealWidth(70), Y = Application.GetRealHeight(142), Height = codeWidth, Width = codeWidth, ImageBytes = Scan.BytesFromText(str1, codeWidth, codeWidth), }; whiteView.AddChidren(codeImage); dialog.Show(); iconBtn.MouseUpEventHandler += (sender, e) => { iconBtn.IsSelected = !iconBtn.IsSelected; if (iconBtn.IsSelected) { btnpaw.Text = "******"; } else { btnpaw.Text = str1; } }; frameLayout.MouseUpEventHandler += (sender, e) => { dialog.Close(); }; } } }