using System; using System.Collections.Generic; using Newtonsoft.Json.Linq; namespace ZigBee.Device { [System.Serializable] public class HDLbutton : LightBase { public HDLbutton() { this.Type = DeviceType.OnOffSwitch; } //#region 读取按键信息 /////// /////// 读取按键信息 /////// gateway:当前网关 /////// ////public static async System.Threading.Tasks.Task GetHdlKeyDataAsync(ZigBee.Device.ZbGateway gateway) ////{ //// if (gateway == null) //// { //// return null; //// } //// return await System.Threading.Tasks.Task.Run(async () => //// { //// var d = new HdlKeyAllData { }; //// Action action = (topic, message) => //// { //// var gatewayID = topic.Split('/')[0]; //// var jobject = Newtonsoft.Json.Linq.JObject.Parse(message); //// if (topic == gatewayID + "/" + "Error_Respon") //// { //// var gatewayTemp = new ZbGateway() { Time = jobject.Value("Time"), DataID = jobject.Value("Data_ID"), CurrentGateWayId = gateway.getGatewayBaseInfo.gwID }; //// var temp = Newtonsoft.Json.JsonConvert.DeserializeObject(jobject["Data"].ToString()); //// if (temp == null) //// { //// d.errorMessageBase = "网关错误回复,且数据是空"; //// } //// else //// { //// d.errorResponData = temp; //// d.errorMessageBase = ErrorMess(temp.Error); //// } //// } //// if (topic == gatewayID + "/" + "hdlButton/GetInfo_Respon") //// { //// var gatewayTemp = new ZbGateway() { DeviceID = jobject.Value("Device_ID"), DeviceAddr = jobject.Value("DeviceAddr"), DeviceEpoint = jobject.Value("Epoint"), DataID = jobject.Value("Data_ID"), CurrentGateWayId = gateway.getGatewayBaseInfo.gwID }; //// var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject(jobject["Data"].ToString()); //// if (tempData == null) //// { //// d.errorMessageBase = "网关返回的数据为空"; //// } //// else //// { //// d.hdlKeyInfo = tempData; //// } //// } //// }; //// gateway.Actions += action; //// System.Console.WriteLine("hdlButton/GetInfo_Actions 启动" + "_" + gateway.getGatewayBaseInfo.gwID + System.DateTime.Now.ToString()); //// var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 92 } }; //// gateway.Send("GetZbGwVersion", Common.SecuritySet.Encryption(jObject.ToString())); //// var dateTime = DateTime.Now; //// while ((DateTime.Now - dateTime).TotalMilliseconds < 1000) //// { //// await System.Threading.Tasks.Task.Delay(10); //// if (d.hdlKeyInfo != null) //// { //// break; //// } //// } //// if ((DateTime.Now - dateTime).TotalMilliseconds > 10000) //// { //// d.errorMessageBase = " 回复超时,请重新操作"; //// } //// gateway.Actions -= action; //// System.Console.WriteLine("hdlButton/GetInfo_Actions 退出" + System.DateTime.Now.ToString()); //// return d; //// }); ////} /////// /////// 读取按键信息,网关反馈信息 /////// ////public HdlKeyAllData hdlKeyAllData; ////[System.Serializable] ////public class HdlKeyAllData ////{ //// /// //// /// 错误信息 //// /// //// public string errorMessageBase; //// /// //// /// 网关信息错误反馈 //// /// 当网关接收到客户端信息后,出现以下异常情况将反馈错误。 //// /// //// public ErrorResponData errorResponData; //// /// //// /// 网关版本信息 //// /// //// public HdlKeyInfo hdlKeyInfo; ////} /////// /////// 读取按键信息 /////// ////public HdlKeyInfo hdlButtonGetInfoData; ////[System.Serializable] ////public class HdlKeyInfo ////{ //// /// //// /// 按键号对应相应的端点号,用来匹配源端点 //// /// //// public int Endpoint; //// /// //// ///按键号类型 //// ///Bit0-触摸开关,可位或 //// ///Bit1-机械开关,可位或 //// ///Bit2-弹性开关,可位或 //// /// //// public int ButtonType; //// /// //// ///按键号功能类型 //// ///Bit0-绑定功能,可位或 //// ///Bit1-条件逻辑功能,可位或 //// /// //// public int Function; //// /// //// ///按键号模式 //// ///Bit0-仅单击,可位或 //// ///Bit1-前单击,可位或 //// ///Bit2-后单击,可位或 //// ///Bit3-仅双击,可位或 //// ///Bit4-前双击,可位或 //// ///Bit5-后双击,可位或 //// ///Bit6-仅长按,可位或 //// ///Bit7-前长按,可位或 //// ///Bit8-后长按,可位或 //// ///Bit9-长按释放,可位或 //// /// //// public int ButtonMode; //// /// //// ///按键物理应用功能 //// ///Bit0-是否支持锁键(0:否;1:是),可位或 //// ///Bit1-是否支持本地互斥(0:否;1:是),可位或 //// /// //// public int PhyFunction; ////} //#endregion ///// ///// 绑定的场景列表 ///// //[Newtonsoft.Json.JsonIgnore] //public System.Collections.Generic.Dictionary> BindedDeviceFilePathList = new Dictionary>(); ///// ///// 获取所有绑定(用于主网关) ///// //public hdlButtonGetAllBind hdlButtonGetAllBindData; //[System.Serializable] //public class hdlButtonGetAllBind //{ // /// // ///绑定信息总量 // /// 当BindSum大于0时 ,下面字段才存在 // /// // public int BindSum; // /// // ///当前发送的绑定信息序号。BindNum从1开始,每发送一条绑定信息将自加1,直到BindNum等于BindSum表示所有绑定信息发送完毕。 // /// // public int BindNum; // /// // ///绑定名称 // /// // public string BindName; // /// // ///按键设备Mac地址 // /// // public string ButtonMacAddr; // /// // ///按键号,对应相应的端点号, // ///用来匹配源端点 // /// // public int ButtonEpoint; // /// // ///按键号模式 // ///1:点击 2:前点击 4:后单击 8:仅双击 // ///16:前双击 32:后双击 64:仅长按 // ///128:前长按 256:后长按 512:长按释放 // /// // public int ButtonMode; // /// // ///按键号类型: // ///Bit0-触摸开关,不可位或 // ///Bit1-机械开关,不可位或 // ///Bit2-弹性开关,不可位或 // /// // public int ButtonType; // /// // ///绑定的簇id // /// // public int BindClusterId; // /// // ///绑定设备的命令id // /// // public int BindCmdId; // /// // ///参数列表 // /// // public List ParameterList = new List(); // /// // ///绑定列表 ,当Status=0时存在 // /// // public List ButtonList = new List(); //} ///// ///// 参数列表参数 ///// //public class ParameterObj//协议格式顺序有错 //{ // /// // /// 参数长度,占用的字节数。 // /// // public int Length { get; set; } // /// // ///参数值 // /// // public int Value { get; set; } //} ///// ///// hdl按键绑定列表参数 ///// //public class GetAllBindListObj:CommonDevice //{ // /// // /// 绑定类型 // ///0:绑定设备,同网关设备间的绑定 // ///1:绑定设备,跨网关设备间的绑定 // ///2:绑定场景 // /// // public int BindType { get; set; } // /// // ///绑定设备Mac地址, 当BindType=0或1时存在 // /// // public string BindMacAddr { get; set; } // /// // /// 绑定设备的端口号,当BindType=0或1时存在 // /// // public int BindEpoint { get; set; } // /// // /// 绑定场景,当BindType=2时存在 // /// // public int BindScenesId { get; set; } // /// // ///绑定的设备或场景名称 // /// // public string ESName{ get; set; } //} ///// ///// 读取按键信息 ///// //public hdlButtonGetInfo hdlButtonGetInfoData; //[System.Serializable] //public class hdlButtonGetInfo //{ // public int ButtonMode; // /// // ///按键物理应用功能 // ///Bit0-是否支持锁键(0:否;1:是),可位或 // ///Bit1-是否支持本地互斥(0:否;1:是),可位或 // /// // public int PhyFunction; // /// // ///按键号对应相应的端点号, // ///用来匹配源端点 // /// // public int Endpoint; // /// // ///按键号类型 // //Bit0-触摸开关,可位或 // ///Bit1-机械开关,可位或 // ///Bit2-弹性开关,可位或 // /// // public int ButtonType; // /// // ///按键号功能类型 // /// Bit0-绑定功能,可位或 // ///Bit1-条件逻辑功能,可位或 // /// // public int Function; // /// // ///按键号模式 // ///Bit0-仅单击,可位或 // ///Bit1-前单击,可位或 // ///Bit2-后单击,可位或 // ///Bit3-仅双击,可位或 // ///Bit4-前双击,可位或 // ///Bit5-后双击,可位或 // ///Bit6-仅长按,可位或 // ///Bit7-前长按,可位或 // ///Bit8-后长按,可位或 // ///Bit9-长按释放,可位或 // /// //} ///// ///// 配置绑定属性(用于主网关) ///// //public hdlButtonSetBindAttribute hdlButtonSetBindAttributeData; //[System.Serializable] //public class hdlButtonSetBindAttribute //{ // /// // ///按键号,对应相应的端点号, // ///用来匹配源端点 // /// // public int ButtonEpoint; // /// // ///按键号类型 // //按键号模式 // ///1:点击 2:前点击 4:后单击 8:仅双击 // ///16:前双击 32:后双击 64:仅长按 // ///128:前长按 256:后长按 512:长按释放 // /// // public int ButtonMode; // /// // ///按键号类型: // /// Bit0-触摸开关,不可位或 // ///Bit1-机械开关,不可位或 // ///Bit2-弹性开关,不可位或 // /// // public int ButtonType; // /// // ///绑定名称,最大32个字符 // /// // public string BindName; // /// // ///0:未知,需要按键设备对修改结果进行确认。 // ///1:失败,当前网关不是主网关,无法进行属性配置。 // /// // public int Result; //} ///// ///// 按键设备配置绑定属性上报 ///// //public hdlButtonBindAttributeConfig hdlButtonBindAttributeConfigData; //[System.Serializable] //public class hdlButtonBindAttributeConfig //{ // /// // ///0:未知,需要按键设备对修改结果进行确认。 // ///1:失败,当前网关不是主网关,无法进行属性配置。 // /// // public int Result; // /// // ///按键号,对应相应的端点号, // ///用来匹配源端点 // /// // public int ButtonEpoint; // /// // ///按键号类型 // //按键号模式 // ///1:点击 2:前点击 4:后单击 8:仅双击 // ///16:前双击 32:后双击 64:仅长按 // ///128:前长按 256:后长按 512:长按释放 // /// // public int ButtonMode; // /// // ///按键号类型: // /// Bit0-触摸开关,不可位或 // ///Bit1-机械开关,不可位或 // ///Bit2-弹性开关,不可位或 // /// // public int ButtonType; // /// // ///绑定名称,最大32个字符 // /// // public string BindName; // /// // ///绑定的簇id // /// // public int BindClusterId; // /// // ///按键号类型 // ///绑定设备的命令id // /// // public int BindCmdId; // /// // ///参数列表 // /// // public List ParameterList = new List(); //} ///// ///// 设备绑定,(用于主网关) ///// 绑定失败、跨网关设备间的绑定,场景绑定的结果将直接由网关反馈 ///// //public hdlButtonSetBind hdlButtonSetBindData; //[System.Serializable] //public class hdlButtonSetBind //{ // /// // ///按键号,对应相应的端点号, // ///用来匹配源端点 // /// // public int ButtonEpoint; // /// // ///按键号模式 // ///1:点击 2:前点击 4:后单击 8:仅双击 // /// /// 16:前双击 32:后双击 64:仅长按 // ///128:前长按 256:后长按 512:长按释放 // /// // public int ButtonMode; // /// // ///按键号类型: // /// 按键号类型: // /// Bit0-触摸开关,不可位或 // ///Bit1-机械开关,不可位或 // ///Bit2-弹性开关,不可位或 // /// // public int ButtonType; // /// // /// Status // ///0:正常 // ///1:不可绑定,需先对按键在指定按键模式下配置绑定属性方可创建绑定。 // ///2:当前网关不是主网关。不能创建绑定。 // /// // public int Status; // /// // ///绑定列表 ,当Status=0时存在 // /// // public List BindList = new List(); //} ///// ///// hdl按键绑定列表参数 ///// //public class BindListObj//协议格式顺序有错 //{ // /// // ///绑定设备Mac地址, 当BindType=0或1时存在 // /// // public string BindMacAddr { get; set; } // /// // /// 绑定设备的端口号,当BindType=0或1时存在 // /// // public int BindEpoint { get; set; } // /// // /// 绑定类型 // ///0:绑定设备,同网关设备间的绑定 // ///1:绑定设备,跨网关设备间的绑定 // ///2:绑定场景 // /// // public int BindType { get; set; } // /// // /// 0:加入成功(该状态只适用用于跨网关绑定和绑定场景。同网关设备间的绑定需要节点设备的确认成功信息,不会直接反馈成功。) // ///1:失败,设备已在绑定列表中 // ///2:失败,节点设备或场景不存在。 // ///3:失败,在等待节点设备确认是否绑定成功(当网关还在等待某节点设备确认是否绑定成功的反馈信息时,客户端再次发送绑定该节点设备的指令,将反馈该状态。) // ///4:未知,由节点设备反馈发送“hdlButton/BindResult”主题消息确定是否成功。 // /// // public int Result { get; set; } // /// // /// 绑定场景,当BindType=1时存在 // /// // public int BindScenesId { get; set; } // /// // ///绑定的设备或场景的名称 // /// // public string ESName { get; set; } //} ///// ///// 设备绑定,用于主网关) ///// 本地设备间的绑定 ,是否成功需要等待hdl按键设备的确认 ///// //public hdlButtonBindResult hdlButtonBindResultData; //[System.Serializable] //public class hdlButtonBindResult //{ // /// // ///按键号,对应相应的端点号, // ///用来匹配源端点 // /// // public int ButtonEpoint; // /// // ///按键号模式 // ///1:点击 2:前点击 4:后单击 8:仅双击 // /// 16:前双击 32:后双击 64:仅长按 // ///128:前长按 256:后长按 512:长按释放 // /// // public int ButtonMode; // /// // ///绑定结果 // ///0:成功 // ///1:失败 // ///2:无效 // /// // public int Result; // /// // ///绑定设备Mac地址 // /// // public string BindMacAddr; // /// // /// 绑定设备的端口号 // /// // public int BindEpoint; //} ///// ///// 移除绑定(用于主网关) ///// //public hdlButtonRemoveBind hdlButtonRemoveBindData; //[System.Serializable] //public class hdlButtonRemoveBind //{ // /// // ///0:正常 // ///1:绑定不存在 // ///2:当前网关不是主网关。不能解除绑定。 // /// // public int Status; // /// // ///按键号,对应相应的端点号, // ///用来匹配源端点 // /// // public int ButtonEpoint; // /// // ///按键号模式 // ///1:点击 2:前点击 4:后单击 8:仅双击 // /// /// 16:前双击 32:后双击 64:仅长按 // ///128:前长按 256:后长按 512:长按释放 // /// // public int ButtonMode; // /// // ///按键号类型: // /// 按键号类型: // /// Bit0-触摸开关,不可位或 // ///Bit1-机械开关,不可位或 // ///Bit2-弹性开关,不可位或 // /// // public int ButtonType; // /// // ///绑定列表 ,当Status=0时存在。 // /// // public List RemoveBindList = new List(); //} ///// ///// 移除绑定(用于主网关) ///// //public hdlButtonRemoveBindResult hdlButtonRemoveBindResultData; //[System.Serializable] //public class hdlButtonRemoveBindResult //{ // /// // ///按键号,对应相应的端点号, // ///用来匹配源端点 // /// // public int ButtonEpoint; // /// // ///按键号模式 // ///1:点击 2:前点击 4:后单击 8:仅双击 // /// /// 16:前双击 32:后双击 64:仅长按 // ///128:前长按 256:后长按 512:长按释放 // /// // public int ButtonMode; // /// // ///按键号类型: // /// 按键号类型: // /// Bit0-触摸开关,不可位或 // ///Bit1-机械开关,不可位或 // ///Bit2-弹性开关,不可位或 // /// // public int ButtonType; // /// // ///0:成功 // ///1:失败 // ///2:无效 // /// // public int Result; // /// // ///绑定设备Mac地址 // /// // public string BindMacAddr; // /// // /// 绑定设备的端口号 // /// // public int BindEpoint; // } ///// ///// hdl按键绑定列表参数 ///// //public class RemoveBindListObj//协议格式顺序有错 //{ // /// // ///0:移除成功(该状态只适用用于跨网关绑定、绑定场景、失效设备(设备已经从网关的设备列表中删除)。同网关设备间的解除绑定需要节点设备的确认成功信息,不会直接反馈成功。) // ///1:失败,设备不在绑定列表中 // ///3:失败,在等待节点设备确认是否解除绑定成功(当网关还在等待某节点设备确认是否解除绑定成功的反馈信息时,客户端再次发送解除绑定该节点设备的指令,将反馈该状态。) // ///4:未知,由节点设备反馈发送“hdlButton/RemoveBindResult”主题消息确定是否成功。 // /// // public int Result { get; set; } // /// // /// 绑定类型 // ///0:移除设备,同网关设备间的移除 // ///1:移除设备,跨网关设备间的移除 // ///2:移除绑定场景 // /// // public int BindType { get; set; } // /// // ///绑定设备Mac地址, 当BindType=0或1时存在 // /// // public string BindMacAddr { get; set; } // /// // /// 绑定设备的端口号,当BindType=0或1时存在 // /// // public int BindEpoint { get; set; } // /// // /// 绑定场景,当BindType=1时存在 // /// // public int BindScenesId { get; set; } // /// // ///绑定的设备或场景名称 // /// // public string ESName; //} ///// ///// 删除按键功能(用于主网关) ///// //public hdlButtonDelButtonFunction hdlButtonDelButtonFunctionData; //[System.Serializable] //public class hdlButtonDelButtonFunction //{ // /// // ///按键号,对应相应的端点号, // ///用来匹配源端点 // /// // public int ButtonEpoint; // /// // ///按键号模式 // ///1:点击 2:前点击 4:后单击 8:仅双击 // /// /// 16:前双击 32:后双击 64:仅长按 // ///128:前长按 256:后长按 512:长按释放 // /// // public int ButtonMode; // /// // ///结果: // ///0:成功,当该按键设备已经失效(按键设备已经从网关的设备列表删除)将直接删除该按键功能。 // ///1:失败,当前网关不是主网关不能进行此操作。 // ///2: 未知,需由按键设备对删除结果进行确认 // /// // public int Result; //} ///// ///// 按键设备删除功能确认信息上报 ///// //public hdlButtonDelButtonFunctionResult hdlButtonDelButtonFunctionResultData; //[System.Serializable] //public class hdlButtonDelButtonFunctionResult //{ // /// // ///按键号,对应相应的端点号, // ///用来匹配源端点 // /// // public int ButtonEpoint; // /// // ///按键号模式 // ///1:点击 2:前点击 4:后单击 8:仅双击 // /// /// 16:前双击 32:后双击 64:仅长按 // ///128:前长按 256:后长按 512:长按释放 // /// // public int ButtonMode; // /// // ///结果: // ///0:成功。 // ///1:失败 // /// // public int Result; //} ///// ///// 修改绑定名称(用于主网关) ///// //public hdlButtonBindRename hdlButtonBindRenameData; //[System.Serializable] //public class hdlButtonBindRename //{ // /// // ///0:成功。 // ///1:失败,当前网关不是主网关,无法进行属性配置。 // ///2:失败,绑定不存在。 // /// // public int Result; // /// // ///绑定设备Mac地址 // /// // public string ButtonMacAddr; // /// // /// 按键号,对应相应的端点号, // ///用来匹配源端点 // /// // public int ButtonEpoint; // /// // ///按键号模式 // ///1:点击 2:前点击 4:后单击 8:仅双击 // ///16:前双击 32:后双击 64:仅长按 // ///128:前长按 256:后长按 512:长按释放 // /// // public int ButtonMode; // /// // ///按键号类型: // ///Bit0-触摸开关,不可位或 // ///Bit1-机械开关,不可位或 // ///Bit2-弹性开关,不可位或 // /// // public int ButtonType; // /// // ///绑定名称,最大32个字符 // /// // public string BindName; //} ///// ///// hdl按键绑定列表参数 ///// //public class BindListDeviceInfo//协议格式顺序有错 //{ // /// // /// 绑定类型 // ///0:绑定设备,同网关设备间的绑定 // ///1:绑定设备,跨网关设备间的绑定 // ///2:绑定场景 // /// // public int BindType { get; set; } // /// // ///绑定设备Mac地址, 当BindType=0或1时存在 // /// // public string BindMacAddr { get; set; } // /// // /// 绑定设备的端口号,当BindType=0或1时存在 // /// // public int BindEpoint { get; set; } //} ///// ///// hdl按键绑定列表参数 ///// //public class BindSceneInfo//协议格式顺序有错 //{ // /// // /// 绑定类型 // ///0:绑定设备,同网关设备间的绑定 // ///1:绑定设备,跨网关设备间的绑定 // ///2:绑定场景 // /// // public int BindType { get; set; } // /// // /// 绑定场景,当BindType=1时存在 // /// // public int BindScenesId { get; set; } //} ///// ///// hdl按键绑定列表参数 ///// //public class RemoveBindListInfo //{ // /// // /// 绑定类型 // ///0:移除设备,同网关设备间的移除 // ///1:移除设备,跨网关设备间的移除 // ///2:移除绑定场景 // /// // public int BindType { get; set; } // /// // ///绑定设备Mac地址, 当BindType=0或1时存在 // /// // public string BindMacAddr { get; set; } // /// // /// 绑定设备的端口号,当BindType=0或1时存在 // /// // public int BindEpoint { get; set; } //} ///// ///// hdl按键绑定列表参数 ///// //public class RemoveSceneBindListInfo //{ // /// // /// 绑定类型 // ///0:移除设备,同网关设备间的移除 // ///1:移除设备,跨网关设备间的移除 // ///2:移除绑定场景 // /// // public int BindType { get; set; } // /// // ///绑定场景,当BindType=1时存在 // /// // public int BindScenesId { get; set; } //} //#region Hdl按键 ///// /////获取所有绑定(用于主网关) ///// //public void GetAllBindPublish() //{ // var jobject = new JObject { { "Cluster_ID", 64528 }, { "Command", 10 } }; // CurrentGateWayId = Gateway?.CurrentGateWayId; // Gateway?.Send(("hdlButton/BindInfo"), Common.SecuritySet.Encryption((jobject.ToString()))); //} ///// /////读取按键信息 ///// //public void GetInfoPublish(ZigBee.Device.ZbGateway gateway, string buttonMacAddr, int epoint, int endpoint) //{ // var jobject = new JObject { { "DeviceAddr", DeviceAddr }, { "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()))); //} ///// /////配置锁键 ///// IsLock ///// 0:不锁 /////1:锁 ///// //public void LockPublish(int endpoint, int isLock) //{ // var jobject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", DeviceEpoint }, { "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()))); //} ///// /////配置绑定属性(用于主网关) ///// IsLock ///// 0:不锁 /////1:锁 ///// //public void SetBindAttributePublish(int buttonMode, int buttonType, string bindName, int bindClusterId, int bindCmdId) //{ // var jobject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", DeviceEpoint }, { "Cluster_ID", 64528 }, { "Command", 4 } }; // var ParameterList = new JArray{ // new JObject {} // }; // var data = new JObject { { "ButtonEpoint", DeviceEpoint }, // { "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()))); //} ///// /////设备绑定(用于主网关) ///// 绑定设备 ///// //public void SetBindPublish(BindListDeviceInfo bindListObj,int buttonMode, int buttonType) //{ // var jobject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", DeviceEpoint }, { "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", DeviceEpoint }, // { "ButtonMode", buttonMode },{ "ButtonType", buttonType }, // { "BindList", bindList } // }; // jobject.Add("Data", data); // Gateway?.Send(("hdlButton/SetBind"), Common.SecuritySet.Encryption((jobject.ToString()))); //} ///// /////设备绑定(用于主网关) ///// 绑定场景,当BindType=1时存在 ///// //public void SetSceneBindPublish(BindSceneInfo bindListObj,int buttonMode, int buttonType) //{ // var jobject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", DeviceEpoint }, { "Cluster_ID", 64528 }, { "Command", 6 } }; // var bindList = new JArray{ // new JObject {{ "BindType", bindListObj.BindType},{ "BindScenesId", bindListObj.BindScenesId}} // }; // var data = new JObject { { "ButtonEpoint", DeviceEpoint }, // { "ButtonMode", buttonMode },{ "ButtonType", buttonType }, // { "BindList", bindList } // }; // jobject.Add("Data", data); // Gateway?.Send(("hdlButton/SetBind"), Common.SecuritySet.Encryption((jobject.ToString()))); //} ///// /////移除绑定(用于主网关) ///// /// BindScenesId,绑定场景,当BindType=1时存在 ///// //public void RemoveBindPublish(RemoveBindListInfo removeListObj,int buttonMode, int buttonType) //{ // var jobject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", DeviceEpoint }, { "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", DeviceEpoint }, // { "ButtonMode", buttonMode },{ "ButtonType", buttonType }, // { "RemoveBindList", removeBindList } // }; // jobject.Add("Data", data); // Gateway?.Send(("hdlButton/RemoveBind"), Common.SecuritySet.Encryption((jobject.ToString()))); //} ///// /////移除绑定(用于主网关) ///// /// BindScenesId,绑定场景,当BindType=1时存在 ///// //public void RemoveSceneBindPublish(RemoveSceneBindListInfo removeListObj,int buttonMode, int buttonType) //{ // var jobject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", DeviceEpoint }, { "Cluster_ID", 64528 }, { "Command", 7 } }; // var removeBindList = new JArray{ // new JObject {{ "BindType", removeListObj.BindType},{ "BindScenesId", removeListObj.BindScenesId}} // }; // var data = new JObject { { "ButtonEpoint", DeviceEpoint }, // { "ButtonMode", buttonMode },{ "ButtonType", buttonType }, // { "RemoveBindList", removeBindList } // }; // jobject.Add("Data", data); // Gateway?.Send(("hdlButton/RemoveBind"), Common.SecuritySet.Encryption((jobject.ToString()))); //} ///// /////删除按键功能(用于主网关) ///// buttonMode设为0xffff 65536 ,直接清除按键号下所有按键模式的绑定 ///// //public void DelButtonFunctionPublish(int buttonMode) //{ // var jobject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", DeviceEpoint }, { "Cluster_ID", 64528 }, { "Command", 8 } }; // var data = new JObject { { "ButtonEpoint", DeviceEpoint}, // { "ButtonMode", buttonMode } // }; // jobject.Add("Data", data); // Gateway?.Send(("hdlButton/DelButtonFunction"), Common.SecuritySet.Encryption((jobject.ToString()))); //} ///// /////修改绑定名称(用于主网关) ///// //public void BindRenamePublish(int buttonMode, int buttonType, string bindName) //{ // var jobject = new JObject { { "Cluster_ID", 64528 }, { "Command", 9 } }; // var data = new JObject { { "ButtonMacAddr", DeviceAddr }, // { "ButtonEpoint", DeviceEpoint },{ "ButtonMode", buttonMode }, // { "ButtonType", buttonType }, // { "BindName", bindName } // }; // jobject.Add("Data", data); // Gateway?.Send(("hdlButton/BindRename"), Common.SecuritySet.Encryption((jobject.ToString()))); //} //#endregion } }