From 3fcb73db484d2bed5ee993702913a7eaea68068c Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期五, 18 八月 2023 18:01:23 +0800 Subject: [PATCH] 2.1.2 --- HDL_ON/Entity/Function/Function.cs | 208 +++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 182 insertions(+), 26 deletions(-) diff --git a/HDL_ON/Entity/Function/Function.cs b/HDL_ON/Entity/Function/Function.cs index 8f4f3c3..53702aa 100644 --- a/HDL_ON/Entity/Function/Function.cs +++ b/HDL_ON/Entity/Function/Function.cs @@ -171,6 +171,9 @@ string iconPath = spk.Replace(".", ""); switch (spk) { + case SPK.AirSwitchP3: + iconPath = "electricalbreaker"; + break; case SPK.PanelSocket: iconPath = "electricalsocket"; break; @@ -442,20 +445,52 @@ /// </summary> public bool collect = false; - private bool _online = false; - /// <summary> - /// 鏄惁鍦ㄧ嚎 - /// </summary> - public bool online - { + private bool _online; + public bool online { get { + if (spk == SPK.AirSwitchP3) + { + return _online; + } return true; } set { _online = value; } + } + ///// <summary> + ///// 鏄惁鍦ㄧ嚎 + ///// </summary> + //public bool online + //{ + // get + // { + // if(spk == SPK.AirSwitchP3) + // { + // return _online; + // } + // return true; + // } + // set + // { + // _online = value; + // } + //} + + public bool isOnline() + { + if (spk == SPK.AirSwitchP3) + { + return online; + } + return true; + } + + public void setOnine(bool isOnline) + { + online = isOnline; } /// <summary> @@ -727,9 +762,9 @@ /// <summary> /// 淇濆瓨鎴块棿缁戝畾淇℃伅 /// </summary> - public void UpdataRoomIds() + public async void UpdataRoomIds() { - new System.Threading.Thread(() => + new System.Threading.Thread( () => { var pack = ApiUtlis.Ins.HttpRequest.UpdataDevcieBindRoomInfo(this); //鐩存帴淇濆瓨鏈湴锛� @@ -803,25 +838,27 @@ var list = new List<FunctionAttributes>(); if (spk == SPK.GroupControl) { - var gc = FunctionList.List.groupControls.Find((obj) => obj.sid == sid); - if (gc != null) + lock (list) { - foreach (var temp in gc.sids) + var gc = FunctionList.List.groupControls.Find((obj) => obj.sid == sid); + if (gc != null) { - var light = FunctionList.List.GetLightList().Find((obj) => obj.sid == temp.sid); - if (light != null) + foreach (var temp in gc.sids) { - foreach (var attr in light.attributes) + var tempDevice = FunctionList.List.GetLightList().Find((obj) => obj.sid == temp.sid); + if (tempDevice != null) { - if (list.Find((obj) => obj.key == attr.key) == null) + foreach (var attr in tempDevice.attributes) { - list.Add(attr); + if (list.Find((obj) => obj.key == attr.key) == null) + { + list.Add(attr); + } } } } } } - } else { @@ -830,6 +867,10 @@ foreach (var attr in list) { + if(attr.key == FunctionAttributeKey.ColorfulBegin || attr.key == FunctionAttributeKey.ColorfulEnd || attr.key == FunctionAttributeKey.ColorfulTime) + { + continue; + } //绐楀笜鍚屾椂鍙戦�佸紑鍏宠窡鐧惧垎姣斾細鏈夐棶棰橈紝 if(spk == SPK.CurtainRoller || spk == SPK.CurtainTrietex || spk == SPK.CurtainDream) { @@ -845,27 +886,54 @@ sFunc.type = "5"; } - string us = ""; switch (attr.key) { case FunctionAttributeKey.SetTemp: + var tt = GetAttribute(FunctionAttributeKey.TempType); + if (tt == null) + { + attr.unit = "掳C"; + } + else + { + if (tt.unit == string.Empty) + { + attr.unit = "掳C"; + } + else + { + if (tt.unit == "C") + { + attr.unit = "掳C"; + } + else if (tt.unit == "F") + { + attr.unit = "掳F"; + } + else + { + attr.unit = tt.unit; + } + } + } + break; case FunctionAttributeKey.RoomTemp: - us = "掳C"; + attr.unit = "掳C"; var tempType = attributes.Find((obj) => obj.key == FunctionAttributeKey.TempType); if (tempType != null) { - us = tempType.curValue.ToString(); + attr.unit = tempType.curValue.ToString(); } break; case FunctionAttributeKey.Percent: case FunctionAttributeKey.Brightness: - us = "%"; + attr.unit = "%"; break; case FunctionAttributeKey.CCT: - us = "K"; + attr.unit = "K"; break; case FunctionAttributeKey.Angle: - us = "掳"; + attr.unit = "掳"; break; } @@ -929,13 +997,13 @@ vv = 26; } sFunc.status.Add(new SceneFunctionStatus() { - UintString = us, + UintString = attr.unit, key = attr.key, value = Convert.ToInt32(vv).ToString(), max = attr.max, min = attr.min }) ; } else { sFunc.status.Add(new SceneFunctionStatus() { - UintString = us, + UintString = attr.unit, key = attr.key, value = attr.curValue.ToString(), max = attr.max, min = attr.min }); } break; @@ -1083,6 +1151,10 @@ /// 浜戠璐熻矗鐢熸垚 /// </summary> public string deviceId = "0"; + /// <summary> + /// 鍦ㄧ嚎鐘舵�� + /// </summary> + public bool online = true; public List<AttributesStatus> status = new List<AttributesStatus>(); } /// <summary> @@ -1142,6 +1214,10 @@ /// 褰撳墠鍊� /// </summary> public object curValue = new object(); + /// <summary> + /// 灞炴�у崟浣� + /// </summary> + public string unit=string.Empty; } /// <summary> @@ -1149,6 +1225,79 @@ /// </summary> public static class FunctionAttributeKey { + #region 涓夌浉绌哄紑灞炴�� + /// <summary> + /// A鐩稿姛鐜� + /// </summary> + public const string PowerA = "power_a"; + /// <summary> + /// B鐩稿姛鐜� + /// </summary> + public const string PowerB = "power_b"; + /// <summary> + /// C鐩稿姛鐜� + /// </summary> + public const string PowerC = "power_c"; + /// <summary> + /// A鐩哥數鍘� + /// </summary> + public const string VoltageA = "voltage_a"; + /// <summary> + /// B鐩哥數鍘� + /// </summary> + public const string VoltageB = "voltage_b"; + /// <summary> + /// C鐩哥數鍘� + /// </summary> + public const string VoltageC = "voltage_c"; + /// <summary> + /// A鐩哥數娴� + /// </summary> + public const string CurrentA = "current_a"; + /// <summary> + /// B鐩哥數娴� + /// </summary> + public const string CurrentB = "current_b"; + /// <summary> + /// C鐩哥數娴� + /// </summary> + public const string CurrentC = "current_c"; + /// <summary> + /// A鐩告俯搴� + /// </summary> + public const string TempA = "temp_a"; + /// <summary> + /// B鐩告俯搴� + /// </summary> + public const string TempB = "temp_b"; + /// <summary> + /// C鐩告俯搴� + /// </summary> + public const string TempC = "temp_c"; + /// <summary> + /// 杩囨祦鍊� + /// </summary> + public const string MaxCurrent = "max_current"; + /// <summary> + /// 杩囨俯鍊� + /// </summary> + public const string MaxTemp = "max_temp"; + /// <summary> + /// A鐩哥數閲� + /// </summary> + public const string ElectricityA = "electricity_a"; + /// <summary> + /// B鐩哥數閲� + /// </summary> + public const string ElectricityB = "electricity_b"; + /// <summary> + /// C鐩哥數閲� + /// </summary> + public const string ElectricityC = "electricity_c"; + + #endregion + + public const string _null = ""; /// <summary> /// 瀹夐槻甯冮槻鐘舵�� @@ -1764,6 +1913,8 @@ { var spkList = new List<string>(); spkList.Add(ElectricEnergy); + spkList.Add(AirSwitch); + spkList.Add(AirSwitchP3); return spkList; } #endregion @@ -2052,6 +2203,10 @@ /// 鏅鸿兘绌哄紑 /// </summary> public const string AirSwitch = "electrical.breaker"; + /// <summary> + /// 涓夌浉鏅鸿兘绌哄紑 + /// </summary> + public const string AirSwitchP3 = "electrical.breakerP3"; #region 娑傞甫 /// <summary> @@ -2104,7 +2259,8 @@ spkList.Add(ElectricTuyaWeepRobot2); spkList.Add(ElectricTuyaWaterValve); spkList.Add(ElectricTuyaWaterValve2); - spkList.Add(AirSwitch); + //spkList.Add(AirSwitch); + //spkList.Add(AirSwitchP3); return spkList; } -- Gitblit v1.8.0