wxr
2021-03-16 7584dea0241cefc276a4b5311331aee1dcda6c80
HDL_ON/DAL/Mqtt/MqttClient.cs
@@ -236,6 +236,10 @@
            {
                return;
            }
            if(DB_ResidenceData.Instance.CurrentRegion == null || DB_ResidenceData.Instance.CurrentRegion.RegionID == null)
            {
                return;
            }
            //追加:没有远程连接的权限
            if (RemoteMqttIsConnecting || remoteIsConnected)
@@ -245,7 +249,7 @@
            Utlis.WriteLine($"StartCloudMqtt: 开始");
            await Task.Factory.StartNew(async () => {
            await Task.Factory.StartNew((Func<Task>)(async () => {
                try
                {
                    #region 初始化远程Mqtt
@@ -257,7 +261,7 @@
                    if (RemoteMqttClient.ApplicationMessageReceivedHandler == null)
                    {
                        //处理接收到的数据
                        RemoteMqttClient.UseApplicationMessageReceivedHandler((e) => {
                        RemoteMqttClient.UseApplicationMessageReceivedHandler((Action<MqttApplicationMessageReceivedEventArgs>)((e) => {
                            try
                            {
                                var topic = e.ApplicationMessage.Topic;
@@ -287,6 +291,12 @@
                                    }
                                }
                                //一些特殊的主题处理(为了执行速度,尽可能的别加耗时的操作 true:执行了特殊处理 false:没有执行特殊处理)
                                if (Stan.HdlCloudReceiveLogic.Current.CloudOverallMsgReceiveEx(topic, e.ApplicationMessage.Payload, mqttEncryptKey, tuyaEncryptKey) == true)
                                {
                                    return;
                                }
                                if (topic == $"/BusGateWayToClient/{UserInfo.Current.ID}" + PushNotifySqueeze)
                                {
                                    var mMes = Encoding.UTF8.GetString(e.ApplicationMessage.Payload);
@@ -298,7 +308,7 @@
                                {
                                    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.mqttdata = revString;
                                    //ReceiveCheckGateway(ss);
                                    //return;
                                }
@@ -307,7 +317,7 @@
                                {
                                    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.mqttdata = revString;
                                    //ReceiveCheckGateway(ss);
                                    //return;
                                }
@@ -322,7 +332,7 @@
                                else
                                {
                                    //SetGatewayOnlineResetCheck();
                                    var bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, mqttEncryptKey);
                                    //var bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, mqttEncryptKey);
                                    //bus数据解析
                                    var packet = new Packet();
@@ -338,7 +348,7 @@
                                }
                            }
                            catch { }
                        });
                        }));
                    }
                    //(2)DisconnectedHandler
@@ -389,7 +399,7 @@
                    Utlis.WriteLine($"StartCloudMqtt: 结束");
                }
            });
            }));
        }