From 60fea1a35f8bfd2eb1399cae05d853b93b3674f9 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期五, 03 一月 2020 13:47:35 +0800
Subject: [PATCH] 2020-01-03 1.增加信mqtt网关设备类型支持。 2.住宅ID改为string类型。

---
 Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideSettingGateway.cs |  726 ++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 557 insertions(+), 169 deletions(-)

diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideSettingGateway.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideSettingGateway.cs
index 27797e3..74791eb 100644
--- a/Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideSettingGateway.cs
+++ b/Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideSettingGateway.cs
@@ -6,6 +6,8 @@
 {
     public class GuideSettingGateway : FrameLayout
     {
+        static byte TYPEStandardMQTT = 5;
+        static byte TYPEHdlMQTT = 4;
         static GuideSettingGateway curView;
         static GatewayBase gatewayDeicve;
         static VerticalScrolViewLayout bodyView;
@@ -13,7 +15,7 @@
         static Loading myLoading;
         bool isReBind = false;
         static List<Common> addedCommon;
-        public GuideSettingGateway(GatewayBase gd)
+        public GuideSettingGateway (GatewayBase gd)
         {
             gatewayDeicve = gd as GatewayBase;
             addedCommon = new List<Common> ();
@@ -21,14 +23,14 @@
             curView = this;
             myLoading = new Loading ();
 
-//#if __IOS__
+            //#if __IOS__
             myLoading.LodingBackgroundColor = 0x00999999;
-//#else
-//            myLoading.LodingBackgroundColor = SkinStyle.Current.ViewColor;
-//#endif
+            //#else
+            //            myLoading.LodingBackgroundColor = SkinStyle.Current.ViewColor;
+            //#endif
             btnCloseLoading = new Button ();
             btnCloseLoading.MouseUpEventHandler += (sender, e) => {
-                Application.RunOnMainThread(()=>{
+                Application.RunOnMainThread (() => {
                     myLoading.Hide ();
                     btnCloseLoading.RemoveFromParent ();
                     WirelessConfig (new byte [] { 1 });//close
@@ -89,7 +91,7 @@
                 Width = Application.GetRealWidth (75),
                 Height = Application.GetRealHeight (75),
                 X = Application.GetRealWidth (520),
-                Y = Application.GetRealHeight(10),
+                Y = Application.GetRealHeight (10),
                 UnSelectedImagePath = "Item/Refresh.png",
             };
             topView.AddChidren (btnSearch);
@@ -98,19 +100,19 @@
                 addedCommon.Clear ();
                 SearchDeviceList ();
             };
-#endregion
+            #endregion
 
-            bodyView = new VerticalScrolViewLayout () { 
+            bodyView = new VerticalScrolViewLayout () {
                 Y = topView.Bottom,
-                Height = Application.GetRealHeight(1136- 126 - 95),
+                Height = Application.GetRealHeight (1136 - 126 - 95),
                 BackgroundColor = SkinStyle.Current.ViewColor,
             };
             AddChidren (bodyView);
 
-            var bottomView = new FrameLayout () { 
+            var bottomView = new FrameLayout () {
                 BackgroundColor = SkinStyle.Current.Black50Transparent,
                 Y = bodyView.Bottom,
-                Height = Application.GetRealHeight(100),
+                Height = Application.GetRealHeight (100),
             };
             AddChidren (bottomView);
 
@@ -125,167 +127,31 @@
             bottomView.AddChidren (btnAssignRoom);
             btnAssignRoom.MouseUpEventHandler += (sender, e) => {
                 //bodyView.RemoveAll ();
-                RemoteSetting ();
+               
+                btnAssignRoomAction ();
             };
             SearchDeviceList ();
         }
 
         /// <summary>
-        /// 杩滅▼閰嶇疆
+        /// 鍒ゆ柇璁惧绫诲瀷 鍏煎鏃ц澶�
         /// </summary>
-        void RemoteSetting ()
+        void btnAssignRoomAction ()
         {
-            byte [] gatewayBytes = null;
-            byte [] serverIPBytes = null;
-
-            string [] strServerIP = (MainPage.SeviceIP).Split ('.');
-            string [] strServerIP1 = (MainPage.SeviceIP).Split ('.');
-            MainPage.Loading.Start ("Configuring device...");
-            System.Threading.Tasks.Task.Run (() => {
-                try {
-                    var currentRegionIdBytes = new byte [] {
-                        (byte)(UserConfig.Instance.CurrentRegion.RegionID / 256 / 256 / 256),
-                        (byte)(UserConfig.Instance.CurrentRegion.RegionID / 256 / 256),
-                        (byte)(UserConfig.Instance.CurrentRegion.RegionID / 256),
-                        (byte)(UserConfig.Instance.CurrentRegion.RegionID%256),
-                    };
-
-                    gatewayBytes = Control.ControlBytesSendHasReturn (Command.ReadGateWayModelInfo, gatewayDeicve.SubnetID, gatewayDeicve.DeviceID, new byte [] { });
-                    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_UserName = "Admin";
-                    gatewayDeicve.Remote_Password = "c" + MainPage.LoginUser.MasterID;
-                    byte [] ggn = new byte [20];
-                    byte [] b1 = CommonPage.MyEncodingGB2312.GetBytes (gatewayDeicve.Remote_GroupName);
-                    gatewayDeicve.Remote_GroupName = CommonPage.MyEncodingGB2312.GetString (b1);
-                    Array.Copy (b1, 0, ggn, 0, 20 < b1.Length ? 20 : b1.Length);
-
-                    byte [] gpn = new byte [20];
-                    byte [] b2 = CommonPage.MyEncodingGB2312.GetBytes (gatewayDeicve.Remote_ProjectName);
-                    Array.Copy (b2, 0, gpn, 0, 20 < b2.Length ? 20 : b2.Length);
-
-                    byte [] gun = new byte [8];
-                    byte [] b3 = CommonPage.MyEncodingGB2312.GetBytes (gatewayDeicve.Remote_UserName);
-                    Array.Copy (b3, 0, gun, 0, 8 < b3.Length ? 8 : b3.Length);
-
-                    byte [] gpw = new byte [8];
-                    byte [] b4 = CommonPage.MyEncodingGB2312.GetBytes (gatewayDeicve.Remote_Password);
-                    Array.Copy (b4, 0, gpw, 0, 8 < b4.Length ? 8 : b4.Length);
-
-
-                    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);
-                    Array.Copy (gun, 0, gatewayBytes, 41, 8 < gun.Length ? 8 : gun.Length);
-                    Array.Copy (gpw, 0, gatewayBytes, 49, 8 < gpw.Length ? 8 : gpw.Length);
-
-                    Control.ControlBytesSend (Command.SetGateWayModelInfo, gatewayDeicve.SubnetID, gatewayDeicve.DeviceID, gatewayBytes);
-
-                    serverIPBytes [0] = Convert.ToByte (strServerIP [0]);
-                    serverIPBytes [1] = Convert.ToByte (strServerIP [1]);
-                    serverIPBytes [2] = Convert.ToByte (strServerIP [2]);
-                    serverIPBytes [3] = Convert.ToByte (strServerIP [3]);
-                    int point1 = 9999;
-
-                    serverIPBytes [4] = Convert.ToByte (point1 / 256);
-                    serverIPBytes [5] = Convert.ToByte (point1 % 256);
-
-                    serverIPBytes [6] = Convert.ToByte (strServerIP1 [0]);
-                    serverIPBytes [7] = Convert.ToByte (strServerIP1 [1]);
-                    serverIPBytes [8] = Convert.ToByte (strServerIP1 [2]);
-                    serverIPBytes [9] = Convert.ToByte (strServerIP1 [3]);
-                    int point2 = 9999;
-
-                    serverIPBytes [10] = Convert.ToByte (point2 / 256);
-                    serverIPBytes [11] = Convert.ToByte (point2 % 256);
-
-                    //杩滅▼ip鍦板潃鐨勮缃�
-                    var mobytes = Control.ControlBytesSendHasReturn (Command.SetGateWayModelInternetInfo, gatewayDeicve.SubnetID, gatewayDeicve.DeviceID, serverIPBytes);
-                    if (mobytes == null) {
-                        Application.RunOnMainThread (() => {
-                            new Alert ("", Language.StringByID (R.MyInternationalizationString.TipEquipmentNotOnline),
-                                       Language.StringByID (R.MyInternationalizationString.Close)).Show ();
-                        });
-                    } else if (mobytes [0] == 0xF5) {
-                        Application.RunOnMainThread (() => {
-                            new Alert ("", Language.StringByID (R.MyInternationalizationString.OperationFailed),
-                                       Language.StringByID (R.MyInternationalizationString.Close)).Show ();
-                        });
-                    } else {
-                        if (gatewayDeicve.Type == DeviceType.OnePortWirelessFR) {
-                            var bindReginIdStatus = Control.ControlBytesSendHasReturn (Command.Write_APP_Data_STORE_1D5E_CMD, gatewayDeicve.SubnetID, gatewayDeicve.DeviceID, currentRegionIdBytes);
-                            if (bindReginIdStatus == null) {
-                                Application.RunOnMainThread (() => {
-                                    new Alert ("", Language.StringByID (R.MyInternationalizationString.TipEquipmentNotOnline), Language.StringByID (R.MyInternationalizationString.Close)).Show ();
-                                });
-                                return;
-                            } else if (bindReginIdStatus [0] != 0xF8) {
-                                //new Alert ("", "缃戝叧缁戝畾浣忓畢澶辫触锛�", Language.StringByID (R.MyInternationalizationString.Close)).Show ();
-                                Application.RunOnMainThread (() => {
-                                    new Alert ("", "Gateway failed to bind residence!", Language.StringByID (R.MyInternationalizationString.Close)).Show ();
-                                });
-                                return;
-                            }
-                        }
-                        Application.RunOnMainThread (() => {
-                            MainPage.Loading.Start ("Gateway setting succeeded锛宒ata up.Please wait...");
-                        });
-                        IO.FileUtils.SaveEquipmentMessage (gatewayDeicve);
-                        var gatewayMAC = gatewayDeicve.MAC.Replace (".", "");
-                        var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject (new EditMACByHomeId { RegionID = UserConfig.Instance.CurrentRegion.RegionID, MAC = gatewayMAC, IsReBind = true });
-                        var respone = MainPage.RequestHttps ("EditMACByHomeId", requestJson);
-                        if (respone.StateCode != "SUCCESS") {
-                            Application.RunOnMainThread (() => {
-                                new Alert ("", "Communication abnormality,gateway failed to bind residence!", Language.StringByID (R.MyInternationalizationString.Close)).Show ();
-                                if (MainPage.LoginUser.AccountString == "464027401@qq.com") {
-                                    new Alert (respone.StateCode, respone.ErrorInfo, Language.StringByID (R.MyInternationalizationString.Close)).Show ();
-                                }
-                            });
-                            return;
-                        }
-                        var gatewayListObj = new GatewayListObj ();
-                        var gatewayListJson = Newtonsoft.Json.JsonConvert.SerializeObject (gatewayListObj);
-                        var gatewayListRevertObj = MainPage.RequestHttps ("GatewayList", gatewayListJson);
-                        if (gatewayListRevertObj.StateCode == "SUCCESS") {
-                            var responseGatewayDataObj = Newtonsoft.Json.JsonConvert.DeserializeObject<List<GatewayRes>> (gatewayListRevertObj.ResponseData.ToString ());
-                            if (responseGatewayDataObj.Count > 0) {
-                                UserConfig.Instance.GatewayList.Clear ();
-                                UserConfig.Instance.GatewayList.AddRange (responseGatewayDataObj);
-                                UserConfig.Instance.GatewayMAC = gatewayDeicve.MAC;
-                                UserConfig.Instance.SaveUserConfig ();
-                                MainPage.LoginUser.LastTime = DateTime.Now;
-                                Application.RunOnMainThread (() => {
-                                    UserMiddle.Init (true);
-                                });
-                            } else {
-                                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 ();
-                                    }
-                                });
-                            }
-                        }
-                    }
-                } catch (Exception ex) {
-                    Console.WriteLine (ex.Message);
-                    Application.RunOnMainThread (() => {
-                        new Alert ("", Language.StringByID (R.MyInternationalizationString.OperationFailed), Language.StringByID (R.MyInternationalizationString.Close)).Show ();
-                    });
-                    bool canRemove = false;
-                } finally {
-                    Application.RunOnMainThread (() => {
-                        MainPage.Loading.Hide ();
-                        //this.RemoveAll ();
-                    });
-                }
-            });
-            //Room.InitAllRoom ();
+            if (gatewayDeicve.Type == DeviceType.OnePortMqttFR) {
+              
+                Console.WriteLine ("Assign OnePortMqttFR锛孒DL MQTT");
+                //RemoteSetting ();
+                RemoteSettingWithHDLMQTT ();
+            } else {
+                Console.WriteLine ("Assign OnePortWirelessFR");
+                RemoteSettingWithOldDevice ();
+                //RemoteSettingWithMQTT ();
+            }
         }
+
+
+      
 
         /// <summary>
         /// 寮�鍏虫棤绾块厤缃�
@@ -343,7 +209,7 @@
                         if (common == null)
                             continue;
                         Application.RunOnMainThread (() => {
-                            if(!common.isMixBox){
+                            if (!common.isMixBox) {
                                 progress++;
                             }
                             MainPage.Loading.Start ("Loading:" + common.Name + " 锛孭rogress " + progress.ToString () + "/" + CommonPage.searchTotal.ToString ());
@@ -368,7 +234,7 @@
                     th = null;
                     Application.RunOnMainThread (() => {
                         MainPage.Loading.Hide ();
-                        if (gatewayDeicve.Type == DeviceType.OnePortWirelessFR) {
+                        if (gatewayDeicve.Type == DeviceType.OnePortWirelessFR || gatewayDeicve.Type == DeviceType.OnePortMqttFR) {
                             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 ();
@@ -390,7 +256,7 @@
             if (curView == null || addedCommon == null)
                 return;
             lock (addedCommon) {
-                if (addedCommon.Find ((obj)=>obj.Type == common.Type&& obj.CommonLoopID == common.CommonLoopID)!=null)
+                if (addedCommon.Find ((obj) => obj.Type == common.Type && obj.CommonLoopID == common.CommonLoopID) != null)
                     return;
                 addedCommon.Add (common);
                 if (common.SubnetID == gatewayDeicve.SubnetID) {
@@ -559,7 +425,7 @@
                         Alert alert = new Alert ("", Language.StringByID (R.MyInternationalizationString.TipDeleteEquipmentMessage)
                                         , Language.StringByID (R.MyInternationalizationString.Cancel), Language.StringByID (R.MyInternationalizationString.Confrim));
                         alert.Show ();
-                        alert.ResultEventHandler += ( sender1,  e1) => {
+                        alert.ResultEventHandler += (sender1, e1) => {
                             if (e1) {
                                 MainPage.Loading.Start ("Please wait...");
                                 System.Threading.Tasks.Task.Run (() => {
@@ -710,5 +576,527 @@
             CommonPage.FindGatewayChilren = false;
         }
 
+
+
+        /// <summary>
+        /// 杩滅▼閰嶇疆
+        /// </summary>
+        void RemoteSettingWithOldDevice ()
+        {
+            byte [] gatewayBytes = null;
+            byte [] serverIPBytes = null;
+
+            string [] strServerIP = (MainPage.SeviceIP).Split ('.');
+            string [] strServerIP1 = (MainPage.SeviceIP).Split ('.');
+            MainPage.Loading.Start ("Configuring device...");
+            System.Threading.Tasks.Task.Run (() => {
+                try {
+
+                    //var currentRegionIdBytes = new byte [] {
+                    //    (byte)(UserConfig.Instance.CurrentRegion.RegionID / 256 / 256 / 256),
+                    //    (byte)(UserConfig.Instance.CurrentRegion.RegionID / 256 / 256),
+                    //    (byte)(UserConfig.Instance.CurrentRegion.RegionID / 256),
+                    //    (byte)(UserConfig.Instance.CurrentRegion.RegionID % 256),
+                    //};
+
+
+
+
+                    //var currentRegionIdBytes = Utlis.IntToByteArray (UserConfig.Instance.CurrentRegion.RegionID);
+
+                    byte [] RegionIDBytes = CommonPage.MyEncodingGB2312.GetBytes (UserConfig.Instance.CurrentRegion.RegionID.ToString());
+                    var currentRegionIdBytes = new byte [4];
+                    Array.Copy (RegionIDBytes, 0, currentRegionIdBytes, 0, 4 < RegionIDBytes.Length ? 4 : RegionIDBytes.Length);
+
+                    gatewayBytes = Control.ControlBytesSendHasReturn (Command.ReadGateWayModelInfo, gatewayDeicve.SubnetID, gatewayDeicve.DeviceID, new byte [] { });
+                    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_UserName = "Admin";
+                    gatewayDeicve.Remote_Password = "c" + MainPage.LoginUser.MasterID;
+                    byte [] ggn = new byte [20];
+                    byte [] b1 = CommonPage.MyEncodingGB2312.GetBytes (gatewayDeicve.Remote_GroupName);
+                    gatewayDeicve.Remote_GroupName = CommonPage.MyEncodingGB2312.GetString (b1);
+                    Array.Copy (b1, 0, ggn, 0, 20 < b1.Length ? 20 : b1.Length);
+
+                    byte [] gpn = new byte [20];
+                    byte [] b2 = CommonPage.MyEncodingGB2312.GetBytes (gatewayDeicve.Remote_ProjectName);
+                    Array.Copy (b2, 0, gpn, 0, 20 < b2.Length ? 20 : b2.Length);
+
+                    byte [] gun = new byte [8];
+                    byte [] b3 = CommonPage.MyEncodingGB2312.GetBytes (gatewayDeicve.Remote_UserName);
+                    Array.Copy (b3, 0, gun, 0, 8 < b3.Length ? 8 : b3.Length);
+
+                    byte [] gpw = new byte [8];
+                    byte [] b4 = CommonPage.MyEncodingGB2312.GetBytes (gatewayDeicve.Remote_Password);
+                    Array.Copy (b4, 0, gpw, 0, 8 < b4.Length ? 8 : b4.Length);
+
+
+                    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);
+                    Array.Copy (gun, 0, gatewayBytes, 41, 8 < gun.Length ? 8 : gun.Length);
+                    Array.Copy (gpw, 0, gatewayBytes, 49, 8 < gpw.Length ? 8 : gpw.Length);
+
+                    Control.ControlBytesSend (Command.SetGateWayModelInfo, gatewayDeicve.SubnetID, gatewayDeicve.DeviceID, gatewayBytes);
+
+                    serverIPBytes [0] = Convert.ToByte (strServerIP [0]);
+                    serverIPBytes [1] = Convert.ToByte (strServerIP [1]);
+                    serverIPBytes [2] = Convert.ToByte (strServerIP [2]);
+                    serverIPBytes [3] = Convert.ToByte (strServerIP [3]);
+                    int point1 = 9999;
+
+                    serverIPBytes [4] = Convert.ToByte (point1 / 256);
+                    serverIPBytes [5] = Convert.ToByte (point1 % 256);
+
+                    serverIPBytes [6] = Convert.ToByte (strServerIP1 [0]);
+                    serverIPBytes [7] = Convert.ToByte (strServerIP1 [1]);
+                    serverIPBytes [8] = Convert.ToByte (strServerIP1 [2]);
+                    serverIPBytes [9] = Convert.ToByte (strServerIP1 [3]);
+                    int point2 = 9999;
+
+                    serverIPBytes [10] = Convert.ToByte (point2 / 256);
+                    serverIPBytes [11] = Convert.ToByte (point2 % 256);
+
+                    //杩滅▼ip鍦板潃鐨勮缃�
+                    var mobytes = Control.ControlBytesSendHasReturn (Command.SetGateWayModelInternetInfo, gatewayDeicve.SubnetID, gatewayDeicve.DeviceID, serverIPBytes);
+                    if (mobytes == null) {
+                        Application.RunOnMainThread (() => {
+                            new Alert ("", Language.StringByID (R.MyInternationalizationString.TipEquipmentNotOnline),
+                                       Language.StringByID (R.MyInternationalizationString.Close)).Show ();
+                        });
+                    } else if (mobytes [0] == 0xF5) {
+                        Application.RunOnMainThread (() => {
+                            new Alert ("", Language.StringByID (R.MyInternationalizationString.OperationFailed),
+                                       Language.StringByID (R.MyInternationalizationString.Close)).Show ();
+                        });
+                    } else {
+                        if (gatewayDeicve.Type == DeviceType.OnePortWirelessFR) {
+                            var bindReginIdStatus = Control.ControlBytesSendHasReturn (Command.Write_APP_Data_STORE_1D5E_CMD, gatewayDeicve.SubnetID, gatewayDeicve.DeviceID, currentRegionIdBytes);
+                            if (bindReginIdStatus == null) {
+                                Application.RunOnMainThread (() => {
+                                    new Alert ("", Language.StringByID (R.MyInternationalizationString.TipEquipmentNotOnline), Language.StringByID (R.MyInternationalizationString.Close)).Show ();
+                                });
+                                return;
+                            } else if (bindReginIdStatus [0] != 0xF8) {
+                                //new Alert ("", "缃戝叧缁戝畾浣忓畢澶辫触锛�", Language.StringByID (R.MyInternationalizationString.Close)).Show ();
+                                Application.RunOnMainThread (() => {
+                                    new Alert ("", "Gateway failed to bind residence!", Language.StringByID (R.MyInternationalizationString.Close)).Show ();
+                                });
+                                return;
+                            }
+                        }
+                        Application.RunOnMainThread (() => {
+                            MainPage.Loading.Start ("Gateway setting succeeded锛宒ata up.Please wait...");
+                        });
+                        IO.FileUtils.SaveEquipmentMessage (gatewayDeicve);
+                        var gatewayMAC = gatewayDeicve.MAC.Replace (".", "");
+                        var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject (new EditMACByHomeId { RegionID = UserConfig.Instance.CurrentRegion.RegionID, MAC = gatewayMAC, IsReBind = true });
+                        var respone = MainPage.RequestHttps ("EditMACByHomeId", requestJson);
+                        if (respone.StateCode != "SUCCESS") {
+                            Application.RunOnMainThread (() => {
+                                new Alert ("", "Communication abnormality,gateway failed to bind residence!", Language.StringByID (R.MyInternationalizationString.Close)).Show ();
+                                if (MainPage.LoginUser.AccountString == "464027401@qq.com") {
+                                    new Alert (respone.StateCode, respone.ErrorInfo, Language.StringByID (R.MyInternationalizationString.Close)).Show ();
+                                }
+                            });
+                            return;
+                        }
+                        var gatewayListObj = new GatewayListObj ();
+                        var gatewayListJson = Newtonsoft.Json.JsonConvert.SerializeObject (gatewayListObj);
+                        var gatewayListRevertObj = MainPage.RequestHttps ("GatewayList", gatewayListJson);
+                        if (gatewayListRevertObj.StateCode == "SUCCESS") {
+                            var responseGatewayDataObj = Newtonsoft.Json.JsonConvert.DeserializeObject<List<GatewayRes>> (gatewayListRevertObj.ResponseData.ToString ());
+                            if (responseGatewayDataObj.Count > 0) {
+                                UserConfig.Instance.GatewayList.Clear ();
+                                UserConfig.Instance.GatewayList.AddRange (responseGatewayDataObj);
+                                UserConfig.Instance.GatewayMAC = gatewayDeicve.MAC;
+                                UserConfig.Instance.SaveUserConfig ();
+                                MainPage.LoginUser.LastTime = DateTime.Now;
+                                Application.RunOnMainThread (() => {
+                                    UserMiddle.Init (true);
+                                });
+                            } else {
+                                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 ();
+                                    }
+                                });
+                            }
+                        }
+                    }
+                } catch (Exception ex) {
+                    Console.WriteLine (ex.Message);
+                    Application.RunOnMainThread (() => {
+                        new Alert ("", Language.StringByID (R.MyInternationalizationString.OperationFailed), Language.StringByID (R.MyInternationalizationString.Close)).Show ();
+                    });
+                    bool canRemove = false;
+                } finally {
+                    Application.RunOnMainThread (() => {
+                        MainPage.Loading.Hide ();
+                        //this.RemoveAll ();
+                    });
+                }
+            });
+            //Room.InitAllRoom ();
+        }
+
+        /// <summary>
+        /// 杩滅▼閰嶇疆 HDL MQTT妯″紡
+        /// </summary>
+        void RemoteSettingWithHDLMQTT ()
+        {
+            byte [] gatewayBytes = null;
+            string [] strServerIP = (MainPage.SeviceIP).Split ('.');
+            string [] strServerIP1 = (MainPage.SeviceIP).Split ('.');
+            MainPage.Loading.Start ("Configuring device...");
+            System.Threading.Tasks.Task.Run (() => {
+                try {
+
+                    //璇诲彇涓�绔彛浜ゆ崲鏈恒�佹棤绾跨綉鍏崇殑閰嶇疆淇℃伅
+                    gatewayBytes = Control.ControlBytesSendHasReturn (Command.ReadGateWayModelInfo, 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_UserName = "Admin";
+                    gatewayDeicve.Remote_Password = "c" + MainPage.LoginUser.MasterID;
+                    //gatewayDeicve.Remote_Password = "85521566";
+                    byte [] ggn = new byte [20];
+                    byte [] b1 = CommonPage.MyEncodingGB2312.GetBytes (gatewayDeicve.Remote_GroupName);
+                    gatewayDeicve.Remote_GroupName = CommonPage.MyEncodingGB2312.GetString (b1);
+                    Array.Copy (b1, 0, ggn, 0, 20 < b1.Length ? 20 : b1.Length);
+
+                    byte [] gpn = new byte [20];
+                    byte [] b2 = CommonPage.MyEncodingGB2312.GetBytes (gatewayDeicve.Remote_ProjectName);
+                    Array.Copy (b2, 0, gpn, 0, 20 < b2.Length ? 20 : b2.Length);
+
+                    byte [] gun = new byte [8];
+                    byte [] b3 = CommonPage.MyEncodingGB2312.GetBytes (gatewayDeicve.Remote_UserName);
+                    Array.Copy (b3, 0, gun, 0, 8 < b3.Length ? 8 : b3.Length);
+
+                    byte [] gpw = new byte [8];
+                    byte [] b4 = CommonPage.MyEncodingGB2312.GetBytes (gatewayDeicve.Remote_Password);
+                    Array.Copy (b4, 0, gpw, 0, 8 < b4.Length ? 8 : b4.Length);
+
+
+                    gatewayBytes [0] = TYPEHdlMQTT;//HDL MQTT
+                    Array.Copy (ggn, 0, gatewayBytes, 1, 20);
+                    Array.Copy (gpn, 0, gatewayBytes, 21, 20);
+                    Array.Copy (gun, 0, gatewayBytes, 41, 8);
+                    Array.Copy (gpw, 0, gatewayBytes, 49, 8);
+                    //1.淇敼鐢ㄦ埛鍚嶄俊鎭�
+                    Control.ControlBytesSend (Command.SetGateWayModelInfo, gatewayDeicve.SubnetID, gatewayDeicve.DeviceID, gatewayBytes);
+                    ////2.璇诲彇涓�娆$鐞嗕俊鎭�
+                    //byte [] adminBytes = Control.ControlBytesSendHasReturn (Command.ReadGateWayAdminInfo, gatewayDeicve.SubnetID, gatewayDeicve.DeviceID, new byte [] { });
+                    ////3.淇敼绠$悊淇℃伅
+                    //if (SetGateWayAdminInfo (adminBytes)) {
+                    //    //4.鍐欓厤缃垚鍔熷悗涓嬩竴姝ユ搷浣�
+                    //    GatewaySettingSucceeded ();
+                    //}
+
+                    //2.淇敼绠$悊淇℃伅
+                    if (SetGateWayAdminInfo ()) {
+                        //3.鍐欓厤缃垚鍔熷悗涓嬩竴姝ユ搷浣�
+                        GatewaySettingSucceeded ();
+                    }
+                    
+
+
+
+                } catch (Exception ex) {
+                    Console.WriteLine (ex.Message);
+                    Application.RunOnMainThread (() => {
+                        new Alert ("", Language.StringByID (R.MyInternationalizationString.OperationFailed), Language.StringByID (R.MyInternationalizationString.Close)).Show ();
+                    });
+                    bool canRemove = false;
+                } finally {
+                    Application.RunOnMainThread (() => {
+                        MainPage.Loading.Hide ();
+                        //this.RemoveAll ();
+                    });
+                }
+            });
+            //Room.InitAllRoom ();
+        }
+
+        /// <summary>
+        /// 淇敼绠$悊鍛樹俊鎭�
+        /// </summary>
+        /// <param name="adminBytes"></param>
+        /// <returns></returns>
+        bool SetGateWayAdminInfo (byte[] adminBytes) {
+            byte [] name = CommonPage.MyEncodingGB2312.GetBytes (MainPage.LoginUser.AccountString);
+            byte [] backBytes;
+            if (adminBytes != null && adminBytes.Length >= 73) {//杩斿洖鏁版嵁姝e父,鍙慨鏀硅处鍙蜂俊鎭�
+                Array.Copy (name, 0, adminBytes, 0, 36 < name.Length ? 36 : name.Length);
+                backBytes = Control.ControlBytesSendHasReturn (Command.SetGateWayAdminInfo, gatewayDeicve.SubnetID, gatewayDeicve.DeviceID, adminBytes);
+             
+            } else {
+                byte [] currentRegionIdBytes = CommonPage.MyEncodingGB2312.GetBytes (UserConfig.Instance.CurrentRegion.RegionID.ToString());
+                //byte [] currentRegionIdBytes = CommonPage.MyEncodingGB2312.GetBytes (UserConfig.Instance.CurrentRegion.RegionID);
+                //var currentRegionIdBytes = Utlis.IntToByteArray (UserConfig.Instance.CurrentRegion.RegionID);
+                adminBytes = new byte [73];
+                adminBytes [36] = 1;//浣忓畢鏍囧織浣�
+                Array.Copy (name, 0, adminBytes, 0, 36 < name.Length ? 36 : name.Length);
+                Array.Copy (currentRegionIdBytes, 0, adminBytes, 37, 36 < currentRegionIdBytes.Length ? 36 : currentRegionIdBytes.Length);
+                backBytes = Control.ControlBytesSendHasReturn (Command.SetGateWayAdminInfo, gatewayDeicve.SubnetID, gatewayDeicve.DeviceID, adminBytes);
+                
+            }
+            return CheckIsSuccessfulWithBytes (backBytes);
+        }
+
+        /// <summary>
+        /// 淇敼绠$悊鍛樹俊鎭�
+        /// </summary>
+        /// <param name="adminBytes"></param>
+        /// <returns></returns>
+        bool SetGateWayAdminInfo ()
+        {
+            byte [] name = CommonPage.MyEncodingGB2312.GetBytes (MainPage.LoginUser.AccountString);
+            //byte [] currentRegionIdBytes = CommonPage.MyEncodingGB2312.GetBytes (UserConfig.Instance.CurrentRegion.RegionID);
+            byte [] currentRegionIdBytes = CommonPage.MyEncodingGB2312.GetBytes (UserConfig.Instance.CurrentRegion.RegionID.ToString());
+            //var currentRegionIdBytes = Utlis.IntToByteArray (UserConfig.Instance.CurrentRegion.RegionID);
+            byte [] adminBytes = new byte [73];
+            adminBytes [36] = 1;//浣忓畢鏍囧織浣�
+            Array.Copy (name, 0, adminBytes, 0, 36 < name.Length ? 36 : name.Length);
+            Array.Copy (currentRegionIdBytes, 0, adminBytes, 37, 36 < currentRegionIdBytes.Length ? 36 : currentRegionIdBytes.Length);
+
+            byte [] backBytes = Control.ControlBytesSendHasReturn (Command.SetGateWayAdminInfo, gatewayDeicve.SubnetID, gatewayDeicve.DeviceID, adminBytes);
+
+            return CheckIsSuccessfulWithBytes (backBytes);
+        }
+
+
+        /// <summary>
+        /// 杩滅▼閰嶇疆 Standard MQTT妯″紡
+        /// </summary>
+        void RemoteSettingWithStandardMQTT ()
+        {
+            byte [] gatewayBytes = null;
+            string [] strServerIP = (MainPage.SeviceIP).Split ('.');
+            string [] strServerIP1 = (MainPage.SeviceIP).Split ('.');
+            MainPage.Loading.Start ("Configuring device...");
+            System.Threading.Tasks.Task.Run (() => {
+                try {
+
+                    //璇诲彇涓�绔彛浜ゆ崲鏈恒�佹棤绾跨綉鍏崇殑閰嶇疆淇℃伅
+                    gatewayBytes = Control.ControlBytesSendHasReturn (Command.ReadGateWayModelInfo, gatewayDeicve.SubnetID, gatewayDeicve.DeviceID, new byte [] { });
+                    //杩炴帴绫诲瀷閰嶇疆涓�5 Standard MQTT妯″紡
+                    gatewayBytes [0] = TYPEStandardMQTT;//Standard MQTT
+                    Control.ControlBytesSend (Command.SetGateWayModelInfo, gatewayDeicve.SubnetID, gatewayDeicve.DeviceID, gatewayBytes);
+                    //1.淇敼URL
+                    //2.淇敼璇诲彇瀹㈡埛绔疘D锛岀敤鎴峰悕锛屽瘑鐮�
+                    //3.淇敼AES鍔犲瘑
+                    //4.淇敼涓婚
+
+                    //1.淇敼URL
+                    if (SetGateWayURL ("https://developer.hdlcontrol.com/api/")) {
+                        //2.淇敼瀹㈡埛绔疘D锛岀敤鎴峰悕锛屽瘑鐮�
+                        if (SetGateWayClientIDUsernamePassword ("85521566", "Admin", "85521566")) {
+                            //3.淇敼AES鍔犲瘑
+                            if (SetGateWayAESEncryption (true, "85521566")) {
+                                //4.1淇敼璁㈤槄涓婚
+                                if (SetGateWayTopic ("SubscribeTopic")) {
+                                    //4.2淇敼鍙戝竷涓婚
+                                    if (SetGateWayTopic ("PublishTopic", true)) {
+                                        //5.鍐欓厤缃垚鍔熷悗涓嬩竴姝ユ搷浣�
+                                        GatewaySettingSucceeded ();
+                                    }
+                                }
+                            }
+                        }
+                    }
+
+                } catch (Exception ex) {
+                    Console.WriteLine (ex.Message);
+                    Application.RunOnMainThread (() => {
+                        new Alert ("", Language.StringByID (R.MyInternationalizationString.OperationFailed), Language.StringByID (R.MyInternationalizationString.Close)).Show ();
+                    });
+                    bool canRemove = false;
+                } finally {
+                    Application.RunOnMainThread (() => {
+                        MainPage.Loading.Hide ();
+                        //this.RemoveAll ();
+                    });
+                }
+            });
+            //Room.InitAllRoom ();
+        }
+
+        /// <summary>
+        /// 鍒ゆ柇鏄惁淇鎴愬姛 F8 = 鎴愬姛锛� F5=澶辫触
+        /// </summary>
+        /// <param name="backBytes"></param>
+        /// <returns></returns>
+        private bool CheckIsSuccessfulWithBytes (byte [] backBytes)
+        {
+            if (backBytes == null) {
+                Application.RunOnMainThread (() => {
+                    new Alert ("", Language.StringByID (R.MyInternationalizationString.TipEquipmentNotOnline),
+                               Language.StringByID (R.MyInternationalizationString.Close)).Show ();
+                });
+                return false;
+            } else if (backBytes [0] == 0xF8) {//F8 = 鎴愬姛锛� F5=澶辫触
+                return true;
+            } else {
+                Application.RunOnMainThread (() => {
+                    new Alert ("", Language.StringByID (R.MyInternationalizationString.OperationFailed),
+                               Language.StringByID (R.MyInternationalizationString.Close)).Show ();
+                });
+                return false;
+            }
+        }
+
+        /// <summary>
+        /// 淇敼URL
+        /// </summary>
+        /// <returns></returns>
+        bool SetGateWayURL (string urlStr = "", int pointID = 1883)
+        {
+            byte [] sendBytes = new byte [63];
+            byte [] url = CommonPage.MyEncodingGB2312.GetBytes (urlStr);
+            Array.Copy (url, 0, sendBytes, 1, 60 < url.Length ? 60 : url.Length);
+            sendBytes [0] = GuideSettingGateway.TYPEStandardMQTT;
+            sendBytes [61] = Convert.ToByte (pointID / 256);
+            sendBytes [62] = Convert.ToByte (pointID % 256);
+            var backBytes = Control.ControlBytesSendHasReturn (Command.SetGateWayURL, gatewayDeicve.SubnetID, gatewayDeicve.DeviceID, sendBytes);
+
+            return CheckIsSuccessfulWithBytes (backBytes);
+        }
+
+
+        /// <summary>
+        /// 淇敼瀹㈡埛绔疘D锛岀敤鎴峰悕锛屽瘑鐮�
+        /// </summary>
+        /// <returns></returns>
+        bool SetGateWayClientIDUsernamePassword (string clientIDStr = "", string usernameStr = "", string passwordStr = "")
+        {
+
+            byte [] userInfoBytes = new byte [64];
+            byte [] clientID = CommonPage.MyEncodingGB2312.GetBytes (clientIDStr);
+            Array.Copy (clientID, 0, userInfoBytes, 0, 32 < clientID.Length ? 32 : clientID.Length);
+            byte [] username = CommonPage.MyEncodingGB2312.GetBytes (usernameStr);
+            Array.Copy (username, 0, userInfoBytes, 32, 16 < username.Length ? 16 : username.Length);
+            byte [] password = CommonPage.MyEncodingGB2312.GetBytes (passwordStr);
+            Array.Copy (password, 0, userInfoBytes, 48, 16 < password.Length ? 16 : password.Length);
+            var setUserInfoBytes = Control.ControlBytesSendHasReturn (Command.SetGateWayClientIDUsernamePassword, gatewayDeicve.SubnetID, gatewayDeicve.DeviceID, userInfoBytes);
+
+            return CheckIsSuccessfulWithBytes (setUserInfoBytes);
+        }
+
+        /// <summary>
+        /// 淇敼AES鍔犲瘑
+        /// </summary>
+        /// <returns></returns>
+        bool SetGateWayAESEncryption (bool enable = false, string passwordStr = "")
+        {
+            byte [] sendBytes = new byte [17];
+            sendBytes [0] = enable ? (byte)1 : (byte)0; //0:涓嶄娇鑳�  1 - 255:浣胯兘
+            byte [] password = CommonPage.MyEncodingGB2312.GetBytes (passwordStr);
+            Array.Copy (password, 0, sendBytes, 1, 16 < password.Length ? 16 : password.Length);
+            var backBytes = Control.ControlBytesSendHasReturn (Command.SetGateWayAESEncryption, gatewayDeicve.SubnetID, gatewayDeicve.DeviceID, sendBytes);
+
+            return CheckIsSuccessfulWithBytes (backBytes);
+        }
+
+        /// <summary>
+        /// 淇敼涓婚
+        /// </summary>
+        /// <param name="bPublish">鏄惁涓哄彂甯冧富棰�</param>
+        /// <param name="bDefault">鏄惁榛樿</param>
+        /// <returns></returns>
+        bool SetGateWayTopic (string topicInfoStr = "", bool bPublish = false, bool bDefault = false)
+        {
+            byte [] sendBytes = new byte [50];
+            sendBytes [0] = bPublish ? (byte)2 : (byte)1; //1锛氳闃�  2锛氬彂甯�
+            sendBytes [1] = bDefault ? (byte)0 : (byte)1; //1:闈為粯璁� 0:榛樿
+
+            byte [] topicInfo = CommonPage.MyEncodingGB2312.GetBytes (topicInfoStr);
+            Array.Copy (topicInfo, 0, sendBytes, 2, 48 < topicInfo.Length ? 48 : topicInfo.Length);
+            var backBytes = Control.ControlBytesSendHasReturn (Command.SetGateWayTopic, gatewayDeicve.SubnetID, gatewayDeicve.DeviceID, sendBytes);
+
+            if (backBytes != null && backBytes.Length >= 2) {
+                if (backBytes [0] == sendBytes [0] && backBytes [1] == sendBytes [1]) {
+                    return true;
+                }
+            }
+            return CheckIsSuccessfulWithBytes (backBytes);
+        }
+
+
+        /// <summary>
+        /// 鍐欓厤缃弬鏁版垚鍔熷悗鎵ц涓嬩竴姝ユ搷浣�
+        /// </summary>
+        void GatewaySettingSucceeded ()
+        {
+
+            if (gatewayDeicve.Type == DeviceType.OnePortMqttFR) {
+                //var currentRegionIdBytes = Utlis.IntToByteArray (UserConfig.Instance.CurrentRegion.RegionID);
+                //byte [] currentRegionIdBytes = CommonPage.MyEncodingGB2312.GetBytes (UserConfig.Instance.CurrentRegion.RegionID);
+                byte [] currentRegionIdBytes = CommonPage.MyEncodingGB2312.GetBytes (UserConfig.Instance.CurrentRegion.RegionID.ToString());
+                byte [] sendBytes = new byte [32];
+                Array.Copy (currentRegionIdBytes, 0, sendBytes, 2, 32 < currentRegionIdBytes.Length ? 32 : currentRegionIdBytes.Length);
+
+                //var currentRegionIdBytes = Utlis.IntToByteArray (UserConfig.Instance.CurrentRegion.RegionID);
+                var bindReginIdStatus = Control.ControlBytesSendHasReturn (Command.Write_APP_Data_STORE_1D5E_CMD, gatewayDeicve.SubnetID, gatewayDeicve.DeviceID, sendBytes);
+                if (bindReginIdStatus == null) {
+                    Application.RunOnMainThread (() => {
+                        new Alert ("", Language.StringByID (R.MyInternationalizationString.TipEquipmentNotOnline), Language.StringByID (R.MyInternationalizationString.Close)).Show ();
+                    });
+                    return;
+                } else if (bindReginIdStatus [0] != 0xF8) {
+                    //new Alert ("", "缃戝叧缁戝畾浣忓畢澶辫触锛�", Language.StringByID (R.MyInternationalizationString.Close)).Show ();
+                    Application.RunOnMainThread (() => {
+                        new Alert ("", "Gateway failed to bind residence!", Language.StringByID (R.MyInternationalizationString.Close)).Show ();
+                    });
+                    return;
+                }
+            }
+
+
+            Application.RunOnMainThread (() => {
+                MainPage.Loading.Start ("Gateway setting succeeded锛宒ata up.Please wait...");
+            });
+            IO.FileUtils.SaveEquipmentMessage (gatewayDeicve);
+            var gatewayMAC = gatewayDeicve.MAC.Replace (".", "");
+            var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject (new EditMACByHomeId { RegionID = UserConfig.Instance.CurrentRegion.RegionID, MAC = gatewayMAC, IsReBind = true });
+            var respone = MainPage.RequestHttps ("EditMACByHomeId", requestJson);
+            if (respone.StateCode != "SUCCESS") {
+                Application.RunOnMainThread (() => {
+                    new Alert ("", "Communication abnormality,gateway failed to bind residence!", Language.StringByID (R.MyInternationalizationString.Close)).Show ();
+                    if (MainPage.LoginUser.AccountString == "464027401@qq.com") {
+                        new Alert (respone.StateCode, respone.ErrorInfo, Language.StringByID (R.MyInternationalizationString.Close)).Show ();
+                    }
+                });
+                return;
+            }
+            var gatewayListObj = new GatewayListObj ();
+            var gatewayListJson = Newtonsoft.Json.JsonConvert.SerializeObject (gatewayListObj);
+            var gatewayListRevertObj = MainPage.RequestHttps ("GatewayList", gatewayListJson);
+            if (gatewayListRevertObj.StateCode == "SUCCESS") {
+                var responseGatewayDataObj = Newtonsoft.Json.JsonConvert.DeserializeObject<List<GatewayRes>> (gatewayListRevertObj.ResponseData.ToString ());
+                if (responseGatewayDataObj.Count > 0) {
+                    UserConfig.Instance.GatewayList.Clear ();
+                    UserConfig.Instance.GatewayList.AddRange (responseGatewayDataObj);
+                    UserConfig.Instance.GatewayMAC = gatewayDeicve.MAC;
+                    UserConfig.Instance.SaveUserConfig ();
+                    MainPage.LoginUser.LastTime = DateTime.Now;
+                    Application.RunOnMainThread (() => {
+                        UserMiddle.Init (true);
+                    });
+                } else {
+                    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 ();
+                        }
+                    });
+                }
+            }
+        }
     }
 }
\ No newline at end of file

--
Gitblit v1.8.0