From 014abc547ffd1a9f23c58fd7a471dffc5933fdd3 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期四, 17 十二月 2020 14:27:56 +0800
Subject: [PATCH] Merge branch 'master' into NewFilePath
---
HDL_ON/DAL/DriverLayer/Control.cs | 45 ++++++++++++++++-----------------------------
1 files changed, 16 insertions(+), 29 deletions(-)
diff --git a/HDL_ON/DAL/DriverLayer/Control.cs b/HDL_ON/DAL/DriverLayer/Control.cs
index e8215ad..dcd5410 100644
--- a/HDL_ON/DAL/DriverLayer/Control.cs
+++ b/HDL_ON/DAL/DriverLayer/Control.cs
@@ -123,7 +123,7 @@
/// <summary>
/// 鏈湴udp
/// </summary>
- public Control_Udp myUdp = null;
+ public Control_Udp myUdp1 = null;
/// <summary>
/// 閫氳鏂瑰紡
@@ -144,11 +144,6 @@
/// </summary>
public void OpenUdp(int port)
{
- if (myUdp == null)
- {
- myUdp = new Control_Udp();
- }
-
UdpSocket._BusSocket.Start(port);
}
/// <summary>
@@ -156,10 +151,6 @@
/// </summary>
public void CloseUdp()
{
- if (myUdp != null)
- {
- myUdp = null;
- }
UdpSocket._BusSocket.Stop();
}
@@ -197,11 +188,11 @@
break;
if (DB_ResidenceData.Instance.GatewayType == 0)
{
- myUdp.ControlBytesSend(Command.ReadGateway, 255, 255, new byte[] { (byte)new Random().Next(255), (byte)new Random().Next(255) });
+ new Control_Udp().ControlBytesSend(Command.ReadGateway, 255, 255, new byte[] { (byte)new Random().Next(255), (byte)new Random().Next(255) });
}
else if (DB_ResidenceData.Instance.GatewayType == 1)
{
- myUdp.SearchLocalGateway();
+ new Control_Udp().SearchLocalGateway();
}
System.Threading.Thread.Sleep(500);
}
@@ -227,7 +218,7 @@
{
if (DB_ResidenceData.Instance.GatewayType == 0)
{
- myUdp.ControlBusScenes(scene);
+ new Control_Udp().ControlBusScenes(scene);
}
}
}
@@ -264,10 +255,7 @@
{
try
{
- if (myUdp != null)
- {
- myUdp.WriteBusData(function, commandDictionary);
- }
+ new Control_Udp().WriteBusData(function, commandDictionary);
}
catch (Exception ex)
{
@@ -277,13 +265,10 @@
//ALink鎺у埗
else
{
- if (myUdp != null)
- {
- var functionControlDataObj = function.GetGatewayAlinkControlData(commandDictionary);
- var functionControlDataJson = Newtonsoft.Json.JsonConvert.SerializeObject(functionControlDataObj);
- var sendBytes = Ins.ConvertSendBodyData(CommunicationTopic.ct.ControlFunctionTopic, functionControlDataJson);
- Ins.myUdp.SendLocalHdlLinkData(sendBytes);
- }
+ var functionControlDataObj = function.GetGatewayAlinkControlData(commandDictionary);
+ var functionControlDataJson = Newtonsoft.Json.JsonConvert.SerializeObject(functionControlDataObj);
+ var sendBytes = Ins.ConvertSendBodyData(CommunicationTopic.ct.ControlFunctionTopic, functionControlDataJson);
+ new Control_Udp().SendLocalHdlLinkData(sendBytes, functionControlDataObj.id);
}
}
}
@@ -312,7 +297,7 @@
{
try
{
- Ins.myUdp.ReadBusData(function);
+ new Control_Udp().ReadBusData(function);
}
catch (Exception ex)
{
@@ -335,7 +320,7 @@
};
var functionControlDataJson = Newtonsoft.Json.JsonConvert.SerializeObject(readDataObj);
var sendBytes = Ins.ConvertSendBodyData(CommunicationTopic.ct.ReadStatus, functionControlDataJson);
- Ins.myUdp.SendLocalHdlLinkData(sendBytes);
+ new Control_Udp().SendLocalHdlLinkData(sendBytes,readDataObj.id);
}
}
}
@@ -381,7 +366,7 @@
};
var aLinkJson = Newtonsoft.Json.JsonConvert.SerializeObject(aLinkData);
var sendBytes = Ins.ConvertSendBodyData(CommunicationTopic.ct.ControlScene, aLinkJson);
- Ins.myUdp.SendLocalHdlLinkData(sendBytes);
+ new Control_Udp().SendLocalHdlLinkData(sendBytes,aLinkData.id);
}
}
/// <summary>
@@ -469,7 +454,8 @@
else if(receiveObj.Topic == CommunicationTopic.ct.ReadStatus+"_reply" ||
receiveObj.Topic == CommunicationTopic.ct.GatewayUpStatus)
{
- UpdataFunctionStatus(receiveObj.BodyDataString);
+ //TODO 鏆傛椂涓嶄紶姝g‘鐨勬暟鎹笂鍘伙紝濡傛灉鍚庨潰瑕佷紭鍖栧墠闈㈣繖浜涗唬鐮�
+ UpdataFunctionStatus(receiveObj.BodyDataString,null);
}
}
return receiveObj;
@@ -480,7 +466,7 @@
/// A鍗忚鏁版嵁
/// </summary>
/// <param name="updateBytes"></param>
- public void UpdataFunctionStatus(string revString)
+ public void UpdataFunctionStatus(string revString,byte []usefulBytes)
{
MainPage.Log($"A鍗忚鏇存柊鐘舵��:{revString}");
if(Control.Ins.myUdp!= null)
@@ -491,6 +477,7 @@
var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<AlinkFunctionStatusObj>(revString);
if (temp != null)
{
+ Control_Udp.ReceiveRepeatManager(temp.id,usefulBytes);
var allLocalFuntion = FunctionList.List.GetDeviceFunctionList();
foreach (var updateTemp in temp.objects)
{
--
Gitblit v1.8.0