| | |
| | | }; |
| | | |
| | | #region 数据更新推送主题 |
| | | //appHomeRefresh:住宅数据刷新通知 |
| | | //appHomeRefresh:住宅数据刷新通知--杨涛 |
| | | var appHomeRefresh = new MqttTopicFilter() |
| | | { |
| | | Topic = $"/user/{DB_ResidenceData.Instance.CurrentRegion.id}/app/thing/event/appHomeRefresh/up", |
| | | QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce |
| | | }; |
| | | //住宅消息变更推送--豆豆 |
| | | var residenceChange = new MqttTopicFilter() |
| | | { |
| | | Topic = $"/user/{DB_ResidenceData.Instance.CurrentRegion.id}/app/thing/event/appDeviceRefresh/up", |
| | | QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce |
| | | }; |
| | | //appRoomRefresh:房间数据刷新通知 |
| | |
| | | //appDeviceRefresh:设备数据刷新通知 |
| | | var appDeviceRefresh = new MqttTopicFilter() |
| | | { |
| | | Topic = $"/user/{DB_ResidenceData.Instance.CurrentRegion.id}/app/thing/event/appDeviceRefresh/up", |
| | | Topic = $"/user/{MqttInfoConfig.Current.HomeGatewayInfo.gatewayId}/app/thing/event/appHomeRefresh/up", |
| | | QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce |
| | | }; |
| | | //一端口密钥更新通知 |
| | |
| | | Utlis.WriteLine("开始订阅!"); |
| | | var result = await RemoteMqttClient.SubscribeAsync(new MqttTopicFilter[] { |
| | | pirStatus,pirStudy, |
| | | appDeviceRefresh,appHomeRefresh,appRoomRefresh, |
| | | appDeviceRefresh,appHomeRefresh,appRoomRefresh,residenceChange, |
| | | topicFilterPush2, topicAlinkStatus ,mqttkeyChange}); |
| | | if (result.Items[0].ResultCode == MQTTnet.Client.Subscribing.MqttClientSubscribeResultCode.GrantedQoS0) |
| | | { |
| | |
| | | } |
| | | |
| | | //一些特殊的主题处理(为了执行速度,尽可能的别加耗时的操作 true:执行了特殊处理 false:没有执行特殊处理) |
| | | if (Stan.HdlCloudReceiveLogic.Current.CloudOverallMsgReceiveEx(topic, e.ApplicationMessage.Payload, mqttEncryptKey, tuyaEncryptKey) == true) |
| | | { |
| | | return; |
| | | } |
| | | Stan.HdlCloudReceiveLogic.Current.CloudOverallMsgReceiveEx(topic, e.ApplicationMessage.Payload, mqttEncryptKey, tuyaEncryptKey); |
| | | |
| | | if (topic == $"/BusGateWayToClient/{UserInfo.Current.ID}" + PushNotifySqueeze) |
| | | { |
| | |
| | | } |
| | | #region 数据更新推送主题 |
| | | //appHomeRefresh:住宅数据刷新通知 |
| | | else if (topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.id}/app/thing/event/appHomeRefresh/up") |
| | | else if (topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.id}/app/thing/event/appHomeRefresh/up" |
| | | || topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.id}/app/thing/event/appDeviceRefresh/up") |
| | | { |
| | | MainPage.Log("住宅数据刷新通知"); |
| | | new HttpServerRequest().GetHomePager(); |
| | |
| | | #endregion |
| | | |
| | | //(4)===========开始连接过程========== |
| | | |
| | | ////一端口每次都要刷新密钥 |
| | | //if (DB_ResidenceData.Instance.HomeGateway != null && DB_ResidenceData.Instance.HomeGateway.gatewayType == "BUSUDPGATEWAY") { |
| | | // var pm = new HttpServerRequest(); |
| | | // var result = pm.GetHomeGatewayList(); |
| | | // if(result == StateCode.SUCCESS) |
| | | // { |
| | | // MainPage.Log($"刷新一端口密钥"); |
| | | // MainPage.Log($"旧密钥:{mqttEncryptKey}"); |
| | | // mqttEncryptKey = MqttInfoConfig.Current.HomeGatewayInfo.aesKey; |
| | | // MainPage.Log($"新密钥:{mqttEncryptKey}"); |
| | | // }else |
| | | // { |
| | | // return; |
| | | // } |
| | | //} |
| | | |
| | | |
| | | |
| | | //之前已经获取参数成功过 |
| | | if (MqttInfoConfig.Current.IfGetMqttInfoSuccess) |
| | | { |