From 00ab3ddb140ba8bb88b5cf572b004a85e1da85e9 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期四, 02 一月 2020 19:51:56 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev-tzy' into DEV_GXC

---
 ZigbeeApp/Shared/Phone/ZigBee/Device/Panel.cs | 1119 ++++++---------------------------------------------------
 1 files changed, 132 insertions(+), 987 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Device/Panel.cs b/ZigbeeApp/Shared/Phone/ZigBee/Device/Panel.cs
index 0bc309a..df7711c 100755
--- a/ZigbeeApp/Shared/Phone/ZigBee/Device/Panel.cs
+++ b/ZigbeeApp/Shared/Phone/ZigBee/Device/Panel.cs
@@ -1,6 +1,7 @@
 锘縰sing System;
 using System.Collections.Generic;
 using System.Threading.Tasks;
+using MQTTnet;
 using Newtonsoft.Json.Linq;
 using Shared.Common;
 
@@ -16,7 +17,7 @@
         /// <summary>
         /// 鎸夐敭妯″紡锛堢鏈夊姛鑳斤級
         /// </summary>
-        public int panelMode = -1;
+        public int panelMode = 65535;
         /// <summary>
         ///鎸夐敭寮�鐘舵�侊紙鎸囩ず锛変寒搴�
         /// </summary>
@@ -109,10 +110,11 @@
         /// 鎸夐敭涓缁戝畾鐨勭洰鏍囧垪琛�
         /// </summary>
         public System.Collections.Generic.List<BindListResponseObj> bindList = new System.Collections.Generic.List<BindListResponseObj> { };
+
         /// <summary>
         /// 鎸夐敭鏀寔鐨勭鏈夋ā寮忓垪琛�
         /// </summary>
-        public System.Collections.Generic.List<string> priFunList = new System.Collections.Generic.List<string> { };
+        public System.Collections.Generic.Dictionary<int, string> priDeviceModeFunList = new System.Collections.Generic.Dictionary<int, string> { };
 
         /// <summary>
         /// 绉佹湁鍔熻兘绫�
@@ -1240,8 +1242,8 @@
         #region 閰嶇疆鎸夐敭鎸囩ず鐏潰鏉夸寒搴﹀睘鎬�.
         ///<summary >
         ///閰嶇疆鎸夐敭鎸囩ず鐏潰鏉夸寒搴﹀睘鎬�
-        /// <para>directionsLevel:鎸囩ず鐏寒搴� 0-100</para>
-        /// <para>backlightLevel:鑳屽厜鐏寒搴� 0-100</para>
+        /// <para>directionsLevel:鎸囩ず鐏寒搴� 0-100(杩欎釜鏄偣鍑诲悗鐨勫��)</para>
+        /// <para>backlightLevel:鑳屽厜鐏寒搴� 0-100(杩欎釜鏄偣鍑诲墠鐨勫��)</para>
         /// </summary>
         public async System.Threading.Tasks.Task<ResponseAllData> SetKeyLevelAsync(int directionsLevel, int backlightLevel)
         {
@@ -1940,12 +1942,12 @@
             /// </summary>
             public ErrorResponData errorResponData;
             /// <summary>
-            ///鎸夐敭寮�鐘舵�侊紙鎸囩ず锛変寒搴�
+            ///鎸夐敭寮�鐘舵�侊紙鎸囩ず锛変寒搴�(杩欎釜鏄偣鍑诲悗鐨勫��)
             /// </summary>
             public int panelDirectionsLevel = -1;
 
             /// <summary>
-            /// 鎸夐敭鍏崇姸鎬侊紙鑳屽厜锛変寒搴�
+            /// 鎸夐敭鍏崇姸鎬侊紙鑳屽厜锛変寒搴�(杩欎釜鏄偣鍑诲墠鐨勫��)
             /// </summary>
             public int panelBacklightLevel = -1;
         }
@@ -2527,7 +2529,7 @@
         ///閰嶇疆闈㈡澘鍔熻兘
         ///<para>value:缁欓潰鏉块厤缃殑妯″紡</para>
         /// </summary>
-        public async System.Threading.Tasks.Task<SetWritableValueResponAllData> ConfigureHdlKeyValueAsync(KeyMode value)
+        public async System.Threading.Tasks.Task<SetWritableValueResponAllData> ConfigureHdlKeyValueAsync(KeyMode value, int clusterID = 6)
         {
             if (Gateway == null)
             {
@@ -2576,7 +2578,7 @@
                 System.Console.WriteLine("SetWritableValue_Actions 鍚姩" + "_" + System.DateTime.Now.ToString());
                 try
                 {
-                    var jObject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", DeviceEpoint }, { "Cluster_ID", 6 }, { "Command", 120 } };
+                    var jObject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", DeviceEpoint }, { "Cluster_ID", clusterID }, { "Command", 120 } };
                     var data = new JObject { { "Undivided", 0 }, { "AttributeId", 6533 }, { "AttributeDataType", 33 }, { "AttributeData", (int)value } };
                     jObject.Add("Data", data);
                     Gateway.Send("SetWritableValue", jObject.ToString());
@@ -2818,993 +2820,136 @@
         }
         #endregion
 
-        //#region 璁惧缁戝畾
-        ///// <summary>
-        /////璁惧缁戝畾
-        ///// </summary>
-        //public async System.Threading.Tasks.Task<AddedDeviceBindResponseAllData> AddDeviceBindAsync(AddBindData addBindData)
-        //{
-        //    return await System.Threading.Tasks.Task.Run(async () =>
-        //    {
-        //        var result = new AddedDeviceBindResponseAllData();
-        //        var mainGateway = ZbGateway.MainGateWay;
-        //        if (mainGateway == null)
-        //        {
-        //            result.errorMessageBase = "褰撳墠娌℃湁涓荤綉鍏�";
-        //            return result;
-        //        }
-        //        Action<string, string> action = (topic, message) =>
-        //        {
-        //            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
-        //            var gatewayID = topic.Split('/')[0];
-        //            var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
-        //            if (topic == gatewayID + "/" + "Error_Respon")
-        //            {
-        //                var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID };
-        //                var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString());
+        #region 鑾峰彇缃戝叧涓殑鍦烘櫙
+        /// <summary>
+        /// 鍙兘鑾峰彇鍦烘櫙淇℃伅锛屾病鏈夊満鏅腑鐨勮澶囦俊鎭�
+        /// </summary>
+        /// <returns></rxeturns>
+        public async System.Threading.Tasks.Task<GetOnlySceneAllData> GetSceneInfoAsync()
+        {
+            GetOnlySceneAllData result = null;
+            if (ZbGateway.MainGateWay == null)
+            {
+                result = new GetOnlySceneAllData { errorMessageBase = "娌℃湁涓荤綉鍏�" };
+            }
+            return await System.Threading.Tasks.Task.Run(async () =>
+            {
+                Action<string, string> action = (topic, message) =>
+                {
+                    var gatewayID = topic.Split('/')[0];
+                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+                    if (topic == gatewayID + "/" + "Error_Respon")
+                    {
+                        var tempResult = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
+                        if (tempResult == null)
+                        {
+                            result = new GetOnlySceneAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+                        }
+                        else
+                        {
+                            result = new GetOnlySceneAllData { errorResponData = tempResult };
+                        }
+                    }
 
-        //                if (temp == null)
-        //                {
-        //                    result.errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖";
-        //                }
-        //                else
-        //                {
-        //                    result.errorResponData = temp;
-        //                    result.errorMessageBase = ErrorMess(temp.Error);
-        //                }
-        //            }
-        //            else if (topic == gatewayID + "/" + "Bind/SetBind_Respon")
-        //            {
-        //                var gatewayTemp = new ZbGateway() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID };
-        //                //var tempBindName = Newtonsoft.Json.JsonConvert.DeserializeObject<string>(jobject["Data"]["BindName"].ToString());
-        //                var tempBindList = Newtonsoft.Json.Linq.JArray.Parse(jobject["Data"]["BindList"].ToString());
-        //                if (tempBindList == null)
-        //                {
-        //                    result.errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�";
-        //                }
-        //                else
-        //                {
-        //                    var dataBindRes = new AddedDeviceBindResponseData();
-        //                    for (int m = 0; tempBindList != null && m < tempBindList.Count; m++)
-        //                    {
-        //                        var tempBind = tempBindList[m];
-        //                        dataBindRes.BindList.Add(Newtonsoft.Json.JsonConvert.DeserializeObject<AddBindListResponseObj>(tempBind.ToString()));
-        //                    }
-        //                    if (dataBindRes != null)
-        //                    {
-        //                        result.addedDeviceBindResponseData = dataBindRes;
-        //                        System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
-        //                    }
-        //                }
-        //            }
-        //            else if (topic == gatewayID + "/" + "Bind/BindResult")
-        //            {
-        //                var gatewayTemp = new ZbGateway() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID };
-        //                var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<AddBindResultResponseData>(jobject["Data"].ToString());
+                    if (topic == gatewayID + "/" + "Scene/GetInfo_Respon")
+                    {
+                        var getSceneInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<GetSceneInfo>(jobject["Data"].ToString());
+                        if (getSceneInfo == null)
+                        {
+                            result = new GetOnlySceneAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+                        }
+                        else
+                        {
+                            result = new GetOnlySceneAllData { getSceneInfo = getSceneInfo };
+                        }
+                    }
+                };
+                ZbGateway.MainGateWay.Actions += action;
+                System.Console.WriteLine("Scene/GetInfo_Actions 鍚姩" + System.DateTime.Now.ToString());
+                var jobjectData = new JObject { { "Cluster_ID", 0 }, { "Command", 805 } };
+                await ZbGateway.MainGateWay.Send(("Scene/GetInfo"), System.Text.Encoding.UTF8.GetBytes(jobjectData.ToString()));
 
-        //                if (tempData != null)
-        //                {
-        //                    result.addBindResultResponseData = tempData;
-        //                }
-        //            }
-        //        };
-        //        mainGateway.Actions += action;
-        //        System.Console.WriteLine("Bind/SetBind_Actions 鍚姩" + "_" + System.DateTime.Now.ToString());
-        //        try
-        //        {
-        //            if (addBindData != null)
-        //            {
-        //                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);
-        //                mainGateway.Send("Bind/SetBind", jObject.ToString());
-        //            }
-        //        }
-        //        catch
-        //        {
-        //        }
-
-        //        var dateTime = DateTime.Now;
-        //        while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
-        //        {
-        //            await System.Threading.Tasks.Task.Delay(100);
-        //            if (result == null || result.addedDeviceBindResponseData == null)
-        //            {
-        //                continue;
-        //            }
-        //            if (0 < result.addedDeviceBindResponseData.BindList.FindAll((obj) => obj.BindType == 0).Count)
-        //            {
-        //                if (result.addBindResultResponseData != null)
-        //                {
-        //                    break;
-        //                }
-        //            }
-        //            else
-        //            {
-        //                break;
-        //            }
-        //        }
-        //        if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
-        //        {
-        //            result.errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔";
-        //        }
-        //        mainGateway.Actions -= action;
-        //        System.Console.WriteLine($"Bind/SetBind_Actions 閫�鍑� {System.DateTime.Now}");
-        //        return result;
-        //    });
-        //}
-
-        ///// <summary>
-        ///// 缁戝畾璁惧淇℃伅,缃戝叧鍙嶉淇℃伅
-        ///// </summary>
-        //public AddedDeviceBindResponseAllData addedDeviceBindResponseAllData;
-        //[System.Serializable]
-        //public class AddedDeviceBindResponseAllData
-        //{
-        //    /// <summary>
-        //    /// 閿欒淇℃伅
-        //    /// </summary>
-        //    public string errorMessageBase;
-        //    /// <summary>
-        //    /// 缃戝叧淇℃伅閿欒鍙嶉
-        //    /// <para>褰撶綉鍏虫帴鏀跺埌瀹㈡埛绔俊鎭悗锛屽嚭鐜颁互涓嬪紓甯告儏鍐靛皢鍙嶉閿欒銆�</para>
-        //    /// </summary>
-        //    public ErrorResponData errorResponData;
-        //    /// <summary>
-        //    /// 缃戝叧鐩存帴鍙嶉缁戝畾璁惧淇℃伅
-        //    /// </summary>
-        //    public AddedDeviceBindResponseData addedDeviceBindResponseData;
-        //    /// <summary>
-        //    /// 鎸夐敭璁惧鐨勭‘璁ゅ弽棣堢粦瀹氳澶囦俊鎭�
-        //    /// </summary>
-        //    public AddBindResultResponseData addBindResultResponseData;
-        //}
-
-        ///// <summary>
-        ///// 缁戝畾璁惧淇℃伅
-        ///// </summary>
-        //public AddedDeviceBindResponseData addedDeviceBindResponseData;
-        //[System.Serializable]
-        //public class AddedDeviceBindResponseData
-        //{
-        //    /// <summary>
-        //    ///缁戝畾鍚嶇О
-        //    /// </summary>
-        //    public string BindName;
-        //    /// <summary>
-        //    ///缁戝畾鍒楄〃 锛屽綋Status=0鏃跺瓨鍦�
-        //    /// </summary>
-        //    public List<AddBindListResponseObj> BindList = new List<AddBindListResponseObj>();
-        //}
-
-        ///// <summary>
-        ///// 缁戝畾鍒楄〃鐨勪俊鎭�
-        ///// </summary>
-        //[System.Serializable]
-        //public class AddBindListResponseObj : BindListResponseObj
-        //{
-        //    /// <summary>
-        //    /// 0锛氬姞鍏ユ垚鍔燂紙璇ョ姸鎬佸彧閫傜敤鐢ㄤ簬璺ㄧ綉鍏崇粦瀹氬拰缁戝畾鍦烘櫙銆傚悓缃戝叧璁惧闂寸殑缁戝畾闇�瑕佽妭鐐硅澶囩殑纭鎴愬姛淇℃伅锛屼笉浼氱洿鎺ュ弽棣堟垚鍔熴�傦級
-        //    ///<para>1锛氬け璐ワ紝鑺傜偣璁惧鎴栧満鏅笉瀛樺湪銆�</para>
-        //    ///<para>2锛氭湭鐭ワ紝鐢辫妭鐐硅澶囧弽棣堝彂閫佲�淏ind/BindResult鈥濅富棰樻秷鎭‘瀹氭槸鍚︽垚鍔熴��</para>
-        //    ///<para>3锛氱粦瀹氬凡缁忓瓨鍦ㄣ��</para>
-        //    /// </summary>
-        //    public int Result;
-        //}
-
-        ///// <summary>
-        ///// 鎸夐敭璁惧鐨勭‘璁ょ殑淇℃伅
-        ///// </summary>
-        //[System.Serializable]
-        //public class AddBindResultResponseData
-        //{
-        //    /// <summary>
-        //    ///缁戝畾缁撴灉
-        //    ///<para>0锛氭垚鍔�</para>
-        //    ///<para>140锛氬け璐ワ紝鎺у埗璁惧鐨勭粦瀹氬垪琛ㄥ凡婊�</para>
-        //    ///<para>鍏朵粬锛氬け璐�</para>
-        //    /// </summary>
-        //    public int Result;
-        //    /// <summary>
-        //    /// 缁戝畾鐨刢luster
-        //    /// </summary>
-        //    public int BindCluster;
-        //    /// <summary>
-        //    /// 缁戝畾璁惧Mac鍦板潃锛� 褰揃indType=0鏃跺瓨鍦�
-        //    /// </summary>
-        //    public string BindMacAddr;
-        //    /// <summary>
-        //    /// 缁戝畾璁惧鐨勭鍙e彿锛屽綋BindType=0鏃跺瓨鍦�
-        //    /// </summary>
-        //    public int BindEpoint;
-        //    /// <summary>
-        //    /// 缁戝畾鍦烘櫙锛屽綋BindType=2鏃跺瓨鍦�
-        //    /// </summary>
-        //    public int BindScenesId;
-        //    /// <summary>
-        //    /// 缁戝畾璁惧鐨勫悕绉�
-        //    /// </summary>
-        //    public string DeviceName;
-        //}
-
-        ///// <summary>
-        ///// 缁戝畾璁惧鐨勬暟鎹�
-        ///// </summary>
-        //public AddBindData addBindData;
-        //[System.Serializable]
-        //public class AddBindData
-        //{
-        //    /// <summary>
-        //    /// 鎺у埗璁惧鑺傜偣鐨刴ac鍦板潃
-        //    /// </summary>
-        //    public string DeviceAddr;
-        //    /// <summary>
-        //    /// 閿欒淇℃伅
-        //    /// </summary>
-        //    public int Epoint;
-        //    /// <summary>
-        //    ///缁戝畾鍚嶇О锛屼笉淇敼鍚嶇О鏃跺拷鐣ヨ閫夐」
-        //    /// </summary>
-        //    public string BindName;
-        //    /// <summary>
-        //    ///缁戝畾鍒楄〃锛屼笉淇敼缁戝畾鍒楄〃鏃跺拷鐣ヨ閫夐」銆�
-        //    /// </summary>
-        //    public List<AddBindListObj> BindList = new List<AddBindListObj>();
-        //}
-
-        ///// <summary>
-        ///// 鎺у埗璁惧缁戝畾鐨勪俊鎭�
-        ///// </summary>
-        //[System.Serializable]
-        //public class AddBindListObj
-        //{
-        //    /// <summary>
-        //    /// 缁戝畾绫诲瀷
-        //    ///<para>0锛氱粦瀹氳澶� </para>
-        //    ///<para>1锛氱粦瀹氬満鏅�</para>
-        //    /// </summary>
-        //    public int BindType;
-        //    /// <summary>
-        //    /// 缁戝畾鐨刢luster,闇�瑕佹帶鍒惰澶囩殑OutCluster鍒楄〃涓瓨鍦ㄨcluster銆�
-        //    ///濡傜粦瀹氭煇涓澶囩殑on/off锛屼负6銆�
-        //    /// </summary>
-        //    public int BindCluster;
-        //    /// <summary>
-        //    /// 缁戝畾璁惧Mac鍦板潃锛� 褰揃indType=0鏃跺瓨鍦�
-        //    /// </summary>
-        //    public string BindMacAddr;
-        //    /// <summary>
-        //    /// 缁戝畾璁惧鐨勭鍙e彿锛屽綋BindType=0鏃跺瓨鍦�
-        //    /// </summary>
-        //    public int BindEpoint;
-        //    /// <summary>
-        //    /// 缁戝畾鍦烘櫙锛屽綋BindType=1鏃跺瓨鍦�
-        //    /// </summary>
-        //    public int BindScenesId;
-        //}
-        //#endregion
-
-        //#region 瑙i櫎缁戝畾
-        ///// <summary>
-        ///// 瑙i櫎缁戝畾
-        ///// </summary>
-        //public async System.Threading.Tasks.Task<DelDeviceBindResponseAllData> DelDeviceBindAsync(DelDeviceBindData delDeviceBindData)
-        //{
-        //    return await System.Threading.Tasks.Task.Run(async () =>
-        //    {
-        //        var responseData = new DelDeviceBindResponseAllData();
-        //        var mainGateway = ZbGateway.MainGateWay;
-        //        if (mainGateway == null)
-        //        {
-        //            responseData.errorMessageBase = "褰撳墠娌℃湁涓荤綉鍏�";
-        //            return responseData;
-        //        }
-
-        //        Action<string, string> action = (topic, message) =>
-        //        {
-        //            var gatewayID = topic.Split('/')[0];
-        //            var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
-
-        //            if (topic == gatewayID + "/" + "Error_Respon")
-        //            {
-        //                var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID };
-        //                var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString());
-
-        //                if (temp == null)
-        //                {
-        //                    responseData.errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖";
-        //                }
-        //                else
-        //                {
-        //                    responseData.errorResponData = temp;
-        //                    responseData.errorMessageBase = ErrorMess(temp.Error);
-        //                }
-        //            }
-
-        //            if (topic == gatewayID + "/" + "Bind/RemoveBind_Respon")
-        //            {
-        //                var gatewayTemp = new ZbGateway() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID };
-        //                var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<DelDeviceBindResponseData>(jobject["Data"].ToString());
-
-        //                if (tempData == null)
-        //                {
-        //                    responseData.errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�";
-
-        //                }
-        //                else
-        //                {
-        //                    responseData.delDeviceBindResponseData = tempData;
-        //                    System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
-        //                }
-        //            }
-
-        //            if (topic == gatewayID + "/" + "Bind/RemoveBindResult")
-        //            {
-        //                var gatewayTemp = new ZbGateway() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID };
-        //                var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<RemoveBindResultResponseData>(jobject["Data"].ToString());
-
-        //                if (tempData != null)
-        //                {
-        //                    responseData.removeBindResultResponseData = tempData;
-        //                    System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
-        //                }
-        //            }
-        //        };
-        //        mainGateway.Actions += action;
-        //        System.Console.WriteLine("DeviceBind/DelBind_Actions 鍚姩" + "_" + System.DateTime.Now.ToString());
-        //        try
-        //        {
-        //            if (delDeviceBindData != null)
-        //            {
-        //                var jObject = new JObject { { "DeviceAddr", delDeviceBindData.DeviceAddr }, { "Epoint", delDeviceBindData.Epoint }, { "Cluster_ID", 0 }, { "Command", 5003 } };
-        //                var removeBindList = new JArray { };
-        //                foreach (var removeBindInfo in delDeviceBindData.RemoveBindList)
-        //                {
-        //                    if (removeBindInfo.BindType == 0)
-        //                    {
-        //                        var dInfo = new JObject{
-        //                    { "BindMacAddr",removeBindInfo.BindMacAddr},
-        //                 { "BindEpoint", removeBindInfo.BindEpoint} ,
-        //                 { "BindCluster", removeBindInfo.BindCluster} ,
-        //                 { "BindType",removeBindInfo.BindType}
-        //                    };
-        //                        removeBindList.Add(dInfo);
-        //                    }
-        //                    else if (removeBindInfo.BindType == 1)
-        //                    {
-        //                        var dInfo = new JObject{
-        //                 { "BindCluster", removeBindInfo.BindCluster} ,
-        //                 { "BindType",removeBindInfo.BindType},
-        //                 { "BindScenesId", removeBindInfo.BindScenesId}
-        //                    };
-        //                        removeBindList.Add(dInfo);
-        //                    }
-        //                }
-        //                var data = new JObject {
-        //            {"RemoveBindList",removeBindList}
-        //             };
-        //                jObject.Add("Data", data);
-        //                mainGateway.Send("Bind/RemoveBind", jObject.ToString());
-        //            }
-        //        }
-        //        catch { }
-
-
-        //        var dateTime = DateTime.Now;
-        //        while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
-        //        {
-        //            await System.Threading.Tasks.Task.Delay(100);
-        //            if (responseData == null || responseData.delDeviceBindResponseData == null)
-        //            {
-        //                continue;
-        //            }
-        //            if (0 < responseData.delDeviceBindResponseData.RemoveBindList.FindAll((obj) => obj.BindType == 0).Count)
-        //            {
-        //                if (responseData.removeBindResultResponseData != null)
-        //                {
-        //                    break;
-        //                }
-        //            }
-        //            else
-        //            {
-        //                break;
-        //            }
-        //        }
-
-        //        if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
-        //        {
-        //            responseData.errorMessageBase = "鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔";
-        //        }
-        //        mainGateway.Actions -= action;
-        //        System.Console.WriteLine("DeviceBind/DelBind_Actions 閫�鍑�" + System.DateTime.Now.ToString());
-
-        //        return responseData;
-        //    });
-        //}
-
-        ///// <summary>
-        /////瑙i櫎缁戝畾鏁版嵁,缃戝叧鍙嶉淇℃伅
-        ///// </summary>
-        //public DelDeviceBindResponseAllData delDeviceBindResponseAllData;
-        ///// <summary>
-        /////瑙i櫎缁戝畾鏁版嵁,缃戝叧鍙嶉淇℃伅
-        ///// </summary>
-        //[System.Serializable]
-        //public class DelDeviceBindResponseAllData
-        //{
-        //    /// <summary>
-        //    /// 閿欒淇℃伅
-        //    /// </summary>
-        //    public string errorMessageBase;
-        //    /// <summary>
-        //    /// 缃戝叧淇℃伅閿欒鍙嶉
-        //    /// <para>褰撶綉鍏虫帴鏀跺埌瀹㈡埛绔俊鎭悗锛屽嚭鐜颁互涓嬪紓甯告儏鍐靛皢鍙嶉閿欒銆�</para>
-        //    /// </summary>
-        //    public ErrorResponData errorResponData;
-        //    /// <summary>
-        //    /// 瑙i櫎缁戝畾鏁版嵁淇℃伅
-        //    /// </summary>
-        //    public DelDeviceBindResponseData delDeviceBindResponseData;
-
-        //    /// <summary>
-        //    /// 瑙i櫎缁戝畾鎸夐敭纭鏁版嵁淇℃伅
-        //    /// </summary>
-        //    public RemoveBindResultResponseData removeBindResultResponseData;
-        //}
-
-        ///// <summary>
-        ///// 瑙i櫎缁戝畾鏁版嵁
-        ///// </summary>
-        //public DelDeviceBindResponseData delDeviceBindResponseData;
-        ///// <summary>
-        ///// 瑙i櫎缁戝畾鏁版嵁
-        ///// </summary>
-        //[System.Serializable]
-        //public class DelDeviceBindResponseData
-        //{
-        //    /// <summary>
-        //    ///缁戝畾鍒楄〃 锛屽綋Status=0鏃跺瓨鍦�
-        //    /// </summary>
-        //    public List<RemoveBindListResponseObj> RemoveBindList = new List<RemoveBindListResponseObj>();
-        //}
-
-        ///// <summary>
-        ///// 绉婚櫎璁惧缁戝畾鐨勪俊鎭�
-        ///// </summary>
-        //[System.Serializable]
-        //public class RemoveBindListResponseObj : BindListResponseObj
-        //{
-        //    /// <summary>
-        //    /// 0锛氱Щ闄ゆ垚鍔燂紙璇ョ姸鎬佸彧閫傜敤鐢ㄤ簬璺ㄧ綉鍏崇粦瀹氥�佺粦瀹氬満鏅�佸け鏁堣澶囷紙璁惧宸茬粡浠庣綉鍏崇殑璁惧鍒楄〃涓垹闄わ級銆傚悓缃戝叧璁惧闂寸殑瑙i櫎缁戝畾闇�瑕佽妭鐐硅澶囩殑纭鎴愬姛淇℃伅锛屼笉浼氱洿鎺ュ弽棣堟垚鍔熴�傦級
-        //    ///<para>1锛氬け璐ワ紝璁惧涓嶅湪缁戝畾鍒楄〃涓�</para>
-        //    ///<para>3锛氬け璐ワ紝鍦ㄧ瓑寰呰妭鐐硅澶囩‘璁ゆ槸鍚﹁В闄ょ粦瀹氭垚鍔燂紙褰撶綉鍏宠繕鍦ㄧ瓑寰呮煇鑺傜偣璁惧纭鏄惁瑙i櫎缁戝畾鎴愬姛鐨勫弽棣堜俊鎭椂锛屽鎴风鍐嶆鍙戦�佽В闄ょ粦瀹氳鑺傜偣璁惧鐨勬寚浠わ紝灏嗗弽棣堣鐘舵�併�傦級</para>
-        //    ///<para>4锛氭湭鐭ワ紝鐢辫妭鐐硅澶囧弽棣堝彂閫佲�淏ind/RemoveBindResult鈥濅富棰樻秷鎭‘瀹氭槸鍚︽垚鍔熴��</para>
-        //    /// </summary>
-        //    public int Result;
-
-        //}
-
-        ///// <summary>
-        ///// 绉婚櫎璁惧缁戝畾鎸夐敭纭鐨勪俊鎭�
-        ///// </summary>
-        //[System.Serializable]
-        //public class RemoveBindResultResponseData
-        //{
-        //    /// <summary>
-        //    ///缁戝畾缁撴灉
-        //    ///<para>0锛氭垚鍔�</para>
-        //    ///<para>136锛氭帶鍒惰澶囨湰鍦扮粦瀹氬垪琛ㄤ腑鏃犳缁戝畾</para>
-        //    ///<para>鍏朵粬锛氬け璐�</para>
-        //    /// </summary>
-        //    public int Result;
-
-        //    /// <summary>
-        //    /// 缁戝畾璁惧Mac鍦板潃
-        //    /// </summary>
-        //    public string BindMacAddr;
-        //    /// <summary>
-        //    /// 缁戝畾璁惧鐨勭鍙e彿
-        //    /// </summary>
-        //    public int BindEpoint;
-        //    /// <summary>
-        //    /// 缁戝畾鐨刢luster
-        //    /// </summary>
-        //    public int BindCluster;
-        //    /// <summary>
-        //    /// 缁戝畾璁惧鍚嶇О
-        //    /// </summary>
-        //    public string DeviceName;
-        //}
-
-        ///// <summary>
-        ///// 瑙i櫎缁戝畾鏁版嵁
-        ///// </summary>
-        //public DelDeviceBindData delDeviceBindData;
-        ///// <summary>
-        ///// 瑙i櫎缁戝畾鏁版嵁
-        ///// </summary>
-        //[System.Serializable]
-        //public class DelDeviceBindData
-        //{
-        //    /// <summary>
-        //    /// 鎺у埗璁惧鑺傜偣鐨刴ac鍦板潃
-        //    /// </summary>
-        //    public string DeviceAddr;
-        //    /// <summary>
-        //    /// 閿欒淇℃伅
-        //    /// </summary>
-        //    public int Epoint;
-        //    /// <summary>
-        //    ///缁戝畾鍒楄〃 锛屽綋Status=0鏃跺瓨鍦�
-        //    /// </summary>
-        //    public List<RemoveBindListObj> RemoveBindList = new List<RemoveBindListObj>();
-        //}
-
-        ///// <summary>
-        ///// 绉婚櫎璁惧缁戝畾鐨勪俊鎭�
-        ///// </summary>
-        //[System.Serializable]
-        //public class RemoveBindListObj
-        //{
-
-        //    /// <summary>
-        //    /// 缁戝畾绫诲瀷
-        //    ///<para>0锛氱Щ闄よ澶� </para>
-        //    ///<para>1锛氱Щ闄ゅ満鏅�</para>
-        //    /// </summary>
-        //    public int BindType;
-        //    /// <summary>
-        //    /// 缁戝畾鐨刢luster
-        //    /// </summary>
-        //    public int BindCluster;
-        //    /// <summary>
-        //    /// 缁戝畾璁惧Mac鍦板潃锛� 褰揃indType=0鏃跺瓨鍦�
-        //    /// </summary>
-        //    public string BindMacAddr;
-        //    /// <summary>
-        //    /// 缁戝畾璁惧鐨勭鍙e彿锛屽綋BindType=0鏃跺瓨鍦�
-        //    /// </summary>
-        //    public int BindEpoint;
-        //    /// <summary>
-        //    /// 缁戝畾鍦烘櫙锛屽綋BindType=1鏃跺瓨鍦�
-        //    /// </summary>
-        //    public int BindScenesId;
-        //}
-        //#endregion
-
-        //#region 鑾峰彇鎵�鏈夌粦瀹�
-        ///// <summary>
-        /////鑾峰彇鎵�鏈夌粦瀹�
-        ///// </summary>
-        //public async System.Threading.Tasks.Task<GetDeviceBindResponseAllData> GetDeviceBindAsyncAsync()
-        //{
-        //    return await System.Threading.Tasks.Task.Run(async () =>
-        //    {
-        //        GetDeviceBindResponseAllData d = null;
-        //        var mainGateway = ZbGateway.MainGateWay;
-        //        if (mainGateway == null)
-        //        {
-        //            d = new GetDeviceBindResponseAllData { errorMessageBase = "褰撳墠娌℃湁涓荤綉鍏�" };
-        //            return d;
-        //        }
-
-        //        Action<string, string> action = (topic, message) =>
-        //        {
-        //            var gatewayID = topic.Split('/')[0];
-        //            var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
-
-        //            if (topic == gatewayID + "/" + "Error_Respon")
-        //            {
-        //                var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID };
-        //                var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString());
-
-        //                if (temp == null)
-        //                {
-        //                    d = new GetDeviceBindResponseAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
-        //                }
-        //                else
-        //                {
-        //                    d = new GetDeviceBindResponseAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
-        //                }
-        //            }
-
-        //            if (topic == gatewayID + "/" + "Bind/GetDeviceBind_Respon")
-        //            {
-        //                var gatewayTemp = new ZbGateway() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID };
-        //                var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<GetDeviceBindResponseData>(jobject["Data"].ToString());
-        //                //var tempBindList = Newtonsoft.Json.Linq.JArray.Parse(jobject["Data"]["BindList"].ToString());
-        //                if (tempData == null)
-        //                {
-        //                    d = new GetDeviceBindResponseAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
-        //                }
-        //                else
-        //                {
-        //                    d = new GetDeviceBindResponseAllData { getAllBindResponseData = tempData };
-        //                    System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
-        //                }
-        //            }
-        //        };
-        //        mainGateway.Actions += action;
-
-        //        try
-        //        {
-        //            System.Console.WriteLine("Bind/GetDeviceBind_Actions 鍚姩" + "_" + System.DateTime.Now.ToString());
-        //            var jObject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", DeviceEpoint }, { "Cluster_ID", 0 }, { "Command", 5007 } };
-        //            mainGateway.Send("Bind/GetDeviceBind", jObject.ToString());
-        //        }
-        //        catch { }
-
-        //        var dateTime = DateTime.Now;
-        //        while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
-        //        {
-        //            await System.Threading.Tasks.Task.Delay(10);
-        //            if (d != null)
-        //            {
-        //                break;
-        //            }
-        //        }
-        //        if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
-        //        {
-        //            d = new GetDeviceBindResponseAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
-        //        }
-        //        mainGateway.Actions -= action;
-        //        System.Console.WriteLine("Bind/GetDeviceBind_Actions 閫�鍑�" + System.DateTime.Now.ToString());
-
-        //        return d;
-        //    });
-        //}
-
-        ///// <summary>
-        /////鑾峰彇鎵�鏈夌粦瀹氭暟鎹�,缃戝叧鍙嶉淇℃伅
-        ///// </summary>
-        //public GetDeviceBindResponseAllData getAllBindResponseAllData;
-        //[System.Serializable]
-        //public class GetDeviceBindResponseAllData
-        //{
-        //    /// <summary>
-        //    /// 閿欒淇℃伅
-        //    /// </summary>
-        //    public string errorMessageBase;
-        //    /// <summary>
-        //    /// 缃戝叧淇℃伅閿欒鍙嶉
-        //    /// <para>褰撶綉鍏虫帴鏀跺埌瀹㈡埛绔俊鎭悗锛屽嚭鐜颁互涓嬪紓甯告儏鍐靛皢鍙嶉閿欒銆�</para>
-        //    /// </summary>
-        //    public ErrorResponData errorResponData;
-        //    /// <summary>
-        //    /// 鎺у埗璁惧缁戝畾鐨勮澶囧垪琛ㄥ洖澶嶆暟鎹�
-        //    /// </summary>
-        //    public GetDeviceBindResponseData getAllBindResponseData;
-        //}
-
-        ///// <summary>
-        ///// 鑾峰彇鎵�鏈夌粦瀹氬洖澶嶇殑鏁版嵁
-        ///// </summary>
-        //public GetDeviceBindResponseData getAllBindResponseData;
-        //[System.Serializable]
-        //public class GetDeviceBindResponseData
-        //{
-        //    /// <summary>
-        //    /// 0锛氭垚鍔�
-        //    ///<para>1锛氱粦瀹氫笉瀛樺湪</para>
-        //    /// </summary>
-        //    public int Result;
-        //    /// <summary>
-        //    /// 缁戝畾鍒楄〃 锛屽綋Status=0鏃跺瓨鍦ㄣ��
-        //    /// </summary>
-        //    public List<BindListResponseObj> BindList = new List<BindListResponseObj>();
-        //}
-
-        ///// <summary>
-        ///// 鑾峰彇鎵�鏈夌粦瀹氱殑淇℃伅
-        ///// </summary>
-        //public class BindListResponseObj
-        //{
-        //    /// <summary>
-        //    /// 缁戝畾绫诲瀷
-        //    ///<para>0锛氱Щ闄よ澶囷紝鍚岀綉鍏宠澶囬棿鐨勭Щ闄�</para>
-        //    ///<para>1锛氱Щ闄よ澶囷紝璺ㄧ綉鍏宠澶囬棿鐨勭Щ闄�</para>
-        //    ///<para>2锛氱Щ闄ょ粦瀹氬満鏅�</para>
-        //    /// </summary>
-        //    public int BindType;
-        //    /// <summary>
-        //    /// 缁戝畾鐨刢luster
-        //    /// </summary>
-        //    public int BindCluster;
-        //    /// <summary>
-        //    /// 缁戝畾璁惧Mac鍦板潃锛� 褰揃indType=0鏃跺瓨鍦�
-        //    /// </summary>
-        //    public string BindMacAddr;
-        //    /// <summary>
-        //    /// 缁戝畾璁惧鐨勭鍙e彿锛屽綋BindType=0鏃跺瓨鍦�
-        //    /// </summary>
-        //    public int BindEpoint;
-        //    /// <summary>
-        //    /// 缁戝畾鍦烘櫙锛屽綋BindType=1鏃跺瓨鍦�
-        //    /// </summary>
-        //    public int BindScenesId;
-        //    /// <summary>
-        //    /// 缁戝畾鐨勮澶囨垨鍦烘櫙鍚嶇О
-        //    /// </summary>
-        //    public string ESName;
-        //}
-        //#endregion
-
-        //#region 鍒犻櫎涓�涓帶鍒惰澶囨墍鏈夌粦瀹氫俊鎭�
-        ///// <summary>
-        /////鍒犻櫎涓�涓帶鍒惰澶囨墍鏈夌粦瀹氫俊鎭�
-        ///// </summary>
-        //public async System.Threading.Tasks.Task<ClearBindInfoResponseAllData> ClearBindInfoAsync()
-        //{
-        //    if (Gateway == null)
-        //    {
-        //        return null;
-        //    }
-        //    return await System.Threading.Tasks.Task.Run(async () =>
-        //    {
-        //        ClearBindInfoResponseAllData d = null;
-        //        Action<string, string> action = (topic, message) =>
-        //        {
-        //            var gatewayID = topic.Split('/')[0];
-        //            var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
-
-        //            if (topic == gatewayID + "/" + "Error_Respon")
-        //            {
-        //                var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID };
-        //                var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString());
-
-        //                if (temp == null)
-        //                {
-        //                    d = new ClearBindInfoResponseAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
-        //                }
-        //                else
-        //                {
-        //                    d = new ClearBindInfoResponseAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
-        //                }
-        //            }
-
-        //            if (topic == gatewayID + "/" + "Bind/ClearBindInfo_Respon")
-        //            {
-        //                var gatewayTemp = new ZbGateway() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID };
-        //                var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<ClearBindInfoResponseData>(jobject["Data"].ToString());
-        //                if (tempData == null)
-        //                {
-        //                    d = new ClearBindInfoResponseAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
-        //                }
-        //                else
-        //                {
-        //                    d = new ClearBindInfoResponseAllData { clearBindInfoResponseData = tempData };
-        //                    System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
-        //                }
-        //            }
-        //        };
-        //        Gateway.Actions += action;
-        //        System.Console.WriteLine("Bind/ClearBindInfo_Actions 鍚姩" + "_" + System.DateTime.Now.ToString());
-
-        //        try
-        //        {
-        //            var jObject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", DeviceEpoint }, { "Cluster_ID", 0 }, { "Command", 5006 } };
-        //            Gateway.Send("Bind/ClearBindInfo", jObject.ToString());
-        //        }
-        //        catch { }
-
-        //        var dateTime = DateTime.Now;
-        //        while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
-        //        {
-        //            await System.Threading.Tasks.Task.Delay(10);
-        //            if (d != null)
-        //            {
-        //                break;
-        //            }
-        //        }
-        //        if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
-        //        {
-        //            d = new ClearBindInfoResponseAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
-        //        }
-        //        Gateway.Actions -= action;
-        //        System.Console.WriteLine("Bind/ClearBindInfo_Actions 閫�鍑�" + System.DateTime.Now.ToString());
-
-        //        return d;
-        //    });
-        //}
-
-        ///// <summary>
-        /////鍒犻櫎涓�涓帶鍒惰澶囨墍鏈夌粦瀹氭暟鎹�,缃戝叧鍙嶉淇℃伅
-        ///// </summary>
-        //public ClearBindInfoResponseAllData clearBindInfoResponseAllData;
-        //[System.Serializable]
-        //public class ClearBindInfoResponseAllData
-        //{
-        //    /// <summary>
-        //    /// 閿欒淇℃伅
-        //    /// </summary>
-        //    public string errorMessageBase;
-        //    /// <summary>
-        //    /// 缃戝叧淇℃伅閿欒鍙嶉
-        //    /// <para>褰撶綉鍏虫帴鏀跺埌瀹㈡埛绔俊鎭悗锛屽嚭鐜颁互涓嬪紓甯告儏鍐靛皢鍙嶉閿欒銆�</para>
-        //    /// </summary>
-        //    public ErrorResponData errorResponData;
-        //    /// <summary>
-        //    /// 鎺у埗璁惧缁戝畾鐨勮澶囧垪琛ㄥ洖澶嶆暟鎹�
-        //    /// </summary>
-        //    public ClearBindInfoResponseData clearBindInfoResponseData;
-        //}
-
-        ///// <summary>
-        ///// 鍒犻櫎涓�涓帶鍒惰澶囨墍鏈夌粦瀹氫俊鎭洖澶嶇殑鏁版嵁
-        ///// </summary>
-        //public ClearBindInfoResponseData clearBindInfoResponseData;
-        //[System.Serializable]
-        //public class ClearBindInfoResponseData
-        //{
-        //    /// <summary>
-        //    /// 0锛氭垚鍔�
-        //    ///<para>1锛氱粦瀹氫俊鎭笉瀛樺湪</para>
-        //    /// </summary>
-        //    public int Result;
-        //}
-
-        //#endregion
+                var dateTime = DateTime.Now;
+                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
+                {
+                    await System.Threading.Tasks.Task.Delay(10);
+                    if (result != null)
+                    {
+                        break;
+                    }
+                }
+                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
+                {
+                    result = new GetOnlySceneAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
+                }
+                return result;
+            });
+        }
+        /// <summary>
+        ///鑾峰彇鍦烘櫙淇℃伅,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        [System.Serializable]
+        public class GetOnlySceneAllData
+        {
+            /// <summary>
+            /// 閿欒淇℃伅
+            /// </summary>
+            public string errorMessageBase;
+            /// <summary>
+            /// 缃戝叧淇℃伅閿欒鍙嶉
+            /// <para>褰撶綉鍏虫帴鏀跺埌瀹㈡埛绔俊鎭悗锛屽嚭鐜颁互涓嬪紓甯告儏鍐靛皢鍙嶉閿欒銆�</para>
+            /// </summary>
+            public ErrorResponData errorResponData;
+            /// <summary>
+            /// 鑾峰彇鍦烘櫙淇℃伅
+            /// </summary>
+            public GetSceneInfo getSceneInfo;
+        }
 
         /// <summary>
-        /// 璇诲彇闈㈡澘鐨勯厤缃俊鎭�(淇℃伅瀛樺埌褰撳墠鐨勫璞″叿浣撳�间腑锛�
+        /// 鑾峰彇鍦烘櫙淇℃伅
         /// </summary>
-        //public void ReadPanelConfigureInfo()
-        //{
-        //    ReadAttri(Device.Cluster_ID.HdlKey, AttriButeId.HdlKey);
-        //}
+        public GetSceneInfo sceneGetInfo;
+        /// <summary>
+        /// 鑾峰彇鍦烘櫙淇℃伅
+        /// </summary>
+        [System.Serializable]
+        public class GetSceneInfo
+        {
+            /// <summary>
+            ///鍦烘櫙鎬绘暟
+            /// </summary>
+            public int ScenesSum;
 
-        //#region 鑾峰彇鎵�鏈夊仛浜嗙粦瀹氱殑鎺у埗璁惧
-        ///// <summary>
-        /////鑾峰彇鎵�鏈夊仛浜嗙粦瀹氱殑鎺у埗璁惧
-        ///// </summary>
-        //public async System.Threading.Tasks.Task<GetControlDeviceBindResponseAllData> GetControlDeviceAsync()
-        //{
-        //    if (Gateway == null)
-        //    {
-        //        return null;
-        //    }
-        //    return await System.Threading.Tasks.Task.Run(async () =>
-        //    {
-        //        var d = new GetControlDeviceBindResponseAllData { };
-        //        Action<string, string> action = (topic, message) =>
-        //        {
-        //            var gatewayID = topic.Split('/')[0];
-        //            var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+            /// <summary>
+            /// 鍦烘櫙鍒楄〃
+            /// </summary>
+            public List<ScenesListInfo> ScenesList = new List<ScenesListInfo>();
+        }
 
-        //            if (topic == gatewayID + "/" + "Error_Respon")
-        //            {
-        //                var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID };
-        //                var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString());
+        /// <summary>
+        /// 鍦烘櫙鍒楄〃涓殑鍏蜂綋淇℃伅
+        /// </summary>
+        [System.Serializable]
+        public class ScenesListInfo
+        {
+            /// <summary>
+            /// 鍦烘櫙ID
+            /// </summary>
+            public int ScenesId;
 
-        //                if (temp == null)
-        //                {
-        //                    d.errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖";
-        //                }
-        //                else
-        //                {
-        //                    d.errorResponData = temp;
-        //                    d.errorMessageBase = ErrorMess(temp.Error);
-        //                }
-        //            }
+            /// <summary>
+            /// 鍚嶇О
+            /// </summary>
+            public string ScenesName;
 
-        //            if (topic == gatewayID + "/" + "DeviceBind_AddBind_Respon")
-        //            {
-        //                var gatewayTemp = new ZbGateway() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID };
-        //                var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<GetControlDeviceBindResponseData>(jobject["Data"].ToString());
-
-        //                if (tempData == null)
-        //                {
-        //                    d.errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�";
-        //                }
-        //                else
-        //                {
-        //                    d.getControlDeviceBindResponseData = tempData;
-        //                }
-        //            }
-        //        };
-        //        Gateway.Actions += action;
-        //        System.Console.WriteLine("GetControlDevice_Actions 鍚姩" + "_" + Gateway.getGatewayBaseInfo.gwID + System.DateTime.Now.ToString());
-
-        //        var jObject = new JObject {{ "Cluster_ID", 0 }, { "Command", 154 } };
-        //        Gateway.Send("DeviceBind/GetControlDevice", jObject.ToString());
-
-        //        var dateTime = DateTime.Now;
-        //        while ((DateTime.Now - dateTime).TotalMilliseconds < 1000)
-        //        {
-        //            await System.Threading.Tasks.Task.Delay(10);
-        //            if (d.getControlDeviceBindResponseData != null)
-        //            {
-        //                break;
-        //            }
-        //        }
-        //        if ((DateTime.Now - dateTime).TotalMilliseconds > 10000)
-        //        {
-        //            d.errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔";
-        //        }
-        //        Gateway.Actions -= action;
-        //        System.Console.WriteLine("GetControlDevice_Actions 閫�鍑�" + System.DateTime.Now.ToString());
-
-        //        return d;
-        //    });
-        //}
-
-        ///// <summary>
-        ///// 鑾峰彇鎵�鏈夊仛浜嗙粦瀹氱殑鎺у埗璁惧鏁版嵁,缃戝叧鍙嶉淇℃伅
-        ///// </summary>
-        //public GetControlDeviceBindResponseAllData getControlDeviceBindResponseAllData;
-        //[System.Serializable]
-        //public class GetControlDeviceBindResponseAllData
-        //{
-        //    /// <summary>
-        //    /// 閿欒淇℃伅
-        //    /// </summary>
-        //    public string errorMessageBase;
-        //    /// <summary>
-        //    /// 缃戝叧淇℃伅閿欒鍙嶉
-        //    /// <para>褰撶綉鍏虫帴鏀跺埌瀹㈡埛绔俊鎭悗锛屽嚭鐜颁互涓嬪紓甯告儏鍐靛皢鍙嶉閿欒銆�</para>
-        //    /// </summary>
-        //    public ErrorResponData errorResponData;
-        //    /// <summary>
-        //    /// 鑾峰彇鎵�鏈夊仛浜嗙粦瀹氱殑鎺у埗璁惧鏁版嵁
-        //    /// </summary>
-        //    public GetControlDeviceBindResponseData getControlDeviceBindResponseData;
-        //}
-
-
-        ///// <summary>
-        ///// 鑾峰彇鎵�鏈夊仛浜嗙粦瀹氱殑鎺у埗璁惧鏁版嵁
-        ///// </summary>
-        //public GetControlDeviceBindResponseData getControlDeviceBindResponseData;
-        //[System.Serializable]
-        //public class GetControlDeviceBindResponseData
-        //{
-        //    /// <summary>
-        //    /// 璁惧灞炴�у垪琛�
-        //    /// </summary>
-        //    public List<DeviceObj> DeviceObj = new List<DeviceObj>();
-        //}
-
-        ///// <summary>
-        ///// Command鏁扮粍
-        ///// </summary>
-        //public class DeviceObj
-        //{
-        //    /// <summary>
-        //    /// 鎺у埗璁惧鐨刴ac鍦板潃
-        //    /// </summary>
-        //    public string DeviceAddr;
-
-        //    /// <summary>
-        //    /// 鎺у埗璁惧鐨勭鍙e彿
-        //    /// </summary>
-        //    public int Epoint;
-        //}
-        //#endregion
+            /// <summary>
+            /// 鏄惁澶勪簬寮�鍚姸鎬�
+            ///0锛氬満鏅病鏈夎寮�鍚�
+            ///1锛氬満鏅浜庡紑鍚姸鎬�
+            /// </summary>
+            public int IsOpen;
+        }
+        #endregion
     }
 }

--
Gitblit v1.8.0