| | |
| | | myLoading.Hide (); |
| | | btnCloseLoading.RemoveFromParent (); |
| | | WirelessConfig (new byte [] { 1 });//close |
| | | if (CommonPage.newDevice > 0) { |
| | | CommonPage.newDevice = 0; |
| | | SearchDeviceList (); |
| | | } |
| | | }); |
| | | }; |
| | | |
| | |
| | | serverIPBytes = Control.ControlBytesSendHasReturn (Command.ReadGatewayServerIP, gatewayDeicve.SubnetID, gatewayDeicve.DeviceID, new byte [] { }); |
| | | |
| | | gatewayDeicve.Remote_GroupName = MainPage.LoginUser.AccountString;//UserConfig.Instance.CurrentRegion.RegionName; |
| | | gatewayDeicve.Remote_ProjectName = gatewayDeicve.MAC.Replace(".","");//UserConfig.Instance.CurrentRegion.RegionName; |
| | | gatewayDeicve.Remote_ProjectName = gatewayDeicve.MAC.Replace (".", "");//UserConfig.Instance.CurrentRegion.RegionName; |
| | | gatewayDeicve.Remote_UserName = "Admin"; |
| | | gatewayDeicve.Remote_Password = "c" + MainPage.LoginUser.MasterID; |
| | | byte [] ggn = new byte [20]; |
| | |
| | | |
| | | |
| | | byte [] macAddress = Control.ControlBytesSendHasReturn (Command.ReadDeviceMac, gatewayDeicve.SubnetID, gatewayDeicve.DeviceID, new byte [] { }); |
| | | |
| | | |
| | | gatewayBytes [0] = 2;//远程标示 |
| | | Array.Copy (ggn, 0, gatewayBytes, 1, 20 < ggn.Length ? 20 : ggn.Length); |
| | | Array.Copy (gpn, 0, gatewayBytes, 21, 20 < gpn.Length ? 20 : gpn.Length); |
| | |
| | | Application.RunOnMainThread (() => { |
| | | new Alert ("", "Communication abnormality,gateway failed to bind residence.Please try again.", Language.StringByID (R.MyInternationalizationString.Close)).Show (); |
| | | if (MainPage.LoginUser.AccountString == "464027401@qq.com") { |
| | | new Alert ("22:"+respone.StateCode, respone.ErrorInfo, Language.StringByID (R.MyInternationalizationString.Close)).Show (); |
| | | new Alert ("22:" + respone.StateCode, respone.ErrorInfo, Language.StringByID (R.MyInternationalizationString.Close)).Show (); |
| | | } |
| | | }); |
| | | } |
| | |
| | | th = null; |
| | | Application.RunOnMainThread (() => { |
| | | MainPage.Loading.Hide (); |
| | | if (gatewayDeicve.Type == DeviceType.OnePortWirelessFR) { |
| | | if (gatewayDeicve.Type == DeviceType.OnePortWirelessFR && CommonPage.newDevice==0) { |
| | | CommonPage.newDevice = 0; |
| | | Control.ControlBytesSend (Command.GotoConfigMode, gatewayDeicve.SubnetID, gatewayDeicve.DeviceID, new byte [] { }); |
| | | //new Alert ("", "网关已经进入配频模式,请手动新设备进入配频模式。", "Close").Show (); |
| | | new Alert ("", "Searching for new devices, Please make sure all new devices are in configuration mode.", "OK").Show (); |
| | |
| | | //} |
| | | |
| | | if (config) { |
| | | System.Threading.Tasks.Task.Factory.StartNew (() => { |
| | | try { |
| | | byte bigClass = common.BigClass; |
| | | byte minClass = common.MinClass; |
| | | int count = common.LoopCount; |
| | | for (int k = 1, j = 0; k <= count; k++) { |
| | | if (Control.ControlBytesSendHasReturn (Command.ReadDeviceLoopInfo, common.SubnetID, common.DeviceID, new byte [] { bigClass, minClass, (byte)k }) == null) { |
| | | j++; |
| | | //连续两次读取不到数据则跳出该循环 |
| | | if (j == 2 && k == 2) |
| | | break; |
| | | } |
| | | } |
| | | } catch (Exception ex) { |
| | | Console.WriteLine ("Cinfig Read Device Loop Info " + ex.Message); |
| | | } |
| | | }); |
| | | CommonPage.newDevice++; |
| | | //System.Threading.Tasks.Task.Factory.StartNew (() => { |
| | | // try { |
| | | // byte bigClass = common.BigClass; |
| | | // byte minClass = common.MinClass; |
| | | // int count = common.LoopCount; |
| | | // for (int k = 1, j = 0; k <= count; k++) { |
| | | // if (Control.ControlBytesSendHasReturn (Command.ReadDeviceLoopInfo, common.SubnetID, common.DeviceID, new byte [] { bigClass, minClass, (byte)k }) == null) { |
| | | // j++; |
| | | // //连续两次读取不到数据则跳出该循环 |
| | | // if (j == 2 && k == 2) |
| | | // break; |
| | | // } |
| | | // } |
| | | // } catch (Exception ex) { |
| | | // Console.WriteLine ("Cinfig Read Device Loop Info " + ex.Message); |
| | | // } |
| | | //}); |
| | | } |
| | | |
| | | #endregion |