From 0a11352dffeb8d5f31dd40b9728fe1abf4537f04 Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期五, 01 九月 2023 18:06:45 +0800
Subject: [PATCH] 2023年09月01日18:06:42

---
 HDL_ON/DAL/DriverLayer/Control.cs |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/HDL_ON/DAL/DriverLayer/Control.cs b/HDL_ON/DAL/DriverLayer/Control.cs
index e4cebab..85737d2 100644
--- a/HDL_ON/DAL/DriverLayer/Control.cs
+++ b/HDL_ON/DAL/DriverLayer/Control.cs
@@ -261,6 +261,7 @@
         /// </summary>
         public void OpenTcpClent()
         {
+            return;
             if (myTcpClient == null)
             {
                 myTcpClient = new Control_TcpClient(reportIp);
@@ -535,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);
                     }
                 }
                 //杩滅▼閫氳
@@ -625,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++;
@@ -636,7 +641,10 @@
                         System.Threading.Thread.Sleep(100);
                     }
                 }
-                var pack = pm.ControlDevice(actionObjs);
+                if (actionObjs.Count > 0)
+                {
+                    var pack = pm.ControlDevice(actionObjs);
+                }
             }
         }
 
@@ -862,7 +870,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);
             }
@@ -1011,7 +1019,7 @@
 
                 if (receiveObj.Topic == CommunicationTopic.ct.HeartBeat + "_reply")
                 {
-                    Ins.myTcpClient.ClearHeartBeatLog();
+                    //Ins.myTcpClient.ClearHeartBeatLog();
                     MainPage.Log("tcp蹇冭烦鍥炲");
                     return null;
                 }
@@ -1107,7 +1115,7 @@
                         Ins.IsLocalEncrypt = device.isLocalEncrypt;
                         //MainPage.Log("缃戝叧鏈湴鍔犲瘑鐘舵�侊細" + device.local_encrypt.ToString());
                         //鐧诲綍缃戝叧Tcp
-                        OpenTcpClent();
+                        //OpenTcpClent();
 
 
                     }

--
Gitblit v1.8.0