From b02e8275a21dc06bf54b66273485d44e007a2616 Mon Sep 17 00:00:00 2001 From: xm <1271024303@qq.com> Date: 星期一, 20 七月 2020 14:50:17 +0800 Subject: [PATCH] 新代码 --- ZigbeeApp/Shared/Common/Device.cs | 100 +++++++++++++++++-------------------------------- 1 files changed, 35 insertions(+), 65 deletions(-) diff --git a/ZigbeeApp/Shared/Common/Device.cs b/ZigbeeApp/Shared/Common/Device.cs old mode 100644 new mode 100755 index ccb39ce..1435f45 --- a/ZigbeeApp/Shared/Common/Device.cs +++ b/ZigbeeApp/Shared/Common/Device.cs @@ -115,7 +115,7 @@ { CommonDevice device = null; //鍙嶅簭鍒楀寲涓烘寚瀹氱殑绫伙紝涓嶇劧鏁版嵁浼氫涪澶辫�屽鑷存棤娉曞己杞� - try + try { device = CommonDevice.CommonDeviceByFilePath(file); } @@ -260,7 +260,7 @@ //娣诲姞缂撳瓨 this.AddDeviceToMemory(ref device); - //绉婚櫎瀛樺湪鐨勮澶囧唴瀛� + //绉婚櫎瀛樺湪鐨勮澶囧唴瀛� string maikey = this.GetDeviceMainKeys(device); if (dicExist.ContainsKey(maikey) == true) { @@ -709,8 +709,8 @@ this.SaveRealDeviceRoomId(null, null); } return true; - } - + } + /// <summary> /// 鍒犻櫎缂撳瓨鐨勪竴鑸澶� /// </summary> @@ -792,21 +792,21 @@ } this.dicOTADevice.Remove(otaKeys); } - } - + } + #endregion - + #region 鈻� 鍚屾璁惧___________________________ /// <summary> /// 鍚屾璁惧骞朵笖鍒锋柊缂撳瓨(鍚屾澶辫触鏃讹紝浼氭樉绀轰俊鎭�) /// </summary> /// <param name="litdevice">璁惧瀵硅薄(MAC鍦板潃蹇呴』瑕佺浉鍚�)</param> public async Task<bool> SynchronizationDevice(List<CommonDevice> listdevice) - { - //铏氭嫙浣忓畢鐨勮瘽,涓嶉渶瑕佸垹闄ょ綉鍏崇殑璁惧 + { + //铏氭嫙浣忓畢鐨勮瘽,涓嶉渶瑕佸垹闄ょ綉鍏崇殑璁惧 if (Config.Instance.Home.IsVirtually == false) - { - //鍚屾 + { + //鍚屾 var result = await listdevice[0].SyncMsgToBindSource(listdevice[0].DeviceAddr, listdevice[0].DeviceEpoint); if (result == null || result.result != 0) { @@ -820,13 +820,13 @@ } } return true; - } - #endregion - - - + } + #endregion + + + #region 鈻� 娴嬭瘯璁惧___________________________ - + /// <summary> /// 鍙戦�佸畾浣嶆寚浠ゅ埌璁惧 /// </summary> @@ -876,22 +876,6 @@ return true; } } - return false; - } - - /// <summary> - /// 妫�娴嬭澶囨槸鍚︽嫢鏈変竴閿悓姝ュ姛鑳� - /// </summary> - /// <param name="device"></param> - /// <returns></returns> - public bool DeviceIsCanSynchronization(CommonDevice device) - { - //鑾峰彇璁惧绫诲瀷鐨� - var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device }); - if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleMultifunction) - { - return true; - } return false; } @@ -1094,7 +1078,7 @@ /// <param name="listDevice"></param> /// <returns></returns> public List<CommonDevice> GetPanelMatchEpointByMac(List<CommonDevice> listDevice, bool sort = true) - { + { var list = new List<CommonDevice>(); foreach (var dev in listDevice) { @@ -1105,13 +1089,13 @@ else if (dev.Type == DeviceType.FreshAirHumiditySensor) { list.Add(dev); - } + } } if (sort == false) { return list; - } - list.Sort((obj1, obj2) => + } + list.Sort((obj1, obj2) => { if (obj1.DeviceEpoint > obj2.DeviceEpoint) @@ -1119,7 +1103,7 @@ return 1; } return -1; - }); + }); return list; } @@ -1332,7 +1316,7 @@ } if (device.Type == DeviceType.OnOffOutput - || device.Type == DeviceType.DimmableLight + || device.Type == DeviceType.DimmableLight || device.Type == DeviceType.ColorDimmableLight || device.Type == DeviceType.ColorTemperatureLight) { @@ -1343,9 +1327,9 @@ { //绌鸿皟閮藉彨瀹ゅ唴鏈� return Language.StringByID(R.MyInternationalizationString.uIndoorUnit) + epointNo; - } - - //鑾峰彇璁惧绫诲瀷 + } + + //鑾峰彇璁惧绫诲瀷 var deviceInfoType = this.GetMyDeviceEnumInfo(new List<CommonDevice>() { device }); if (device.Type == DeviceType.OnOffSwitch) { @@ -2477,8 +2461,8 @@ list.Add(DeviceBeloneType.A浼犳劅鍣�); //鍏朵粬鐨勭湅鐫�鍔炲憲,閮芥槸鎺掑湪鍚庨潰鐨�,閮藉綊涓鸿繖涓睘鎬� - list.Add(DeviceBeloneType.A鏈煡璁惧); - + list.Add(DeviceBeloneType.A鏈煡璁惧); + return list; } @@ -2496,7 +2480,7 @@ var listDevice = this.GetDevicesByMac(i_device.DeviceAddr, false); foreach (var device in listDevice) { - //0:绂荤嚎 1:鍦ㄧ嚎 2:姝e湪鍒锋柊鐘舵�� + //0:绂荤嚎 1:鍦ㄧ嚎 2:姝e湪鍒锋柊鐘舵�� bool statu = i_device.IsOnline == 1 || i_device.IsOnline == 2; if (statu == true) { @@ -2527,8 +2511,8 @@ { return false; } - } - //2020.03.30杩藉姞寮忔牱:濡傛灉鏄潰鏉跨殑娓╁害鎺㈠ご,涓嶆樉绀� + } + //2020.03.30杩藉姞寮忔牱:濡傛灉鏄潰鏉跨殑娓╁害鎺㈠ご,涓嶆樉绀� else if (i_device.Type == DeviceType.TemperatureSensor && ((TemperatureSensor)i_device).SensorDiv == 1) { var myInfoType = LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { i_device }); @@ -2541,20 +2525,6 @@ { //鏂伴鐨勬箍搴︿紶鎰熷櫒涓嶆樉绀� return false; - } - - //濡傛灉鏄柊椋庨潰鏉挎垨鐜闈㈡澘,鍒欓兘涓嶆樉绀轰换浣曞洖璺� - var myInfoTypeTemp = LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { i_device }); - if (myInfoTypeTemp.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueFreshAir || myInfoTypeTemp.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleEnvironment) - { - return false; - } - else if (myInfoTypeTemp.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleMultifunction) - { - if (i_device.Type != DeviceType.OnOffOutput) - { - return false; - } } //濡傛灉鏄柊椋庨潰鏉挎垨鐜闈㈡澘,鍒欓兘涓嶆樉绀轰换浣曞洖璺� @@ -3189,7 +3159,7 @@ this.dicDeviceModelIdEnum["MGCD01/M-ZB.10"] = "1306-1200-60000";//鍚搁《鐕冩皵浼犳劅鍣� //PM2.5绌烘皵璐ㄩ噺浼犳劅鍣� 銆愯璁惧灞炰簬绗笁鏂硅澶囷紝娌℃湁闀滃儚ID銆� - this.dicDeviceModelIdEnum["MSPM25/M-ZB.10"] = "1307-1200-60000";//PM2.5绌烘皵璐ㄩ噺浼犳劅鍣� + this.dicDeviceModelIdEnum["MSPM25/M-ZB.10"] = "1307-1200-60000";//PM2.5绌烘皵璐ㄩ噺浼犳劅鍣� //=========鈽呪槄缁х數鍣ㄧ被(2300-2499)鈽呪槄========= this.dicDeviceModelIdEnum["MPR0310-ZB.10"] = "2300-2300-60001";//3璺户鐢靛櫒灏忔ā鍧� @@ -3431,9 +3401,9 @@ /// <summary> /// 鏂规偊鏂伴灏忔ā鍧� 闀滃儚id锛�2310 /// </summary> - Relay_FangyueFreshAirModul = 2310, - - //=========鈽呪槄璋冨厜鍣ㄧ被(2500-2799)鈽呪槄========= + Relay_FangyueFreshAirModul = 2310, + + //=========鈽呪槄璋冨厜鍣ㄧ被(2500-2799)鈽呪槄========= /// <summary> /// 璋冨厜鍣� /// </summary> -- Gitblit v1.8.0