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