From ecba45c93391066bc30c7bd602c3a7683fbb99a7 Mon Sep 17 00:00:00 2001 From: xm <1271024303@qq.com> Date: 星期五, 31 七月 2020 10:56:12 +0800 Subject: [PATCH] 临时备份 --- ZigbeeApp/Shared/Common/Device.cs | 129 +++++++++++++++++------------------------- 1 files changed, 52 insertions(+), 77 deletions(-) diff --git a/ZigbeeApp/Shared/Common/Device.cs b/ZigbeeApp/Shared/Common/Device.cs index a813749..b94b3e0 100755 --- a/ZigbeeApp/Shared/Common/Device.cs +++ b/ZigbeeApp/Shared/Common/Device.cs @@ -99,7 +99,7 @@ this.dicDeviceEpoint.Clear(); //鍒濆鍖栬澶囨灇涓� - this.InitDeviceModelIdEnum(); + this.InitDeviceModelIdEnum(); //鑾峰彇鏈湴鍏ㄩ儴鐨勮澶囨枃浠� List<string> listFile = this.GetAllDeviceFile(); @@ -267,8 +267,22 @@ listDriveDevice.Add(device); } } - //璁剧疆铏氭嫙璁惧鐨勯粯璁ゅ悕瀛� - this.SetDriveDeviceDefultName(listDriveDevice); + if (listDriveDevice.Count > 0) + { + //濡傛灉铏氭嫙璁惧杩樻病鏈夊悕瀛楃殑璇� + HdlThreadLogic.Current.RunThread(() => + { + //濡傛灉涓嶈繖鏍锋斁鍦ㄤ竴涓嚎绋嬮噷,鏈夊彲鑳藉Dictionary浜х敓褰卞搷 + foreach (var myDevice in listDriveDevice) + { + //鏍规嵁璁惧绫诲瀷鑾峰彇鍚嶇О + var dName = this.GetDeviceObjectText(new List<CommonDevice>() { myDevice }, false); + //鍦ㄧ鐐瑰悕瀛楃殑鍚庨潰闄勫姞銆愬洖璺�戝瓧鏍� + dName += "(" + myDevice.DeviceEpoint + Language.StringByID(R.MyInternationalizationString.uDeviceCircuit) + ")"; + this.ReName(myDevice, dName, ShowErrorMode.NO); + } + }); + } //鍙湁瀹屽叏鑾峰彇鐨勬椂鍊�,鎵嶄細鍘诲鐞嗗垹闄ょ殑闂 if (statu != 1) @@ -520,42 +534,6 @@ return true; } - /// <summary> - /// 璁剧疆铏氭嫙璁惧鐨勯粯璁ゅ悕瀛� - /// </summary> - /// <param name="listDriveDevice">铏氭嫙璁惧鍒楄〃</param> - private void SetDriveDeviceDefultName(List<CommonDevice> listDriveDevice) - { - if (listDriveDevice.Count == 0) - { - return; - } - //濡傛灉铏氭嫙璁惧杩樻病鏈夊悕瀛楃殑璇� - HdlThreadLogic.Current.RunThread(() => - { - //濡傛灉涓嶈繖鏍锋斁鍦ㄤ竴涓嚎绋嬮噷,鏈夊彲鑳藉Dictionary浜х敓褰卞搷 - foreach (var myDevice in listDriveDevice) - { - string dName = string.Empty; - if (this.IsMiniLight(myDevice) == true) - { - //Mini澶滅伅 - dName = Language.StringByID(R.MyInternationalizationString.uMiniNightLight); - } - else - { - //鏍规嵁璁惧绫诲瀷鑾峰彇鍚嶇О - dName = this.GetDeviceObjectText(new List<CommonDevice>() { myDevice }, false); - //鍦ㄧ鐐瑰悕瀛楃殑鍚庨潰闄勫姞銆愬洖璺�戝瓧鏍� - dName += "(" + myDevice.DeviceEpoint + Language.StringByID(R.MyInternationalizationString.uDeviceCircuit) + ")"; - } - this.ReName(myDevice, dName, ShowErrorMode.NO); - - System.Threading.Thread.Sleep(100); - } - }); - } - ///<summary > /// 淇敼璁惧mac鍚嶇О /// <para>macName:璁惧鍚嶇О</para> @@ -565,7 +543,7 @@ //濡傛灉褰撳墠鏄櫄鎷熶綇瀹� if (Common.Config.Instance.Home.IsVirtually == true) { - return Phone.TemplateData.TemplateDeviceDataLogic.Current.ReDeviceMacName(device, macName); + return Phone.ModelData.DeviceModelDataLogic.Current.ReDeviceMacName(device, macName, "MacRename"); } //鑾峰彇缂栬緫璁惧Mac鍚嶅瓧鐨勫懡浠ゅ瓧绗� @@ -576,7 +554,7 @@ return null; } //鍔犵紦瀛� - Phone.TemplateData.TemplateDeviceDataLogic.Current.ReDeviceMacName(device, macName); + Phone.ModelData.DeviceModelDataLogic.Current.ReDeviceMacName(device, macName, "MacRename"); var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.RenameDeviceMacNameData>(result.ReceiptData); return new CommonDevice.RenameDeviceMacNameAllData { renameDeviceMacNameData = tempData }; @@ -593,7 +571,7 @@ //濡傛灉褰撳墠鏄櫄鎷熶綇瀹� if (Common.Config.Instance.Home.IsVirtually == true) { - return Phone.TemplateData.TemplateDeviceDataLogic.Current.ReDeviceEpointName(device, deviceName); + return Phone.ModelData.DeviceModelDataLogic.Current.ReDeviceEpointName(device, deviceName, "DeviceRename"); } //鑾峰彇缂栬緫璁惧绔偣鍚嶅瓧鐨勫懡浠ゅ瓧绗� var sendData = this.GetReDeviceEpointNameCommandText(device.DeviceAddr, device.DeviceEpoint, deviceName); @@ -603,7 +581,7 @@ return null; } //鍔犵紦瀛� - Phone.TemplateData.TemplateDeviceDataLogic.Current.ReDeviceEpointName(device, deviceName); + Phone.ModelData.DeviceModelDataLogic.Current.ReDeviceEpointName(device, deviceName, "DeviceRename"); var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.DeviceRenameResponseData>(result.ReceiptData); return new CommonDevice.DeviceRenameAllData { deviceRenameData = tempData }; @@ -869,9 +847,9 @@ //闂ㄩ攣娌℃湁瀹氫綅鍔熻兘 return false; } - var myTypeInfo = this.GetMyDeviceEnumInfo(new List<CommonDevice>() { device }); if (device.Type == DeviceType.IASZone) { + var myTypeInfo = this.GetMyDeviceEnumInfo(new List<CommonDevice>() { device }); if (myTypeInfo.ConcreteType == DeviceConcreteType.Sensor_Pir) { //浼犳劅鍣ㄩ櫎浜哖ir閮芥病鏈夊畾浣嶅姛鑳� @@ -882,11 +860,6 @@ //鐞冨瀷绉诲姩浼犳劅鍣ㄨ櫧鐒舵槸鐢垫睜璁惧,浣嗘槸瀹冩湁瀹氫綅鍔熻兘 return true; } - return false; - } - //娓╂箍搴︿紶鎰熷櫒娌℃湁瀹氫綅鍔熻兘 - if (myTypeInfo.ConcreteType == DeviceConcreteType.Sensor_TemperatureHumidity) - { return false; } @@ -1386,16 +1359,6 @@ //闈㈡澘鐨勬俯搴︽帰澶村彨 闈㈡澘鍚嶅瓧+娓╁害 return deviceInfoType.DeviceDefultName + Language.StringByID(R.MyInternationalizationString.uTemperature); } - else if (((TemperatureSensor)device).SensorDiv == 1) - { - //娓╁害浼犳劅鍣� - return Language.StringByID(R.MyInternationalizationString.TemperatureSensor); - } - else if (((TemperatureSensor)device).SensorDiv == 2) - { - //婀垮害浼犳劅鍣� - return Language.StringByID(R.MyInternationalizationString.HumiditySensor); - } } //鍏朵粬鎯呭喌,浣跨敤瀹冪殑榛樿鍚嶇О return deviceInfoType.DeviceDefultName + epointNo; @@ -1430,7 +1393,7 @@ /// <param name="device">璁惧瀵硅薄</param> /// <param name="macName">Mac鍚嶅瓧</param> /// <returns></returns> - public void SetMacName(CommonDevice device, string macName) + private void SetMacName(CommonDevice device, string macName) { device.DeviceName = macName; } @@ -1441,7 +1404,7 @@ /// <param name="device">璁惧瀵硅薄</param> /// <param name="epointName">绔偣鍚嶅瓧</param> /// <returns></returns> - public void SetEpointName(CommonDevice device, string epointName) + private void SetEpointName(CommonDevice device, string epointName) { device.DeviceEpointName = epointName; } @@ -1891,8 +1854,7 @@ info.ObjectTypeName = this.dicDeviceModelIdEnum["A418"].A绫诲瀷鍚嶅瓧;//璋冨厜妯″潡 } else if (info.BeloneType == DeviceBeloneType.A浼犳劅鍣� - || device.Type == DeviceType.TemperatureSensor - || device.Type == DeviceType.FreshAirHumiditySensor) + || device.Type == DeviceType.TemperatureSensor) { //浼犳劅鍣ㄥ悎骞� info.ConcreteType = DeviceConcreteType.Sensor; @@ -2197,6 +2159,12 @@ //闂ㄧ獥浼犳劅鍣� info.ConcreteType = DeviceConcreteType.Sensor_DoorWindow; info.ConcreteText = Language.StringByID(R.MyInternationalizationString.uSensorDoorWindow); + } + else if (iasZone.IasDeviceType == 541) + { + //鐞冨瀷绉诲姩浼犳劅鍣� + info.ConcreteType = DeviceConcreteType.Sensor_SphericalMotion; + info.ConcreteText = this.dicDeviceModelIdEnum["MSPIRB-ZB.10"].A瀹樻柟鍚嶅瓧; } } @@ -2739,14 +2707,15 @@ listCheck.Add(mainkeys); //鍒锋柊涓�涓嬫湰鍦扮紦瀛� var localDevice = this.GetDevice(mainkeys); - var tempDevice = localDevice == null ? device : localDevice; - - //鍒锋柊灞炴�� - this.SetDeviceInfoToMain(tempDevice, device); - if (this.RefreshDeviceFunctionType(tempDevice, device, false) == true) + if (localDevice != null) { - //闇�瑕佸彂閫佸姛鑳界被鍨嬬粰缃戝叧 - listFucDevice.Add(tempDevice); + //鍒锋柊灞炴�� + this.SetDeviceInfoToMain(localDevice, device); + if (this.RefreshDeviceFunctionType(localDevice, device, false) == true) + { + //闇�瑕佸彂閫佸姛鑳界被鍨嬬粰缃戝叧 + listFucDevice.Add(localDevice); + } } } } @@ -2881,8 +2850,14 @@ /// <param name="device">璁剧疆婧愯澶囧璞�</param> public void SetDeviceInfoToMain(CommonDevice mainDevice, CommonDevice device) { - mainDevice.DeviceName = device.DeviceInfo.MacName; - mainDevice.DeviceEpointName = device.DeviceInfo.DeviceName; + if (string.IsNullOrEmpty(device.DeviceInfo.MacName) == false) + { + mainDevice.DeviceName = device.DeviceInfo.MacName; + } + if (string.IsNullOrEmpty(device.DeviceInfo.DeviceName) == false) + { + mainDevice.DeviceEpointName = device.DeviceInfo.DeviceName; + } mainDevice.CurrentGateWayId = device.CurrentGateWayId; mainDevice.ZigbeeType = device.DeviceInfo.ZigbeeType; mainDevice.IsOnline = device.DeviceInfo.IsOnline; @@ -3396,10 +3371,6 @@ /// PM2.5绌烘皵璐ㄩ噺浼犳劅鍣� /// </summary> Sensor_PMTwoPointFive = 1307, - /// <summary> - /// 娓╂箍搴︿紶鎰熷櫒(杩欎釜鍗曡瘝鎷奸敊浜�,浣嗘槸閿欎簡灏遍敊浜嗗憲,灏辫繖鏍蜂簡) - /// </summary> - Sensor_TemperatureHumidity = 1308, /// <summary> /// 杩愬姩浼犳劅鍣� @@ -3410,7 +3381,11 @@ /// </summary> Sensor_Keyfob = -1307, /// <summary> - /// 娓╁害浼犳劅鍣�(杩欎釜鍗曡瘝鎷奸敊浜�,浣嗘槸閿欎簡灏遍敊浜嗗憲,灏辫繖鏍蜂簡) + /// 娓╂箍搴︿紶鎰熷櫒 + /// </summary> + Sensor_TemperatureHumidity = -1308, + /// <summary> + /// 娓╁害浼犳劅鍣� /// </summary> Sensor_Temperature = -1309, /// <summary> -- Gitblit v1.8.0