1
wxr
2022-12-30 9ebd6edb9beddf1a6881b2ca924ed43bf5cedfbe
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) {