From acf6f2bfdd9c4fa2500cc746e1064f375dc633d1 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期一, 13 六月 2022 11:22:43 +0800
Subject: [PATCH] 备份

---
 Crabtree/SmartHome/UI/SimpleControl/Phone/Register/MigrationServer.cs |   43 +++++++++++++++++++++++++++++++++++++++----
 1 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/MigrationServer.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/MigrationServer.cs
index 0fbf265..16dd21d 100644
--- a/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/MigrationServer.cs
+++ b/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/MigrationServer.cs
@@ -13,7 +13,8 @@
         /// </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;
 
@@ -27,6 +28,7 @@
         string newUserId;
 
         Button btnSave;
+
 
         public MigrationServer ()
         {
@@ -76,6 +78,7 @@
                 Text = "璇疯緭鍏ュ瘑鐮侊紝纭杩佺Щ",
                 TextAlignment = TextAlignment.CenterLeft,
                 TextColor = SkinStyle.Current.TextColor,
+                IsMoreLines = true,
             };
             contentView.AddChidren (btnTipTitle);
 
@@ -152,7 +155,6 @@
                 }
 
 #if DEBUG
-
                 //WriteSecretKey (1, 0, new byte [] {1,1,2,3,2,3,4,5,2,3,5,6 });
                 //CheckGateway ();
 
@@ -608,12 +610,27 @@
                                         System.Threading.Thread.Sleep (100);
                                     } else {
                                         Application.RunOnMainThread (() => {
-                                            btnTipMsg.Text = "鍒濆鍖栫綉鍏虫垚鍔�,姝e湪杩佺Щ璐﹀彿淇℃伅銆�";
+                                            btnTipMsg.Text = "鍒濆鍖栫綉鍏虫垚鍔�,姝e湪鎵撳紑缃戝叧杩滅▼閰嶇疆銆�";
                                             btnTipMsg.TextColor = SkinStyle.Current.TextColor;
                                         });
                                         break;
                                     }
                                 }
+                                //寮�鍚綉鍏宠繙绋�
+                                var setRemoteResult = SetGatewayRemote (common.SubnetID, common.DeviceID);
+                                if (setRemoteResult) {
+                                    Application.RunOnMainThread (() => {
+                                        btnTipMsg.Text = "缃戝叧杩滅▼宸插紑鍚�,姝e湪杩佺Щ璐﹀彿淇℃伅銆�";
+                                        btnTipMsg.TextColor = SkinStyle.Current.TextColor;
+                                    });
+                                } else {
+                                    Application.RunOnMainThread (() => {
+                                        btnTipMsg.Text = "缃戝叧杩滅▼寮�鍚け璐ャ��";
+                                        btnTipMsg.TextColor = SkinStyle.Current.DelColor;
+                                    });
+                                    return;
+                                }
+
                                 //杩佺Щ璐﹀彿
                                 var moveAccontResult = Account2New (pwd);
                                 if (moveAccontResult) {
@@ -818,7 +835,25 @@
             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>

--
Gitblit v1.8.0