1 | //#ifndef SISPMCTL_H |
---|
2 | //#define SISPMCTL_H |
---|
3 | |
---|
4 | |
---|
5 | |
---|
6 | struct clist *myconfig[LISTHASHSIZE] = {NULL}; |
---|
7 | char* sispmctlconf = NULL; |
---|
8 | struct stimerthread* sispmctl_checkthread = NULL; |
---|
9 | int startextern = 0; |
---|
10 | int stopextern = 0; |
---|
11 | |
---|
12 | int sispmctl_Anzeige() |
---|
13 | { |
---|
14 | int anzmenu = 0; |
---|
15 | int ende = 0; |
---|
16 | int rcret = 0; |
---|
17 | int statb1 = 0; |
---|
18 | int statb2 = 0; |
---|
19 | int statb3 = 0; |
---|
20 | int statb4 = 0; |
---|
21 | |
---|
22 | char* zeile = NULL; |
---|
23 | char* cmd = NULL; |
---|
24 | |
---|
25 | char* red = NULL; |
---|
26 | char* yellow = NULL; |
---|
27 | char* green = NULL; |
---|
28 | char* menu = NULL; |
---|
29 | |
---|
30 | struct skin* load = getscreen("loading"); |
---|
31 | |
---|
32 | struct skin* sis_anzeige = getscreen("sis_anzeige"); |
---|
33 | struct skin* buttonbar = getscreennode(sis_anzeige, "buttonbar"); |
---|
34 | struct skin* b1 = getscreennode(sis_anzeige, "b1"); |
---|
35 | struct skin* b2 = getscreennode(sis_anzeige, "b2"); |
---|
36 | struct skin* b3 = getscreennode(sis_anzeige, "b3"); |
---|
37 | struct skin* b4 = getscreennode(sis_anzeige, "b4"); |
---|
38 | struct skin* m1 = getscreennode(sis_anzeige, "m1"); |
---|
39 | |
---|
40 | struct skin* tmp = NULL; |
---|
41 | |
---|
42 | red = createpluginpath("/sispmctl/picons/key_red_22.png", 0); |
---|
43 | yellow = createpluginpath("/sispmctl/picons/key_yellow_22.png", 0); |
---|
44 | green = createpluginpath("/sispmctl/picons/key_green_22.png", 0); |
---|
45 | menu = createpluginpath("/sispmctl/picons/key_menu_70x40.png", 0); |
---|
46 | |
---|
47 | changetext(b1, getlist(myconfig, "g1_name", NULL)); |
---|
48 | changetext(b2, getlist(myconfig, "g2_name", NULL)); |
---|
49 | changetext(b3, getlist(myconfig, "g3_name", NULL)); |
---|
50 | changetext(b4, getlist(myconfig, "g4_name", NULL)); |
---|
51 | |
---|
52 | |
---|
53 | while(1) |
---|
54 | { |
---|
55 | drawscreen(load, 0, 0); |
---|
56 | ende = 0; |
---|
57 | cmd = ostrcat(createpluginpath("/sispmctl/bin/sispmctl", 0), " -g1 > /tmp/helpsis", 0, 0); |
---|
58 | system(cmd); |
---|
59 | free(cmd); cmd = NULL; |
---|
60 | zeile = readsys("/tmp/helpsis", 2); |
---|
61 | printf("->%s<-\n", zeile); |
---|
62 | if(zeile == NULL) |
---|
63 | { |
---|
64 | changepic(b1, yellow); |
---|
65 | changepic(b2, yellow); |
---|
66 | changepic(b3, yellow); |
---|
67 | changepic(b4, yellow); |
---|
68 | statb1 = 2; |
---|
69 | statb2 = 2; |
---|
70 | statb3 = 2; |
---|
71 | statb4 = 2; |
---|
72 | } |
---|
73 | else |
---|
74 | { |
---|
75 | if(ostrstr(zeile, "on") != NULL) |
---|
76 | { |
---|
77 | changepic(b1, green); |
---|
78 | statb1 = 1; |
---|
79 | } |
---|
80 | else |
---|
81 | { |
---|
82 | changepic(b1, red); |
---|
83 | statb1 = 0; |
---|
84 | } |
---|
85 | free(zeile); zeile = NULL; |
---|
86 | |
---|
87 | cmd = ostrcat(createpluginpath("/sispmctl/bin/sispmctl", 0), " -g2 > /tmp/helpsis", 0, 0); |
---|
88 | system(cmd); |
---|
89 | free(cmd); cmd = NULL; |
---|
90 | zeile = readsys("/tmp/helpsis", 2); |
---|
91 | if(ostrstr(zeile, "on") != NULL) |
---|
92 | { |
---|
93 | changepic(b2, green); |
---|
94 | statb2 = 1; |
---|
95 | } |
---|
96 | else |
---|
97 | { |
---|
98 | changepic(b2, red); |
---|
99 | statb2 = 0; |
---|
100 | } |
---|
101 | free(zeile); zeile = NULL; |
---|
102 | |
---|
103 | cmd = ostrcat(createpluginpath("/sispmctl/bin/sispmctl", 0), " -g3 > /tmp/helpsis", 0, 0); |
---|
104 | system(cmd); |
---|
105 | free(cmd); cmd = NULL; |
---|
106 | zeile = readsys("/tmp/helpsis", 2); |
---|
107 | if(ostrstr(zeile, "on") != NULL) |
---|
108 | { |
---|
109 | changepic(b3, green); |
---|
110 | statb3 = 1; |
---|
111 | } |
---|
112 | else |
---|
113 | { |
---|
114 | changepic(b3, red); |
---|
115 | statb3 = 0; |
---|
116 | } |
---|
117 | free(zeile); zeile = NULL; |
---|
118 | |
---|
119 | cmd = ostrcat(createpluginpath("/sispmctl/bin/sispmctl", 0), " -g4 > /tmp/helpsis", 0, 0); |
---|
120 | system(cmd); |
---|
121 | free(cmd); cmd = NULL; |
---|
122 | zeile = readsys("/tmp/helpsis", 2); |
---|
123 | if(ostrstr(zeile, "on") != NULL) |
---|
124 | { |
---|
125 | changepic(b4, green); |
---|
126 | statb4 = 1; |
---|
127 | } |
---|
128 | else |
---|
129 | { |
---|
130 | changepic(b4, red); |
---|
131 | statb4 = 0; |
---|
132 | } |
---|
133 | free(zeile); zeile = NULL; |
---|
134 | } |
---|
135 | changepic(m1, menu); |
---|
136 | |
---|
137 | clearscreen(load); |
---|
138 | |
---|
139 | drawscreen(sis_anzeige, 0, 0); |
---|
140 | addscreenrc(sis_anzeige, buttonbar); |
---|
141 | tmp = buttonbar->select; |
---|
142 | |
---|
143 | while(1) |
---|
144 | { |
---|
145 | addscreenrc(sis_anzeige, tmp); |
---|
146 | rcret = waitrc(sis_anzeige, 1000, 0); |
---|
147 | tmp = buttonbar->select; |
---|
148 | if(rcret == getrcconfigint("rcok", NULL)) |
---|
149 | { |
---|
150 | if(buttonbar->select != NULL && ostrcmp(buttonbar->select->name, "b1") == 0) |
---|
151 | { |
---|
152 | if(statb1 == 0) |
---|
153 | cmd = ostrcat(createpluginpath("/sispmctl/bin/sispmctl", 0), " -o1 > /tmp/helpsis", 0, 0); |
---|
154 | else |
---|
155 | cmd = ostrcat(createpluginpath("/sispmctl/bin/sispmctl", 0), " -f1 > /tmp/helpsis", 0, 0); |
---|
156 | system(cmd); |
---|
157 | free(cmd); cmd = NULL; |
---|
158 | break; |
---|
159 | } |
---|
160 | if(buttonbar->select != NULL && ostrcmp(buttonbar->select->name, "b2") == 0) |
---|
161 | { |
---|
162 | if(statb2 == 0) |
---|
163 | cmd = ostrcat(createpluginpath("/sispmctl/bin/sispmctl", 0), " -o2 > /tmp/helpsis", 0, 0); |
---|
164 | else |
---|
165 | cmd = ostrcat(createpluginpath("/sispmctl/bin/sispmctl", 0), " -f2 > /tmp/helpsis", 0, 0); |
---|
166 | system(cmd); |
---|
167 | free(cmd); cmd = NULL; |
---|
168 | break; |
---|
169 | } |
---|
170 | if(buttonbar->select != NULL && ostrcmp(buttonbar->select->name, "b3") == 0) |
---|
171 | { |
---|
172 | if(statb3 == 0) |
---|
173 | cmd = ostrcat(createpluginpath("/sispmctl/bin/sispmctl", 0), " -o3 > /tmp/helpsis", 0, 0); |
---|
174 | else |
---|
175 | cmd = ostrcat(createpluginpath("/sispmctl/bin/sispmctl", 0), " -f3 > /tmp/helpsis", 0, 0); |
---|
176 | system(cmd); |
---|
177 | free(cmd); cmd = NULL; |
---|
178 | break; |
---|
179 | } |
---|
180 | if(buttonbar->select != NULL && ostrcmp(buttonbar->select->name, "b4") == 0) |
---|
181 | { |
---|
182 | if(statb4 == 0) |
---|
183 | cmd = ostrcat(createpluginpath("/sispmctl/bin/sispmctl", 0), " -o4 > /tmp/helpsis", 0, 0); |
---|
184 | else |
---|
185 | cmd = ostrcat(createpluginpath("/sispmctl/bin/sispmctl", 0), " -f4 > /tmp/helpsis", 0, 0); |
---|
186 | system(cmd); |
---|
187 | free(cmd); cmd = NULL; |
---|
188 | break; |
---|
189 | } |
---|
190 | if(buttonbar->select != NULL && ostrcmp(buttonbar->select->name, "m1") == 0) |
---|
191 | { |
---|
192 | ende = 1; |
---|
193 | anzmenu = 1; |
---|
194 | break; |
---|
195 | } |
---|
196 | } |
---|
197 | if(rcret == getrcconfigint("rcexit", NULL)) |
---|
198 | { |
---|
199 | anzmenu = 0; |
---|
200 | ende = 1; |
---|
201 | break; |
---|
202 | } |
---|
203 | if(rcret == getrcconfigint("rcmenu", NULL)) |
---|
204 | { |
---|
205 | ende = 1; |
---|
206 | anzmenu = 1; |
---|
207 | break; |
---|
208 | } |
---|
209 | } |
---|
210 | delownerrc(sis_anzeige); |
---|
211 | clearscreen(sis_anzeige); |
---|
212 | if(ende == 1) |
---|
213 | break; |
---|
214 | } |
---|
215 | |
---|
216 | free(red); |
---|
217 | free(yellow); |
---|
218 | free(green); |
---|
219 | free(menu); |
---|
220 | |
---|
221 | return anzmenu; |
---|
222 | } |
---|
223 | |
---|
224 | |
---|
225 | |
---|
226 | void sispmctl_start(int flag) |
---|
227 | { |
---|
228 | char* cmd = NULL; |
---|
229 | |
---|
230 | int g1_timer_m = 0; |
---|
231 | int g2_timer_m = 0; |
---|
232 | int g3_timer_m = 0; |
---|
233 | int g4_timer_m = 0; |
---|
234 | |
---|
235 | int g1_flag_on = 0; |
---|
236 | int g2_flag_on = 0; |
---|
237 | int g3_flag_on = 0; |
---|
238 | int g4_flag_on = 0; |
---|
239 | |
---|
240 | if(flag == 3 && (ostrcmp(getlist(myconfig, "g1_auto_on", NULL), "standby") == 0 || ostrcmp(getlist(myconfig, "g1_auto_on", NULL), "off") == 0)) |
---|
241 | g1_flag_on = 1; |
---|
242 | if(flag == 3 && (ostrcmp(getlist(myconfig, "g2_auto_on", NULL), "standby") == 0 || ostrcmp(getlist(myconfig, "g2_auto_on", NULL), "off") == 0)) |
---|
243 | g2_flag_on = 1; |
---|
244 | if(flag == 3 && (ostrcmp(getlist(myconfig, "g3_auto_on", NULL), "standby") == 0 || ostrcmp(getlist(myconfig, "g3_auto_on", NULL), "off") == 0)) |
---|
245 | g3_flag_on = 1; |
---|
246 | if(flag == 3 && (ostrcmp(getlist(myconfig, "g4_auto_on", NULL), "standby") == 0 || ostrcmp(getlist(myconfig, "g4_auto_on", NULL), "off") == 0)) |
---|
247 | g4_flag_on = 1; |
---|
248 | |
---|
249 | if(flag == 3) |
---|
250 | { |
---|
251 | if(ostrcmp(getlist(myconfig, "g1_timer", NULL), "yes") == 0) |
---|
252 | g1_timer_m = 1; |
---|
253 | if(ostrcmp(getlist(myconfig, "g2_timer", NULL), "yes") == 0) |
---|
254 | g2_timer_m = 1; |
---|
255 | if(ostrcmp(getlist(myconfig, "g3_timer", NULL), "yes") == 0) |
---|
256 | g3_timer_m = 1; |
---|
257 | if(ostrcmp(getlist(myconfig, "g4_timer", NULL), "yes") == 0) |
---|
258 | g4_timer_m = 1; |
---|
259 | } |
---|
260 | |
---|
261 | if(flag == 3) |
---|
262 | writesys("/mnt/plugin/ps01sispm", "#!/bin/sh", 1); |
---|
263 | |
---|
264 | if(getwaswakuptimer() != 1 || flag == 3) |
---|
265 | { |
---|
266 | |
---|
267 | if((flag == 3 && g1_flag_on == 0) || ostrcmp(getlist(myconfig, "g1_auto_on", NULL), "both") == 0 || (ostrcmp(getlist(myconfig, "g1_auto_on", NULL), "standby") == 0 && flag == 1) || (ostrcmp(getlist(myconfig, "g1_auto_on", NULL), "deep") == 0 && flag == 2)) |
---|
268 | { |
---|
269 | if(g1_timer_m == 1) |
---|
270 | writesys("/mnt/plugin/ps01sispm", "if [ `cat /proc/stb/fp/was_timer_wakeup | grep 0 | wc -l` -gt 0 ]; then", 3); |
---|
271 | |
---|
272 | if(ostrcmp(getlist(myconfig, "g1_script", NULL), "yes") == 0) |
---|
273 | { |
---|
274 | cmd = ostrcat(createpluginpath("/sispmctl/bin/g1_script.sh", 0), " start", 0, 0); |
---|
275 | if(flag == 3) |
---|
276 | writesys("/mnt/plugin/ps01sispm", cmd, 3); |
---|
277 | else |
---|
278 | system(cmd); |
---|
279 | free(cmd); cmd = NULL; |
---|
280 | } |
---|
281 | |
---|
282 | if(ostrcmp(getlist(myconfig, "g1_delay", NULL), "0") == 0) |
---|
283 | { |
---|
284 | if(ostrcmp(getlist(myconfig, "g1_delayhard", NULL), "0") == 0) |
---|
285 | cmd = ostrcat(createpluginpath("/sispmctl/bin/sispmctl", 0), " -o1 > /tmp/helpsis", 0, 0); |
---|
286 | else |
---|
287 | { |
---|
288 | cmd = ostrcat(createpluginpath("/sispmctl/bin/sispmctl", 0), " -A1 --Aafter ", 0, 0); |
---|
289 | cmd = ostrcat(cmd, getlist(myconfig, "g1_delayhard", NULL), 1, 0); |
---|
290 | cmd = ostrcat(cmd, " --Ado on", 1, 0); |
---|
291 | } |
---|
292 | } |
---|
293 | else |
---|
294 | { |
---|
295 | cmd = ostrcat("(sleep ", getlist(myconfig, "g1_delay", NULL), 0, 0); |
---|
296 | cmd = ostrcat(cmd, "; ", 1, 0); |
---|
297 | cmd = ostrcat(cmd, createpluginpath("/sispmctl/bin/sispmctl", 0), 1, 0); |
---|
298 | cmd = ostrcat(cmd, " -o1) &", 1, 0); |
---|
299 | } |
---|
300 | if(flag == 3) |
---|
301 | writesys("/mnt/plugin/ps01sispm", cmd, 3); |
---|
302 | else |
---|
303 | system(cmd); |
---|
304 | printf("%s\n", cmd); |
---|
305 | free(cmd); cmd = NULL; |
---|
306 | if(g1_timer_m == 1) |
---|
307 | writesys("/mnt/plugin/ps01sispm", "fi", 3); |
---|
308 | |
---|
309 | } |
---|
310 | if((flag == 3 && g2_flag_on == 0) || ostrcmp(getlist(myconfig, "g2_auto_on", NULL), "both") == 0 || (ostrcmp(getlist(myconfig, "g2_auto_on", NULL), "standby") == 0 && flag == 1) || (ostrcmp(getlist(myconfig, "g2_auto_on", NULL), "deep") == 0 && flag == 2)) |
---|
311 | { |
---|
312 | if(g2_timer_m == 1) |
---|
313 | writesys("/mnt/plugin/ps01sispm", "if [ `cat /proc/stb/fp/was_timer_wakeup | grep 0 | wc -l` -gt 0 ]; then", 3); |
---|
314 | if(ostrcmp(getlist(myconfig, "g2_script", NULL), "yes") == 0) |
---|
315 | { |
---|
316 | cmd = ostrcat(createpluginpath("/sispmctl/bin/g2_script.sh", 0), " start", 0, 0); |
---|
317 | if(flag == 3) |
---|
318 | writesys("/mnt/plugin/ps01sispm", cmd, 3); |
---|
319 | else |
---|
320 | system(cmd); |
---|
321 | free(cmd); cmd = NULL; |
---|
322 | } |
---|
323 | if(ostrcmp(getlist(myconfig, "g2_delay", NULL), "0") == 0) |
---|
324 | { |
---|
325 | if(ostrcmp(getlist(myconfig, "g2_delayhard", NULL), "0") == 0) |
---|
326 | cmd = ostrcat(createpluginpath("/sispmctl/bin/sispmctl", 0), " -o2 > /tmp/helpsis", 0, 0); |
---|
327 | else |
---|
328 | { |
---|
329 | cmd = ostrcat(createpluginpath("/sispmctl/bin/sispmctl", 0), " -A2 --Aafter ", 0, 0); |
---|
330 | cmd = ostrcat(cmd, getlist(myconfig, "g2_delayhard", NULL), 1, 0); |
---|
331 | cmd = ostrcat(cmd, " --Ado on", 1, 0); |
---|
332 | } |
---|
333 | } |
---|
334 | else |
---|
335 | { |
---|
336 | cmd = ostrcat("(sleep ", getlist(myconfig, "g2_delay", NULL), 0, 0); |
---|
337 | cmd = ostrcat(cmd, "; ", 1, 0); |
---|
338 | cmd = ostrcat(cmd, createpluginpath("/sispmctl/bin/sispmctl", 0), 1, 0); |
---|
339 | cmd = ostrcat(cmd, " -o2) &", 1, 0); |
---|
340 | } |
---|
341 | if(flag == 3) |
---|
342 | writesys("/mnt/plugin/ps01sispm", cmd, 3); |
---|
343 | else |
---|
344 | system(cmd); |
---|
345 | printf("%s\n", cmd); |
---|
346 | free(cmd); cmd = NULL; |
---|
347 | if(g2_timer_m == 1) |
---|
348 | writesys("/mnt/plugin/ps01sispm", "fi", 3); |
---|
349 | } |
---|
350 | if((flag == 3 && g3_flag_on == 0) || ostrcmp(getlist(myconfig, "g3_auto_on", NULL), "both") == 0 || (ostrcmp(getlist(myconfig, "g3_auto_on", NULL), "standby") == 0 && flag == 1) || (ostrcmp(getlist(myconfig, "g3_auto_on", NULL), "deep") == 0 && flag == 2)) |
---|
351 | { |
---|
352 | if(g3_timer_m == 1) |
---|
353 | writesys("/mnt/plugin/ps01sispm", "if [ `cat /proc/stb/fp/was_timer_wakeup | grep 0 | wc -l` -gt 0 ]; then", 3); |
---|
354 | if(ostrcmp(getlist(myconfig, "g3_script", NULL), "yes") == 0) |
---|
355 | { |
---|
356 | cmd = ostrcat(createpluginpath("/sispmctl/bin/g3_script.sh", 0), " start", 0, 0); |
---|
357 | if(flag == 3) |
---|
358 | writesys("/mnt/plugin/ps01sispm", cmd, 3); |
---|
359 | else |
---|
360 | system(cmd); |
---|
361 | free(cmd); cmd = NULL; |
---|
362 | } |
---|
363 | if(ostrcmp(getlist(myconfig, "g3_delay", NULL), "0") == 0) |
---|
364 | { |
---|
365 | if(ostrcmp(getlist(myconfig, "g3_delayhard", NULL), "0") == 0) |
---|
366 | cmd = ostrcat(createpluginpath("/sispmctl/bin/sispmctl", 0), " -o3 > /tmp/helpsis", 0, 0); |
---|
367 | else |
---|
368 | { |
---|
369 | cmd = ostrcat(createpluginpath("/sispmctl/bin/sispmctl", 0), " -A3 --Aafter ", 0, 0); |
---|
370 | cmd = ostrcat(cmd, getlist(myconfig, "g3_delayhard", NULL), 1, 0); |
---|
371 | cmd = ostrcat(cmd, " --Ado on", 1, 0); |
---|
372 | } |
---|
373 | } |
---|
374 | else |
---|
375 | { |
---|
376 | cmd = ostrcat("(sleep ", getlist(myconfig, "g3_delay", NULL), 0, 0); |
---|
377 | cmd = ostrcat(cmd, "; ", 1, 0); |
---|
378 | cmd = ostrcat(cmd, createpluginpath("/sispmctl/bin/sispmctl", 0), 1, 0); |
---|
379 | cmd = ostrcat(cmd, " -o3) &", 1, 0); |
---|
380 | |
---|
381 | } |
---|
382 | if(flag == 3) |
---|
383 | writesys("/mnt/plugin/ps01sispm", cmd, 3); |
---|
384 | else |
---|
385 | system(cmd); |
---|
386 | printf("%s\n", cmd); |
---|
387 | free(cmd); cmd = NULL; |
---|
388 | if(g3_timer_m == 1) |
---|
389 | writesys("/mnt/plugin/ps01sispm", "fi", 3); |
---|
390 | } |
---|
391 | if((flag == 3 && g3_flag_on == 0) || ostrcmp(getlist(myconfig, "g4_auto_on", NULL), "both") == 0 || (ostrcmp(getlist(myconfig, "g4_auto_on", NULL), "standby") == 0 && flag == 1) || (ostrcmp(getlist(myconfig, "g4_auto_on", NULL), "deep") == 0 && flag == 2)) |
---|
392 | { |
---|
393 | if(g4_timer_m == 1) |
---|
394 | writesys("/mnt/plugin/ps01sispm", "if [ `cat /proc/stb/fp/was_timer_wakeup | grep 0 | wc -l` -gt 0 ]; then", 3); |
---|
395 | if(ostrcmp(getlist(myconfig, "g4_script", NULL), "yes") == 0) |
---|
396 | { |
---|
397 | cmd = ostrcat(createpluginpath("/sispmctl/bin/g4_script.sh", 0), " start", 0, 0); |
---|
398 | if(flag == 3) |
---|
399 | writesys("/mnt/plugin/ps01sispm", cmd, 3); |
---|
400 | else |
---|
401 | system(cmd); |
---|
402 | free(cmd); cmd = NULL; |
---|
403 | } |
---|
404 | if(ostrcmp(getlist(myconfig, "g4_delay", NULL), "0") == 0) |
---|
405 | { |
---|
406 | if(ostrcmp(getlist(myconfig, "g4_delayhard", NULL), "0") == 0) |
---|
407 | cmd = ostrcat(createpluginpath("/sispmctl/bin/sispmctl", 0), " -o4 > /tmp/helpsis", 0, 0); |
---|
408 | else |
---|
409 | { |
---|
410 | cmd = ostrcat(createpluginpath("/sispmctl/bin/sispmctl", 0), " -A4 --Aafter ", 0, 0); |
---|
411 | cmd = ostrcat(cmd, getlist(myconfig, "g4_delay", NULL), 1, 0); |
---|
412 | cmd = ostrcat(cmd, " --Ado on", 1, 0); |
---|
413 | } |
---|
414 | } |
---|
415 | else |
---|
416 | { |
---|
417 | cmd = ostrcat("(sleep ", getlist(myconfig, "g4_delayhard", NULL), 0, 0); |
---|
418 | cmd = ostrcat(cmd, "; ", 1, 0); |
---|
419 | cmd = ostrcat(cmd, createpluginpath("/sispmctl/bin/sispmctl", 0), 1, 0); |
---|
420 | cmd = ostrcat(cmd, " -o4) &", 1, 0); |
---|
421 | } |
---|
422 | if(flag == 3) |
---|
423 | writesys("/mnt/plugin/ps01sispm", cmd, 3); |
---|
424 | else |
---|
425 | system(cmd); |
---|
426 | printf("%s\n", cmd); |
---|
427 | free(cmd); cmd = NULL; |
---|
428 | if(g4_timer_m == 1) |
---|
429 | writesys("/mnt/plugin/ps01sispm", "fi", 3); |
---|
430 | } |
---|
431 | } |
---|
432 | } |
---|
433 | |
---|
434 | void sispmctl_stop(int flag) |
---|
435 | { |
---|
436 | char* cmd = NULL; |
---|
437 | int maxsleep = 0; |
---|
438 | |
---|
439 | int g1_flag_off = 0; |
---|
440 | int g2_flag_off = 0; |
---|
441 | int g3_flag_off = 0; |
---|
442 | int g4_flag_off = 0; |
---|
443 | |
---|
444 | if(flag == 3 && (ostrcmp(getlist(myconfig, "g1_auto_off", NULL), "standby") == 0 || ostrcmp(getlist(myconfig, "g1_auto_off", NULL), "off") == 0)) |
---|
445 | g1_flag_off = 1; |
---|
446 | if(flag == 3 && (ostrcmp(getlist(myconfig, "g2_auto_off", NULL), "standby") == 0 || ostrcmp(getlist(myconfig, "g2_auto_off", NULL), "off") == 0)) |
---|
447 | g2_flag_off = 1; |
---|
448 | if(flag == 3 && (ostrcmp(getlist(myconfig, "g3_auto_off", NULL), "standby") == 0 || ostrcmp(getlist(myconfig, "g3_auto_off", NULL), "off") == 0)) |
---|
449 | g3_flag_off = 1; |
---|
450 | if(flag == 3 && (ostrcmp(getlist(myconfig, "g4_auto_off", NULL), "standby") == 0 || ostrcmp(getlist(myconfig, "g4_auto_off", NULL), "off") == 0)) |
---|
451 | g4_flag_off = 1; |
---|
452 | |
---|
453 | if(flag == 3) |
---|
454 | writesys("/mnt/plugin/pe01sispm", "#!/bin/sh", 1); |
---|
455 | |
---|
456 | if((flag == 3 && g1_flag_off == 0) || ostrcmp(getlist(myconfig, "g1_auto_off", NULL), "both") == 0 || (ostrcmp(getlist(myconfig, "g1_auto_off", NULL), "standby") == 0 && flag == 1) || (ostrcmp(getlist(myconfig, "g1_auto_off", NULL), "deep") == 0 && flag == 2)) |
---|
457 | { |
---|
458 | if(ostrcmp(getlist(myconfig, "g1_script", NULL), "yes") == 0) |
---|
459 | { |
---|
460 | cmd = ostrcat(createpluginpath("/sispmctl/bin/g1_script.sh", 0), " stop", 0, 0); |
---|
461 | if(flag == 3) |
---|
462 | writesys("/mnt/plugin/pe01sispm", cmd, 3); |
---|
463 | else |
---|
464 | system(cmd); |
---|
465 | free(cmd); cmd = NULL; |
---|
466 | } |
---|
467 | if(ostrcmp(getlist(myconfig, "g1_delay", NULL), "0") == 0) |
---|
468 | { |
---|
469 | if(ostrcmp(getlist(myconfig, "g1_delayhard", NULL), "0") == 0) |
---|
470 | cmd = ostrcat(createpluginpath("/sispmctl/bin/sispmctl", 0), " -f1 > /tmp/helpsis", 0, 0); |
---|
471 | else |
---|
472 | { |
---|
473 | cmd = ostrcat(createpluginpath("/sispmctl/bin/sispmctl", 0), " -A1 --Aafter ", 0, 0); |
---|
474 | cmd = ostrcat(cmd, getlist(myconfig, "g1_delayhard", NULL), 1, 0); |
---|
475 | cmd = ostrcat(cmd, " --Ado off", 1, 0); |
---|
476 | } |
---|
477 | } |
---|
478 | else |
---|
479 | { |
---|
480 | cmd = ostrcat("(sleep ", getlist(myconfig, "g1_delay", NULL), 0, 0); |
---|
481 | cmd = ostrcat(cmd, "; ", 1, 0); |
---|
482 | cmd = ostrcat(cmd, createpluginpath("/sispmctl/bin/sispmctl", 0), 1, 0); |
---|
483 | cmd = ostrcat(cmd, " -f1) &", 1, 0); |
---|
484 | if(maxsleep < atoi(getlist(myconfig, "g1_delay", NULL))) |
---|
485 | maxsleep = atoi(getlist(myconfig, "g1_delay", NULL)); |
---|
486 | } |
---|
487 | if(flag == 3) |
---|
488 | writesys("/mnt/plugin/pe01sispm", cmd, 3); |
---|
489 | else |
---|
490 | system(cmd); |
---|
491 | printf("%s\n", cmd); |
---|
492 | free(cmd); cmd = NULL; |
---|
493 | } |
---|
494 | if((flag == 3 && g2_flag_off == 0) || ostrcmp(getlist(myconfig, "g2_auto_off", NULL), "both") == 0 || (ostrcmp(getlist(myconfig, "g2_auto_off", NULL), "standby") == 0 && flag == 1) || (ostrcmp(getlist(myconfig, "g2_auto_off", NULL), "deep") == 0 && flag == 2)) |
---|
495 | { |
---|
496 | if(ostrcmp(getlist(myconfig, "g2_script", NULL), "yes") == 0) |
---|
497 | { |
---|
498 | cmd = ostrcat(createpluginpath("/sispmctl/bin/g2_script.sh", 0), " stop", 0, 0); |
---|
499 | if(flag == 3) |
---|
500 | writesys("/mnt/plugin/pe01sispm", cmd, 3); |
---|
501 | else |
---|
502 | system(cmd); |
---|
503 | free(cmd); cmd = NULL; |
---|
504 | } |
---|
505 | if(ostrcmp(getlist(myconfig, "g2_delay", NULL), "0") == 0) |
---|
506 | { |
---|
507 | if(ostrcmp(getlist(myconfig, "g2_delayhard", NULL), "0") == 0) |
---|
508 | cmd = ostrcat(createpluginpath("/sispmctl/bin/sispmctl", 0), " -f2 > /tmp/helpsis", 0, 0); |
---|
509 | else |
---|
510 | { |
---|
511 | cmd = ostrcat(createpluginpath("/sispmctl/bin/sispmctl", 0), " -A2 --Aafter ", 0, 0); |
---|
512 | cmd = ostrcat(cmd, getlist(myconfig, "g2_delayhard", NULL), 1, 0); |
---|
513 | cmd = ostrcat(cmd, " --Ado off", 1, 0); |
---|
514 | } |
---|
515 | } |
---|
516 | else |
---|
517 | { |
---|
518 | cmd = ostrcat("(sleep ", getlist(myconfig, "g2_delay", NULL), 0, 0); |
---|
519 | cmd = ostrcat(cmd, "; ", 1, 0); |
---|
520 | cmd = ostrcat(cmd, createpluginpath("/sispmctl/bin/sispmctl", 0), 1, 0); |
---|
521 | cmd = ostrcat(cmd, " -f2) &", 1, 0); |
---|
522 | if(maxsleep < atoi(getlist(myconfig, "g2_delay", NULL))) |
---|
523 | maxsleep = atoi(getlist(myconfig, "g2_delay", NULL)); |
---|
524 | } |
---|
525 | if(flag == 3) |
---|
526 | writesys("/mnt/plugin/pe01sispm", cmd, 3); |
---|
527 | else |
---|
528 | system(cmd); |
---|
529 | printf("%s\n", cmd); |
---|
530 | free(cmd); cmd = NULL; |
---|
531 | } |
---|
532 | if((flag == 3 && g3_flag_off == 0) || ostrcmp(getlist(myconfig, "g3_auto_off", NULL), "both") == 0 || (ostrcmp(getlist(myconfig, "g3_auto_off", NULL), "standby") == 0 && flag == 1) || (ostrcmp(getlist(myconfig, "g3_auto_off", NULL), "deep") == 0 && flag == 2)) |
---|
533 | { |
---|
534 | if(ostrcmp(getlist(myconfig, "g3_script", NULL), "yes") == 0) |
---|
535 | { |
---|
536 | cmd = ostrcat(createpluginpath("/sispmctl/bin/g3_script.sh", 0), " stop", 0, 0); |
---|
537 | if(flag == 3) |
---|
538 | writesys("/mnt/plugin/pe01sispm", cmd, 3); |
---|
539 | else |
---|
540 | system(cmd); |
---|
541 | free(cmd); cmd = NULL; |
---|
542 | } |
---|
543 | if(ostrcmp(getlist(myconfig, "g3_delay", NULL), "0") == 0) |
---|
544 | { |
---|
545 | if(ostrcmp(getlist(myconfig, "g3_delayhard", NULL), "0") == 0) |
---|
546 | cmd = ostrcat(createpluginpath("/sispmctl/bin/sispmctl", 0), " -f3 > /tmp/helpsis", 0, 0); |
---|
547 | else |
---|
548 | { |
---|
549 | cmd = ostrcat(createpluginpath("/sispmctl/bin/sispmctl", 0), " -A3 --Aafter ", 0, 0); |
---|
550 | cmd = ostrcat(cmd, getlist(myconfig, "g3_delayhard", NULL), 1, 0); |
---|
551 | cmd = ostrcat(cmd, " --Ado off", 1, 0); |
---|
552 | } |
---|
553 | } |
---|
554 | else |
---|
555 | { |
---|
556 | cmd = ostrcat("(sleep ", getlist(myconfig, "g3_delay", NULL), 0, 0); |
---|
557 | cmd = ostrcat(cmd, "; ", 1, 0); |
---|
558 | cmd = ostrcat(cmd, createpluginpath("/sispmctl/bin/sispmctl", 0), 1, 0); |
---|
559 | cmd = ostrcat(cmd, " -f3) &", 1, 0); |
---|
560 | if(maxsleep < atoi(getlist(myconfig, "g3_delay", NULL))) |
---|
561 | maxsleep = atoi(getlist(myconfig, "g3_delay", NULL)); |
---|
562 | } |
---|
563 | if(flag == 3) |
---|
564 | writesys("/mnt/plugin/pe01sispm", cmd, 3); |
---|
565 | else |
---|
566 | system(cmd); |
---|
567 | printf("%s\n", cmd); |
---|
568 | free(cmd); cmd = NULL; |
---|
569 | } |
---|
570 | if((flag == 3 && g4_flag_off == 0) || ostrcmp(getlist(myconfig, "g4_auto_off", NULL), "both") == 0 || (ostrcmp(getlist(myconfig, "g4_auto_off", NULL), "standby") == 0 && flag == 1) || (ostrcmp(getlist(myconfig, "g4_auto_off", NULL), "deep") == 0 && flag == 2)) |
---|
571 | { |
---|
572 | if(ostrcmp(getlist(myconfig, "g4_script", NULL), "yes") == 0) |
---|
573 | { |
---|
574 | cmd = ostrcat(createpluginpath("/sispmctl/bin/g4_script.sh", 0), " stop", 0, 0); |
---|
575 | if(flag == 3) |
---|
576 | writesys("/mnt/plugin/pe01sispm", cmd, 3); |
---|
577 | else |
---|
578 | system(cmd); |
---|
579 | free(cmd); cmd = NULL; |
---|
580 | } |
---|
581 | if(ostrcmp(getlist(myconfig, "g4_delay", NULL), "0") == 0) |
---|
582 | { |
---|
583 | if(ostrcmp(getlist(myconfig, "g4_delayhard", NULL), "0") == 0) |
---|
584 | cmd = ostrcat(createpluginpath("/sispmctl/bin/sispmctl", 0), " -f4 > /tmp/helpsis", 0, 0); |
---|
585 | else |
---|
586 | { |
---|
587 | cmd = ostrcat(createpluginpath("/sispmctl/bin/sispmctl", 0), " -A4 --Aafter ", 0, 0); |
---|
588 | cmd = ostrcat(cmd, getlist(myconfig, "g4_delayhard", NULL), 1, 0); |
---|
589 | cmd = ostrcat(cmd, " --Ado off", 1, 0); |
---|
590 | } |
---|
591 | } |
---|
592 | else |
---|
593 | { |
---|
594 | cmd = ostrcat("(sleep ", getlist(myconfig, "g4_delay", NULL), 0, 0); |
---|
595 | cmd = ostrcat(cmd, "; ", 1, 0); |
---|
596 | cmd = ostrcat(cmd, createpluginpath("/sispmctl/bin/sispmctl", 0), 1, 0); |
---|
597 | cmd = ostrcat(cmd, " -f4) &", 1, 0); |
---|
598 | if(maxsleep < atoi(getlist(myconfig, "g4_delay", NULL))) |
---|
599 | maxsleep = atoi(getlist(myconfig, "g4_delay", NULL)); |
---|
600 | } |
---|
601 | if(flag == 3) |
---|
602 | writesys("/mnt/plugin/pe01sispm", cmd, 3); |
---|
603 | else |
---|
604 | system(cmd); |
---|
605 | printf("%s\n", cmd); |
---|
606 | free(cmd); cmd = NULL; |
---|
607 | } |
---|
608 | if(maxsleep > 0 && flag == 3) |
---|
609 | { |
---|
610 | cmd = ostrcat("sleep ", oitoa(maxsleep),0 ,1); |
---|
611 | writesys("/mnt/plugin/pe01sispm", cmd, 3); |
---|
612 | free(cmd); cmd = NULL; |
---|
613 | } |
---|
614 | else if(maxsleep > 0) |
---|
615 | sleep(maxsleep); |
---|
616 | } |
---|
617 | |
---|
618 | void sispmctl_check_thread() |
---|
619 | { |
---|
620 | int standby = 0; |
---|
621 | while (sispmctl_checkthread->aktion != STOP) |
---|
622 | { |
---|
623 | if(status.standby > 0 && standby == 0) |
---|
624 | { |
---|
625 | sispmctl_stop(1); |
---|
626 | standby = 1; |
---|
627 | } |
---|
628 | if(status.standby == 0 && standby == 1) |
---|
629 | { |
---|
630 | sispmctl_start(1); |
---|
631 | standby = 0; |
---|
632 | } |
---|
633 | sleep(2); |
---|
634 | } |
---|
635 | sispmctl_checkthread = NULL; |
---|
636 | } |
---|
637 | |
---|
638 | void sispmctl_settings() |
---|
639 | { |
---|
640 | |
---|
641 | int rcret = 0; |
---|
642 | int rcode = 0; |
---|
643 | |
---|
644 | struct skin* load = getscreen("loading"); |
---|
645 | |
---|
646 | struct skin* sis_einstellungen = getscreen("sis_einstellungen"); |
---|
647 | struct skin* listbox = getscreennode(sis_einstellungen, "listbox"); |
---|
648 | |
---|
649 | struct skin* g1_name = getscreennode(sis_einstellungen, "g1_name"); |
---|
650 | struct skin* g1_auto_on = getscreennode(sis_einstellungen, "g1_auto_on"); |
---|
651 | struct skin* g1_timer = getscreennode(sis_einstellungen, "g1_timer"); |
---|
652 | struct skin* g1_auto_off = getscreennode(sis_einstellungen, "g1_auto_off"); |
---|
653 | struct skin* g1_delay = getscreennode(sis_einstellungen, "g1_delay"); |
---|
654 | struct skin* g1_delayhard = getscreennode(sis_einstellungen, "g1_delayhard"); |
---|
655 | struct skin* g1_script = getscreennode(sis_einstellungen, "g1_script"); |
---|
656 | |
---|
657 | struct skin* g2_name = getscreennode(sis_einstellungen, "g2_name"); |
---|
658 | struct skin* g2_auto_on = getscreennode(sis_einstellungen, "g2_auto_on"); |
---|
659 | struct skin* g2_timer = getscreennode(sis_einstellungen, "g2_timer"); |
---|
660 | struct skin* g2_auto_off = getscreennode(sis_einstellungen, "g2_auto_off"); |
---|
661 | struct skin* g2_delay = getscreennode(sis_einstellungen, "g2_delay"); |
---|
662 | struct skin* g2_delayhard = getscreennode(sis_einstellungen, "g2_delayhard"); |
---|
663 | struct skin* g2_script = getscreennode(sis_einstellungen, "g2_script"); |
---|
664 | |
---|
665 | struct skin* g3_name = getscreennode(sis_einstellungen, "g3_name"); |
---|
666 | struct skin* g3_auto_on = getscreennode(sis_einstellungen, "g3_auto_on"); |
---|
667 | struct skin* g3_timer = getscreennode(sis_einstellungen, "g3_timer"); |
---|
668 | struct skin* g3_auto_off = getscreennode(sis_einstellungen, "g3_auto_off"); |
---|
669 | struct skin* g3_delay = getscreennode(sis_einstellungen, "g3_delay"); |
---|
670 | struct skin* g3_delayhard = getscreennode(sis_einstellungen, "g3_delayhard"); |
---|
671 | struct skin* g3_script = getscreennode(sis_einstellungen, "g3_script"); |
---|
672 | |
---|
673 | struct skin* g4_name = getscreennode(sis_einstellungen, "g4_name"); |
---|
674 | struct skin* g4_auto_on = getscreennode(sis_einstellungen, "g4_auto_on"); |
---|
675 | struct skin* g4_timer = getscreennode(sis_einstellungen, "g4_timer"); |
---|
676 | struct skin* g4_auto_off = getscreennode(sis_einstellungen, "g4_auto_off"); |
---|
677 | struct skin* g4_delay = getscreennode(sis_einstellungen, "g4_delay"); |
---|
678 | struct skin* g4_delayhard = getscreennode(sis_einstellungen, "g4_delayhard"); |
---|
679 | struct skin* g4_script = getscreennode(sis_einstellungen, "g4_script"); |
---|
680 | |
---|
681 | struct skin* tmp = NULL; |
---|
682 | |
---|
683 | changemask(g1_name, "abcdefghijklmnopqrstuvwxyz"); |
---|
684 | changeinput(g1_name, getlist(myconfig, "g1_name", NULL)); |
---|
685 | |
---|
686 | addchoicebox(g1_auto_on, "off", _("off")); |
---|
687 | addchoicebox(g1_auto_on, "both", _("both")); |
---|
688 | addchoicebox(g1_auto_on, "standby", _("standby")); |
---|
689 | addchoicebox(g1_auto_on, "deep", _("deep")); |
---|
690 | setchoiceboxselection(g1_auto_on, getlist(myconfig, "g1_auto_on", NULL)); |
---|
691 | |
---|
692 | addchoicebox(g1_timer, "yes", _("yes")); |
---|
693 | addchoicebox(g1_timer, "no", _("no")); |
---|
694 | setchoiceboxselection(g1_timer, getlist(myconfig, "g1_timer", NULL)); |
---|
695 | |
---|
696 | addchoicebox(g1_script, "yes", _("yes")); |
---|
697 | addchoicebox(g1_script, "no", _("no")); |
---|
698 | setchoiceboxselection(g1_script, getlist(myconfig, "g1_script", NULL)); |
---|
699 | |
---|
700 | addchoicebox(g1_auto_off, "off", _("off")); |
---|
701 | addchoicebox(g1_auto_off, "both", _("both")); |
---|
702 | addchoicebox(g1_auto_off, "standby", _("standby")); |
---|
703 | addchoicebox(g1_auto_off, "deep", _("deep")); |
---|
704 | setchoiceboxselection(g1_auto_off, getlist(myconfig, "g1_auto_off", NULL)); |
---|
705 | |
---|
706 | addchoicebox(g1_delay, "0", "0"); |
---|
707 | addchoicebox(g1_delay, "1", "1"); |
---|
708 | addchoicebox(g1_delay, "2", "2"); |
---|
709 | addchoicebox(g1_delay, "3", "3"); |
---|
710 | addchoicebox(g1_delay, "4", "4"); |
---|
711 | addchoicebox(g1_delay, "5", "5"); |
---|
712 | addchoicebox(g1_delay, "6", "6"); |
---|
713 | addchoicebox(g1_delay, "7", "7"); |
---|
714 | addchoicebox(g1_delay, "8", "8"); |
---|
715 | addchoicebox(g1_delay, "9", "9"); |
---|
716 | addchoicebox(g1_delay, "10", "10"); |
---|
717 | setchoiceboxselection(g1_delay, getlist(myconfig, "g1_delay", NULL)); |
---|
718 | |
---|
719 | addchoicebox(g1_delayhard, "0", "0"); |
---|
720 | addchoicebox(g1_delayhard, "1", "1"); |
---|
721 | addchoicebox(g1_delayhard, "2", "2"); |
---|
722 | addchoicebox(g1_delayhard, "3", "3"); |
---|
723 | addchoicebox(g1_delayhard, "4", "4"); |
---|
724 | addchoicebox(g1_delayhard, "5", "5"); |
---|
725 | setchoiceboxselection(g1_delayhard, getlist(myconfig, "g1_delayhard", NULL)); |
---|
726 | |
---|
727 | changemask(g2_name, "abcdefghijklmnopqrstuvwxyz"); |
---|
728 | changeinput(g2_name, getlist(myconfig, "g2_name", NULL)); |
---|
729 | |
---|
730 | addchoicebox(g2_auto_on, "off", _("off")); |
---|
731 | addchoicebox(g2_auto_on, "both", _("both")); |
---|
732 | addchoicebox(g2_auto_on, "standby", _("standby")); |
---|
733 | addchoicebox(g2_auto_on, "deep", _("deep")); |
---|
734 | setchoiceboxselection(g2_auto_on, getlist(myconfig, "g2_auto_on", NULL)); |
---|
735 | |
---|
736 | addchoicebox(g2_timer, "yes", _("yes")); |
---|
737 | addchoicebox(g2_timer, "no", _("no")); |
---|
738 | setchoiceboxselection(g2_timer, getlist(myconfig, "g2_timer", NULL)); |
---|
739 | |
---|
740 | addchoicebox(g2_script, "yes", _("yes")); |
---|
741 | addchoicebox(g2_script, "no", _("no")); |
---|
742 | setchoiceboxselection(g2_script, getlist(myconfig, "g2_script", NULL)); |
---|
743 | |
---|
744 | addchoicebox(g2_auto_off, "off", _("off")); |
---|
745 | addchoicebox(g2_auto_off, "both", _("both")); |
---|
746 | addchoicebox(g2_auto_off, "standby", _("standby")); |
---|
747 | addchoicebox(g2_auto_off, "deep", _("deep")); |
---|
748 | setchoiceboxselection(g2_auto_off, getlist(myconfig, "g2_auto_off", NULL)); |
---|
749 | |
---|
750 | addchoicebox(g2_delay, "0", "0"); |
---|
751 | addchoicebox(g2_delay, "1", "1"); |
---|
752 | addchoicebox(g2_delay, "2", "2"); |
---|
753 | addchoicebox(g2_delay, "3", "3"); |
---|
754 | addchoicebox(g2_delay, "4", "4"); |
---|
755 | addchoicebox(g2_delay, "5", "5"); |
---|
756 | addchoicebox(g2_delay, "6", "6"); |
---|
757 | addchoicebox(g2_delay, "7", "7"); |
---|
758 | addchoicebox(g2_delay, "8", "8"); |
---|
759 | addchoicebox(g2_delay, "9", "9"); |
---|
760 | addchoicebox(g2_delay, "10", "10"); |
---|
761 | setchoiceboxselection(g2_delay, getlist(myconfig, "g2_delay", NULL)); |
---|
762 | |
---|
763 | addchoicebox(g2_delayhard, "0", "0"); |
---|
764 | addchoicebox(g2_delayhard, "1", "1"); |
---|
765 | addchoicebox(g2_delayhard, "2", "2"); |
---|
766 | addchoicebox(g2_delayhard, "3", "3"); |
---|
767 | addchoicebox(g2_delayhard, "4", "4"); |
---|
768 | addchoicebox(g2_delayhard, "5", "5"); |
---|
769 | setchoiceboxselection(g2_delayhard, getlist(myconfig, "g2_delayhard", NULL)); |
---|
770 | |
---|
771 | changemask(g3_name, "abcdefghijklmnopqrstuvwxyz"); |
---|
772 | changeinput(g3_name, getlist(myconfig, "g3_name", NULL)); |
---|
773 | |
---|
774 | addchoicebox(g3_auto_on, "off", _("off")); |
---|
775 | addchoicebox(g3_auto_on, "both", _("both")); |
---|
776 | addchoicebox(g3_auto_on, "standby", _("standby")); |
---|
777 | addchoicebox(g3_auto_on, "deep", _("deep")); |
---|
778 | setchoiceboxselection(g3_auto_on, getlist(myconfig, "g3_auto_on", NULL)); |
---|
779 | |
---|
780 | addchoicebox(g3_timer, "yes", _("yes")); |
---|
781 | addchoicebox(g3_timer, "no", _("no")); |
---|
782 | setchoiceboxselection(g3_timer, getlist(myconfig, "g3_timer", NULL)); |
---|
783 | |
---|
784 | addchoicebox(g3_script, "yes", _("yes")); |
---|
785 | addchoicebox(g3_script, "no", _("no")); |
---|
786 | setchoiceboxselection(g3_script, getlist(myconfig, "g3_script", NULL)); |
---|
787 | |
---|
788 | addchoicebox(g3_auto_off, "off", _("off")); |
---|
789 | addchoicebox(g3_auto_off, "both", _("both")); |
---|
790 | addchoicebox(g3_auto_off, "standby", _("standby")); |
---|
791 | addchoicebox(g3_auto_off, "deep", _("deep")); |
---|
792 | setchoiceboxselection(g3_auto_off, getlist(myconfig, "g3_auto_off", NULL)); |
---|
793 | |
---|
794 | addchoicebox(g3_delay, "0", "0"); |
---|
795 | addchoicebox(g3_delay, "1", "1"); |
---|
796 | addchoicebox(g3_delay, "2", "2"); |
---|
797 | addchoicebox(g3_delay, "3", "3"); |
---|
798 | addchoicebox(g3_delay, "4", "4"); |
---|
799 | addchoicebox(g3_delay, "5", "5"); |
---|
800 | addchoicebox(g3_delay, "6", "6"); |
---|
801 | addchoicebox(g3_delay, "7", "7"); |
---|
802 | addchoicebox(g3_delay, "8", "8"); |
---|
803 | addchoicebox(g3_delay, "9", "9"); |
---|
804 | addchoicebox(g3_delay, "10", "10"); |
---|
805 | setchoiceboxselection(g3_delay, getlist(myconfig, "g3_delay", NULL)); |
---|
806 | |
---|
807 | addchoicebox(g3_delayhard, "0", "0"); |
---|
808 | addchoicebox(g3_delayhard, "1", "1"); |
---|
809 | addchoicebox(g3_delayhard, "2", "2"); |
---|
810 | addchoicebox(g3_delayhard, "3", "3"); |
---|
811 | addchoicebox(g3_delayhard, "4", "4"); |
---|
812 | addchoicebox(g3_delayhard, "5", "5"); |
---|
813 | setchoiceboxselection(g3_delayhard, getlist(myconfig, "g3_delayhard", NULL)); |
---|
814 | |
---|
815 | changemask(g4_name, "abcdefghijklmnopqrstuvwxyz"); |
---|
816 | changeinput(g4_name, getlist(myconfig, "g4_name", NULL)); |
---|
817 | |
---|
818 | addchoicebox(g4_auto_on, "off", _("off")); |
---|
819 | addchoicebox(g4_auto_on, "both", _("both")); |
---|
820 | addchoicebox(g4_auto_on, "standby", _("standby")); |
---|
821 | addchoicebox(g4_auto_on, "deep", _("deep")); |
---|
822 | setchoiceboxselection(g4_auto_on, getlist(myconfig, "g4_auto_on", NULL)); |
---|
823 | |
---|
824 | addchoicebox(g4_timer, "yes", _("yes")); |
---|
825 | addchoicebox(g4_timer, "no", _("no")); |
---|
826 | setchoiceboxselection(g4_timer, getlist(myconfig, "g4_timer", NULL)); |
---|
827 | |
---|
828 | addchoicebox(g4_script, "yes", _("yes")); |
---|
829 | addchoicebox(g4_script, "no", _("no")); |
---|
830 | setchoiceboxselection(g4_script, getlist(myconfig, "g4_script", NULL)); |
---|
831 | |
---|
832 | addchoicebox(g4_auto_off, "off", _("off")); |
---|
833 | addchoicebox(g4_auto_off, "both", _("both")); |
---|
834 | addchoicebox(g4_auto_off, "standby", _("standby")); |
---|
835 | addchoicebox(g4_auto_off, "deep", _("deep")); |
---|
836 | setchoiceboxselection(g4_auto_off, getlist(myconfig, "g4_auto_off", NULL)); |
---|
837 | |
---|
838 | addchoicebox(g4_delay, "0", "0"); |
---|
839 | addchoicebox(g4_delay, "1", "1"); |
---|
840 | addchoicebox(g4_delay, "2", "2"); |
---|
841 | addchoicebox(g4_delay, "3", "3"); |
---|
842 | addchoicebox(g4_delay, "4", "4"); |
---|
843 | addchoicebox(g4_delay, "5", "5"); |
---|
844 | addchoicebox(g4_delay, "6", "6"); |
---|
845 | addchoicebox(g4_delay, "7", "7"); |
---|
846 | addchoicebox(g4_delay, "8", "8"); |
---|
847 | addchoicebox(g4_delay, "9", "9"); |
---|
848 | addchoicebox(g4_delay, "10", "10"); |
---|
849 | setchoiceboxselection(g4_delay, getlist(myconfig, "g4_delay", NULL)); |
---|
850 | |
---|
851 | addchoicebox(g4_delayhard, "0", "0"); |
---|
852 | addchoicebox(g4_delayhard, "1", "1"); |
---|
853 | addchoicebox(g4_delayhard, "2", "2"); |
---|
854 | addchoicebox(g4_delayhard, "3", "3"); |
---|
855 | addchoicebox(g4_delayhard, "4", "4"); |
---|
856 | addchoicebox(g4_delayhard, "5", "5"); |
---|
857 | setchoiceboxselection(g4_delayhard, getlist(myconfig, "g4_delayhard", NULL)); |
---|
858 | |
---|
859 | |
---|
860 | drawscreen(sis_einstellungen, 0, 0); |
---|
861 | addscreenrc(sis_einstellungen, listbox); |
---|
862 | tmp = listbox->select; |
---|
863 | |
---|
864 | while(1) |
---|
865 | { |
---|
866 | addscreenrc(sis_einstellungen, tmp); |
---|
867 | rcret = waitrc(sis_einstellungen, 1000, 0); |
---|
868 | tmp = listbox->select; |
---|
869 | |
---|
870 | if(rcret == getrcconfigint("rcexit", NULL)) break; |
---|
871 | if(rcret == getrcconfigint("rcgreen", NULL)) |
---|
872 | { |
---|
873 | //drawscreen(load, 0, 0); |
---|
874 | addlist(myconfig, "g1_name", g1_name->ret); |
---|
875 | addlist(myconfig, "g1_auto_on", g1_auto_on->ret); |
---|
876 | addlist(myconfig, "g1_timer", g1_timer->ret); |
---|
877 | addlist(myconfig, "g1_auto_off", g1_auto_off->ret); |
---|
878 | addlist(myconfig, "g1_delay", g1_delay->ret); |
---|
879 | addlist(myconfig, "g1_delayhard", g1_delayhard->ret); |
---|
880 | addlist(myconfig, "g1_script", g1_script->ret); |
---|
881 | |
---|
882 | addlist(myconfig, "g2_name", g2_name->ret); |
---|
883 | addlist(myconfig, "g2_auto_on", g2_auto_on->ret); |
---|
884 | addlist(myconfig, "g2_timer", g2_timer->ret); |
---|
885 | addlist(myconfig, "g2_auto_off", g2_auto_off->ret); |
---|
886 | addlist(myconfig, "g2_delay", g2_delay->ret); |
---|
887 | addlist(myconfig, "g2_delayhard", g2_delayhard->ret); |
---|
888 | addlist(myconfig, "g2_script", g2_script->ret); |
---|
889 | |
---|
890 | addlist(myconfig, "g3_name", g3_name->ret); |
---|
891 | addlist(myconfig, "g3_auto_on", g3_auto_on->ret); |
---|
892 | addlist(myconfig, "g3_timer", g3_timer->ret); |
---|
893 | addlist(myconfig, "g3_auto_off", g3_auto_off->ret); |
---|
894 | addlist(myconfig, "g3_delay", g3_delay->ret); |
---|
895 | addlist(myconfig, "g3_delayhard", g3_delayhard->ret); |
---|
896 | addlist(myconfig, "g3_script", g3_script->ret); |
---|
897 | |
---|
898 | addlist(myconfig, "g4_name", g4_name->ret); |
---|
899 | addlist(myconfig, "g4_auto_on", g4_auto_on->ret); |
---|
900 | addlist(myconfig, "g4_timer", g4_timer->ret); |
---|
901 | addlist(myconfig, "g4_auto_off", g4_auto_off->ret); |
---|
902 | addlist(myconfig, "g4_delay", g4_delay->ret); |
---|
903 | addlist(myconfig, "g4_delayhard", g4_delayhard->ret); |
---|
904 | addlist(myconfig, "g4_script", g4_script->ret); |
---|
905 | writelist(myconfig, sispmctlconf); |
---|
906 | if(startextern == 1) |
---|
907 | sispmctl_start(3); |
---|
908 | if(stopextern == 1) |
---|
909 | sispmctl_stop(3); |
---|
910 | sleep(1); |
---|
911 | //clearscreen(load); |
---|
912 | } |
---|
913 | } |
---|
914 | delownerrc(sis_einstellungen); |
---|
915 | clearscreen(sis_einstellungen); |
---|
916 | return; |
---|
917 | } |
---|
918 | |
---|
919 | void sispmctl_main() |
---|
920 | { |
---|
921 | int rcret = 0; |
---|
922 | |
---|
923 | rcret = sispmctl_Anzeige(); |
---|
924 | if(rcret == 1) |
---|
925 | sispmctl_settings(); |
---|
926 | |
---|
927 | } |
---|