| | |
| | | Topic = $"/user/{DB_ResidenceData.Instance.CurrentRegion.RegionID}/app/thing/property/send", |
| | | QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce |
| | | }; |
| | | //App订阅红外宝 / 网关遥控器添加成功通知 |
| | | var pirStatus = new MqttTopicFilter() |
| | | { |
| | | Topic = $"/user/{DB_ResidenceData.Instance.CurrentRegion.RegionID}/app/thing/topo/found", |
| | | QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce |
| | | }; |
| | | |
| | | Utlis.WriteLine("开始订阅!"); |
| | | var result = await RemoteMqttClient.SubscribeAsync(new MqttTopicFilter[] { topicFilterPush2, topicAlinkStatus }); |
| | | var result = await RemoteMqttClient.SubscribeAsync(new MqttTopicFilter[] { |
| | | pirStatus, |
| | | topicFilterPush2, topicAlinkStatus }); |
| | | if (result.Items[0].ResultCode == MQTTnet.Client.Subscribing.MqttClientSubscribeResultCode.GrantedQoS0) |
| | | { |
| | | isSubscribeSuccess = true; |
| | |
| | | //新挤下线主题方案 收到挤下线主题 |
| | | ReceiveNotifySqueezeAsync(mMes); |
| | | } |
| | | //App订阅红外宝/网关遥控器添加成功通知 |
| | | else if (topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.RegionID}/app/thing/topo/found") |
| | | { |
| | | var bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, tuyaEncryptKey); |
| | | var revString = Encoding.UTF8.GetString(bytes); |
| | | HDL_ON.UI.UI2.PersonalCenter.PirDevice.Method.addcontronsid = revString; |
| | | //ReceiveCheckGateway(ss); |
| | | //return; |
| | | } |
| | | //A网关设备状态-包含涂鸦设备 |
| | | else if (topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.RegionID}/app/thing/property/send") |
| | | { |
| | | var bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, tuyaEncryptKey); |
| | | var revString = Encoding.UTF8.GetString(bytes); |
| | | Control.Ins.UpdataFunctionStatus(revString, null); |
| | | Control.Ins.UpdataFunctionStatus(revString, null,true); |
| | | } |
| | | //一端口数据解析 |
| | | else |
| | |
| | | RemoteMqttClient.UseConnectedHandler(async (e) => |
| | | { |
| | | IfNeedReadAllDeviceStatus = true; |
| | | Control.Ins.GatewayOnline_Cloud = true; |
| | | Utlis.WriteLine($"============>Mqtt远程连接成功"); |
| | | SendPushSignOut(); |
| | | }); |
| | |
| | | static void ReceiveNotifySqueezeAsync(string mMes) |
| | | { |
| | | if (mMes == PushSignStr ) return;//是自己的登录推送不处理//或者当前不是远程链接状态 |
| | | //测试账号,不挤下线 |
| | | switch (UserInfo.Current.AccountString) |
| | | { |
| | | case "13415629083": |
| | | case "18316120654": |
| | | case "15622703419": |
| | | case "18824864143": |
| | | case "464027401@qq.com": |
| | | case "2791308028@qq.com": |
| | | case "13697499568": |
| | | case "18666455392": |
| | | case "13375012446": |
| | | case "13602944661": |
| | | case "18778381374": |
| | | case "18316672920": |
| | | return; |
| | | } |
| | | |
| | | if (!UserInfo.Current.IsLogin) |
| | | { |