From 9ebd6edb9beddf1a6881b2ca924ed43bf5cedfbe Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期五, 30 十二月 2022 11:24:03 +0800
Subject: [PATCH] 1

---
 SmartHome/HDL/Operation/Control.cs |   21 ++++++++++-----------
 1 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/SmartHome/HDL/Operation/Control.cs b/SmartHome/HDL/Operation/Control.cs
index a2b60c0..35e9033 100644
--- a/SmartHome/HDL/Operation/Control.cs
+++ b/SmartHome/HDL/Operation/Control.cs
@@ -8,7 +8,6 @@
 {
     public class Control
     {
-        public bool IsCanShowTip;
         public System.DateTime LatestDateTime = System.DateTime.Now;
 
         /// <summary>
@@ -20,18 +19,20 @@
         /// 鍙戦�佹暟鎹紝绛夊緟鏈夊弽棣�
         /// </summary>
         /// <returns>The bytes send has return.</returns>
-        public static byte [] ControlBytesSendHasReturn (Command command, byte subnetID, byte deviceID, byte [] gatewayBytes, bool isShow = true)
+        public static byte [] ControlBytesSendHasReturn (Command command, byte subnetID, byte deviceID, byte [] gatewayBytes, string ip = "")
         {
-          
-            Control control = new Control () { IsCanShowTip = isShow };
+            Control control = new Control ();
+            var sendIp = CommonPage.EndPoint;
+            if (!string.IsNullOrEmpty (ip)) {
+                sendIp = new System.Net.IPEndPoint (System.Net.IPAddress.Parse (ip), 9999); 
+            }
             control.Send (new Target () {
-                IPEndPoint = CommonPage.EndPoint,
+                IPEndPoint = sendIp,
                 Command = command,
                 SubnetID = subnetID,
                 DeviceID = deviceID,
                 AddData = gatewayBytes,
             }, SendCount.Three, true);
-
             return control.UsefulBytes;
         }
 
@@ -41,7 +42,7 @@
         public static void ControlBytesSend (Command command, byte subnetID, byte deviceID, byte [] gatewayBytes, SendCount sendCount = SendCount.Three, System.Net.IPEndPoint ipEndpoint = null, bool isShowTip = true)
         {
          
-            Control control = new Control () { IsCanShowTip = isShowTip };
+            Control control = new Control ();
             control.Send (new Target () {
                 IPEndPoint = ipEndpoint == null ? CommonPage.EndPoint : ipEndpoint,//new System.Net.IPEndPoint (System.Net.IPAddress.Parse (new Net.NetWiFi ().BroadcastIpAddress.ToString ()), 6000),
                 Command = command,
@@ -265,7 +266,8 @@
                 for (int i = 0; i < controlList.Count; i++) {
                     try {
                         Control control = controlList [i];
-                        if (control.SendFlag == receiveFlag) {
+                        if (control.SendFlag == receiveFlag && (control.Packet.RemoteEndPoint.ToString() == remoteEndPoint.ToString()||
+                            control.Packet.RemoteEndPoint.ToString().Contains("6000"))) {
                             control.LatestDateTime = System.DateTime.Now;
                             control.UsefulBytes = usefulBytes;//
                             control.run ();
@@ -378,9 +380,6 @@
                 Console.WriteLine ("managerSendCount:" + ex.ToString ());
             } finally {
                 allDone.Set ();
-                if (Packet.HaveSendCount == 3 && IsCanShowTip) {
-                    //MainPage.AddTip (Language.StringByID (SimpleControl.R.MyInternationalizationString.OperationFailed));
-                }
             }
             return;
             //if (Shared.SimpleControl.CommonPage.IsRemote && !isLocal) {

--
Gitblit v1.8.0