From ce1feeeb0aaa2e53bca4e8d64953edaba2b41106 Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期五, 19 六月 2020 17:27:49 +0800
Subject: [PATCH]  请合并最新版代码

---
 Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceBindLogic.cs |  298 -----------------------------------------------------------
 1 files changed, 2 insertions(+), 296 deletions(-)

diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceBindLogic.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceBindLogic.cs
old mode 100755
new mode 100644
index 73b1c56..34f9db9
--- a/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceBindLogic.cs
+++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceBindLogic.cs
@@ -316,304 +316,10 @@
             return false;
         }
 
-        /// <summary>
-        /// 鍒犻櫎璁惧缁戝畾鐨勭洰鏍�
-        /// </summary>
-        public static HdlDeviceBindLogic Current
-        {
-            get
-            {
-                if (m_Current == null)
-                {
-                    m_Current = new HdlDeviceBindLogic();
-                }
-                return m_Current;
-            }
-        }
-
         #endregion
-
-        #region 鈻� 鑾峰彇璁惧涓嬮潰缁戝畾鐨勮澶嘷____________
-
-        /// <summary>
-        /// 鑾峰彇璁惧涓嬮潰缁戝畾鐨勮澶�(閿欒鏃惰繑鍥瀗ull),杩欎釜鏄粰pir浼犳劅鍣ㄧ敤鐨�
-        /// </summary>
-        /// <param name="mainDevice">璁惧瀵硅薄</param>
-        /// <returns></returns>
-        public List<CommonDevice> GetBindTargetDevice(CommonDevice mainDevice)
-        {
-            var result = this.GetDeviceBindAsync(mainDevice);
-            if (result == null || result.getAllBindResponseData == null)
-            {
-                //鑾峰彇璁惧鐨勭粦瀹氱洰鏍囧け璐�
-                string msg = Language.StringByID(R.MyInternationalizationString.uGetDeviceBindTargetFail);
-                //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
-                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
-
-                this.ShowErrorMsg(msg);
-                return null;
-            }
-            var listDevice = new List<CommonDevice>();
-            foreach (var data in result.getAllBindResponseData.BindList)
-            {
-                CommonDevice deviceTemp = Common.LocalDevice.Current.GetDevice(data.BindMacAddr, data.BindEpoint);
-                if (deviceTemp == null)
-                {
-                    continue;
-                }
-                listDevice.Add(deviceTemp);
-            }
-            return listDevice;
-        }
-
-        /// <summary>
-        ///鑾峰彇鎵�鏈夌粦瀹�
-        /// </summary>
-        public BindObj.GetDeviceBindResponseAllData GetDeviceBindAsync(CommonDevice device)
-        {
-            //濡傛灉褰撳墠浣忓畢鏄櫄鎷熶綇瀹�
-            if (Common.Config.Instance.Home.IsVirtually == true)
-            {
-                var listBind = ModelData.DeviceModelDataLogic.Current.GetDeviceBindList(device, "Bind/GetDeviceBind");
-                return new BindObj.GetDeviceBindResponseAllData()
-                {
-                    getAllBindResponseData = new BindObj.GetDeviceBindResponseData
-                    {
-                        Result = 0,
-                        BindList = listBind
-                    }
-                };
-            }
-
-            var jObject = new JObject { { "DeviceAddr", device.DeviceAddr }, { "Epoint", device.DeviceEpoint }, { "Cluster_ID", 0 }, { "Command", 5007 } };
-            string sendData = jObject.ToString();
-            //鍙戦��
-            var result = HdlDeviceCommonLogic.Current.SendJobjectDataToGateway(device, "Bind/GetDeviceBind", sendData, "Bind/GetDeviceBind_Respon", 6);
-            if (result.ErrorMsg != null || result.ErrorMsgDiv == 0)
-            {
-                return null;
-            }
-            var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<BindObj.GetDeviceBindResponseData>(result.ReceiptData);
-            return new BindObj.GetDeviceBindResponseAllData() { getAllBindResponseData = tempData };
-        }
-
-        #endregion
-
-        #region 鈻� 鎵ц缁戝畾璁惧鐩爣___________________
-
-        /// <summary>
-        /// 缁戝畾璁惧鐨勭洰鏍�(杩斿洖鎴愬姛璁剧疆鐨勮澶�,閿欒鏃讹紝杩斿洖null)
-        /// </summary>
-        /// <param name="mainDevice">璁惧瀵硅薄</param>
-        /// <param name="listDevice">瑕佺粦瀹氱殑鐩爣璁惧</param>
-        /// <param name="BindCluster">BindCluster</param>
-        /// <returns></returns>
-        public List<CommonDevice> BindDeviceTarget(CommonDevice mainDevice, List<CommonDevice> listDevice, int BindCluster = 6)
-        {
-            if (listDevice.Count == 0)
-            {
-                return new List<CommonDevice>();
-            }
-
-            var dicDevice = new Dictionary<string, CommonDevice>();
-
-            //缁勮鏁版嵁
-            var addData = new IASZone.AddBindData();
-            addData.DeviceAddr = mainDevice.DeviceAddr;
-            addData.Epoint = mainDevice.DeviceEpoint;
-            foreach (var device in listDevice)
-            {
-                var info = new IASZone.AddBindListObj();
-                info.BindCluster = BindCluster;
-                info.BindMacAddr = device.DeviceAddr;
-                info.BindEpoint = device.DeviceEpoint;
-                info.BindType = 0;
-
-                addData.BindList.Add(info);
-
-                //杩斿洖鎴愬姛璁惧鐨勬椂鍊欎娇鐢�
-                string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(device);
-                dicDevice[mainkeys] = device;
-            }
-            //鎵ц缁戝畾
-            var result = this.AddDeviceBindAsync(addData);
-            if (result == null || result.addedDeviceBindResponseData == null)
-            {
-                //缁戝畾鐩爣璁剧疆澶辫触
-                string msg = Language.StringByID(R.MyInternationalizationString.uSetBindTargetsFail);
-                //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
-                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
-
-                this.ShowErrorMsg(msg);
-                return null;
-            }
-
-            var listSuccess = new List<CommonDevice>();
-            foreach (var data in result.addedDeviceBindResponseData.BindList)
-            {
-                string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(data.BindMacAddr, data.BindEpoint);
-                if (dicDevice.ContainsKey(mainkeys) == true)
-                {
-                    listSuccess.Add(dicDevice[mainkeys]);
-                }
-            }
-
-            if (listSuccess.Count == 0)
-            {
-                //缁戝畾鐩爣璁剧疆澶辫触
-                string msg = Language.StringByID(R.MyInternationalizationString.uSetBindTargetsFail);
-                this.ShowTipMsg(msg);
-            }
-            return listSuccess;
-        }
-
-        /// <summary>
-        ///璁惧缁戝畾
-        /// </summary>
-        public BindObj.AddedDeviceBindResponseAllData AddDeviceBindAsync(BindObj.AddBindData addBindData)
-        {
-            //濡傛灉褰撳墠浣忓畢鏄櫄鎷熶綇瀹�
-            if (Common.Config.Instance.Home.IsVirtually == true)
-            {
-                return ModelData.DeviceModelDataLogic.Current.AddDeviceBindList(addBindData, "Bind/GetDeviceBind");
-            }
-
-            var device = Common.LocalDevice.Current.GetDevice(addBindData.DeviceAddr, addBindData.Epoint);
-            //鑾峰彇鍙戦�佺殑鍛戒护瀛楃
-            var sendData = this.GetAddDeviceListBindCommandText(addBindData);
-            //鍙戦��
-            var result = HdlDeviceCommonLogic.Current.SendJobjectDataToGateway(device, "Bind/SetBind", sendData, "Bind/SetBind_Respon", 20);
-            if (result.ErrorMsg != null || result.ErrorMsgDiv == 0)
-            {
-                return null;
-            }
-
-            //淇敼缂撳瓨
-            ModelData.DeviceModelDataLogic.Current.AddDeviceBindList(addBindData, "Bind/GetDeviceBind");
-
-            var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<BindObj.AddedDeviceBindResponseData>(result.ReceiptData);
-            return new BindObj.AddedDeviceBindResponseAllData() { addedDeviceBindResponseData = tempData };
-        }
-
-        /// <summary>
-        /// 鑾峰彇娣诲姞璁惧缁戝畾鐨勫懡浠ゅ瓧绗�
-        /// </summary>
-        /// <param name="addBindData"></param>
-        /// <returns></returns>
-        public string GetAddDeviceListBindCommandText(BindObj.AddBindData addBindData)
-        {
-            var jObject = new JObject { { "DeviceAddr", addBindData.DeviceAddr }, { "Epoint", addBindData.Epoint }, { "Cluster_ID", 0 }, { "Command", 5001 } };
-            var bindList = new JArray { };
-            foreach (var bindInfo in addBindData.BindList)
-            {
-                if (bindInfo.BindType == 0)
-                {
-                    var dInfo = new JObject{{ "BindMacAddr",bindInfo.BindMacAddr},{ "BindEpoint", bindInfo.BindEpoint} ,
-                            { "BindCluster", bindInfo.BindCluster} ,{ "BindType",bindInfo.BindType}};
-                    bindList.Add(dInfo);
-                }
-                else if (bindInfo.BindType == 1)
-                {
-                    var dInfo = new JObject{{ "BindCluster", bindInfo.BindCluster} ,{ "BindType",bindInfo.BindType},
-                            { "BindScenesId", bindInfo.BindScenesId}};
-                    bindList.Add(dInfo);
-                }
-            }
-            var data = new JObject { { "BindName", addBindData.BindName }, { "BindList", bindList } };
-            jObject.Add("Data", data);
-            return jObject.ToString();
-        }
-
-        #endregion
-
+
         #region 鈻� 鍒犻櫎璁惧缁戝畾鐨勭洰鏍嘷________________
-
-        /// <summary>
-        /// 鍒犻櫎璁惧缁戝畾鐨勭洰鏍�
-        /// </summary>
-        /// <param name="mainDevice">璁惧瀵硅薄</param>
-        /// <param name="deleteDevice">瑕佸垹闄ょ殑缁戝畾鐩爣璁惧</param>
-        /// <param name="BindCluster">BindCluster</param>
-        /// <returns></returns>
-        public bool DeleteDeviceTarget(CommonDevice mainDevice, CommonDevice deleteDevice, int BindCluster = 6)
-        {
-            //缁勮鏁版嵁
-            var deleteData = new IASZone.DelDeviceBindData();
-            deleteData.DeviceAddr = mainDevice.DeviceAddr;
-            deleteData.Epoint = mainDevice.DeviceEpoint;
-
-            var info = new IASZone.RemoveBindListObj();
-            info.BindCluster = BindCluster;
-            info.BindMacAddr = deleteDevice.DeviceAddr;
-            info.BindEpoint = deleteDevice.DeviceEpoint;
-            info.BindType = 0;
-
-            deleteData.RemoveBindList.Add(info);
-
-            //鎵ц鍒犻櫎
-            var result = this.DelDeviceBindAsync(deleteData);
-            if (result == null || result.delDeviceBindResponseData == null)
-            {
-                //鍒犻櫎缁戝畾鐩爣澶辫触
-                string msg = Language.StringByID(R.MyInternationalizationString.uDeleteBindTargetsFail);
-                //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
-                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
-
-                this.ShowErrorMsg(msg);
-                return false;
-            }
-
-            foreach (var data in result.delDeviceBindResponseData.RemoveBindList)
-            {
-                //0:鎴愬姛  1:璁惧涓嶅湪缁戝畾鍒楄〃涓� 锛屼篃鍙互浠h〃鎴愬姛
-                if (data.Result == 0 || data.Result == 1 || data.Result == 5)
-                {
-                    return true;
-                }
-                //3:澶辫触锛屽湪绛夊緟鑺傜偣璁惧纭鏄惁瑙i櫎缁戝畾鎴愬姛
-                else if (data.Result == 3)
-                {
-                    //鍏朵粬缁戝畾鐩爣姝e湪鍒犻櫎涓紝璇风◢鍚庡啀璇�
-                    string msg = Language.StringByID(R.MyInternationalizationString.uOtherBindTargetsIsDelettingPleaseWait);
-                    this.ShowErrorMsg(msg);
-                    return false;
-                }
-                //2锛氭湭鐭ワ紝鐢辫妭鐐硅澶囧弽棣堝彂閫佲�淏ind/BindResult鈥濅富棰樻秷鎭‘瀹氭槸鍚︽垚鍔�
-                else if (data.Result == 2)
-                {
-                    if (result.removeBindResultResponseData == null)
-                    {
-                        //鍒犻櫎缁戝畾鐩爣澶辫触
-                        string msg = Language.StringByID(R.MyInternationalizationString.uDeleteBindTargetsFail);
-                        this.ShowErrorMsg(msg);
-                        return false;
-                    }
-                    else
-                    {
-                        //鎴愬姛
-                        if (result.removeBindResultResponseData.Result == 0)
-                        {
-                            return true;
-                        }
-                        //136锛氭帶鍒惰澶囨湰鍦扮粦瀹氬垪琛ㄤ腑鏃犳缁戝畾
-                        else if (result.removeBindResultResponseData.Result == 136)
-                        {
-                            //杩欎釜鍙互褰撳仛鎴愬姛
-                            return true;
-                        }
-                        else
-                        {
-                            //鍒犻櫎缁戝畾鐩爣澶辫触
-                            string msg = Language.StringByID(R.MyInternationalizationString.uDeleteBindTargetsFail);
-                            this.ShowErrorMsg(msg);
-                            return false;
-                        }
-                    }
-                }
-            }
-            return false;
-        }
-
+
         /// <summary>
         /// 鍒犻櫎璁惧缁戝畾鐨勭洰鏍�
         /// </summary>

--
Gitblit v1.8.0