From a40db3104e6d5d8a5d146ad808e5bb1ad6c8cb07 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期五, 20 十一月 2020 17:53:22 +0800
Subject: [PATCH] 20201120

---
 HDL_ON/DAL/DriverLayer/UdpSocket.cs |   36 ++++--------------------------------
 1 files changed, 4 insertions(+), 32 deletions(-)

diff --git a/HDL_ON/DriverLayer/UdpSocket.cs b/HDL_ON/DAL/DriverLayer/UdpSocket.cs
similarity index 80%
rename from HDL_ON/DriverLayer/UdpSocket.cs
rename to HDL_ON/DAL/DriverLayer/UdpSocket.cs
index ac83f9b..2e6343a 100644
--- a/HDL_ON/DriverLayer/UdpSocket.cs
+++ b/HDL_ON/DAL/DriverLayer/UdpSocket.cs
@@ -20,21 +20,6 @@
             }
         }
 
-		/// <summary>
-		/// 鐩戝惉绔彛
-		/// </summary>
-		public int port
-		{
-            get
-            {
-				if (MainPage.LoginUser != null && Entity.DB_ResidenceData.residenceData != null)
-				{
-					return Entity.DB_ResidenceData.residenceData.GatewayType == 0 ? 6000 : 8585;
-				}
-				return 6000;
-            }
-		}
-
 		//鏈湴Socket
 		private Socket busSocket;
 
@@ -43,15 +28,14 @@
 		/// </summary>
 		public void Start ()
         {
-            if (IsRunning || port == 0) {
+            if (IsRunning) {
                 return;
             }
 
             busSocket = new Socket (AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
             busSocket.EnableBroadcast = true;
             try {
-                busSocket.Bind (new IPEndPoint (IPAddress.Any, port));
-
+                busSocket.Bind (new IPEndPoint (IPAddress.Any, 6000));
 				busSocket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(IPAddress.Parse("239.0.168.188")));
 			}
 			catch{
@@ -61,7 +45,7 @@
 
             asyncBeginReceive();
 
-            MainPage.Log ($"udp port : {port}");
+            MainPage.Log ($"udp port : 6000");
         }
 
 		/// <summary>
@@ -142,19 +126,7 @@
 				//mqtt杩炴帴鏁版嵁璇诲彇  A鍗忚缃戠粶璁惧淇℃伅璇诲彇鍥炲 澶勭悊
 				if (((IPEndPoint)packet.RemoteEndPoint).Port == 8585)
 				{
-					var reString = System.Text.Encoding.UTF8.GetString(bytes);
-					var jt = Newtonsoft.Json.JsonConvert.DeserializeObject<JObject>(reString);
-					JToken jtc = null;
-					jt.TryGetValue("command", out jtc);
-					if (jtc != null && jtc.ToString() == "search_response")
-					{
-						JToken jto = null;
-						jt.TryGetValue("objects", out jto);
-						if (jto != null)
-						{
-							SearchNetDeviceAction?.Invoke(jto.ToString());
-						}
-					}
+					Common.A_Protocal_Common.apc.ConvertReceiveData(bytes);
 				}
 				else if(((IPEndPoint)packet.RemoteEndPoint).Port == 6000)//澶勭悊bus 6000绔彛鐨勬暟鎹�
 				{

--
Gitblit v1.8.0