old mode 100755
new mode 100644
| | |
| | | /// <summary> |
| | | /// 外网的MQTT是否正在连接 |
| | | /// </summary> |
| | | public static bool remoteMqttIsConnecting; |
| | | public static bool RemoteMqttIsConnecting; |
| | | static bool remoteIsConnected; |
| | | |
| | | static MqttClient() |
| | |
| | | { |
| | | System.Threading.Thread.Sleep(500); |
| | | if (!Control.Ins.IsRemote) continue; |
| | | //进入后台不处理 |
| | | if (MainPage.IsEnterBackground) continue; |
| | | |
| | | await StartCloudMqtt(); |
| | | await SubscribeTopics(); |
| | |
| | | } |
| | | |
| | | //追加:没有远程连接的权限 |
| | | if (remoteMqttIsConnecting || remoteIsConnected) |
| | | if (RemoteMqttIsConnecting || remoteIsConnected) |
| | | { |
| | | return; |
| | | } |
| | |
| | | try |
| | | { |
| | | #region 初始化远程Mqtt |
| | | remoteMqttIsConnecting = true; |
| | | RemoteMqttIsConnecting = true; |
| | | RemoteMqttClient = new MqttFactory().CreateMqttClient(); |
| | | |
| | | |
| | |
| | | finally |
| | | { |
| | | //最终要释放连接状态 |
| | | remoteMqttIsConnecting = false; |
| | | RemoteMqttIsConnecting = false; |
| | | |
| | | Utlis.WriteLine($"StartCloudMqtt: 结束"); |
| | | } |