Rev 1609 | Rev 1614 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1609 | Rev 1610 | ||
|---|---|---|---|
| Line 20... | Line 20... | ||
| 20 | } |
20 | } |
| 21 | 21 | ||
| 22 | this.Module.prototype.ReceiveMessage.call(this, id, command, variables); |
22 | this.Module.prototype.ReceiveMessage.call(this, id, command, variables); |
| 23 | } |
23 | } |
| 24 | 24 | ||
| 25 |
|
25 | function Dimmer230_complete(args) |
| 26 | { |
26 | { |
| 27 | var result = new Array(); |
27 | var result = new Array(); |
| 28 | 28 | ||
| 29 | var arg_index = args.length - 1; |
29 | var arg_index = args.length - 1; |
| 30 | 30 | ||
| Line 32... | Line 32... | ||
| 32 | { |
32 | { |
| 33 | result = Dimmer230.instance_.GetAvailableIds(); |
33 | result = Dimmer230.instance_.GetAvailableIds(); |
| 34 | } |
34 | } |
| 35 | else if (arg_index == 2) // channel |
35 | else if (arg_index == 2) // channel |
| 36 | { |
36 | { |
| 37 | result |
37 | result = [ 0 ]; |
| 38 | } |
38 | } |
| 39 | else if (arg_index > 2) |
39 | else if (arg_index > 2) |
| 40 | { |
40 | { |
| 41 | if (args[0] == "Dimmer230_StartFade") |
41 | if (args[0] == "Dimmer230_StartFade") |
| 42 | { |
42 | { |
| 43 | if (arg_index == 3) // speed |
43 | if (arg_index == 3) // speed |
| 44 | { |
44 | { |
| 45 | result.push(50); |
- | |
| 46 | result.push(135); |
- | |
| 47 | result.push(200); |
- | |
| 48 | result |
45 | result = [ 50, 135, 200, 255 ]; |
| 49 | } |
46 | } |
| 50 | else if (arg_index == 4) // direction |
47 | else if (arg_index == 4) // direction |
| 51 | { |
48 | { |
| 52 | result.push("Increase"); |
- | |
| 53 | result |
49 | result = [ "Increase", "Decrease" ]; |
| 54 | } |
50 | } |
| 55 | } |
51 | } |
| 56 | else if (args[0] == "Dimmer230_AbsoluteFade") |
52 | else if (args[0] == "Dimmer230_AbsoluteFade") |
| 57 | { |
53 | { |
| 58 | if (arg_index == 3) // speed |
54 | if (arg_index == 3) // speed |
| 59 | { |
55 | { |
| 60 | result.push(50); |
- | |
| 61 | result.push(135); |
- | |
| 62 | result.push(200); |
- | |
| 63 | result |
56 | result = [ 50, 135, 200, 255 ]; |
| 64 | } |
57 | } |
| 65 | else if (arg_index == 4) // end_value |
58 | else if (arg_index == 4) // end_value |
| 66 | { |
59 | { |
| 67 | result.push(0); |
- | |
| 68 | result.push(50); |
- | |
| 69 | result.push(100); |
- | |
| 70 | result.push(150); |
- | |
| 71 | result.push(200); |
- | |
| 72 | result |
60 | result = [ 0, 50, 100, 150, 200, 255 ]; |
| 73 | } |
61 | } |
| 74 | } |
62 | } |
| 75 | else if (args[0] == "Dimmer230_RelativeFade") |
63 | else if (args[0] == "Dimmer230_RelativeFade") |
| 76 | { |
64 | { |
| 77 | if (arg_index == 3) // speed |
65 | if (arg_index == 3) // speed |
| 78 | { |
66 | { |
| 79 | result.push(50); |
- | |
| 80 | result.push(135); |
- | |
| 81 | result.push(200); |
- | |
| 82 | result |
67 | result = [ 50, 135, 200, 255 ]; |
| 83 | } |
68 | } |
| 84 | else if (arg_index == 4) // direction |
69 | else if (arg_index == 4) // direction |
| 85 | { |
70 | { |
| 86 | result.push("Increase"); |
- | |
| 87 | result |
71 | result = [ "Increase", "Decrease" ]; |
| 88 | } |
72 | } |
| 89 | else if (arg_index == 5) // steps |
73 | else if (arg_index == 5) // steps |
| 90 | { |
74 | { |
| 91 | result.push(0); |
- | |
| 92 | result.push(10); |
- | |
| 93 | result.push(20); |
- | |
| 94 | result.push(30); |
- | |
| 95 | result.push(40); |
- | |
| 96 | result.push(50); |
- | |
| 97 | result |
75 | result = [ 0, 10, 20, 30, 40, 50, 60, 70, 80, 90 ]; |
| 98 | result.push(70); |
- | |
| 99 | result.push(80); |
- | |
| 100 | result.push(90); |
- | |
| 101 | } |
76 | } |
| 102 | } |
77 | } |
| 103 | else if (args[0] == "Dimmer230_Demo") |
78 | else if (args[0] == "Dimmer230_Demo") |
| 104 | { |
79 | { |
| 105 | if (arg_index == 3) // speed |
80 | if (arg_index == 3) // speed |
| 106 | { |
81 | { |
| 107 | result.push(50); |
- | |
| 108 | result.push(135); |
- | |
| 109 | result.push(200); |
- | |
| 110 | result |
82 | result = [ 50, 135, 200, 255 ]; |
| 111 | } |
83 | } |
| 112 | else if (arg_index == 4) // steps |
84 | else if (arg_index == 4) // steps |
| 113 | { |
85 | { |
| 114 | result.push(0); |
- | |
| 115 | result.push(10); |
- | |
| 116 | result.push(20); |
- | |
| 117 | result.push(30); |
- | |
| 118 | result.push(40); |
- | |
| 119 | result.push(50); |
- | |
| 120 | result |
86 | result = [ 0, 10, 20, 30, 40, 50, 60, 70, 80, 90 ]; |
| 121 | result.push(70); |
- | |
| 122 | result.push(80); |
- | |
| 123 | result.push(90); |
- | |
| 124 | } |
87 | } |
| 125 | } |
88 | } |
| 126 | } |
89 | } |
| 127 | 90 | ||
| 128 | return result; |
91 | return result; |
| 129 | } |
92 | } |
| 130 | 93 | ||
| 131 |
|
94 | function Dimmer230_StartFade(id, channel, speed, direction) |
| 132 | { |
95 | { |
| 133 | var variables = [ |
96 | var variables = [ |
| 134 | { "Channel" : channel }, |
97 | { "Channel" : channel }, |
| 135 | { "Speed" : speed }, |
98 | { "Speed" : speed }, |
| 136 | { "Direction" : direction } ]; |
99 | { "Direction" : direction } ]; |
| 137 | 100 | ||
| 138 | Dimmer230.instance_.Module.prototype.SendMessage.call(Dimmer230.instance_, id, "Start_Fade", variables); |
101 | Dimmer230.instance_.Module.prototype.SendMessage.call(Dimmer230.instance_, id, "Start_Fade", variables); |
| 139 | return "OK"; |
102 | return "OK"; |
| 140 | } |
103 | } |
| 141 | RegisterConsoleCommand( |
104 | RegisterConsoleCommand(Dimmer230_StartFade, Dimmer230_complete); |
| 142 | 105 | ||
| 143 | 106 | ||
| 144 |
|
107 | function Dimmer230_StopFade(id, channel) |
| 145 | { |
108 | { |
| 146 | var variables = [ |
109 | var variables = [ |
| 147 | { "Channel" : channel } ]; |
110 | { "Channel" : channel } ]; |
| 148 | 111 | ||
| 149 | Dimmer230.instance_.Module.prototype.SendMessage.call(Dimmer230.instance_, id, "Stop_Fade", variables); |
112 | Dimmer230.instance_.Module.prototype.SendMessage.call(Dimmer230.instance_, id, "Stop_Fade", variables); |
| 150 | return "OK"; |
113 | return "OK"; |
| 151 | } |
114 | } |
| 152 | RegisterConsoleCommand( |
115 | RegisterConsoleCommand(Dimmer230_StopFade, Dimmer230_complete); |
| 153 | 116 | ||
| 154 | 117 | ||
| 155 |
|
118 | function Dimmer230_AbsoluteFade(id, channel, speed, end_value) |
| 156 | { |
119 | { |
| 157 | var variables = [ |
120 | var variables = [ |
| 158 | { "Channel" : channel }, |
121 | { "Channel" : channel }, |
| 159 | { "Speed" : speed }, |
122 | { "Speed" : speed }, |
| 160 | { "EndValue" : end_value } ]; |
123 | { "EndValue" : end_value } ]; |
| 161 | 124 | ||
| 162 | Dimmer230.instance_.Module.prototype.SendMessage.call(Dimmer230.instance_, id, "Abs_Fade", variables); |
125 | Dimmer230.instance_.Module.prototype.SendMessage.call(Dimmer230.instance_, id, "Abs_Fade", variables); |
| 163 | return "OK"; |
126 | return "OK"; |
| 164 | } |
127 | } |
| 165 | RegisterConsoleCommand( |
128 | RegisterConsoleCommand(Dimmer230_AbsoluteFade, Dimmer230_complete); |
| 166 | 129 | ||
| 167 | 130 | ||
| 168 |
|
131 | function Dimmer230_RelativeFade(id, channel, speed, direction, steps) |
| 169 | { |
132 | { |
| 170 | var variables = [ |
133 | var variables = [ |
| 171 | { "Channel" : channel }, |
134 | { "Channel" : channel }, |
| 172 | { "Speed" : speed }, |
135 | { "Speed" : speed }, |
| 173 | { "Direction" : direction }, |
136 | { "Direction" : direction }, |
| 174 | { "Steps" : steps } ]; |
137 | { "Steps" : steps } ]; |
| 175 | 138 | ||
| 176 | Dimmer230.instance_.Module.prototype.SendMessage.call(Dimmer230.instance_, id, "Rel_Fade", variables); |
139 | Dimmer230.instance_.Module.prototype.SendMessage.call(Dimmer230.instance_, id, "Rel_Fade", variables); |
| 177 | return "OK"; |
140 | return "OK"; |
| 178 | } |
141 | } |
| 179 | RegisterConsoleCommand( |
142 | RegisterConsoleCommand(Dimmer230_RelativeFade, Dimmer230_complete); |
| 180 | 143 | ||
| 181 | 144 | ||
| 182 |
|
145 | function Dimmer230_Demo(id, channel, speed, steps) |
| 183 | { |
146 | { |
| 184 | var variables = [ |
147 | var variables = [ |
| 185 | { "Channel" : channel }, |
148 | { "Channel" : channel }, |
| 186 | { "Speed" : speed }, |
149 | { "Speed" : speed }, |
| 187 | { "Steps" : steps } ]; |
150 | { "Steps" : steps } ]; |
| 188 | 151 | ||
| 189 | Dimmer230.instance_.Module.prototype.SendMessage.call(Dimmer230.instance_, id, "Demo", variables); |
152 | Dimmer230.instance_.Module.prototype.SendMessage.call(Dimmer230.instance_, id, "Demo", variables); |
| 190 | return "OK"; |
153 | return "OK"; |
| 191 | } |
154 | } |
| 192 | RegisterConsoleCommand( |
155 | RegisterConsoleCommand(Dimmer230_Demo, Dimmer230_complete); |