From 203c3a3ffde6259413d9743f6a723b95b1e7989c Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期四, 06 七月 2023 22:43:05 +0800 Subject: [PATCH] 门锁功能 --- HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/GroupControl.cs | 83 +++++++++++++++++++---------------------- 1 files changed, 39 insertions(+), 44 deletions(-) diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/GroupControl.cs b/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/GroupControl.cs index 4591f0b..81ce887 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/GroupControl.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/GroupControl.cs @@ -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> /// 缇ゆ帶鍚嶇О @@ -82,60 +82,55 @@ /// <summary> /// 鎴块棿uid /// </summary> - public List<String> uids = new List<string>(); + [Newtonsoft.Json.JsonIgnore] + public List<string> uids = new List<string>(); //public List<String> roomIds = new List<string>(); /// <summary> /// 缇ゆ帶鍔熻兘sid閰嶇疆 /// </summary> public List<GroupControlFunction> sids = new List<GroupControlFunction>(); - ///// <summary> - ///// 鑾峰彇璁惧娣诲姞鍒版埧闂寸殑鎴块棿鍚嶇О - ///// </summary> - ///// <returns></returns> - //public string GetRoomListName() - //{ - // string roomNameList = ""; - // foreach (var roomId in roomIds) - // { - // var findRoom = SpatialInfo.CurrentSpatial.RoomList.Find(obj => obj.roomId == roomId); - // if (findRoom == null) - // { - // continue; - // } - // if (roomNameList != "") - // { - // roomNameList += ","; - // } - // roomNameList += findRoom.floorName + "-" + findRoom.roomName; - // } - // if (roomNameList == "") - // { - // roomNameList = Language.StringByID(StringId.WholeZone); - // } - // return roomNameList; - //} + /// <summary> + /// 鑾峰彇璁惧娣诲姞鍒版埧闂寸殑鎴块棿鍚嶇О + /// </summary> + /// <returns></returns> + public string GetUidListName() + { + string roomNameList = ""; + foreach (var roomId in uids) + { + var findRoom = SpatialInfo.CurrentSpatial.RoomList.Find(obj => obj.roomId == roomId); + if (findRoom == null) + { + continue; + } + if (roomNameList != "") + { + roomNameList += ","; + } + roomNameList += findRoom.floorName + "-" + findRoom.roomName; + } + if (roomNameList == "") + { + roomNameList = Language.StringByID(StringId.WholeZone); + } + return roomNameList; + } /// <summary> /// 缇ゆ帶鎺у埗 /// </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}"); } -- Gitblit v1.8.0