xm
2020-12-14 d6fb0646531172f23648441c224cdcccd721b894
ZigbeeApp/Shared/Phone/ZigBee/Common/SendDataToGateway.cs
New file
@@ -0,0 +1,1184 @@
using 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 >
        /////读取当前局域网的PANID
        ///// </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 >
        /////读取协调器MAC地址
        ///// </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 >
        /////读取协调器MAC地址
        ///// </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 >
        /////设置指定设备亮度(Level)
        ////Command
        ////0:Move to Level Command
        ////4:Move to Level Command(with 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:Move to Level Command(with On/ Off)
        ////MoveMode:0: Up mode , Level 变大
        ////MoveMode1:Down 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:Move to Level Command(with On/ Off)
        ////MoveMode:0: Up mode , Level 变大
        ////MoveMode1:Down 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 >
        /////设置指定设备色度(Hue)
        /////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:stop ,停止变化色调
        /////1:up ,正方向变化色调
        /////3:down,反方向变化色调
        ///// </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 >
        /////设置指定设备色度(Hue)
        /////Step Hue
        /////1:up ,正方向变化色调
        /////3:down,反方向变化色调
        ///// </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:Move to Level Command
        /////4:Move to Level Command(with 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:Stop ,停止变化饱和度
        /////1:Up ,正方向变化,(颜色由白色变为其他色)
        /////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:up ,正方向变化
        /////3:down ,反方向变化
        ///// </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
    }
}