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/Common/SendDataToGateway.cs | 1184 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 1,184 insertions(+), 0 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Common/SendDataToGateway.cs b/ZigbeeApp/Shared/Phone/ZigBee/Common/SendDataToGateway.cs
new file mode 100755
index 0000000..a06e548
--- /dev/null
+++ b/ZigbeeApp/Shared/Phone/ZigBee/Common/SendDataToGateway.cs
@@ -0,0 +1,1184 @@
+锘縰sing System;
+using System.Text;
+using Newtonsoft.Json.Linq;
+using static ZigBee.Device.ZbGateway;
+
+namespace ZigBee.Common
+{
+    public class SendDataToGateway : ZigBee.Device.CommonDevice
+    {
+        //#region 缃戝叧淇℃伅
+        ///// <summary>
+        /////鑾峰彇缃戝叧鐗堟湰淇℃伅
+        ///// </summary>
+        //public static void GetZbGwVersion(ZigBee.Device.ZbGateway gateway)
+        //{
+        //    var jobject1 = new JObject { { "Cluster_ID", 0 }, { "Command", 92 } };
+        //    gateway.Send("GetZbGwVersion", Common.SecuritySet.Encryption(jobject1.ToString()));
+        //}
+
+        ///// <summary>
+        ///// 鑾峰彇鎵�鏈夌綉鍏崇殑鑺傜偣璁惧淇℃伅锛堢敤浜庝富缃戝叧锛�
+        ///// </summary>
+        //public static void GetAllDeviceInfo(ZigBee.Device.ZbGateway gateway)
+        //{
+        //    var jobject2 = new JObject { { "Cluster_ID", 0 }, { "Command", 90 } };
+        //    gateway.Send("GetAllDeviceInfo", Common.SecuritySet.Encryption(jobject2.ToString()));
+        //}
+
+        ///// <summary>
+        ///// 鑾峰彇缃戝叧淇℃伅
+        ///// </summary>
+        //public static void GetZbGwInfo(ZigBee.Device.ZbGateway gateway)
+        //{
+        //    var jobject2 = new JObject { { "Cluster_ID", 0 }, { "Command", 95 } };
+        //    gateway.Send("GetZbGwInfo", Common.SecuritySet.Encryption(jobject2.ToString()));
+        //}
+        //#endregion
+
+        //#region 璁惧淇℃伅
+        /////<summary >
+        ///// 鑾峰彇缃戝叧宸插叆缃戣澶囦俊鎭� 
+        ///// </summary>
+        //public static void GetDeviceInfo(ZigBee.Device.ZbGateway gateway)
+        //{
+        //    var jobject = new JObject();
+        //    jobject.Add("Cluster_ID", 0);
+        //    jobject.Add("Command", 93);
+        //    gateway.Send(("GetDeviceInfo"), Common.SecuritySet.Encryption((jobject.ToString())));
+        //}
+
+        /////<summary >
+        ///// 鎼滅储鏂拌澶囷紙鍏佽璁惧鍏ョ綉锛�
+        ///// Time:0-255,0:鍏抽棴鎼滅储,255:涓�鐩村紑鍚�
+        ///// </summary>
+        //public static void SearchNewDevice(ZigBee.Device.ZbGateway gateway)
+        //{
+        //    var jobject = new JObject { { "Cluster_ID", 0 }, { "Command", 94 } };
+        //    var data = new JObject { { "Time", 180 } };
+        //    jobject.Add("Data", data);
+        //    gateway.Send(("SearchNewDevice"), Common.SecuritySet.Encryption((jobject.ToString())));
+        //}
+
+        /////<summary >
+        ///// 淇敼璁惧鍚嶇О
+        ///// </summary>
+        //public static void DeviceRename(ZigBee.Device.ZbGateway gateway)
+        //{
+        //    var jobject = new JObject { { "DeviceAddr", "00124b00076a210b" }, { "Epoint", 11 }, { "Cluster_ID", 0 }, { "Command", 96 } };
+        //    var data = new JObject { { "DeviceName", "HDL" } };
+        //    jobject.Add("Data", data);
+        //    gateway.Send(("DeviceRename"), Common.SecuritySet.Encryption((jobject.ToString())));
+        //}
+
+        /////<summary >
+        ///// 浣胯澶囨仮澶嶅嚭鍘傝缃�
+        ///// </summary>
+        //public static void FactoryReset(ZigBee.Device.ZbGateway gateway)
+        //{
+        //    var jobject = new JObject { { "DeviceAddr", "00124b00076a210b" }, { "Epoint", 11 }, { "Cluster_ID", 0 }, { "Command", 97 } };
+        //    gateway.Send(("FactoryReset"), Common.SecuritySet.Encryption((jobject.ToString())));
+        //}
+
+        /////<summary >
+        ///// 鍒犻櫎璁惧
+        ///// </summary>
+        //public static void RemoveDevice(ZigBee.Device.ZbGateway gateway)
+        //{
+        //    var jobject = new JObject { { "Cluster_ID", 0 }, { "Command", 99 } };
+        //    var DeviceAddrList = new JArray
+        //    {
+        //        //鍙戜笉鍑哄幓锛屽彲鑳芥槸鎵嬫満娌$粌Wi-Fi
+        //        new JObject {
+        //            { "DeviceAddr", "00124b00076a210b"}
+        //         }
+        //    };
+        //    var data = new JObject { { "CompelClear", 1 }, { "DeviceAddrList", DeviceAddrList } };
+        //    jobject.Add("Data", data);
+        //    gateway.Send(("RemoveDevice"), Common.SecuritySet.Encryption((jobject.ToString())));
+        //}
+
+        /////<summary >
+        ///// 鎵撳紑鎴栧叧闂澶�
+        ///// Command
+        ///// 0 : 鍏抽棴
+        ///// 1: 鎵撳紑
+        ///// 2锛氬彇鍙�
+        ///// </summary>
+        //public static void OpenCloseDevice(ZigBee.Device.ZbGateway gateway, ZigBee.Device.CommonDevice device, int command)
+        //{
+        //    var jobject = new JObject { { "DeviceAddr", device.DeviceAddr }, { "Epoint", device.DeviceEpoint }, { "Cluster_ID", 6 }, { "Command", command }, { "SendMode", 2 } };
+        //    gateway.Send("DeviceControl", Common.SecuritySet.Encryption(jobject.ToString()));
+        //}
+        //#endregion 
+
+        //#region 鍗囩骇鍥轰欢
+        /////<summary >
+        ///// 璁惧畾OTA鍗囩骇鍥轰欢
+        ///// <para>oTAImageName:鍗囩骇闀滃儚鍚嶇О</para>
+        ///// <para>oTAImagePath:闀滃儚鎵�鍦ㄨ矾寰勩�傞暅鍍忓湪绯荤粺鐨勭洰褰曡矾寰勩�傚锛�/tmp/</para>
+        ///// </summary>
+        //public static void SetImage(ZigBee.Device.ZbGateway gateway, string oTAImageName, string oTAImagePath)
+        //{
+        //    var jobject = new JObject { { "Cluster_ID", 25 }, { "Command", 30 } };
+        //    var data = new JObject { { "OTAImageName", oTAImageName }, { "OTAImagePath", oTAImagePath } };
+        //    jobject.Add("Data", data);
+        //    gateway.Send(("OTA/SetImage"), Common.SecuritySet.Encryption((jobject.ToString())));
+        //}
+        //#endregion
+
+        //#region Hdl鎸夐敭
+        ///////<summary>
+        ///////鑾峰彇鎵�鏈夌粦瀹氾紙鐢ㄤ簬涓荤綉鍏筹級
+        /////// </summary>
+        ////public static void hdlButtonGetAllBind(ZigBee.Device.ZbGateway gateway)
+        ////{
+        ////    var jobject = new JObject { { "Cluster_ID", 64528 }, { "Command", 10 } };
+        ////    gateway.Send(("hdlButton/BindInfo"), Common.SecuritySet.Encryption((jobject.ToString())));
+        ////}
+
+        ///////<summary>
+        ///////璇诲彇鎸夐敭淇℃伅
+        /////// </summary>
+        ////public static void hdlButtonGetInfo(ZigBee.Device.ZbGateway gateway, string buttonMacAddr, int epoint, int endpoint)
+        ////{
+        ////    var jobject = new JObject { { "DeviceAddr", buttonMacAddr }, { "Epoint", epoint }, { "Cluster_ID", 64528 }, { "Command", 3 } };
+        ////    var data = new JObject { { "Endpoint", endpoint } };
+        ////    jobject.Add("Data", data);
+        ////    gateway.Send(("hdlButton/GetInfo"), Common.SecuritySet.Encryption((jobject.ToString())));
+        ////}
+
+        ///////<summary>
+        ///////閰嶇疆閿侀敭
+        /////// IsLock
+        /////// 0锛氫笉閿�
+        ///////1锛氶攣
+        /////// </summary>
+        ////public static void hdlButtonLock(ZigBee.Device.ZbGateway gateway, string buttonMacAddr, int epoint, int endpoint, int isLock)
+        ////{
+        ////    var jobject = new JObject { { "DeviceAddr", buttonMacAddr }, { "Epoint", epoint }, { "Cluster_ID", 64528 }, { "Command", 5 } };
+        ////    var data = new JObject { { "Endpoint", endpoint }, { "IsLock", isLock } };
+        ////    jobject.Add("Data", data);
+        ////    gateway.Send(("hdlButton/Lock"), Common.SecuritySet.Encryption((jobject.ToString())));
+        ////}
+
+        ///////<summary>
+        ///////閰嶇疆缁戝畾灞炴�э紙鐢ㄤ簬涓荤綉鍏筹級
+        /////// IsLock
+        /////// 0锛氫笉閿�
+        ///////1锛氶攣
+        /////// </summary>
+        ////public static void hdlButtonSetBindAttribute(ZigBee.Device.ZbGateway gateway, string buttonMacAddr, int epoint, int buttonMode, int buttonType, string bindName, int bindClusterId, int bindCmdId)
+        ////{
+        ////    var jobject = new JObject { { "DeviceAddr", buttonMacAddr }, { "Epoint", epoint }, { "Cluster_ID", 64528 }, { "Command", 4 } };
+
+        ////    var ParameterList = new JArray{
+        ////        new JObject {}
+        ////    };
+
+        ////    var data = new JObject { { "ButtonEpoint", epoint },
+        ////        { "ButtonMode", buttonMode },{ "ButtonType", buttonType },
+        ////        { "BindName", bindName },
+        ////        { "BindClusterId", bindClusterId },{ "BindCmdId", bindCmdId },
+        ////        { "ParameterList", ParameterList },
+        ////     };
+        ////    jobject.Add("Data", data);
+        ////    gateway.Send(("hdlButton/SetBindAttribute"), Common.SecuritySet.Encryption((jobject.ToString())));
+        ////}
+
+        ///////<summary>
+        ///////璁惧缁戝畾锛堢敤浜庝富缃戝叧锛�
+        /////// 缁戝畾璁惧
+        /////// </summary>
+        ////public static void hdlButtonSetBind(ZigBee.Device.ZbGateway gateway, ZigBee.Device.HDLbutton.BindListDeviceInfo bindListObj, string buttonMacAddr, int epoint, int buttonMode, int buttonType)
+        ////{
+        ////    var jobject = new JObject { { "DeviceAddr", buttonMacAddr }, { "Epoint", epoint }, { "Cluster_ID", 64528 }, { "Command", 6 } };
+
+        ////    var bindList = new JArray{
+        ////        new JObject {{ "BindType", bindListObj.BindType},{ "BindMacAddr", bindListObj.BindMacAddr},{ "BindEpoint", bindListObj.BindEpoint }}
+        ////    };
+        ////    var data = new JObject { { "ButtonEpoint", epoint },
+        ////        { "ButtonMode", buttonMode },{ "ButtonType", buttonType },
+        ////        { "BindList", bindList }
+        ////     };
+
+        ////    jobject.Add("Data", data);
+        ////    gateway.Send(("hdlButton/SetBind"), Common.SecuritySet.Encryption((jobject.ToString())));
+        ////}
+
+        ///////<summary>
+        ///////璁惧缁戝畾锛堢敤浜庝富缃戝叧锛�
+        /////// 缁戝畾鍦烘櫙锛屽綋BindType=1鏃跺瓨鍦�
+        /////// </summary>
+        ////public static void hdlButtonSetSceneBind(ZigBee.Device.ZbGateway gateway, ZigBee.Device.HDLbutton.BindSceneInfo bindListObj, string buttonMacAddr, int epoint, int buttonMode, int buttonType)
+        ////{
+        ////    var jobject = new JObject { { "DeviceAddr", buttonMacAddr }, { "Epoint", epoint }, { "Cluster_ID", 64528 }, { "Command", 6 } };
+
+        ////    var bindList = new JArray{
+        ////        new JObject {{ "BindType", bindListObj.BindType},{ "BindScenesId", bindListObj.BindScenesId}}
+        ////    };
+        ////    var data = new JObject { { "ButtonEpoint", epoint },
+        ////        { "ButtonMode", buttonMode },{ "ButtonType", buttonType },
+        ////        { "BindList", bindList }
+        ////     };
+
+        ////    jobject.Add("Data", data);
+        ////    gateway.Send(("hdlButton/SetBind"), Common.SecuritySet.Encryption((jobject.ToString())));
+        ////}
+
+        ///////<summary>
+        ///////绉婚櫎缁戝畾锛堢敤浜庝富缃戝叧锛�
+        /////// /// BindScenesId,缁戝畾鍦烘櫙锛屽綋BindType=1鏃跺瓨鍦�
+        /////// </summary>
+        ////public static void hdlButtonRemoveBind(ZigBee.Device.ZbGateway gateway, ZigBee.Device.HDLbutton.RemoveBindListInfo removeListObj, string buttonMacAddr, int epoint, int buttonMode, int buttonType)
+        ////{
+        ////    var jobject = new JObject { { "DeviceAddr", buttonMacAddr }, { "Epoint", epoint }, { "Cluster_ID", 64528 }, { "Command", 7 } };
+
+        ////    var removeBindList = new JArray{
+        ////        new JObject {{ "BindType", removeListObj.BindType},{ "BindMacAddr", removeListObj.BindMacAddr},{ "BindEpoint", removeListObj.BindEpoint}}
+        ////    };
+        ////    var data = new JObject { { "ButtonEpoint", epoint },
+        ////        { "ButtonMode", buttonMode },{ "ButtonType", buttonType },
+        ////        { "RemoveBindList", removeBindList }
+        ////     };
+
+        ////    jobject.Add("Data", data);
+        ////    gateway.Send(("hdlButton/RemoveBind"), Common.SecuritySet.Encryption((jobject.ToString())));
+        ////}
+
+
+        ///////<summary>
+        ///////绉婚櫎缁戝畾锛堢敤浜庝富缃戝叧锛�
+        /////// /// BindScenesId,缁戝畾鍦烘櫙锛屽綋BindType=1鏃跺瓨鍦�
+        /////// </summary>
+        ////public static void hdlButtonRemoveSceneBind(ZigBee.Device.ZbGateway gateway, ZigBee.Device.HDLbutton.RemoveSceneBindListInfo removeListObj, string buttonMacAddr, int epoint, int buttonMode, int buttonType)
+        ////{
+        ////    var jobject = new JObject { { "DeviceAddr", buttonMacAddr }, { "Epoint", epoint }, { "Cluster_ID", 64528 }, { "Command", 7 } };
+
+        ////    var removeBindList = new JArray{
+        ////        new JObject {{ "BindType", removeListObj.BindType},{ "BindScenesId", removeListObj.BindScenesId}}
+        ////    };
+        ////    var data = new JObject { { "ButtonEpoint", epoint },
+        ////        { "ButtonMode", buttonMode },{ "ButtonType", buttonType },
+        ////        { "RemoveBindList", removeBindList }
+        ////     };
+
+        ////    jobject.Add("Data", data);
+        ////    gateway.Send(("hdlButton/RemoveBind"), Common.SecuritySet.Encryption((jobject.ToString())));
+        ////}
+
+        ///////<summary>
+        ///////鍒犻櫎鎸夐敭鍔熻兘锛堢敤浜庝富缃戝叧锛�
+        /////// buttonMode璁句负0xffff  65536 锛岀洿鎺ユ竻闄ゆ寜閿彿涓嬫墍鏈夋寜閿ā寮忕殑缁戝畾
+        /////// </summary>
+        ////public static void hdlButtonDelButtonFunction(ZigBee.Device.ZbGateway gateway, string buttonMacAddr, int epoint, int buttonMode)
+        ////{
+        ////    var jobject = new JObject { { "DeviceAddr", buttonMacAddr }, { "Epoint", epoint }, { "Cluster_ID", 64528 }, { "Command", 8 } };
+        ////    var data = new JObject { { "ButtonEpoint", epoint},
+        ////        { "ButtonMode", buttonMode }
+        ////    };
+        ////    jobject.Add("Data", data);
+        ////    gateway.Send(("hdlButton/DelButtonFunction"), Common.SecuritySet.Encryption((jobject.ToString())));
+        ////}
+
+        ///////<summary>
+        ///////淇敼缁戝畾鍚嶇О锛堢敤浜庝富缃戝叧锛�
+        /////// </summary>
+        ////public static void hdlButtonBindRename(ZigBee.Device.ZbGateway gateway, string buttonMacAddr, int epoint, int buttonMode, int buttonType, string bindName)
+        ////{
+        ////    var jobject = new JObject { { "Cluster_ID", 64528 }, { "Command", 9 } };
+        ////    var data = new JObject { { "ButtonMacAddr", buttonMacAddr },
+        ////        { "ButtonEpoint", epoint },{ "ButtonMode", buttonMode },
+        ////        { "ButtonType", buttonType },
+        ////        { "BindName", bindName }
+        ////    };
+        ////    jobject.Add("Data", data);
+        ////    gateway.Send(("hdlButton/BindRename"), Common.SecuritySet.Encryption((jobject.ToString())));
+        ////}
+        //#endregion
+
+        //#region 鍗忚皟鍣�
+        /////<summary >
+        /////娣诲姞Install Codes鐮�
+        ///// <para>installCode:InstallCode鐮�  36涓瓧绗�</para>
+        ///// <para>installCodeAddr:InstallCodes鐮佽澶囩殑mac鍦板潃16涓瓧绗�</para>
+        ///// </summary>
+        //public static void ZbGwInstallCode(ZigBee.Device.ZbGateway gateway, string installCode, string installCodeAddr)
+        //{
+        //    var jobject = new JObject { { "Cluster_ID", 64512 }, { "Command", 7 } };
+        //    var data = new JObject { { "InstallCode", installCode }, { "InstallCodeAddr", installCodeAddr } };
+        //    jobject.Add("Data", data);
+        //    gateway.Send(("ZbGw/InstallCode"), Common.SecuritySet.Encryption((jobject.ToString())));
+        //}
+
+        /////<summary >
+        /////鑾峰彇鍗忚皟鍣ㄥ綋鍓嶄俊閬�
+        ///// </summary>
+        //public static void ZbGwGetChannel(ZigBee.Device.ZbGateway gateway)
+        //{
+        //    var jobject = new JObject { { "Cluster_ID", 64512 }, { "Command", 8 } };
+        //    gateway.Send(("ZbGw/GetChannel"), Common.SecuritySet.Encryption((jobject.ToString())));
+        //}
+
+        /////<summary >
+        /////鏇存敼鍗忚皟鍣ㄥ綋鍓嶄俊閬�
+        ///// <para>channel:瑕佹洿鏀圭殑淇¢亾: 11 -26</para>
+        ///// </summary>
+        //public static void ZbGwChangeChannel(ZigBee.Device.ZbGateway gateway, int channel)
+        //{
+        //    var jobject = new JObject { { "Cluster_ID", 64512 }, { "Command", 9 } };
+        //    var data = new JObject { { "Channel", channel } };
+        //    jobject.Add("Data", data);
+        //    gateway.Send(("ZbGw/ChangeChannel"), Common.SecuritySet.Encryption((jobject.ToString())));
+        //}
+
+        /////<summary >
+        /////鏌ョ湅褰撳墠鍙戝皠鍔熺巼
+        ///// </summary>
+        //public static void ZbGwGetPower(ZigBee.Device.ZbGateway gateway)
+        //{
+        //    var jobject = new JObject { { "Cluster_ID", 64512 }, { "Command", 10 } };
+        //    gateway.Send(("ZbGw/GetPower"), Common.SecuritySet.Encryption((jobject.ToString())));
+        //}
+
+        /////<summary >
+        /////璁剧疆鍙戝皠鍔熺巼
+        ///// <para>power:瑕佹洿鏀圭殑璁惧鍙戝皠鍔熺巼锛屽彲璁剧疆8,10,11,13,15,16,18,19,20,21,22(dBm)</para>
+        ///// </summary>
+        //public static void ZbGwSetPower(ZigBee.Device.ZbGateway gateway, int power)
+        //{
+        //    var jobject = new JObject { { "Cluster_ID", 64512 }, { "Command", 11 } };
+        //    var data = new JObject { { "Power", power } };
+        //    jobject.Add("Data", data);
+        //    gateway.Send(("ZbGw/SetPower"), Common.SecuritySet.Encryption((jobject.ToString())));
+        //}
+
+        /////<summary >
+        /////璇诲彇褰撳墠灞�鍩熺綉鐨凱ANID
+        ///// </summary>
+        //public static void ZbGwGetPanId(ZigBee.Device.ZbGateway gateway)
+        //{
+        //    var jobject = new JObject { { "Cluster_ID", 64512 }, { "Command", 12 } };
+        //    gateway.Send(("ZbGw/GetPanId"), Common.SecuritySet.Encryption((jobject.ToString())));
+        //}
+
+        /////<summary >
+        /////璇诲彇鍗忚皟鍣∕AC鍦板潃
+        ///// </summary>
+        //public static void ZbGwGetMac(ZigBee.Device.ZbGateway gateway)
+        //{
+        //    var jobject = new JObject { { "Cluster_ID", 64512 }, { "Command", 13 } };
+        //    gateway.Send(("ZbGw/GetMac"), Common.SecuritySet.Encryption((jobject.ToString())));
+        //}
+
+        /////<summary >
+        /////zigbee鍗忚皟鍣ㄦ仮澶嶅嚭鍘傝缃�
+        ///// 0锛氫粎灏嗗崗璋冨櫒鎭㈠鍑哄巶璁剧疆锛屼笉鍒犻櫎缃戝叧淇濆瓨鐨勮澶囧垪琛紝缁勫垪琛紝鍦烘櫙鍒楄〃绛変俊鎭��
+        /////1锛氬皢鍗忚皟鍣ㄦ仮澶嶅嚭鍘傝缃紝骞跺垹闄ょ綉鍏充繚瀛樼殑璁惧鍒楄〃锛岀粍鍒楄〃锛屽満鏅垪琛ㄧ瓑淇℃伅銆�
+        ///// </summary>
+        //public static void ZbGwOperationReset(ZigBee.Device.ZbGateway gateway, int delAllInfo)
+        //{
+        //    var jobject = new JObject { { "Cluster_ID", 0 }, { "Command", 160 } };
+        //    var data = new JObject { { "DelAllInfo", delAllInfo } };
+        //    jobject.Add("Data", data);
+        //    gateway.Send(("ZbGwOperation/Reset"), Common.SecuritySet.Encryption((jobject.ToString())));
+        //}
+
+        ///////<summary >
+        ///////淇濆瓨zigbee鍗忚皟鍣ㄧ粍缃戜俊鎭�
+        /////// </summary>
+        ////public static void ZbGwOperationSaveNVFile(ZigBee.Device.ZbGateway gateway, string imageName, string imagePath)
+        ////{
+        ////    var jobject = new JObject { { "Cluster_ID", 0 }, { "Command", 500 } };
+        ////    var data = new JObject { { "ImageName", imageName }, { "ImagePath", imagePath } };
+        ////    jobject.Add("Data", data);
+        ////    gateway.Send(("ZbGwOperation/SaveNVFile"), Common.SecuritySet.Encryption((jobject.ToString())));
+        ////}
+
+        ///////<summary >
+        ///////鍗忚皟鍣ㄦ仮澶嶇粍缃戜俊鎭�
+        /////// </summary>
+        ////public static void ZbGwOperationRestoreNV(ZigBee.Device.ZbGateway gateway, string imageName, string imagePath)
+        ////{
+        ////    var jobject = new JObject { { "Cluster_ID", 0 }, { "Command", 501 } };
+        ////    var data = new JObject { { "ImageName", imageName }, { "ImagePath", imagePath } };
+        ////    jobject.Add("Data", data);
+        ////    gateway.Send(("ZbGwOperation/RestoreNV"), Common.SecuritySet.Encryption((jobject.ToString())));
+        ////}
+
+        ///////<summary >
+        /////// 鍗忚皟鍣ㄥ崌绾�
+        /////// </summary>
+        ////public static void ZbGwOperationUpgrade(ZigBee.Device.ZbGateway gateway, string imageName, string imagePath)
+        ////{
+        ////    var jobject = new JObject { { "Cluster_ID", 0 }, { "Command", 502 } };
+        ////    var data = new JObject { { "ImageName", imageName }, { "ImagePath", imagePath } };
+        ////    jobject.Add("Data", data);
+        ////    gateway.Send(("ZbGwOperation/Upgrade"), Common.SecuritySet.Encryption((jobject.ToString())));
+        ////}
+
+        /////<summary >
+        /////璇诲彇鍗忚皟鍣∕AC鍦板潃
+        ///// </summary>
+        //public static void ZbGwSetOrGetData(ZigBee.Device.ZbGateway gateway, int command_ID, string payload)
+        //{
+        //    var jobject = new JObject { { "Cluster_ID", 64512 }, { "Command", 2600 } };
+        //    var data = new JObject { { "Command_ID", command_ID }, { "Payload", payload } };
+        //    jobject.Add("Data", data);
+        //    gateway.Send(("ZbGw/GetMac"), Common.SecuritySet.Encryption((jobject.ToString())));
+        //}
+        //#endregion
+
+        //#region 鍦烘櫙
+        /////<summary >
+        ///// 鍦ㄧ綉鍏充腑鍒涘缓鏂扮殑鍦烘櫙ID
+        ///// </summary>
+        ////public static void SceneGetNewId(ZigBee.Device.ZbGateway gateway, string SceneName)
+        ////{
+        ////    var jObject = new Newtonsoft.Json.Linq.JObject() {
+        ////                            { "Cluster_ID", 0 },
+        ////                            { "Command", 800 }
+        ////                        };
+        ////    var data = new JObject { { "ScenesName", SceneName } };
+        ////    jObject.Add("Data", data);
+        ////    gateway.Send("Scene/GetNewId", Common.SecuritySet.Encryption(jObject.ToString()));
+        ////}
+
+        /////<summary >
+        ///// 娣诲姞璁惧鍒扮綉鍏冲埌鍦烘櫙涓�
+        ///// </summary>
+        ////public static void SceneAddMember(Shared.Device.ZbGateway gateway,Shared.Device.ZbGateway.TaskListInfo taskInfo, int ScenesId, string DeviceAddr, int Epoint)
+        ////public static void SceneAddMember(ZigBee.Device.ZbGateway gateway, ZigBee.Device.Scene.TaskListInfo taskInfo, int ScenesId, string DeviceAddr, int Epoint)
+
+        ////{
+        ////    var jobject = new JObject { { "Cluster_ID", 0 }, { "Command", 810 } };
+
+        ////    //var taskList = new JArray{
+        ////    //new JObject{{ "TaskType", 1}, { "Data1",1}, { "Data2",0}},
+        ////    //new JObject{{ "TaskType", 2 }, { "Data1", 60 }, { "Data2", 0 }}
+        ////    //};
+        ////    var taskList = new JArray
+        ////    {
+        ////        new JObject{
+        ////            { "TaskType", taskInfo.TaskType},
+        ////            { "Data1", taskInfo.Data1},
+        ////            { "Data2",taskInfo.Data2}
+        ////        }
+        ////    };
+        ////    var data = new JObject {
+        ////        { "ScenesId",ScenesId},
+        ////        { "Type", 0} ,
+        ////        { "DeviceAddr",DeviceAddr} ,
+        ////        { "Epoint", Epoint} ,
+        ////        { "TaskList", taskList }
+        ////    };
+        ////    jobject.Add("Data", data);
+        ////    gateway.Send(("Scene/AddMember"), Common.SecuritySet.Encryption((jobject.ToString())));
+        ////}
+
+        /////<summary >
+        ///// 浠庣綉鍏崇殑鍦烘櫙涓Щ闄よ澶�
+        ///// </summary>
+        ////public static void SceneRemoveMember(ZigBee.Device.ZbGateway gateway, int ScenesId, string DeviceAddr, int Epoint)
+        ////{
+        ////    var jobject = new JObject { { "Cluster_ID", 0 }, { "Command", 802 } };
+        ////    var DeviceList = new JArray
+        ////                        {
+        ////                            new JObject {
+        ////                                { "Type", 0},
+        ////                                { "DeviceAddr",DeviceAddr},
+        ////                                { "Epoint",Epoint}
+        ////                            }
+        ////                        };
+        ////    var data = new JObject {
+        ////        {"ScenesId",ScenesId},
+        ////                            { "DeviceList", DeviceList }
+        ////                        };
+        ////    jobject.Add("Data", data);
+        ////    gateway.Send(("Scene/RemoveMember"), Common.SecuritySet.Encryption((jobject.ToString())));
+
+        ////}
+
+        /////<summary >
+        ///// 鍒犻櫎鍦烘櫙
+        ///// </summary>
+        ////public static void SceneRemove(ZigBee.Device.ZbGateway gateway, int scenesId)
+        ////{
+        ////    var jobject = new JObject { { "Cluster_ID", 0 }, { "Command", 803 } };
+        ////    var data = new JObject { { "ScenesId", scenesId } };
+        ////    jobject.Add("Data", data);
+        ////    gateway.Send(("Scene/Remove"), Common.SecuritySet.Encryption((jobject.ToString())));
+        ////}
+
+        /////<summary >
+        ///// 淇敼鍦烘櫙鍚嶇О
+        ///// </summary>
+        ////public static void SceneRename(ZigBee.Device.ZbGateway gateway, int scenesId, string scenesName)
+        ////{
+        ////    var jobject = new JObject { { "Cluster_ID", 0 }, { "Command", 804 } };
+        ////    var data = new JObject { { "ScenesId", scenesId }, { "ScenesName", scenesName } };
+        ////    jobject.Add("Data", data);
+        ////    gateway.Send(("Scene/Rename"), Common.SecuritySet.Encryption((jobject.ToString())));
+        ////}
+
+        /////<summary >
+        ///// 鑾峰彇缃戝叧涓満鏅俊鎭�
+        ///// </summary>
+        ////public static void SceneGetInfo(ZigBee.Device.ZbGateway gateway)
+        ////{
+        ////    var jobject = new JObject { { "Cluster_ID", 0 }, { "Command", 805 } };
+        ////    gateway.Send(("Scene/GetInfo"), Common.SecuritySet.Encryption((jobject.ToString())));
+        ////}
+
+        /////<summary >
+        /////鑾峰彇缃戝叧涓満鏅殑璁惧鍒楄〃
+        ///// </summary>
+        ////public static void SceneGetDeviceList(ZigBee.Device.ZbGateway gateway, int ScenesId)
+        ////{
+        ////    var jobject = new JObject { { "Cluster_ID", 0 }, { "Command", 806 } };
+        ////    var data = new JObject { { "ScenesId", ScenesId } };
+        ////    jobject.Add("Data", data);
+        ////    gateway.Send(("Scene/GetDeviceList"), Common.SecuritySet.Encryption((jobject.ToString())));
+        ////}
+
+        /////<summary >
+        ///// 鑾峰彇鎵�鏈夊満鏅俊鎭紙鍖呮嫭鍦烘櫙璁惧鍒楄〃锛�
+        ///// </summary>
+        //public static void SceneGetAllInfo(ZigBee.Device.ZbGateway gateway)
+        //{
+        //    var jobject = new JObject { { "Cluster_ID", 0 }, { "Command", 807 } };
+        //    gateway.Send(("Scene/GetAllInfo"), Common.SecuritySet.Encryption((jobject.ToString())));
+        //}
+
+        /////<summary >
+        /////璋冪敤鍦烘櫙
+        ///// </summary>
+        ////public static void SceneOpen(ZigBee.Device.ZbGateway gateway, int ScenesId)
+        ////{
+        ////    var jobject = new JObject { { "Cluster_ID", 0 }, { "Command", 808 } };
+        ////    var data = new JObject { { "ScenesId", ScenesId } };
+        ////    jobject.Add("Data", data);
+        ////    gateway.Send(("Scene/Open"), Common.SecuritySet.Encryption((jobject.ToString())));
+        ////}
+        //#endregion
+
+        //#region 鍒涘缓鏂囦欢,鍙戦�佹枃浠舵祦
+        /////<summary >
+        ///// 鍒涘缓鏂囦欢
+        ///// </summary>
+        //public static void CreateFile(ZigBee.Device.ZbGateway gateway, string fileName)
+        //{
+        //    var jobject = new JObject { { "Cluster_ID", 0 }, { "Command", 3000 } };
+        //    var data = new JObject { { "FileName", fileName }, { "FilePath", "/tmp/" } };
+        //    jobject.Add("Data", data);
+        //    gateway.Send(("FileTransfer/CreateFile"), Common.SecuritySet.Encryption((jobject.ToString())));
+        //}
+
+        /////<summary >
+        ///// 瀹㈡埛绔彂閫佹枃浠舵祦鍒扮綉鍏�
+        ///// </summary>
+        //public static void SendFile(ZigBee.Device.ZbGateway gateway, string fileName)
+        //{
+
+        //    //System.Threading.Tasks.Task.Run(() =>
+        //    //{
+        //    //    var downloadFile = new DroidService.service.hdlcontrol.com.WebServiceSoftware().DownloadByOneFile(fileName);//("openwrt-ramips-mt7688-Widora-20180607.bin");
+        //    //    var data = SymmetricEncrypt.Encrypt.ToDecrypt(downloadFile.Binary);
+        //    //    var ff = "鏁版嵁鍖呮�婚暱搴�====" + data.Length.ToString();
+        //    //    System.Console.WriteLine(ff);
+        //    //    if (data == null)
+        //    //    {
+        //    //        return;
+        //    //    }
+        //    //    var fileBytes = data;
+        //    //    var size = 2048;
+        //    //    for (int i = 0, tempSize = 0; i < fileBytes.Length; i += tempSize)
+        //    //    {
+        //    //        byte finish = 0;
+        //    //        if (i + size < fileBytes.Length)
+        //    //        {
+        //    //            tempSize = size;
+        //    //        }
+        //    //        else if (i + size == fileBytes.Length)
+        //    //        {
+        //    //            tempSize = size;
+        //    //            finish = 1;
+        //    //        }
+        //    //        else
+        //    //        {
+        //    //            tempSize = fileBytes.Length % size;
+        //    //            finish = 1;
+        //    //        }
+        //    //        var bytes = new byte[8 + tempSize];
+        //    //        bytes[0] = 0xfe;
+        //    //        bytes[1] = 0;
+        //    //        bytes[2] = 0;
+        //    //        bytes[3] = 0;
+        //    //        bytes[4] = 0;
+        //    //        bytes[5] = finish;//0x00 鎴� 0x01
+        //    //        bytes[6] = Convert.ToByte(tempSize % 256);   // DataLen 0x01 鍒� 0x800 锛堝嵆姣忔鏈�澶у彂閫�2048瀛楄妭锛�2
+        //    //        bytes[7] = Convert.ToByte(tempSize / 256);
+        //    //        System.Array.Copy(fileBytes, i, bytes, 8, tempSize);
+
+        //    //        if (finish == 1)
+        //    //        {
+        //    //            var bb = "鏈�鍚庝竴涓暟鎹寘澶у皬" + tempSize.ToString();
+        //    //            System.Console.WriteLine(bb);
+        //    //            var aa = "鏈�鍚庝竴涓暟鎹寘澶у皬" + (i + tempSize).ToString();
+        //    //            System.Console.WriteLine(aa);
+        //    //        }
+        //    //        var dd = "鏁版嵁鍖呭ぇ灏�====" + (i + tempSize).ToString().ToString();
+        //    //        System.Console.WriteLine(dd);
+        //    //        gateway.Send("FileTransfer/SendFile", Common.SecuritySet.EncryptionBytes(bytes));
+        //    //        System.Threading.Thread.Sleep(100);
+        //    //    }
+        //    //});
+
+        //}
+        //#endregion
+
+        //#region 灞炴��
+        ///// <summary>
+        ///// 璇诲彇鎶ュ憡灞炴�ч厤缃�
+        ///// </summary>
+        ///// <param name="clusterID">Cluster identifier.</param>
+        ///// <param name="attriButeId">Attri bute identifier.</param>
+        //public static void ReadAttri(ZigBee.Device.ZbGateway gateway, string buttonMacAddr, int epoint, ZigBee.Device.Cluster_ID clusterID, ZigBee.Device.AttriButeId attriButeId)
+        //{
+        //    var jobject = new JObject {
+        //        { "DeviceAddr",buttonMacAddr },
+        //        { "Epoint", epoint },
+        //        { "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())));
+        //}
+
+        ///// <summary>
+        ///// 璁剧疆鍙啓灞炴�х殑鍊�
+        ///// </summary>
+        ///// <param name="clusterID">Cluster identifier.</param>
+        ///// <param name="attriButeId">Attri bute identifier.</param>
+        //public static void SetWritableValue(ZigBee.Device.ZbGateway gateway, string buttonMacAddr, int epoint, int clusterID, int attriButeId, int attributeDataType, int attributeData)
+        //{
+        //    var jobject = new JObject {
+        //        { "DeviceAddr",buttonMacAddr },
+        //        { "Epoint", epoint },
+        //        { "Cluster_ID", clusterID },
+        //        { "Command", 120 }
+        //    };
+        //    var data = new JObject { { "AttributeId", attriButeId },
+        //        { "AttributeDataType", attributeDataType },{ "AttributeData", attributeData }
+        //     };
+        //    jobject.Add("Data", data);
+        //    gateway?.Send(("GetDeviceStatus"), Common.SecuritySet.Encryption((jobject.ToString())));
+        //}
+        //#endregion
+
+        //#region 寮�鍏�
+        /////<summary >
+        /////寮�鍏虫帶鍒�
+        ///// command鐨勫��
+        /////0 : 鍏抽棴
+        /////1: 鎵撳紑
+        /////2锛氬彇鍙�
+        ///// </summary>
+        //public static void SwitchControll(ZigBee.Device.ZbGateway gateway, string buttonMacAddr, int epoint, int command)
+        //{
+        //    var jobject = new JObject { { "DeviceAddr", buttonMacAddr }, { "Epoint", epoint }, { "Cluster_ID", 6 }, { "Command", command }, { "SendMode", 2 } };
+        //    gateway?.Send(("DeviceControl"), Common.SecuritySet.Encryption((jobject.ToString())));
+        //}
+        //#endregion
+
+        //#region 鐏厜
+
+        //#region Level
+        /////<summary >
+        /////璁剧疆鎸囧畾璁惧浜害锛圠evel锛�
+        ////Command
+        ////0锛歁ove to Level Command
+        ////4锛歁ove to Level Command锛坵ith On/ Off锛�
+        ///// </summary>
+        //public static void SetLevel(ZigBee.Device.ZbGateway gateway, string DeviceAddr, int Epoint, int value)
+        //{
+        //    var jobject = new JObject {
+        //        { "DeviceAddr", DeviceAddr},
+        //        { "Epoint", Epoint},
+        //            { "Cluster_ID", 8 },
+        //            { "Command", 0 },
+        //            { "SendMode", 2 }
+        //        };
+        //    var data = new JObject {
+        //            { "Level", value },
+        //            { "TransitionTime", 0 }
+        //        };
+        //    jobject.Add("Data", data);
+        //    gateway?.Send("DeviceControl", Common.SecuritySet.Encryption(jobject.ToString()));
+        //}
+
+        /////<summary >
+        /////Move Level 
+        ////1: Move Command
+        ////5锛歁ove to Level Command锛坵ith On/ Off锛�
+        ////MoveMode:0: Up mode , Level 鍙樺ぇ
+        ////MoveMode1锛欴own mode , Level鍙樺皬
+        ///// </summary>
+        //public static void MoveLevel(ZigBee.Device.ZbGateway gateway, string DeviceAddr, int Epoint, int MoveMode)
+        //{
+        //    var jobject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", Epoint }, { "Cluster_ID", 8 }, { "Command", 1 }, { "SendMode", 2 } };
+        //    var data = new JObject { { "MoveMode", MoveMode }, { "Rate", 100 } };
+        //    jobject.Add("Data", data);
+        //    gateway?.Send("DeviceControl", Common.SecuritySet.Encryption(jobject.ToString()));
+        //}
+
+        /////<summary >
+        ////Move Level Command
+        ////2: Move Command
+        ////6锛歁ove to Level Command锛坵ith On/ Off锛�
+        ////MoveMode:0: Up mode , Level 鍙樺ぇ
+        ////MoveMode1锛欴own mode , Level鍙樺皬
+        ///// </summary>
+        //public static void StepLevel(ZigBee.Device.ZbGateway gateway, string DeviceAddr, int Epoint, int StepMode)
+        //{
+        //    var jobject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", Epoint }, { "Cluster_ID", 8 }, { "Command", 2 }, { "SendMode", 2 } };
+        //    var data = new JObject { { "StepMode", StepMode }, { "StepSize", 50 }, { "TransitionTime", 0 } };
+        //    jobject.Add("Data", data);
+        //    gateway?.Send("DeviceControl", Common.SecuritySet.Encryption(jobject.ToString()));
+        //}
+
+        /////<summary >
+        ////Stop Level Command
+        ///// </summary>
+        //public static void StopLevel(ZigBee.Device.ZbGateway gateway, string DeviceAddr, int Epoint)
+        //{
+        //    var jobject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", Epoint }, { "Cluster_ID", 8 }, { "Command", 3 }, { "SendMode", 2 } };
+        //    gateway?.Send("DeviceControl", Common.SecuritySet.Encryption(jobject.ToString()));
+        //}
+        //#endregion
+
+        //#region Hue
+        /////<summary > 
+        /////璁剧疆鎸囧畾璁惧鑹插害锛圚ue锛�
+        /////0锛氶�夋渶鐭殑璺緞鍒拌揪Hue
+        /////1锛氶�夋渶闀跨殑璺緞鍒拌揪Hue
+        /////2锛氭鏂瑰悜鍒拌揪Hue
+        /////3锛氬弽鏂瑰悜鍒拌揪Hue
+        ///// </summary>
+        //public static void SetHue(ZigBee.Device.ZbGateway gateway, string DeviceAddr, int Epoint, int value)
+        //{
+
+        //    var jobject = new JObject {
+        //            { "DeviceAddr",  DeviceAddr },
+        //            { "Epoint",  Epoint },
+        //            { "Cluster_ID", 768 },
+        //            { "Command", 0 },
+        //            { "SendMode", 2 }
+        //        };
+        //    var data = new JObject {
+        //                { "Hue", value },
+        //                { "Direction", 0 },
+        //            { "TransitionTime", 0 }
+        //        };
+        //    jobject.Add("Data", data);
+        //    gateway?.Send("DeviceControl", Common.SecuritySet.Encryption(jobject.ToString()));
+        //}
+
+        /////<summary > 
+        ///// Move Hue Command
+        /////0锛歴top 锛屽仠姝㈠彉鍖栬壊璋�
+        /////1锛歶p 锛屾鏂瑰悜鍙樺寲鑹茶皟
+        /////3锛歞own锛屽弽鏂瑰悜鍙樺寲鑹茶皟
+        ///// </summary>
+        //public static void MoveHue(ZigBee.Device.ZbGateway gateway, string DeviceAddr, int Epoint, int MoveMode)
+        //{
+        //    var jobject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", Epoint }, { "Cluster_ID", 768 }, { "Command", 1 }, { "SendMode", 2 } };
+        //    var data = new JObject { { "MoveMode", MoveMode }, { "Rate", 10 } };
+        //    jobject.Add("Data", data);
+        //    gateway?.Send("DeviceControl", Common.SecuritySet.Encryption(jobject.ToString()));
+        //}
+
+        /////<summary > 
+        /////璁剧疆鎸囧畾璁惧鑹插害锛圚ue锛�
+        /////Step Hue
+        /////1锛歶p 锛屾鏂瑰悜鍙樺寲鑹茶皟
+        /////3锛歞own锛屽弽鏂瑰悜鍙樺寲鑹茶皟
+        ///// </summary>
+        //public static void StepHue(ZigBee.Device.ZbGateway gateway, string DeviceAddr, int Epoint, int StepMode)
+        //{
+        //    var jobject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", Epoint }, { "Cluster_ID", 768 }, { "Command", 2 }, { "SendMode", 2 } };
+        //    var data = new JObject { { "StepMode", StepMode }, { "StepSize", 50 }, { "TransitionTime", 0 } };
+        //    jobject.Add("Data", data);
+        //    gateway?.Send("DeviceControl", Common.SecuritySet.Encryption(jobject.ToString()));
+        //}
+
+        /////<summary > 
+        /////璁剧疆鑹插害鍜岄ケ鍜屽害 
+        ///// </summary>
+        //public static void setHueAndStaturation(ZigBee.Device.ZbGateway gateway, string DeviceAddr, int Epoint, int Hue, int Saturation)
+        //{
+        //    var jobject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", Epoint }, { "Cluster_ID", 768 }, { "Command", 6 }, { "SendMode", 2 } };
+        //    var data = new JObject { { "Hue", Hue }, { "Saturation", Saturation }, { "TransitionTime", 0 } };
+        //    jobject.Add("Data", data);
+        //    gateway?.Send("DeviceControl", Common.SecuritySet.Encryption(jobject.ToString()));
+        //}
+        //#endregion
+
+        //#region Saturation
+        /////<summary > 
+        /////璁剧疆鎸囧畾璁惧楗卞拰搴︼紙Saturation锛�
+        /////Command
+        /////0锛歁ove to Level Command
+        /////4锛歁ove to Level Command锛坵ith On/ Off锛�
+        ///// </summary>
+        //public static void SetSaturation(ZigBee.Device.ZbGateway gateway, string DeviceAddr, int Epoint, int value)
+        //{
+        //    var jobject = new JObject {
+        //            { "DeviceAddr", DeviceAddr },
+        //            { "Epoint", Epoint },
+        //            { "Cluster_ID", 768 },
+        //            { "Command", 3 },
+        //            { "SendMode", 2 }
+        //        };
+        //    var data = new JObject {
+        //            { "Saturation", value },
+        //             { "TransitionTime", 0 }
+        //        };
+        //    jobject.Add("Data", data);
+        //    gateway?.Send("DeviceControl", Common.SecuritySet.Encryption(jobject.ToString()));
+        //}
+
+        /////<summary > 
+        /////Move Saturation Command
+        /////0锛歋top 锛屽仠姝㈠彉鍖栭ケ鍜屽害
+        /////1锛歎p 锛屾鏂瑰悜鍙樺寲,(棰滆壊鐢辩櫧鑹插彉涓哄叾浠栬壊锛�
+        /////3锛氬弽鏂瑰悜鍙樺寲锛堥鑹茬敱鍏朵粬鑹插彉涓虹櫧鑹诧級
+        ///// </summary>
+        //public static void MoveUpSaturation(ZigBee.Device.ZbGateway gateway, string DeviceAddr, int Epoint, int MoveMode)
+        //{
+        //    var jobject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", Epoint }, { "Cluster_ID", 768 }, { "Command", 4 }, { "SendMode", 2 } };
+        //    var data = new JObject { { "MoveMode", MoveMode }, { "Rate", 15 } };
+        //    jobject.Add("Data", data);
+        //    gateway?.Send("DeviceControl", Common.SecuritySet.Encryption(jobject.ToString()));
+        //}
+
+        /////<summary > 
+        /////Step Saturation Command
+        /////1锛歶p 锛屾鏂瑰悜鍙樺寲
+        /////3锛歞own 锛屽弽鏂瑰悜鍙樺寲
+        ///// </summary>
+        //public static void StepSaturation(ZigBee.Device.ZbGateway gateway, string DeviceAddr, int Epoint, int StepMode)
+        //{
+        //    var jobject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", Epoint }, { "Cluster_ID", 768 }, { "Command", 5 }, { "SendMode", 2 } };
+        //    var data = new JObject { { "StepMode", StepMode }, { "StepSize", 50 }, { "TransitionTime", 0 } };
+        //    jobject.Add("Data", data);
+        //    gateway?.Send("DeviceControl", Common.SecuritySet.Encryption(jobject.ToString()));
+        //}
+        //#endregion
+
+        //#endregion
+
+        //#region 绐楀笜
+        /////<summary >
+        /////绐楀笜鎺у埗
+        ///// command鐨勫��
+        ///// 0:寮�
+        /////1锛氬叧
+        /////2:鍋�
+        ///// </summary>
+        //public static void CurtainControll(ZigBee.Device.ZbGateway gateway, string buttonMacAddr, int epoint, int command)
+        //{
+        //    var jobject = new JObject { { "DeviceAddr", buttonMacAddr }, { "Epoint", epoint }, { "Cluster_ID", 258 }, { "Command", command }, { "SendMode", 2 } };
+        //    gateway.Send(("ZbGwOperation/Reset"), Common.SecuritySet.Encryption((jobject.ToString())));
+        //}
+        //#endregion
+
+        //#region 閫昏緫
+        /////<summary>
+        ///// 鑾峰彇閫昏緫鍒楄〃
+        ///// </summary>
+        //public static void LogicGetLogicList()
+        //{
+        //    var jobject = new JObject { { "Cluster_ID", 0 }, { "Command", 2004 } };
+        //    ZigBee.Device.ZbGateway.MainGateWay?.Send(("Logic/GetLogicList"), Common.SecuritySet.Encryption((jobject.ToString())));
+        //}
+
+        /////<summary>
+        /////閫氳繃閫昏緫id鑾峰彇閫昏緫淇℃伅
+        ///// </summary>
+        ////public static void LogicGetLogicInfo(Shared.Device.ZbGateway gateway, int LogicId)
+        ////{
+        ////    var jobject = new JObject { { "Cluster_ID", 0 }, { "Command", 2002 } };
+        ////    var data = new JObject { { "LogicId", LogicId } };
+        ////    jobject.Add("Data", data);
+        ////    gateway.Send(("Logic/GetLogicInfo"), Common.SecuritySet.Encryption((jobject.ToString())));
+        ////}
+
+        ///// <summary>
+        ///// 鍦ㄧ綉鍏充腑鍒涘缓鏂扮殑鍦烘櫙ID
+        ///// </summary>
+        ///// <param name="gateway">Gateway.</param>
+        ///// <param name="logicId">Logic identifier.</param>
+        ///// <param name="isEnable">Is enable.</param>
+        ///// <param name="logicName">Logic name.</param>
+        ///// <param name="relationship">Relationship.</param>
+        ///// <param name="Condition">Condition.</param>
+        ///// <param name="Action">Action.</param>
+        ///// <param name="taskInfo">Task info.</param>
+        ////public static void LogicAddLogic(Shared.Device.ZbGateway gateway, int LogicId, int IsEnable, string LogicName, int Relationship, LogicObj.ConditionsData Condition, LogicObj.ActionsData Action, LogicObj.TaskListInfo taskInfo)
+        ////{
+        ////    var jObject = new Newtonsoft.Json.Linq.JObject() {
+        ////                            { "Cluster_ID", 0 },
+        ////                            { "Command", 2000 }
+        ////                        };
+        ////    var Conditions = new JArray
+        ////    {
+        ////        new JObject{
+        ////        //    { "ConditionId", Condition.ConditionId},
+        ////        //    { "IsValid", Condition.IsValid},
+        ////        //    { "Type",Condition.Type}
+        ////        }
+        ////    };
+        ////    var taskList = new JArray
+        ////    {
+        ////        new JObject{
+        ////        //    { "TaskType", taskInfo.TaskType},
+        ////        //    { "Data1", taskInfo.Data1},
+        ////        //    { "Data2",taskInfo.Data2}
+        ////        }
+        ////    };
+        ////    var Actions = new JArray
+        ////    {
+        ////        new JObject{
+        ////        //    { "ConditionId", Action.ConditionId},
+        ////        //    { "DeviceAddr", Action.DeviceAddr},
+        ////        //    { "EnableCondition",Action.EnableCondition},
+        ////        //    { "EnableLogic", Action.EnableLogic},
+        ////        //    { "Epoint", Action.Epoint},
+        ////        //    { "LinkType",Action.LinkType},
+        ////        //    { "SecuritySetting", Action.SecuritySetting},
+        ////        //    { "TaskList", taskList},
+        ////        //    { "Time",Action.Time}
+        ////        }
+        ////    };
+        ////    var data = new JObject {
+        ////        { "LogicId", LogicId },
+        ////        { "IsEnable", IsEnable },
+        ////        { "LogicName", LogicName },
+        ////        { "Relationship", Relationship },
+        ////        { "Conditions", Conditions },
+        ////        { "Actions", Actions }
+        ////    };
+
+        ////    jObject.Add("Data", data);
+        ////    gateway.Send("logic/AddLogic", Common.SecuritySet.Encryption(jObject.ToString()));
+        ////}
+
+        /////<summary>
+        ///// 淇敼閫昏緫鍚嶇О銆侀�昏緫鍏崇郴銆佹槸鍚︿娇鑳�
+        ///// </summary>
+        ////public static void LogicReviseAttribute(Shared.Device.ZbGateway gateway, int LogicId, int IsEnable, string LogicName, int Relationship)
+        ////{
+        ////    var jobject = new JObject { { "Cluster_ID", 0 }, { "Command", 2001 } };
+        ////    var data = new JObject { { "LogicId", LogicId }, { "IsEnable", IsEnable }, { "LogicName", LogicName }, { "Relationship", Relationship } };
+        ////    jobject.Add("Data", data);
+        ////    gateway.Send(("Logic/ReviseAttribute"), Common.SecuritySet.Encryption((jobject.ToString())));
+        ////}
+
+        /////<summary>
+        ///// 鏂板鎴栦慨鏀归�昏緫鏉′欢
+        ///// </summary>
+        ////public static void LogicChangeCondition(Shared.Device.ZbGateway gateway, int LogicId, int ConditionId, int Type, int IsValid)
+        ////{
+        ////    var jobject = new JObject { { "Cluster_ID", 0 }, { "Command", 2005 } };
+        ////    var data = new JObject { { "LogicId", LogicId }, { "ConditionId", ConditionId }, { "Type", Type }, { "IsValid", IsValid } };
+        ////    jobject.Add("Data", data);
+        ////    gateway.Send(("Logic/ChangeCondition"), Common.SecuritySet.Encryption((jobject.ToString())));
+        ////}
+
+        /////<summary>
+        /////鍒犻櫎/鍚敤/绂佺敤閫昏緫鏉′欢
+        ///// </summary>
+        ////public static void LogicSetConditionData(Shared.Device.ZbGateway gateway, int LogicId, int ConditionId, int Operation)
+        ////{
+        ////    var jobject = new JObject { { "Cluster_ID", 0 }, { "Command", 2006 } };
+        ////    var data = new JObject { { "LogicId", LogicId }, { "ConditionId", ConditionId }, { "Operation", Operation } };
+        ////    jobject.Add("Data", data);
+        ////    gateway.Send(("Logic/SetCondition"), Common.SecuritySet.Encryption((jobject.ToString())));
+        ////}
+
+        /////<summary>
+        /////淇敼鎴栨柊澧炲姩浣滀换鍔�
+        ///// </summary>
+        ////public static void LogicChangeAction(Shared.Device.ZbGateway gateway, int LogicId, int LinkType, string DeviceAddr, int Epoint, int ConditionId, int EnableCondition, int Time, LogicObj.TaskListInfo taskInfo)
+        ////{
+        ////    var jobject = new JObject { { "Cluster_ID", 0 }, { "Command", 2007 } };
+        ////    var taskList = new JArray
+        ////    {
+        ////        new JObject{
+        ////            { "TaskType", taskInfo.TaskType},
+        ////            { "Data1", taskInfo.Data1},
+        ////            { "Data2",taskInfo.Data2}
+        ////        }
+        ////    };
+
+        ////    var data = new JObject {
+        ////        { "LogicId", LogicId },
+        ////        { "LinkType", LinkType },
+        ////        { "DeviceAddr", DeviceAddr },
+        ////        { "Epoint", Epoint },
+        ////        { "ConditionId", ConditionId },
+        ////        { "EnableCondition", EnableCondition },
+        ////        { "Time", Time },
+        ////        { "TaskList", taskList }
+        ////    };
+        ////    jobject.Add("Data", data);
+        ////    gateway.Send(("Logic/ ChangeAction"), Common.SecuritySet.Encryption((jobject.ToString())));
+        ////}
+
+        /////<summary>
+        /////鍒犻櫎鍔ㄤ綔璁惧
+        ///// </summary>
+        ////public static void LogicDelAction(Shared.Device.ZbGateway gateway, int LogicId, int Type, string DeviceAddr, int Epoint, int GwId)
+        ////{
+        ////    var jobject = new JObject { { "Cluster_ID", 0 }, { "Command", 2008 } };
+
+        ////    var data = new JObject {
+        ////        { "LogicId", LogicId },
+        ////        { "Type", Type },
+        ////        { "DeviceAddr", DeviceAddr },
+        ////        { "Epoint", Epoint },
+        ////        { "GwId", GwId }
+        ////       };
+        ////    jobject.Add("Data", data);
+        ////    gateway.Send(("Logic/DelAction"), Common.SecuritySet.Encryption((jobject.ToString())));
+        ////}
+
+        ///// <summary>
+        ///// 鍒犻櫎閫昏緫
+        ///// </summary>
+        ///// <param name="gateway">Gateway.</param>
+        ///// <param name="LogicId">Logic identifier.</param>
+        ////public static void LogicDelLogic(Shared.Device.ZbGateway gateway, int LogicId)
+        ////{
+        ////    var jobject = new JObject { { "Cluster_ID", 0 }, { "Command", 2009 } };
+
+        ////    var data = new JObject {
+        ////        { "LogicId", LogicId }
+        ////       };
+        ////    jobject.Add("Data", data);
+        ////    gateway.Send(("Logic/DelLogic"), Common.SecuritySet.Encryption((jobject.ToString())));
+        ////}
+
+        ///// <summary>
+        ///// 鎺ㄨ繜瀹氭椂
+        ///// </summary>
+        ///// <param name="gateway">Gateway.</param>
+        ///// <param name="LogicId">Logic identifier.</param>
+        ////public static void LogicTimeDelayTrigger(Shared.Device.ZbGateway gateway, int LogicId, int ConditionId)
+        ////{
+        ////    var jobject = new JObject { { "Cluster_ID", 0 }, { "Command", 2011 } };
+
+        ////    var data = new JObject {
+        ////        { "LogicId", LogicId },
+        ////        { "LogicId", ConditionId }
+        ////       };
+        ////    jobject.Add("Data", data);
+        ////    gateway.Send(("Logic/TimeDelayTrigger"), Common.SecuritySet.Encryption((jobject.ToString())));
+        ////}
+
+        ///// <summary>
+        ///// 鎵ц閫昏緫鍔ㄤ綔
+        ///// </summary>
+        ///// <param name="gateway">Gateway.</param>
+        ///// <param name="LogicId">Logic identifier.</param>
+        ////public static void LogicTestActions(Shared.Device.ZbGateway gateway, int LogicId)
+        ////{
+        ////    var jobject = new JObject { { "Cluster_ID", 0 }, { "Command", 2012 } };
+
+        ////    var data = new JObject {
+        ////        { "LogicId", LogicId }
+        ////       };
+        ////    jobject.Add("Data", data);
+        ////    gateway.Send(("Logic/TestActions"), Common.SecuritySet.Encryption((jobject.ToString())));
+        ////}
+        //#endregion
+
+        //#region 缁�
+        /////<summary >
+        /////Group
+        ///// </summary>
+        //public static void GroupID(ZigBee.Device.ZbGateway gateway)
+        //{
+        //    var jObject = new Newtonsoft.Json.Linq.JObject() {
+        //                            { "Cluster_ID", 0 },
+        //                            { "Command", 201 }
+        //                        };
+        //    gateway.Send("Group/GetNewId", Common.SecuritySet.Encryption(jObject.ToString()));
+        //}
+        //#endregion
+
+        //#region 甯冮槻涓庢挙闃诧紙鐢ㄤ簬涓荤綉鍏筹級
+        /////<summary >
+        /////绠$悊鍛樺瘑鐮佺櫥闄�
+        ///// 瀵归槻鍖恒�佸竷闃叉ā寮忕殑鎿嶄綔閮介渶瑕佺鐞嗗憳鏉冮檺銆傛墍浠ヨ瀵归槻鍖哄拰甯冮槻妯″紡杩涜鎿嶄綔闇�鍏堜互瀹夐槻绠$悊鍛樼殑韬唤杩涜鐧婚檰
+        ///// </summary>
+        //public static void SecurityAdminLogin(ZigBee.Device.ZbGateway gateway, string Password)
+        //{
+        //    var jobject = new JObject { { "Cluster_ID", 0 }, { "Command", 4001 } };
+        //    var data = new JObject { { "Password", Password } };
+        //    jobject.Add("Data", data);
+        //    gateway.Send(("Security/AdminLogin"), Common.SecuritySet.Encryption((jobject.ToString())));
+        //}
+        /////<summary >
+        /////鏂板缓鎴栦慨鏀归槻鍖�
+        /////闇�瑕佺鐞嗗憳鏉冮檺
+        ///// </summary>
+        //public static void SecurityAddNewZone(ZigBee.Device.ZbGateway gateway, int ZoneId, string ZoneName, int Bypass, int ZoneType, int ElasticBypass)
+        //{
+        //    var jobject = new JObject { { "Cluster_ID", 0 }, { "Command", 4002 } };
+        //    var data = new JObject { { "ZoneId", ZoneId }, { "ZoneName", ZoneName }, { "ZoneType", ZoneType }, { "Bypass", Bypass }, { "ElasticBypass", ElasticBypass } };
+        //    jobject.Add("Data", data);
+        //    gateway.Send(("Security/AddNewZone"), Common.SecuritySet.Encryption((jobject.ToString())));
+        //}
+
+        /////<summary >
+        /////鏂板缓鎴栦慨鏀归槻鍖�
+        /////闇�瑕佺鐞嗗憳鏉冮檺
+        ///// </summary>
+        //public static void SecurityAddEqToZone(ZigBee.Device.ZbGateway gateway, int ZoneId, string DeviceAddr, int Epoint, int MomentStatus, int TriggerZoneStatus)
+        //{
+        //    var jobject = new JObject { { "Cluster_ID", 0 }, { "Command", 4003 } };
+        //    var DeviceList = new JArray
+        //                        {
+        //                            new JObject {
+        //                                { "DeviceAddr",DeviceAddr},
+        //                                { "Epoint",Epoint},
+        //            { "MomentStatus",MomentStatus},
+        //            { "TriggerZoneStatus",TriggerZoneStatus}
+        //                            }
+        //                        };
+        //    var data = new JObject { { "ZoneId", ZoneId }, { "DeviceList", DeviceList } };
+        //    jobject.Add("Data", data);
+        //    gateway.Send(("Security/AddEqToZone"), Common.SecuritySet.Encryption((jobject.ToString())));
+        //}
+
+        /////<summary >
+        /////鏂板缓鎴栦慨鏀瑰竷闃叉ā寮�
+        ///// </summary>
+        //public static void SecurityAddNewMode(ZigBee.Device.ZbGateway gateway, int ModeId, string ModeName, int AllowWithdraw, int AllowDisable, int AllowDelay)
+        //{
+        //    var jobject = new JObject { { "Cluster_ID", 0 }, { "Command", 4004 } };
+        //    var data = new JObject { { "ModeId", ModeId }, { "ModeName", ModeName }, { "AllowWithdraw", AllowWithdraw }, { "AllowDisable", AllowDisable }, { "AllowDelay", AllowDelay } };
+        //    jobject.Add("Data", data);
+        //    gateway.Send(("Security/AddNewMode"), Common.SecuritySet.Encryption((jobject.ToString())));
+        //}
+        //#endregion
+    }
+}

--
Gitblit v1.8.0