From d76b0e40e5bb127fd33aa1f7842447a1df0628d5 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期日, 30 七月 2023 22:16:34 +0800
Subject: [PATCH] Update PublicAssmeblyBLL.cs
---
HDL_ON/DAL/DriverLayer/Control.cs | 32 +++++++++++++++++++++++++++++---
1 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/HDL_ON/DAL/DriverLayer/Control.cs b/HDL_ON/DAL/DriverLayer/Control.cs
index 7e94fb4..1658bfd 100644
--- a/HDL_ON/DAL/DriverLayer/Control.cs
+++ b/HDL_ON/DAL/DriverLayer/Control.cs
@@ -1,6 +1,7 @@
锘縰sing System;
using System.Collections.Generic;
using System.Text;
+using HDL_ON.DAL.Mqtt;
using HDL_ON.DAL.Server;
using HDL_ON.Entity;
using HDL_ON.UI;
@@ -124,6 +125,10 @@
HomePage.LoadEvent_CheckLinkStatus();
}
}
+ else
+ {
+ MainPage.Log($"鐘舵�佷竴鑷达紝涓嶆洿鏂版暟鎹�(鏈湴)");
+ }
}
}
bool _GatewayOnline_Cloud = false;
@@ -169,7 +174,16 @@
MainPage.Log($"缃戝叧浜戠鍦ㄧ嚎锛屽埛鏂拌澶囩姸鎬�");
new System.Threading.Thread(() =>
{
- System.Threading.Thread.Sleep(1000);
+ int count = 20;
+ while (true)
+ {
+ System.Threading.Thread.Sleep(500);
+ if (MqttClient.isSubscribeSuccess || count<1)
+ {
+ break;
+ }
+ count--;
+ }
FunctionList.List.ReadAllFunctionStatus();
})
{ IsBackground = true, Priority = System.Threading.ThreadPriority.AboveNormal }.Start();
@@ -179,6 +193,10 @@
//淇敼涓婚〉杩炴帴鐘舵��
HomePage.LoadEvent_CheckLinkStatus();
}
+ }
+ else
+ {
+ MainPage.Log($"鐘舵�佷竴鑷达紝涓嶆洿鏂版暟鎹�(浜戠)");
}
}catch(Exception ex)
{
@@ -257,7 +275,8 @@
public void SearchLoaclGateway()
{
//2021-01-15 : 浣忓畢娌℃湁缁戝畾缃戝叧鐨勬椂鍊欎笉鐢ㄦ悳绱紝骞朵笖涓嶈兘閾炬帴mqtt
- if (DB_ResidenceData.Instance.HomeGateway == null || string.IsNullOrEmpty(DB_ResidenceData.Instance.HomeGateway.gatewayId))
+ if (DB_ResidenceData.Instance.HomeGateway == null || string.IsNullOrEmpty(DB_ResidenceData.Instance.HomeGateway.gatewayId) ||
+ !UserInfo.Current.IsLogin)
{
return;
}
@@ -276,6 +295,7 @@
}
else if (MainPage.InternetStatus == 2)
{
+ DAL.Mqtt.MqttClient.InitState();
OpenUdp(DB_ResidenceData.Instance.GatewayType == 0 ? 6000 : 8585);
//閲嶇疆鎼滅储缃戝叧鏍囧織
IsSearchLocalGatewaySuccessful = false;
@@ -302,7 +322,6 @@
System.Threading.Thread.Sleep(500);
}
- DAL.Mqtt.MqttClient.InitState();
})
{ IsBackground = true }.Start();
}
@@ -316,6 +335,7 @@
/// </summary>
public void LoginGateway()
{
+ return;//tcp鎺у埗瀛樺湪闂锛屼絾鏄厛涓嶇敤tcp鎺у埗浜嗭紝瑕佺粡杩囨祴璇曞厛 2023-07-29 10:14:32
if (loginGatewayThread == null)
{
loginGatewayThread = new System.Threading.Thread(() =>
@@ -515,6 +535,7 @@
var sendBytes = Ins.ConvertSendBodyData(CommunicationTopic.ct.ControlFunctionTopic, functionControlDataJson);
new Control_Udp().SendLocalHdlLinkData(sendBytes, functionControlDataObj.id, resend);
MainPage.Log($"鏈湴閫氳 鍙戦�丠DL-Link鏁版嵁:{functionControlDataJson}");
+ Ins.myTcpClient.SendMessage(sendBytes);
}
}
//杩滅▼閫氳
@@ -939,6 +960,10 @@
/// <returns></returns>
public void ConvertReceiveData(byte[] receiveBytes, string ip)
{
+ if (!UserInfo.Current.IsLogin)
+ {
+ return;
+ }
var reString = Encoding.UTF8.GetString(receiveBytes);
AnalysisReceiveData(reString, receiveBytes, ip);
}
@@ -950,6 +975,7 @@
/// <returns></returns>
public LocalCommunicationData AnalysisReceiveData(string receiveString, byte[] originalReceiveBytes, string sIp = null)
{
+
LocalCommunicationData receiveObj = new LocalCommunicationData();
--
Gitblit v1.8.0