黄学彪
2020-12-17 9f326f4000847e6167d8166fa2f6a66f53cb3734
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
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
    }
}