HDL Home App 第二版本 旧平台金堂用 正在使用
ZigbeeApp/Shared/Phone/ZigBee/Device/ColorDimmableLight.cs
New file
@@ -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>
        /// 标准色度值X (0-65535)
        /// </summary>
        //public string ColorX;
        /// <summary>
        /// 标准色度值Y (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>
        /// 读取当前标准色度值X
        /// </summary>
        //public void ReadCurrentX()
        //{
        //    ReadAttri(Device.Cluster_ID.ColorControl, AttriButeId.CurrentX);
        //}
        /// <summary>
        /// 读取当前标准色度值Y
        /// </summary>
        //public void ReadCurrentY()
        //{
        //    ReadAttri(Device.Cluster_ID.ColorControl, AttriButeId.CurrentY);
        //}
        #region Hue
        ///<summary >
        ///设置指定设备色度(Hue)
        ///<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:stop ,停止变化色调</para>
        ///<para>1:up ,正方向变化色调</para>
        ///<para>3:down,反方向变化色调</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 >
        ///设置指定设备色度(Hue)
        ///<para>Step Hue</para>
        ///<para>1:up ,正方向变化色调</para>
        ///<para>3:down,反方向变化色调</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:Move to Level Command</para>
        ///<para>4:Move to Level Command(with 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:Stop ,停止变化饱和度</para>
        ///<para>1:Up ,正方向变化,(颜色由白色变为其他色)</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:up ,正方向变化</para>
        ///<para>3:down ,反方向变化</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
    }
}