From 8fcc3bd198606e0400eca5383572fb97ecdada85 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期二, 10 一月 2023 15:51:37 +0800
Subject: [PATCH] 备份
---
SmartHome/HDL/Operation/Control.cs | 38 ++++++++++++++------------------------
1 files changed, 14 insertions(+), 24 deletions(-)
diff --git a/SmartHome/HDL/Operation/Control.cs b/SmartHome/HDL/Operation/Control.cs
index 0b0b1b2..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,24 +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 = "")
{
- if (command == Command.ReadDeviceLoopInfo || command == Command.ReadDeviceModul)
- CommonPage.LocalPhoneFindDevice = true;
- if (command == Command.ReadGateway || command == Command.ReadGatewayProgrammingMode || command == Command.SetGateway) {
- CommonPage.FindGateway = true;
- CommonPage.LocalPhoneFindDevice = true;
+ Control control = new Control ();
+ var sendIp = CommonPage.EndPoint;
+ if (!string.IsNullOrEmpty (ip)) {
+ sendIp = new System.Net.IPEndPoint (System.Net.IPAddress.Parse (ip), 9999);
}
- Control control = new Control () { IsCanShowTip = isShow };
control.Send (new Target () {
- IPEndPoint = CommonPage.EndPoint,
+ IPEndPoint = sendIp,
Command = command,
SubnetID = subnetID,
DeviceID = deviceID,
AddData = gatewayBytes,
}, SendCount.Three, true);
- CommonPage.FindGateway = false;
-
return control.UsefulBytes;
}
@@ -46,14 +41,8 @@
/// </summary>
public static void ControlBytesSend (Command command, byte subnetID, byte deviceID, byte [] gatewayBytes, SendCount sendCount = SendCount.Three, System.Net.IPEndPoint ipEndpoint = null, bool isShowTip = true)
{
- if (command == Command.ReadDeviceLoopInfo || command == Command.ReadDeviceModul)
- CommonPage.LocalPhoneFindDevice = true;
- if (command == Command.ReadGateway || command == Command.ReadGatewayProgrammingMode
- || command == Command.SetGateway) {
- CommonPage.FindGateway = true;
- CommonPage.LocalPhoneFindDevice = 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,
@@ -61,7 +50,6 @@
DeviceID = deviceID,
AddData = gatewayBytes,
}, sendCount, false);
- CommonPage.FindGateway = false;
System.Console.WriteLine (command.ToString () + "::" + CommonPage.EndPoint.ToString ());
}
@@ -204,6 +192,8 @@
case Command.READ_JOG_OPEN_TIME_ACK:
case Command.SET_JOG_CLOSE_TIME_ACK:
case Command.READ_JOG_CLOSE_TIME_ACK:
+ case Command.GetRemoteOnePortInfoACK:
+ case Command.GetRemoteOnePortListInfoACK:
receiveFlag += "";
break;
case Command.ControlMusicModel1ACK:
@@ -276,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 ();
@@ -389,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) {
@@ -545,6 +533,8 @@
case Command.READ_JOG_OPEN_TIME_CMD:
case Command.SET_JOG_CLOSE_TIME_CMD:
case Command.READ_JOG_CLOSE_TIME_CMD:
+ case Command.GetRemoteOnePortInfo:
+ case Command.GetRemoteOnePortListInfo:
this.SendFlag += "";
break;
case Command.ControlMusicModel2:
--
Gitblit v1.8.0