wxr
2022-08-30 c737673ababf40f25b2220888c7fe402a0880ab3
增加网关上锁提示
2个文件已修改
52 ■■■■ 已修改文件
Crabtree/SmartHome/HDL/Operation/Packet.cs 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Crabtree/SmartHome/UI/SimpleControl/Phone/Register/MigrationServer.cs 46 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Crabtree/SmartHome/HDL/Operation/Packet.cs
old mode 100755 new mode 100644
@@ -49,6 +49,8 @@
        public delegate void DelegateReceive (byte subnetID, byte deviceID, Command command, byte [] usefullBytes);
        public static event DelegateReceive ReceiveEvent;
        public static Action lockedAction;
        /// <summary>
        /// 接收到的所有数据
        /// </summary>
@@ -59,6 +61,10 @@
        public virtual void Manager ()
        {
            //对于操作数据库的时间比较长的,可以创建另一个线程处理
            string verString = System.Text.Encoding.ASCII.GetString (Bytes);
            if (verString.Contains ("HDLMIRACLELocked")) {
                lockedAction?.Invoke ();
            }
            if (!"HDLMIRACLE".Equals (System.Text.Encoding.ASCII.GetString (Bytes, 4, 10))) {
                return;
            }
Crabtree/SmartHome/UI/SimpleControl/Phone/Register/MigrationServer.cs
@@ -18,8 +18,11 @@
        /// </summary>
        private bool finish = false;
#if DEBUG
        private string SeverAddr = "https://test-gz.hdlcontrol.com";
#else
        private string SeverAddr = "https://bahrain-gateway.hdlcontrol.com";
        //private string SeverAddr = "https://test-gz.hdlcontrol.com";
#endif
        FrameLayout contentView;
@@ -35,11 +38,27 @@
        Button btnSave;
        Button btnClose;
        Alert sssAlert = new Alert ("", "Please press the PROG button on Gateway for 3 sec.", "Confirm");
        Action tipLockedAction;
        bool showedLockedTip = false;
        public MigrationServer ()
        {
            loading = new Loading ();
            loading = new Loading ();
            tipLockedAction = () => {
                Application.RunOnMainThread (() => {
                    if (!showedLockedTip) {
                        sssAlert.Show ();
                        showedLockedTip = true;
                        sssAlert.ResultEventHandler += (sd, dd) => {
                            showedLockedTip = false;
                        };
                    }
                });
            };
            Packet.lockedAction = tipLockedAction;
        }
@@ -47,7 +66,7 @@
        public void ShowDialog()
        {
            #region 弹窗
#region 弹窗
            Dialog dialog = new Dialog ();
            FrameLayout dialogBodyView = new FrameLayout () {
@@ -135,6 +154,8 @@
            bottomView.AddChidren (btnClose);
            btnClose.MouseUpEventHandler += (send2er, e2) => {
                dialog.Close ();
                Packet.lockedAction = null;
            };
            Button btnBottomLine = new Button () {
@@ -158,6 +179,7 @@
            btnSave.MouseUpEventHandler += (sender2, e2) => {
                if (finish) {
                    dialog.Close ();
                    Packet.lockedAction = null;
                    return;
                }
@@ -165,10 +187,10 @@
                var moveAccontResult = Account2New ("12345678");
                var newHomeId = Home2New ();
                //迁移网关
                var moveGatewayResult = Gateway2New ("4D59383553502243", newHomeId, 0);
                //var moveAccontResult = Account2New ("12345678");
                //var newHomeId = Home2New ();
                ////迁移网关
                //var moveGatewayResult = Gateway2New ("4D59383553502243", newHomeId, 0);
#endif
                if (etPwd.Text.Trim() == "") {
@@ -216,6 +238,7 @@
                etPwd.Visible = false;
                btnSave.MouseUpEventHandler = (sender2, e2) => {
                    dialog.Close ();
                    Packet.lockedAction = null;
                };
            } else {
@@ -229,13 +252,13 @@
            //3.接收升级文件获取请求
            //迁移账号
            #endregion
#endregion
        }
        #region 云端
#region 云端
        /// <summary>
        /// 账号登录验证
        /// </summary>
@@ -506,7 +529,7 @@
        #endregion
#endregion
        /// <summary>
        /// 检测一端口信息
@@ -540,6 +563,9 @@
                            gateWayString = CommonPage.MyEncodingUTF8.GetString (IO.FileUtils.ReadFile (gatewayFileName));
                            common = Newtonsoft.Json.JsonConvert.DeserializeObject<GatewayBase> (gateWayString);
                            //bool
                            CommonPage.IsRemote = false;
                            Control.ControlBytesSendHasReturn (Command.ReadGateway, common.SubnetID, common.DeviceID, new byte [] { CommonPage.RandomHigh, CommonPage.RandomLow });
                            var bytes = Control.ControlBytesSendHasReturn (Command.readGatewayVision, common.SubnetID, common.DeviceID, new byte [] { });
                            if(bytes == null) {