From f71e74b5f0d2716fbf05da016cdaa18d64e09f80 Mon Sep 17 00:00:00 2001 From: xm <1271024303@qq.com> Date: 星期四, 31 十二月 2020 17:01:18 +0800 Subject: [PATCH] 又换完成最新门锁。空气质量传感器完成数据和基本配置功能。开发图表和自动化的同事可下载此代码 --- ZigbeeApp/Shared/Phone/ZigBee/Device/ColorDimmableLight.cs | 209 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 209 insertions(+), 0 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Device/ColorDimmableLight.cs b/ZigbeeApp/Shared/Phone/ZigBee/Device/ColorDimmableLight.cs new file mode 100755 index 0000000..bcb5ef6 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/ZigBee/Device/ColorDimmableLight.cs @@ -0,0 +1,209 @@ +using System; +using System.Collections.Generic; +using Newtonsoft.Json.Linq; + +namespace ZigBee.Device +{ + [System.Serializable] + public class ColorDimmableLight : LightBase + { + public ColorDimmableLight() + { + this.Type = DeviceType.ColorDimmableLight; + } + /// <summary> + /// 褰╃伅鐨勭被鍨� + /// </summary> + // public string ColorCapabilities; + + /// <summary> + /// 鑹插害锛屽彇鍊艰寖鍥达細0-255 + /// </summary> + //public string Hue; + + /// <summary> + /// 浜害锛屾暣褰紝鍙栧�艰寖鍥达細0-254琛ㄧず0%-100% + /// </summary> + //public string Level; + + /// <summary> + /// 楗卞拰搴︼紝鍙栧�艰寖鍥达細0-255 + /// </summary> + //public string Saturation; + + /// <summary> + /// 鏍囧噯鑹插害鍊糥 锛�0-65535锛� + /// </summary> + //public string ColorX; + + /// <summary> + /// 鏍囧噯鑹插害鍊糦 锛�0-65535锛� + /// </summary> + //public string ColorY; + + /// <summary> + /// 寮哄瀷鑹茶皟鍊� + /// </summary> + //public string EnhancedCurrentHue; + + /// <summary> + /// 璇诲彇褰撳墠楗辫壊搴� + /// </summary> + //public void ReadHue() + //{ + // ReadAttri(Device.Cluster_ID.ColorControl, AttriButeId.CurrentHue); + //} + + /// <summary> + /// 璇诲彇褰撳墠楗卞拰搴﹀�� + /// </summary> + //public void ReadSaturation() + //{ + // ReadAttri(Device.Cluster_ID.ColorControl, AttriButeId.CurrentSaturation); + //} + + /// <summary> + /// 璇诲彇褰撳墠澧炲己鍨嬭壊璋冨�� + /// </summary> + //public void ReadEnhancedCurrentHue() + //{ + // ReadAttri(Device.Cluster_ID.ColorControl, AttriButeId.EnhancedCurrentHu); + //} + + /// <summary> + /// 璇诲彇褰撳墠鏍囧噯鑹插害鍊糥 + /// </summary> + //public void ReadCurrentX() + //{ + // ReadAttri(Device.Cluster_ID.ColorControl, AttriButeId.CurrentX); + //} + + /// <summary> + /// 璇诲彇褰撳墠鏍囧噯鑹插害鍊糦 + /// </summary> + //public void ReadCurrentY() + //{ + // ReadAttri(Device.Cluster_ID.ColorControl, AttriButeId.CurrentY); + //} + + #region Hue + ///<summary > + ///璁剧疆鎸囧畾璁惧鑹插害锛圚ue锛� + ///<para>0锛氶�夋渶鐭殑璺緞鍒拌揪Hue</para> + ///<para>1锛氶�夋渶闀跨殑璺緞鍒拌揪Hue</para> + ///<para>2锛氭鏂瑰悜鍒拌揪Hue</para> + ///<para>3锛氬弽鏂瑰悜鍒拌揪Hue</para> + /// </summary> + //public void SetHue(int value) + //{ + + // var jobject = new JObject { + // { "DeviceAddr", DeviceAddr }, + // { "Epoint", DeviceEpoint }, + // { "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 + ///<para>0锛歴top 锛屽仠姝㈠彉鍖栬壊璋�</para> + ///<para>1锛歶p 锛屾鏂瑰悜鍙樺寲鑹茶皟</para> + ///<para>3锛歞own锛屽弽鏂瑰悜鍙樺寲鑹茶皟</para> + /// </summary> + //public void MoveHue(int MoveMode) + //{ + // var jobject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", DeviceEpoint }, { "Cluster_ID", 768 }, { "Command", 1 }, { "SendMode", 2 } }; + // var data = new JObject { { "MoveMode", MoveMode }, { "Rate", 10 } }; + // jobject.Add("Data", data); + // Gateway?.Send("DeviceControl", Common.SecuritySet.Encryption(jobject.ToString())); + //} + + ///<summary > + ///璁剧疆鎸囧畾璁惧鑹插害锛圚ue锛� + ///<para>Step Hue</para> + ///<para>1锛歶p 锛屾鏂瑰悜鍙樺寲鑹茶皟</para> + ///<para>3锛歞own锛屽弽鏂瑰悜鍙樺寲鑹茶皟</para> + /// </summary> + //public void StepHue(int StepMode) + //{ + // var jobject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", DeviceEpoint }, { "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 void setHueAndStaturation(int Hue, int Saturation) + //{ + // var jobject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", DeviceEpoint }, { "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锛� + ///<para>Command</para> + ///<para>0锛歁ove to Level Command</para> + ///<para>4锛歁ove to Level Command锛坵ith On/ Off锛�</para> + /// </summary> + //public void SetSaturation(int value) + //{ + // var jobject = new JObject { + // { "DeviceAddr", DeviceAddr }, + // { "Epoint", DeviceEpoint }, + // { "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 + ///<para>0锛歋top 锛屽仠姝㈠彉鍖栭ケ鍜屽害</para> + ///<para>1锛歎p 锛屾鏂瑰悜鍙樺寲,(棰滆壊鐢辩櫧鑹插彉涓哄叾浠栬壊锛�</para> + ///<para>3锛氬弽鏂瑰悜鍙樺寲锛堥鑹茬敱鍏朵粬鑹插彉涓虹櫧鑹诧級</para> + /// </summary> + //public void MoveUpSaturation(int MoveMode) + //{ + // var jobject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", DeviceEpoint }, { "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 + ///<para>1锛歶p 锛屾鏂瑰悜鍙樺寲</para> + ///<para>3锛歞own 锛屽弽鏂瑰悜鍙樺寲</para> + /// </summary> + //public void StepSaturation(int StepMode) + //{ + // var jobject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", DeviceEpoint }, { "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 + } +} + -- Gitblit v1.8.0