| | |
| | | #region ■ 全局接收___________________________ |
| | | |
| | | /// <summary> |
| | | /// 全局接收云端推送的的逻辑(为了执行速度,尽可能的别加耗时的操作) |
| | | /// 特殊全局接收云端推送的的逻辑(为了执行速度,尽可能的别加耗时的操作 true:执行了特殊处理 false:没有执行特殊处理) |
| | | /// </summary> |
| | | /// <param name="topic">整个主题</param> |
| | | /// <param name="byteData">接收的数据</param> |
| | | /// <param name="mqttEncryptKey">Mqtt的解密密钥</param> |
| | | /// <param name="homeIdEncryptKey">住宅倒序的解密密钥</param> |
| | | public bool CloudOverallMsgReceiveEx(string topic, byte[] byteData, string mqttEncryptKey, string homeIdEncryptKey) |
| | | { |
| | | //设备入网上报主题 |
| | | if (topic == $"/user/{Entity.DB_ResidenceData.Instance.CurrentRegion.RegionID}/app/thing/topo/found") |
| | | { |
| | | if (string.IsNullOrEmpty(homeIdEncryptKey) == false) |
| | | { |
| | | //解密 |
| | | byteData = Securitys.EncryptionService.AesDecryptPayload(byteData, homeIdEncryptKey); |
| | | } |
| | | string msgData = Encoding.UTF8.GetString(byteData); |
| | | //这里特殊,别急着转字符串,先判断主题再转 |
| | | return this.CloudOverallMsgReceiveEx(topic, msgData); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 特殊全局接收云端推送的的逻辑(为了执行速度,尽可能的别加耗时的操作 true:执行了特殊处理 false:没有执行特殊处理) |
| | | /// </summary> |
| | | /// <param name="topic">整个主题</param> |
| | | /// <param name="msgData">接收的数据</param> |
| | | public void CloudOverallMsgReceive(string topic, string msgData) |
| | | public bool CloudOverallMsgReceiveEx(string topic, string msgData) |
| | | { |
| | | //没有任何监听 |
| | | if (ListCloudEvent.Count == 0) { return; } |
| | | if (ListCloudEvent.Count == 0) { return false; } |
| | | |
| | | //设备入网上报主题(目前只有红外宝) |
| | | if (topic == DriverLayer.CommunicationTopic.ct.AddDevicePush) |
| | | if (topic == $"/user/{Entity.DB_ResidenceData.Instance.CurrentRegion.RegionID}/app/thing/topo/found") |
| | | { |
| | | for (int i = 0; i < this.ListCloudEvent.Count; i++) |
| | | { |
| | | //回调事件 |
| | | this.ListCloudEvent[i].CloudReceiveEvent(CloudPushEnum.A新设备上报, msgData); |
| | | } |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | #endregion |