From ed2f4a97aa48cdb4a013d2a389877f52eb3eccdf Mon Sep 17 00:00:00 2001 From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local> Date: 星期二, 29 十月 2019 13:15:59 +0800 Subject: [PATCH] Merge branch 'DEV_GXC' of http://172.16.1.23:6688/r/~xm/HomeApp into DEV_GXC --- ZigbeeApp/Shared/Common/Device.cs | 37 +++++++++++-------------------------- 1 files changed, 11 insertions(+), 26 deletions(-) diff --git a/ZigbeeApp/Shared/Common/Device.cs b/ZigbeeApp/Shared/Common/Device.cs index 15b7c71..8f0dc65 100755 --- a/ZigbeeApp/Shared/Common/Device.cs +++ b/ZigbeeApp/Shared/Common/Device.cs @@ -85,7 +85,7 @@ /// </summary> private Dictionary<string, HashSet<int>> dicDeviceEpoint = new Dictionary<string, HashSet<int>>(); /// <summary> - /// 璁惧Mac椤哄簭(閲岄潰鏄疢ac鍦板潃) + /// 璁惧Mac椤哄簭 /// </summary> private Dictionary<string, List<string>> dicDeviceSort = null; /// <summary> @@ -223,11 +223,11 @@ /// <param name="zbGateway">缃戝叧瀵硅薄</param> /// <param name="deviceComingAction">鎺ユ敹鍒拌澶囨椂鐨勪簨浠�,璁惧瀵硅薄涓簄ull鏃�,浠h〃鎺ユ敹瀹屾垚</param> /// <returns>涓�鐩磋繑鍥瀟rue</returns> - public bool SetDeviceToMemmoryByGateway(ZbGateway zbGateway, Action<CommonDevice> deviceComingAction = null) + public async Task<bool> SetDeviceToMemmoryByGateway(ZbGateway zbGateway, Action<CommonDevice> deviceComingAction = null) { //浠庣綉鍏宠幏鍙栧叏閮ㄧ殑璁惧 List<CommonDevice> listDevice = new List<CommonDevice>(); - List<CommonDevice> list = this.GetDeviceListFromGateway(zbGateway, true, deviceComingAction); + List<CommonDevice> list = await this.GetDeviceListFromGateway(zbGateway, true, deviceComingAction); if (list == null) { @@ -1007,7 +1007,6 @@ this.GetDeviceIcon(device, ref unSelectFilePath, ref selectFilePath); btnIcon.UnSelectedImagePath = unSelectFilePath; - btnIcon.SelectedImagePath = selectFilePath; } /// <summary> @@ -1564,33 +1563,19 @@ /// <returns></returns> public List<CommonDevice> SortDevice(List<CommonDevice> listDevice) { - var dic = new Dictionary<string, List<CommonDevice>>(); + var dic = new Dictionary<string, CommonDevice>(); for (int i = 0; i < listDevice.Count; i++) { - if (dic.ContainsKey(listDevice[i].DeviceAddr) == false) - { - dic[listDevice[i].DeviceAddr] = new List<CommonDevice>(); - } - dic[listDevice[i].DeviceAddr].Add(listDevice[i]); + dic[(this.GetDeviceMainKeys(listDevice[i]))] = listDevice[i]; } var list = new List<CommonDevice>(); - var listCheck = new HashSet<string>(); foreach (var listSort in this.dicDeviceSort.Values) { for (int i = 0; i < listSort.Count; i++) { - if (dic.ContainsKey(listSort[i]) == true && listCheck.Contains(listSort[i]) == false) + if (dic.ContainsKey(listSort[i]) == true) { - listCheck.Add(listSort[i]); - dic[listSort[i]].Sort((obj1, obj2) => - { - if (obj1.DeviceEpoint > obj2.DeviceEpoint) - { - return 1; - } - return -1; - }); - list.AddRange(dic[listSort[i]]); + list.Add(dic[listSort[i]]); } } } @@ -1707,7 +1692,7 @@ /// <param name="deviceComingAction">鎺ユ敹鍒拌澶囨椂鐨勪簨浠�</param> /// <param name="mode">鏄惁鏄剧ず閿欒</param> /// <returns></returns> - public List<CommonDevice> GetDeviceListFromGateway(ZbGateway zbGateway, bool ignoreTime, Action<CommonDevice> deviceComingAction = null, ShowErrorMode mode = ShowErrorMode.YES) + public async Task<List<CommonDevice>> GetDeviceListFromGateway(ZbGateway zbGateway, bool ignoreTime, Action<CommonDevice> deviceComingAction = null, ShowErrorMode mode = ShowErrorMode.YES) { if (ignoreTime == false) { @@ -1814,13 +1799,13 @@ try { var jObject = new Newtonsoft.Json.Linq.JObject { { "Cluster_ID", 0 }, { "Command", 93 } }; - realWay.Send("GetDeviceInfo", jObject.ToString()); + await realWay.Send("GetDeviceInfo", jObject.ToString()); } catch { canBreak = true; } while (canBreak == false && TimeOut < 60) { - System.Threading.Thread.Sleep(100); + await Task.Delay(100); TimeOut++; } @@ -2075,7 +2060,7 @@ this.dicDeviceModelIdEnum["H06C"] = "2800-2800";//鏅鸿兘闂ㄩ攣(H06C) //=========鈽呪槄绌鸿皟绫�(3600-3899)鈽呪槄========= - this.dicDeviceModelIdEnum["MAC/GW-ZB.10"] = "3600-3600";//zigbee绌鸿皟缃戝叧妯″潡 + this.dicDeviceModelIdEnum["MAC/GW-ZB.431"] = "3600-3600";//zigbee绌鸿皟缃戝叧妯″潡 //=========鈽呪槄涓户鍣ㄧ被(3900-3999)鈽呪槄========= this.dicDeviceModelIdEnum["MSR-ZB.10"] = "3900-3900"; //zigbee涓户鍣� -- Gitblit v1.8.0