From 5ec581e5d37b108fc9d59e89afd8e94e21b32080 Mon Sep 17 00:00:00 2001 From: mac <user@users-MacBook-Pro.local> Date: 星期二, 17 十月 2023 17:33:36 +0800 Subject: [PATCH] 2023年10月17日17:33:33 --- HDL_ON/DAL/DriverLayer/Control.cs | 45 +++++++++++++++++++++++++++++---------------- 1 files changed, 29 insertions(+), 16 deletions(-) diff --git a/HDL_ON/DAL/DriverLayer/Control.cs b/HDL_ON/DAL/DriverLayer/Control.cs index e8a9655..6955fab 100644 --- a/HDL_ON/DAL/DriverLayer/Control.cs +++ b/HDL_ON/DAL/DriverLayer/Control.cs @@ -536,7 +536,7 @@ var sendBytes = Ins.ConvertSendBodyData(CommunicationTopic.ct.ControlFunctionTopic, functionControlDataJson); new Control_Udp().SendLocalHdlLinkData(sendBytes, functionControlDataObj.id, resend); MainPage.Log($"鏈湴閫氳 鍙戦�丠DL-Link鏁版嵁:{functionControlDataJson}"); - Ins.myTcpClient.SendMessage(sendBytes); + //Ins.myTcpClient.SendMessage(sendBytes); } } //杩滅▼閫氳 @@ -626,6 +626,10 @@ { foreach (var temp in functions) { + if((temp.trait_on_off.state.ToString() == "on" && open)|| temp.trait_on_off.state.ToString() == "off"&& !open) + { + continue; + } var apiControlData = temp.GetApiControlData(d); actionObjs.Add(apiControlData); count++; @@ -637,7 +641,10 @@ System.Threading.Thread.Sleep(100); } } - var pack = pm.ControlDevice(actionObjs); + if (actionObjs.Count > 0) + { + var pack = pm.ControlDevice(actionObjs); + } } } @@ -725,8 +732,18 @@ } else { - var pm = new DAL.Server.HttpServerRequest(); - var pack = pm.RefreshDeviceStatus(new List<string>() { function.deviceId }); + var pm = new HttpServerRequest(); + try + { + pm.RefreshDeviceStatus(new List<string>() { function.deviceId }); + }catch(Exception ex) + { + MainPage.Log($"杩滅▼璇诲彇璁惧鐘舵�佸紓甯�:{ex.Message}"); + } + finally + { + pm = null; + } } } } @@ -863,7 +880,7 @@ }, time_stamp = Utlis.GetTimestamp() }; - var aLinkJson = Newtonsoft.Json.JsonConvert.SerializeObject(aLinkData); + var aLinkJson = JsonConvert.SerializeObject(aLinkData); var sendBytes = Ins.ConvertSendBodyData(CommunicationTopic.ct.ControlScene, aLinkJson); new Control_Udp().SendLocalHdlLinkData(sendBytes, aLinkData.id, 0); } @@ -1012,7 +1029,7 @@ if (receiveObj.Topic == CommunicationTopic.ct.HeartBeat + "_reply") { - Ins.myTcpClient.ClearHeartBeatLog(); + //Ins.myTcpClient.ClearHeartBeatLog(); MainPage.Log("tcp蹇冭烦鍥炲"); return null; } @@ -1305,16 +1322,6 @@ } MainPage.Log(localFunction.name); - if (Ins.GatewayOnline_Local && isCloudData)//鏈湴閾炬帴锛岄櫎浜嗘秱楦﹁澶囨暟鎹箣澶栫殑浜戠鏁版嵁涓嶅鐞� - { - if (!SPK.Get3tySpk(SPK.BrandType.All3tyBrand).Contains(localFunction.spk) && !SPK.MusicSpkList().Contains(localFunction.spk)) - { - //MainPage.Log($"A鍗忚鏇存柊鐘舵��:鏈湴閾炬帴锛岄櫎浜嗘秱楦﹁澶囨暟鎹箣澶栫殑浜戠鏁版嵁涓嶅鐞�........"); - - return; - } - } - //if (SPK.MusicSpkList().Contains(localFunction.spk)) //{ // if (updateTemp.status.Count < 3) @@ -1335,6 +1342,11 @@ { localFunction.online = updateTemp.online; } + if (SPK.LightSpkList().Contains(localFunction.spk)) + { + localFunction.updateTime = DateTime.Now; + } + //鏇存柊鐣岄潰鐘舵�� switch (localFunction.spk) @@ -1599,6 +1611,7 @@ break; } + HomePage.UpdataFunctionStates(localFunction); RoomPage.UpdataStates(localFunction); FunctionPage.UpdataStates(localFunction); -- Gitblit v1.8.0