From 9f326f4000847e6167d8166fa2f6a66f53cb3734 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期四, 17 十二月 2020 09:07:13 +0800 Subject: [PATCH] 新云端Ver1.3 --- ZigbeeApp/Shared/Phone/ZigBee/Device/CommonDevice.cs | 182 ++++++++++++++++++++++---------------------- 1 files changed, 91 insertions(+), 91 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Device/CommonDevice.cs b/ZigbeeApp/Shared/Phone/ZigBee/Device/CommonDevice.cs index fcd8ca0..5d8ca7d 100755 --- a/ZigbeeApp/Shared/Phone/ZigBee/Device/CommonDevice.cs +++ b/ZigbeeApp/Shared/Phone/ZigBee/Device/CommonDevice.cs @@ -10,8 +10,8 @@ { #region 闇�瑕佷繚瀛樼殑鍙橀噺 - /// <summary> - /// 鏄惁鏄嚜瀹氫箟鍥剧墖 + /// <summary> + /// 鏄惁鏄嚜瀹氫箟鍥剧墖 /// </summary> public bool IsCustomizeImage = false; /// <summary> @@ -27,9 +27,9 @@ { get { - if (string.IsNullOrEmpty(IconPath)) - { - return string.Empty; + if (string.IsNullOrEmpty(IconPath)) + { + return string.Empty; } var pathArr = IconPath.Split('.'); if (pathArr == null || string.IsNullOrEmpty(pathArr[0])) @@ -72,14 +72,14 @@ /// <para>262:Light sensor,鍏夌収浼犳劅鍣�</para> /// <para>1026:sensor,浼犳劅鍣紝鍏蜂綋绫诲瀷鐨勪紶鎰熷櫒DeviceType鏉ュ尯鍒�</para> /// </summary> - public int DeviceID; - /// <summary> - /// <para>2020.09.21杩藉姞:涓轰簡瀵瑰簲绗笁鏂硅澶�,浠ュ強涔嬪悗鐨勫璁惧ID闂,杩藉姞鐨勫彉閲�</para> - /// <para>杩欐槸涓壒娈婄殑,骞朵笖涓嶄繚瀛樺湪鏂囦欢褰撲腑鐨処D, DeviceType鐢辨鍊兼槧灏勫嚭鏉�</para> - /// <para>褰撹澶囨槸娌充笢璁惧鏃�,瀹冧笌DeviceID鐩哥瓑</para> - /// <para>褰撴槸鐪熸鐨勭涓夋柟璁惧鏃�,瀹冩湁鍙兘涓嶥eviceID涓嶇浉绛�</para> - /// <para>姣斿锛�2鍜�256閮芥槸缁х數鍣�,閭d箞銆怐eviceID涓�2 鎴栬�� DeviceID涓�256銆� 鑰� 銆怑xDeviceID鍥哄畾涓�2銆�,銆怐eviceType涓篛nOffOutput銆�</para> - /// <para>閫氫織鏉ヨ锛欴eviceID鏄疄闄呮纭殑ID,鑰屻�怑xDeviceID鏄竴绉嶆墍灞炴蹇电殑ID銆�</para> + public int DeviceID; + /// <summary> + /// <para>2020.09.21杩藉姞:涓轰簡瀵瑰簲绗笁鏂硅澶�,浠ュ強涔嬪悗鐨勫璁惧ID闂,杩藉姞鐨勫彉閲�</para> + /// <para>杩欐槸涓壒娈婄殑,骞朵笖涓嶄繚瀛樺湪鏂囦欢褰撲腑鐨処D, DeviceType鐢辨鍊兼槧灏勫嚭鏉�</para> + /// <para>褰撹澶囨槸娌充笢璁惧鏃�,瀹冧笌DeviceID鐩哥瓑</para> + /// <para>褰撴槸鐪熸鐨勭涓夋柟璁惧鏃�,瀹冩湁鍙兘涓嶥eviceID涓嶇浉绛�</para> + /// <para>姣斿锛�2鍜�256閮芥槸缁х數鍣�,閭d箞銆怐eviceID涓�2 鎴栬�� DeviceID涓�256銆� 鑰� 銆怑xDeviceID鍥哄畾涓�2銆�,銆怐eviceType涓篛nOffOutput銆�</para> + /// <para>閫氫織鏉ヨ锛欴eviceID鏄疄闄呮纭殑ID,鑰屻�怑xDeviceID鏄竴绉嶆墍灞炴蹇电殑ID銆�</para> /// </summary> [Newtonsoft.Json.JsonIgnore] public int ExDeviceID; @@ -118,11 +118,11 @@ /// 0锛氳澶囦笉鍦ㄧ嚎 /// <para>1锛氳澶囧湪绾�</para> /// </summary> - public int IsOnline; - /// <summary> - /// 1锛氳矾鐢辫澶� - /// <para>2锛氱粓绔澶囷紝鐢垫睜璁惧</para> - /// </summary> + public int IsOnline; + /// <summary> + /// 1锛氳矾鐢辫澶� + /// <para>2锛氱粓绔澶囷紝鐢垫睜璁惧</para> + /// </summary> public int ZigbeeType; /// <summary> /// 鍥轰欢鐗堟湰 @@ -167,7 +167,7 @@ /// <summary> /// 杈撳嚭绨囧垪琛� /// </summary> - public List<OutClusterObj> OutClusterList = new List<OutClusterObj>(); + public List<OutClusterObj> OutClusterList = new List<OutClusterObj>(); /// <summary> /// 鐢ㄤ簬璁板綍璁惧鏈�鏂颁笂鎶ョ殑灞炴�х姸鎬佷俊鎭� /// </summary> @@ -179,8 +179,8 @@ /// 鏄惁宸茬粡璇诲彇浜嗚澶囩姸鎬�(姝ゅ睘鎬ф槸缁欎富椤典娇鐢ㄧ殑) /// </summary> [Newtonsoft.Json.JsonIgnore] - public bool HadReadDeviceStatu = false; - + public bool HadReadDeviceStatu = false; + /// <summary> /// 鏄惁鏄綆鐢甸噺(杩欎釜鍙橀噺鐩墠鏄粰浼犳劅鍣ㄧ敤鐨�) /// </summary> @@ -248,19 +248,19 @@ #endregion #region 璁惧淇濆瓨鍙婄敓鎴� - - /// <summary> - /// 鐢辫澶囧瓧绗︿覆姣旂壒鎭㈠璁惧瀵硅薄 - /// </summary> - /// <param name="intDeviceType">璁惧DeviceType鐨勬暣鍨嬪��</param> - /// <param name="strDeviceByte">璁惧Json鏂囦欢杞负姣旂壒鍚庡啀杞负鐨勫瓧绗︿覆</param> + + /// <summary> + /// 鐢辫澶囧瓧绗︿覆姣旂壒鎭㈠璁惧瀵硅薄 + /// </summary> + /// <param name="intDeviceType">璁惧DeviceType鐨勬暣鍨嬪��</param> + /// <param name="strDeviceByte">璁惧Json鏂囦欢杞负姣旂壒鍚庡啀杞负鐨勫瓧绗︿覆</param> /// <returns></returns> public static CommonDevice CommonDeviceByByteString(int intDeviceType, string strDeviceByte) - { - //杩欐槸娌充笢鐨勭壒娈婄鐐�,涓嶉渶瑕佸鐞� - if (intDeviceType == 49408) - { - return null; + { + //杩欐槸娌充笢鐨勭壒娈婄鐐�,涓嶉渶瑕佸鐞� + if (intDeviceType == 49408) + { + return null; } CommonDevice device = null; @@ -271,7 +271,7 @@ } else if (intDeviceType == (int)DeviceType.OnOffOutput || intDeviceType == 256) { - device = Newtonsoft.Json.JsonConvert.DeserializeObject<ToggleLight>(strDeviceByte); + device = Newtonsoft.Json.JsonConvert.DeserializeObject<ToggleLight>(strDeviceByte); device.ExDeviceID = (int)DeviceType.OnOffOutput; } else if (intDeviceType == (int)DeviceType.ColorDimmerSwitch) @@ -321,7 +321,7 @@ else if (intDeviceType == (int)DeviceType.DoorLock) { device = Newtonsoft.Json.JsonConvert.DeserializeObject<DoorLock>(strDeviceByte); - } + } else if (intDeviceType == (int)DeviceType.TemperatureSensor) { device = Newtonsoft.Json.JsonConvert.DeserializeObject<TemperatureSensor>(strDeviceByte); @@ -341,7 +341,7 @@ else if (intDeviceType == (int)DeviceType.ColorTemperatureLight) { device = Newtonsoft.Json.JsonConvert.DeserializeObject<ColorTemperatureLight>(strDeviceByte); - } + } else if (intDeviceType == (int)DeviceType.Buzzer) { device = Newtonsoft.Json.JsonConvert.DeserializeObject<Buzzer>(strDeviceByte); @@ -355,20 +355,20 @@ device = Newtonsoft.Json.JsonConvert.DeserializeObject<DimmerSwitch>(strDeviceByte); } else - { + { device = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice>(strDeviceByte); } //杩欐槸娌充笢鐨勭壒娈婄鐐�,涓嶉渶瑕佸鐞� - if (device.DeviceEpoint == 242 && intDeviceType == 97) - { - return null; + if (device.DeviceEpoint == 242 && intDeviceType == 97) + { + return null; } - if (device.ExDeviceID == 0) - { - //璧嬪垵濮嬪�� - device.ExDeviceID = device.DeviceID; + if (device.ExDeviceID == 0) + { + //璧嬪垵濮嬪�� + device.ExDeviceID = device.DeviceID; } //鑳藉皯瀛樹竴涓彉閲忓氨灏戝瓨涓�涓� @@ -399,15 +399,15 @@ //灞曠ず妯℃澘鏃�,涓嶅厑璁镐繚瀛樻枃浠�(闃叉灞炴�т笂鎶ョ敤鐨�) return; } - if (IconPath == string.Empty) - { - //淇濆瓨璁惧鍥炬爣(杩欓噷浼氫繚瀛樹竴娆�,涓嬮潰灏变笉鐢ㄤ繚瀛樹簡) - this.SaveDeviceIcon(); - return; + if (IconPath == string.Empty) + { + //淇濆瓨璁惧鍥炬爣(杩欓噷浼氫繚瀛樹竴娆�,涓嬮潰灏变笉鐢ㄤ繚瀛樹簡) + this.SaveDeviceIcon(); + return; } Shared.Common.Global.WriteFileByBytesByHomeId(FilePath, System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this))); - } - + } + /// <summary> /// 淇濆瓨璁惧鍥炬爣 /// </summary> @@ -415,25 +415,25 @@ { if (IconPath == string.Empty) { - //骞叉帴鐐� - if (this.Type == DeviceType.OnOffSwitch) - { - IconPath = "Device/DryContact.png"; - } + //骞叉帴鐐� + if (this.Type == DeviceType.OnOffSwitch) + { + IconPath = "Device/DryContact.png"; + } else if (this.Type == DeviceType.ColorDimmableLight) { //褰╃伅 IconPath = "Device/ColorLight.png"; - } + } else if (this.Type == DeviceType.DimmableLight) { //璋冨厜鍣� IconPath = "Device/Light.png"; - } - else if (this.Type == DeviceType.ColorTemperatureLight) - { - //鑹叉俯鐏� - IconPath = "Device/ColorLightTemperature.png"; + } + else if (this.Type == DeviceType.ColorTemperatureLight) + { + //鑹叉俯鐏� + IconPath = "Device/ColorLightTemperature.png"; } else if (this.Type == DeviceType.OnOffOutput) { @@ -460,31 +460,31 @@ //婀垮害浼犳劅鍣� IconPath = "Device/SensorHumidity.png"; } - else if (this.Type == DeviceType.TemperatureSensor) - { - if (((TemperatureSensor)this).SensorDiv == 1) - { - //娓╁害浼犳劅鍣� - IconPath = "Device/SensorTemperature.png"; - } - else if (((TemperatureSensor)this).SensorDiv == 2) - { - //婀垮害浼犳劅鍣� - IconPath = "Device/SensorHumidity.png"; - } + else if (this.Type == DeviceType.TemperatureSensor) + { + if (((TemperatureSensor)this).SensorDiv == 1) + { + //娓╁害浼犳劅鍣� + IconPath = "Device/SensorTemperature.png"; + } + else if (((TemperatureSensor)this).SensorDiv == 2) + { + //婀垮害浼犳劅鍣� + IconPath = "Device/SensorHumidity.png"; + } } - else if (this.Type != DeviceType.UnKown) - { - //鍏朵粬鐨勫浘鏍囨湁鐐圭壒娈� - string unSelectPic = string.Empty; - string selectPic = string.Empty; - Shared.Common.LocalDevice.Current.GetDeviceObjectIcon(new List<CommonDevice> { this }, ref unSelectPic, ref selectPic); - IconPath = unSelectPic; - } + else if (this.Type != DeviceType.UnKown) + { + //鍏朵粬鐨勫浘鏍囨湁鐐圭壒娈� + string unSelectPic = string.Empty; + string selectPic = string.Empty; + Shared.Phone.HdlDeviceCommonLogic.Current.GetDeviceObjectIcon(new List<CommonDevice> { this }, ref unSelectPic, ref selectPic); + IconPath = unSelectPic; + } Shared.Common.Global.WriteFileByBytesByHomeId(FilePath, System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this))); } - } - + } + #endregion #region 杈撳叆杈撳嚭闀炲畾涔� @@ -715,20 +715,20 @@ /// 椹卞姩浠g爜銆備负0鏃讹紝琛ㄧずzigbee鍗忚皟鍣ㄨ澶囥�傚叾浠栧�艰〃绀轰负铏氭嫙椹卞姩璁惧 /// </summary> public int DriveCode; - /// <summary> - /// 鍘傚晢鍚嶇О + /// <summary> + /// 鍘傚晢鍚嶇О /// </summary> public string ManufacturerName = string.Empty; - /// <summary> - /// 妯″潡ID + /// <summary> + /// 妯″潡ID /// </summary> public string ModelIdentifier = string.Empty; - /// <summary> - /// 濂藉儚鏄簭鍒楀彿 + /// <summary> + /// 濂藉儚鏄簭鍒楀彿 /// </summary> public string ProductCode = string.Empty; - /// <summary> - /// 璁惧鍔熻兘绫诲瀷(绌烘皵寮�鍏冲拰缁х數鍣ㄤ笓鐢�) + /// <summary> + /// 璁惧鍔熻兘绫诲瀷(绌烘皵寮�鍏冲拰缁х數鍣ㄤ笓鐢�) /// </summary> public int FunctionType = -1; /// <summary> -- Gitblit v1.8.0