From f718d23a262a5a8e1241fdeaeb4153399f95e79d Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期二, 21 四月 2020 09:19:05 +0800
Subject: [PATCH] 20200421
---
HDL_ON/DriverLayer/Control_Bus.cs | 55 ++++++++++++++++++++++---------------------------------
1 files changed, 22 insertions(+), 33 deletions(-)
diff --git a/HDL_ON/DriverLayer/Control_Bus.cs b/HDL_ON/DriverLayer/Control_Bus.cs
index 7ba3779..a0d8538 100644
--- a/HDL_ON/DriverLayer/Control_Bus.cs
+++ b/HDL_ON/DriverLayer/Control_Bus.cs
@@ -16,25 +16,6 @@
private static List<Control> controlList = new List<Control>(50);
/// <summary>
- /// 鍙戦�佹暟鎹紝绛夊緟鏈夊弽棣�
- /// </summary>
- /// <returns>The bytes send has return.</returns>
- static byte[] ControlBytesSendHasReturn(Command command, byte subnetID, byte deviceID, byte[] gatewayBytes, int sendCount = 3)
- {
- Control control = new Control();
- control.Send(new Target()
- {
- IPEndPoint = CommonPage.EndPoint,
- Command = command,
- SubnetID = subnetID,
- DeviceID = deviceID,
- AddData = gatewayBytes,
- }, sendCount, true);
-
- return control.UsefulBytes;
- }
-
- /// <summary>
/// 鍙戦�佹暟鎹紝涓嶉渶瑕佺瓑寰呭洖澶�
/// </summary>
static void ControlBytesSend(Command command, byte subnetID, byte deviceID, byte[] gatewayBytes, int sendCount = 3, System.Net.IPEndPoint ipEndpoint = null)
@@ -74,7 +55,11 @@
case Command.SetLogicLoopColorACK:
receiveFlag += string.Format("{0},{1},{2}", usefulBytes[0], usefulBytes[1], usefulBytes[2]);
break;
-
+ case Command.ReadLogicLoopColorACK:
+ case Command.ReadACModeACK:
+ case Command.SetACModeACK:
+ receiveFlag += string.Format("{0}", usefulBytes[0]);
+ break;
//case Command.YIPanelDeviceInofACK:
// for (int i = 0; i < 4; i++)
// {
@@ -132,8 +117,6 @@
// break;
//case Command.SetCommonACK:
//case Command.InfraredChannelControlACK:
- //case Command.ReadACModeACK:
- //case Command.SetACModeACK:
//case Command.Serverx_FH_CMD_ACK:
//case Command.ReadSensorHistoryACK:
//case Command.SetSensorAutomationTargetLevelEnableACK:
@@ -254,7 +237,6 @@
//case Command.AssignedAddressACK:
//case Command.UpdataCurtainModelRunTimeACK:
//case Command.ReadCurtainStutasACK:
- //case Command.ReadLogicLoopColorACK:
//case Command.ReadPanleTempACK:
//case Command.FreshAirReadACK:
//case Command.FreshAirControlACK:
@@ -460,6 +442,9 @@
switch (target.Command)
{
case Command.SetSingleLight:
+ case Command.ReadLogicLoopColor:
+ case Command.ReadACMode:
+ case Command.SetACMode:
this.sendFlag += string.Format("{0}", target.AddData[0]);
break;
case Command.SetLogicLoopColor:
@@ -496,8 +481,6 @@
// break;
//case Command.SetCommonSwitch:
//case Command.InfraredChannelControl:
- //case Command.ReadACMode:
- //case Command.SetACMode:
//case Command.ReadFoolHeat:
//case Command.SetFoolHeat:
//case Command.Serverx_FH_CMD:
@@ -620,7 +603,6 @@
//case Command.AssignedAddress:
//case Command.UpdataCurtainModelRunTime:
//case Command.ReadCurtainStatus:
- //case Command.ReadLogicLoopColor:
//case Command.ReadPanleTemp:
//case Command.FreshAirRead:
//case Command.FreshAirControl:
@@ -665,14 +647,21 @@
/// <param name="sendCount">閲嶅彂娆℃暟</param>
public void Send(Target target, int sendCount, bool isWait)
{
- Packet = new Packet(target.SendBytes, target.IPEndPoint);
- Packet.HaveSendCount = 3 - sendCount;
-
- ini(target);
-
- if (isWait)
+ try
{
- this.wait();
+ Packet = new Packet(target.SendBytes, target.IPEndPoint);
+ Packet.HaveSendCount = 3 - sendCount;
+
+ ini(target);
+
+ if (isWait)
+ {
+ this.wait();
+ }
+ }
+ catch(Exception ex)
+ {
+ MainPage.Log($"Send bus data error {ex.Message}");
}
}
--
Gitblit v1.8.0