| | |
| | | if (status == 2) { |
| | | //var result = Control.ControlBytesSendHasReturn (Command.ReadGateway, common.SubnetID, common.DeviceID, new byte [] { (byte)new Random ().Next (255), (byte)new Random ().Next (255) }); |
| | | #region |
| | | //开始本地搜索网关... |
| | | MainPage.AddTip ("Searching local gateway..."); |
| | | |
| | | var control = new Control (); |
| | | control.Send (new Target () { |
| | | IPEndPoint = new System.Net.IPEndPoint (System.Net.IPAddress.Parse (new Net.NetWiFi ().BroadcastIpAddress.ToString ()), 6000), |
| | |
| | | UserMiddle.btnLinkStatus.UnSelectedImagePath = MainPage.WiFiStatus; |
| | | MainPage.Loading.Hide (); |
| | | }); |
| | | //搜索成功,启用本地连接 |
| | | MainPage.AddTip ("Gateway searched successfully, enable local connection."); |
| | | |
| | | Shared.SimpleControl.Phone.UserMiddle.ReadAllDeviceStatus (); |
| | | await SmartHome.MqttCommon.DisConnectRemoteMqttClient (); |
| | | return; |
| | | } else { |
| | | |
| | | } |
| | | } else { |
| | | //搜索失败,启用远程连接 |
| | | MainPage.AddTip ("Gateway cannot be searched locally."); |
| | | |
| | | } |
| | | } else { |
| | | break; |
| | |
| | | if (UserConfig.Instance.CheckHomeGateways ()) { |
| | | if (!string.IsNullOrEmpty (UserConfig.Instance.CurrentRegion.HomeGateways [0].GatewayUniqueId)) { |
| | | // 5.1能远程,显示CloudUnlink状态,IsRemote设为true开始远程 |
| | | MainPage.AddTip ("Starting remote connection mode..."); |
| | | MainPage.AddTip ("Please wait, starting remote connection..."); |
| | | |
| | | Utlis.ShowAppLinkStatus (AppLinkStatus.CloudUnlink); |
| | | CommonPage.IsRemote = true; |
| | | SmartHome.MqttCommon.IsGatewayOnline = false; |
| | | //await SmartHome.MqttCommon.StartCloudMqtt (); |
| | | //重置参数状态 |
| | | SmartHome.MqttCommon.InitState (); |
| | | |
| | | } |
| | | } |
| | | } |