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; } /// /// 彩灯的类型 /// // public string ColorCapabilities; /// /// 色度,取值范围:0-255 /// //public string Hue; /// /// 亮度,整形,取值范围:0-254表示0%-100% /// //public string Level; /// /// 饱和度,取值范围:0-255 /// //public string Saturation; /// /// 标准色度值X (0-65535) /// //public string ColorX; /// /// 标准色度值Y (0-65535) /// //public string ColorY; /// /// 强型色调值 /// //public string EnhancedCurrentHue; /// /// 读取当前饱色度 /// //public void ReadHue() //{ // ReadAttri(Device.Cluster_ID.ColorControl, AttriButeId.CurrentHue); //} /// /// 读取当前饱和度值 /// //public void ReadSaturation() //{ // ReadAttri(Device.Cluster_ID.ColorControl, AttriButeId.CurrentSaturation); //} /// /// 读取当前增强型色调值 /// //public void ReadEnhancedCurrentHue() //{ // ReadAttri(Device.Cluster_ID.ColorControl, AttriButeId.EnhancedCurrentHu); //} /// /// 读取当前标准色度值X /// //public void ReadCurrentX() //{ // ReadAttri(Device.Cluster_ID.ColorControl, AttriButeId.CurrentX); //} /// /// 读取当前标准色度值Y /// //public void ReadCurrentY() //{ // ReadAttri(Device.Cluster_ID.ColorControl, AttriButeId.CurrentY); //} #region Hue /// ///设置指定设备色度(Hue) ///0:选最短的路径到达Hue ///1:选最长的路径到达Hue ///2:正方向到达Hue ///3:反方向到达Hue /// //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())); //} /// /// Move Hue Command ///0:stop ,停止变化色调 ///1:up ,正方向变化色调 ///3:down,反方向变化色调 /// //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())); //} /// ///设置指定设备色度(Hue) ///Step Hue ///1:up ,正方向变化色调 ///3:down,反方向变化色调 /// //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())); //} /// ///设置色度和饱和度 /// //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 /// ///设置指定设备饱和度(Saturation) ///Command ///0:Move to Level Command ///4:Move to Level Command(with On/ Off) /// //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())); //} /// ///Move Saturation Command ///0:Stop ,停止变化饱和度 ///1:Up ,正方向变化,(颜色由白色变为其他色) ///3:反方向变化(颜色由其他色变为白色) /// //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())); //} /// ///Step Saturation Command ///1:up ,正方向变化 ///3:down ,反方向变化 /// //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 } }