From d6fb0646531172f23648441c224cdcccd721b894 Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期一, 14 十二月 2020 09:59:01 +0800
Subject: [PATCH] 请合并代码,完成晾衣架最终功能。

---
 ZigbeeApp/Shared/Phone/ZigBee/Device/CommonDevice.cs | 6539 +++++++++++++++++++++--------------------------------------
 1 files changed, 2,363 insertions(+), 4,176 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Device/CommonDevice.cs b/ZigbeeApp/Shared/Phone/ZigBee/Device/CommonDevice.cs
old mode 100755
new mode 100644
index 591353e..e71564b
--- a/ZigbeeApp/Shared/Phone/ZigBee/Device/CommonDevice.cs
+++ b/ZigbeeApp/Shared/Phone/ZigBee/Device/CommonDevice.cs
@@ -5,4277 +5,2464 @@
 
 namespace ZigBee.Device
 {
-    [System.Serializable]
-    public class CommonDevice
+  [System.Serializable]
+  public class CommonDevice
+  {
+    #region 闇�瑕佷繚瀛樼殑鍙橀噺
+
+    /// <summary>
+    /// 鏄惁鏄嚜瀹氫箟鍥剧墖
+    /// </summary>
+    public bool IsCustomizeImage = false;
+    /// <summary>
+    /// 璁惧鍥剧墖
+    /// </summary>
+    public string IconPath = string.Empty;
+    /// <summary>
+    /// 璁惧鍥剧墖--鍦ㄧ嚎鎴栬�呴�変腑鐘舵��
+    /// </summary>
+    /// <value>The online icon path.</value>
+    [Newtonsoft.Json.JsonIgnore]
+    public string OnlineIconPath
     {
-        [Newtonsoft.Json.JsonIgnore]
-        public DateTime LastDateTime = DateTime.MinValue;
-
-        /// <summary>
-        /// 璋冭瘯鏃舵墦寮�鎵撳嵃淇℃伅锛宼rue:鎵撳嵃锛宖alse:涓嶆墦鍗�
-        /// </summary>
-        /// <param name="msg">Message.</param>
-        /// <param name="flage">If set to <c>true</c> flage.</param>
-        public static void DebugPrintLog(string msg, bool flage = true)
+      get
+      {
+        if (string.IsNullOrEmpty(IconPath))
         {
-#if DEBUG
-            if (flage == true)
+          return string.Empty;
+        }
+        var pathArr = IconPath.Split('.');
+        if (pathArr == null || string.IsNullOrEmpty(pathArr[0]))
+        {
+          return string.Empty;
+        }
+        return $"{pathArr[0]}Selected.png";
+      }
+    }
+    /// <summary>
+    /// 褰撳墠缃戝叧鐨処D
+    /// </summary>
+    public string CurrentGateWayId;
+    /// <summary>
+    /// 褰撳墠璁惧绫诲瀷
+    /// </summary>
+    [Newtonsoft.Json.JsonIgnore]
+    public DeviceType Type = DeviceType.UnKown;
+    /// <summary>
+    /// 璁惧鐨勫姛鑳界被鍨�(姝ょ被鍨嬬洰鍓嶅彧閽堝缁х數鍣ㄥ洖璺湁鏁�,榛樿鏈寚瀹�)
+    /// </summary>
+    public DeviceFunctionType DfunctionType = DeviceFunctionType.A鏈畾涔�;
+    /// <summary>
+    /// MAC鍦板潃
+    /// </summary>
+    public string DeviceAddr;
+    /// <summary>
+    /// 璁惧绔彛鍙�
+    /// </summary>
+    public int DeviceEpoint;
+    /// <summary>
+    /// 瀹為檯鐨勮澶噄d
+    /// <para>258:color dimmable light,璋冨叧鐏� </para>
+    /// <para>10:Door lock,闂ㄩ攣</para>
+    /// <para>514:Window covering device,绐楀笜</para>
+    /// <para>515:Window covering controller锛岀獥甯樻帶鍒跺櫒</para>
+    /// <para>769:Thermostat,鎭掓俯闈㈡澘/绌鸿皟</para>
+    /// <para>770:Temperature Sensor,娓╁害浼犳劅鍣�</para>
+    /// <para>775:Temperature Sensor,婀垮害浼犳劅鍣�</para>
+    /// <para>262:Light sensor,鍏夌収浼犳劅鍣�</para>
+    /// <para>1026:sensor,浼犳劅鍣紝鍏蜂綋绫诲瀷鐨勪紶鎰熷櫒DeviceType鏉ュ尯鍒�</para>
+    /// </summary>
+    public int DeviceID;
+    /// <summary>
+    /// <para>2020.09.21杩藉姞:涓轰簡瀵瑰簲绗笁鏂硅澶�,浠ュ強涔嬪悗鐨勫璁惧ID闂,杩藉姞鐨勫彉閲�</para>
+    /// <para>杩欐槸涓壒娈婄殑,骞朵笖涓嶄繚瀛樺湪鏂囦欢褰撲腑鐨処D, DeviceType鐢辨鍊兼槧灏勫嚭鏉�</para>
+    /// <para>褰撹澶囨槸娌充笢璁惧鏃�,瀹冧笌DeviceID鐩哥瓑</para>
+    /// <para>褰撴槸鐪熸鐨勭涓夋柟璁惧鏃�,瀹冩湁鍙兘涓嶥eviceID涓嶇浉绛�</para>
+    /// <para>姣斿锛�2鍜�256閮芥槸缁х數鍣�,閭d箞銆怐eviceID涓�2 鎴栬�� DeviceID涓�256銆� 鑰� 銆怑xDeviceID鍥哄畾涓�2銆�,銆怐eviceType涓篛nOffOutput銆�</para>
+    /// <para>閫氫織鏉ヨ锛欴eviceID鏄疄闄呮纭殑ID,鑰屻�怑xDeviceID鏄竴绉嶆墍灞炴蹇电殑ID銆�</para>
+    /// </summary>
+    [Newtonsoft.Json.JsonIgnore]
+    public int ExDeviceID;
+    /// <summary>
+    /// 璇ュ瓧娈典富瑕侀拡瀵笽AS瀹夐槻璁惧璁剧珛銆傛墍鏈塈AS瀹夐槻璁惧鍏辩敤涓�涓狣eviceID涓�1026銆傛墍浠ヨ鍖哄垎瀛愯澶囩被鍨嬶紝闇�瑕佽瀛楁銆�
+    /// 鐬棿鏁版嵁涓婃姤鐨勪紶鎰熷櫒 (MomentStatus=1    TriggerZoneStatus>=1锛滄姤璀︼紴)
+    /// <para>13:Motion sensor (杩愬姩浼犳劅鍣級</para>
+    /// <para>40 Fire sensor 鐑熼浘浼犳劅鍣�</para>
+    /// <para>42 Water sensor 姘翠镜浼犳劅鍣�</para>
+    /// <para>43 Carbon Monoxide (CO) 鐕冩皵浼犳劅鍣�</para>
+    /// <para>44 Personal emergency device 绱ф�ユ寜閽�</para>
+    /// <para>277 Key fob 閽ュ寵鎵�</para>
+    /// <para>鎸佺画鏁版嵁涓婃姤(MomentStatus=0   TriggerZoneStatus>=1锛滄姤璀︼紴  TriggerZoneStatus=0锛滃彇娑堟姤璀︼紴)</para>
+    /// <para>21: Door/Window 闂ㄧ獥浼犳劅鍣紙鏈�21鍜�22锛岃繖閲屾病鏈夊啓閿欙級</para>
+    /// <para>22:Door/Window 闂ㄧ獥浼犳劅鍣紙鏈�21鍜�22锛岃繖閲屾病鏈夊啓閿�</para>
+    /// </summary>
+    public int IasDeviceType;
+    /// <summary>
+    /// 璁惧鍚嶇О,浠ヨ澶囩殑MAC鍛藉悕
+    /// </summary>
+    public string DeviceName = "UnKown";
+    /// <summary>
+    /// 璁惧绔偣鍚嶇О锛屼互璁惧绔偣鍚嶇О鍛藉悕
+    /// </summary>
+    public string DeviceEpointName = "UnKown";
+    /// <summary>
+    /// 鐢ㄤ簬鍒ゆ柇璁惧鐨剒igbee鍗忚鐗堟湰銆�
+    ///<para>49246锛歓LL1.0鏍囧噯璁惧銆�</para>
+    ///<para>260锛� ZHA1.2鏍囧噯璁惧銆� Z3.0鏍囧噯璁惧銆�</para>
+    ///<para>41440锛歓GP3.0鏍囧噯璁惧銆�</para>
+    ///<para>265锛歓SE1.4鏍囧噯璁惧銆�</para>
+    /// </summary>
+    [Newtonsoft.Json.JsonIgnore]
+    public int Profile;
+    /// <summary>
+    /// 0锛氳澶囦笉鍦ㄧ嚎
+    /// <para>1锛氳澶囧湪绾�</para>
+    /// </summary>
+    public int IsOnline;
+    /// <summary>
+    /// 1锛氳矾鐢辫澶�
+    /// <para>2锛氱粓绔澶囷紝鐢垫睜璁惧</para>
+    /// </summary>
+    public int ZigbeeType;
+    /// <summary>
+    /// 鍥轰欢鐗堟湰
+    /// </summary>
+    public int ImgVersion;
+    /// <summary>
+    /// 纭欢鐗堟湰
+    /// </summary>
+    public int HwVersion;
+    /// <summary>
+    /// 褰撳墠闀滃儚绫诲瀷id
+    /// </summary>
+    public int ImgTypeId;
+    /// <summary>
+    /// 椹卞姩浠g爜銆備负0鏃讹紝琛ㄧずzigbee鍗忚皟鍣ㄨ澶囥�傚叾浠栧�艰〃绀轰负铏氭嫙椹卞姩璁惧
+    /// </summary>
+    public int DriveCode;
+    /// <summary>
+    /// 鐢熶骇鍟嗗悕瀛�
+    /// </summary>
+    public string ManufacturerName = string.Empty;
+    /// <summary>
+    /// 妯″潡ID锛堣繖涓笢瑗夸篃鍙�愬瀷鍙风爜銆戯級
+    /// </summary>
+    public string ModelIdentifier = string.Empty;
+    /// <summary>
+    /// 鐢熶骇鏃ユ湡
+    /// </summary>
+    public string ProductionDate = string.Empty;
+    /// <summary>
+    /// 鐢垫簮
+    /// </summary>
+    public int PowerSource = -1;
+    /// <summary>
+    /// 搴忓垪鍙�
+    /// </summary>
+    public string SerialNumber = string.Empty;
+    /// <summary>
+    /// 杈撳叆绨囧垪琛�
+    /// </summary>
+    public List<InClusterObj> InClusterList = new List<InClusterObj>();
+    /// <summary>
+    /// 杈撳嚭绨囧垪琛�
+    /// </summary>
+    public List<OutClusterObj> OutClusterList = new List<OutClusterObj>();
+    /// <summary>
+    /// 鐢ㄤ簬璁板綍璁惧鏈�鏂颁笂鎶ョ殑灞炴�х姸鎬佷俊鎭�
+    /// </summary>
+    public List<AttributeStatusObj> AttributeStatus = new List<AttributeStatusObj>();
+
+    [Newtonsoft.Json.JsonIgnore]
+    public DateTime LastDateTime = DateTime.MinValue;
+    /// <summary>
+    /// 鏄惁宸茬粡璇诲彇浜嗚澶囩姸鎬�(姝ゅ睘鎬ф槸缁欎富椤典娇鐢ㄧ殑)
+    /// </summary>
+    [Newtonsoft.Json.JsonIgnore]
+    public bool HadReadDeviceStatu = false;
+
+    /// <summary>
+    /// 鏄惁鏄綆鐢甸噺(杩欎釜鍙橀噺鐩墠鏄粰浼犳劅鍣ㄧ敤鐨�)
+    /// </summary>
+    [Newtonsoft.Json.JsonIgnore]
+    public bool IsBatteryDown = false;
+
+    /// <summary>
+    /// 绛夊緟浠庣綉鍏虫帴鏀舵暟鎹殑鏃堕棿
+    /// </summary>
+    /// <value>The wait receive data time.</value>
+    [Newtonsoft.Json.JsonIgnore]
+    public virtual int WaitReceiveDataTime
+    {
+      get
+      {
+        if (Device.ZbGateway.RemoteMqttClient != null && Device.ZbGateway.RemoteMqttClient.IsConnected)
+        {
+          return 10000;
+        }
+        else
+        {
+          return 3000;
+        }
+      }
+    }
+
+    /// <summary>
+    /// 閫氳繃璁惧璋冪敤缃戝叧
+    /// </summary>
+    [Newtonsoft.Json.JsonIgnore]
+    public ZbGateway Gateway
+    {
+      get
+      {
+        if (string.IsNullOrEmpty(CurrentGateWayId))
+        {
+          return null;
+        }
+        var gateWay = ZbGateway.GateWayList.Find(obj => (obj != null) && (obj.GwId == CurrentGateWayId));
+        if (gateWay == null)
+        {
+          gateWay = new ZbGateway { IsVirtual = true, };
+          gateWay.GwId = CurrentGateWayId;
+          gateWay.HomeId = Shared.Common.Config.Instance.HomeId;
+          ZbGateway.GateWayList.Add(gateWay);
+        }
+
+        return gateWay;
+      }
+    }
+
+    /// <summary>
+    /// 淇濆瓨璁惧鏁版嵁鐨勬枃浠跺悕
+    /// </summary>
+    [Newtonsoft.Json.JsonIgnore]
+    public virtual string FilePath
+    {
+      get
+      {
+        //2020.09.21 瀵瑰簲绗笁鏂硅澶囧彲浠ュ叆缃�,璁惧鏂囦欢鍚嶅瓧,鍘绘帀 deviceType
+        return "Device_" + DeviceAddr + "_" + DeviceEpoint.ToString().PadLeft(2, '0');
+      }
+    }
+
+    #endregion
+
+    #region 璁惧淇濆瓨鍙婄敓鎴�
+
+    /// <summary>
+    /// 鐢辫澶囧瓧绗︿覆姣旂壒鎭㈠璁惧瀵硅薄
+    /// </summary>
+    /// <param name="intDeviceType">璁惧DeviceType鐨勬暣鍨嬪��</param>
+    /// <param name="strDeviceByte">璁惧Json鏂囦欢杞负姣旂壒鍚庡啀杞负鐨勫瓧绗︿覆</param>
+    /// <returns></returns>
+    public static CommonDevice CommonDeviceByByteString(int intDeviceType, string strDeviceByte)
+    {
+      //杩欐槸娌充笢鐨勭壒娈婄鐐�,涓嶉渶瑕佸鐞�
+      if (intDeviceType == 49408)
+      {
+        return null;
+      }
+
+      CommonDevice device = null;
+      if (intDeviceType == (int)DeviceType.DimmableLight || intDeviceType == 3)
+      {
+        device = Newtonsoft.Json.JsonConvert.DeserializeObject<DimmableLight>(strDeviceByte);
+        device.ExDeviceID = (int)DeviceType.DimmableLight;
+      }
+      else if (intDeviceType == (int)DeviceType.OnOffOutput || intDeviceType == 256)
+      {
+        device = Newtonsoft.Json.JsonConvert.DeserializeObject<ToggleLight>(strDeviceByte);
+        device.ExDeviceID = (int)DeviceType.OnOffOutput;
+      }
+      else if (intDeviceType == (int)DeviceType.ColorDimmerSwitch)
+      {
+        device = Newtonsoft.Json.JsonConvert.DeserializeObject<ColorDimmerSwitch>(strDeviceByte);
+      }
+      else if (intDeviceType == (int)DeviceType.LevelControlSwitch)
+      {
+        device = Newtonsoft.Json.JsonConvert.DeserializeObject<LevelControlSwitch>(strDeviceByte);
+      }
+      else if (intDeviceType == (int)DeviceType.WindowCoveringDevice)
+      {
+        device = Newtonsoft.Json.JsonConvert.DeserializeObject<Rollershade>(strDeviceByte);
+      }
+      else if (intDeviceType == (int)DeviceType.WindowCoveringController)
+      {
+        device = Newtonsoft.Json.JsonConvert.DeserializeObject<WindowCoveringController>(strDeviceByte);
+      }
+      else if (intDeviceType == (int)DeviceType.OnOffSwitch)
+      {
+        device = Newtonsoft.Json.JsonConvert.DeserializeObject<Panel>(strDeviceByte);
+      }
+      else if (intDeviceType == (int)DeviceType.IASZone)
+      {
+        device = Newtonsoft.Json.JsonConvert.DeserializeObject<IASZone>(strDeviceByte);
+      }
+      else if (intDeviceType == (int)DeviceType.OtaDevice || intDeviceType == (int)DeviceType.OtaPanelDevice)
+      {
+        device = Newtonsoft.Json.JsonConvert.DeserializeObject<OTADevice>(strDeviceByte);
+      }
+      else if (intDeviceType == (int)DeviceType.AirSwitch)
+      {
+        device = Newtonsoft.Json.JsonConvert.DeserializeObject<AirSwitch>(strDeviceByte);
+      }
+      else if (intDeviceType == (int)DeviceType.Repeater)
+      {
+        device = Newtonsoft.Json.JsonConvert.DeserializeObject<Repeater>(strDeviceByte);
+      }
+      else if (intDeviceType == (int)DeviceType.Thermostat)
+      {
+        device = Newtonsoft.Json.JsonConvert.DeserializeObject<AC>(strDeviceByte);
+      }
+      else if (intDeviceType == (int)DeviceType.Transverter)
+      {
+        device = Newtonsoft.Json.JsonConvert.DeserializeObject<Transverter>(strDeviceByte);
+      }
+      else if (intDeviceType == (int)DeviceType.DoorLock)
+      {
+        device = Newtonsoft.Json.JsonConvert.DeserializeObject<DoorLock>(strDeviceByte);
+      }
+      else if (intDeviceType == (int)DeviceType.TemperatureSensor)
+      {
+        device = Newtonsoft.Json.JsonConvert.DeserializeObject<TemperatureSensor>(strDeviceByte);
+      }
+      else if (intDeviceType == (int)DeviceType.FreshAirHumiditySensor)
+      {
+        device = Newtonsoft.Json.JsonConvert.DeserializeObject<HumiditySensor>(strDeviceByte);
+      }
+      else if (intDeviceType == (int)DeviceType.FreshAir)
+      {
+        device = Newtonsoft.Json.JsonConvert.DeserializeObject<FreshAir>(strDeviceByte);
+      }
+      else if (intDeviceType == (int)DeviceType.PMSensor)
+      {
+        device = Newtonsoft.Json.JsonConvert.DeserializeObject<PMSensor>(strDeviceByte);
+      }
+      else if (intDeviceType == (int)DeviceType.ColorTemperatureLight)
+      {
+        device = Newtonsoft.Json.JsonConvert.DeserializeObject<ColorTemperatureLight>(strDeviceByte);
+      }
+      else if (intDeviceType == (int)DeviceType.Buzzer)
+      {
+        device = Newtonsoft.Json.JsonConvert.DeserializeObject<Buzzer>(strDeviceByte);
+      }
+      else if (intDeviceType == (int)DeviceType.ColorDimmableLight)
+      {
+        device = Newtonsoft.Json.JsonConvert.DeserializeObject<ColorDimmableLight>(strDeviceByte);
+      }
+      else if (intDeviceType == (int)DeviceType.DimmerSwitch)
+      {
+        device = Newtonsoft.Json.JsonConvert.DeserializeObject<DimmerSwitch>(strDeviceByte);
+      }
+      else if (intDeviceType == (int)DeviceType.Airer)
+      {
+        device = Newtonsoft.Json.JsonConvert.DeserializeObject<Airer>(strDeviceByte);
+      }
+      else
+      {
+        device = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice>(strDeviceByte);
+      }
+
+      //杩欐槸娌充笢鐨勭壒娈婄鐐�,涓嶉渶瑕佸鐞�
+      if (device.DeviceEpoint == 242 && intDeviceType == 97)
+      {
+        return null;
+      }
+
+      if (device.ExDeviceID == 0)
+      {
+        //璧嬪垵濮嬪��
+        device.ExDeviceID = device.DeviceID;
+      }
+
+      //鑳藉皯瀛樹竴涓彉閲忓氨灏戝瓨涓�涓�
+      device.Type = (DeviceType)device.ExDeviceID;
+
+      return device;
+    }
+
+    /// <summary>
+    /// 淇濆瓨璁惧
+    /// </summary>
+    public void Save()
+    {
+      if (Shared.Common.Global.IsExistsByHomeId(FilePath))
+      {
+        return;
+      }
+      ReSave();
+    }
+
+    /// <summary>
+    /// 閲嶆柊淇濆瓨璁惧
+    /// </summary>
+    public void ReSave()
+    {
+      if (Shared.Common.Config.Instance.Home.IsShowTemplate == true)
+      {
+        //灞曠ず妯℃澘鏃�,涓嶅厑璁镐繚瀛樻枃浠�(闃叉灞炴�т笂鎶ョ敤鐨�)
+        return;
+      }
+      if (IconPath == string.Empty)
+      {
+        //淇濆瓨璁惧鍥炬爣(杩欓噷浼氫繚瀛樹竴娆�,涓嬮潰灏变笉鐢ㄤ繚瀛樹簡)
+        this.SaveDeviceIcon();
+        return;
+      }
+      Shared.Common.Global.WriteFileByBytesByHomeId(FilePath, System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)));
+    }
+
+    /// <summary>
+    /// 淇濆瓨璁惧鍥炬爣
+    /// </summary>
+    private void SaveDeviceIcon()
+    {
+      if (IconPath == string.Empty)
+      {
+        //骞叉帴鐐�
+        if (this.Type == DeviceType.OnOffSwitch)
+        {
+          IconPath = "Device/DryContact.png";
+        }
+        else if (this.Type == DeviceType.ColorDimmableLight)
+        {
+          //褰╃伅
+          IconPath = "Device/ColorLight.png";
+        }
+        else if (this.Type == DeviceType.DimmableLight)
+        {
+          //璋冨厜鍣�
+          IconPath = "Device/Light.png";
+        }
+        else if (this.Type == DeviceType.ColorTemperatureLight)
+        {
+          //鑹叉俯鐏�
+          IconPath = "Device/ColorLightTemperature.png";
+        }
+        else if (this.Type == DeviceType.OnOffOutput)
+        {
+          //缁х數鍣�
+          IconPath = "Device/RelayEpoint.png";
+        }
+        else if (this.Type == DeviceType.Thermostat)
+        {
+          //绌鸿皟 
+          IconPath = "Device/AirConditionerEpoint.png";
+        }
+        else if (this.Type == DeviceType.FreshAir)
+        {
+          //鏂伴 
+          IconPath = "Device/FreshAirEpoint.png";
+        }
+        else if (this.Type == DeviceType.PMSensor)
+        {
+          //PM2.5绌烘皵璐ㄩ噺浼犳劅鍣� 
+          IconPath = "Device/AirQualitySensorEpoint.png";
+        }
+        else if (this.Type == DeviceType.FreshAirHumiditySensor)
+        {
+          //婀垮害浼犳劅鍣�
+          IconPath = "Device/SensorHumidity.png";
+        }
+        else if (this.Type == DeviceType.TemperatureSensor)
+        {
+          if (((TemperatureSensor)this).SensorDiv == 1)
+          {
+            //娓╁害浼犳劅鍣�
+            IconPath = "Device/SensorTemperature.png";
+          }
+          else if (((TemperatureSensor)this).SensorDiv == 2)
+          {
+            //婀垮害浼犳劅鍣�
+            IconPath = "Device/SensorHumidity.png";
+          }
+        }
+        else if (this.Type != DeviceType.UnKown)
+        {
+          //鍏朵粬鐨勫浘鏍囨湁鐐圭壒娈�
+          string unSelectPic = string.Empty;
+          string selectPic = string.Empty;
+          Shared.Common.LocalDevice.Current.GetDeviceObjectIcon(new List<CommonDevice> { this }, ref unSelectPic, ref selectPic);
+          IconPath = unSelectPic;
+        }
+        Shared.Common.Global.WriteFileByBytesByHomeId(FilePath, System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)));
+      }
+    }
+
+    #endregion
+
+    #region 杈撳叆杈撳嚭闀炲畾涔�
+
+    /// <summary>
+    /// 璁惧鏈�鏂颁笂鎶ョ殑灞炴�х姸鎬佷俊鎭�
+    /// </summary>
+    [System.Serializable]
+    public class AttributeStatusObj
+    {
+      /// <summary>
+      /// 灞炴�х皣id
+      /// </summary>
+      public int ClusterId;
+      /// <summary>
+      /// 灞炴�d
+      /// </summary>
+      public int AttributeId;
+      /// <summary>
+      /// 灞炴�у�硷紝杩欎釜涓滆タ涓嶉渶瑕佷粈涔堥珮浣嶅湪鍚庝綆浣嶅湪鍓�,瀹冨凡缁忔槸杞负浜�10杩涘埗
+      /// </summary>
+      public int AttributeData;
+      /// <summary>
+      /// 灞炴�х姸鎬佹渶鍚庢洿鏂扮殑utc鏃堕棿鎴�
+      /// </summary>
+      public int ReportTime;
+    }
+
+    /// <summary>
+    /// 杈撳叆绨�
+    /// </summary>
+    [System.Serializable]
+    public class InClusterObj
+    {
+      /// <summary>
+      /// 璁惧鏀寔鐨勮緭鍏ュ姛鑳�
+      /// <para>0:Basic,璁惧鏀寔鈥滃熀纭�灞炴�р�� </para>
+      /// <para>3:Identify,璁惧鏀寔鈥滆瘑鍒姛鑳解��</para>
+      /// <para>4:Groups,璁惧鏀寔鈥滅粍鍔熻兘鈥�</para>
+      /// <para>5:Scenes,璁惧鏀寔鈥滃満鏅姛鑳解��</para>
+      /// <para>6:on/off,璁惧鏀寔鈥滃紑鍏冲姛鑳解��</para>
+      /// 寮�鍏冲姛鑳界殑璁惧濡傦細璋冨叧鐏�/缁х數鍣�/绐楀笜绛夈�傘�傘��
+      /// <para>8:Level Control,璁惧鏀寔鈥滀寒搴﹁皟鑺傚姛鑳解��</para>
+      /// 浜害璋冭妭鍔熻兘鐨勮澶囧锛氳皟鍏崇伅銆傘�傘��
+      /// <para>257:Door Lock,璁惧鏀寔鈥滈棬閿佸姛鑳解��</para>
+      /// 闂ㄩ攣鍔熻兘鐨勮澶囧锛氶棬閿併�傘�傘��
+      ///  <para>258:Window Covering,璁惧鏀寔鈥滅獥甯樻帶鍒跺姛鑳解��</para>
+      /// 绐楀笜鎺у埗鍔熻兘鐨勮澶囧锛氱獥甯�/寮�鍚堝笜/鍗峰笜銆傘�傘��
+      /// <para>513:Thermostat,璁惧鏀寔鈥滄亽娓╁櫒鍔熻兘鈥�</para>
+      /// 鎭掓俯鍣ㄥ姛鑳界殑璁惧濡傦細绌鸿皟銆傘�傘��
+      /// <para>768:Color Control,璁惧鏀寔鈥滈鑹茶皟鑺傚姛鑳解��</para>
+      /// 棰滆壊璋冭妭鍔熻兘鐨勮澶囧锛氳皟鍏夌伅銆傘�傘��
+      /// <para>1026:Temperature Measurement,璁惧鏀寔鈥滄俯搴︽祴閲忓姛鑳解��</para>
+      /// 娓╁害娴嬮噺鍔熻兘鐨勮澶囧锛氭俯搴︿紶鎰熷櫒銆傘�傘��
+      /// <para>1029:Relative Humidity Measurement,璁惧鏀寔鈥滄箍搴︽祴閲忓姛鑳解��</para>
+      /// 婀垮害娴嬮噺鍔熻兘鐨勮澶囧锛氭箍搴︿紶鎰熷櫒銆傘�傘��
+      /// <para>1066:Pm2.5  Measurement,璁惧鏀寔鈥減m2.5娴嬮噺鍔熻兘鈥�</para>
+      /// Pm2.5娴嬮噺鍔熻兘鐨勮澶囧锛歅m2.5浼犳劅鍣ㄣ�傘�傘��
+      /// </summary>
+      public int InCluster;
+    }
+
+    /// <summary>
+    /// 杈撳嚭绨�
+    /// </summary>
+    [System.Serializable]
+    public class OutClusterObj
+    {
+      /// <summary>
+      /// 璁惧鏀寔鐨勮緭鍑哄姛鑳�
+      /// <para>0:Basic,璁惧鏀寔鈥滃熀纭�灞炴�р�� </para>
+      /// <para>3:Identify,璁惧鏀寔鈥滆瘑鍒姛鑳解��</para>
+      /// <para>4:Groups,璁惧鏀寔鈥滅粍鍔熻兘鈥�</para>
+      /// <para>5:Scenes,璁惧鏀寔鈥滃満鏅姛鑳解��</para>
+      /// <para>6:on/off,璁惧鏀寔鈥滃紑鍏冲姛鑳解��</para>
+      /// 寮�鍏冲姛鑳界殑璁惧濡傦細璋冨叧鐏�/缁х數鍣�/绐楀笜绛夈�傘�傘��
+      /// <para>8:Level Control,璁惧鏀寔鈥滀寒搴﹁皟鑺傚姛鑳解��</para>
+      /// 浜害璋冭妭鍔熻兘鐨勮澶囧锛氳皟鍏崇伅銆傘�傘��
+      /// <para>257:Door Lock,璁惧鏀寔鈥滈棬閿佸姛鑳解��</para>
+      /// 闂ㄩ攣鍔熻兘鐨勮澶囧锛氶棬閿併�傘�傘��
+      ///  <para>258:Window Covering,璁惧鏀寔鈥滅獥甯樻帶鍒跺姛鑳解��</para>
+      /// 绐楀笜鎺у埗鍔熻兘鐨勮澶囧锛氱獥甯�/寮�鍚堝笜/鍗峰笜銆傘�傘��
+      /// <para>513:Thermostat,璁惧鏀寔鈥滄亽娓╁櫒鍔熻兘鈥�</para>
+      /// 鎭掓俯鍣ㄥ姛鑳界殑璁惧濡傦細绌鸿皟銆傘�傘��
+      /// <para>768:Color Control,璁惧鏀寔鈥滈鑹茶皟鑺傚姛鑳解��</para>
+      /// 棰滆壊璋冭妭鍔熻兘鐨勮澶囧锛氳皟鍏夌伅銆傘�傘��
+      /// <para>1026:Temperature Measurement,璁惧鏀寔鈥滄俯搴︽祴閲忓姛鑳解��</para>
+      /// 娓╁害娴嬮噺鍔熻兘鐨勮澶囧锛氭俯搴︿紶鎰熷櫒銆傘�傘��
+      /// <para>1029:Relative Humidity Measurement,璁惧鏀寔鈥滄箍搴︽祴閲忓姛鑳解��</para>
+      /// 婀垮害娴嬮噺鍔熻兘鐨勮澶囧锛氭箍搴︿紶鎰熷櫒銆傘�傘��
+      /// </summary>
+      public int OutCluster;
+    }
+
+    /// <summary>
+    /// 鏀寔鐨勫睘鎬ф暟鎹�
+    /// </summary>
+    [System.Serializable]
+    public class AttributeObj
+    {
+      /// <summary>
+      /// 鍝嶅簲鐨勫睘鎬D
+      /// </summary>
+      public int AttributeId;
+      /// <summary>
+      /// 灞炴�у�肩殑鏁版嵁绫诲瀷
+      /// </summary>
+      public int AttributeType;
+    }
+
+    /// <summary>
+    /// 璁惧涓婃姤鐨勫睘鎬ф暟鎹�
+    /// </summary>
+    [System.Serializable]
+    public class AttributeDataObj
+    {
+      /// <summary>
+      /// 灞炴�d
+      /// </summary>
+      public int AttributeId;
+      /// <summary>
+      /// 瑕佹姤鍛婂睘鎬х殑鏁版嵁绫诲瀷
+      /// </summary>
+      public int AttriButeDataType;
+      /// <summary>
+      /// AttriButeData鍗犵敤鐨勫瓧鑺傛暟
+      /// </summary>
+      public int AttriButeDataLength;
+      /// <summary>
+      /// 灞炴�у��
+      /// </summary>
+      public int AttriButeData = 999;
+      /// <summary>
+      /// 灞炴�ф暟鎹�16杩涘埗杞瓧绗�
+      /// </summary>
+      public string AttriButeDataHex;
+    }
+
+    /// <summary>
+    /// Command鏁扮粍
+    /// </summary>
+    [System.Serializable]
+    public class CommandObj
+    {
+      /// <summary>
+      /// 鏀寔鐨勫懡浠d
+      /// </summary>
+      public int commandId;
+    }
+
+    #endregion
+
+    #region 鑾峰彇宸插叆缃戣澶囦俊鎭�
+
+    /// <summary>
+    /// 缃戝叧涓殑璁惧淇℃伅
+    /// </summary>
+    [Newtonsoft.Json.JsonIgnore]
+    public DeviceInfoData DeviceInfo = null;
+    /// <summary>
+    /// 缃戝叧涓殑璁惧淇℃伅
+    /// </summary>
+    [System.Serializable]
+    public class DeviceInfoData
+    {
+      /// <summary>
+      /// 鍏ョ綉璁惧鎬绘暟銆傜瓑浜�0鏃讹紝琛ㄧず娌℃湁璁惧淇℃伅锛屼笅闈㈠瓧娈靛皢涓嶅瓨鍦ㄣ��
+      /// </summary>
+      public int TotalNum;
+      /// <summary>
+      /// 鏍囪瘑褰撳墠璁惧鏄彂閫佺殑鏄鍑犱釜璁惧銆侱eviceNum浠�1寮�濮嬫瘡鍙戦�佷竴涓澶囦俊鎭紝涓嬩竴涓澶囦俊鎭殑DeviceNum灏嗗姞1銆傜洿鍒癉eviceNum绛変簬TotalNum璇存槑鎵�鏈夎澶囦俊鎭彂閫佸畬姣曘��
+      /// </summary>
+      public int DeviceNum;
+      /// <summary>
+      /// 鍏ョ綉鐨剈tc鏃堕棿鎴�
+      /// </summary>
+      public int JoinTime;
+      /// <summary>
+      /// 1:璺敱鍣ㄨ澶�
+      /// <para>2锛氱粓绔澶�</para>
+      /// </summary>
+      public int ZigbeeType;
+      /// <summary>
+      /// 璁惧缃戠粶鍦板潃
+      /// </summary>
+      public int NwkAddr;
+      /// <summary>
+      /// 璇ュ瓧娈典富瑕侀拡瀵笽AS瀹夐槻璁惧璁剧珛銆傛墍鏈塈AS瀹夐槻璁惧鍏辩敤涓�涓狣eviceID涓�1026銆傛墍浠ヨ鍖哄垎瀛愯澶囩被鍨嬶紝闇�瑕佽瀛楁銆�
+      /// <para>13:Motion sensor (杩愬姩浼犳劅鍣級</para>
+      /// <para>43:Carbon Monoxide sensor (涓�姘у寲纰充紶鎰熷櫒锛�</para>
+      /// <para>44:Personal emergency device (绱ф�ユ寜閽級</para>
+      /// </summary>
+      public int DeviceType;
+      /// <summary>
+      /// 鐢ㄤ簬鍒ゆ柇璁惧鐨剒igbee鍗忚鐗堟湰銆�
+      ///<para>49246锛歓LL1.0鏍囧噯璁惧銆�</para>
+      ///<para>260锛� ZHA1.2鏍囧噯璁惧銆� Z3.0鏍囧噯璁惧銆�</para>
+      ///<para>41440锛歓GP3.0鏍囧噯璁惧銆�</para>
+      ///<para>265锛歓SE1.4鏍囧噯璁惧銆�</para>
+      /// </summary>
+      public int Profile;
+      /// <summary>
+      /// 璁惧mac鍚嶇О
+      /// </summary>
+      public string MacName;
+      /// <summary>
+      /// 璁惧鍚�(Mac+鏂偣鍛藉悕鐨勶級
+      /// </summary>
+      public string DeviceName;
+      /// <summary>
+      /// 0锛氳澶囦笉鍦ㄧ嚎
+      /// <para>1锛氳澶囧湪绾�</para>
+      /// </summary>
+      public int IsOnline;
+      /// <summary>
+      /// 褰撳墠杩愯绋嬪簭鐗堟湰淇℃伅銆� 鏈�澶�64瀛楄妭
+      /// </summary>
+      public int ImgVersion;
+      /// <summary>
+      /// 纭欢鐗堟湰
+      /// </summary>
+      public int HwVersion;
+      /// <summary>
+      /// 褰撳墠闀滃儚绫诲瀷id
+      /// </summary>
+      public int ImgTypeId;
+      /// <summary>
+      /// 椹卞姩浠g爜銆備负0鏃讹紝琛ㄧずzigbee鍗忚皟鍣ㄨ澶囥�傚叾浠栧�艰〃绀轰负铏氭嫙椹卞姩璁惧
+      /// </summary>
+      public int DriveCode;
+      /// <summary>
+      /// 鍘傚晢鍚嶇О
+      /// </summary>
+      public string ManufacturerName = string.Empty;
+      /// <summary>
+      /// 妯″潡ID
+      /// </summary>
+      public string ModelIdentifier = string.Empty;
+      /// <summary>
+      /// 濂藉儚鏄簭鍒楀彿
+      /// </summary>
+      public string ProductCode = string.Empty;
+      /// <summary>
+      /// 璁惧鍔熻兘绫诲瀷(绌烘皵寮�鍏冲拰缁х數鍣ㄤ笓鐢�)
+      /// </summary>
+      public int FunctionType = -1;
+      /// <summary>
+      /// 杈撳叆绨囧垪琛�
+      /// </summary>
+      public List<InClusterObj> InClusterList = new List<InClusterObj>();
+      /// <summary>
+      /// 杈撳嚭绨囧垪琛�
+      /// </summary>
+      public List<OutClusterObj> OutClusterList = new List<OutClusterObj>();
+      /// <summary>
+      /// 鐢ㄤ簬璁板綍璁惧鏈�鏂颁笂鎶ョ殑灞炴�х姸鎬佷俊鎭�傛渶澶ф敮鎸佽褰�16涓睘鎬х姸鎬侊紝涓斿彧璁板綍灞炴�у�奸暱搴︿笉澶т簬4瀛楄妭鐨勬暟鎹��
+      /// </summary>
+      public List<AttributeStatusObj> AttributeStatus = new List<AttributeStatusObj>();
+
+    }
+
+    #endregion
+
+    #region 閿欒缁撴灉瀹氫箟
+
+    /// <summary>
+    /// 缃戝叧淇℃伅閿欒鍙嶉鍏遍��
+    /// </summary>
+    [System.Serializable]
+    public class ErrorResponCommon
+    {
+      /// <summary>
+      /// 閿欒淇℃伅
+      /// </summary>
+      public string errorMessageBase;
+      /// <summary>
+      /// 缃戝叧淇℃伅閿欒鍙嶉
+      /// <para>褰撶綉鍏虫帴鏀跺埌瀹㈡埛绔俊鎭悗锛屽嚭鐜颁互涓嬪紓甯告儏鍐靛皢鍙嶉閿欒銆�</para>
+      /// </summary>
+      public ErrorResponData errorResponData;
+    }
+
+    /// <summary>
+    /// 缃戝叧淇℃伅閿欒鍙嶉
+    /// <para>褰撶綉鍏虫帴鏀跺埌瀹㈡埛绔俊鎭悗锛屽嚭鐜颁互涓嬪紓甯告儏鍐靛皢鍙嶉閿欒銆�</para>
+    /// </summary>
+    [System.Serializable]
+    public class ErrorResponData
+    {
+      /// <summary>
+      /// Error鍙傛暟鍚箟
+      ///<para>1锛氱綉鍏虫棤娉曡В鏋愬懡浠ゆ暟鎹��</para>
+      ///<para>2锛氬崗璋冨櫒姝e湪鍗囩骇鎴栧浠�/鎭㈠鏁版嵁
+      ///<para>3锛氭搷浣滆澶�/缁�/鍦烘櫙涓嶅瓨鍦�</para>
+      ///<para>4锛氬叾浠栭敊璇�</para>
+      ///<para>5锛氭暟鎹紶杈撻敊璇紙鍦ㄦ煇娆″鎴风鍚戠綉鍏冲彂閫佹暟鎹殑杩囩▼涓紝缃戝叧鍦ㄥ悎鐞嗘椂闂磋寖鍥村唴鎺ユ敹瀹㈡埛绔暟鎹笉瀹屾暣瀵艰嚧璇ラ敊璇彂鐢熴�傚瀹㈡埛绔悜缃戝叧涓�娆″彂閫�100涓瓧鑺傜殑鏁版嵁锛屼絾缃戝叧绛夊緟鎺ユ敹浜嗕竴绉掑彧鎺ユ敹浜�80涓瓧鑺傘�傚彂鐢熻閿欒锛岀綉鍏冲皢涓诲姩鍏抽棴瀹㈡埛绔繛鎺ワ級</para>
+      /// </summary>
+      public int Error;
+    }
+
+    /// <summary>
+    /// 缃戝叧閿欒淇℃伅鍏蜂綋鍐呭
+    /// </summary>
+    public static string ErrorMess(int err)
+    {
+      string message = "";
+      switch (err)
+      {
+        case 1:
+          message = " 缃戝叧鏃犳硶瑙f瀽鍛戒护鏁版嵁銆�";
+          break;
+        case 2:
+          message = " 鍗忚皟鍣ㄦ鍦ㄥ崌绾ф垨澶囦唤 / 鎭㈠鏁版嵁銆�";
+          break;
+        case 3:
+          message = "鎿嶄綔璁惧 / 缁� / 鍦烘櫙涓嶅瓨鍦�";
+          break;
+        case 4:
+          message = " 鍏朵粬閿欒";
+          break;
+        case 5:
+          message = " 鏁版嵁浼犺緭閿欒锛堝湪鏌愭瀹㈡埛绔悜缃戝叧鍙戦�佹暟鎹殑杩囩▼涓紝缃戝叧鍦ㄥ悎鐞嗘椂闂磋寖鍥村唴鎺ユ敹瀹㈡埛绔暟鎹笉瀹屾暣瀵艰嚧璇ラ敊璇彂鐢熴�傚瀹㈡埛绔悜缃戝叧涓�娆″彂閫�100涓瓧鑺傜殑鏁版嵁锛屼絾缃戝叧绛夊緟鎺ユ敹浜嗕竴绉掑彧鎺ユ敹浜� 涓瓧鑺傘�傚彂鐢熻閿欒锛岀綉鍏冲皢涓诲姩鍏抽棴瀹㈡埛绔繛鎺ワ級";
+          break;
+        default:
+          break;
+      }
+      return message;
+    }
+
+    #endregion
+
+    #region 淇敼璁惧绔彛鍚嶇О
+
+    /// <summary>
+    /// 閲嶅懡鍚嶈澶�,缃戝叧鍙嶉鍏蜂綋淇℃伅
+    /// </summary>
+    [System.Serializable]
+    public class DeviceRenameAllData
+    {
+      /// <summary>
+      /// 閿欒淇℃伅
+      /// </summary>
+      public string errorMessageBase;
+      /// <summary>
+      /// 缃戝叧淇℃伅閿欒鍙嶉
+      /// <para>褰撶綉鍏虫帴鏀跺埌瀹㈡埛绔俊鎭悗锛屽嚭鐜颁互涓嬪紓甯告儏鍐靛皢鍙嶉閿欒銆�</para>
+      /// </summary>
+      public ErrorResponData errorResponData;
+      /// <summary>
+      /// 璁惧鍚嶇О淇敼
+      /// </summary>
+      public DeviceRenameResponseData deviceRenameData;
+    }
+
+    /// <summary>
+    /// 璁惧鍚嶇О淇敼
+    /// </summary>
+    [System.Serializable]
+    public class DeviceRenameResponseData
+    {
+      /// <summary>
+      /// 0:淇敼鎴愬姛
+      /// <para>1:淇敼澶辫触</para>
+      /// </summary>
+      public int Result;
+      /// <summary>
+      /// 淇敼鍚庣殑璁惧鍚嶇О
+      /// </summary>
+      public string DeviceName;
+    }
+    #endregion
+
+    #region 淇敼璁惧mac鍚嶇О
+
+    /// <summary>
+    /// 淇敼璁惧mac鍚嶇О鏁版嵁,缃戝叧鍙嶉鍏蜂綋淇℃伅
+    /// </summary>
+    [System.Serializable]
+    public class RenameDeviceMacNameAllData : ErrorResponCommon
+    {
+      /// <summary>
+      /// 淇敼璁惧mac鍚嶇О鏁版嵁
+      /// </summary>
+      public RenameDeviceMacNameData renameDeviceMacNameData;
+    }
+
+    /// <summary>
+    /// 淇敼璁惧mac鍚嶇О鏁版嵁
+    /// </summary>
+    [System.Serializable]
+    public class RenameDeviceMacNameData
+    {
+      /// <summary>
+      /// 0:淇敼鎴愬姛
+      /// <para>1:淇敼澶辫触,mac涓嶅瓨鍦�</para>
+      /// </summary>
+      public int Result;
+      /// <summary>
+      /// 淇敼鍚庣殑璁惧鍚嶇О
+      /// </summary>
+      public string MacName;
+    }
+    #endregion
+
+    #region 涓�閿洿鏂板洓瀵稿睆鎸夐敭灞炴��
+    /// <summary>
+    /// 鍚屾璁惧鍔熻兘
+    /// </summary>
+    /// <returns></returns>
+    public async System.Threading.Tasks.Task<SynchronizationDeviceResponseAllData> SyncMsgToBindSource(string deviceAddr, int deviceEpoint)
+    {
+      if (Gateway == null)
+      {
+        return null;
+      }
+
+      return await System.Threading.Tasks.Task.Run(async () =>
+      {
+        SynchronizationDeviceResponseAllData resContent = 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")
             {
-                if (msg.Contains("DeviceStatusReport") == false)
-                {
-                    System.Console.WriteLine(msg + "  " + System.DateTime.Now.ToLongTimeString() + " " + System.DateTime.Now.Millisecond);
-                }
+              var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+              if (temp == null)
+              {
+                resContent = new SynchronizationDeviceResponseAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+              }
+              else
+              {
+                resContent = new SynchronizationDeviceResponseAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
+              }
             }
-#endif
-        }
 
-        /// <summary>
-        /// 绛夊緟浠庣綉鍏虫帴鏀舵暟鎹殑鏃堕棿
-        /// </summary>
-        /// <value>The wait receive data time.</value>
-        public virtual int WaitReceiveDataTime
-        {
-            get
+            if (topic == gatewayID + "/" + "Bind/SyncMsgToBindSourceRespon")
             {
-                if (Device.ZbGateway.RemoteMqttClient != null && Device.ZbGateway.RemoteMqttClient.IsConnected)
-                {
-                    return 10000;
-                }
-                else
-                {
-                    return 3000;
-                }
+              var res = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(jobject["Data"]["Result"].ToString());
+              if (res == null)
+              {
+                resContent = new SynchronizationDeviceResponseAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
+              }
+              else
+              {
+                resContent = new SynchronizationDeviceResponseAllData { result = res };
+                System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
+              }
             }
-        }
+          };
+        Gateway.Actions = action;
+        DebugPrintLog("Bind/SyncMsgToBindSourceRespon_Actions 鍚姩" + "_" + System.DateTime.Now.ToString());
 
-
-        [Newtonsoft.Json.JsonIgnore]
-        public bool IsValid
+        try
         {
-            get
+          var jObject = new JObject { { "DeviceAddr", deviceAddr }, { "Epoint", deviceEpoint }, { "Cluster_ID", 0 }, { "Command", 5010 } };
+          Gateway.Send("Bind/SyncMsgToBindSource", jObject.ToString());
+        }
+        catch { }
+
+        var dateTime = DateTime.Now;
+        while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
+        {
+          await System.Threading.Tasks.Task.Delay(10);
+          if (resContent != null)
+          {
+            break;
+          }
+        }
+        if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
+        {
+          resContent = new SynchronizationDeviceResponseAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
+        }
+        Gateway.Actions -= action;
+        DebugPrintLog("Bind/SyncMsgToBindSource_Actions 閫�鍑�" + System.DateTime.Now.ToString());
+
+        return resContent;
+      });
+
+    }
+
+    /// <summary>
+    /// 鍚屾璁惧,缃戝叧鍙嶉鍏蜂綋淇℃伅
+    /// </summary>
+    [System.Serializable]
+    public class SynchronizationDeviceResponseAllData
+    {
+      /// <summary>
+      /// 閿欒淇℃伅
+      /// </summary>
+      public string errorMessageBase;
+      /// <summary>
+      /// 缃戝叧淇℃伅閿欒鍙嶉
+      /// <para>褰撶綉鍏虫帴鏀跺埌瀹㈡埛绔俊鎭悗锛屽嚭鐜颁互涓嬪紓甯告儏鍐靛皢鍙嶉閿欒銆�</para>
+      /// </summary>
+      public ErrorResponData errorResponData;
+      /// <summary>
+      /// 鍚屾缁撴灉
+      /// 0:鎴愬姛锛氱綉鍏冲唴閮ㄨ嚜鍔ㄥ啓鍏ヨ澶囩洰鏍囧悕瀛椼�佽澶囩洰鏍囧姛鑳界被鍨嬨�佸満鏅洰鏍囧悕瀛椼�乽tc鏃堕棿鍐欏叆4瀵稿睆
+      /// 1:澶辫触
+      /// </summary>
+      public int result;
+    }
+    #endregion
+
+    #region 鍒犻櫎璁惧锛堜娇璁惧绂荤綉锛�
+    /// <summary>
+    /// 鍒犻櫎璁惧锛堜娇璁惧绂荤綉锛�
+    /// </summary>
+    /// <returns>The device async.</returns>
+    /// <param name="removeData">Remove data.</param>
+    public async System.Threading.Tasks.Task<RemoveDeviceResponseAllData> DeleteDeviceAsync(ZigBee.Device.CommonDevice.RemoveDeviceData removeData)
+    {
+      if (Gateway == null || removeData == null)
+      {
+        return null;
+      }
+      return await System.Threading.Tasks.Task.Run(async () =>
+      {
+        RemoveDeviceResponseAllData 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")
             {
-                return (DateTime.Now - LastDateTime).TotalSeconds < 10;
+              var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+              if (temp == null)
+              {
+                d = new RemoveDeviceResponseAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+              }
+              else
+              {
+                d = new RemoveDeviceResponseAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
+              }
             }
-        }
 
-        /// <summary>
-        /// 閫氳繃璁惧璋冪敤缃戝叧
-        /// </summary>
-        [Newtonsoft.Json.JsonIgnore]
-        public ZbGateway Gateway
-        {
-            get
+            if (topic == gatewayID + "/" + "RemoveDeviceRespon")
             {
-                if (string.IsNullOrEmpty(CurrentGateWayId))
-                {
-                    return null;
-                }
-                var gateWay = ZbGateway.GateWayList.Find(obj => (obj != null) && (obj.getGatewayBaseInfo != null) && (obj.getGatewayBaseInfo.gwID == CurrentGateWayId));
-                if (gateWay == null)
-                {
-                    gateWay = new ZbGateway { IsVirtual = true, };
-                    gateWay.getGatewayBaseInfo.gwID = CurrentGateWayId;
-                    gateWay.getGatewayBaseInfo.HomeId = Shared.Common.Config.Instance.HomeId;
-                    ZbGateway.GateWayList.Add(gateWay);
-                }
+              var removeDeviceResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.RemoveDeviceResponseData>(jobject["Data"].ToString());
 
-                return gateWay;
+              if (removeDeviceResponseData == null)
+              {
+                d = new RemoveDeviceResponseAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
+              }
+              else
+              {
+                d = new RemoveDeviceResponseAllData { removeDeviceResponseData = removeDeviceResponseData };
+                System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
+              }
             }
-        }
+          };
+        Gateway.Actions += action;
+        DebugPrintLog("RemoveDevice_Actions 鍚姩" + "_" + System.DateTime.Now.ToString());
 
-        /// <summary>
-        /// 淇濆瓨璁惧鏁版嵁鐨勬枃浠跺悕
-        /// </summary>
-        [Newtonsoft.Json.JsonIgnore]
-        public virtual string FilePath
+        try
         {
-            get
+          if (removeData != null)
+          {
+            var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 99 } };
+            var deviceAddrList = new JArray { };
+            foreach (var a in removeData.DeviceAddrList)
             {
-                var deviceType = Type.ToString();
-                var fileName = "Device_" + deviceType + "_" + DeviceAddr;
-                fileName += "_" + (DeviceEpoint.ToString().Length < 2 ? "0" + DeviceEpoint.ToString() : DeviceEpoint.ToString());
-                return fileName;
+              var dd = new JObject { { "DeviceAddr", a.DeviceAddr } };
+              deviceAddrList.Add(dd);
             }
-        }
 
-        /// <summary>
-        /// 鐢辫澶囪矾寰勬仮澶嶈澶囧璞�
-        /// </summary>
-        /// <returns>The device by file path.</returns>
-        /// <param name="deviceFilePath">Device file path.</param>
-        public static CommonDevice CommonDeviceByFilePath(string deviceFilePath)
-        {
-            var v = deviceFilePath.Split('_');
-            if (v.Length < 3)
-            {
-                return null;
-            }
-            return CommonDeviceByByteString(v[1], System.Text.Encoding.UTF8.GetString(Shared.Common.Global.ReadFileByHomeId(deviceFilePath)));
-        }
-
-        /// <summary>
-        /// 鐢辫澶囧瓧绗︿覆姣旂壒鎭㈠璁惧瀵硅薄
-        /// </summary>
-        /// <param name="strDeviceType">璁惧DeviceType鐨勫瓧绗︿覆绫诲瀷</param>
-        /// <param name="strDeviceByte">璁惧Json鏂囦欢杞负姣旂壒鍚庡啀杞负鐨勫瓧绗︿覆</param>
-        /// <returns></returns>
-        public static CommonDevice CommonDeviceByByteString(string strDeviceType, string strDeviceByte)
-        {
-            if (strDeviceType == ZigBee.Device.DeviceType.DimmableLight.ToString())
-            {
-                return Newtonsoft.Json.JsonConvert.DeserializeObject<DimmableLight>(strDeviceByte);
-            }
-            else if (strDeviceType == ZigBee.Device.DeviceType.OnOffOutput.ToString())
-            {
-                return Newtonsoft.Json.JsonConvert.DeserializeObject<ToggleLight>(strDeviceByte);
-            }
-            else if (strDeviceType == ZigBee.Device.DeviceType.WindowCoveringDevice.ToString())
-            {
-                return Newtonsoft.Json.JsonConvert.DeserializeObject<Rollershade>(strDeviceByte);
-            }
-            else if (strDeviceType == ZigBee.Device.DeviceType.OnOffSwitch.ToString())
-            {
-                return Newtonsoft.Json.JsonConvert.DeserializeObject<Panel>(strDeviceByte);
-            }
-            else if (strDeviceType == ZigBee.Device.DeviceType.IASZone.ToString())
-            {
-                return Newtonsoft.Json.JsonConvert.DeserializeObject<IASZone>(strDeviceByte);
-            }
-            else if (strDeviceType == ZigBee.Device.DeviceType.OtaDevice.ToString() || strDeviceType == ZigBee.Device.DeviceType.OtaPanelDevice.ToString())
-            {
-                return Newtonsoft.Json.JsonConvert.DeserializeObject<OTADevice>(strDeviceByte);
-            }
-            else if (strDeviceType == ZigBee.Device.DeviceType.AirSwitch.ToString())
-            {
-                return Newtonsoft.Json.JsonConvert.DeserializeObject<AirSwitch>(strDeviceByte);
-            }
-            else if (strDeviceType == ZigBee.Device.DeviceType.Repeater.ToString())
-            {
-                return Newtonsoft.Json.JsonConvert.DeserializeObject<Repeater>(strDeviceByte);
-            }
-            else if (strDeviceType == ZigBee.Device.DeviceType.Thermostat.ToString())
-            {
-                return Newtonsoft.Json.JsonConvert.DeserializeObject<AC>(strDeviceByte);
-            }
-            else if (strDeviceType == ZigBee.Device.DeviceType.Transverter.ToString())
-            {
-                return Newtonsoft.Json.JsonConvert.DeserializeObject<Transverter>(strDeviceByte);
-            }
-            else if (strDeviceType == ZigBee.Device.DeviceType.DoorLock.ToString())
-            {
-                return Newtonsoft.Json.JsonConvert.DeserializeObject<DoorLock>(strDeviceByte);
-            }
-            else if (strDeviceType == ZigBee.Device.DeviceType.TemperatureSensor.ToString())
-            {
-                return Newtonsoft.Json.JsonConvert.DeserializeObject<TemperatureSensor>(strDeviceByte);
-            }
-            return null;
-        }
-
-        /// <summary>
-        /// 淇濆瓨璁惧
-        /// </summary>
-        public void Save()
-        {
-            if (Shared.Common.Global.IsExistsByHomeId(FilePath))
-            {
-                return;
-            }
-            ReSave();
-        }
-
-        /// <summary>
-        /// 閲嶆柊淇濆瓨璁惧
-        /// </summary>
-        public void ReSave()
-        {
-            if (IconPath == string.Empty)
-            {
-                //淇濆瓨璁惧鍥炬爣(杩欓噷浼氫繚瀛樹竴娆�,涓嬮潰灏变笉鐢ㄤ繚瀛樹簡)
-                this.SaveDeviceIcon();
-                return;
-            }
-            Shared.Common.Global.WriteFileByBytesByHomeId(FilePath, System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)));
-        }
-
-        /// <summary>
-        /// 淇濆瓨璁惧鍥炬爣
-        /// </summary>
-        private void SaveDeviceIcon()
-        {
-            if (IconPath == string.Empty)
-            {
-                //骞叉帴鐐�
-                if (this.Type == DeviceType.OnOffSwitch)
-                {
-                    IconPath = "Device/DryContact.png";
-                }
-                else if (this.Type == DeviceType.ColorDimmableLight)
-                {
-                    //褰╃伅
-                    IconPath = "Device/ColorLight.png";
-                }
-                else if (this.Type == DeviceType.DimmableLight)
-                {
-                    //璋冨厜鍣�
-                    IconPath = "Device/Light.png";
-                }
-                else if (this.Type == DeviceType.OnOffOutput)
-                {
-                    //缁х數鍣�
-                    IconPath = "Device/RelayEpoint.png";
-                }
-                else if (this.Type == DeviceType.Thermostat)
-                {
-                    //绌鸿皟
-                    IconPath = "Device/AirConditionerEpoint.png";
-                }
-                else if (this.Type == DeviceType.TemperatureSensor)
-                {
-                    if (((TemperatureSensor)this).SensorDiv == 1)
-                    {
-                        //娓╁害浼犳劅鍣�
-                        IconPath = "Device/SensorTemperature.png";
-                    }
-                    else if (((TemperatureSensor)this).SensorDiv == 2)
-                    {
-                        //婀垮害浼犳劅鍣�
-                        IconPath = "Device/SensorHumidity.png";
-                    }
-                }
-                else if (this.Type != DeviceType.UnKown)
-                {
-                    //鍏朵粬鐨勫浘鏍囨湁鐐圭壒娈�
-                    string unSelectPic = string.Empty;
-                    string selectPic = string.Empty;
-                    Shared.Common.LocalDevice.Current.GetDeviceBeloneIcon(new List<CommonDevice> { this }, ref unSelectPic, ref selectPic);
-                    IconPath = unSelectPic;
-                }
-                Shared.Common.Global.WriteFileByBytesByHomeId(FilePath, System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)));
-            }
-        }
-
-        /// <summary>
-        /// 鏄惁鏄嚜瀹氫箟鍥剧墖
-        /// </summary>
-        public bool IsCustomizeImage = false;
-        /// <summary>
-        /// 璁惧鍥剧墖
-        /// </summary>
-        public string IconPath = string.Empty;
-        /// <summary>
-        /// 璁惧鍥剧墖--鍦ㄧ嚎鎴栬�呴�変腑鐘舵��
-        /// </summary>
-        /// <value>The online icon path.</value>
-        [Newtonsoft.Json.JsonIgnore]
-        public string OnlineIconPath
-        {
-            get
-            {
-                if (string.IsNullOrEmpty(IconPath))
-                {
-                    return string.Empty;
-                }
-                var pathArr = IconPath.Split('.');
-                if (pathArr == null || string.IsNullOrEmpty(pathArr[0]))
-                {
-                    return string.Empty;
-                }
-                return $"{pathArr[0]}Selected.png";
-            }
-        }
-
-        /// <summary>
-        /// 褰撳墠缃戝叧鐨処D
-        /// </summary>
-        public string CurrentGateWayId;
-        /// <summary>
-        /// 褰撳墠璁惧绫诲瀷
-        /// </summary>
-        public DeviceType Type = DeviceType.UnKown;
-        /// <summary>
-        /// 璁惧鐨勫姛鑳界被鍨�(姝ょ被鍨嬬洰鍓嶅彧閽堝缁х數鍣ㄥ洖璺湁鏁�,榛樿鏈寚瀹�)
-        /// </summary>
-        public DeviceFunctionType DfunctionType = DeviceFunctionType.A鏈畾涔�;
-        /// <summary>
-        /// MAC鍦板潃
-        /// </summary>
-        public string DeviceAddr;
-
-        /// <summary>
-        /// 璁惧绔彛鍙�
-        /// </summary>
-        public int DeviceEpoint;
-
-        /// <summary>
-        /// 璁惧鍛戒护鏍煎紡锛歁ac+绔彛
-        /// </summary>
-        /// <value>The common device address epoint.</value>
-        public string CommonDeviceAddrEpoint
-        {
-            get
-            {
-                return DeviceAddr + "_" + DeviceEpoint.ToString();
-            }
-        }
-
-        /// <summary>
-        /// 缃戝叧鍙嶉鐨勬椂闂存埑
-        /// </summary>
-        public int Time;
-
-        /// <summary>
-        /// 缃戝叧鍥炲鐨勬暟鎹甀D
-        /// </summary>
-        public int DataID;
-
-        /// <summary>
-        /// 璁惧id
-        /// <para>258:color dimmable light,璋冨叧鐏� </para>
-        /// <para>10:Door lock,闂ㄩ攣</para>
-        /// <para>514:Window covering device,绐楀笜</para>
-        /// <para>515:Window covering controller锛岀獥甯樻帶鍒跺櫒</para>
-        /// <para>769:Thermostat,鎭掓俯闈㈡澘/绌鸿皟</para>
-        /// <para>770:Temperature Sensor,娓╁害浼犳劅鍣�</para>
-        /// <para>775:Temperature Sensor,婀垮害浼犳劅鍣�</para>
-        /// <para>262:Light sensor,鍏夌収浼犳劅鍣�</para>
-        /// <para>1026:sensor,浼犳劅鍣紝鍏蜂綋绫诲瀷鐨勪紶鎰熷櫒DeviceType鏉ュ尯鍒�</para>
-        /// </summary>
-        public int DeviceID;
-
-        /// <summary>
-        /// 璇ュ瓧娈典富瑕侀拡瀵笽AS瀹夐槻璁惧璁剧珛銆傛墍鏈塈AS瀹夐槻璁惧鍏辩敤涓�涓狣eviceID涓�1026銆傛墍浠ヨ鍖哄垎瀛愯澶囩被鍨嬶紝闇�瑕佽瀛楁銆�
-        /// 鐬棿鏁版嵁涓婃姤鐨勪紶鎰熷櫒 (MomentStatus=1    TriggerZoneStatus>=1锛滄姤璀︼紴)
-        /// <para>13:Motion sensor (杩愬姩浼犳劅鍣級</para>
-        /// <para>40 Fire sensor 鐑熼浘浼犳劅鍣�</para>
-        /// <para>42 Water sensor 姘翠镜浼犳劅鍣�</para>
-        /// <para>43 Carbon Monoxide (CO) 鐕冩皵浼犳劅鍣�</para>
-        /// <para>44 Personal emergency device 绱ф�ユ寜閽�</para>
-        /// <para>277 Key fob 閽ュ寵鎵�</para>
-        /// <para>鎸佺画鏁版嵁涓婃姤(MomentStatus=0   TriggerZoneStatus>=1锛滄姤璀︼紴  TriggerZoneStatus=0锛滃彇娑堟姤璀︼紴)</para>
-        /// <para>21: Door/Window 闂ㄧ獥浼犳劅鍣紙鏈�21鍜�22锛岃繖閲屾病鏈夊啓閿欙級</para>
-        /// <para>22:Door/Window 闂ㄧ獥浼犳劅鍣紙鏈�21鍜�22锛岃繖閲屾病鏈夊啓閿�</para>
-        /// </summary>
-        public int IasDeviceType;
-
-        /// <summary>
-        /// 璁惧鍚嶇О,浠ヨ澶囩殑MAC鍛藉悕
-        /// </summary>
-        public string DeviceName = "UnKown";
-
-        /// <summary>
-        /// 璁惧绔偣鍚嶇О锛屼互璁惧绔偣鍚嶇О鍛藉悕
-        /// </summary>
-        public string DeviceEpointName = "UnKown";
-
-        /// <summary>
-        /// 鐢ㄤ簬鍒ゆ柇璁惧鐨剒igbee鍗忚鐗堟湰銆�
-        ///<para>49246锛歓LL1.0鏍囧噯璁惧銆�</para>
-        ///<para>260锛� ZHA1.2鏍囧噯璁惧銆� Z3.0鏍囧噯璁惧銆�</para>
-        ///<para>41440锛歓GP3.0鏍囧噯璁惧銆�</para>
-        ///<para>265锛歓SE1.4鏍囧噯璁惧銆�</para>
-        /// </summary>
-        public int Profile;
-        /// <summary>
-        /// 0锛氳澶囦笉鍦ㄧ嚎
-        /// <para>1锛氳澶囧湪绾�</para>
-        /// </summary>
-        public int IsOnline;
-        /// <summary>
-        /// 褰撳墠杩愯绋嬪簭鐗堟湰淇℃伅銆� 鏈�澶�64瀛楄妭
-        /// </summary>
-        public int ImgVersion;
-        /// <summary>
-        /// 纭欢鐗堟湰
-        /// </summary>
-        public int HwVersion;
-        /// <summary>
-        /// 褰撳墠闀滃儚绫诲瀷id
-        /// </summary>
-        public int ImgTypeId;
-        /// <summary>
-        /// 椹卞姩浠g爜銆備负0鏃讹紝琛ㄧずzigbee鍗忚皟鍣ㄨ澶囥�傚叾浠栧�艰〃绀轰负铏氭嫙椹卞姩璁惧
-        /// </summary>
-        public int DriveCode;
-        /// <summary>
-        /// 鐢熶骇鍟嗗悕瀛�
-        /// </summary>
-        public string ManufacturerName = string.Empty;
-        /// <summary>
-        /// 妯″潡ID锛堣繖涓笢瑗夸篃鍙�愬瀷鍙风爜銆戯級
-        /// </summary>
-        public string ModelIdentifier = string.Empty;
-        /// <summary>
-        /// 鐢熶骇鏃ユ湡
-        /// </summary>
-        public string ProductionDate = string.Empty;
-        /// <summary>
-        /// 鐢垫簮
-        /// </summary>
-        public int PowerSource = -1;
-        /// <summary>
-        /// 搴忓垪鍙�
-        /// </summary>
-        public string SerialNumber = string.Empty;
-        /// <summary>
-        /// 鎵�鏈夋寚瀹歝luster鏄惁閮藉凡缁忔垚鍔熺粦瀹氬崗璋冨櫒
-        ///<para>0:鏈畬鍏ㄧ粦瀹�</para>
-        ///<para>1锛氬凡缁忕粦瀹�</para>
-        /// </summary>
-        public int ClusterBindZbSuccess = -1;
-        /// <summary>
-        /// 鏄惁鑾峰彇鎵�鏈夐粯璁ょ粦瀹氫俊鎭�
-        ///<para>0锛氬惁</para>
-        ///<para>1锛氭槸</para>
-        /// </summary>
-        public int IsGetAllDefaultBind = -1;
-        /// <summary>
-        /// 杈撳叆绨囧垪琛�
-        /// </summary>
-        public List<InClusterObj> InClusterList = new List<InClusterObj>();
-        /// <summary>
-        /// 杈撳嚭绨囧垪琛�
-        /// </summary>
-        public List<OutClusterObj> OutClusterList = new List<OutClusterObj>();
-        /// <summary>
-        /// 鐢ㄤ簬璁板綍璁惧鏈�鏂颁笂鎶ョ殑灞炴�х姸鎬佷俊鎭�傛渶澶ф敮鎸佽褰�16涓睘鎬х姸鎬侊紝涓斿彧璁板綍灞炴�у�奸暱搴︿笉澶т簬4瀛楄妭鐨勬暟鎹��
-        /// </summary>
-        public List<AttributeStatusObj> AttributeStatus = new List<AttributeStatusObj>();
-
-        /// <summary>
-        /// 璁惧鏈�鏂颁笂鎶ョ殑灞炴�х姸鎬佷俊鎭�
-        /// </summary>
-        [System.Serializable]
-        public class AttributeStatusObj
-        {
-            /// <summary>
-            /// 灞炴�х皣id
-            /// </summary>
-            public int ClusterId;
-            /// <summary>
-            /// 灞炴�d
-            /// </summary>
-            public int AttributeId;
-            /// <summary>
-            /// 灞炴�у�硷紝鏈�澶у崰鐢�4涓瓧鑺�
-            /// </summary>
-            public int AttributeData;
-            /// <summary>
-            /// 灞炴�х姸鎬佹渶鍚庢洿鏂扮殑utc鏃堕棿鎴�
-            /// </summary>
-            public int ReportTime;
-        }
-
-        /// <summary>
-        /// 杈撳叆绨�
-        /// </summary>
-        [System.Serializable]
-        public class InClusterObj
-        {
-            /// <summary>
-            /// 璁惧鏀寔鐨勮緭鍏ュ姛鑳�
-            /// <para>0:Basic,璁惧鏀寔鈥滃熀纭�灞炴�р�� </para>
-            /// <para>3:Identify,璁惧鏀寔鈥滆瘑鍒姛鑳解��</para>
-            /// <para>4:Groups,璁惧鏀寔鈥滅粍鍔熻兘鈥�</para>
-            /// <para>5:Scenes,璁惧鏀寔鈥滃満鏅姛鑳解��</para>
-            /// <para>6:on/off,璁惧鏀寔鈥滃紑鍏冲姛鑳解��</para>
-            /// 寮�鍏冲姛鑳界殑璁惧濡傦細璋冨叧鐏�/缁х數鍣�/绐楀笜绛夈�傘�傘��
-            /// <para>8:Level Control,璁惧鏀寔鈥滀寒搴﹁皟鑺傚姛鑳解��</para>
-            /// 浜害璋冭妭鍔熻兘鐨勮澶囧锛氳皟鍏崇伅銆傘�傘��
-            /// <para>257:Door Lock,璁惧鏀寔鈥滈棬閿佸姛鑳解��</para>
-            /// 闂ㄩ攣鍔熻兘鐨勮澶囧锛氶棬閿併�傘�傘��
-            ///  <para>258:Window Covering,璁惧鏀寔鈥滅獥甯樻帶鍒跺姛鑳解��</para>
-            /// 绐楀笜鎺у埗鍔熻兘鐨勮澶囧锛氱獥甯�/寮�鍚堝笜/鍗峰笜銆傘�傘��
-            /// <para>513:Thermostat,璁惧鏀寔鈥滄亽娓╁櫒鍔熻兘鈥�</para>
-            /// 鎭掓俯鍣ㄥ姛鑳界殑璁惧濡傦細绌鸿皟銆傘�傘��
-            /// <para>768:Color Control,璁惧鏀寔鈥滈鑹茶皟鑺傚姛鑳解��</para>
-            /// 棰滆壊璋冭妭鍔熻兘鐨勮澶囧锛氳皟鍏夌伅銆傘�傘��
-            /// <para>1026:Temperature Measurement,璁惧鏀寔鈥滄俯搴︽祴閲忓姛鑳解��</para>
-            /// 娓╁害娴嬮噺鍔熻兘鐨勮澶囧锛氭俯搴︿紶鎰熷櫒銆傘�傘��
-            /// <para>1029:Relative Humidity Measurement,璁惧鏀寔鈥滄箍搴︽祴閲忓姛鑳解��</para>
-            /// 婀垮害娴嬮噺鍔熻兘鐨勮澶囧锛氭箍搴︿紶鎰熷櫒銆傘�傘��
-            /// </summary>
-            public int InCluster;
-        }
-
-        /// <summary>
-        /// 杈撳嚭绨�
-        /// </summary>
-        [System.Serializable]
-        public class OutClusterObj
-        {
-            /// <summary>
-            /// 璁惧鏀寔鐨勮緭鍑哄姛鑳�
-            /// <para>0:Basic,璁惧鏀寔鈥滃熀纭�灞炴�р�� </para>
-            /// <para>3:Identify,璁惧鏀寔鈥滆瘑鍒姛鑳解��</para>
-            /// <para>4:Groups,璁惧鏀寔鈥滅粍鍔熻兘鈥�</para>
-            /// <para>5:Scenes,璁惧鏀寔鈥滃満鏅姛鑳解��</para>
-            /// <para>6:on/off,璁惧鏀寔鈥滃紑鍏冲姛鑳解��</para>
-            /// 寮�鍏冲姛鑳界殑璁惧濡傦細璋冨叧鐏�/缁х數鍣�/绐楀笜绛夈�傘�傘��
-            /// <para>8:Level Control,璁惧鏀寔鈥滀寒搴﹁皟鑺傚姛鑳解��</para>
-            /// 浜害璋冭妭鍔熻兘鐨勮澶囧锛氳皟鍏崇伅銆傘�傘��
-            /// <para>257:Door Lock,璁惧鏀寔鈥滈棬閿佸姛鑳解��</para>
-            /// 闂ㄩ攣鍔熻兘鐨勮澶囧锛氶棬閿併�傘�傘��
-            ///  <para>258:Window Covering,璁惧鏀寔鈥滅獥甯樻帶鍒跺姛鑳解��</para>
-            /// 绐楀笜鎺у埗鍔熻兘鐨勮澶囧锛氱獥甯�/寮�鍚堝笜/鍗峰笜銆傘�傘��
-            /// <para>513:Thermostat,璁惧鏀寔鈥滄亽娓╁櫒鍔熻兘鈥�</para>
-            /// 鎭掓俯鍣ㄥ姛鑳界殑璁惧濡傦細绌鸿皟銆傘�傘��
-            /// <para>768:Color Control,璁惧鏀寔鈥滈鑹茶皟鑺傚姛鑳解��</para>
-            /// 棰滆壊璋冭妭鍔熻兘鐨勮澶囧锛氳皟鍏夌伅銆傘�傘��
-            /// <para>1026:Temperature Measurement,璁惧鏀寔鈥滄俯搴︽祴閲忓姛鑳解��</para>
-            /// 娓╁害娴嬮噺鍔熻兘鐨勮澶囧锛氭俯搴︿紶鎰熷櫒銆傘�傘��
-            /// <para>1029:Relative Humidity Measurement,璁惧鏀寔鈥滄箍搴︽祴閲忓姛鑳解��</para>
-            /// 婀垮害娴嬮噺鍔熻兘鐨勮澶囧锛氭箍搴︿紶鎰熷櫒銆傘�傘��
-            /// </summary>
-            public int OutCluster;
-        }
-
-        /// <summary>
-        /// 鏀寔鐨勫睘鎬ф暟鎹�
-        /// </summary>
-        [System.Serializable]
-        public class AttributeObj
-        {
-            /// <summary>
-            /// 鍝嶅簲鐨勫睘鎬D
-            /// </summary>
-            public int AttributeId;
-            /// <summary>
-            /// 灞炴�у�肩殑鏁版嵁绫诲瀷
-            /// </summary>
-            public int AttributeType;
-        }
-
-        /// <summary>
-        /// 璁惧涓婃姤鐨勫睘鎬ф暟鎹�
-        /// </summary>
-        [System.Serializable]
-        public class AttributeDataObj
-        {
-            /// <summary>
-            /// 灞炴�d
-            /// </summary>
-            public int AttributeId;
-            /// <summary>
-            /// 瑕佹姤鍛婂睘鎬х殑鏁版嵁绫诲瀷
-            /// </summary>
-            public int AttriButeDataType;
-            /// <summary>
-            /// AttriButeData鍗犵敤鐨勫瓧鑺傛暟
-            /// </summary>
-            public int AttriButeDataLength;
-            /// <summary>
-            /// 灞炴�у��
-            /// </summary>
-            public int AttriButeData = 999;
-            /// <summary>
-            /// 灞炴�ф暟鎹�16杩涘埗杞瓧绗�
-            /// </summary>
-            public string AttriButeDataHex;
-        }
-
-        /// <summary>
-        /// Command鏁扮粍
-        /// </summary>
-        [System.Serializable]
-        public class CommandObj
-        {
-            /// <summary>
-            /// 鏀寔鐨勫懡浠d
-            /// </summary>
-            public int commandId;
-        }
-
-        #region 浜屻�佽幏鍙栧凡鍏ョ綉璁惧淇℃伅
-
-        /// <summary>
-        /// 缃戝叧涓殑璁惧淇℃伅
-        /// </summary>
-        public DeviceInfoData DeviceInfo = new DeviceInfoData();
-        /// <summary>
-        /// 缃戝叧涓殑璁惧淇℃伅
-        /// </summary>
-        [System.Serializable]
-        public class DeviceInfoData
-        {
-            /// <summary>
-            /// 鍏ョ綉璁惧鎬绘暟銆傜瓑浜�0鏃讹紝琛ㄧず娌℃湁璁惧淇℃伅锛屼笅闈㈠瓧娈靛皢涓嶅瓨鍦ㄣ��
-            /// </summary>
-            public int TotalNum;
-            /// <summary>
-            /// 鏍囪瘑褰撳墠璁惧鏄彂閫佺殑鏄鍑犱釜璁惧銆侱eviceNum浠�1寮�濮嬫瘡鍙戦�佷竴涓澶囦俊鎭紝涓嬩竴涓澶囦俊鎭殑DeviceNum灏嗗姞1銆傜洿鍒癉eviceNum绛変簬TotalNum璇存槑鎵�鏈夎澶囦俊鎭彂閫佸畬姣曘��
-            /// </summary>
-            public int DeviceNum;
-            /// <summary>
-            /// 鍏ョ綉鐨剈tc鏃堕棿鎴�
-            /// </summary>
-            public int JoinTime;
-            /// <summary>
-            /// 1:璺敱鍣ㄨ澶�
-            /// <para>2锛氱粓绔澶�</para>
-            /// </summary>
-            public int ZigbeeType;
-            /// <summary>
-            /// 璁惧缃戠粶鍦板潃
-            /// </summary>
-            public int NwkAddr;
-            /// <summary>
-            /// 璇ュ瓧娈典富瑕侀拡瀵笽AS瀹夐槻璁惧璁剧珛銆傛墍鏈塈AS瀹夐槻璁惧鍏辩敤涓�涓狣eviceID涓�1026銆傛墍浠ヨ鍖哄垎瀛愯澶囩被鍨嬶紝闇�瑕佽瀛楁銆�
-            /// <para>13:Motion sensor (杩愬姩浼犳劅鍣級</para>
-            /// <para>43:Carbon Monoxide sensor (涓�姘у寲纰充紶鎰熷櫒锛�</para>
-            /// <para>44:Personal emergency device (绱ф�ユ寜閽級</para>
-            /// </summary>
-            public int DeviceType;
-            /// <summary>
-            /// 鐢ㄤ簬鍒ゆ柇璁惧鐨剒igbee鍗忚鐗堟湰銆�
-            ///<para>49246锛歓LL1.0鏍囧噯璁惧銆�</para>
-            ///<para>260锛� ZHA1.2鏍囧噯璁惧銆� Z3.0鏍囧噯璁惧銆�</para>
-            ///<para>41440锛歓GP3.0鏍囧噯璁惧銆�</para>
-            ///<para>265锛歓SE1.4鏍囧噯璁惧銆�</para>
-            /// </summary>
-            public int Profile;
-            /// <summary>
-            /// 璁惧mac鍚嶇О
-            /// </summary>
-            public string MacName;
-            /// <summary>
-            /// 璁惧鍚�(Mac+鏂偣鍛藉悕鐨勶級
-            /// </summary>
-            public string DeviceName;
-            /// <summary>
-            /// 0锛氳澶囦笉鍦ㄧ嚎
-            /// <para>1锛氳澶囧湪绾�</para>
-            /// </summary>
-            public int IsOnline;
-            /// <summary>
-            /// 褰撳墠杩愯绋嬪簭鐗堟湰淇℃伅銆� 鏈�澶�64瀛楄妭
-            /// </summary>
-            public int ImgVersion;
-            /// <summary>
-            /// 纭欢鐗堟湰
-            /// </summary>
-            public int HwVersion;
-            /// <summary>
-            /// 褰撳墠闀滃儚绫诲瀷id
-            /// </summary>
-            public int ImgTypeId;
-            /// <summary>
-            /// 椹卞姩浠g爜銆備负0鏃讹紝琛ㄧずzigbee鍗忚皟鍣ㄨ澶囥�傚叾浠栧�艰〃绀轰负铏氭嫙椹卞姩璁惧
-            /// </summary>
-            public int DriveCode;
-            /// <summary>
-            /// 鍘傚晢鍚嶇О
-            /// </summary>
-            public string ManufacturerName = string.Empty;
-            /// <summary>
-            /// 妯″潡ID
-            /// </summary>
-            public string ModelIdentifier = string.Empty;
-            /// <summary>
-            /// 濂藉儚鏄簭鍒楀彿
-            /// </summary>
-            public string ProductCode = string.Empty;
-            /// <summary>
-            /// 杈撳叆绨囧垪琛�
-            /// </summary>
-            public List<InClusterObj> InClusterList = new List<InClusterObj>();
-            /// <summary>
-            /// 杈撳嚭绨囧垪琛�
-            /// </summary>
-            public List<OutClusterObj> OutClusterList = new List<OutClusterObj>();
-            /// <summary>
-            /// 鐢ㄤ簬璁板綍璁惧鏈�鏂颁笂鎶ョ殑灞炴�х姸鎬佷俊鎭�傛渶澶ф敮鎸佽褰�16涓睘鎬х姸鎬侊紝涓斿彧璁板綍灞炴�у�奸暱搴︿笉澶т簬4瀛楄妭鐨勬暟鎹��
-            /// </summary>
-            public List<AttributeStatusObj> AttributeStatus = new List<AttributeStatusObj>();
-
-        }
-
-        /// <summary>
-        /// 鑾峰彇鎵�鏈夌綉鍏崇殑鑺傜偣璁惧淇℃伅锛堢敤浜庝富缃戝叧锛�
-        /// </summary>
-        public AllGatewayDeviceInfo getAllGatewayDeviceInfo;
-        /// <summary>
-        /// 鑾峰彇鎵�鏈夌綉鍏崇殑鑺傜偣璁惧淇℃伅锛堢敤浜庝富缃戝叧锛�
-        /// </summary>
-        [System.Serializable]
-        public class AllGatewayDeviceInfo
-        {
-            /// <summary>
-            /// 鍏ョ綉璁惧鎬绘暟銆傜瓑浜�0鏃讹紝琛ㄧず娌℃湁璁惧淇℃伅锛屼笅闈㈠瓧娈靛皢涓嶅瓨鍦ㄣ��
-            /// </summary>
-            public int TotalNum;
-            /// <summary>
-            /// 鏍囪瘑褰撳墠璁惧鏄彂閫佺殑鏄鍑犱釜璁惧銆侱eviceNum浠�1寮�濮嬫瘡鍙戦�佷竴涓澶囦俊鎭紝涓嬩竴涓澶囦俊鎭殑DeviceNum灏嗗姞1銆傜洿鍒癉eviceNum绛変簬TotalNum璇存槑鎵�鏈夎澶囦俊鎭彂閫佸畬姣曘��
-            /// </summary>
-            public int DeviceNum;
-            /// <summary>
-            /// 璁惧鎵�鍦ㄧ綉鍏崇殑缃戝叧id
-            /// </summary>
-            public string GwId;
-            /// <summary>
-            /// 鍏ョ綉鐨剈tc鏃堕棿鎴�
-            /// </summary>
-            public int JoinTime;
-            /// <summary>
-            /// 1:璺敱鍣ㄨ澶�
-            /// <para>2:缁堢璁惧</para>
-            /// </summary>
-            public int ZigbeeType;
-            /// <summary>
-            /// 璁惧缃戠粶鍦板潃
-            /// </summary>
-            public int NwkAddr;
-            /// <summary>
-            /// 璇ュ瓧娈典富瑕侀拡瀵笽AS瀹夐槻璁惧璁剧珛銆傛墍鏈塈AS瀹夐槻璁惧鍏辩敤涓�涓狣eviceID涓�1026銆傛墍浠ヨ鍖哄垎瀛愯澶囩被鍨嬶紝闇�瑕佽瀛楁銆�
-            /// <para>13:Motion sensor (杩愬姩浼犳劅鍣級</para>
-            /// <para>43:Carbon Monoxide sensor (涓�姘у寲纰充紶鎰熷櫒锛�</para>
-            /// <para>44:Personal emergency device (绱ф�ユ寜閽級</para>
-            /// </summary>
-            public int DeviceType;
-            /// <summary>
-            /// 鐢ㄤ簬鍒ゆ柇璁惧鐨剒igbee鍗忚鐗堟湰銆�
-            /// <para>49246锛歓LL1.0鏍囧噯璁惧銆�</para>
-            /// <para>260锛� ZHA1.2鏍囧噯璁惧銆� Z3.0鏍囧噯璁惧銆�</para>
-            /// <para>41440锛歓GP3.0鏍囧噯璁惧銆�</para>
-            /// <para>265锛歓SE1.4鏍囧噯璁惧銆�</para>
-            /// </summary>
-            public int Profile;
-            /// <summary>
-            /// 璁惧绔偣鍚�
-            /// </summary>
-            public string DeviceName;
-            /// <summary>
-            /// 璁惧鍚�
-            /// </summary>
-            public string MacName;
-            /// <summary>
-            /// 0锛氳澶囦笉鍦ㄧ嚎
-            /// <para>1锛氳澶囧湪绾�</para>
-            /// </summary>
-            public int IsOnline;
-            /// <summary>
-            /// 褰撳墠杩愯绋嬪簭鐗堟湰淇℃伅銆� 鏈�澶�64瀛楄妭
-            /// </summary>
-            public int ImgVersion;
-            /// <summary>
-            /// 纭欢鐗堟湰
-            /// </summary>
-            public int HwVersion;
-            /// <summary>
-            /// 褰撳墠闀滃儚绫诲瀷id
-            /// </summary>
-            public int ImgTypeId;
-            /// <summary>
-            /// 椹卞姩浠g爜銆備负0鏃讹紝琛ㄧずzigbee鍗忚皟鍣ㄨ澶囥�傚叾浠栧�艰〃绀轰负铏氭嫙椹卞姩璁惧
-            /// </summary>
-            public int DriveCode;
-            /// <summary>
-            /// 杈撳叆绨囧垪琛�
-            /// </summary>
-            public List<InClusterObj> InClusterList = new List<InClusterObj>();
-
-            /// <summary>
-            /// 杈撳嚭绨囧垪琛�
-            /// </summary>
-            public List<OutClusterObj> OutClusterList = new List<OutClusterObj>();
-            /// <summary>
-            /// 鐢ㄤ簬璁板綍璁惧鏈�鏂颁笂鎶ョ殑灞炴�х姸鎬佷俊鎭�傛渶澶ф敮鎸佽褰�16涓睘鎬х姸鎬侊紝涓斿彧璁板綍灞炴�у�奸暱搴︿笉澶т簬4瀛楄妭鐨勬暟鎹��
-            /// </summary>
-            public List<AttributeStatusObj> AttributeStatus = new List<AttributeStatusObj>();
-
-        }
-
-        /// <summary>
-        /// 鑾峰彇缃戝叧璁板綍鐨勮澶囧睘鎬х姸鎬�
-        /// </summary>
-        public GetStatusRecordAllInfo getStatusRecordAllInfo;
-        /// <summary>
-        /// 鑾峰彇缃戝叧璁板綍鐨勮澶囧睘鎬х姸鎬�
-        /// </summary>
-        [System.Serializable]
-        public class GetStatusRecordAllInfo
-        {
-            /// <summary>
-            /// 閿欒淇℃伅
-            /// </summary>
-            public string errorMessageBase;
-            /// <summary>
-            /// 缃戝叧淇℃伅閿欒鍙嶉
-            /// <para>褰撶綉鍏虫帴鏀跺埌瀹㈡埛绔俊鎭悗锛屽嚭鐜颁互涓嬪紓甯告儏鍐靛皢鍙嶉閿欒銆�</para>
-            /// </summary>
-            public ErrorResponData errorResponData;
-            /// <summary>
-            /// 璁惧鍚嶇О淇敼
-            /// </summary>
-            public GetStatusRecordInfo getStatusRecordInfo;
-        }
-
-        /// <summary>
-        /// 鑾峰彇鎵�鏈夌綉鍏崇殑鑺傜偣璁惧淇℃伅锛堢敤浜庝富缃戝叧锛�
-        /// </summary>
-        public GetStatusRecordInfo getStatusRecordInfo;
-        /// <summary>
-        /// 鑾峰彇鎵�鏈夌綉鍏崇殑鑺傜偣璁惧淇℃伅锛堢敤浜庝富缃戝叧锛�
-        /// </summary>
-        [System.Serializable]
-        public class GetStatusRecordInfo
-        {
-            /// <summary>
-            /// 璁惧鎵�鍦ㄧ綉鍏崇殑缃戝叧id
-            /// </summary>
-            public string GwId;
-            /// <summary>
-            /// 鍏ョ綉鐨剈tc鏃堕棿鎴�
-            /// </summary>
-            public int JoinTime;
-            /// <summary>
-            /// 1:璺敱鍣ㄨ澶�
-            /// <para>2:缁堢璁惧</para>
-            /// </summary>
-            public int ZigbeeType;
-            /// <summary>
-            /// 璁惧缃戠粶鍦板潃
-            /// </summary>
-            public int NwkAddr;
-            /// <summary>
-            /// 璇ュ瓧娈典富瑕侀拡瀵笽AS瀹夐槻璁惧璁剧珛銆傛墍鏈塈AS瀹夐槻璁惧鍏辩敤涓�涓狣eviceID涓�1026銆傛墍浠ヨ鍖哄垎瀛愯澶囩被鍨嬶紝闇�瑕佽瀛楁銆�
-            /// <para>13:Motion sensor (杩愬姩浼犳劅鍣級</para>
-            /// <para>43:Carbon Monoxide sensor (涓�姘у寲纰充紶鎰熷櫒锛�</para>
-            /// <para>44:Personal emergency device (绱ф�ユ寜閽級</para>
-            /// </summary>
-            public int DeviceType;
-            /// <summary>
-            /// 鐢ㄤ簬鍒ゆ柇璁惧鐨剒igbee鍗忚鐗堟湰銆�
-            /// <para>49246锛歓LL1.0鏍囧噯璁惧銆�</para>
-            /// <para>260锛� ZHA1.2鏍囧噯璁惧銆� Z3.0鏍囧噯璁惧銆�</para>
-            /// <para>41440锛歓GP3.0鏍囧噯璁惧銆�</para>
-            /// <para>265锛歓SE1.4鏍囧噯璁惧銆�</para>
-            /// </summary>
-            public int Profile;
-            /// <summary>
-            /// 璁惧绔偣鍚�
-            /// </summary>
-            public string DeviceName;
-            /// <summary>
-            /// 璁惧鍚�
-            /// </summary>
-            public string MacName;
-            /// <summary>
-            /// 0锛氳澶囦笉鍦ㄧ嚎
-            /// <para>1锛氳澶囧湪绾�</para>
-            /// </summary>
-            public int IsOnline;
-            /// <summary>
-            /// 褰撳墠杩愯绋嬪簭鐗堟湰淇℃伅銆� 鏈�澶�64瀛楄妭
-            /// </summary>
-            public int ImgVersion;
-            /// <summary>
-            /// 纭欢鐗堟湰
-            /// </summary>
-            public int HwVersion;
-            /// <summary>
-            /// 褰撳墠闀滃儚绫诲瀷id
-            /// </summary>
-            public int ImgTypeId;
-            /// <summary>
-            /// 椹卞姩浠g爜銆備负0鏃讹紝琛ㄧずzigbee鍗忚皟鍣ㄨ澶囥�傚叾浠栧�艰〃绀轰负铏氭嫙椹卞姩璁惧
-            /// </summary>
-            public int DriveCode;
-            /// <summary>
-            /// 杈撳叆绨囧垪琛�
-            /// </summary>
-            public List<InClusterObj> InClusterList = new List<InClusterObj>();
-            /// <summary>
-            /// 杈撳嚭绨囧垪琛�
-            /// </summary>
-            public List<OutClusterObj> OutClusterList = new List<OutClusterObj>();
-            /// <summary>
-            /// 鐢ㄤ簬璁板綍璁惧鏈�鏂颁笂鎶ョ殑灞炴�х姸鎬佷俊鎭�傛渶澶ф敮鎸佽褰�16涓睘鎬х姸鎬侊紝涓斿彧璁板綍灞炴�у�奸暱搴︿笉澶т簬4瀛楄妭鐨勬暟鎹��
-            /// </summary>
-            public List<AttributeStatusObj> AttributeStatus = new List<AttributeStatusObj>();
-        }
-        #endregion
-
-        /// <summary>
-        /// 鏈夋柊璁惧鍔犲叆zigbee缃戠粶鐨勪俊鎭�
-        /// </summary>
-        public DeviceDeviceJoinZbNetResponData deviceDeviceJoinZbNetResponData;
-        /// <summary>
-        /// 鏈夋柊璁惧鍔犲叆zigbee缃戠粶鐨勪俊鎭�
-        /// </summary>
-        [System.Serializable]
-        public class DeviceDeviceJoinZbNetResponData
-        {
-            /// <summary>
-            /// 璁惧缃戠粶鍦板潃
-            /// </summary>
-            public int NwkAddr;
-            /// <summary>
-            /// 1:璺敱鍣ㄨ澶�
-            /// <para>2:缁堢璁惧</para>
-            /// </summary>
-            public int ZigbeeType;
-        }
-
-        /// <summary>
-        /// 鑾峰彇鏂拌澶囨墍鏈夌鐐逛俊鎭槸鍚︽垚鍔熶俊鎭�
-        /// </summary>
-        public DeviceIsGetEpointInfoResponData deviceIsGetEpointInfoResponData;
-        /// <summary>
-        /// 鑾峰彇鏂拌澶囨墍鏈夌鐐逛俊鎭槸鍚︽垚鍔熶俊鎭�
-        /// </summary>
-        [System.Serializable]
-        public class DeviceIsGetEpointInfoResponData
-        {
-            /// <summary>
-            /// 0锛氭垚鍔熻幏鍙栨墍鏈夌鐐逛俊鎭�
-            ///<para>1锛氳幏鍙栧け璐�</para>
-            /// </summary>
-            public int Result;
-        }
-
-        /// <summary>
-        /// 缃戝叧涓柊鎼滅储鍑虹殑璁惧淇℃伅
-        /// </summary>
-        public NewDeviceInfoData getNewDeviceInfo;
-        /// <summary>
-        /// 缃戝叧涓柊鎼滅储鍑虹殑璁惧淇℃伅
-        /// </summary>
-        [System.Serializable]
-        public class NewDeviceInfoData
-        {
-            /// <summary>
-            /// 鍏ョ綉鐨剈tc鏃堕棿鎴�
-            /// </summary>
-            public int JoinTime;
-            /// <summary>
-            /// 1:璺敱鍣ㄨ澶�
-            /// <para>2:缁堢璁惧</para>
-            /// </summary>
-            public int ZigbeeType;
-            /// <summary>
-            /// 璁惧缃戠粶鍦板潃
-            /// </summary>
-            public int NwkAddr;
-            /// <summary>
-            /// 璇ュ瓧娈典富瑕侀拡瀵笽AS瀹夐槻璁惧璁剧珛銆傛墍鏈塈AS瀹夐槻璁惧鍏辩敤涓�涓狣eviceID涓�1026銆傛墍浠ヨ鍖哄垎瀛愯澶囩被鍨嬶紝闇�瑕佽瀛楁銆�
-            /// <para>13:Motion sensor (杩愬姩浼犳劅鍣級</para>
-            /// <para>43:Carbon Monoxide sensor (涓�姘у寲纰充紶鎰熷櫒锛�</para>
-            /// <para>44:Personal emergency device (绱ф�ユ寜閽級</para>
-            /// </summary>
-            public int DeviceType;
-            /// <summary>
-            /// 鐢ㄤ簬鍒ゆ柇璁惧鐨剒igbee鍗忚鐗堟湰銆傚尯鍒�3.0璁惧鍜孼HA璁惧
-            /// <para>49246锛歓LL1.0鏍囧噯璁惧銆�</para>
-            /// <para>260锛� ZHA1.2鏍囧噯璁惧銆� Z3.0鏍囧噯璁惧銆�</para>
-            /// <para>41440锛歓GP3.0鏍囧噯璁惧銆�</para>
-            /// <para>265锛歓SE1.4鏍囧噯璁惧銆�</para>
-            /// </summary>
-            public int Profile;
-            /// <summary>
-            /// 鏄惁鏄柊鍏ョ綉璁惧銆�
-            /// <para>濡傛灉缃戝叧鍌ㄥ瓨鐨勮澶囧垪琛ㄤ腑鍘熸潵鏄病鏈夎璁惧鍒欎负鏂板叆缃戣澶囥��</para>
-            /// <para>濡傛灉缃戝叧鍌ㄥ瓨鐨勮澶囧垪琛ㄤ腑鏈夎璁惧鍒欎负鏃ц澶囥��</para>
-            /// <para>濡傛灉閲嶅叆缃戝悗璁惧淇℃伅宸茬粡鏀瑰彉锛堝璁惧鐨勭綉缁滃湴鍧�锛岃澶嘔D锛宑luster鍒楄〃锛夊垯涔熻涓烘柊璁惧鍏ョ綉銆�</para>
-            /// <para>璇ュ瓧娈电敤鏉ュ垽鍒敤鎴峰彲鑳介�氳繃鑺傜偣鐨勫疄浣撴寜閿皢璁惧鎭㈠鍑哄巶璁惧鍚庤妭鐐硅澶囬噸鏂板叆缃戠殑鎯呭喌鎴栬妭鐐硅澶囬噸鍚富鍔ㄥ彂閫佸叆缃戜俊鎭殑鎯呭喌銆�</para>
-            /// <para>0锛氭棫璁惧鍏ョ綉</para>
-            /// <para>1锛氭柊璁惧鍏ョ綉</para>
-            /// <para>2锛氳澶囦负鏂拌澶囷紝骞跺湪涓婃姤璇ヤ俊鎭墠宸茬粡閫�缃戯紝鍗宠澶囧叆缃戝悗缃戝叧杩樻潵涓嶅強涓婃姤璇ヨ澶囦俊鎭澶囦究宸茬粡閫�缃戙�傦紙璁惧鍏ョ綉锛屽埌缃戝叧涓婃姤璁惧淇℃伅鏈変竴娈靛欢鏃讹紝濡傛灉鍦ㄦ鏈熼棿濡傛灉璁惧宸茬粡閫�缃戯紝灏嗗弽棣堣鍊笺�傝鍊间负寮傚父鎯呭喌锛屽綋鏀跺埌璇ュ�兼椂鍊欒鏄庤澶囧苟娌″叆缃戯紝鍙涪寮冭繖涓叆缃戜俊鎭級</para>
-            /// </summary>
-            public int IsNewDev;
-            /// <summary>
-            /// 褰撳墠杩愯绋嬪簭鐗堟湰淇℃伅銆� 鏈�澶�64瀛楄妭
-            /// </summary>
-            public int ImgVersion;
-            /// <summary>
-            /// 纭欢鐗堟湰
-            /// </summary>
-            public int HwVersion;
-            /// <summary>
-            /// 褰撳墠闀滃儚绫诲瀷id
-            /// </summary>
-            public int ImgTypeId;
-            /// <summary>
-            /// 椹卞姩浠g爜銆備负0鏃讹紝琛ㄧずzigbee鍗忚皟鍣ㄨ澶囥�傚叾浠栧�艰〃绀轰负铏氭嫙椹卞姩璁惧
-            /// </summary>
-            public int DriveCode;
-            /// <summary>
-            /// 璁惧鎵�鍦ㄧ綉鍏崇殑缃戝叧id
-            /// </summary>
-            public string GwId;
-            /// <summary>
-            /// 璁惧鍚�
-            /// </summary>
-            public string MacName;
-            /// <summary>
-            /// 璁惧绔偣鍚�
-            /// </summary>
-            public string DeviceName;
-            /// <summary>
-            /// 0锛氳澶囦笉鍦ㄧ嚎
-            /// <para>1锛氳澶囧湪绾�</para>
-            /// </summary>
-            public int IsOnline;
-            /// <summary>
-            /// 鎵�鏈夋寚瀹歝luster鏄惁閮藉凡缁忔垚鍔熺粦瀹氬崗璋冨櫒
-            ///<para>0:鏈畬鍏ㄧ粦瀹�</para>
-            ///<para>1锛氬凡缁忕粦瀹�</para>
-            /// </summary>
-            public int ClusterBindZbSuccess = -1;
-            /// <summary>
-            /// 鏄惁鑾峰彇鎵�鏈夐粯璁ょ粦瀹氫俊鎭�
-            ///<para>0锛氬惁</para>
-            ///<para>1锛氭槸</para>
-            /// </summary>
-            public int IsGetAllDefaultBind = -1;
-            /// <summary>
-            /// 鐢熶骇鍟嗗悕瀛�
-            /// </summary>
-            public string ManufacturerName = string.Empty;
-            /// <summary>
-            /// 妯″潡ID锛堣繖涓笢瑗夸篃鍙�愬瀷鍙风爜銆戯級
-            /// </summary>
-            public string ModelIdentifier = string.Empty;
-            /// <summary>
-            /// 鐢熶骇鏃ユ湡
-            /// </summary>
-            public string ProductionDate = string.Empty;
-            /// <summary>
-            /// 鐢垫簮
-            /// </summary>
-            public int PowerSource = -1;
-            /// <summary>
-            /// 搴忓垪鍙�
-            /// </summary>
-            public string SerialNumber = string.Empty;
-            /// <summary>
-            /// 杈撳叆绨囧垪琛�
-            /// </summary>
-            public List<InClusterObj> InClusterList = new List<InClusterObj>();
-            /// <summary>
-            /// 杈撳嚭绨囧垪琛�
-            /// </summary>
-            public List<OutClusterObj> OutClusterList = new List<OutClusterObj>();
-            /// <summary>
-            /// 鐢ㄤ簬璁板綍璁惧鏈�鏂颁笂鎶ョ殑灞炴�х姸鎬佷俊鎭�傛渶澶ф敮鎸佽褰�16涓睘鎬х姸鎬侊紝涓斿彧璁板綍灞炴�у�奸暱搴︿笉澶т簬4瀛楄妭鐨勬暟鎹��
-            /// </summary>
-            public List<AttributeStatusObj> AttributeStatus = new List<AttributeStatusObj>();
-        }
-
-        /// <summary>
-        /// 缃戝叧淇℃伅閿欒鍙嶉
-        /// <para>褰撶綉鍏虫帴鏀跺埌瀹㈡埛绔俊鎭悗锛屽嚭鐜颁互涓嬪紓甯告儏鍐靛皢鍙嶉閿欒銆�</para>
-        /// </summary>
-        public ErrorResponData errorResponData;
-        /// <summary>
-        /// 缃戝叧淇℃伅閿欒鍙嶉
-        /// <para>褰撶綉鍏虫帴鏀跺埌瀹㈡埛绔俊鎭悗锛屽嚭鐜颁互涓嬪紓甯告儏鍐靛皢鍙嶉閿欒銆�</para>
-        /// </summary>
-        [System.Serializable]
-        public class ErrorResponData
-        {
-            /// <summary>
-            /// Error鍙傛暟鍚箟
-            ///<para>1锛氱綉鍏虫棤娉曡В鏋愬懡浠ゆ暟鎹��</para>
-            ///<para>2锛氬崗璋冨櫒姝e湪鍗囩骇鎴栧浠�/鎭㈠鏁版嵁
-            ///<para>3锛氭搷浣滆澶�/缁�/鍦烘櫙涓嶅瓨鍦�</para>
-            ///<para>4锛氬叾浠栭敊璇�</para>
-            ///<para>5锛氭暟鎹紶杈撻敊璇紙鍦ㄦ煇娆″鎴风鍚戠綉鍏冲彂閫佹暟鎹殑杩囩▼涓紝缃戝叧鍦ㄥ悎鐞嗘椂闂磋寖鍥村唴鎺ユ敹瀹㈡埛绔暟鎹笉瀹屾暣瀵艰嚧璇ラ敊璇彂鐢熴�傚瀹㈡埛绔悜缃戝叧涓�娆″彂閫�100涓瓧鑺傜殑鏁版嵁锛屼絾缃戝叧绛夊緟鎺ユ敹浜嗕竴绉掑彧鎺ユ敹浜�80涓瓧鑺傘�傚彂鐢熻閿欒锛岀綉鍏冲皢涓诲姩鍏抽棴瀹㈡埛绔繛鎺ワ級</para>
-            /// </summary>
-            public int Error;
-        }
-
-        /// <summary>
-        /// 缃戝叧閿欒淇℃伅鍏蜂綋鍐呭
-        /// </summary>
-        public static string ErrorMess(int err)
-        {
-            string message = "";
-            switch (err)
-            {
-                case 1:
-                    message = " 缃戝叧鏃犳硶瑙f瀽鍛戒护鏁版嵁銆�";
-                    break;
-                case 2:
-                    message = " 鍗忚皟鍣ㄦ鍦ㄥ崌绾ф垨澶囦唤 / 鎭㈠鏁版嵁銆�";
-                    break;
-                case 3:
-                    message = "鎿嶄綔璁惧 / 缁� / 鍦烘櫙涓嶅瓨鍦�";
-                    break;
-                case 4:
-                    message = " 鍏朵粬閿欒";
-                    break;
-                case 5:
-                    message = " 鏁版嵁浼犺緭閿欒锛堝湪鏌愭瀹㈡埛绔悜缃戝叧鍙戦�佹暟鎹殑杩囩▼涓紝缃戝叧鍦ㄥ悎鐞嗘椂闂磋寖鍥村唴鎺ユ敹瀹㈡埛绔暟鎹笉瀹屾暣瀵艰嚧璇ラ敊璇彂鐢熴�傚瀹㈡埛绔悜缃戝叧涓�娆″彂閫�100涓瓧鑺傜殑鏁版嵁锛屼絾缃戝叧绛夊緟鎺ユ敹浜嗕竴绉掑彧鎺ユ敹浜� 涓瓧鑺傘�傚彂鐢熻閿欒锛岀綉鍏冲皢涓诲姩鍏抽棴瀹㈡埛绔繛鎺ワ級";
-                    break;
-                default:
-                    break;
-            }
-            return message;
-        }
-
-        #region 淇敼璁惧绔彛鍚嶇О
-        ///<summary >
-        /// 淇敼璁惧绔彛锛堟寜閿級鍚嶇О
-        /// <para>Gateway:璁惧鎵�灞炵綉鍏筹紙璋冪敤鏂规硶锛歞evice.Gateway)</para>
-        /// <para>deviceName:鎸夐敭鍚嶇О</para>
-        /// </summary>
-        public async System.Threading.Tasks.Task<DeviceRenameAllData> RenameDeviceNameAsync(string deviceAddr, int deviceEpoint, string deviceName)
-        {
-            if (Gateway == null)
-            {
-                return null;
-            }
-            return await System.Threading.Tasks.Task.Run(async () =>
-            {
-                DeviceRenameAllData 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 DeviceRenameAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
-                        }
-                        else
-                        {
-                            d = new DeviceRenameAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
-                        }
-                    }
-
-                    if (topic == gatewayID + "/" + "DeviceRenameRespon")
-                    {
-                        var deviceID = jobject.Value<int>("Device_ID");
-                        switch ((DeviceType)(deviceID))
-                        {
-                            case DeviceType.OnOffOutput:
-                                var toggleLight = new ToggleLight() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.CurrentGateWayId };
-                                toggleLight.renameDeviceData = Newtonsoft.Json.JsonConvert.DeserializeObject<ToggleLight.DeviceRenameResponseData>(jobject["Data"].ToString());
-
-                                if (toggleLight.renameDeviceData == null)
-                                {
-                                    d = new DeviceRenameAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
-                                }
-                                else
-                                {
-                                    d = new DeviceRenameAllData { deviceRenameData = toggleLight.renameDeviceData };
-                                    System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
-                                    var infoToggleLight = Gateway.DeviceList.Find((CommonDevice obj) => obj.DeviceID == toggleLight.DeviceID && obj.DeviceAddr == toggleLight.DeviceAddr && obj.DeviceEpoint == toggleLight.DeviceEpoint);
-                                    if (infoToggleLight != null)
-                                    {
-                                        infoToggleLight.DeviceEpointName = toggleLight.renameDeviceData.DeviceName;
-                                    }
-                                }
-                                break;
-                            case DeviceType.AirSwitch:
-                                var airSwitch = new AirSwitch() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.CurrentGateWayId };
-                                airSwitch.renameDeviceData = Newtonsoft.Json.JsonConvert.DeserializeObject<AirSwitch.DeviceRenameResponseData>(jobject["Data"].ToString());
-
-                                if (airSwitch.renameDeviceData == null)
-                                {
-                                    d = new DeviceRenameAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
-                                }
-                                else
-                                {
-                                    d = new DeviceRenameAllData { deviceRenameData = airSwitch.renameDeviceData };
-                                    System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
-                                    var infoAirSwitch = Gateway.DeviceList.Find((CommonDevice obj) => obj.DeviceID == airSwitch.DeviceID && obj.DeviceAddr == airSwitch.DeviceAddr && obj.DeviceEpoint == airSwitch.DeviceEpoint);
-                                    if (infoAirSwitch != null)
-                                    {
-                                        infoAirSwitch.DeviceEpointName = airSwitch.renameDeviceData.DeviceName;
-                                        //infoAirSwitch.ReSave();
-                                    }
-                                }
-                                break;
-                            case DeviceType.OnOffSwitch:
-                                var panelObj = new Panel() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.CurrentGateWayId };
-                                panelObj.renameDeviceData = Newtonsoft.Json.JsonConvert.DeserializeObject<Panel.DeviceRenameResponseData>(jobject["Data"].ToString());
-                                if (panelObj.renameDeviceData == null)
-                                {
-                                    d = new DeviceRenameAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
-                                }
-                                else
-                                {
-                                    d = new DeviceRenameAllData { deviceRenameData = panelObj.renameDeviceData };
-                                    System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
-                                    var infoPanel = Gateway.DeviceList.Find((CommonDevice obj) => obj.DeviceID == panelObj.DeviceID && obj.DeviceAddr == panelObj.DeviceAddr && obj.DeviceEpoint == panelObj.DeviceEpoint);
-                                    if (infoPanel != null)
-                                    {
-                                        infoPanel.DeviceEpointName = panelObj.renameDeviceData.DeviceName;
-                                        //infoPanel.ReSave();
-                                    }
-                                }
-                                break;
-                            case DeviceType.WindowCoveringDevice:
-                                var windowCovering = new Rollershade() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.CurrentGateWayId };
-                                windowCovering.renameDeviceData = Newtonsoft.Json.JsonConvert.DeserializeObject<Rollershade.DeviceRenameResponseData>(jobject["Data"].ToString());
-                                if (windowCovering.renameDeviceData == null)
-                                {
-                                    d = new DeviceRenameAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
-                                }
-                                else
-                                {
-                                    d = new DeviceRenameAllData { deviceRenameData = windowCovering.renameDeviceData };
-                                    System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
-                                    var wc = Gateway.DeviceList.Find((CommonDevice obj) => obj.DeviceID == windowCovering.DeviceID && obj.DeviceAddr == windowCovering.DeviceAddr && obj.DeviceEpoint == windowCovering.DeviceEpoint);
-                                    if (wc != null)
-                                    {
-                                        wc.DeviceEpointName = windowCovering.renameDeviceData.DeviceName;
-                                    }
-                                }
-
-                                break;
-                            case DeviceType.IASZone:
-                                var ias = new IASZone() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.CurrentGateWayId };
-                                ias.renameDeviceData = Newtonsoft.Json.JsonConvert.DeserializeObject<Rollershade.DeviceRenameResponseData>(jobject["Data"].ToString());
-                                if (ias.renameDeviceData == null)
-                                {
-                                    d = new DeviceRenameAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
-                                }
-                                else
-                                {
-                                    d = new DeviceRenameAllData { deviceRenameData = ias.renameDeviceData };
-                                    System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
-
-                                    var zone = Gateway.DeviceList.Find((CommonDevice obj) => obj.DeviceID == ias.DeviceID && obj.DeviceAddr == ias.DeviceAddr && obj.DeviceEpoint == ias.DeviceEpoint);
-                                    if (zone != null)
-                                    {
-                                        zone.DeviceEpointName = ias.renameDeviceData.DeviceName;
-                                    }
-                                }
-                                break;
-                            case DeviceType.DimmableLight:
-                                var dimmableLight = new DimmableLight() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.CurrentGateWayId };
-                                dimmableLight.renameDeviceData = Newtonsoft.Json.JsonConvert.DeserializeObject<DimmableLight.DeviceRenameResponseData>(jobject["Data"].ToString());
-
-                                if (dimmableLight.renameDeviceData == null)
-                                {
-                                    d = new DeviceRenameAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
-                                }
-                                else
-                                {
-                                    d = new DeviceRenameAllData { deviceRenameData = dimmableLight.renameDeviceData };
-                                    System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
-                                    var info = Gateway.DeviceList.Find((CommonDevice obj) => obj.DeviceID == dimmableLight.DeviceID && obj.DeviceAddr == dimmableLight.DeviceAddr && obj.DeviceEpoint == dimmableLight.DeviceEpoint);
-                                    if (info != null)
-                                    {
-                                        info.DeviceEpointName = dimmableLight.renameDeviceData.DeviceName;
-                                    }
-                                }
-                                break;
-                            case DeviceType.Repeater:
-                                var repeater = new Repeater() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.CurrentGateWayId };
-                                repeater.renameDeviceData = Newtonsoft.Json.JsonConvert.DeserializeObject<Repeater.DeviceRenameResponseData>(jobject["Data"].ToString());
-
-                                if (repeater.renameDeviceData == null)
-                                {
-                                    d = new DeviceRenameAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
-                                }
-                                else
-                                {
-                                    d = new DeviceRenameAllData { deviceRenameData = repeater.renameDeviceData };
-                                    System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
-                                    var info = Gateway.DeviceList.Find((CommonDevice obj) => obj.DeviceID == repeater.DeviceID && obj.DeviceAddr == repeater.DeviceAddr && obj.DeviceEpoint == repeater.DeviceEpoint);
-                                    if (info != null)
-                                    {
-                                        info.DeviceEpointName = repeater.renameDeviceData.DeviceName;
-                                    }
-                                }
-                                break;
-                            case DeviceType.Thermostat:
-                                var ac = new AC() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.CurrentGateWayId };
-                                ac.renameDeviceData = Newtonsoft.Json.JsonConvert.DeserializeObject<AC.DeviceRenameResponseData>(jobject["Data"].ToString());
-                                if (ac.renameDeviceData == null)
-                                {
-                                    d = new DeviceRenameAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
-                                }
-                                else
-                                {
-                                    d = new DeviceRenameAllData { deviceRenameData = ac.renameDeviceData };
-                                    System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
-                                    var info = Gateway.DeviceList.Find((CommonDevice obj) => obj.DeviceID == ac.DeviceID && obj.DeviceAddr == ac.DeviceAddr && obj.DeviceEpoint == ac.DeviceEpoint);
-                                    if (info != null)
-                                    {
-                                        info.DeviceEpointName = ac.renameDeviceData.DeviceName;
-                                    }
-                                }
-                                break;
-                            case DeviceType.Transverter:
-                                var transverter = new Transverter() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.CurrentGateWayId };
-                                transverter.renameDeviceData = Newtonsoft.Json.JsonConvert.DeserializeObject<Transverter.DeviceRenameResponseData>(jobject["Data"].ToString());
-                                if (transverter.renameDeviceData == null)
-                                {
-                                    d = new DeviceRenameAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
-                                }
-                                else
-                                {
-                                    d = new DeviceRenameAllData { deviceRenameData = transverter.renameDeviceData };
-                                    System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
-                                    var info = Gateway.DeviceList.Find((CommonDevice obj) => obj.DeviceID == transverter.DeviceID && obj.DeviceAddr == transverter.DeviceAddr && obj.DeviceEpoint == transverter.DeviceEpoint);
-                                    if (info != null)
-                                    {
-                                        info.DeviceEpointName = transverter.renameDeviceData.DeviceName;
-                                    }
-                                }
-                                break;
-                            case DeviceType.DoorLock:
-                                var doorLock = new DoorLock() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.CurrentGateWayId };
-                                doorLock.renameDeviceData = Newtonsoft.Json.JsonConvert.DeserializeObject<DoorLock.DeviceRenameResponseData>(jobject["Data"].ToString());
-                                if (doorLock.renameDeviceData == null)
-                                {
-                                    d = new DeviceRenameAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
-                                }
-                                else
-                                {
-                                    d = new DeviceRenameAllData { deviceRenameData = doorLock.renameDeviceData };
-                                    System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
-                                    var info = Gateway.DeviceList.Find((CommonDevice obj) => obj.DeviceID == doorLock.DeviceID && obj.DeviceAddr == doorLock.DeviceAddr && obj.DeviceEpoint == doorLock.DeviceEpoint);
-                                    if (info != null)
-                                    {
-                                        info.DeviceEpointName = doorLock.renameDeviceData.DeviceName;
-                                    }
-                                }
-                                break;
-                        }
-                    }
-                };
-                Gateway.Actions += action;
-                System.Console.WriteLine("DeviceRename_Actions 鍚姩" + "_" + System.DateTime.Now.ToString());
-                try
-                {
-                    var bytes = new byte[64];
-                    var reamarkGwBytes = Encoding.UTF8.GetBytes(deviceName);
-                    System.Array.Copy(reamarkGwBytes, 0, bytes, 0, 64 < reamarkGwBytes.Length ? 64 : reamarkGwBytes.Length);
-                    deviceName = Encoding.UTF8.GetString(bytes);
-
-                    var jObject = new JObject { { "DeviceAddr", deviceAddr }, { "Epoint", deviceEpoint }, { "Cluster_ID", 0 }, { "Command", 96 } };
-                    var data = new JObject { { "DeviceName", deviceName } };
-                    jObject.Add("Data", data);
-                    Gateway?.Send(("DeviceRename"), 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 DeviceRenameAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
-                }
-
-                Gateway.Actions -= action;
-                System.Console.WriteLine("DeviceRename_Actions閫�鍑�" + System.DateTime.Now.ToString());
-                return d;
-            });
-        }
-
-        /// <summary>
-        /// 閲嶅懡鍚嶈澶�,缃戝叧鍙嶉鍏蜂綋淇℃伅
-        /// </summary>
-        public DeviceRenameAllData renameDeviceAllData;
-        /// <summary>
-        /// 閲嶅懡鍚嶈澶�,缃戝叧鍙嶉鍏蜂綋淇℃伅
-        /// </summary>
-        [System.Serializable]
-        public class DeviceRenameAllData
-        {
-            /// <summary>
-            /// 閿欒淇℃伅
-            /// </summary>
-            public string errorMessageBase;
-            /// <summary>
-            /// 缃戝叧淇℃伅閿欒鍙嶉
-            /// <para>褰撶綉鍏虫帴鏀跺埌瀹㈡埛绔俊鎭悗锛屽嚭鐜颁互涓嬪紓甯告儏鍐靛皢鍙嶉閿欒銆�</para>
-            /// </summary>
-            public ErrorResponData errorResponData;
-            /// <summary>
-            /// 璁惧鍚嶇О淇敼
-            /// </summary>
-            public DeviceRenameResponseData deviceRenameData;
-        }
-
-        /// <summary>
-        /// 璁惧鍚嶇О淇敼
-        /// </summary>
-        public DeviceRenameResponseData renameDeviceData;
-        /// <summary>
-        /// 璁惧鍚嶇О淇敼
-        /// </summary>
-        [System.Serializable]
-        public class DeviceRenameResponseData
-        {
-            /// <summary>
-            /// 0:淇敼鎴愬姛
-            /// <para>1:淇敼澶辫触</para>
-            /// </summary>
-            public int Result;
-            /// <summary>
-            /// 淇敼鍚庣殑璁惧鍚嶇О
-            /// </summary>
-            public string DeviceName;
-        }
-        #endregion
-
-        #region 淇敼璁惧mac鍚嶇О
-        ///<summary >
-        /// 淇敼璁惧mac鍚嶇О
-        /// <para>macName:璁惧鍚嶇О</para>
-        /// </summary>
-        public async System.Threading.Tasks.Task<RenameDeviceMacNameAllData> RenameDeviceMacNameAsync(string deviceAddr, int deviceEpoint, string macName)
-        {
-            if (Gateway == null)
-            {
-                return null;
-            }
-            return await System.Threading.Tasks.Task.Run(async () =>
-            {
-                RenameDeviceMacNameAllData 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 RenameDeviceMacNameAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
-                        }
-                        else
-                        {
-                            d = new RenameDeviceMacNameAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
-                        }
-                    }
-
-                    if (topic == gatewayID + "/" + "MacRename_Respon")
-                    {
-                        var deviceID = jobject.Value<int>("Device_ID");
-                        switch ((DeviceType)(deviceID))
-                        {
-                            case DeviceType.OnOffOutput:
-                                var toggleLight = new ToggleLight() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.CurrentGateWayId };
-                                toggleLight.renameDeviceMacNameData = Newtonsoft.Json.JsonConvert.DeserializeObject<ToggleLight.RenameDeviceMacNameData>(jobject["Data"].ToString());
-
-                                if (toggleLight.renameDeviceMacNameData == null)
-                                {
-                                    d = new RenameDeviceMacNameAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
-                                }
-                                else
-                                {
-                                    d = new RenameDeviceMacNameAllData { renameDeviceMacNameData = toggleLight.renameDeviceMacNameData };
-                                    System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
-                                    var infoToggleLight = Gateway.DeviceList.Find((CommonDevice obj) => obj.DeviceID == toggleLight.DeviceID && obj.DeviceAddr == toggleLight.DeviceAddr && obj.DeviceEpoint == toggleLight.DeviceEpoint);
-                                    if (infoToggleLight != null)
-                                    {
-                                        infoToggleLight.DeviceName = toggleLight.renameDeviceMacNameData.MacName;
-                                    }
-                                }
-                                break;
-                            case DeviceType.AirSwitch:
-                                var airSwitch = new AirSwitch() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.CurrentGateWayId };
-                                airSwitch.renameDeviceMacNameData = Newtonsoft.Json.JsonConvert.DeserializeObject<AirSwitch.RenameDeviceMacNameData>(jobject["Data"].ToString());
-
-                                if (airSwitch.renameDeviceMacNameData == null)
-                                {
-                                    d = new RenameDeviceMacNameAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
-                                }
-                                else
-                                {
-                                    d = new RenameDeviceMacNameAllData { renameDeviceMacNameData = airSwitch.renameDeviceMacNameData };
-                                    System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
-                                    var infoAirSwitch = Gateway.DeviceList.Find((CommonDevice obj) => obj.DeviceID == airSwitch.DeviceID && obj.DeviceAddr == airSwitch.DeviceAddr && obj.DeviceEpoint == airSwitch.DeviceEpoint);
-                                    if (infoAirSwitch != null)
-                                    {
-                                        infoAirSwitch.DeviceName = airSwitch.renameDeviceMacNameData.MacName;
-                                    }
-                                }
-                                break;
-                            case DeviceType.OnOffSwitch:
-                                var panelObj = new Panel() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.CurrentGateWayId };
-                                panelObj.renameDeviceMacNameData = Newtonsoft.Json.JsonConvert.DeserializeObject<Panel.RenameDeviceMacNameData>(jobject["Data"].ToString());
-                                if (panelObj.renameDeviceMacNameData == null)
-                                {
-                                    d = new RenameDeviceMacNameAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
-                                }
-                                else
-                                {
-                                    d = new RenameDeviceMacNameAllData { renameDeviceMacNameData = panelObj.renameDeviceMacNameData };
-                                    System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
-                                    var infoPanel = Gateway.DeviceList.Find((CommonDevice obj) => obj.DeviceID == panelObj.DeviceID && obj.DeviceAddr == panelObj.DeviceAddr && obj.DeviceEpoint == panelObj.DeviceEpoint);
-                                    if (infoPanel != null)
-                                    {
-                                        infoPanel.DeviceName = panelObj.renameDeviceMacNameData.MacName;
-                                    }
-                                }
-                                break;
-                            case DeviceType.WindowCoveringDevice:
-                                var windowCovering = new Rollershade() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.CurrentGateWayId };
-                                windowCovering.renameDeviceMacNameData = Newtonsoft.Json.JsonConvert.DeserializeObject<Rollershade.RenameDeviceMacNameData>(jobject["Data"].ToString());
-                                if (windowCovering.renameDeviceMacNameData == null)
-                                {
-                                    d = new RenameDeviceMacNameAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
-                                }
-                                else
-                                {
-                                    d = new RenameDeviceMacNameAllData { renameDeviceMacNameData = windowCovering.renameDeviceMacNameData };
-                                    System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}_鏀跺埌閫氱煡鍚庣殑鏁版嵁_{ d.renameDeviceMacNameData.ToString()}");
-                                    var wc = Gateway.DeviceList.Find((CommonDevice obj) => obj.DeviceID == windowCovering.DeviceID && obj.DeviceAddr == windowCovering.DeviceAddr && obj.DeviceEpoint == windowCovering.DeviceEpoint);
-                                    if (wc != null)
-                                    {
-                                        wc.DeviceName = windowCovering.renameDeviceMacNameData.MacName;
-                                    }
-                                }
-                                break;
-                            case DeviceType.IASZone:
-                                var ias = new IASZone() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.CurrentGateWayId };
-                                ias.renameDeviceMacNameData = Newtonsoft.Json.JsonConvert.DeserializeObject<DimmableLight.RenameDeviceMacNameData>(jobject["Data"].ToString());
-
-                                if (ias.renameDeviceMacNameData == null)
-                                {
-                                    d = new RenameDeviceMacNameAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
-                                }
-                                else
-                                {
-                                    d = new RenameDeviceMacNameAllData { renameDeviceMacNameData = ias.renameDeviceMacNameData };
-                                    System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}_鏀跺埌閫氱煡鍚庣殑鏁版嵁_{ d.renameDeviceMacNameData.ToString()}");
-                                    var info = Gateway.DeviceList.Find((CommonDevice obj) => obj.DeviceID == ias.DeviceID && obj.DeviceAddr == ias.DeviceAddr && obj.DeviceEpoint == ias.DeviceEpoint);
-                                    if (info != null)
-                                    {
-                                        info.DeviceName = ias.renameDeviceMacNameData.MacName;
-                                    }
-                                }
-                                break;
-                            case DeviceType.DimmableLight:
-                                var dimmableLight = new DimmableLight() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.CurrentGateWayId };
-                                dimmableLight.renameDeviceMacNameData = Newtonsoft.Json.JsonConvert.DeserializeObject<DimmableLight.RenameDeviceMacNameData>(jobject["Data"].ToString());
-
-                                if (dimmableLight.renameDeviceMacNameData == null)
-                                {
-                                    d = new RenameDeviceMacNameAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
-                                }
-                                else
-                                {
-                                    d = new RenameDeviceMacNameAllData { renameDeviceMacNameData = dimmableLight.renameDeviceMacNameData };
-                                    System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}_鏀跺埌閫氱煡鍚庣殑鏁版嵁_{ d.renameDeviceMacNameData.ToString()}");
-                                    var info = Gateway.DeviceList.Find((CommonDevice obj) => obj.DeviceID == dimmableLight.DeviceID && obj.DeviceAddr == dimmableLight.DeviceAddr && obj.DeviceEpoint == dimmableLight.DeviceEpoint);
-                                    if (info != null)
-                                    {
-                                        info.DeviceName = dimmableLight.renameDeviceMacNameData.MacName;
-                                    }
-                                }
-                                break;
-                            case DeviceType.Repeater:
-                                var repeater = new DimmableLight() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.CurrentGateWayId };
-                                repeater.renameDeviceMacNameData = Newtonsoft.Json.JsonConvert.DeserializeObject<Repeater.RenameDeviceMacNameData>(jobject["Data"].ToString());
-
-                                if (repeater.renameDeviceMacNameData == null)
-                                {
-                                    d = new RenameDeviceMacNameAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
-                                }
-                                else
-                                {
-                                    d = new RenameDeviceMacNameAllData { renameDeviceMacNameData = repeater.renameDeviceMacNameData };
-                                    System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}_鏀跺埌閫氱煡鍚庣殑鏁版嵁_{ d.renameDeviceMacNameData.ToString()}");
-                                    var info = Gateway.DeviceList.Find((CommonDevice obj) => obj.DeviceID == repeater.DeviceID && obj.DeviceAddr == repeater.DeviceAddr && obj.DeviceEpoint == repeater.DeviceEpoint);
-                                    if (info != null)
-                                    {
-                                        info.DeviceName = repeater.renameDeviceMacNameData.MacName;
-                                    }
-                                }
-                                break;
-                            case DeviceType.Thermostat:
-                                var ac = new AC() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.CurrentGateWayId };
-                                ac.renameDeviceMacNameData = Newtonsoft.Json.JsonConvert.DeserializeObject<AC.RenameDeviceMacNameData>(jobject["Data"].ToString());
-
-                                if (ac.renameDeviceMacNameData == null)
-                                {
-                                    d = new RenameDeviceMacNameAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
-                                }
-                                else
-                                {
-                                    d = new RenameDeviceMacNameAllData { renameDeviceMacNameData = ac.renameDeviceMacNameData };
-                                    System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}_鏀跺埌閫氱煡鍚庣殑鏁版嵁_{ d.renameDeviceMacNameData.ToString()}");
-                                    var info = Gateway.DeviceList.Find((CommonDevice obj) => obj.DeviceID == ac.DeviceID && obj.DeviceAddr == ac.DeviceAddr && obj.DeviceEpoint == ac.DeviceEpoint);
-                                    if (info != null)
-                                    {
-                                        info.DeviceName = ac.renameDeviceMacNameData.MacName;
-                                    }
-                                }
-                                break;
-                            case DeviceType.Transverter:
-                                var transverter = new Transverter() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.CurrentGateWayId };
-                                transverter.renameDeviceMacNameData = Newtonsoft.Json.JsonConvert.DeserializeObject<Transverter.RenameDeviceMacNameData>(jobject["Data"].ToString());
-
-                                if (transverter.renameDeviceMacNameData == null)
-                                {
-                                    d = new RenameDeviceMacNameAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
-                                }
-                                else
-                                {
-                                    d = new RenameDeviceMacNameAllData { renameDeviceMacNameData = transverter.renameDeviceMacNameData };
-                                    System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}_鏀跺埌閫氱煡鍚庣殑鏁版嵁_{ d.renameDeviceMacNameData.ToString()}");
-                                    var info = Gateway.DeviceList.Find((CommonDevice obj) => obj.DeviceID == transverter.DeviceID && obj.DeviceAddr == transverter.DeviceAddr && obj.DeviceEpoint == transverter.DeviceEpoint);
-                                    if (info != null)
-                                    {
-                                        info.DeviceName = transverter.renameDeviceMacNameData.MacName;
-                                    }
-                                }
-                                break;
-                            case DeviceType.DoorLock:
-                                var doorLock = new DoorLock() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.CurrentGateWayId };
-                                doorLock.renameDeviceMacNameData = Newtonsoft.Json.JsonConvert.DeserializeObject<DoorLock.RenameDeviceMacNameData>(jobject["Data"].ToString());
-
-                                if (doorLock.renameDeviceMacNameData == null)
-                                {
-                                    d = new RenameDeviceMacNameAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
-                                }
-                                else
-                                {
-                                    d = new RenameDeviceMacNameAllData { renameDeviceMacNameData = doorLock.renameDeviceMacNameData };
-                                    System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}_鏀跺埌閫氱煡鍚庣殑鏁版嵁_{ d.renameDeviceMacNameData.ToString()}");
-                                    var info = Gateway.DeviceList.Find((CommonDevice obj) => obj.DeviceID == doorLock.DeviceID && obj.DeviceAddr == doorLock.DeviceAddr && obj.DeviceEpoint == doorLock.DeviceEpoint);
-                                    if (info != null)
-                                    {
-                                        info.DeviceName = doorLock.renameDeviceMacNameData.MacName;
-                                    }
-                                }
-                                break;
-                                //case DeviceType.TemperatureSensor:
-                                //    var temperatureSensor = new TemperatureSensor() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.CurrentGateWayId };
-                                //    temperatureSensor.renameDeviceData = Newtonsoft.Json.JsonConvert.DeserializeObject<TemperatureSensor.DeviceRenameResponseData>(jobject["Data"].ToString());
-                                //    if (temperatureSensor.renameDeviceData == null)
-                                //    {
-                                //        d.errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�";
-                                //    }
-                                //    else
-                                //    {
-                                //        d.deviceRenameData = temperatureSensor.renameDeviceData;
-                                //    }
-                                //    var ts = Gateway.DeviceList.Find((CommonDevice obj) => obj.DeviceID == temperatureSensor.DeviceID && obj.DeviceEpoint == temperatureSensor.DeviceEpoint && obj.DeviceEpoint == temperatureSensor.DeviceEpoint);
-                                //    if (ts == null)
-                                //    {
-                                //        ts.DeviceName = temperatureSensor.renameDeviceData.DeviceName;
-                                //        IO.LocalFileUtils.SaveDeviceInfo(ts, ts.DeviceEpoint.ToString());
-
-                                //    }
-                                //    break;
-                        }
-                    }
-                };
-                Gateway.Actions += action;
-                System.Console.WriteLine("MacRename_Actions 鍚姩" + "_" + System.DateTime.Now.ToString());
-                try
-                {
-                    var bytes = new byte[64];
-                    var reamarkGwBytes = Encoding.UTF8.GetBytes(macName);
-                    System.Array.Copy(reamarkGwBytes, 0, bytes, 0, 64 < reamarkGwBytes.Length ? 64 : reamarkGwBytes.Length);
-                    macName = Encoding.UTF8.GetString(bytes);
-
-                    var jObject = new JObject { { "DeviceAddr", deviceAddr }, { "Epoint", deviceEpoint }, { "Cluster_ID", 0 }, { "Command", 100 } };
-                    var data = new JObject { { "MacName", macName } };
-                    jObject.Add("Data", data);
-                    Gateway?.Send(("MacRename"), 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 RenameDeviceMacNameAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
-                }
-
-                Gateway.Actions -= action;
-                System.Console.WriteLine("MacRename_Action閫�鍑�" + System.DateTime.Now.ToString());
-                return d;
-            });
-        }
-
-        /// <summary>
-        /// 淇敼璁惧mac鍚嶇О鏁版嵁,缃戝叧鍙嶉鍏蜂綋淇℃伅
-        /// </summary>
-        public RenameDeviceMacNameAllData renameDeviceMacNameAllData;
-        /// <summary>
-        /// 淇敼璁惧mac鍚嶇О鏁版嵁,缃戝叧鍙嶉鍏蜂綋淇℃伅
-        /// </summary>
-        [System.Serializable]
-        public class RenameDeviceMacNameAllData
-        {
-            /// <summary>
-            /// 閿欒淇℃伅
-            /// </summary>
-            public string errorMessageBase;
-            /// <summary>
-            /// 缃戝叧淇℃伅閿欒鍙嶉
-            /// <para>褰撶綉鍏虫帴鏀跺埌瀹㈡埛绔俊鎭悗锛屽嚭鐜颁互涓嬪紓甯告儏鍐靛皢鍙嶉閿欒銆�</para>
-            /// </summary>
-            public ErrorResponData errorResponData;
-            /// <summary>
-            /// 淇敼璁惧mac鍚嶇О鏁版嵁
-            /// </summary>
-            public RenameDeviceMacNameData renameDeviceMacNameData;
-        }
-
-        /// <summary>
-        /// 淇敼璁惧mac鍚嶇О鏁版嵁
-        /// </summary>
-        public RenameDeviceMacNameData renameDeviceMacNameData;
-        /// <summary>
-        /// 淇敼璁惧mac鍚嶇О鏁版嵁
-        /// </summary>
-        [System.Serializable]
-        public class RenameDeviceMacNameData
-        {
-            /// <summary>
-            /// 0:淇敼鎴愬姛
-            /// <para>1:淇敼澶辫触,mac涓嶅瓨鍦�</para>
-            /// </summary>
-            public int Result;
-            /// <summary>
-            /// 淇敼鍚庣殑璁惧鍚嶇О
-            /// </summary>
-            public string MacName;
-        }
-        #endregion
-
-        #region 璁惧鎭㈠鍑哄巶璁剧疆涓庡嚭缃�
-        ///<summary >
-        /// 浣胯澶囨仮澶嶅嚭鍘傝缃�
-        /// <para>浠呮仮澶嶅嚭鍘傝缃紝涓嶇缃戙�備絾鏈変簺涓嶆爣鍑嗙殑3.0璁惧锛屾仮澶嶅嚭鍘傝缃氨浼氱缃戙�� 瀹㈡埛绔垨浜戠鍒扮綉鍏�</para>
-        /// </summary>
-        public async void ResetDeviceFactoryAsync(string deviceAddr, int deviceEpoint)
-        {
-            if (Gateway == null)
-            {
-                return;
-            }
-            //Action<string, string> action = (topic, message) => { };
-            //Gateway.Actions += action;
-            System.Console.WriteLine("FactoryResete_Actions 鍚姩" + "_" + System.DateTime.Now.ToString());
-            try
-            {
-                var jObject = new JObject { { "DeviceAddr", deviceAddr }, { "Epoint", deviceEpoint }, { "Cluster_ID", 0 }, { "Command", 97 } };
-                Gateway.Send("FactoryReset", jObject.ToString());
-            }
-            catch { }
-
-            //Gateway.Actions -= action;
-            System.Console.WriteLine("FactoryReset_Action閫�鍑�" + System.DateTime.Now.ToString());
-        }
-        #endregion
-
-        #region 鍒犻櫎璁惧锛堜娇璁惧绂荤綉锛�
-        /// <summary>
-        /// 鍒犻櫎璁惧锛堜娇璁惧绂荤綉锛�
-        /// </summary>
-        /// <returns>The device async.</returns>
-        /// <param name="removeData">Remove data.</param>
-        public async System.Threading.Tasks.Task<RemoveDeviceResponseAllData> DeleteDeviceAsync(ZigBee.Device.CommonDevice.RemoveDeviceData removeData)
-        {
-            if (Gateway == null || removeData == null)
-            {
-                return null;
-            }
-            return await System.Threading.Tasks.Task.Run(async () =>
-            {
-                RemoveDeviceResponseAllData 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 RemoveDeviceResponseAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
-                        }
-                        else
-                        {
-                            d = new RemoveDeviceResponseAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
-                        }
-                    }
-
-                    if (topic == gatewayID + "/" + "RemoveDeviceRespon")
-                    {
-                        var gatewayTemp = new ZbGateway() { DeviceAddr = jobject.Value<string>("DeviceAddr"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID };
-                        gatewayTemp.removeDeviceResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.RemoveDeviceResponseData>(jobject["Data"].ToString());
-
-                        if (gatewayTemp.removeDeviceResponseData == null)
-                        {
-                            d = new RemoveDeviceResponseAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
-                        }
-                        else
-                        {
-                            d = new RemoveDeviceResponseAllData { removeDeviceResponseData = gatewayTemp.removeDeviceResponseData };
-                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
-                            try
-                            {
-                                if (gatewayTemp.removeDeviceResponseData.Result == 0)
-                                {
-                                    foreach (var delD in gatewayTemp.removeDeviceResponseData.DeviceList)
-                                    {
-                                        var deviceID = delD.Device_ID;
-                                        switch ((DeviceType)(deviceID))
-                                        {
-                                            case DeviceType.OnOffOutput:
-                                                var toggleLight = new ToggleLight() { DeviceAddr = jobject.Value<string>("DeviceAddr"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID };
-                                                toggleLight.removeDeviceResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<ToggleLight.RemoveDeviceResponseData>(jobject["Data"].ToString());
-                                                if (toggleLight.removeDeviceResponseData == null)
-                                                {
-                                                    return;
-                                                }
-                                                else
-                                                {
-                                                    if (toggleLight.removeDeviceResponseData.Result == 0)
-                                                    {
-                                                        var infoToggleLight = Gateway.DeviceList.Find((CommonDevice obj) => obj.DeviceID == toggleLight.DeviceID && obj.DeviceAddr == toggleLight.DeviceAddr && obj.DeviceEpoint == toggleLight.DeviceEpoint);
-                                                        if (infoToggleLight != null)
-                                                        {
-                                                            Gateway.DeviceList.Remove(infoToggleLight);
-                                                        }
-                                                    }
-                                                }
-                                                break;
-                                            case DeviceType.AirSwitch:
-                                                var airSwitch = new AirSwitch() { DeviceAddr = jobject.Value<string>("DeviceAddr"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID };
-                                                airSwitch.removeDeviceResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<AirSwitch.RemoveDeviceResponseData>(jobject["Data"].ToString());
-                                                if (airSwitch.removeDeviceResponseData == null)
-                                                {
-                                                    return;
-                                                }
-                                                else
-                                                {
-                                                    if (airSwitch.removeDeviceResponseData.Result == 0)
-                                                    {
-                                                        var infoAirSwitch = Gateway.DeviceList.Find((CommonDevice obj) => obj.DeviceID == airSwitch.DeviceID && obj.DeviceAddr == airSwitch.DeviceAddr && obj.DeviceEpoint == airSwitch.DeviceEpoint);
-                                                        if (infoAirSwitch != null)
-                                                        {
-                                                            Gateway.DeviceList.Remove(infoAirSwitch);
-                                                        }
-                                                    }
-                                                }
-                                                break;
-                                            case DeviceType.OnOffSwitch:
-                                                var panelObj = new Panel() { 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 };
-                                                panelObj.removeDeviceResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<Panel.RemoveDeviceResponseData>(jobject["Data"].ToString());
-                                                if (panelObj.removeDeviceResponseData == null)
-                                                {
-                                                    return;
-                                                }
-                                                else
-                                                {
-                                                    if (panelObj.removeDeviceResponseData.Result == 0)
-                                                    {
-                                                        var infoPanel = Gateway.DeviceList.Find((CommonDevice obj) => obj.DeviceID == panelObj.DeviceID && obj.DeviceAddr == panelObj.DeviceAddr && obj.DeviceEpoint == panelObj.DeviceEpoint);
-                                                        if (infoPanel != null)
-                                                        {
-                                                            Gateway.DeviceList.Remove(infoPanel);
-                                                        }
-                                                    }
-                                                }
-                                                break;
-                                            case DeviceType.WindowCoveringDevice:
-                                                var rollershade = new Rollershade() { 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 };
-                                                rollershade.removeDeviceResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<Panel.RemoveDeviceResponseData>(jobject["Data"].ToString());
-                                                if (rollershade.removeDeviceResponseData == null)
-                                                {
-                                                    return;
-                                                }
-                                                else
-                                                {
-                                                    if (rollershade.removeDeviceResponseData.Result == 0)
-                                                    {
-                                                        var infoRoller = Gateway.DeviceList.Find((CommonDevice obj) => obj.DeviceID == rollershade.DeviceID && obj.DeviceAddr == rollershade.DeviceAddr && obj.DeviceEpoint == rollershade.DeviceEpoint);
-                                                        if (infoRoller != null)
-                                                        {
-                                                            Gateway.DeviceList.Remove(infoRoller);
-                                                        }
-                                                    }
-                                                }
-                                                break;
-                                            case DeviceType.IASZone:
-                                                var ias = new IASZone() { DeviceAddr = jobject.Value<string>("DeviceAddr"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID };
-                                                ias.removeDeviceResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<IASZone.RemoveDeviceResponseData>(jobject["Data"].ToString());
-                                                if (ias.removeDeviceResponseData == null)
-                                                {
-                                                    return;
-                                                }
-                                                else
-                                                {
-                                                    if (ias.removeDeviceResponseData.Result == 0)
-                                                    {
-                                                        var info = Gateway.DeviceList.Find((CommonDevice obj) => obj.DeviceID == ias.DeviceID && obj.DeviceAddr == ias.DeviceAddr && obj.DeviceEpoint == ias.DeviceEpoint);
-                                                        if (info != null)
-                                                        {
-                                                            Gateway.DeviceList.Remove(info);
-                                                        }
-                                                    }
-                                                }
-                                                break;
-                                            case DeviceType.DimmableLight:
-                                                var dimmableLight = new DimmableLight() { DeviceAddr = jobject.Value<string>("DeviceAddr"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID };
-                                                dimmableLight.removeDeviceResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<DimmableLight.RemoveDeviceResponseData>(jobject["Data"].ToString());
-                                                if (dimmableLight.removeDeviceResponseData == null)
-                                                {
-                                                    return;
-                                                }
-                                                else
-                                                {
-                                                    if (dimmableLight.removeDeviceResponseData.Result == 0)
-                                                    {
-                                                        var info = Gateway.DeviceList.Find((CommonDevice obj) => obj.DeviceID == dimmableLight.DeviceID && obj.DeviceAddr == dimmableLight.DeviceAddr && obj.DeviceEpoint == dimmableLight.DeviceEpoint);
-                                                        if (info != null)
-                                                        {
-                                                            Gateway.DeviceList.Remove(info);
-                                                        }
-                                                    }
-                                                }
-                                                break;
-                                            case DeviceType.Repeater:
-                                                var repeater = new Repeater() { DeviceAddr = jobject.Value<string>("DeviceAddr"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID };
-                                                repeater.removeDeviceResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<Repeater.RemoveDeviceResponseData>(jobject["Data"].ToString());
-                                                if (repeater.removeDeviceResponseData == null)
-                                                {
-                                                    return;
-                                                }
-                                                else
-                                                {
-                                                    if (repeater.removeDeviceResponseData.Result == 0)
-                                                    {
-                                                        var info = Gateway.DeviceList.Find((CommonDevice obj) => obj.DeviceID == repeater.DeviceID && obj.DeviceAddr == repeater.DeviceAddr && obj.DeviceEpoint == repeater.DeviceEpoint);
-                                                        if (info != null)
-                                                        {
-                                                            Gateway.DeviceList.Remove(info);
-                                                        }
-                                                    }
-                                                }
-                                                break;
-                                            case DeviceType.Thermostat:
-                                                var ac = new AC() { DeviceAddr = jobject.Value<string>("DeviceAddr"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID };
-                                                ac.removeDeviceResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<AC.RemoveDeviceResponseData>(jobject["Data"].ToString());
-                                                if (ac.removeDeviceResponseData == null)
-                                                {
-                                                    return;
-                                                }
-                                                else
-                                                {
-                                                    if (ac.removeDeviceResponseData.Result == 0)
-                                                    {
-                                                        var info = Gateway.DeviceList.Find((CommonDevice obj) => obj.DeviceID == ac.DeviceID && obj.DeviceAddr == ac.DeviceAddr && obj.DeviceEpoint == ac.DeviceEpoint);
-                                                        if (info != null)
-                                                        {
-                                                            Gateway.DeviceList.Remove(info);
-                                                        }
-                                                    }
-                                                }
-                                                break;
-                                            case DeviceType.Transverter:
-                                                var transverter = new Transverter() { DeviceAddr = jobject.Value<string>("DeviceAddr"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID };
-                                                transverter.removeDeviceResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<Transverter.RemoveDeviceResponseData>(jobject["Data"].ToString());
-                                                if (transverter.removeDeviceResponseData == null)
-                                                {
-                                                    return;
-                                                }
-                                                else
-                                                {
-                                                    if (transverter.removeDeviceResponseData.Result == 0)
-                                                    {
-                                                        var info = Gateway.DeviceList.Find((CommonDevice obj) => obj.DeviceID == transverter.DeviceID && obj.DeviceAddr == transverter.DeviceAddr && obj.DeviceEpoint == transverter.DeviceEpoint);
-                                                        if (info != null)
-                                                        {
-                                                            Gateway.DeviceList.Remove(info);
-                                                        }
-                                                    }
-                                                }
-                                                break;
-                                            case DeviceType.DoorLock:
-                                                var doorLock = new DoorLock() { DeviceAddr = jobject.Value<string>("DeviceAddr"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID };
-                                                doorLock.removeDeviceResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<DoorLock.RemoveDeviceResponseData>(jobject["Data"].ToString());
-                                                if (doorLock.removeDeviceResponseData == null)
-                                                {
-                                                    return;
-                                                }
-                                                else
-                                                {
-                                                    if (doorLock.removeDeviceResponseData.Result == 0)
-                                                    {
-                                                        var info = Gateway.DeviceList.Find((CommonDevice obj) => obj.DeviceID == doorLock.DeviceID && obj.DeviceAddr == doorLock.DeviceAddr && obj.DeviceEpoint == doorLock.DeviceEpoint);
-                                                        if (info != null)
-                                                        {
-                                                            Gateway.DeviceList.Remove(info);
-                                                        }
-                                                    }
-                                                }
-                                                break;
-                                        }
-                                    }
-                                }
-                            }
-                            catch { }
-                        }
-                    }
-                };
-                Gateway.Actions += action;
-                System.Console.WriteLine("RemoveDevice_Actions 鍚姩" + "_" + System.DateTime.Now.ToString());
-
-                try
-                {
-                    if (removeData != null)
-                    {
-                        var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 99 } };
-                        var deviceAddrList = new JArray { };
-                        foreach (var a in removeData.DeviceAddrList)
-                        {
-                            var dd = new JObject { { "DeviceAddr", a.DeviceAddr } };
-                            deviceAddrList.Add(dd);
-                        }
-
-                        var data = new JObject {
+            var data = new JObject {
                     { "CompelClear", removeData.CompelClear },
                     { "DeviceAddrList", deviceAddrList }
-                        };
-                        jObject.Add("Data", data);
-                        Gateway.Send(("RemoveDevice"), 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 RemoveDeviceResponseAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
-                }
-                Gateway.Actions -= action;
-                System.Console.WriteLine("RemoveDevice_Actions 閫�鍑�" + System.DateTime.Now.ToString());
-
-                return d;
-            });
+                  };
+            jObject.Add("Data", data);
+            Gateway.Send(("RemoveDevice"), jObject.ToString());
+          }
         }
+        catch { }
 
-        /// <summary>
-        /// 闇�瑕佸垹闄よ澶囩殑鏁版嵁
-        /// </summary>
-        public RemoveDeviceData removeDeviceData;
-        /// <summary>
-        /// 闇�瑕佸垹闄よ澶囩殑鏁版嵁
-        /// </summary>
-        [System.Serializable]
-        public class RemoveDeviceData
+        var dateTime = DateTime.Now;
+        while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
         {
-            /// <summary>
-            /// 0锛氫笉寮哄埗娓呴櫎銆傞渶瑕佽妭鐐硅澶囧弽棣堢缃戠‘璁や俊鎭悗鎵嶈兘鍒犻櫎璁惧淇℃伅銆�
-            ///<para>1锛氬己鍒舵竻闄ゃ�備笉闇�瑕佽妭鐐硅澶囧弽棣堢缃戠‘璁や俊鎭紝鐩存帴鍒犻櫎璁惧淇℃伅銆�</para>
-            ///<para>璇存槑锛氭甯告儏鍐典笅璁╄妭鐐硅澶囩缃戯紝闇�瑕佽妭鐐硅澶囧湪绾匡紝鑺傜偣璁惧鍙嶉绂荤綉纭淇℃伅鍚庣綉鍏虫柟鍙垹闄よ璁惧鐨勮澶囦俊鎭�備絾濡傛灉璁惧宸茬粡鎹熷潖锛屾垨宸茬粡閫氳繃澶栭儴鍔熻兘绂荤綉锛屾鏃惰妭鐐硅澶囧凡缁忔棤娉曞弽棣堢缃戠‘璁や俊鎭紝闈㈠杩欑鎯呭喌锛岃鍒犻櫎淇濆瓨鍦ㄧ綉鍏充笂鐨勮鑺傜偣璁惧鐨勮澶囦俊鎭紝闇�瑕佸皢璇ュ瓧娈佃祴鍊间负1锛岀綉鍏冲己鍒跺垹闄よ璁惧淇℃伅锛屼笉闇�瑕佽妭鐐硅澶囩‘璁ゃ��</para>
-            /// </summary>
-            public int CompelClear = 1;
-            /// <summary>
-            /// 鍑虹綉璁惧鍒楄〃
-            /// </summary>
-            public List<RemoveDeviceListInfo> DeviceAddrList = new List<RemoveDeviceListInfo>();
+          await System.Threading.Tasks.Task.Delay(10);
+          if (d != null)
+          {
+            break;
+          }
         }
-
-        /// <summary>
-        /// 鍦烘櫙淇℃伅
-        /// </summary>
-        public class RemoveDeviceListInfo
+        if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
         {
-            /// <summary>
-            /// 璁惧mac鍦板潃
-            /// </summary>
-            public string DeviceAddr;
+          d = new RemoveDeviceResponseAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
         }
+        Gateway.Actions -= action;
+        DebugPrintLog("RemoveDevice_Actions 閫�鍑�" + System.DateTime.Now.ToString());
 
-        /// <summary>
-        /// 绉婚櫎璁惧,缃戝叧鍙嶉鍏蜂綋淇℃伅
-        /// </summary>
-        public RemoveDeviceResponseAllData removeDeviceResponseAllData;
-        /// <summary>
-        /// 绉婚櫎璁惧,缃戝叧鍙嶉鍏蜂綋淇℃伅
-        /// </summary>
-        [System.Serializable]
-        public class RemoveDeviceResponseAllData
+        return d;
+      });
+    }
+
+    /// <summary>
+    /// 闇�瑕佸垹闄よ澶囩殑鏁版嵁
+    /// </summary>
+    [System.Serializable]
+    public class RemoveDeviceData
+    {
+      /// <summary>
+      /// 0锛氫笉寮哄埗娓呴櫎銆傞渶瑕佽妭鐐硅澶囧弽棣堢缃戠‘璁や俊鎭悗鎵嶈兘鍒犻櫎璁惧淇℃伅銆�
+      ///<para>1锛氬己鍒舵竻闄ゃ�備笉闇�瑕佽妭鐐硅澶囧弽棣堢缃戠‘璁や俊鎭紝鐩存帴鍒犻櫎璁惧淇℃伅銆�</para>
+      ///<para>璇存槑锛氭甯告儏鍐典笅璁╄妭鐐硅澶囩缃戯紝闇�瑕佽妭鐐硅澶囧湪绾匡紝鑺傜偣璁惧鍙嶉绂荤綉纭淇℃伅鍚庣綉鍏虫柟鍙垹闄よ璁惧鐨勮澶囦俊鎭�備絾濡傛灉璁惧宸茬粡鎹熷潖锛屾垨宸茬粡閫氳繃澶栭儴鍔熻兘绂荤綉锛屾鏃惰妭鐐硅澶囧凡缁忔棤娉曞弽棣堢缃戠‘璁や俊鎭紝闈㈠杩欑鎯呭喌锛岃鍒犻櫎淇濆瓨鍦ㄧ綉鍏充笂鐨勮鑺傜偣璁惧鐨勮澶囦俊鎭紝闇�瑕佸皢璇ュ瓧娈佃祴鍊间负1锛岀綉鍏冲己鍒跺垹闄よ璁惧淇℃伅锛屼笉闇�瑕佽妭鐐硅澶囩‘璁ゃ��</para>
+      /// </summary>
+      public int CompelClear = 1;
+      /// <summary>
+      /// 鍑虹綉璁惧鍒楄〃
+      /// </summary>
+      public List<RemoveDeviceListInfo> DeviceAddrList = new List<RemoveDeviceListInfo>();
+    }
+
+    /// <summary>
+    /// 鍦烘櫙淇℃伅
+    /// </summary>
+    public class RemoveDeviceListInfo
+    {
+      /// <summary>
+      /// 璁惧mac鍦板潃
+      /// </summary>
+      public string DeviceAddr;
+    }
+
+    /// <summary>
+    /// 绉婚櫎璁惧,缃戝叧鍙嶉鍏蜂綋淇℃伅
+    /// </summary>
+    [System.Serializable]
+    public class RemoveDeviceResponseAllData
+    {
+      /// <summary>
+      /// 閿欒淇℃伅
+      /// </summary>
+      public string errorMessageBase;
+      /// <summary>
+      /// 缃戝叧淇℃伅閿欒鍙嶉
+      /// <para>褰撶綉鍏虫帴鏀跺埌瀹㈡埛绔俊鎭悗锛屽嚭鐜颁互涓嬪紓甯告儏鍐靛皢鍙嶉閿欒銆�</para>
+      /// </summary>
+      public ErrorResponData errorResponData;
+      /// <summary>
+      /// 璁惧鍚嶇О淇敼
+      /// </summary>
+      public RemoveDeviceResponseData removeDeviceResponseData;
+    }
+
+    /// <summary>
+    /// 鍒犻櫎璁惧鍥炲鏁版嵁
+    /// <para>杩斿洖缁撴灉Resul=锛屽垹闄ゆ垚鍔�</para>
+    /// </summary>
+    [System.Serializable]
+    public class RemoveDeviceResponseData
+    {
+      /// <summary>
+      /// 0锛氬垹闄ゆ垚鍔�
+      /// <para>鍒犻櫎澶辫触</para>
+      /// </summary>
+      public int Result = 2;
+      /// <summary>
+      /// 鍑虹綉璁惧鍒楄〃
+      /// </summary>
+      public List<DeviceListInfo> DeviceList = new List<DeviceListInfo>();
+    }
+
+    /// <summary>
+    /// 鍦烘櫙淇℃伅
+    /// </summary>
+    [System.Serializable]
+    public class DeviceListInfo
+    {
+      /// <summary>
+      /// 璁惧ID
+      /// </summary>
+      public int Device_ID;
+
+      /// <summary>
+      /// 璁惧mac鍦板潃
+      /// </summary>
+      public string MacAddr;
+
+      /// <summary>
+      /// 璁惧绔彛鍙�
+      /// </summary>
+      public int Epoint;
+
+    }
+    #endregion
+
+    #region 璇嗗埆璁惧
+    ///<summary >
+    /// 璇嗗埆璁惧
+    /// <para>cluster=3锛屽叿鏈塈dentify锛堣瘑鍒級鍔熻兘锛屽睘浜嶼CL搴�</para>
+    /// <para>time:璁剧疆璁惧闂儊鏃堕棿锛堢锛夎寖鍥达細0-65535</para>
+    /// </summary>
+    public void IdentifyControl(string deviceAddr, int deviceEpoint, int time)
+    {
+      if (Gateway == null)
+      {
+        return;
+      }
+      Action<string, string> action = (topic, message) => { };
+      Gateway.Actions += action;
+      System.Console.WriteLine("Identify_Actions 鍚姩" + "_" + System.DateTime.Now.ToString());
+
+      try
+      {
+        var jObject = new JObject { { "DeviceAddr", deviceAddr }, { "Epoint", deviceEpoint }, { "Cluster_ID", 3 }, { "Command", 0 }, { "SendMode", 2 } };
+        var data = new JObject { { "Time", time } };
+        jObject.Add("Data", data);
+        Gateway.Send(("Identify"), jObject.ToString());
+      }
+      catch { }
+
+      Gateway.Actions -= action;
+      System.Console.WriteLine("Identify_Actions 閫�鍑�" + System.DateTime.Now.ToString());
+
+    }
+    #endregion
+
+    #region 璁惧灞炴�х姸鎬佷笂鎶�
+    /// <summary>
+    /// 鑾峰彇璁惧褰撳墠灞炴�х姸鎬�
+    /// </summary>
+    /// <param name="clusterID">Cluster identifier.</param>
+    /// <param name="attriButeId">Attri bute identifier.</param>
+    public async void ReadAttri(Cluster_ID clusterID, AttriButeId attriButeId)
+    {
+      if (Gateway == null)
+      {
+        return;
+      }
+      await System.Threading.Tasks.Task.Run(async () =>
+      {
+              //Action<string, string> action = (topic, message) => { };
+
+              // Gateway.Actions += action;
+              System.Console.WriteLine("GetDeviceStatus_Actions 鍚姩" + "_" + System.DateTime.Now.ToString());
+
+        try
         {
-            /// <summary>
-            /// 閿欒淇℃伅
-            /// </summary>
-            public string errorMessageBase;
-            /// <summary>
-            /// 缃戝叧淇℃伅閿欒鍙嶉
-            /// <para>褰撶綉鍏虫帴鏀跺埌瀹㈡埛绔俊鎭悗锛屽嚭鐜颁互涓嬪紓甯告儏鍐靛皢鍙嶉閿欒銆�</para>
-            /// </summary>
-            public ErrorResponData errorResponData;
-            /// <summary>
-            /// 璁惧鍚嶇О淇敼
-            /// </summary>
-            public RemoveDeviceResponseData removeDeviceResponseData;
-        }
-
-        /// <summary>
-        /// 鍒犻櫎璁惧鍥炲鏁版嵁
-        /// </summary>
-        public RemoveDeviceResponseData removeDeviceResponseData;
-        /// <summary>
-        /// 鍒犻櫎璁惧鍥炲鏁版嵁
-        /// <para>杩斿洖缁撴灉Resul=锛屽垹闄ゆ垚鍔�</para>
-        /// </summary>
-        [System.Serializable]
-        public class RemoveDeviceResponseData
-        {
-            /// <summary>
-            /// 0锛氬垹闄ゆ垚鍔�
-            /// <para>鍒犻櫎澶辫触</para>
-            /// </summary>
-            public int Result = 2;
-            /// <summary>
-            /// 鍑虹綉璁惧鍒楄〃
-            /// </summary>
-            public List<DeviceListInfo> DeviceList = new List<DeviceListInfo>();
-        }
-
-        /// <summary>
-        /// 鍦烘櫙淇℃伅
-        /// </summary>
-        [System.Serializable]
-        public class DeviceListInfo
-        {
-            /// <summary>
-            /// 璁惧ID
-            /// </summary>
-            public int Device_ID;
-
-            /// <summary>
-            /// 璁惧mac鍦板潃
-            /// </summary>
-            public string MacAddr;
-
-            /// <summary>
-            /// 璁惧绔彛鍙�
-            /// </summary>
-            public int Epoint;
-
-        }
-        #endregion
-
-        #region 浠庢�昏澶囧垪琛ㄤ腑绉婚櫎涓�涓綉鍏崇殑鎵�鏈夎妭鐐硅澶囷紙鐢ㄤ簬涓荤綉鍏筹級
-        ///<summary >
-        /// 浠庢�昏澶囧垪琛ㄤ腑绉婚櫎涓�涓綉鍏崇殑鎵�鏈夎妭鐐硅澶囷紙鐢ㄤ簬涓荤綉鍏筹級
-        /// <para>GwId:瑕佺Щ闄よ妭鐐硅澶囩殑缃戝叧id</para>
-        /// </summary>
-        public async System.Threading.Tasks.Task<RemoveGatewayDeviceListAllData> RemoveGatewayDeviceListAsync(string gwId)
-        {
-            if (Gateway == null || gwId == null)
-            {
-                return null;
-            }
-            return await System.Threading.Tasks.Task.Run(async () =>
-            {
-                RemoveGatewayDeviceListAllData 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 RemoveGatewayDeviceListAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
-                        }
-                        else
-                        {
-                            d = new RemoveGatewayDeviceListAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
-                        }
-                    }
-                    if (topic == gatewayID + "/" + "RemoveEqOfGw_Respon")
-                    {
-                        var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID };
-                        gatewayTemp.removeGatewayDeviceListData = Newtonsoft.Json.JsonConvert.DeserializeObject<RemoveGatewayDeviceListData>(jobject["Data"].ToString());
-
-                        if (gatewayTemp.removeGatewayDeviceListData == null)
-                        {
-                            d = new RemoveGatewayDeviceListAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
-                        }
-                        else
-                        {
-                            d = new RemoveGatewayDeviceListAllData { removeGatewayDeviceListData = gatewayTemp.removeGatewayDeviceListData };
-                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
-
-                            //for (int listCount = 0; listCount < Gateway.AllGatewayDeviceList.Count; listCount++)
-                            //{
-                            //    var dev = Gateway.AllGatewayDeviceList[listCount];
-                            //    if (gatewayTemp.removeGatewayDeviceListData.GwId == dev.Gateway.CurrentGateWayId)
-                            //    {
-                            //        ZigBee.Device.ZbGateway.LogicList.RemoveAt(listCount);
-                            //        listCount--;
-                            //    }
-                            //}
-                        }
-                    }
-                };
-
-                Gateway.Actions += action;
-                System.Console.WriteLine("RemoveEqOfGw_Actions 鍚姩" + "_" + System.DateTime.Now.ToString());
-
-                try
-                {
-                    var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 81 } };
-                    var data = new JObject { { "GwId", gwId } };
-                    jObject.Add("Data", data);
-                    Gateway.Send(("RemoveEqOfGw"), 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 RemoveGatewayDeviceListAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
-                }
-                Gateway.Actions -= action;
-                System.Console.WriteLine("RemoveEqOfGw_Actions 閫�鍑�" + System.DateTime.Now.ToString());
-
-                return d;
-            });
-        }
-
-        /// <summary>
-        /// 绉婚櫎璁惧,缃戝叧鍙嶉鍏蜂綋淇℃伅
-        /// </summary>
-        public RemoveGatewayDeviceListAllData removeGatewayDeviceListAllData;
-        /// <summary>
-        /// 绉婚櫎璁惧,缃戝叧鍙嶉鍏蜂綋淇℃伅
-        /// </summary>
-        [System.Serializable]
-        public class RemoveGatewayDeviceListAllData
-        {
-            /// <summary>
-            /// 閿欒淇℃伅
-            /// </summary>
-            public string errorMessageBase;
-            /// <summary>
-            /// 缃戝叧淇℃伅閿欒鍙嶉
-            /// <para>褰撶綉鍏虫帴鏀跺埌瀹㈡埛绔俊鎭悗锛屽嚭鐜颁互涓嬪紓甯告儏鍐靛皢鍙嶉閿欒銆�</para>
-            /// </summary>
-            public ErrorResponData errorResponData;
-            /// <summary>
-            /// 璁惧鍚嶇О淇敼
-            /// </summary>
-            public RemoveGatewayDeviceListData removeGatewayDeviceListData;
-        }
-
-        /// <summary>
-        /// 浠庢�昏澶囧垪琛ㄤ腑绉婚櫎涓�涓綉鍏崇殑鎵�鏈夎妭鐐硅澶囷紙鐢ㄤ簬涓荤綉鍏筹級
-        /// </summary>
-        public RemoveGatewayDeviceListData removeGatewayDeviceListData;
-        /// <summary>
-        /// 浠庢�昏澶囧垪琛ㄤ腑绉婚櫎涓�涓綉鍏崇殑鎵�鏈夎妭鐐硅澶囷紙鐢ㄤ簬涓荤綉鍏筹級
-        /// </summary>
-        [System.Serializable]
-        public class RemoveGatewayDeviceListData
-        {
-            /// <summary>
-            /// 瑕佺Щ闄よ妭鐐硅澶囩殑缃戝叧id
-            /// </summary>
-            public string GwId;
-            /// <summary>
-            /// 琚垹闄よ澶囩殑鏁伴噺
-            /// </summary>
-            public int RemoveNum;
-        }
-
-        #endregion
-
-        #region 璇嗗埆璁惧
-        ///<summary >
-        /// 璇嗗埆璁惧
-        /// <para>cluster=3锛屽叿鏈塈dentify锛堣瘑鍒級鍔熻兘锛屽睘浜嶼CL搴�</para>
-        /// <para>time:璁剧疆璁惧闂儊鏃堕棿锛堢锛夎寖鍥达細0-65535</para>
-        /// </summary>
-        public void IdentifyControl(string deviceAddr, int deviceEpoint, int time)
-        {
-            if (Gateway == null)
-            {
-                return;
-            }
-            Action<string, string> action = (topic, message) => { };
-            Gateway.Actions += action;
-            System.Console.WriteLine("Identify_Actions 鍚姩" + "_" + System.DateTime.Now.ToString());
-
-            try
-            {
-                var jObject = new JObject { { "DeviceAddr", deviceAddr }, { "Epoint", deviceEpoint }, { "Cluster_ID", 3 }, { "Command", 0 }, { "SendMode", 2 } };
-                var data = new JObject { { "Time", time } };
-                jObject.Add("Data", data);
-                Gateway.Send(("Identify"), jObject.ToString());
-            }
-            catch { }
-
-            Gateway.Actions -= action;
-            System.Console.WriteLine("Identify_Actions 閫�鍑�" + System.DateTime.Now.ToString());
-
-        }
-        #endregion
-
-        #region 璁惧涓婃姤杩斿洖鏁版嵁锛岀綉鍏冲洖澶嶄俊鎭�
-        ///// <summary>
-        ///// 璁惧涓婃姤杩斿洖鏁版嵁锛岀綉鍏冲洖澶嶄俊鎭�
-        ///// </summary>
-        //public DeviceReportResponAllData deviceReportResponAllData;
-        ///// <summary>
-        ///// 缃戝叧鎭㈠鍑哄巶璁剧疆杩斿洖鏁版嵁
-        ///// </summary>
-        //[System.Serializable]
-        //public class DeviceReportResponAllData
-        //{
-        //    /// <summary>
-        //    /// 閿欒淇℃伅
-        //    /// </summary>
-        //    public string errorMessageBase;
-        //    /// <summary>
-        //    /// 缃戝叧淇℃伅閿欒鍙嶉
-        //    /// <para>褰撶綉鍏虫帴鏀跺埌瀹㈡埛绔俊鎭悗锛屽嚭鐜颁互涓嬪紓甯告儏鍐靛皢鍙嶉閿欒銆�</para>
-        //    /// </summary>
-        //    public ErrorResponData errorResponData;
-        //    ///<summary >
-        //    ///璁惧鏁版嵁
-        //    /// </summary>
-        //    public DeviceStatusReportData deviceStatusReportData;
-        //}
-
-        ///// <summary>
-        ///// 璇诲彇鎶ュ憡灞炴�ч厤缃�,寮傛鑾峰彇鏁版嵁
-        ///// </summary>
-        ///// <param name="clusterID">Cluster identifier.</param>
-        ///// <param name="attriButeId">Attri bute identifier.</param>
-        //public async System.Threading.Tasks.Task<DeviceReportResponAllData> ReadAttriAsync(Cluster_ID clusterID, AttriButeId attriButeId)
-        //{
-        //if (Gateway == null)
-        //{
-        //    return null;
-        //}
-        ////string result = null;
-
-        //return await System.Threading.Tasks.Task.Run(async () =>
-        //{
-        //var d = new DeviceReportResponAllData();
-        //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.errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖";
-        //    }
-        //    else
-        //    {
-        //        d.errorResponData = temp;
-        //        d.errorMessageBase = ErrorMess(temp.Error);
-        //    }
-        //}
-
-        //if (topic == gatewayID + "/" + "DeviceStatusReport" + "/" + DeviceAddr + "/" + DeviceEpoint + "/" + (int)clusterID + "/" + (int)attriButeId)
-        //{
-        //var deviceID = jobject.Value<int>("Device_ID");
-        //var deviceAddr = jobject.Value<string>("DeviceAddr");
-        //var ep = jobject.Value<int>("Epoint");
-
-        //var device = Gateway.DeviceList.Find((obj) => obj.DeviceID == deviceID && obj.DeviceAddr == deviceAddr && obj.DeviceEpoint == ep);
-        //if (device == null)
-        //{
-        //    return;
-        //}
-
-        //switch ((DeviceType)(deviceID))
-        //{
-        // case DeviceType.ColorDimmableLight:
-        //    device.DeviceStatusReport = Newtonsoft.Json.JsonConvert.DeserializeObject<ColorDimmableLight.DeviceStatusReportData>(jobject["Data"].ToString());
-        //    if (device.DeviceStatusReport == null)
-        //    {
-        //        d.errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖";
-        //    }
-        //    else
-        //    {
-        //        d.deviceStatusReportData = device.DeviceStatusReport;
-        //        System.Console.WriteLine($"鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
-        //        var light = device as ColorDimmableLight;
-        //        if (device.DeviceStatusReport.CluterID == 8)
-        //        {
-        //            var attriButeList = device.DeviceStatusReport.AttriBute;
-        //            foreach (var attriBute1 in attriButeList)
-        //            {
-        //                light.Level = attriBute1.AttriButeData;
-        //            }
-        //            light.ReSave();
-        //            ZigBee.Device.ZbGateway.UpdateDeviceStatus(light);
-        //        }
-        //        else if (device.DeviceStatusReport.CluterID == 6)
-        //        {
-        //            var attriButeList = device.DeviceStatusReport.AttriBute;
-        //            foreach (var attriBute1 in attriButeList)
-        //            {
-        //                light.OnOffStatus = attriBute1.AttriButeData;
-
-        //                var key = light.DeviceAddr + "_" + light.DeviceEpoint;
-        //                Gateway.sceneTaskInfoList.Remove(key);
-        //                var st = new Scene.TaskListInfo()
-        //                {
-        //                    TaskType = 1,
-        //                    Data1 = attriBute1.AttriButeData,
-        //                    Data2 = 0,
-        //                };
-        //                Gateway.sceneTaskInfoList.Add(key, st);
-        //            }
-        //            light.ReSave();
-        //            ZigBee.Device.ZbGateway.UpdateDeviceStatus(light);
-        //        }
-        //        else if (device.DeviceStatusReport.CluterID == 768)
-        //        {
-        //            var attriButeList = device.DeviceStatusReport.AttriBute;
-        //            //foreach (var attriBute1 in attriButeList)
-        //            //{
-        //            //    if (attriBute1.AttriButeId == 0)
-        //            //    {
-        //            //        light.Hue = attriBute1.AttriButeData.ToString();
-        //            //    }
-        //            //    else if ((attriBute1.AttriButeId == 1))
-        //            //    {
-        //            //        light.Saturation = attriBute1.AttriButeData.ToString();
-
-        //            //    }
-        //            //    else if ((attriBute1.AttriButeId == 16394))
-        //            //    {
-        //            //        light.ColorCapabilities = attriBute1.AttriButeData.ToString();
-        //            //    }
-        //            //    else if ((attriBute1.AttriButeId == 16384))
-        //            //    {
-        //            //        light.EnhancedCurrentHue = attriBute1.AttriButeData.ToString();
-        //            //    }
-        //            //}
-        //            light.ReSave();
-        //            ZigBee.Device.ZbGateway.UpdateDeviceStatus(light);
-        //        }
-        //    }
-        //    break;
-        // case DeviceType.OnOffSwitch:
-        //    device.DeviceStatusReport = Newtonsoft.Json.JsonConvert.DeserializeObject<Panel.DeviceStatusReportData>(jobject["Data"].ToString());
-        //    if (device.DeviceStatusReport == null)
-        //    {
-        //        d.errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖";
-        //    }
-        //    else
-        //    {
-        //        d.deviceStatusReportData = device.DeviceStatusReport;
-        //        System.Console.WriteLine($"鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
-
-        //        var panelObj = device as Panel;
-        //        foreach (var common in Gateway.DeviceList)
-        //        {
-        //            if (common.DeviceAddr != panelObj.DeviceAddr || common.DeviceEpoint != panelObj.DeviceEpoint)
-        //            {
-        //                continue;
-        //            }
-        //            if (common.Type == DeviceType.OnOffSwitch)
-        //            {
-        //                if (device.DeviceStatusReport.CluterID == 6)
-        //                {
-        //                    var attriButeList = device.DeviceStatusReport.AttriBute;
-        //                    foreach (var attriBute1 in attriButeList)
-        //                    {
-        //                        panelObj.panelMode = attriBute1.AttriButeData;
-        //                    }
-
-        //                }
-        //            }
-        //            panelObj.ReSave();
-        //            ZigBee.Device.ZbGateway.UpdateDeviceStatus(panelObj);
-        //        }
-        //    }
-        //     break;
-        //case DeviceType.OnOffOutput:
-        //    device.DeviceStatusReport = Newtonsoft.Json.JsonConvert.DeserializeObject<ToggleLight.DeviceStatusReportData>(jobject["Data"].ToString());
-        //    //if (device.DeviceStatusReport != null)
-        //    //{
-        //    //    result = "鎴愬姛";
-        //    //}
-        //    if (device.DeviceStatusReport == null)
-        //    {
-        //        d.errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖";
-        //    }
-        //    else
-        //    {
-        //        d.deviceStatusReportData = device.DeviceStatusReport;
-        //        System.Console.WriteLine($"鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
-
-        //        var lighttoggle = device as ToggleLight;
-        //        foreach (var common in Gateway.DeviceList)
-        //        {
-        //            if (common.DeviceAddr != lighttoggle.DeviceAddr || common.DeviceEpoint != lighttoggle.DeviceEpoint)
-        //            {
-        //                continue;
-        //            }
-        //            if (common.Type == DeviceType.OnOffOutput)
-        //            {
-        //                if (device.DeviceStatusReport.CluterID == 6)
-        //                {
-        //                    var attriButeList = device.DeviceStatusReport.AttriBute;
-        //                    foreach (var attriBute1 in attriButeList)
-        //                    {
-        //                        lighttoggle.OnOffStatus = attriBute1.AttriButeData;
-        //                        System.Console.WriteLine("褰撳墠寮�鍏崇姸鎬�" + "_" + attriBute1.AttriButeData.ToString() + "_" + Gateway.getGatewayBaseInfo.gwID + "_" + System.DateTime.Now.ToString());
-        //                    }
-        //                }
-        //            }
-        //            lighttoggle.ReSave();
-        //            ZigBee.Device.ZbGateway.UpdateDeviceStatus(lighttoggle);
-        //        }
-        //    }
-        //      break;
-
-        //case DeviceType.WindowCoveringDevice:
-        //    device.DeviceStatusReport = Newtonsoft.Json.JsonConvert.DeserializeObject<Rollershade.DeviceStatusReportData>(jobject["Data"].ToString());
-        //    if (device.DeviceStatusReport == null)
-        //    {
-        //        d.errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖";
-        //    }
-        //    else
-        //    {
-        //        d.deviceStatusReportData = device.DeviceStatusReport;
-        //        System.Console.WriteLine($"鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
-        //        var curtain = device as Rollershade;
-        //        foreach (var common in Gateway.DeviceList)
-        //        {
-        //            if (common.DeviceAddr != curtain.DeviceAddr || common.DeviceEpoint != curtain.DeviceEpoint)
-        //            {
-        //                continue;
-        //            }
-        //            if (common.Type == DeviceType.WindowCoveringDevice)
-        //            {
-        //                if (device.DeviceStatusReport.CluterID == 258)
-        //                {
-        //                    foreach (var attriBute1 in curtain.DeviceStatusReport.AttriBute)
-        //                    {
-        //                        switch (attriBute1.AttributeId)
-        //                        {
-        //                            case 0:
-        //                                curtain.WcdType = attriBute1.AttriButeData;
-        //                                System.Console.WriteLine("褰撳墠绐楀笜鐨勭被鍨�" + "_" + curtain.WcdType.ToString() + "_" + Gateway.getGatewayBaseInfo.gwID + "_" + System.DateTime.Now.ToString());
-        //                                break;
-        //                            case 3:
-        //                                curtain.WcdCurrentPositionLift = attriBute1.AttriButeData;
-        //                                System.Console.WriteLine("绐楀笜褰撳墠楂樺害" + "_" + curtain.WcdCurrentPositionLift.ToString() + "_" + Gateway.getGatewayBaseInfo.gwID + "_" + System.DateTime.Now.ToString());
-        //                                break;
-        //                            case 8:
-        //                                curtain.WcdCurrentPositionLiftPercentage = attriBute1.AttriButeData;
-        //                                System.Console.WriteLine("褰撳墠绐楀笜鎵�鍦ㄧ殑杩涘害锛堢櫨鍒嗭級浣嶇疆" + "_" + curtain.WcdCurrentPositionLiftPercentage.ToString() + "_" + Gateway.getGatewayBaseInfo.gwID + "_" + System.DateTime.Now.ToString());
-        //                                break;
-        //                            case 16:
-        //                                curtain.WcdInstalledOpenLimitLift = attriBute1.AttriButeData;
-        //                                System.Console.WriteLine("绐楀笜鍏ㄥ紑鎵�鍦ㄧ殑浣嶇疆" + "_" + curtain.WcdInstalledOpenLimitLift.ToString() + "_" + Gateway.getGatewayBaseInfo.gwID + "_" + System.DateTime.Now.ToString());
-        //                                break;
-        //                            case 17:
-        //                                curtain.WcdInstalledClosedLimitLift = attriBute1.AttriButeData;
-        //                                System.Console.WriteLine("绐楀笜鍏ㄥ叧鎵�鍦ㄧ殑浣嶇疆" + "_" + curtain.WcdCurrentPositionLift.ToString() + "_" + Gateway.getGatewayBaseInfo.gwID + "_" + System.DateTime.Now.ToString());
-        //                                break;
-        //                            case 18:
-        //                                curtain.WcdInstalledOpenLimitTilt = attriBute1.AttriButeData;
-        //                                System.Console.WriteLine("绐楀笜鍏ㄥ紑鎵�鍦ㄧ殑瑙掑害" + "_" + curtain.WcdCurrentPositionLift.ToString() + "_" + Gateway.getGatewayBaseInfo.gwID + "_" + System.DateTime.Now.ToString());
-        //                                break;
-        //                            case 19:
-        //                                curtain.WcdInstalledClosedLimitTilt = attriBute1.AttriButeData;
-        //                                System.Console.WriteLine("绐楀笜鍏ㄥ叧鎵�鍦ㄧ殑瑙掑害" + "_" + curtain.WcdCurrentPositionLift.ToString() + "_" + Gateway.getGatewayBaseInfo.gwID + "_" + System.DateTime.Now.ToString());
-        //                                break;
-        //                            case 23:
-        //                                curtain.WcdCurrentMode = attriBute1.AttriButeData;
-        //                                System.Console.WriteLine("绐楀笜褰撳墠妯″紡" + "_" + curtain.WcdCurrentMode.ToString() + "_" + Gateway.getGatewayBaseInfo.gwID + "_" + System.DateTime.Now.ToString());
-        //                                break;
-        //                            default:
-        //                                break;
-        //                        }
-        //                    }
-        //                    curtain.ReSave();
-        //                    ZigBee.Device.ZbGateway.UpdateDeviceStatus(curtain);
-        //                }
-        //            }
-        //        }
-        //    }
-        //    break;
-        //case DeviceType.IASZone:
-        //device.DeviceStatusReport = Newtonsoft.Json.JsonConvert.DeserializeObject<IASZone.DeviceStatusReportData>(jobject["Data"].ToString());
-        //var ias = device as IASZone;
-        //foreach (var common in Gateway.DeviceList)
-        //{
-        //    if (common.DeviceAddr != ias.DeviceAddr || common.DeviceEpoint != ias.DeviceEpoint)
-        //    {
-        //        continue;
-        //    }
-        //    if (common.Type == DeviceType.IASZone)
-        //    {
-        //        ias.ReSave();
-        //        ZigBee.Device.ZbGateway.UpdateDeviceStatus(ias);
-        //    }
-        //}
-        //ias.ReSave();
-        //break;
-        //case DeviceType.Thermostat:
-        //device.DeviceStatusReport = Newtonsoft.Json.JsonConvert.DeserializeObject<ThermostatObj.DeviceStatusReportData>(jobject["Data"].ToString());
-        //var ther = device as ThermostatObj;
-        //if (ther.DeviceStatusReport.CluterID == 514)
-        //{
-        //    foreach (var attriBute1 in ther.DeviceStatusReport.AttriBute)
-        //    {
-        //        if (attriBute1.AttributeId == 0)
-        //        {
-        //            ther.CurentFanControlMode = attriBute1.AttriButeData;
-        //        }
-        //    }
-        //}
-
-        //if (ther.DeviceStatusReport.CluterID == 513)
-        //{
-        //    foreach (var attriBute1 in ther.DeviceStatusReport.AttriBute)
-        //    {
-        //        if (attriBute1.AttributeId == 0)
-        //        {
-        //            ther.LocalThermostat = attriBute1.AttriButeData / 100;
-        //        }
-        //        else if (attriBute1.AttributeId == 17)
-        //        {
-        //            ther.CurentCoolingSetpoint = attriBute1.AttriButeData / 100;
-        //        }
-        //        else if (attriBute1.AttributeId == 18)
-        //        {
-        //            ther.CurentHeatingSetpoint = attriBute1.AttriButeData / 100;
-        //        }
-        //        else if (attriBute1.AttributeId == 28)
-        //        {
-        //            ther.CurentSystemMode = attriBute1.AttriButeData;
-        //        }
-        //    }
-        //}
-
-        //ZigBee.Device.ZbGateway.UpdateDeviceStatus(ther);
-        //break;
-        //case DeviceType.TemperatureSensor:
-        //var sensor = new TemperatureSensor() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.CurrentGateWayId };
-        //sensor.DeviceStatusReport = Newtonsoft.Json.JsonConvert.DeserializeObject<TemperatureSensor.DeviceStatusReportData>(jobject["Data"].ToString());
-        //ZigBee.Device.ZbGateway.UpdateDeviceStatus(sensor);
-
-        //if (sensor.DeviceStatusReport.CluterID == 1026)
-        //{
-        //    foreach (var attriBute1 in sensor.DeviceStatusReport.AttriBute)
-        //    {
-        //        if (attriBute1.AttributeId == 0)
-        //        {
-        //            sensor.CurentTemperature = attriBute1.AttriButeData;
-        //        }
-        //        else if (attriBute1.AttributeId == 1)
-        //        {
-        //            sensor.MaxTemperature = attriBute1.AttriButeData;
-        //        }
-        //        else if (attriBute1.AttributeId == 2)
-        //        {
-        //            sensor.MinTemperature = attriBute1.AttriButeData;
-        //        }
-        //        else if (attriBute1.AttributeId == 3)
-        //        {
-        //            sensor.TorleranceTemperature = attriBute1.AttriButeData;
-        //        }
-        //        IO.LocalFileUtils.SaveDeviceInfo(sensor, sensor.DeviceEpoint.ToString());
-        //    }
-        //}
-        //else if (sensor.DeviceStatusReport.CluterID == 1029)
-        //{
-        //    foreach (var attriBute1 in sensor.DeviceStatusReport.AttriBute)
-        //    {
-        //        if (attriBute1.AttributeId == 0)
-        //        {
-        //            sensor.CurentHumidity = attriBute1.AttriButeData;
-        //        }
-        //        else if (attriBute1.AttributeId == 1)
-        //        {
-        //            sensor.MaxHumidity = attriBute1.AttriButeData;
-        //        }
-        //        else if (attriBute1.AttributeId == 2)
-        //        {
-        //            sensor.MinHumidity = attriBute1.AttriButeData;
-        //        }
-        //        else if (attriBute1.AttributeId == 3)
-        //        {
-        //            sensor.ToleranceHumidity = attriBute1.AttriButeData;
-        //        }
-        //        IO.LocalFileUtils.SaveDeviceInfo(sensor, sensor.DeviceEpoint.ToString());
-        //    }
-        //}
-
-        //var sen = Gateway.SensorInfoList.Find(obj => obj.DeviceAddr == sensor.DeviceAddr && obj.DeviceEpoint == sensor.DeviceEpoint);
-        //if (sen == null)
-        //{
-        //    Gateway.SensorInfoList.Add(sensor);
-        //}
-        //else
-        //{
-        //    if (sensor.DeviceStatusReport.CluterID == 1026)
-        //    {
-        //        foreach (var attriBute1 in sensor.DeviceStatusReport.AttriBute)
-        //        {
-        //            if (attriBute1.AttributeId == 0)
-        //            {
-        //                sen.CurentTemperature = attriBute1.AttriButeData;
-        //            }
-        //            else if (attriBute1.AttributeId == 1)
-        //            {
-        //                sen.MaxTemperature = attriBute1.AttriButeData;
-        //            }
-        //            else if (attriBute1.AttributeId == 2)
-        //            {
-        //                sen.MinTemperature = attriBute1.AttriButeData;
-        //            }
-        //            else if (attriBute1.AttributeId == 3)
-        //            {
-        //                sen.TorleranceTemperature = attriBute1.AttriButeData;
-        //            }
-        //            IO.LocalFileUtils.SaveDeviceInfo(sensor, sensor.DeviceEpoint.ToString());
-        //        }
-        //    }
-        //    else if (sensor.DeviceStatusReport.CluterID == 1029)
-        //    {
-        //        foreach (var attriBute1 in sensor.DeviceStatusReport.AttriBute)
-        //        {
-        //            if (attriBute1.AttributeId == 0)
-        //            {
-        //                sen.CurentHumidity = attriBute1.AttriButeData;
-        //            }
-        //            else if (attriBute1.AttributeId == 1)
-        //            {
-        //                sen.MaxHumidity = attriBute1.AttriButeData;
-        //            }
-        //            else if (attriBute1.AttributeId == 2)
-        //            {
-        //                sen.MinHumidity = attriBute1.AttriButeData;
-        //            }
-        //            else if (attriBute1.AttributeId == 3)
-        //            {
-        //                sen.ToleranceHumidity = attriBute1.AttriButeData;
-        //            }
-        //            IO.LocalFileUtils.SaveDeviceInfo(sensor, sensor.DeviceEpoint.ToString());
-        //        }
-        //    }
-        //}
-        //break;
-        //                }
-        //            }
-        //        };
-
-        //        Gateway.Actions += action;
-
-        //        var JObject = new JObject {
-        //        { "DeviceAddr",DeviceAddr },
-        //        { "Epoint", DeviceEpoint },
-        //        { "Cluster_ID", (int)clusterID },
-        //        { "Command", 108 }
-        //    };
-        //        var attriBute = new JArray{
-        //          new JObject {
-        //            { "AttriButeId", (int)attriButeId}
-        //           }
-        //    };
-        //        var data = new JObject { { "AttriBute", attriBute } };
-        //        JObject.Add("Data", data);
-        //        Gateway?.Send(("GetDeviceStatus"), Common.SecuritySet.Encryption((JObject.ToString())));
-
-        //        var dateTime = DateTime.Now;
-        //        while ((DateTime.Now - dateTime).TotalMilliseconds < 5000)
-        //        {
-        //            await System.Threading.Tasks.Task.Delay(10);
-        //            if (d.deviceStatusReportData != null)
-        //            {
-        //                break;
-        //            }
-        //        }
-        //        if ((DateTime.Now - dateTime).TotalMilliseconds > 10000)
-        //        {
-        //            d.errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔";
-        //        }
-        //        Gateway.Actions -= action;
-        //        return d;
-
-        //    });
-
-        //}
-        #endregion
-
-        #region 璁惧灞炴�х姸鎬佷笂鎶�
-        /// <summary>
-        /// 鑾峰彇璁惧褰撳墠灞炴�х姸鎬�
-        /// </summary>
-        /// <param name="clusterID">Cluster identifier.</param>
-        /// <param name="attriButeId">Attri bute identifier.</param>
-        public async void ReadAttri(Cluster_ID clusterID, AttriButeId attriButeId)
-        {
-            if (Gateway == null)
-            {
-                return;
-            }
-            await System.Threading.Tasks.Task.Run(async () =>
-            {
-                //Action<string, string> action = (topic, message) => { };
-
-                // Gateway.Actions += action;
-                System.Console.WriteLine("GetDeviceStatus_Actions 鍚姩" + "_" + System.DateTime.Now.ToString());
-
-                try
-                {
-                    var JObject = new JObject {
+          var JObject = new JObject {
                 { "DeviceAddr",DeviceAddr },
                 { "Epoint", DeviceEpoint },
                 { "Cluster_ID", (int)clusterID },
                 { "Command", 108 }
-           };
-                    var attriBute = new JArray{
+     };
+          var attriBute = new JArray{
                   new JObject {
                     { "AttriButeId", (int)attriButeId}
                    }
-           };
-                    var data = new JObject { { "AttriBute", attriBute } };
-                    JObject.Add("Data", data);
-                    Gateway?.Send(("GetDeviceStatus"), JObject.ToString());
-                }
-                catch { }
-
-                // Gateway.Actions -= action;
-                System.Console.WriteLine("GetDeviceStatus_Actions 閫�鍑�" + System.DateTime.Now.ToString());
-            });
+     };
+          var data = new JObject { { "AttriBute", attriBute } };
+          JObject.Add("Data", data);
+          Gateway?.Send(("GetDeviceStatus"), JObject.ToString());
         }
+        catch { }
 
-        /// <summary>
-        /// 璁惧灞炴�х姸鎬佷笂鎶�
-        /// </summary>
-        public DeviceStatusReportData DeviceStatusReport = new DeviceStatusReportData { };
-        /// <summary>
-        /// 璁惧灞炴�х姸鎬佷笂鎶�
-        /// </summary>
-        [System.Serializable]
-        public class DeviceStatusReportData
-        {
-            /// <summary>
-            /// 灞炴�ф墍鍦–luterID
-            /// <summary>
-            /// 璁惧鏀寔鐨勮緭鍏ュ姛鑳�
-            /// <para>0:Basic,璁惧鏀寔鈥滃熀纭�灞炴�р�� </para>
-            /// <para>3:Identify,璁惧鏀寔鈥滆瘑鍒姛鑳解��</para>
-            /// <para>4:Groups,璁惧鏀寔鈥滅粍鍔熻兘鈥�</para>
-            /// <para>5:Scenes,璁惧鏀寔鈥滃満鏅姛鑳解��</para>
-            /// <para>6:on/off,璁惧鏀寔鈥滃紑鍏冲姛鑳解��</para>
-            /// 寮�鍏冲姛鑳界殑璁惧濡傦細璋冨叧鐏�/缁х數鍣�/绐楀笜绛夈�傘�傘��
-            /// <para>8:Level Control,璁惧鏀寔鈥滀寒搴﹁皟鑺傚姛鑳解��</para>
-            /// 浜害璋冭妭鍔熻兘鐨勮澶囧锛氳皟鍏崇伅銆傘�傘��
-            /// <para>257:Door Lock,璁惧鏀寔鈥滈棬閿佸姛鑳解��</para>
-            /// 闂ㄩ攣鍔熻兘鐨勮澶囧锛氶棬閿併�傘�傘��
-            ///  <para>258:Window Covering,璁惧鏀寔鈥滅獥甯樻帶鍒跺姛鑳解��</para>
-            /// 绐楀笜鎺у埗鍔熻兘鐨勮澶囧锛氱獥甯�/寮�鍚堝笜/鍗峰笜銆傘�傘��
-            /// <para>513:Thermostat,璁惧鏀寔鈥滄亽娓╁櫒鍔熻兘鈥�</para>
-            /// 鎭掓俯鍣ㄥ姛鑳界殑璁惧濡傦細绌鸿皟銆傘�傘��
-            /// <para>768:Color Control,璁惧鏀寔鈥滈鑹茶皟鑺傚姛鑳解��</para>
-            /// 棰滆壊璋冭妭鍔熻兘鐨勮澶囧锛氳皟鍏夌伅銆傘�傘��
-            /// <para>1026:Temperature Measurement,璁惧鏀寔鈥滄俯搴︽祴閲忓姛鑳解��</para>
-            /// 娓╁害娴嬮噺鍔熻兘鐨勮澶囧锛氭俯搴︿紶鎰熷櫒銆傘�傘��
-            /// <para>1029:Relative Humidity Measurement,璁惧鏀寔鈥滄箍搴︽祴閲忓姛鑳解��</para>
-            /// 婀垮害娴嬮噺鍔熻兘鐨勮澶囧锛氭箍搴︿紶鎰熷櫒銆傘�傘��
-            /// </summary>
-            /// </summary>
-            public int CluterID;
-            /// <summary>
-            /// 灞炴�у垪琛�
-            /// </summary>
-            public List<AttributeDataObj> AttriBute = new List<AttributeDataObj>();
-        }
-        #endregion
+              // Gateway.Actions -= action;
+              System.Console.WriteLine("GetDeviceStatus_Actions 閫�鍑�" + System.DateTime.Now.ToString());
+      });
+    }
 
-        #region 璁剧疆鍙啓灞炴�х殑鍊�
-        /// <summary>
-        /// 璁剧疆鍙啓灞炴�х殑鍊�
-        /// </summary>
-        /// <returns>The writable value async.</returns>
-        /// <param name="gateway">Gateway.</param>
-        /// <param name="clusterID">瑕侀厤缃殑灞炴�ф墍鍦ㄧ殑cluster.</param>
-        /// <param name="setWritableValue">璁剧疆鍙啓灞炴�х殑鏁版嵁</param>
-        public async System.Threading.Tasks.Task<SetWritableValueResponAllData> SetWritableValueAsync(ZigBee.Device.ZbGateway gateway, int clusterID, SetWritableValueData setWritableValue)
-        {
-            if (gateway == null || setWritableValue == null)
+    /// <summary>
+    /// 璁惧灞炴�х姸鎬佷笂鎶�
+    /// </summary>
+    [Newtonsoft.Json.JsonIgnore]
+    public DeviceStatusReportData DeviceStatusReport = new DeviceStatusReportData();
+    /// <summary>
+    /// 璁惧灞炴�х姸鎬佷笂鎶�
+    /// </summary>
+    [System.Serializable]
+    public class DeviceStatusReportData
+    {
+      /// <summary>
+      /// 灞炴�ф墍鍦–luterID
+      /// <summary>
+      /// 璁惧鏀寔鐨勮緭鍏ュ姛鑳�
+      /// <para>0:Basic,璁惧鏀寔鈥滃熀纭�灞炴�р�� </para>
+      /// <para>3:Identify,璁惧鏀寔鈥滆瘑鍒姛鑳解��</para>
+      /// <para>4:Groups,璁惧鏀寔鈥滅粍鍔熻兘鈥�</para>
+      /// <para>5:Scenes,璁惧鏀寔鈥滃満鏅姛鑳解��</para>
+      /// <para>6:on/off,璁惧鏀寔鈥滃紑鍏冲姛鑳解��</para>
+      /// 寮�鍏冲姛鑳界殑璁惧濡傦細璋冨叧鐏�/缁х數鍣�/绐楀笜绛夈�傘�傘��
+      /// <para>8:Level Control,璁惧鏀寔鈥滀寒搴﹁皟鑺傚姛鑳解��</para>
+      /// 浜害璋冭妭鍔熻兘鐨勮澶囧锛氳皟鍏崇伅銆傘�傘��
+      /// <para>257:Door Lock,璁惧鏀寔鈥滈棬閿佸姛鑳解��</para>
+      /// 闂ㄩ攣鍔熻兘鐨勮澶囧锛氶棬閿併�傘�傘��
+      ///  <para>258:Window Covering,璁惧鏀寔鈥滅獥甯樻帶鍒跺姛鑳解��</para>
+      /// 绐楀笜鎺у埗鍔熻兘鐨勮澶囧锛氱獥甯�/寮�鍚堝笜/鍗峰笜銆傘�傘��
+      /// <para>513:Thermostat,璁惧鏀寔鈥滄亽娓╁櫒鍔熻兘鈥�</para>
+      /// 鎭掓俯鍣ㄥ姛鑳界殑璁惧濡傦細绌鸿皟銆傘�傘��
+      /// <para>768:Color Control,璁惧鏀寔鈥滈鑹茶皟鑺傚姛鑳解��</para>
+      /// 棰滆壊璋冭妭鍔熻兘鐨勮澶囧锛氳皟鍏夌伅銆傘�傘��
+      /// <para>1026:Temperature Measurement,璁惧鏀寔鈥滄俯搴︽祴閲忓姛鑳解��</para>
+      /// 娓╁害娴嬮噺鍔熻兘鐨勮澶囧锛氭俯搴︿紶鎰熷櫒銆傘�傘��
+      /// <para>1029:Relative Humidity Measurement,璁惧鏀寔鈥滄箍搴︽祴閲忓姛鑳解��</para>
+      /// 婀垮害娴嬮噺鍔熻兘鐨勮澶囧锛氭箍搴︿紶鎰熷櫒銆傘�傘��
+      /// </summary>
+      /// </summary>
+      public int CluterID;
+      /// <summary>
+      /// 灞炴�у垪琛�
+      /// </summary>
+      public List<AttributeDataObj> AttriBute = new List<AttributeDataObj>();
+    }
+    #endregion
+
+    #region 璁剧疆鍙啓灞炴�х殑鍊�
+    /// <summary>
+    /// 璁剧疆鍙啓灞炴�х殑鍊�
+    /// </summary>
+    /// <returns>The writable value async.</returns>
+    /// <param name="clusterID">瑕侀厤缃殑灞炴�ф墍鍦ㄧ殑cluster.</param>
+    /// <param name="setWritableValue">璁剧疆鍙啓灞炴�х殑鏁版嵁</param>
+    public async System.Threading.Tasks.Task<SetWritableValueResponAllData> SetWritableValueAsync(int clusterID, SetWritableValueData setWritableValue)
+    {
+      if (Gateway == null || setWritableValue == null)
+      {
+        return null;
+      }
+      return await System.Threading.Tasks.Task.Run(async () =>
+      {
+        SetWritableValueResponAllData 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")
             {
-                return null;
+              var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+              if (temp == null)
+              {
+                d = new SetWritableValueResponAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+              }
+              else
+              {
+                d = new SetWritableValueResponAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
+              }
             }
-            return await System.Threading.Tasks.Task.Run(async () =>
+
+            if (topic == gatewayID + "/" + "SetWritableValue_Respon")
             {
-                SetWritableValueResponAllData d = null;
-                Action<string, string> action = (topic, message) =>
-                {
-                    var gatewayID = topic.Split('/')[0];
-                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+              var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<SetWritableValueResponData>(jobject["Data"].ToString());
 
-                    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 SetWritableValueResponAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
-                        }
-                        else
-                        {
-                            d = new SetWritableValueResponAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
-                        }
-                    }
-
-                    if (topic == gatewayID + "/" + "SetWritableValue_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<SetWritableValueResponData>(jobject["Data"].ToString());
-
-                        if (tempData == null)
-                        {
-                            d = new SetWritableValueResponAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
-                        }
-                        else
-                        {
-                            d = new SetWritableValueResponAllData { setWritableValueResponData = tempData };
-                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
-                        }
-                    }
-                };
-                gateway.Actions += action;
-                System.Console.WriteLine("SetWritableValue_Actions 鍚姩" + "_" + System.DateTime.Now.ToString());
-
-                try
-                {
-                    var jObject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", DeviceEpoint }, { "Cluster_ID", clusterID }, { "Command", 120 } };
-                    var data = new JObject { { "Undivided", setWritableValue.Undivided }, { "AttributeId", setWritableValue.AttributeId }, { "AttributeDataType", setWritableValue.AttributeDataType }, { "AttributeData", setWritableValue.AttributeData } };
-                    jObject.Add("Data", data);
-                    gateway.Send("SetWritableValue", 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 SetWritableValueResponAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
-                }
-                gateway.Actions -= action;
-                System.Console.WriteLine("SetWritableValue_Actions 閫�鍑�" + System.DateTime.Now.ToString());
-
-                return d;
-            });
-        }
-
-        /// <summary>
-        /// 缃戝叧鐗堟湰淇℃伅,缃戝叧鍙嶉淇℃伅
-        /// </summary>
-        public SetWritableValueResponAllData setWritableValueResponAllData;
-        /// <summary>
-        /// 缃戝叧鐗堟湰淇℃伅,缃戝叧鍙嶉淇℃伅
-        /// </summary>
-        [System.Serializable]
-        public class SetWritableValueResponAllData
-        {
-            /// <summary>
-            /// 閿欒淇℃伅
-            /// </summary>
-            public string errorMessageBase;
-            /// <summary>
-            /// 缃戝叧淇℃伅閿欒鍙嶉
-            /// <para>褰撶綉鍏虫帴鏀跺埌瀹㈡埛绔俊鎭悗锛屽嚭鐜颁互涓嬪紓甯告儏鍐靛皢鍙嶉閿欒銆�</para>
-            /// </summary>
-            public ErrorResponData errorResponData;
-            /// <summary>
-            /// 缃戝叧鐗堟湰淇℃伅
-            /// </summary>
-            public SetWritableValueResponData setWritableValueResponData;
-        }
-
-        /// <summary>
-        /// 璁剧疆鍙啓灞炴�х殑鍊肩殑鏁版嵁
-        /// </summary>
-        [System.Serializable]
-        public class SetWritableValueResponData
-        {
-            /// <summary>
-            /// 閰嶇疆灞炴�ф墍鍦ㄧ殑cluster
-            /// </summary>
-            public int Cluster;
-            /// <summary>
-            /// 0锛氶厤缃垚鍔燂紙鑻ラ厤缃垚鍔燂紝涓嬮潰鐨凙ttributeId瀛楁涓嶅瓨鍦級
-            ///<para>134锛氫笉鏀寔璇ュ睘鎬�</para>
-            ///<para>135锛氭棤鏁堢殑灞炴�у��</para>
-            ///<para>141锛氭棤鏁堢殑鏁版嵁绫诲瀷</para>
-            /// </summary>
-            public int Status;
-            /// <summary>
-            /// 閰嶇疆鐨勫睘鎬D锛堝綋Status=0 鏃讹紝璇ュ瓧娈靛皢涓嶅瓨鍦� 锛屼篃灏辨槸鍙湁澶辫触鐨勭粨鏋滄墠浼氳繑鍥炶瀛楁锛�
-            /// </summary>
-            public int AttributeId;
-
-        }
-
-        /// <summary>
-        /// 璁剧疆鍙啓灞炴�х殑鍊肩殑鏁版嵁
-        /// </summary>
-        public SetWritableValueData setWritableValueData;
-        /// <summary>
-        /// 璁剧疆鍙啓灞炴�х殑鍊肩殑鏁版嵁
-        /// </summary>
-        [System.Serializable]
-        public class SetWritableValueData
-        {
-            /// <summary>
-            /// 鏄惁寮哄埗鍐欏叆灞炴��
-            ///<para>0锛氬惁</para>
-            ///<para>1锛氬己鍒跺啓灞炴�у��</para>
-            ///<para>鍙己鐪侊紝榛樿涓�0銆�</para>
-            /// </summary>
-            public int Undivided;
-            /// <summary>
-            /// 灞炴�d
-            /// </summary>
-            public int AttributeId;
-            /// <summary>
-            /// 灞炴�ф暟鎹被鍨�
-            /// </summary>
-            public int AttributeDataType;
-            /// <summary>
-            /// 鍐欏叆鏁板��
-            /// </summary>
-            public int AttributeData;
-
-        }
-        #endregion
-
-        #region 寮�鍏�
-        ///<summary >
-        ///寮�鍏虫帶鍒�(浠呯敤浜巆luster=6鐨勮澶囷級
-        /// <para>璁惧鏀寔cluster=6鐨勮澶囨墠鑳借皟鐢ㄨ鎺ュ彛</para>
-        /// <para>command鐨勫��</para>
-        ///<para>0 : 鍏抽棴</para>
-        ///<para>1: 鎵撳紑</para>
-        ///<para>2锛氬彇鍙�</para>
-        /// </summary>
-        public void SwitchControl(int command)
-        {
-            try
-            {
-                var jobject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", DeviceEpoint }, { "Cluster_ID", 6 }, { "Command", command }, { "SendMode", 2 } };
-                Gateway?.Send(("DeviceControl"), jobject.ToString());
-                System.Console.WriteLine("SwitchControl_鍙戦�佹暟鎹�" + "_" + jobject.ToString() + "_" + System.DateTime.Now.ToString());
-
+              if (tempData == null)
+              {
+                d = new SetWritableValueResponAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
+              }
+              else
+              {
+                d = new SetWritableValueResponAllData { setWritableValueResponData = tempData };
+                System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
+              }
             }
-            catch { }
-        }
-        #endregion
+          };
+        Gateway.Actions += action;
+        System.Console.WriteLine("SetWritableValue_Actions 鍚姩" + "_" + System.DateTime.Now.ToString());
 
-        #region ZCL搴�-鍙戠幇灞炴��
-        /// <summary>
-        ///ZCL搴�-鍙戠幇灞炴��(濡傛灉杩斿洖涓虹┖锛屽彲鑳芥槸璁惧涓嶆槸鏍囧噯璁惧锛屼笉鏀寔杩欐潯鍛戒护锛�
-        /// <para>鑾峰彇璁惧鐨勬煇涓狢luster鎵�鏀寔鐨凙ttributes</para>
-        /// <para> gateway锛氬綋鍓嶇綉鍏�</para>
-        /// <para> clusterID锛氶渶瑕佹煡璇㈢殑cluster</para>
-        /// <para>璇籔anel鐨勫睘鎬э細clusterID=6</para>
-        /// <para>璇讳寒搴︾殑灞炴�э細clusterID=8</para>
-        /// </summary>
-        public async System.Threading.Tasks.Task<ClusterOwnAttributesResponAllData> ClusterOwnAttributesAsync(ZigBee.Device.ZbGateway gateway, int clusterID)
+        try
         {
-            if (gateway == null)
+          var jObject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", DeviceEpoint }, { "Cluster_ID", clusterID }, { "Command", 120 } };
+          var data = new JObject { { "Undivided", setWritableValue.Undivided }, { "AttributeId", setWritableValue.AttributeId }, { "AttributeDataType", setWritableValue.AttributeDataType }, { "AttributeData", setWritableValue.AttributeData } };
+          jObject.Add("Data", data);
+          Gateway.Send("SetWritableValue", 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 SetWritableValueResponAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
+        }
+        Gateway.Actions -= action;
+        System.Console.WriteLine("SetWritableValue_Actions 閫�鍑�" + System.DateTime.Now.ToString());
+
+        return d;
+      });
+    }
+
+    /// <summary>
+    /// 缃戝叧鐗堟湰淇℃伅,缃戝叧鍙嶉淇℃伅
+    /// </summary>
+    [System.Serializable]
+    public class SetWritableValueResponAllData : ErrorResponCommon
+    {
+      /// <summary>
+      /// 缃戝叧鐗堟湰淇℃伅
+      /// </summary>
+      public SetWritableValueResponData setWritableValueResponData;
+    }
+
+    /// <summary>
+    /// 璁剧疆鍙啓灞炴�х殑鍊肩殑鏁版嵁
+    /// </summary>
+    [System.Serializable]
+    public class SetWritableValueResponData
+    {
+      /// <summary>
+      /// 閰嶇疆灞炴�ф墍鍦ㄧ殑cluster
+      /// </summary>
+      public int Cluster;
+      /// <summary>
+      /// 0锛氶厤缃垚鍔燂紙鑻ラ厤缃垚鍔燂紝涓嬮潰鐨凙ttributeId瀛楁涓嶅瓨鍦級
+      ///<para>134锛氫笉鏀寔璇ュ睘鎬�</para>
+      ///<para>135锛氭棤鏁堢殑灞炴�у��</para>
+      ///<para>141锛氭棤鏁堢殑鏁版嵁绫诲瀷</para>
+      /// </summary>
+      public int Status;
+      /// <summary>
+      /// 閰嶇疆鐨勫睘鎬D锛堝綋Status=0 鏃讹紝璇ュ瓧娈靛皢涓嶅瓨鍦� 锛屼篃灏辨槸鍙湁澶辫触鐨勭粨鏋滄墠浼氳繑鍥炶瀛楁锛�
+      /// </summary>
+      public int AttributeId;
+
+    }
+
+    /// <summary>
+    /// 璁剧疆鍙啓灞炴�х殑鍊肩殑鏁版嵁
+    /// </summary>
+    [System.Serializable]
+    public class SetWritableValueData
+    {
+      /// <summary>
+      /// 鏄惁寮哄埗鍐欏叆灞炴��
+      ///<para>0锛氬惁</para>
+      ///<para>1锛氬己鍒跺啓灞炴�у��</para>
+      ///<para>鍙己鐪侊紝榛樿涓�0銆�</para>
+      /// </summary>
+      public int Undivided;
+      /// <summary>
+      /// 灞炴�d
+      /// </summary>
+      public int AttributeId;
+      /// <summary>
+      /// 灞炴�ф暟鎹被鍨�
+      /// </summary>
+      public int AttributeDataType;
+      /// <summary>
+      /// 鍐欏叆鏁板��
+      /// </summary>
+      public int AttributeData;
+
+    }
+    #endregion
+
+    #region 寮�鍏�
+    ///<summary >
+    ///寮�鍏虫帶鍒�(浠呯敤浜巆luster=6鐨勮澶囷級
+    /// <para>璁惧鏀寔cluster=6鐨勮澶囨墠鑳借皟鐢ㄨ鎺ュ彛</para>
+    /// <para>command鐨勫��</para>
+    ///<para>0 : 鍏抽棴</para>
+    ///<para>1: 鎵撳紑</para>
+    ///<para>2锛氬彇鍙�</para>
+    /// </summary>
+    public void SwitchControl(int command)
+    {
+      try
+      {
+        var jobject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", DeviceEpoint }, { "Cluster_ID", 6 }, { "Command", command }, { "SendMode", 2 } };
+        Gateway?.Send(("DeviceControl"), jobject.ToString());
+        System.Console.WriteLine("SwitchControl_鍙戦�佹暟鎹�" + "_" + jobject.ToString() + "_" + System.DateTime.Now.ToString());
+
+      }
+      catch { }
+    }
+    #endregion
+
+    #region ZCL搴�-鍙戠幇灞炴��
+    /// <summary>
+    ///ZCL搴�-鍙戠幇灞炴��(濡傛灉杩斿洖涓虹┖锛屽彲鑳芥槸璁惧涓嶆槸鏍囧噯璁惧锛屼笉鏀寔杩欐潯鍛戒护锛�
+    /// <para>鑾峰彇璁惧鐨勬煇涓狢luster鎵�鏀寔鐨凙ttributes</para>
+    /// <para> gateway锛氬綋鍓嶇綉鍏�</para>
+    /// <para> clusterID锛氶渶瑕佹煡璇㈢殑cluster</para>
+    /// <para>璇籔anel鐨勫睘鎬э細clusterID=6</para>
+    /// <para>璇讳寒搴︾殑灞炴�э細clusterID=8</para>
+    /// </summary>
+    public async System.Threading.Tasks.Task<ClusterOwnAttributesResponAllData> ClusterOwnAttributesAsync(ZigBee.Device.ZbGateway gateway, int clusterID)
+    {
+      if (gateway == null)
+      {
+        return null;
+      }
+      return await System.Threading.Tasks.Task.Run(async () =>
+      {
+        ClusterOwnAttributesResponAllData 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")
             {
-                return null;
+              var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+              if (temp == null)
+              {
+                d = new ClusterOwnAttributesResponAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+              }
+              else
+              {
+                d = new ClusterOwnAttributesResponAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
+              }
             }
-            return await System.Threading.Tasks.Task.Run(async () =>
+
+            if (topic == gatewayID + "/" + "Cluster/OwnAttributes_Respon")
             {
-                ClusterOwnAttributesResponAllData d = null;
-                Action<string, string> action = (topic, message) =>
-                {
-                    var gatewayID = topic.Split('/')[0];
-                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+              var clusterOwnAttributesResponData = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ClusterOwnAttributesResponData>(jobject["Data"].ToString());
+              var tempAttributes = Newtonsoft.Json.Linq.JArray.Parse(jobject["Data"]["Attribute"].ToString());
+              for (int m = 0; tempAttributes != null && m < tempAttributes.Count; m++)
+              {
+                var tempAttribute = tempAttributes[m];
+                clusterOwnAttributesResponData.AttributeList.Add(Newtonsoft.Json.JsonConvert.DeserializeObject<AttributeObj>(tempAttribute.ToString()));
+              }
 
-                    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 (clusterOwnAttributesResponData == null)
+              {
+                d = new ClusterOwnAttributesResponAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
+              }
+              else
+              {
+                d = new ClusterOwnAttributesResponAllData { clusterOwnAttributesResponData = clusterOwnAttributesResponData };
+                System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
 
-                        if (temp == null)
-                        {
-                            d = new ClusterOwnAttributesResponAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
-                        }
-                        else
-                        {
-                            d = new ClusterOwnAttributesResponAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
-                        }
-                    }
-
-                    if (topic == gatewayID + "/" + "Cluster/OwnAttributes_Respon")
-                    {
-                        var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = gateway.getGatewayBaseInfo.gwID };
-                        gatewayTemp.clusterOwnAttributesResponData = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ClusterOwnAttributesResponData>(jobject["Data"].ToString());
-                        var tempAttributes = Newtonsoft.Json.Linq.JArray.Parse(jobject["Data"]["Attribute"].ToString());
-                        for (int m = 0; tempAttributes != null && m < tempAttributes.Count; m++)
-                        {
-                            var tempAttribute = tempAttributes[m];
-                            gatewayTemp.clusterOwnAttributesResponData.AttributeList.Add(Newtonsoft.Json.JsonConvert.DeserializeObject<AttributeObj>(tempAttribute.ToString()));
-                        }
-
-                        if (gatewayTemp.clusterOwnAttributesResponData == null)
-                        {
-                            d = new ClusterOwnAttributesResponAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
-                        }
-                        else
-                        {
-                            d = new ClusterOwnAttributesResponAllData { clusterOwnAttributesResponData = gatewayTemp.clusterOwnAttributesResponData };
-                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
-
-                        }
-                    }
-                };
-                gateway.Actions += action;
-                System.Console.WriteLine("Cluster/OwnAttributes_Actions 鍚姩" + "_" + System.DateTime.Now.ToString());
-
-                try
-                {
-                    var jObject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", DeviceEpoint }, { "Cluster_ID", clusterID }, { "Command", 301 } };
-                    gateway.Send("Cluster/OwnAttributes", 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 ClusterOwnAttributesResponAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
-                }
-                gateway.Actions -= action;
-                System.Console.WriteLine("Cluster/OwnAttributes_Actions 閫�鍑�" + System.DateTime.Now.ToString());
-
-                return d;
-            });
-        }
-
-        /// <summary>
-        /// 鍙戠幇灞炴��,缃戝叧鍙嶉淇℃伅
-        /// </summary>
-        public ClusterOwnAttributesResponAllData clusterOwnAttributesResponAllData;
-        /// <summary>
-        /// 鍙戠幇灞炴��,缃戝叧鍙嶉淇℃伅
-        /// </summary>
-        [System.Serializable]
-        public class ClusterOwnAttributesResponAllData
-        {
-            /// <summary>
-            /// 閿欒淇℃伅
-            /// </summary>
-            public string errorMessageBase;
-            /// <summary>
-            /// 缃戝叧淇℃伅閿欒鍙嶉
-            /// <para>褰撶綉鍏虫帴鏀跺埌瀹㈡埛绔俊鎭悗锛屽嚭鐜颁互涓嬪紓甯告儏鍐靛皢鍙嶉閿欒銆�</para>
-            /// </summary>
-            public ErrorResponData errorResponData;
-            /// <summary>
-            /// 缃戝叧鐗堟湰淇℃伅
-            /// </summary>
-            public ClusterOwnAttributesResponData clusterOwnAttributesResponData;
-        }
-
-        /// <summary>
-        /// 鍙戠幇灞炴�ф暟鎹�
-        /// </summary>
-        public ClusterOwnAttributesResponData clusterOwnAttributesResponData;
-        [System.Serializable]
-        public class ClusterOwnAttributesResponData
-        {
-            /// <summary>
-            /// 鏌ヨ鐨刢luste
-            /// </summary>
-            public int Cluster;
-            /// <summary>
-            /// 璁惧灞炴�у垪琛�
-            /// </summary>
-            public List<AttributeObj> AttributeList = new List<AttributeObj>();
-
-        }
-        #endregion
-
-        #region ZCL搴�-鏀寔鐨凜ommand
-        /// <summary>
-        ///ZCL搴�-璁惧鏌恈luster鎵�鏀寔鐨凜ommand  ;(濡傛灉杩斿洖涓虹┖锛屽彲鑳芥槸璁惧涓嶆槸鏍囧噯璁惧锛屼笉鏀寔杩欐潯鍛戒护锛�
-        /// <para>鑾峰彇璁惧鏌恈luster鎵�鏀寔鐨凜ommand</para>
-        /// <para> gateway锛氬綋鍓嶇綉鍏�</para>
-        /// <para> clusterID锛氶渶瑕佹煡璇㈢殑cluster</para>
-        /// </summary>
-        public async System.Threading.Tasks.Task<ClusterOwnCommandResponAllData> ClusterOwnCommandAsync(ZigBee.Device.ZbGateway gateway, int clusterID)
-        {
-            if (gateway == null)
-            {
-                return null;
+              }
             }
-            return await System.Threading.Tasks.Task.Run(async () =>
+          };
+        gateway.Actions += action;
+        System.Console.WriteLine("Cluster/OwnAttributes_Actions 鍚姩" + "_" + System.DateTime.Now.ToString());
+
+        try
+        {
+          var jObject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", DeviceEpoint }, { "Cluster_ID", clusterID }, { "Command", 301 } };
+          gateway.Send("Cluster/OwnAttributes", 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 ClusterOwnAttributesResponAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
+        }
+        gateway.Actions -= action;
+        System.Console.WriteLine("Cluster/OwnAttributes_Actions 閫�鍑�" + System.DateTime.Now.ToString());
+
+        return d;
+      });
+    }
+
+    /// <summary>
+    /// 鍙戠幇灞炴��,缃戝叧鍙嶉淇℃伅
+    /// </summary>
+    [System.Serializable]
+    public class ClusterOwnAttributesResponAllData : ErrorResponCommon
+    {
+      /// <summary>
+      /// 缃戝叧鐗堟湰淇℃伅
+      /// </summary>
+      public ClusterOwnAttributesResponData clusterOwnAttributesResponData;
+    }
+
+    [System.Serializable]
+    public class ClusterOwnAttributesResponData
+    {
+      /// <summary>
+      /// 鏌ヨ鐨刢luste
+      /// </summary>
+      public int Cluster;
+      /// <summary>
+      /// 璁惧灞炴�у垪琛�
+      /// </summary>
+      public List<AttributeObj> AttributeList = new List<AttributeObj>();
+
+    }
+    #endregion
+
+    #region ZCL搴�-鏀寔鐨凜ommand
+    /// <summary>
+    ///ZCL搴�-璁惧鏌恈luster鎵�鏀寔鐨凜ommand  ;(濡傛灉杩斿洖涓虹┖锛屽彲鑳芥槸璁惧涓嶆槸鏍囧噯璁惧锛屼笉鏀寔杩欐潯鍛戒护锛�
+    /// <para>鑾峰彇璁惧鏌恈luster鎵�鏀寔鐨凜ommand</para>
+    /// <para> gateway锛氬綋鍓嶇綉鍏�</para>
+    /// <para> clusterID锛氶渶瑕佹煡璇㈢殑cluster</para>
+    /// </summary>
+    public async System.Threading.Tasks.Task<ClusterOwnCommandResponAllData> ClusterOwnCommandAsync(ZigBee.Device.ZbGateway gateway, int clusterID)
+    {
+      if (gateway == null)
+      {
+        return null;
+      }
+      return await System.Threading.Tasks.Task.Run(async () =>
+      {
+        ClusterOwnCommandResponAllData 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")
             {
-                ClusterOwnCommandResponAllData d = null;
-                Action<string, string> action = (topic, message) =>
-                {
-                    var gatewayID = topic.Split('/')[0];
-                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+              var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
 
-                    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 ClusterOwnCommandResponAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+              }
+              else
+              {
+                d = new ClusterOwnCommandResponAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
 
-                        if (temp == null)
-                        {
-                            d = new ClusterOwnCommandResponAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
-                        }
-                        else
-                        {
-                            d = new ClusterOwnCommandResponAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
+              }
+            }
 
-                        }
-                    }
-
-                    if (topic == gatewayID + "/" + "Cluster/OwnCommand_Respon")
-                    {
-                        var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = gateway.getGatewayBaseInfo.gwID };
-                        gatewayTemp.clusterOwnCommandResponData = Newtonsoft.Json.JsonConvert.DeserializeObject<ClusterOwnCommandResponData>(jobject["Data"].ToString());
-
-                        if (gatewayTemp.clusterOwnCommandResponData == null)
-                        {
-                            d = new ClusterOwnCommandResponAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
-
-                        }
-                        else
-                        {
-                            d = new ClusterOwnCommandResponAllData { clusterOwnCommandResponData = gatewayTemp.clusterOwnCommandResponData };
-                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
-                        }
-                    }
-                };
-                gateway.Actions += action;
-                System.Console.WriteLine("Cluster/OwnCommand_Actions 鍚姩" + "_" + System.DateTime.Now.ToString());
-
-                try
-                {
-                    var jObject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", DeviceEpoint }, { "Cluster_ID", clusterID }, { "Command", 302 } };
-                    gateway.Send("Cluster/OwnCommand", 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 ClusterOwnCommandResponAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
-
-                }
-                gateway.Actions -= action;
-                System.Console.WriteLine("Cluster/OwnCommand_Actions 閫�鍑�" + System.DateTime.Now.ToString());
-
-                return d;
-            });
-        }
-
-        /// <summary>
-        /// 璁惧鏌恈luster鎵�鏀寔鐨凜ommand鏁版嵁,缃戝叧鍙嶉淇℃伅
-        /// </summary>
-        public ClusterOwnCommandResponAllData clusterOwnCommandResponAllData;
-        /// <summary>
-        /// 璁惧鏌恈luster鎵�鏀寔鐨凜ommand鏁版嵁,缃戝叧鍙嶉淇℃伅
-        /// </summary>
-        [System.Serializable]
-        public class ClusterOwnCommandResponAllData
-        {
-            /// <summary>
-            /// 閿欒淇℃伅
-            /// </summary>
-            public string errorMessageBase;
-            /// <summary>
-            /// 缃戝叧淇℃伅閿欒鍙嶉
-            /// <para>褰撶綉鍏虫帴鏀跺埌瀹㈡埛绔俊鎭悗锛屽嚭鐜颁互涓嬪紓甯告儏鍐靛皢鍙嶉閿欒銆�</para>
-            /// </summary>
-            public ErrorResponData errorResponData;
-            /// <summary>
-            /// 缃戣澶囨煇cluster鎵�鏀寔鐨凜ommand鏁版嵁
-            /// </summary>
-            public ClusterOwnCommandResponData clusterOwnCommandResponData;
-        }
-
-        /// <summary>
-        /// 璁惧鏌恈luster鎵�鏀寔鐨凜ommand鏁版嵁
-        /// </summary>
-        public ClusterOwnCommandResponData clusterOwnCommandResponData;
-        /// <summary>
-        /// 璁惧鏌恈luster鎵�鏀寔鐨凜ommand鏁版嵁
-        /// </summary>
-        [System.Serializable]
-        public class ClusterOwnCommandResponData
-        {
-            /// <summary>
-            /// 鏌ヨ鐨刢luste
-            /// </summary>
-            public int Cluster;
-            /// <summary>
-            /// 璁惧灞炴�у垪琛�
-            /// </summary>
-            public List<CommandObj> Command = new List<CommandObj>();
-
-        }
-        #endregion
-
-        #region 璁惧畾OTA鍗囩骇鍥轰欢.;
-        /// <summary>
-        /// 璁惧畾OTA鍗囩骇鍥轰欢
-        /// </summary>
-        /// <returns>The NVA sync.</returns>
-        /// <param name="gateway">Gateway.</param>
-        /// <param name="oTAImageName">O TAI mage name:鍗囩骇闀滃儚鍚嶇О</param>
-        public async System.Threading.Tasks.Task<OTASetImageResponseAllData> UpgradeDeviceAsync(ZigBee.Device.ZbGateway gateway, string oTAImageName)
-        {
-            return await System.Threading.Tasks.Task.Run(async () =>
+            if (topic == gatewayID + "/" + "Cluster/OwnCommand_Respon")
             {
-                OTASetImageResponseAllData d = null; ;
-                Action<string, string> action = (topic, message) =>
-                {
-                    var gatewayID = topic.Split('/')[0];
-                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+              var clusterOwnCommandResponData = Newtonsoft.Json.JsonConvert.DeserializeObject<ClusterOwnCommandResponData>(jobject["Data"].ToString());
 
-                    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 (clusterOwnCommandResponData == null)
+              {
+                d = new ClusterOwnCommandResponAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
 
-                        if (temp == null)
-                        {
-                            d = new OTASetImageResponseAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
-                        }
+              }
+              else
+              {
+                d = new ClusterOwnCommandResponAllData { clusterOwnCommandResponData = clusterOwnCommandResponData };
+                System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
+              }
+            }
+          };
+        gateway.Actions += action;
+        System.Console.WriteLine("Cluster/OwnCommand_Actions 鍚姩" + "_" + System.DateTime.Now.ToString());
 
-                        else
-                        {
-                            d = new OTASetImageResponseAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
-                        }
-                    }
-
-                    if (topic == gatewayID + "/" + "OTA/SetImage_Respon")
-                    {
-                        var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID") };
-                        gatewayTemp.oTASetImageData = Newtonsoft.Json.JsonConvert.DeserializeObject<OTASetImageData>(jobject["Data"].ToString());
-
-                        if (gatewayTemp.oTASetImageData == null)
-                        {
-                            d = new OTASetImageResponseAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
-                        }
-                        else
-                        {
-                            d = new OTASetImageResponseAllData { otaSetImageData = gatewayTemp.oTASetImageData };
-                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
-                        }
-                    }
-                };
-                gateway.Actions += action;
-                System.Console.WriteLine("OTA/SetImage_Actions 鍚姩" + "_" + System.DateTime.Now.ToString());
-
-                try
-                {
-                    var jObject = new JObject { { "Cluster_ID", 25 }, { "Command", 30 } };
-                    var data = new JObject { { "OTAImageName", oTAImageName }, { "OTAImagePath", "/tmp" } };
-                    jObject.Add("Data", data);
-                    gateway.Send(("OTA/SetImage"), 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 OTASetImageResponseAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
-                }
-                gateway.Actions -= action;
-                System.Console.WriteLine("OTA/SetImage_Actions 閫�鍑�" + System.DateTime.Now.ToString());
-
-                return d;
-            });
-        }
-
-        /// <summary>
-        /// 璁惧杩涜OTA鍗囩骇,缃戝叧鍙嶉鍏蜂綋淇℃伅
-        /// </summary>
-        public OTASetImageResponseAllData otaSetImageResponseAllData;
-        /// <summary>
-        /// 璁惧杩涜OTA鍗囩骇,缃戝叧鍙嶉鍏蜂綋淇℃伅
-        /// </summary>
-        [System.Serializable]
-        public class OTASetImageResponseAllData
+        try
         {
-            /// <summary>
-            /// 閿欒淇℃伅
-            /// </summary>
-            public string errorMessageBase;
-            /// <summary>
-            /// 缃戝叧淇℃伅閿欒鍙嶉
-            /// <para>褰撶綉鍏虫帴鏀跺埌瀹㈡埛绔俊鎭悗锛屽嚭鐜颁互涓嬪紓甯告儏鍐靛皢鍙嶉閿欒銆�</para>
-            /// </summary>
-            public ErrorResponData errorResponData;
-            /// <summary>
-            /// 淇濆瓨zigbee鍗忚皟鍣ㄧ粍缃戜俊鎭�
-            /// </summary>
-            public OTASetImageData otaSetImageData;
+          var jObject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", DeviceEpoint }, { "Cluster_ID", clusterID }, { "Command", 302 } };
+          gateway.Send("Cluster/OwnCommand", jObject.ToString());
         }
-        /// <summary>
-        /// 璁惧杩涜OTA鍗囩骇
-        /// </summary>
-        public OTASetImageData oTASetImageData;
-        [System.Serializable]
-        public class OTASetImageData
+        catch { }
+
+        var dateTime = DateTime.Now;
+        while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
         {
-            /// <summary>
-            /// 0锛氭垚鍔�
-            ///<para>1锛氭病鏈夋壘鍒版枃浠舵垨鎵撳紑鏂囦欢澶辫触</para>
-            ///<para>2锛氬綋鍓嶆湁鑺傜偣璁惧姝e湪ota鍗囩骇锛屽師鏉ョ殑ota鍥轰欢杩樺湪鍗犵敤锛屼笉鑳介噸鏂拌瀹氬浐浠躲�傝嫢瑕侀噸鏂拌瀹歰ta鍥轰欢锛屽垯闇�瑕佸厛鐢ㄧ粓姝㈠崌绾ф寚浠ょ粓姝㈡墍鏈夋鍦ㄥ崌绾х殑鑺傜偣璁惧銆�</para>
-            /// </summary>
-            public int Result;
-
-            /// <summary>
-            /// 璇ta鍥轰欢鐨勫埗閫犲晢ID(Result = 0鏃跺瓨鍦�)
-            /// </summary>
-            public int Manufacture;
-
-            /// <summary>
-            /// 璇ta鍥轰欢鐨勫浐浠剁被鍨媔d(Result = 0鏃跺瓨鍦�)
-            /// </summary>
-            public int ImgTypeId;
-
-            /// <summary>
-            /// 璇ta鍥轰欢鐨勭増鏈�(Result = 0鏃跺瓨鍦�)
-            /// </summary>
-            public int FileVersion;
-
-            /// <summary>
-            /// 鍥轰欢澶у皬
-            /// </summary>
-            public int FileSize;
-
-            /// <summary>
-            ///姝e湪鍗囩骇鐨刼ta鑺傜偣璁惧鍒�(Result=2鏃讹紝璇ュ瓧娈垫墠瀛樺湪)
-            /// </summary>
-            public List<OTADeviceList> DeviceList = new List<OTADeviceList>();
+          await System.Threading.Tasks.Task.Delay(10);
+          if (d != null)
+          {
+            break;
+          }
         }
-
-        /// <summary>
-        /// 杈撳叆绨�
-        /// </summary>
-        [System.Serializable]
-        public class OTADeviceList
+        if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
         {
-            /// <summary>
-            /// MAC鍦板潃
-            /// </summary>
-            public string MacAddr;
+          d = new ClusterOwnCommandResponAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
 
-            /// <summary>
-            /// 璁惧绔彛鍙凤紝褰撳崌绾ц澶囷紝HDL鐨勮澶囧ぇ澶氭暟鐨勭鐐归粯璁ゆ槸200
-            /// </summary>
-            public int Epoint = 200;
         }
-        #endregion
+        gateway.Actions -= action;
+        System.Console.WriteLine("Cluster/OwnCommand_Actions 閫�鍑�" + System.DateTime.Now.ToString());
 
-        #region 鍚姩鍗囩骇;
-        /// <summary>
-        /// 璁惧畾OTA鍗囩骇鍥轰欢
-        /// </summary>
-        /// <returns>The NVA sync.</returns>
-        /// <param name="gateway">Gateway.</param>
-        /// <param name="oTAImageName">O TAI mage name:鍗囩骇闀滃儚鍚嶇О</param>
-        public async System.Threading.Tasks.Task<StartDeviceUpdateResponseAllData> StartDeviceUpdateAsync(ZigBee.Device.ZbGateway gateway, StartUpdateData startUpdateData)
-        {
-            return await System.Threading.Tasks.Task.Run(async () =>
+        return d;
+      });
+    }
+
+    /// <summary>
+    /// 璁惧鏌恈luster鎵�鏀寔鐨凜ommand鏁版嵁,缃戝叧鍙嶉淇℃伅
+    /// </summary>
+    [System.Serializable]
+    public class ClusterOwnCommandResponAllData : ErrorResponCommon
+    {
+      /// <summary>
+      /// 缃戣澶囨煇cluster鎵�鏀寔鐨凜ommand鏁版嵁
+      /// </summary>
+      public ClusterOwnCommandResponData clusterOwnCommandResponData;
+    }
+
+    /// <summary>
+    /// 璁惧鏌恈luster鎵�鏀寔鐨凜ommand鏁版嵁
+    /// </summary>
+    [System.Serializable]
+    public class ClusterOwnCommandResponData
+    {
+      /// <summary>
+      /// 鏌ヨ鐨刢luste
+      /// </summary>
+      public int Cluster;
+      /// <summary>
+      /// 璁惧灞炴�у垪琛�
+      /// </summary>
+      public List<CommandObj> Command = new List<CommandObj>();
+
+    }
+    #endregion
+
+    #region 璁惧畾OTA鍗囩骇鍥轰欢.;
+    /// <summary>
+    /// 璁惧畾OTA鍗囩骇鍥轰欢
+    /// </summary>
+    /// <returns>The NVA sync.</returns>
+    /// <param name="gateway">Gateway.</param>
+    /// <param name="oTAImageName">O TAI mage name:鍗囩骇闀滃儚鍚嶇О</param>
+    public async System.Threading.Tasks.Task<OTASetImageResponseAllData> UpgradeDeviceAsync(ZigBee.Device.ZbGateway gateway, string oTAImageName)
+    {
+      return await System.Threading.Tasks.Task.Run(async () =>
+      {
+        OTASetImageResponseAllData 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")
             {
-                StartDeviceUpdateResponseAllData d = null; ;
-                Action<string, string> action = (topic, message) =>
-                {
-                    var gatewayID = topic.Split('/')[0];
-                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+              var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
 
-                    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 OTASetImageResponseAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+              }
 
-                        if (temp == null)
-                        {
-                            d = new StartDeviceUpdateResponseAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
-                        }
+              else
+              {
+                d = new OTASetImageResponseAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
+              }
+            }
 
-                        else
-                        {
-                            d = new StartDeviceUpdateResponseAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
-                        }
-                    }
+            if (topic == gatewayID + "/" + "OTA/SetImage_Respon")
+            {
+              var oTASetImageData = Newtonsoft.Json.JsonConvert.DeserializeObject<OTASetImageData>(jobject["Data"].ToString());
 
-                    if (topic == gatewayID + "/" + "OTA/StartUpdate_Respon")
-                    {
-                        var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID") };
-                        gatewayTemp.startUpdateDeviceData = Newtonsoft.Json.JsonConvert.DeserializeObject<StartDeviceUpdateData>(jobject["Data"].ToString());
+              if (oTASetImageData == null)
+              {
+                d = new OTASetImageResponseAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
+              }
+              else
+              {
+                d = new OTASetImageResponseAllData { otaSetImageData = oTASetImageData };
+                System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
+              }
+            }
+          };
+        gateway.Actions += action;
+        System.Console.WriteLine("OTA/SetImage_Actions 鍚姩" + "_" + System.DateTime.Now.ToString());
 
-                        if (gatewayTemp.startUpdateDeviceData == null)
-                        {
-                            d = new StartDeviceUpdateResponseAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
-                        }
-                        else
-                        {
-                            d = new StartDeviceUpdateResponseAllData { startUpdateDeviceData = gatewayTemp.startUpdateDeviceData };
-                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
-                        }
-                    }
-                };
-                gateway.Actions += action;
-                System.Console.WriteLine("OTA/StartUpdate_Actions 鍚姩" + "_" + System.DateTime.Now.ToString());
+        try
+        {
+          var jObject = new JObject { { "Cluster_ID", 25 }, { "Command", 30 } };
+          var data = new JObject { { "OTAImageName", oTAImageName }, { "OTAImagePath", "/tmp" } };
+          jObject.Add("Data", data);
+          gateway.Send(("OTA/SetImage"), 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 OTASetImageResponseAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
+        }
+        gateway.Actions -= action;
+        System.Console.WriteLine("OTA/SetImage_Actions 閫�鍑�" + System.DateTime.Now.ToString());
 
-                try
-                {
-                    if (startUpdateData != null)
-                    {
-                        var jObject = new JObject { { "Cluster_ID", 25 }, { "Command", 0 } };
-                        var deviceList = new JArray { };
-                        foreach (var de in startUpdateData.DeviceList)
-                        {
-                            var dInfo = new JObject{
+        return d;
+      });
+    }
+
+    /// <summary>
+    /// 璁惧杩涜OTA鍗囩骇,缃戝叧鍙嶉鍏蜂綋淇℃伅
+    /// </summary>
+    [System.Serializable]
+    public class OTASetImageResponseAllData : ErrorResponCommon
+    {
+      /// <summary>
+      /// 淇濆瓨zigbee鍗忚皟鍣ㄧ粍缃戜俊鎭�
+      /// </summary>
+      public OTASetImageData otaSetImageData;
+    }
+
+    [System.Serializable]
+    public class OTASetImageData
+    {
+      /// <summary>
+      /// 0锛氭垚鍔�
+      ///<para>1锛氭病鏈夋壘鍒版枃浠舵垨鎵撳紑鏂囦欢澶辫触</para>
+      ///<para>2锛氬綋鍓嶆湁鑺傜偣璁惧姝e湪ota鍗囩骇锛屽師鏉ョ殑ota鍥轰欢杩樺湪鍗犵敤锛屼笉鑳介噸鏂拌瀹氬浐浠躲�傝嫢瑕侀噸鏂拌瀹歰ta鍥轰欢锛屽垯闇�瑕佸厛鐢ㄧ粓姝㈠崌绾ф寚浠ょ粓姝㈡墍鏈夋鍦ㄥ崌绾х殑鑺傜偣璁惧銆�</para>
+      /// </summary>
+      public int Result;
+
+      /// <summary>
+      /// 璇ta鍥轰欢鐨勫埗閫犲晢ID(Result = 0鏃跺瓨鍦�)
+      /// </summary>
+      public int Manufacture;
+
+      /// <summary>
+      /// 璇ta鍥轰欢鐨勫浐浠剁被鍨媔d(Result = 0鏃跺瓨鍦�)
+      /// </summary>
+      public int ImgTypeId;
+
+      /// <summary>
+      /// 璇ta鍥轰欢鐨勭増鏈�(Result = 0鏃跺瓨鍦�)
+      /// </summary>
+      public int FileVersion;
+
+      /// <summary>
+      /// 鍥轰欢澶у皬
+      /// </summary>
+      public int FileSize;
+
+      /// <summary>
+      ///姝e湪鍗囩骇鐨刼ta鑺傜偣璁惧鍒�(Result=2鏃讹紝璇ュ瓧娈垫墠瀛樺湪)
+      /// </summary>
+      public List<OTADeviceList> DeviceList = new List<OTADeviceList>();
+    }
+
+    /// <summary>
+    /// 杈撳叆绨�
+    /// </summary>
+    [System.Serializable]
+    public class OTADeviceList
+    {
+      /// <summary>
+      /// MAC鍦板潃
+      /// </summary>
+      public string MacAddr;
+
+      /// <summary>
+      /// 璁惧绔彛鍙凤紝褰撳崌绾ц澶囷紝HDL鐨勮澶囧ぇ澶氭暟鐨勭鐐归粯璁ゆ槸200
+      /// </summary>
+      public int Epoint = 200;
+    }
+    #endregion
+
+    #region 鍚姩鍗囩骇;
+    /// <summary>
+    /// 璁惧畾OTA鍗囩骇鍥轰欢
+    /// </summary>
+    /// <returns>The NVA sync.</returns>
+    /// <param name="gateway">Gateway.</param>
+    /// <param name="oTAImageName">O TAI mage name:鍗囩骇闀滃儚鍚嶇О</param>
+    public async System.Threading.Tasks.Task<StartDeviceUpdateResponseAllData> StartDeviceUpdateAsync(ZigBee.Device.ZbGateway gateway, StartUpdateData startUpdateData)
+    {
+      return await System.Threading.Tasks.Task.Run(async () =>
+      {
+        StartDeviceUpdateResponseAllData 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 temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+              if (temp == null)
+              {
+                d = new StartDeviceUpdateResponseAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+              }
+
+              else
+              {
+                d = new StartDeviceUpdateResponseAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
+              }
+            }
+
+            if (topic == gatewayID + "/" + "OTA/StartUpdate_Respon")
+            {
+              var startUpdateDeviceData = Newtonsoft.Json.JsonConvert.DeserializeObject<StartDeviceUpdateData>(jobject["Data"].ToString());
+
+              if (startUpdateDeviceData == null)
+              {
+                d = new StartDeviceUpdateResponseAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
+              }
+              else
+              {
+                d = new StartDeviceUpdateResponseAllData { startUpdateDeviceData = startUpdateDeviceData };
+                System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
+              }
+            }
+          };
+        gateway.Actions += action;
+        System.Console.WriteLine("OTA/StartUpdate_Actions 鍚姩" + "_" + System.DateTime.Now.ToString());
+
+        try
+        {
+          if (startUpdateData != null)
+          {
+            var jObject = new JObject { { "Cluster_ID", 25 }, { "Command", 0 } };
+            var deviceList = new JArray { };
+            foreach (var de in startUpdateData.DeviceList)
+            {
+              var dInfo = new JObject{
                             { "MacAddr",de.MacAddr},
                             { "Epoint", de.Epoint}
-                            };
-                            deviceList.Add(dInfo);
-                        }
-                        var data = new JObject { { "DeviceList", deviceList } };
-                        jObject.Add("Data", data);
-                        gateway.Send(("OTA/StartUpdate"), jObject.ToString());
-                    }
-                }
-                catch
-                { }
-                var dateTime = DateTime.Now;
-                while ((DateTime.Now - dateTime).TotalMilliseconds < 30 * 1000)
-                {
-                    await System.Threading.Tasks.Task.Delay(10);
-                    if (d != null)
-                    {
-                        break;
-                    }
-                }
-                if ((DateTime.Now - dateTime).TotalMilliseconds > 30 * 1000)
-                {
-                    d = new StartDeviceUpdateResponseAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
-
-                }
-                gateway.Actions -= action;
-                System.Console.WriteLine("OTA/StartUpdate_Actions 閫�鍑�" + System.DateTime.Now.ToString());
-
-                return d;
-            });
-        }
-
-        /// <summary>
-        /// 鍚姩鍗囩骇,缃戝叧鍙嶉鍏蜂綋淇℃伅
-        /// </summary>
-        public StartDeviceUpdateResponseAllData startUpdateDeviceResponseAllData;
-        /// <summary>
-        /// 鍚姩鍗囩骇,缃戝叧鍙嶉鍏蜂綋淇℃伅
-        /// </summary>
-        [System.Serializable]
-        public class StartDeviceUpdateResponseAllData
-        {
-            /// <summary>
-            /// 閿欒淇℃伅
-            /// </summary>
-            public string errorMessageBase;
-            /// <summary>
-            /// 缃戝叧淇℃伅閿欒鍙嶉
-            /// <para>褰撶綉鍏虫帴鏀跺埌瀹㈡埛绔俊鎭悗锛屽嚭鐜颁互涓嬪紓甯告儏鍐靛皢鍙嶉閿欒銆�</para>
-            /// </summary>
-            public ErrorResponData errorResponData;
-            /// <summary>
-            /// 淇濆瓨zigbee鍗忚皟鍣ㄧ粍缃戜俊鎭�
-            /// </summary>
-            public StartDeviceUpdateData startUpdateDeviceData;
-        }
-        /// <summary>
-        /// 鍚姩鍗囩骇
-        /// </summary>
-        public StartDeviceUpdateData startUpdateDeviceData;
-        [System.Serializable]
-        public class StartDeviceUpdateData
-        {
-            /// <summary>
-            /// 0锛氭甯�
-            /// <para>1锛氬惎鍔ㄥけ璐ワ紝鏈瀹氬崌绾у浐浠�</para>
-            /// </summary>
-            public int Result = 999;
-
-            /// <summary>
-            ///鍗囩骇璁惧鍒楄〃
-            /// </summary>
-            public List<OTAStartUpdateList> DeviceList = new List<OTAStartUpdateList>();
-        }
-
-        /// <summary>
-        /// 杈撳叆绨�
-        /// </summary>
-        [System.Serializable]
-        public class OTAStartUpdateList
-        {
-            /// <summary>
-            /// MAC鍦板潃
-            /// </summary>
-            public string MacAddr;
-
-            /// <summary>
-            /// 璁惧绔彛鍙凤紝褰撳崌绾ц澶囷紝HDL鐨勮澶囧ぇ澶氭暟鐨勭鐐归粯璁ゆ槸200
-            /// </summary>
-            public int Epoint = 200;
-
-            /// <summary>
-            /// 璁惧鍚嶇О
-            /// </summary>
-            public string DeviceName;
-        }
-
-        /// <summary>
-        /// 鍚姩鍗囩骇
-        /// </summary>
-        public OTAScheduleResponData oTAScheduleResponData;
-        [System.Serializable]
-        public class OTAScheduleResponData
-        {
-            /// <summary>
-            /// 0锛氳妭鐐硅澶囧彲杩涜OTA鍗囩骇锛堝鏋滆澶囧湪绾匡紝涓旀敮鎸丱TA鍗囩骇锛屽垯璁惧棣栧厛浼氬弽棣堣鐘舵�侊紝璇存槑璇ヨ澶嘜TA鍗囩骇宸插惎鍔級
-            ///<para>1锛氭鍦ㄥ崌绾э紙璁惧澶勪簬涓嬭浇OTA鍗囩骇鍥轰欢鐘舵�佸皢鍙嶉璇ョ姸</para>
-            ///<para>2锛氬崌绾у畬鎴愶紙OTA鍗囩骇瀹屾垚锛岃妭鐐硅澶囧弽棣堣鐘舵�侊級</para>
-            ///<para>3锛氬崌绾уけ璐ワ紝鍝嶅簲瓒呮椂</para>
-            ///<para>150锛氭棤鏁堢殑OTA鍗囩骇鍥轰欢锛堜笅杞藉畬鎴愬悗锛岀敱鑺傜偣璁惧鍒ゆ柇鍥轰欢鏄惁鏈夋晥锛�</para>
-            ///<para>153锛氬鎴风浠嶉渶鏇村鐨凮TA鍗囩骇鍥轰欢</para>
-            ///<para>149锛氬崌绾х粓姝�</para>
-            /// </summary>
-            public int Status = 999;
-
-            /// <summary>
-            /// 鍗囩骇鐧惧垎姣斻��(褰揝tatus=1鏃舵湁鏁�)
-            /// </summary>
-            public int Percent = 999;
-        }
-
-        /// <summary>
-        ///  鍚姩鍗囩骇鐨勬暟鎹�
-        /// </summary>
-        public StartUpdateData startUpdateData;
-        [System.Serializable]
-        public class StartUpdateData
-        {
-            /// <summary>
-            ///鍗囩骇璁惧鍒楄〃
-            /// </summary>
-            public List<OTADeviceList> DeviceList = new List<OTADeviceList>();
-        }
-
-        #endregion
-
-        #region 鍚敤鎴栧叧闂妭鐐硅澶囬�忎紶鏁版嵁涓婁紶鎺ュ彛
-        /// <summary>
-        /// 鑺傜偣璁惧閫忎紶鏁版嵁鍒板鎴风
-        /// <para>缃戝叧绋嬪簭榛樿鏄叧闂�忎紶鏁版嵁涓婁紶鐨勶紝鍙互閫氳繃浠ヤ笅鎸囦护寮�鍚�忎紶鏁版嵁涓婁紶銆傞�忎紶鏁版嵁涓婁紶寮�鍚悗锛岄噸鍚綉鍏崇▼搴忛�忎紶鏁版嵁涓婁紶灏嗚繕鍘熸垚鍏抽棴鐘舵��</para>
-        /// <para>isOn 0锛氬叧闂�忎紶鏁版嵁涓婁紶</para>
-        /// <para>isOn 1锛氬紑鍚�忎紶鏁版嵁涓婁紶</para>
-        /// </summary>
-        //public void OpenPassthroughControl(ZigBee.Device.ZbGateway gateway, int isOn = 1)
-        //{
-        //    if (Gateway == null)
-        //    {
-        //        return;
-        //    }
-        //    Action<string, string> action = (topic, message) => { };
-        //    Gateway.Actions += action;
-        //    System.Console.WriteLine("OnZbDataPassthrough_Actions 鍚姩" + "_" + System.DateTime.Now.ToString());
-
-        //    try
-        //    {
-        //        var jObject = new JObject { { "Cluster_ID", 64513 }, { "Command", 1 } };
-        //        var data = new JObject { { "IsOn", isOn } };
-        //        jObject.Add("Data", data);
-        //        gateway.Send(("OnZbDataPassthrough"), jObject.ToString());
-        //    }
-        //    catch { }
-
-        //    Gateway.Actions -= action;
-        //    System.Console.WriteLine("OnZbDataPassthrough_Actions 閫�鍑�" + System.DateTime.Now.ToString());
-        //}
-        #endregion
-
-        #region 瀹㈡埛绔悜鑺傜偣璁惧閫忎紶鏁版嵁.
-        /// <summary>
-        /// 瀹㈡埛绔悜鑺傜偣璁惧閫忎紶鏁版嵁
-        /// <para>passData:閫忎紶鏁版嵁(杩欓噷鐨勫�兼槸鍦ㄥ悇涓澶囧璞′腑澶嶅埗濂界殑锛屼紶杩涙潵鍗冲彲锛�</para>
-        /// <para>閫忎紶鏁版嵁杩斿洖鍚庯紝鍙互璋冪敤鍚勪釜璁惧瀵硅薄涓幏鍙栫浉搴旂殑澶勭悊瀹屾垚鐨勬暟鎹�</para>
-        /// </summary>
-        public async System.Threading.Tasks.Task<ClientDataPassthroughResponseAllData> ClientDataPassthroughAsync(ZigBee.Device.ZbGateway gateway, string passData)
-        {
-            return await System.Threading.Tasks.Task.Run(async () =>
-            {
-                ClientDataPassthroughResponseAllData 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 ClientDataPassthroughResponseAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
-                        }
-
-                        else
-                        {
-                            d = new ClientDataPassthroughResponseAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
-                        }
-                    }
-
-                    if (topic == gatewayID + "/" + "ZbDataPassthrough")
-                    {
-                        var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID") };
-                        gatewayTemp.clientDataPassthroughResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<ClientDataPassthroughResponseData>(jobject["Data"].ToString());
-
-                        if (gatewayTemp.clientDataPassthroughResponseData == null)
-                        {
-                            d = new ClientDataPassthroughResponseAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
-                        }
-                        else
-                        {
-                            d = new ClientDataPassthroughResponseAllData { clientDataPassthroughResponseData = gatewayTemp.clientDataPassthroughResponseData };
-                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
-                        }
-                    }
-                };
-                gateway.Actions += action;
-                System.Console.WriteLine("ClientDataPassthrough_Actions 鍚姩" + "_" + System.DateTime.Now.ToString());
-
-                try
-                {
-                    var jObject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", 200 }, { "Cluster_ID", 64513 }, { "Command", 0 } };
-                    var data = new JObject { { "PassData", passData } };
-                    jObject.Add("Data", data);
-                    gateway.Send("ClientDataPassthrough", 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 ClientDataPassthroughResponseAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
-                }
-                gateway.Actions -= action;
-                System.Console.WriteLine("ClientDataPassthrough_Actions 閫�鍑�" + System.DateTime.Now.ToString());
-
-                return d;
-            });
-        }
-
-        /// <summary>
-        /// 瀹㈡埛绔悜鑺傜偣璁惧閫忎紶鏁版嵁,缃戝叧鍙嶉鍏蜂綋淇℃伅
-        /// </summary>
-        public ClientDataPassthroughResponseAllData clientDataPassthroughResponseAllData;
-        /// <summary>
-        /// 瀹㈡埛绔悜鑺傜偣璁惧閫忎紶鏁版嵁,缃戝叧鍙嶉鍏蜂綋淇℃伅
-        /// </summary>
-        [System.Serializable]
-        public class ClientDataPassthroughResponseAllData
-        {
-            /// <summary>
-            /// 閿欒淇℃伅
-            /// </summary>
-            public string errorMessageBase;
-            /// <summary>
-            /// 缃戝叧淇℃伅閿欒鍙嶉
-            /// <para>褰撶綉鍏虫帴鏀跺埌瀹㈡埛绔俊鎭悗锛屽嚭鐜颁互涓嬪紓甯告儏鍐靛皢鍙嶉閿欒銆�</para>
-            /// </summary>
-            public ErrorResponData errorResponData;
-            /// <summary>
-            /// 瀹㈡埛绔悜鑺傜偣璁惧閫忎紶鏁版嵁
-            /// </summary>
-            public ClientDataPassthroughResponseData clientDataPassthroughResponseData;
-        }
-        /// <summary>
-        /// 瀹㈡埛绔悜鑺傜偣璁惧閫忎紶鏁版嵁
-        /// </summary>
-        public ClientDataPassthroughResponseData clientDataPassthroughResponseData = new ClientDataPassthroughResponseData { };
-        [System.Serializable]
-        public class ClientDataPassthroughResponseData
-        {
-            /// <summary>
-            /// 閫忎紶鐨勬暟鎹紝鏈�澶�256涓瓧绗︼紝涔熷氨鏄�忎紶128涓瓧鑺�
-            /// </summary>
-            public string PassData;
-        }
-
-        /// <summary>
-        /// 鍚敤鎴栧叧闂妭鐐硅澶囬�忎紶鏁版嵁涓婁紶鎺ュ彛,缃戝叧鍙嶉鍏蜂綋淇℃伅
-        /// </summary>
-        public OnZbDataPassthroughResponseAllData onZbDataPassthroughResponseAllData;
-        /// <summary>
-        /// 鍚敤鎴栧叧闂妭鐐硅澶囬�忎紶鏁版嵁涓婁紶鎺ュ彛,缃戝叧鍙嶉鍏蜂綋淇℃伅
-        /// </summary>
-        [System.Serializable]
-        public class OnZbDataPassthroughResponseAllData
-        {
-            /// <summary>
-            /// 閿欒淇℃伅
-            /// </summary>
-            public string errorMessageBase;
-            /// <summary>
-            /// 缃戝叧淇℃伅閿欒鍙嶉
-            /// <para>褰撶綉鍏虫帴鏀跺埌瀹㈡埛绔俊鎭悗锛屽嚭鐜颁互涓嬪紓甯告儏鍐靛皢鍙嶉閿欒銆�</para>
-            /// </summary>
-            public ErrorResponData errorResponData;
-            /// <summary>
-            /// 鍚敤鎴栧叧闂妭鐐硅澶囬�忎紶鏁版嵁涓婁紶鎺ュ彛
-            /// </summary>
-            public OnZbDataPassthroughData onZbDataPassthroughData;
-        }
-        /// <summary>
-        /// 鍚敤鎴栧叧闂妭鐐硅澶囬�忎紶鏁版嵁涓婁紶鎺ュ彛
-        /// </summary>
-        public OnZbDataPassthroughData onZbDataPassthroughData;
-        [System.Serializable]
-        public class OnZbDataPassthroughData
-        {
-            /// <summary>
-            /// 宸茬粡杞崲鎴愬瓧绗︽牸寮忕殑16杩涘埗鐨勯�忎紶鏁版嵁
-            /// </summary>
-            public string PassData;
-        }
-        #endregion
-
-        #region 涓嬭浇浜戠鍥轰欢.
-        /// <summary>
-        /// 涓嬭浇浜戠璁惧鍥轰欢
-        /// </summary>
-        /// <returns>The file async.</returns>
-        /// <param name="gateway">Gateway:褰撳墠缃戝叧</param>
-        /// <param name="distributedMark">Distributed mark:鍥轰欢鍞竴鏍囪瘑</param>
-        /// <param name="imageName">Image name:鍥轰欢鐗堟湰</param>
-        public async System.Threading.Tasks.Task<DownloadFileResponAllData> DownloadFileAsync(ZigBee.Device.ZbGateway gateway, string distributedMark, string imageName)
-        {
-            if (gateway == null)
-            {
-                return null;
+                      };
+              deviceList.Add(dInfo);
             }
-            return await System.Threading.Tasks.Task.Run(async () =>
+            var data = new JObject { { "DeviceList", deviceList } };
+            jObject.Add("Data", data);
+            gateway.Send(("OTA/StartUpdate"), jObject.ToString());
+          }
+        }
+        catch
+        { }
+        var dateTime = DateTime.Now;
+        while ((DateTime.Now - dateTime).TotalMilliseconds < 30 * 1000)
+        {
+          await System.Threading.Tasks.Task.Delay(10);
+          if (d != null)
+          {
+            break;
+          }
+        }
+        if ((DateTime.Now - dateTime).TotalMilliseconds > 30 * 1000)
+        {
+          d = new StartDeviceUpdateResponseAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
+
+        }
+        gateway.Actions -= action;
+        System.Console.WriteLine("OTA/StartUpdate_Actions 閫�鍑�" + System.DateTime.Now.ToString());
+
+        return d;
+      });
+    }
+
+    /// <summary>
+    /// 鍚姩鍗囩骇,缃戝叧鍙嶉鍏蜂綋淇℃伅
+    /// </summary>
+    [System.Serializable]
+    public class StartDeviceUpdateResponseAllData
+    {
+      /// <summary>
+      /// 閿欒淇℃伅
+      /// </summary>
+      public string errorMessageBase;
+      /// <summary>
+      /// 缃戝叧淇℃伅閿欒鍙嶉
+      /// <para>褰撶綉鍏虫帴鏀跺埌瀹㈡埛绔俊鎭悗锛屽嚭鐜颁互涓嬪紓甯告儏鍐靛皢鍙嶉閿欒銆�</para>
+      /// </summary>
+      public ErrorResponData errorResponData;
+      /// <summary>
+      /// 淇濆瓨zigbee鍗忚皟鍣ㄧ粍缃戜俊鎭�
+      /// </summary>
+      public StartDeviceUpdateData startUpdateDeviceData;
+    }
+
+    [System.Serializable]
+    public class StartDeviceUpdateData
+    {
+      /// <summary>
+      /// 0锛氭甯�
+      /// <para>1锛氬惎鍔ㄥけ璐ワ紝鏈瀹氬崌绾у浐浠�</para>
+      /// </summary>
+      public int Result = 999;
+
+      /// <summary>
+      ///鍗囩骇璁惧鍒楄〃
+      /// </summary>
+      public List<OTAStartUpdateList> DeviceList = new List<OTAStartUpdateList>();
+    }
+
+    /// <summary>
+    /// 杈撳叆绨�
+    /// </summary>
+    [System.Serializable]
+    public class OTAStartUpdateList
+    {
+      /// <summary>
+      /// MAC鍦板潃
+      /// </summary>
+      public string MacAddr;
+
+      /// <summary>
+      /// 璁惧绔彛鍙凤紝褰撳崌绾ц澶囷紝HDL鐨勮澶囧ぇ澶氭暟鐨勭鐐归粯璁ゆ槸200
+      /// </summary>
+      public int Epoint = 200;
+
+      /// <summary>
+      /// 璁惧鍚嶇О
+      /// </summary>
+      public string DeviceName;
+    }
+
+    /// <summary>
+    /// 鍚姩鍗囩骇
+    /// </summary>
+    [Newtonsoft.Json.JsonIgnore]
+    public OTAScheduleResponData oTAScheduleResponData;
+
+    [System.Serializable]
+    public class OTAScheduleResponData
+    {
+      /// <summary>
+      /// 0锛氳妭鐐硅澶囧彲杩涜OTA鍗囩骇锛堝鏋滆澶囧湪绾匡紝涓旀敮鎸丱TA鍗囩骇锛屽垯璁惧棣栧厛浼氬弽棣堣鐘舵�侊紝璇存槑璇ヨ澶嘜TA鍗囩骇宸插惎鍔級
+      ///<para>1锛氭鍦ㄥ崌绾э紙璁惧澶勪簬涓嬭浇OTA鍗囩骇鍥轰欢鐘舵�佸皢鍙嶉璇ョ姸</para>
+      ///<para>2锛氬崌绾у畬鎴愶紙OTA鍗囩骇瀹屾垚锛岃妭鐐硅澶囧弽棣堣鐘舵�侊級</para>
+      ///<para>3锛氬崌绾уけ璐ワ紝鍝嶅簲瓒呮椂</para>
+      ///<para>150锛氭棤鏁堢殑OTA鍗囩骇鍥轰欢锛堜笅杞藉畬鎴愬悗锛岀敱鑺傜偣璁惧鍒ゆ柇鍥轰欢鏄惁鏈夋晥锛�</para>
+      ///<para>153锛氬鎴风浠嶉渶鏇村鐨凮TA鍗囩骇鍥轰欢</para>
+      ///<para>149锛氬崌绾х粓姝�</para>
+      /// </summary>
+      public int Status = 999;
+
+      /// <summary>
+      /// 鍗囩骇鐧惧垎姣斻��(褰揝tatus=1鏃舵湁鏁�)
+      /// </summary>
+      public int Percent = 999;
+    }
+
+    [System.Serializable]
+    public class StartUpdateData
+    {
+      /// <summary>
+      ///鍗囩骇璁惧鍒楄〃
+      /// </summary>
+      public List<OTADeviceList> DeviceList = new List<OTADeviceList>();
+    }
+
+    #endregion
+
+    #region 瀹㈡埛绔悜鑺傜偣璁惧閫忎紶鏁版嵁.
+    /// <summary>
+    /// 瀹㈡埛绔悜鑺傜偣璁惧閫忎紶鏁版嵁
+    /// <para>passData:閫忎紶鏁版嵁(杩欓噷鐨勫�兼槸鍦ㄥ悇涓澶囧璞′腑澶嶅埗濂界殑锛屼紶杩涙潵鍗冲彲锛�</para>
+    /// <para>閫忎紶鏁版嵁杩斿洖鍚庯紝鍙互璋冪敤鍚勪釜璁惧瀵硅薄涓幏鍙栫浉搴旂殑澶勭悊瀹屾垚鐨勬暟鎹�</para>
+    /// </summary>
+    public async System.Threading.Tasks.Task<ClientDataPassthroughResponseAllData> ClientDataPassthroughAsync(ZigBee.Device.ZbGateway gateway, string passData)
+    {
+      return await System.Threading.Tasks.Task.Run(async () =>
+      {
+        ClientDataPassthroughResponseAllData 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")
             {
-                DownloadFileResponAllData d = null; ;
-                Action<string, string> action = (topic, message) =>
-                {
-                    var gatewayID = topic.Split('/')[0];
-                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+              var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
 
-                    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 ClientDataPassthroughResponseAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+              }
 
-                        if (temp == null)
-                        {
-                            d = new DownloadFileResponAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
-                        }
-                        else
-                        {
-                            d = new DownloadFileResponAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
-                        }
-                    }
+              else
+              {
+                d = new ClientDataPassthroughResponseAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
+              }
+            }
 
-                    if (topic == gatewayID + "/" + "DownloadFile_Respon")
-                    {
-                        var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID") };
-                        gatewayTemp.downloadFileResponData = Newtonsoft.Json.JsonConvert.DeserializeObject<DownloadFileResponData>(jobject["Data"].ToString());
+            if (topic == gatewayID + "/" + "ZbDataPassthrough")
+            {
+              var clientDataPassthroughResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<ClientDataPassthroughResponseData>(jobject["Data"].ToString());
 
-                        if (gatewayTemp.downloadFileResponData == null)
-                        {
-                            d = new DownloadFileResponAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
-                        }
-                        else
-                        {
-                            d = new DownloadFileResponAllData { downloadFileResponData = gatewayTemp.downloadFileResponData };
-                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
-                        }
-                    }
-                };
-                gateway.Actions += action;
-                try
-                {
-                    var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 6000 } };
-                    var data = new JObject {
+              if (clientDataPassthroughResponseData == null)
+              {
+                d = new ClientDataPassthroughResponseAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
+              }
+              else
+              {
+                d = new ClientDataPassthroughResponseAllData { clientDataPassthroughResponseData = clientDataPassthroughResponseData };
+                System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
+              }
+            }
+          };
+        gateway.Actions += action;
+        System.Console.WriteLine("ClientDataPassthrough_Actions 鍚姩" + "_" + System.DateTime.Now.ToString());
+
+        try
+        {
+          var jObject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", 200 }, { "Cluster_ID", 64513 }, { "Command", 0 } };
+          var data = new JObject { { "PassData", passData } };
+          jObject.Add("Data", data);
+          gateway.Send("ClientDataPassthrough", 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 ClientDataPassthroughResponseAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
+        }
+        gateway.Actions -= action;
+        System.Console.WriteLine("ClientDataPassthrough_Actions 閫�鍑�" + System.DateTime.Now.ToString());
+
+        return d;
+      });
+    }
+
+    /// <summary>
+    /// 瀹㈡埛绔悜鑺傜偣璁惧閫忎紶鏁版嵁,缃戝叧鍙嶉鍏蜂綋淇℃伅
+    /// </summary>
+    [System.Serializable]
+    public class ClientDataPassthroughResponseAllData : ErrorResponCommon
+    {
+      /// <summary>
+      /// 瀹㈡埛绔悜鑺傜偣璁惧閫忎紶鏁版嵁
+      /// </summary>
+      public ClientDataPassthroughResponseData clientDataPassthroughResponseData;
+    }
+    /// <summary>
+    /// 瀹㈡埛绔悜鑺傜偣璁惧閫忎紶鏁版嵁
+    /// </summary>
+    [Newtonsoft.Json.JsonIgnore]
+    public ClientDataPassthroughResponseData clientDataPassthroughResponseData = new ClientDataPassthroughResponseData();
+
+    [System.Serializable]
+    public class ClientDataPassthroughResponseData
+    {
+      /// <summary>
+      /// 閫忎紶鐨勬暟鎹紝鏈�澶�256涓瓧绗︼紝涔熷氨鏄�忎紶128涓瓧鑺�
+      /// </summary>
+      public string PassData;
+    }
+
+    /// <summary>
+    /// 鍚敤鎴栧叧闂妭鐐硅澶囬�忎紶鏁版嵁涓婁紶鎺ュ彛,缃戝叧鍙嶉鍏蜂綋淇℃伅
+    /// </summary>
+    [System.Serializable]
+    public class OnZbDataPassthroughResponseAllData : ErrorResponCommon
+    {
+      /// <summary>
+      /// 鍚敤鎴栧叧闂妭鐐硅澶囬�忎紶鏁版嵁涓婁紶鎺ュ彛
+      /// </summary>
+      public OnZbDataPassthroughData onZbDataPassthroughData;
+    }
+
+    [System.Serializable]
+    public class OnZbDataPassthroughData
+    {
+      /// <summary>
+      /// 宸茬粡杞崲鎴愬瓧绗︽牸寮忕殑16杩涘埗鐨勯�忎紶鏁版嵁
+      /// </summary>
+      public string PassData;
+    }
+    #endregion
+
+    #region 涓嬭浇浜戠鍥轰欢.
+    /// <summary>
+    /// 涓嬭浇浜戠璁惧鍥轰欢
+    /// </summary>
+    /// <returns>The file async.</returns>
+    /// <param name="gateway">Gateway:褰撳墠缃戝叧</param>
+    /// <param name="distributedMark">Distributed mark:鍥轰欢鍞竴鏍囪瘑</param>
+    /// <param name="imageName">Image name:鍥轰欢鐗堟湰</param>
+    public async System.Threading.Tasks.Task<DownloadFileResponAllData> DownloadFileAsync(ZigBee.Device.ZbGateway gateway, string distributedMark, string imageName)
+    {
+      if (gateway == null)
+      {
+        return null;
+      }
+      return await System.Threading.Tasks.Task.Run(async () =>
+      {
+        DownloadFileResponAllData 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 temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+              if (temp == null)
+              {
+                d = new DownloadFileResponAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+              }
+              else
+              {
+                d = new DownloadFileResponAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
+              }
+            }
+
+            if (topic == gatewayID + "/" + "DownloadFile_Respon")
+            {
+              var downloadFileResponData = Newtonsoft.Json.JsonConvert.DeserializeObject<DownloadFileResponData>(jobject["Data"].ToString());
+
+              if (downloadFileResponData == null)
+              {
+                d = new DownloadFileResponAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
+              }
+              else
+              {
+                d = new DownloadFileResponAllData { downloadFileResponData = downloadFileResponData };
+                System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
+              }
+            }
+          };
+        gateway.Actions += action;
+        try
+        {
+          var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 6000 } };
+          var data = new JObject {
                         { "DistributeMark", distributedMark},
                         { "DownloadPath", "/tmp" },
                         { "FileName", imageName }
-                     };
-                    jObject.Add("Data", data);
-                    gateway.Send("DownloadFile", jObject.ToString());
-                }
-                catch
-                {
-                }
-                var dateTime = DateTime.Now;
-                while ((DateTime.Now - dateTime).TotalMilliseconds < 30 * 1000)
-                {
-                    await System.Threading.Tasks.Task.Delay(10);
-                    if (d != null)
-                    {
-                        break;
-                    }
-                }
-                if ((DateTime.Now - dateTime).TotalMilliseconds > 30 * 1000)
-                {
-                    d = new DownloadFileResponAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
-
-                }
-                gateway.Actions -= action;
-                System.Console.WriteLine("DownloadFile_Actions 閫�鍑�" + System.DateTime.Now.ToString());
-
-                return d;
-            });
-
+               };
+          jObject.Add("Data", data);
+          gateway.Send("DownloadFile", jObject.ToString());
         }
-        /// <summary>
-        /// 缃戝叧绯荤粺鍗囩骇,缃戝叧鍙嶉鍏蜂綋淇℃伅
-        /// </summary>
-        public DownloadFileResponAllData downloadFileResponAllData;
-        /// <summary>
-        /// 缃戝叧绯荤粺鍗囩骇,缃戝叧鍙嶉鍏蜂綋淇℃伅
-        /// </summary>
-        [System.Serializable]
-        public class DownloadFileResponAllData
+        catch
         {
-            /// <summary>
-            /// 閿欒淇℃伅
-            /// </summary>
-            public string errorMessageBase;
-            /// <summary>
-            /// 缃戝叧淇℃伅閿欒鍙嶉
-            /// <para>褰撶綉鍏虫帴鏀跺埌瀹㈡埛绔俊鎭悗锛屽嚭鐜颁互涓嬪紓甯告儏鍐靛皢鍙嶉閿欒銆�</para>
-            /// </summary>
-            public ErrorResponData errorResponData;
-            /// <summary>
-            /// 涓嬭浇浜戠鍥轰欢
-            /// </summary>
-            public DownloadFileResponData downloadFileResponData;
         }
-
-        /// <summary>
-        /// 涓嬭浇浜戠鍥轰欢
-        /// </summary>
-        public DownloadFileResponData downloadFileResponData;
-        /// <summary>
-        /// 涓嬭浇浜戠鍥轰欢
-        /// </summary>
-        [System.Serializable]
-        public class DownloadFileResponData
+        var dateTime = DateTime.Now;
+        while ((DateTime.Now - dateTime).TotalMilliseconds < 30 * 1000)
         {
-            /// <summary>
-            /// 涓嬭浇鍥轰欢鐨勫敮涓�鏍囪瘑
-            /// </summary>
-            public string DistributeMark;
-            /// <summary>
-            /// 0锛氭垚鍔燂紝寮�鍚惎鍔ㄤ笅杞姐��
-            ///<para>1锛氬け璐ワ紝鏂囦欢鍒涘缓澶辫触銆�</para>
-            ///<para>2锛氬け璐ワ紝浜戠娌℃湁鎵惧埌璇ユ爣璇嗘枃浠躲��</para>
-            ///<para>3锛氱綉鍏虫湭鑳借繛鎺ヤ簯绔��</para>
-            ///<para>4锛氬叾浠栭敊璇��</para>
-            /// </summary>
-            public int Result;
+          await System.Threading.Tasks.Task.Delay(10);
+          if (d != null)
+          {
+            break;
+          }
         }
-
-        /// <summary>
-        /// 涓嬭浇杩涘害
-        /// </summary>
-        public DownloadFileProgressResponData downloadFileProgressResponData;
-        /// <summary>
-        /// 涓嬭浇杩涘害
-        /// </summary>
-        [System.Serializable]
-        public class DownloadFileProgressResponData
+        if ((DateTime.Now - dateTime).TotalMilliseconds > 30 * 1000)
         {
-            /// <summary>
-            /// 涓嬭浇鍥轰欢鐨勫敮涓�鏍囪瘑
-            /// </summary>
-            public string DistributeMark;
-            /// <summary>
-            ///<para>0锛氫笅杞芥垚鍔�</para>
-            ///<para>1锛氭鍦ㄤ笅杞�</para>
-            ///<para>2锛氫笅杞藉け璐�</para>
-            /// </summary>
-            public int Status;
-            /// <summary>
-            ///鏂囦欢鎬诲ぇ灏�
-            /// </summary>
-            public int TotalSize;
-            /// <summary>
-            ///褰撳墠宸茬粡涓嬭浇鏂囦欢澶у皬
-            /// </summary>
-            public int DownloadSize;
-            /// <summary>
-            ///涓嬭浇杩涘害锛岀櫨鍒嗘瘮銆傛瘡鐧惧垎涔嬪崄鍙嶉涓�娆�
-            /// </summary>
-            public int DownloadPercent;
+          d = new DownloadFileResponAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
+
         }
+        gateway.Actions -= action;
+        System.Console.WriteLine("DownloadFile_Actions 閫�鍑�" + System.DateTime.Now.ToString());
 
-        #endregion
+        return d;
+      });
 
-        #region 缁堟璁惧鍗囩骇;
-        /// <summary>
-        /// 缁堟璁惧鍗囩骇
-        /// </summary>
-        /// <returns>The NVA sync.</returns>
-        /// <param name="gateway">Gateway.</param>
-        /// <param name="oTAImageName">O TAI mage name:鍗囩骇闀滃儚鍚嶇О</param>
-        public async System.Threading.Tasks.Task<KillUpdateResponseAllData> KillUpdateAsync(ZigBee.Device.ZbGateway gateway, int deviceEpoint = 200)
-        {
-            return await System.Threading.Tasks.Task.Run(async () =>
-            {
-                KillUpdateResponseAllData 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 KillUpdateResponseAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
-                        }
-
-                        else
-                        {
-                            d = new KillUpdateResponseAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
-                        }
-                    }
-
-                    if (topic == gatewayID + "/" + "OTA/KillUpdate_Respon")
-                    {
-                        var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID") };
-                        gatewayTemp.killUpdateData = Newtonsoft.Json.JsonConvert.DeserializeObject<KillUpdateData>(jobject["Data"].ToString());
-
-                        if (gatewayTemp.killUpdateData == null)
-                        {
-                            d = new KillUpdateResponseAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
-                        }
-                        else
-                        {
-                            d = new KillUpdateResponseAllData { killUpdateData = gatewayTemp.killUpdateData };
-                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
-                        }
-                    }
-                };
-                gateway.Actions += action;
-                System.Console.WriteLine("OTA/KillUpdate_Actions 鍚姩" + "_" + System.DateTime.Now.ToString());
-
-                try
-                {
-                    var jObject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", deviceEpoint }, { "Cluster_ID", 25 }, { "Command", 5 } };
-                    gateway.Send("OTA/KillUpdate", 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 KillUpdateResponseAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
-                }
-                gateway.Actions -= action;
-                System.Console.WriteLine("OTA/KillUpdate_Actions 閫�鍑�" + System.DateTime.Now.ToString());
-
-                return d;
-            });
-        }
-
-        /// <summary>
-        /// 缁堟璁惧鍗囩骇,缃戝叧鍙嶉鍏蜂綋淇℃伅
-        /// </summary>
-        public KillUpdateResponseAllData killUpdateResponseAllData;
-        /// <summary>
-        /// 缁堟璁惧鍗囩骇,缃戝叧鍙嶉鍏蜂綋淇℃伅
-        /// </summary>
-        [System.Serializable]
-        public class KillUpdateResponseAllData
-        {
-            /// <summary>
-            /// 閿欒淇℃伅
-            /// </summary>
-            public string errorMessageBase;
-            /// <summary>
-            /// 缃戝叧淇℃伅閿欒鍙嶉
-            /// <para>褰撶綉鍏虫帴鏀跺埌瀹㈡埛绔俊鎭悗锛屽嚭鐜颁互涓嬪紓甯告儏鍐靛皢鍙嶉閿欒銆�</para>
-            /// </summary>
-            public ErrorResponData errorResponData;
-            /// <summary>
-            /// 缁堟璁惧鍗囩骇
-            /// </summary>
-            public KillUpdateData killUpdateData;
-        }
-        /// <summary>
-        /// 缁堟璁惧鍗囩骇
-        /// </summary>
-        public KillUpdateData killUpdateData;
-        [System.Serializable]
-        public class KillUpdateData
-        {
-            /// <summary>
-            ///0锛氱粓姝㈡垚鍔�
-            ///<para>1锛氱粓姝㈠け璐ワ紝璁惧骞朵笉澶勪簬OTA鍗囩骇鐘舵�併��</para>
-            /// </summary>
-            public int Result;
-        }
-        #endregion
-
-        #region 绉佹湁鍗忚缃戝叧鍜岃澶囩殑榛樿鍥炲
-        /// <summary>
-        /// 绉佹湁鍗忚缃戝叧鍜岃澶囩殑榛樿鍥炲
-        /// </summary>
-        public ResponseAllData keyColorDataResponseAllData;
-        [System.Serializable]
-        public class ResponseAllData
-        {
-            /// <summary>
-            /// 閿欒淇℃伅
-            /// </summary>
-            public string errorMessageBase;
-            /// <summary>
-            /// 缃戝叧淇℃伅閿欒鍙嶉
-            /// <para>褰撶綉鍏虫帴鏀跺埌瀹㈡埛绔俊鎭悗锛屽嚭鐜颁互涓嬪紓甯告儏鍐靛皢鍙嶉閿欒銆�</para>
-            /// </summary>
-            public ErrorResponData errorResponData;
-            /// <summary>
-            /// 鎸夐敭鎸囩ず鐏鑹蹭俊鎭�
-            /// </summary>
-            public ResponseData responseData;
-        }
-
-        /// <summary>
-        /// 绉佹湁鍗忚缃戝叧鍜岃澶囩殑榛樿鍥炲
-        /// </summary>
-        [System.Serializable]
-        public class ResponseData
-        {
-            /// <summary>
-            ///鍝嶅簲鎿嶄綔鐮侊紙0-ffff锛�
-            /// </summary>
-            public int command = -1;
-            /// <summary>
-            /// 鐘舵�佸��
-            /// <para>0--鎴愬姛 1--澶辫触 ff--鏃犳晥</para>
-            /// </summary>
-            public int status = -1;
-        }
-        #endregion
     }
+
+    /// <summary>
+    /// 缃戝叧绯荤粺鍗囩骇,缃戝叧鍙嶉鍏蜂綋淇℃伅
+    /// </summary>
+    [System.Serializable]
+    public class DownloadFileResponAllData : ErrorResponCommon
+    {
+      /// <summary>
+      /// 涓嬭浇浜戠鍥轰欢
+      /// </summary>
+      public DownloadFileResponData downloadFileResponData;
+    }
+
+    /// <summary>
+    /// 涓嬭浇浜戠鍥轰欢
+    /// </summary>
+    [System.Serializable]
+    public class DownloadFileResponData
+    {
+      /// <summary>
+      /// 涓嬭浇鍥轰欢鐨勫敮涓�鏍囪瘑
+      /// </summary>
+      public string DistributeMark;
+      /// <summary>
+      /// 0锛氭垚鍔燂紝寮�鍚惎鍔ㄤ笅杞姐��
+      ///<para>1锛氬け璐ワ紝鏂囦欢鍒涘缓澶辫触銆�</para>
+      ///<para>2锛氬け璐ワ紝浜戠娌℃湁鎵惧埌璇ユ爣璇嗘枃浠躲��</para>
+      ///<para>3锛氱綉鍏虫湭鑳借繛鎺ヤ簯绔��</para>
+      ///<para>4锛氬叾浠栭敊璇��</para>
+      /// </summary>
+      public int Result;
+    }
+
+    /// <summary>
+    /// 涓嬭浇杩涘害
+    /// </summary>
+    [Newtonsoft.Json.JsonIgnore]
+    public DownloadFileProgressResponData downloadFileProgressResponData;
+    /// <summary>
+    /// 涓嬭浇杩涘害
+    /// </summary>
+    [System.Serializable]
+    public class DownloadFileProgressResponData
+    {
+      /// <summary>
+      /// 涓嬭浇鍥轰欢鐨勫敮涓�鏍囪瘑
+      /// </summary>
+      public string DistributeMark;
+      /// <summary>
+      ///<para>0锛氫笅杞芥垚鍔�</para>
+      ///<para>1锛氭鍦ㄤ笅杞�</para>
+      ///<para>2锛氫笅杞藉け璐�</para>
+      /// </summary>
+      public int Status;
+      /// <summary>
+      ///鏂囦欢鎬诲ぇ灏�
+      /// </summary>
+      public int TotalSize;
+      /// <summary>
+      ///褰撳墠宸茬粡涓嬭浇鏂囦欢澶у皬
+      /// </summary>
+      public int DownloadSize;
+      /// <summary>
+      ///涓嬭浇杩涘害锛岀櫨鍒嗘瘮銆傛瘡鐧惧垎涔嬪崄鍙嶉涓�娆�
+      /// </summary>
+      public int DownloadPercent;
+    }
+
+    #endregion
+
+    #region 缁堟璁惧鍗囩骇;
+    /// <summary>
+    /// 缁堟璁惧鍗囩骇
+    /// </summary>
+    /// <returns>The NVA sync.</returns>
+    /// <param name="gateway">Gateway.</param>
+    /// <param name="oTAImageName">O TAI mage name:鍗囩骇闀滃儚鍚嶇О</param>
+    public async System.Threading.Tasks.Task<KillUpdateResponseAllData> KillUpdateAsync(ZigBee.Device.ZbGateway gateway, int deviceEpoint = 200)
+    {
+      return await System.Threading.Tasks.Task.Run(async () =>
+      {
+        KillUpdateResponseAllData 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 temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+              if (temp == null)
+              {
+                d = new KillUpdateResponseAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+              }
+
+              else
+              {
+                d = new KillUpdateResponseAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
+              }
+            }
+
+            if (topic == gatewayID + "/" + "OTA/KillUpdate_Respon")
+            {
+              var killUpdateData = Newtonsoft.Json.JsonConvert.DeserializeObject<KillUpdateData>(jobject["Data"].ToString());
+
+              if (killUpdateData == null)
+              {
+                d = new KillUpdateResponseAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
+              }
+              else
+              {
+                d = new KillUpdateResponseAllData { killUpdateData = killUpdateData };
+                System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
+              }
+            }
+          };
+        gateway.Actions += action;
+        System.Console.WriteLine("OTA/KillUpdate_Actions 鍚姩" + "_" + System.DateTime.Now.ToString());
+
+        try
+        {
+          var jObject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", deviceEpoint }, { "Cluster_ID", 25 }, { "Command", 5 } };
+          gateway.Send("OTA/KillUpdate", 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 KillUpdateResponseAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
+        }
+        gateway.Actions -= action;
+        System.Console.WriteLine("OTA/KillUpdate_Actions 閫�鍑�" + System.DateTime.Now.ToString());
+
+        return d;
+      });
+    }
+
+    /// <summary>
+    /// 缁堟璁惧鍗囩骇,缃戝叧鍙嶉鍏蜂綋淇℃伅
+    /// </summary>
+    [System.Serializable]
+    public class KillUpdateResponseAllData : ErrorResponCommon
+    {
+      /// <summary>
+      /// 缁堟璁惧鍗囩骇
+      /// </summary>
+      public KillUpdateData killUpdateData;
+    }
+
+    [System.Serializable]
+    public class KillUpdateData
+    {
+      /// <summary>
+      ///0锛氱粓姝㈡垚鍔�
+      ///<para>1锛氱粓姝㈠け璐ワ紝璁惧骞朵笉澶勪簬OTA鍗囩骇鐘舵�併��</para>
+      /// </summary>
+      public int Result;
+    }
+    #endregion
+
+    #region 绉佹湁鍗忚缃戝叧鍜岃澶囩殑榛樿鍥炲
+
+    [System.Serializable]
+    public class ResponseAllData : ErrorResponCommon
+    {
+      /// <summary>
+      /// 鎸夐敭鎸囩ず鐏鑹蹭俊鎭�
+      /// </summary>
+      public ResponseData responseData;
+    }
+
+    /// <summary>
+    /// 绉佹湁鍗忚缃戝叧鍜岃澶囩殑榛樿鍥炲
+    /// </summary>
+    [System.Serializable]
+    public class ResponseData
+    {
+      /// <summary>
+      ///鍝嶅簲鎿嶄綔鐮侊紙0-ffff锛�
+      /// </summary>
+      public string command;
+      /// <summary>
+      /// 鐘舵�佸��
+      /// <para>0--鎴愬姛 1--澶辫触 ff--鏃犳晥</para>
+      /// </summary>
+      public int status = -1;
+    }
+    #endregion
+
+    #region 鈻� 璋冭瘯鎵撳嵃
+
+    /// <summary>
+    /// 璋冭瘯鏃舵墦寮�鎵撳嵃淇℃伅锛宼rue:鎵撳嵃锛宖alse:涓嶆墦鍗�
+    /// </summary>
+    /// <param name="msg">Message.</param>
+    /// <param name="flage">If set to <c>true</c> flage.</param>
+    public static void DebugPrintLog(string msg, bool flage = true)
+    {
+#if DEBUG
+      if (flage == true)
+      {
+        if (msg.Contains("DeviceStatusReport") == false)
+        {
+          System.Console.WriteLine(msg + "  " + System.DateTime.Now.ToLongTimeString() + " " + System.DateTime.Now.Millisecond);
+        }
+      }
+#endif
+    }
+
+    #endregion
+  }
 }

--
Gitblit v1.8.0