From f9181a9c8125136f597add7c30cb2ff508d54ba7 Mon Sep 17 00:00:00 2001 From: mac <user@users-MacBook-Pro.local> Date: 星期四, 25 七月 2024 17:34:32 +0800 Subject: [PATCH] 2024年07月25日17:33:40 --- HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/GroupControl.cs | 56 ++++++++++++++++++++++++++++++++++++++------------------ 1 files changed, 38 insertions(+), 18 deletions(-) diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/GroupControl.cs b/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/GroupControl.cs index 9c80d01..6a36845 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/GroupControl.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/GroupControl.cs @@ -11,7 +11,7 @@ { public GroupControl() { - spk = "GroupControl"; + spk = "groupControl"; } /// <summary> /// 缇ゆ帶ID @@ -26,7 +26,7 @@ /// </summary> public string NewGroupControlSid() { - string sceneId = ""; + string Id = ""; try { string sOidBeginsWith = "000101";//鍘傚晢 + 閫氳鏂瑰紡 @@ -53,23 +53,23 @@ //sTimeSpan = "00000000"; } - sceneId = sOidBeginsWith + sTimeSpan; + Id = sOidBeginsWith + sTimeSpan; - sceneId += "AA"; - sceneId += "AA01"; + Id += "AA"; + Id += "AA01"; int maxId = 1; Random random = new Random(Guid.NewGuid().GetHashCode()); maxId = random.Next(10); - sceneId += (maxId + 1).ToString("X4"); - sceneId += "0000"; + Id += (maxId + 1).ToString("X4"); + Id += "0000"; } catch { - return sceneId; + return Id; } - return sceneId; + return Id; } /// <summary> /// 缇ゆ帶鍚嶇О @@ -121,22 +121,16 @@ /// 缇ゆ帶鎺у埗 /// </summary> /// <param name="pairs"></param> - public void Control(Dictionary<string,object> pairs) + public void Control(Dictionary<string,string> pairs) { try { if (DriverLayer.Control.Ins.GatewayOnline_Local) { - var controlValues = new Dictionary<string, string>(); - foreach (var p in pairs) - { - controlValues.Add("key", p.Key); - controlValues.Add("value", p.Value.ToString()); - } - var functionControlDataObj = GetGatewayAlinkControlData(controlValues); + var functionControlDataObj = GetGatewayAlinkControlData(pairs); var functionControlDataJson = Newtonsoft.Json.JsonConvert.SerializeObject(functionControlDataObj); - var sendBytes = DriverLayer.Control.Ins.ConvertSendBodyData(CommunicationTopic.ct.ControlFunctionTopic, functionControlDataJson); + var sendBytes = DriverLayer.Control.Ins.ConvertSendBodyData(CommunicationTopic.ct.ControlGroupControlTopic, functionControlDataJson); new Control_Udp().SendLocalHdlLinkData(sendBytes, functionControlDataObj.id, 3); MainPage.Log($"鏈湴閫氳 鍙戦�丠DL-Link鏁版嵁:{functionControlDataJson}"); } @@ -167,6 +161,32 @@ MainPage.Log($"缇ゆ帶鎺у埗澶辫触: {ex.Message}"); } } + + + public new List<FunctionAttributes> attributes { + get + { + var list = new List<FunctionAttributes>(); + + foreach (var temp in sids) + { + var light = FunctionList.List.GetLightList().Find((obj) => obj.sid == temp.sid); + if (light != null) + { + foreach(var attr in light.attributes) + { + if(list.Find((obj)=>obj.key == attr.key) == null) + { + list.Add(attr); + } + } + } + + } + + return list; + } + } } public class GroupControlFunction -- Gitblit v1.8.0