| | |
| | | /// </summary> |
| | | private bool finish = false; |
| | | |
| | | private string SeverAddr = "https://test-gz.hdlcontrol.com";//"https://bahrain-gateway.hdlcontrol.com" |
| | | private string SeverAddr = "https://bahrain-gateway.hdlcontrol.com"; |
| | | //private string SeverAddr = "https://test-gz.hdlcontrol.com"; |
| | | |
| | | FrameLayout contentView; |
| | | |
| | |
| | | string newUserId; |
| | | |
| | | Button btnSave; |
| | | |
| | | |
| | | public MigrationServer () |
| | | { |
| | |
| | | Text = "请输入密码,确认迁移", |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = SkinStyle.Current.TextColor, |
| | | IsMoreLines = true, |
| | | }; |
| | | contentView.AddChidren (btnTipTitle); |
| | | |
| | |
| | | } |
| | | |
| | | #if DEBUG |
| | | |
| | | //WriteSecretKey (1, 0, new byte [] {1,1,2,3,2,3,4,5,2,3,5,6 }); |
| | | //CheckGateway (); |
| | | |
| | |
| | | System.Threading.Thread.Sleep (100); |
| | | } else { |
| | | Application.RunOnMainThread (() => { |
| | | btnTipMsg.Text = "初始化网关成功,正在迁移账号信息。"; |
| | | btnTipMsg.Text = "初始化网关成功,正在打开网关远程配置。"; |
| | | btnTipMsg.TextColor = SkinStyle.Current.TextColor; |
| | | }); |
| | | break; |
| | | } |
| | | } |
| | | //开启网关远程 |
| | | var setRemoteResult = SetGatewayRemote (common.SubnetID, common.DeviceID); |
| | | if (setRemoteResult) { |
| | | Application.RunOnMainThread (() => { |
| | | btnTipMsg.Text = "网关远程已开启,正在迁移账号信息。"; |
| | | btnTipMsg.TextColor = SkinStyle.Current.TextColor; |
| | | }); |
| | | } else { |
| | | Application.RunOnMainThread (() => { |
| | | btnTipMsg.Text = "网关远程开启失败。"; |
| | | btnTipMsg.TextColor = SkinStyle.Current.DelColor; |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | //迁移账号 |
| | | var moveAccontResult = Account2New (pwd); |
| | | if (moveAccontResult) { |
| | |
| | | Control.ControlBytesSend (Command.InitializationGateway, subnetId, deviceId, sendByets); |
| | | |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 设备网关开启远程 |
| | | /// </summary> |
| | | private bool SetGatewayRemote(byte subnetId, byte deviceId) |
| | | { |
| | | var sendByte = new byte [67]; |
| | | sendByte [0] = 4; |
| | | var result = Control.ControlBytesSendHasReturn (Command.SetGateWayModelInfo, subnetId, deviceId, sendByte); |
| | | if (result == null) { |
| | | |
| | | } else { |
| | | if(result.Length>0 && result[0] == 248) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 写入homeId |
| | | /// </summary> |