| | |
| | | ZbGateway.IsRemote = true;
|
| | | for (int i = 0; i < ZbGateway.GateWayList.Count; i++) |
| | | {
|
| | | ZbGateway.GateWayList[i].DisConnectLocalMqttClient("1"); |
| | | ZbGateway.GateWayList[i].DisConnectLocalMqttClient("1"); |
| | | }
|
| | | }
|
| | | |
| | |
| | | FindGateWaySocket.BeginSend(new System.Net.IPEndPoint(broadcastIpAddress, 7624), broadBytes); |
| | | } |
| | | } |
| | | catch { } |
| | | catch
|
| | | { |
| | | //关闭Socket,下次发送会自动连接
|
| | | FindGateWaySocket.Stop();
|
| | | } |
| | | System.Threading.Thread.Sleep(500); |
| | | } |
| | | }) |
| | |
| | | {
|
| | | gateWayList.Add(zbGateWay); |
| | | } |
| | | //网关中到住宅ID为空此时也通讯 |
| | | else if (homeID == string.Empty) |
| | | {
|
| | | gateWayList.Add(zbGateWay); |
| | | } |
| | | //网关中到住宅ID为空此时也通讯 2020.01.14变更:没这个必要,上面那个变量就能处理 |
| | | //else if (homeID == string.Empty) |
| | | //{
|
| | | // gateWayList.Add(zbGateWay); |
| | | //} |
| | | } |
| | | //网关列表存储处理 |
| | | var gateWay = ZbGateway.GateWayList.Find(obj => obj.getGatewayBaseInfo != null && obj.getGatewayBaseInfo.gwID == zbGateWay.getGatewayBaseInfo.gwID); |
| | |
| | | //标记当前网关是主网关 |
| | | gateWay.getGatewayBaseInfo.IsMainGateWay = true; |
| | | } |
| | | }
|
| | |
|
| | | //测试能否广播得到网关,通常情况下不检测
|
| | | if (Shared.Phone.UserCenter.UserCenterResourse.HideOption.CheckCanReceiveGateway == 1)
|
| | | {
|
| | | if (Shared.Phone.UserCenter.UserCenterResourse.DicReceiveGatewayTest.ContainsKey(id) == false)
|
| | | {
|
| | | if (gateWay == null)
|
| | | {
|
| | | Shared.Phone.UserCenter.UserCenterResourse.DicReceiveGatewayTest[id] = zbGateWay;
|
| | | }
|
| | | else
|
| | | {
|
| | | Shared.Phone.UserCenter.UserCenterResourse.DicReceiveGatewayTest[id] = gateWay;
|
| | | }
|
| | | }
|
| | | } |
| | | } |
| | | } |
| | | catch { } |
| | | catch |
| | | { |
| | | //关闭Socket,下次发送会自动连接 |
| | | FindGateWaySocket.Stop(); |
| | | } |
| | | } |
| | | #endregion |
| | | } |
| | |
| | | try |
| | | { |
| | | //定时检测远程连接情况 |
| | | await ZbGateway.StartRemoteMqtt(); |
| | | await ZbGateway.StartRemoteMqtt();
|
| | | if (!ZbGateway.IsRemote) |
| | | { |
| | | System.Threading.Thread.Sleep(500); |
| | | continue; |
| | | } |
| | | var gateWayList =ZbGateway.GateWayList.FindAll(obj => obj.getGatewayBaseInfo.HomeId == Shared.Common.Config.Instance.HomeId); |
| | | var gateWayList = ZbGateway.GateWayList.FindAll(obj => obj.getGatewayBaseInfo.HomeId == Shared.Common.Config.Instance.HomeId); |
| | | |
| | | if (gateWayList.Count == 1) |
| | | { |