Explorar el Código

uiuiuuiu

master
fyf hace 2 años
padre
commit
004ba834a9
Se han modificado 1 ficheros con 34 adiciones y 1 borrados
  1. +34
    -1
      DataVAPI/UpAndDown/ProcessServer.cs

+ 34
- 1
DataVAPI/UpAndDown/ProcessServer.cs Ver fichero

@@ -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)


Cargando…
Cancelar
Guardar