From 99253403b560f761d5f9af8b4f5140496996433a Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期五, 20 十一月 2020 16:49:50 +0800 Subject: [PATCH] 新云端的代码Ver1.0 --- ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceSearchForm.cs | 69 +++++++++++++++++++++------------- 1 files changed, 42 insertions(+), 27 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceSearchForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceSearchForm.cs index b428f18..f1d8c4b 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceSearchForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceSearchForm.cs @@ -72,7 +72,7 @@ //璁剧疆鏍囬淇℃伅 base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddDevice)); - this.gatewayId = GatewayResourse.NowSelectGatewayId; + this.gatewayId = HdlGatewayResourse.NowSelectGatewayId; HdlGatewayLogic.Current.GetRealGateway(ref this.realGateway, this.gatewayId); //鍒濆鍖栦腑閮ㄦ帶浠� @@ -163,7 +163,7 @@ return; } //鏍规嵁璁惧Type鍒涘缓瀵瑰簲鐨勮澶囧璞� - var device = Common.LocalDevice.Current.NewDeviceObjectByDeviceId((DeviceType)jobject.Value<int>("Device_ID")); + var device = HdlDeviceCommonLogic.Current.NewDeviceObjectByDeviceId((DeviceType)jobject.Value<int>("Device_ID"), jobject.Value<int>("Epoint")); if (device == null) { return; @@ -171,21 +171,17 @@ device.DeviceInfo = info; //缁欐柊璁惧璁剧疆涓婚敭灞炴�� - Common.LocalDevice.Current.SetNewDeviceMainKeys(device, jobject); + HdlDeviceCommonLogic.Current.SetNewDeviceMainKeys(device, jobject); device.CurrentGateWayId = this.realGateway.GwId; //灏咲eviceInfo鐨勫睘鎬ц缃埌涓诲睘鎬т腑 - Common.LocalDevice.Current.SetDeviceInfoToMain(device, device); - Common.LocalDevice.Current.RefreshDeviceFunctionType(device, device, true); + HdlDeviceCommonLogic.Current.SetDeviceInfoToMain(device, device); //娣诲姞璁惧鐨勭紦瀛� device.IsOnline = 1; - Common.LocalDevice.Current.AddDeviceToMemory(ref device); + HdlDeviceCommonLogic.Current.AddDeviceToMemory(ref device); //鍒锋柊瓒呮椂鏃堕棿 this.waitDeviceTimeOut = 20; - - //鑾峰彇璁惧鐨勫浐瀹氬睘鎬� - HdlDeviceFixedAttributeLogic.Current.SetAllFixedAttributeToDevice(device); //涓嶉渶瑕�200绔偣鐨勯偅涓澶� 2020.01.13 鍙樻洿:ota涔熷姞杩涙潵 this.listNewDevice.Add(device); @@ -222,26 +218,36 @@ this.realGateway.GwResDataAction -= this.AdjustGatewayResultData; System.Threading.Thread.Sleep(200); + var listDevice = new List<CommonDevice>(); + for (int i = 0; i < this.listNewDevice.Count; i++) + { + var device = this.listNewDevice[i]; + if (device.DeviceAddr != this.listNewDevice[0].DeviceAddr) + { + continue; + } + listDevice.Add(device); + //閲嶆柊鍙樻洿UI + if (device is OTADevice) + { + continue; + } + device.IconPath = string.Empty; + device.ReSave(); + + //璁剧疆璁惧鍔熻兘绫诲瀷 (涓嶈兘鍦ㄦ帴鏀跺洖璺殑鍦版柟鍐欏叆,涓嶇劧缃戝叧鍙兘浼氳秴璐熻嵎) + HdlDeviceCommonLogic.Current.RefreshDeviceFunctionType(device, device, true); + System.Threading.Thread.Sleep(200); + //鑾峰彇璁惧鐨勫浐瀹氬睘鎬� + if (HdlDeviceAttributeLogic.Current.ReadDeviceAllFixedAttribute(device) == true) + { + System.Threading.Thread.Sleep(200); + } + } + //鐩墠灏卞紕涓�涓� HdlThreadLogic.Current.RunMain(() => { - var listDevice = new List<CommonDevice>(); - for (int i = 0; i < this.listNewDevice.Count; i++) - { - var device = this.listNewDevice[i]; - if (device.DeviceAddr != this.listNewDevice[0].DeviceAddr) - { - continue; - } - listDevice.Add(device); - //閲嶆柊鍙樻洿UI - if (device is OTADevice) - { - continue; - } - device.IconPath = string.Empty; - device.ReSave(); - } //鏄剧ず璁惧淇℃伅鐢婚潰 this.ShowDeviceAddSuccessForm(listDevice); }); @@ -263,7 +269,7 @@ if (this.targetFormId != string.Empty) { //鍐嶅叧闂澶囧叆缃戞寚瀵肩晫闈� - this.CloseFormByFormName(this.targetFormId); + HdlFormLogic.Current.CloseFormByFormName(this.targetFormId); } //娣诲姞璁惧 @@ -440,6 +446,15 @@ else if (topic == gatewayId + "/DeviceInComingRespon") { this.topTimeOut = topMaxTime; + + //璁惧鍏ョ綉鏃�,鏈夋椂鍊欑綉鍏充細涓婃姤铏氭嫙璁惧 + var jobject = Newtonsoft.Json.Linq.JObject.Parse(resultData); + CommonDevice.DeviceInfoData info = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.DeviceInfoData>(jobject["Data"].ToString()); + if (info.DriveCode != 0) + { + //涓嶉渶瑕佽櫄鎷熻澶� + return 0; + } //缃戝叧鏈�缁堜笂鎶ヨ妭鐐硅澶囦俊鎭� this.btnProgressBar.SetValue(6, 6); return 1; -- Gitblit v1.8.0