gxc
2020-02-28 66a9965c44ecc32a6696abca876ab9d1cd091584
ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs
@@ -101,7 +101,7 @@
            }
        }
        #region variable
        #region variable
        /// <summary>
        /// 远程连接成功时的时间
        /// </summary>
@@ -224,6 +224,7 @@
        /// <para>第一个参数:如果为 DDevice/IsGetEpointInfo:有新设备加入zigbee网络反馈</para>设备请求APP获取升级数据
        /// <para>第一个参数:如果为 Device/DeviceJoinZbNet:获取新设备所有端点信息是否成功反馈</para>
        /// <para>第一个参数:如果为 DeviceRequestAcUpdateData: 设备请求空调发升级数据</para>
        /// "已经通知");//已经通知");
        /// </summary>
        [Newtonsoft.Json.JsonIgnore]
        public Action<string, object> ReportAction;
@@ -3324,7 +3325,7 @@
        /// 远程MqttClient
        /// </summary>
        public static IMqttClient RemoteMqttClient= new MqttFactory().CreateMqttClient();
        static bool remoteIsConnected;
        static bool remoteIsConnected;
        private int IsLogin = 0;
        [Newtonsoft.Json.JsonIgnore]
        static Action actionTemp;
@@ -3382,6 +3383,18 @@
                            RemoteMqttClient.UseConnectedHandler(async (e) =>
                            {
                                DebugPrintLog($"远程连接成功");
                                if (Config.Instance.Home.IsOthreShare == true)
                                {
                                    //订阅一个成员被删除的主题
                                    string myGuid = Config.Instance.Guid;
                                    await RemoteMqttClient.SubscribeAsync("/ZigbeeGateWayToClient/" + myGuid + "/Push/Deleted");
                                    //订阅一个分享数据已经变更的主题
                                    await RemoteMqttClient.SubscribeAsync("/ZigbeeGateWayToClient/" + myGuid + "/Push/DeletedShareData");
                                }
                                //订阅一个挤下线的主题
                                await RemoteMqttClient.SubscribeAsync("/ZigbeeGateWayToClient/" + Config.Instance.ConnEmqClientId + "/Push/NotifySqueeze");
                                await initGateWayBaseInfomation();
                                Shared.Phone.UserCenter.HdlGatewayLogic.Current.CheckGatewayByConnectChanged(Shared.Phone.UserCenter.GatewayConnectMode.Remote);
                                //没有主网关时主动读取,获取主网关信息
@@ -3472,6 +3485,8 @@
                                var connEmqClientId = responseData["ConnEmqClientId"]?.ToString();
                                var connEmqUserName = responseData["ConnEmqUserName"]?.ToString();
                                var connEmqPwd = responseData["ConnEmqPwd"]?.ToString();
                                //记录起当前的客户端ID
                                Config.Instance.ConnEmqClientId = connEmqClientId;
                                var connEmqDomainPorts = connEmqDomainPort.Replace("//", "").Split(':');
                                var domain = connEmqDomainPorts[1];
@@ -3542,7 +3557,7 @@
                    await RemoteMqttClient.DisconnectAsync();
                }
            }
            catch(Exception e) {
            catch(Exception e) {
                DebugPrintLog($"Remote断开通讯连接出异常:{e.Message}");
            }
        }
@@ -3874,7 +3889,10 @@
                    epoint = topic.Split('/')[3];
                    cluID = topic.Split('/')[4];
                    attrId = topic.Split('/')[5];
                }
                }
                //全局接收网关推送的的逻辑(为了执行速度,尽可能的别加耗时的操作)
                Shared.Phone.UserCenter.HdlGatewayReceiveLogic.Current.GatewayOverallMsgReceive(gatewayID, topic, reportStatus, message);
                var gwa = GateWayList.Find(obj => obj.getGatewayBaseInfo.gwID == gatewayID);
                if (gwa == null)
@@ -3906,9 +3924,6 @@
                {
                    jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
                }
                //全局接收网关推送的的逻辑(为了执行速度,尽可能的别加耗时的操作)
                Shared.Phone.UserCenter.HdlGatewayReceiveLogic.Current.GatewayOverallMsgReceive(gatewayID, topic, reportStatus, jobject);
                #region 远程,主网关上报通知
                if (IsRemote)