Browse Source

uiuiuuiu

master
fyf 2 years ago
parent
commit
004ba834a9
1 changed files with 34 additions and 1 deletions
  1. +34
    -1
      DataVAPI/UpAndDown/ProcessServer.cs

+ 34
- 1
DataVAPI/UpAndDown/ProcessServer.cs View File

@@ -60,7 +60,6 @@ namespace DataVAPI.UpAndDown
//MQTT 数据接收处理
ConsoleHelper.WriteInfoLine("尝试连接阿里云.");
if (IOTDevServer.GetInstance().CreateLinks(DataBus.ProductKey, DataBus.DeviceName, DataBus.DeviceSecret))
//if (IOTDevServer.GetInstance().CreateLinks("grgpECHSL7q", "Transit", "562dcc779b918a54c2d6589ec30ee230"))
{
ConsoleHelper.WriteSuccessLine($"阿里云【Transit】连接成功");
}
@@ -91,6 +90,40 @@ namespace DataVAPI.UpAndDown
/// </summary>
private void QueueTask()
{
Executer.GetInstance().Start(new Action(() =>
{
while (true)
{
try
{
if (!IOTDevServer.GetInstance().GetIsConnected())
{

if (IOTDevServer.GetInstance().CreateLinks(DataBus.ProductKey, DataBus.DeviceName, DataBus.DeviceSecret))
{
ConsoleHelper.WriteSuccessLine($"阿里云【Transit】连接成功");
//订阅上下线
Subscribe(IOTDevServer.HeartbeatSubTopic);

//订阅主播消息
Subscribe(IOTDevServer.BroadcastTopic);
}
else
{
ConsoleHelper.WriteSuccessLine($"阿里云【Transit】连接失败");
}
Thread.Sleep(10000);
}

}
catch (Exception ex)
{
ConsoleHelper.WriteErrorLine(ex.Message);
}
}

}), "阿里云重新连接");

Executer.GetInstance().Start(new Action(() =>
{
while (true)


Loading…
Cancel
Save