| | |
| | | |
| | | Utlis.WriteLine($"StartCloudMqtt: 开始"); |
| | | |
| | | await Task.Factory.StartNew(async () => { |
| | | await Task.Factory.StartNew((Func<Task>)(async () => { |
| | | try |
| | | { |
| | | #region 初始化远程Mqtt |
| | |
| | | if (RemoteMqttClient.ApplicationMessageReceivedHandler == null) |
| | | { |
| | | //处理接收到的数据 |
| | | RemoteMqttClient.UseApplicationMessageReceivedHandler((e) => { |
| | | RemoteMqttClient.UseApplicationMessageReceivedHandler((Action<MqttApplicationMessageReceivedEventArgs>)((e) => { |
| | | try |
| | | { |
| | | var topic = e.ApplicationMessage.Topic; |
| | |
| | | { |
| | | var bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, tuyaEncryptKey); |
| | | var revString = Encoding.UTF8.GetString(bytes); |
| | | HDL_ON.UI.UI2.PersonalCenter.PirDevice.Method.addcontrondata = revString; |
| | | HDL_ON.UI.UI2.PersonalCenter.PirDevice.Method.controldata = revString; |
| | | //ReceiveCheckGateway(ss); |
| | | //return; |
| | | } |
| | |
| | | { |
| | | var bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, tuyaEncryptKey); |
| | | var revString = Encoding.UTF8.GetString(bytes); |
| | | HDL_ON.UI.UI2.PersonalCenter.PirDevice.Method.studybtndata = revString; |
| | | HDL_ON.UI.UI2.PersonalCenter.PirDevice.Method.buttondata = revString; |
| | | //ReceiveCheckGateway(ss); |
| | | //return; |
| | | } |
| | |
| | | } |
| | | } |
| | | catch { } |
| | | }); |
| | | })); |
| | | } |
| | | |
| | | //(2)DisconnectedHandler |
| | |
| | | Utlis.WriteLine($"StartCloudMqtt: 结束"); |
| | | } |
| | | |
| | | }); |
| | | })); |
| | | } |
| | | |
| | | |