黄学彪
2019-12-12 7e863a33397f317ffc3ffd9288496d0e4f16aa66
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs
@@ -178,10 +178,18 @@
        /// <returns></returns>
        private ZbGateway GetGatewayFromFile(string file)
        {
            byte[] filebyte = Global.ReadFileByHomeId(file);
            string strvalue = System.Text.Encoding.UTF8.GetString(filebyte);
            var gateway = JsonConvert.DeserializeObject<ZbGateway>(strvalue);
            return gateway;
            try
            {
                byte[] filebyte = Global.ReadFileByHomeId(file);
                string strvalue = System.Text.Encoding.UTF8.GetString(filebyte);
                var gateway = JsonConvert.DeserializeObject<ZbGateway>(strvalue);
                return gateway;
            }
            catch (Exception ex)
            {
                HdlLogLogic.Current.WriteLog(ex);
                return null;
            }
        }
        #endregion
@@ -212,11 +220,13 @@
                }
                return false;
            }
            if (result != 1)
            if (result == -1)
            {
                return false;
            }
            return true;
            //设置网关的经纬度
            bool falge = this.SetGatewaySite(zbGateway, Common.Config.Instance.Home.Longitude, Common.Config.Instance.Home.Latitude);
            return falge;
        }
        /// <summary>
@@ -422,6 +432,12 @@
                //错误:网关对象丢失
                string msg = Language.StringByID(R.MyInternationalizationString.uErrorGatewayLostMsg);
                this.ShowTipMsg(msg);
                return -1;
            }
            //设置网关的经纬度
            bool falge = this.SetGatewaySite(zbGateway, Common.Config.Instance.Home.Longitude, Common.Config.Instance.Home.Latitude);
            if (falge == false)
            {
                return -1;
            }
@@ -1832,7 +1848,15 @@
                return;
            }
            var jObject = new Newtonsoft.Json.Linq.JObject { { "Cluster_ID", 0 }, { "Command", 85 } };
            realWay.Send("GwLinuxLocate_Respon", jObject.ToString());
            if (this.IsGatewayExist(zbGateway) == true)
            {
                realWay.Send("GwLinuxLocate_Respon", jObject.ToString());
            }
            else
            {
                //如果这个网关还没有绑定的话,则强制使用本地连接
                realWay.SendLocation("GwLinuxLocate_Respon", System.Text.Encoding.UTF8.GetBytes(jObject.ToString()));
            }
        }
        #endregion
@@ -2205,7 +2229,15 @@
            var jObject = new Newtonsoft.Json.Linq.JObject { { "Cluster_ID", 0 }, { "Command", 2013 } };
            var data = new Newtonsoft.Json.Linq.JObject { { "Longitude", intLongitude }, { "Latitude", intLatitude } };
            jObject.Add("Data", data);
            realWay.Send("Logic/SetSite", jObject.ToString());
            if (this.IsGatewayExist(gateway) == true)
            {
                realWay.Send("Logic/SetSite", jObject.ToString());
            }
            else
            {
                //如果这个网关还没有绑定的话,则强制使用本地连接
                realWay.SendLocation("Logic/SetSite", System.Text.Encoding.UTF8.GetBytes(jObject.ToString()));
            }
            int TimeOut = 0;
            while (result == -1 && TimeOut < 30)