1 | #include "../../titan/struct.h" |
---|
2 | #include "../../titan/debug.h" |
---|
3 | #include "../../titan/header.h" |
---|
4 | |
---|
5 | #include "lcd_weather.h" |
---|
6 | |
---|
7 | char pluginname[] = "LCD Pearl"; |
---|
8 | char plugindesc[] = "Extensions"; |
---|
9 | char pluginpic[] = "%pluginpath%/lcdpearl1/lcdpearl.png"; |
---|
10 | |
---|
11 | int pluginaktiv = 0; |
---|
12 | int pluginversion = PLUGINVERSION; |
---|
13 | //struct skin* pluginmenu = NULL; |
---|
14 | //int pluginflag = 1; //don't show the plugin in pluginmanager |
---|
15 | |
---|
16 | struct stimerthread* LCD_Pearl1thread = NULL; |
---|
17 | |
---|
18 | int firststart = 0; |
---|
19 | |
---|
20 | void weather_getline(FILE* fd, char* fileline) |
---|
21 | { |
---|
22 | fgets(fileline, 256, fd); |
---|
23 | if(fileline[0] == '#' || fileline[0] == '\n') |
---|
24 | return; |
---|
25 | if(fileline[strlen(fileline) - 1] == '\n') |
---|
26 | fileline[strlen(fileline) - 1] = '\0'; |
---|
27 | if(fileline[strlen(fileline) - 1] == '\r') |
---|
28 | fileline[strlen(fileline) - 1] = '\0'; |
---|
29 | } |
---|
30 | |
---|
31 | void LCD_start_lcd4linux() |
---|
32 | { |
---|
33 | int count = 0; |
---|
34 | char* startlcd = createpluginpath("/lcdpearl1/start.sh", 0); |
---|
35 | |
---|
36 | if(LCD_Pearl1thread == NULL) |
---|
37 | return; |
---|
38 | while (LCD_Pearl1thread->aktion != STOP && system("ps | grep -v grep | grep lcd4linux ") != 0) { |
---|
39 | system(startlcd); |
---|
40 | sleep(6); |
---|
41 | count ++; |
---|
42 | if(LCD_Pearl1thread == NULL) |
---|
43 | break; |
---|
44 | if(count == 101) { |
---|
45 | textbox(_("Message"), _("ERROR cant start LCD driver"), _("OK"), getrcconfigint("rcok", NULL), NULL, 0, NULL, 0, NULL, 0, 600, 200, 5, 0); |
---|
46 | LCD_Pearl1thread->aktion = STOP; |
---|
47 | } |
---|
48 | } |
---|
49 | free(startlcd); startlcd=NULL; |
---|
50 | } |
---|
51 | |
---|
52 | void LCD_Pearl1_thread() |
---|
53 | { |
---|
54 | |
---|
55 | struct skin* LCD_Pearl1 = NULL; |
---|
56 | struct skin* LCD_Pearl1_Standby = NULL; |
---|
57 | struct skin* day0_t = NULL; |
---|
58 | struct skin* day0_i = NULL; |
---|
59 | struct skin* day1_t = NULL; |
---|
60 | struct skin* day1_i = NULL; |
---|
61 | struct skin* day2_t = NULL; |
---|
62 | struct skin* day2_i = NULL; |
---|
63 | struct skin* day3_t = NULL; |
---|
64 | struct skin* day3_i = NULL; |
---|
65 | struct skin* akttime = NULL; |
---|
66 | struct skin* akttime_Standby = NULL; |
---|
67 | |
---|
68 | |
---|
69 | char* tmpstr = NULL, *tmpstr2 = NULL, *tmpstr3 = NULL, *timemerk = NULL, *sendermerk = NULL, *recmerk = NULL; |
---|
70 | FILE *fd = NULL; |
---|
71 | char *fileline = NULL; |
---|
72 | int weatherwrite = 999; |
---|
73 | int weatherref = 0; |
---|
74 | |
---|
75 | if(ostrcmp(getconfig("lcd_pearl1_plugin_wetter", NULL), "yes") == 0) |
---|
76 | { |
---|
77 | LCD_Pearl1 = getscreen("LCD_Pearl1_Wetter"); |
---|
78 | day0_t = getscreennode(LCD_Pearl1, "day0_t"); |
---|
79 | day0_i = getscreennode(LCD_Pearl1, "day0_i"); |
---|
80 | day1_t = getscreennode(LCD_Pearl1, "day1_t"); |
---|
81 | day1_i = getscreennode(LCD_Pearl1, "day1_i"); |
---|
82 | day2_t = getscreennode(LCD_Pearl1, "day2_t"); |
---|
83 | day2_i = getscreennode(LCD_Pearl1, "day2_i"); |
---|
84 | day3_t = getscreennode(LCD_Pearl1, "day3_t"); |
---|
85 | day3_i = getscreennode(LCD_Pearl1, "day3_i"); |
---|
86 | if(file_exist("/tmp/lcdweather")) |
---|
87 | system("rm /tmp/lcdweather"); |
---|
88 | weatherwrite = 0; |
---|
89 | } |
---|
90 | else |
---|
91 | LCD_Pearl1 = getscreen("LCD_Pearl1"); |
---|
92 | akttime = getscreennode(LCD_Pearl1, "akttime"); |
---|
93 | |
---|
94 | struct skin* LCD_Play = getscreen("LCD_Play"); |
---|
95 | struct skin* akttimeplay = getscreennode(LCD_Play, "akttime"); |
---|
96 | struct skin* sprogress = getscreennode(LCD_Play, "progress"); |
---|
97 | struct skin* stitle = getscreennode(LCD_Play, "title1"); |
---|
98 | struct skin* spos = getscreennode(LCD_Play, "pos"); |
---|
99 | struct skin* slen = getscreennode(LCD_Play, "len"); |
---|
100 | struct skin* sreverse = getscreennode(LCD_Play, "reverse"); |
---|
101 | |
---|
102 | //struct skin* LCD_MC_Menu = getscreen("LCD_MC_Menu"); |
---|
103 | //struct skin* akttimemc1 = getscreennode(LCD_MC_Menu, "akttime"); |
---|
104 | |
---|
105 | |
---|
106 | if(ostrcmp(getconfig("lcd_pearl1_plugin_standby", NULL), "yes") == 0) |
---|
107 | { |
---|
108 | LCD_Pearl1_Standby = getscreen("LCD_Pearl1_Standby"); |
---|
109 | akttime_Standby = getscreennode(LCD_Pearl1_Standby, "akttime"); |
---|
110 | } |
---|
111 | |
---|
112 | int put = 0, typemerk = 0, type = 0; |
---|
113 | int standby = 0; |
---|
114 | |
---|
115 | char* fbgrab = createpluginpath("/lcdpearl1/fbgrab", 0); |
---|
116 | fbgrab = ostrcat(fbgrab, " -f /tmp/titanlcd.raw -w 320 -h 240 -b 32 -i /tmp/.titanlcd1.png > /dev/null", 1, 0); |
---|
117 | |
---|
118 | char* startlcd = createpluginpath("/lcdpearl1/start.sh", 0); |
---|
119 | |
---|
120 | unsigned long long int pos = 0, len = 0, reverse = 0; |
---|
121 | int playertype = 0; |
---|
122 | int loopcount = 0; |
---|
123 | |
---|
124 | if(firststart == 1) |
---|
125 | sleep(8); |
---|
126 | firststart = 0; |
---|
127 | status.write_png = 0; |
---|
128 | if(ostrcmp(getconfig("write_fb_to_png", NULL), "yes") == 0) |
---|
129 | status.write_png = 1; |
---|
130 | |
---|
131 | while (LCD_Pearl1thread->aktion != STOP) { |
---|
132 | |
---|
133 | tmpstr = gettime(NULL, "%H:%M"); |
---|
134 | |
---|
135 | // TV Programm l�uft |
---|
136 | if(status.infobaraktiv == 1) |
---|
137 | { |
---|
138 | if(ostrcmp(getconfig("write_fb_to_png", NULL), "yes") == 0) |
---|
139 | status.write_png = 1; |
---|
140 | tmpstr2 = getaktchannelname(NULL); |
---|
141 | tmpstr3 = getrec(NULL, NULL); |
---|
142 | type = 1; |
---|
143 | } |
---|
144 | // Aufzeichnung wird abgespielt |
---|
145 | else if(status.playspeed != 0 || status.play != 0 || status.pause != 0) |
---|
146 | { |
---|
147 | status.write_png = 0; |
---|
148 | loopcount++ ; |
---|
149 | type = 2; |
---|
150 | } |
---|
151 | // Sonstige Anzeigen |
---|
152 | else |
---|
153 | { |
---|
154 | if(ostrcmp(getconfig("write_fb_to_png", NULL), "yes") == 0) |
---|
155 | status.write_png = 1; |
---|
156 | type = 999; |
---|
157 | } |
---|
158 | |
---|
159 | if(typemerk != type) |
---|
160 | { |
---|
161 | put = 1; |
---|
162 | typemerk = type; |
---|
163 | free(sendermerk);sendermerk=NULL; |
---|
164 | free(recmerk);recmerk=NULL; |
---|
165 | loopcount = 0; |
---|
166 | } |
---|
167 | else |
---|
168 | put = 0; |
---|
169 | |
---|
170 | if(status.security == 1) |
---|
171 | { |
---|
172 | if(status.standby > 0 && standby == 0) |
---|
173 | { |
---|
174 | if(ostrcmp(getconfig("lcd_pearl1_plugin_standby", NULL), "yes") == 0) |
---|
175 | { |
---|
176 | standby = 2; |
---|
177 | put = 1; |
---|
178 | } |
---|
179 | else { |
---|
180 | system("killall lcd4linux"); |
---|
181 | standby = 1; |
---|
182 | } |
---|
183 | } |
---|
184 | if(status.standby == 0 && standby > 0) |
---|
185 | { |
---|
186 | if(standby == 1) |
---|
187 | system(startlcd); |
---|
188 | standby = 0; |
---|
189 | put = 1; |
---|
190 | } |
---|
191 | |
---|
192 | if(weatherthread == NULL && weatherwrite == 0) |
---|
193 | { |
---|
194 | if(file_exist("/tmp/lcdweather")) |
---|
195 | put = 1; |
---|
196 | } |
---|
197 | |
---|
198 | if(ostrcmp(tmpstr, timemerk) != 0) |
---|
199 | { |
---|
200 | free(timemerk);timemerk=NULL; |
---|
201 | timemerk = ostrcat(tmpstr, "", 0, 0); |
---|
202 | put = 1; |
---|
203 | } |
---|
204 | |
---|
205 | if(standby == 0) |
---|
206 | { |
---|
207 | if(type == 1) |
---|
208 | { |
---|
209 | if(ostrcmp(tmpstr2, sendermerk) != 0) |
---|
210 | { |
---|
211 | free(sendermerk);sendermerk=NULL; |
---|
212 | sendermerk = ostrcat(tmpstr2, "", 0, 0); |
---|
213 | put = 1; |
---|
214 | } |
---|
215 | if(tmpstr3 == NULL && recmerk != NULL) |
---|
216 | { |
---|
217 | put = 1; |
---|
218 | free(recmerk);recmerk=NULL; |
---|
219 | } |
---|
220 | else if(tmpstr3 != NULL && recmerk == NULL) |
---|
221 | { |
---|
222 | free(recmerk);recmerk=NULL; |
---|
223 | recmerk = ostrcat(tmpstr3, "", 0, 0); |
---|
224 | put = 1; |
---|
225 | } |
---|
226 | } |
---|
227 | else if(type == 2) |
---|
228 | { |
---|
229 | if(loopcount >= 15) |
---|
230 | { |
---|
231 | put = 1; |
---|
232 | loopcount = 0; |
---|
233 | } |
---|
234 | } |
---|
235 | |
---|
236 | if(put == 1) |
---|
237 | { |
---|
238 | if(type == 1) |
---|
239 | { |
---|
240 | // Wettervorhersage |
---|
241 | if(ostrcmp(getconfig("lcd_pearl1_plugin_wetter", NULL), "yes") == 0) |
---|
242 | { |
---|
243 | if(weatherwrite == 0) |
---|
244 | { |
---|
245 | if(weatherthread == NULL) |
---|
246 | { |
---|
247 | if(!file_exist("/tmp/lcdweather")) |
---|
248 | weatherthread = addtimer(&lcd_writeweather, START, 10000, 1, NULL, NULL, NULL); |
---|
249 | else |
---|
250 | { |
---|
251 | fileline = malloc(256); |
---|
252 | if(fileline != NULL) |
---|
253 | { |
---|
254 | fd = fopen("/tmp/lcdweather", "r"); |
---|
255 | if(fd != NULL) |
---|
256 | { |
---|
257 | weather_getline(fd, fileline);weather_getline(fd, fileline);weather_getline(fd, fileline); |
---|
258 | weather_getline(fd, fileline); |
---|
259 | changetext(day0_t, fileline); |
---|
260 | weather_getline(fd, fileline); |
---|
261 | weather_getline(fd, fileline); |
---|
262 | changepic(day0_i, fileline); |
---|
263 | |
---|
264 | weather_getline(fd, fileline);weather_getline(fd, fileline); |
---|
265 | weather_getline(fd, fileline); |
---|
266 | changetext(day1_t, fileline); |
---|
267 | weather_getline(fd, fileline); |
---|
268 | weather_getline(fd, fileline); |
---|
269 | changepic(day1_i, fileline); |
---|
270 | |
---|
271 | weather_getline(fd, fileline);weather_getline(fd, fileline); |
---|
272 | weather_getline(fd, fileline); |
---|
273 | changetext(day2_t, fileline); |
---|
274 | weather_getline(fd, fileline); |
---|
275 | weather_getline(fd, fileline); |
---|
276 | changepic(day2_i, fileline); |
---|
277 | |
---|
278 | weather_getline(fd, fileline);weather_getline(fd, fileline); |
---|
279 | weather_getline(fd, fileline); |
---|
280 | changetext(day3_t, fileline); |
---|
281 | weather_getline(fd, fileline); |
---|
282 | weather_getline(fd, fileline); |
---|
283 | changepic(day3_i, fileline); |
---|
284 | fclose(fd); |
---|
285 | } |
---|
286 | free(fileline); fileline=NULL; |
---|
287 | } |
---|
288 | weatherwrite = 1; |
---|
289 | } |
---|
290 | } |
---|
291 | } |
---|
292 | } |
---|
293 | |
---|
294 | changetext(akttime, tmpstr); |
---|
295 | drawscreen(LCD_Pearl1, 0, 0); |
---|
296 | |
---|
297 | //system(fbgrab); |
---|
298 | //system("mv /tmp/.titanlcd1.png /tmp/titanlcd.png"); |
---|
299 | |
---|
300 | //system("/var/bin/fbgrab -f /tmp/titanlcd.raw -w 320 -h 240 -b 32 -i /tmp/titanlcd.png > /dev/null"); |
---|
301 | //system("xloadimage /tmp/titanlcd.png > /dev/null &"); |
---|
302 | |
---|
303 | } |
---|
304 | else if(type == 2) |
---|
305 | { |
---|
306 | if(status.mcaktiv == 1) |
---|
307 | playertype = 0; |
---|
308 | else |
---|
309 | playertype = getconfigint("playertype", NULL); |
---|
310 | |
---|
311 | if(playertype == 1) |
---|
312 | { |
---|
313 | unsigned long long int startpos = 0; |
---|
314 | playergetinfots(&len, &startpos, NULL, &pos, NULL, 0); |
---|
315 | len = len / 90000; |
---|
316 | pos = (pos - startpos) / 90000; |
---|
317 | } |
---|
318 | else |
---|
319 | { |
---|
320 | pos = playergetpts() / 90000; |
---|
321 | len = playergetlength(); |
---|
322 | } |
---|
323 | if(pos < 0) pos = 0; |
---|
324 | reverse = len - pos; |
---|
325 | if(len == 0) |
---|
326 | sprogress->progresssize = 0; |
---|
327 | else |
---|
328 | sprogress->progresssize = pos * 100 / len; |
---|
329 | |
---|
330 | tmpstr2 = convert_timesec(pos); |
---|
331 | changetext(spos, tmpstr2); |
---|
332 | free(tmpstr2); tmpstr2 = NULL; |
---|
333 | |
---|
334 | tmpstr2 = convert_timesec(len); |
---|
335 | changetext(slen, tmpstr2); |
---|
336 | free(tmpstr2); tmpstr2 = NULL; |
---|
337 | |
---|
338 | tmpstr2 = convert_timesec(reverse); |
---|
339 | changetext(sreverse, tmpstr2); |
---|
340 | free(tmpstr2); tmpstr2 = NULL; |
---|
341 | |
---|
342 | changetext(akttimeplay, tmpstr); |
---|
343 | changetext(stitle, basename(status.playfile)); |
---|
344 | drawscreen(LCD_Play, 0, 0); |
---|
345 | |
---|
346 | //else if(type == 999 && status.mcaktiv == 1) |
---|
347 | //else if(type == 999) |
---|
348 | //{ |
---|
349 | //changetext(akttimemc1, tmpstr); |
---|
350 | //drawscreen(LCD_MC_Menu, 0, 3); |
---|
351 | //} |
---|
352 | } |
---|
353 | } |
---|
354 | } |
---|
355 | else |
---|
356 | { |
---|
357 | if(standby == 2) |
---|
358 | { |
---|
359 | if(put == 1) |
---|
360 | { |
---|
361 | changetext(akttime_Standby, tmpstr); |
---|
362 | drawscreen(LCD_Pearl1_Standby, 0, 0); |
---|
363 | put = 0; |
---|
364 | } |
---|
365 | } |
---|
366 | } |
---|
367 | } |
---|
368 | free(tmpstr); tmpstr = NULL; |
---|
369 | free(tmpstr2); tmpstr2 = NULL; |
---|
370 | free(tmpstr3); tmpstr3 = NULL; |
---|
371 | |
---|
372 | do |
---|
373 | { |
---|
374 | //sleep(1); |
---|
375 | usleep(500000); |
---|
376 | }while ( status.aktservice->type == TMPOTHER ); //virtual zap |
---|
377 | |
---|
378 | if(ostrcmp(getconfig("lcd_pearl1_plugin_wetter", NULL), "yes") == 0) |
---|
379 | { |
---|
380 | weatherref = weatherref + 1; |
---|
381 | if(weatherref == 7200) |
---|
382 | { |
---|
383 | weatherwrite = 0; |
---|
384 | system("rm /tmp/lcdweather"); |
---|
385 | weatherref = 0; |
---|
386 | } |
---|
387 | } |
---|
388 | |
---|
389 | } |
---|
390 | free(timemerk);timemerk=NULL; |
---|
391 | free(sendermerk);sendermerk=NULL; |
---|
392 | free(recmerk);recmerk=NULL; |
---|
393 | free(fbgrab);fbgrab=NULL; |
---|
394 | free(startlcd);startlcd=NULL; |
---|
395 | addconfig("lcd_pearl1_plugin_running", "no"); |
---|
396 | LCD_Pearl1thread = NULL; |
---|
397 | drawscreen(LCD_Pearl1, 0, 0); |
---|
398 | status.write_png = 0; |
---|
399 | return; |
---|
400 | } |
---|
401 | |
---|
402 | void LCD_Pearl1_main() |
---|
403 | { |
---|
404 | if(LCD_Pearl1thread == NULL) |
---|
405 | { |
---|
406 | char* tmpstr = NULL; |
---|
407 | |
---|
408 | tmpstr = createpluginpath("/lcdpearl1/start.png", 0); |
---|
409 | tmpstr = ostrcat("cp ", tmpstr, 0, 1); |
---|
410 | tmpstr = ostrcat(tmpstr, " /tmp/titanlcd.png", 1, 0); |
---|
411 | |
---|
412 | system(tmpstr); |
---|
413 | free(tmpstr); tmpstr=NULL; |
---|
414 | //textbox(_("Message"), _("LCD Pearl1 starts ..."), _("OK"), getrcconfigint("rcok", NULL), NULL, 0, NULL, 0, NULL, 0, 600, 200, 5, 0); |
---|
415 | addconfig("lcd_pearl1_plugin_running", "yes"); |
---|
416 | LCD_Pearl1thread = addtimer(&LCD_Pearl1_thread, START, 10000, 1, NULL, NULL, NULL); |
---|
417 | addtimer(&LCD_start_lcd4linux, START, 10000, 1, NULL, NULL, NULL); |
---|
418 | sleep(1); |
---|
419 | } |
---|
420 | else |
---|
421 | { |
---|
422 | //if (textbox(_("Message"), _("Stop LCD Pearl1 ?"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("exit", NULL), NULL, 0, NULL, 0, 600, 200, 5, 0) != 2); |
---|
423 | //{ |
---|
424 | LCD_Pearl1thread->aktion = STOP; |
---|
425 | system("echo ende > /tmp/titanlcd.png"); |
---|
426 | sleep(1); |
---|
427 | system("killall lcd4linux"); |
---|
428 | //} |
---|
429 | } |
---|
430 | } |
---|
431 | |
---|
432 | //wird beim laden ausgefuehrt |
---|
433 | void init(void) |
---|
434 | { |
---|
435 | char* tmpstr = NULL; |
---|
436 | pluginaktiv = 1; |
---|
437 | firststart = 1; |
---|
438 | |
---|
439 | tmpstr = ostrcat("/var/usr/local/share/titan/plugins/lcdpearl1/skin2.xml", NULL, 0, 0); |
---|
440 | if(!file_exist(tmpstr)) |
---|
441 | { |
---|
442 | free(tmpstr); tmpstr = NULL; |
---|
443 | tmpstr = ostrcat("/var/swap/usr/local/share/titan/plugins/lcdpearl1/skin2.xml", NULL, 0, 0); |
---|
444 | } |
---|
445 | if(!file_exist(tmpstr)) |
---|
446 | { |
---|
447 | free(tmpstr); tmpstr = NULL; |
---|
448 | tmpstr = ostrcat("/mnt/swapextensions/usr/local/share/titan/plugins/lcdpearl1/skin2.xml", NULL, 0, 0); |
---|
449 | } |
---|
450 | if(!file_exist(tmpstr)) |
---|
451 | { |
---|
452 | free(tmpstr); tmpstr = NULL; |
---|
453 | tmpstr = createpluginpath("/lcdpearl1/skin.xml", 0); |
---|
454 | } |
---|
455 | |
---|
456 | printf("use skin: %s\n", tmpstr); |
---|
457 | |
---|
458 | readscreen(tmpstr, 116, 1); |
---|
459 | free(tmpstr); tmpstr = NULL; |
---|
460 | debug(10, "LCD Pearl loadet !!!"); |
---|
461 | tmpstr = getconfig("lcd_pearl1_plugin_running", NULL); |
---|
462 | if(ostrcmp(tmpstr, "yes") == 0) |
---|
463 | LCD_Pearl1_main(); |
---|
464 | tmpstr=NULL; |
---|
465 | } |
---|
466 | |
---|
467 | //wird beim entladen ausgefuehrt |
---|
468 | void deinit(void) |
---|
469 | { |
---|
470 | delmarkedscreen(116); |
---|
471 | pluginaktiv = 0; |
---|
472 | system("echo ende > /tmp/titanlcd.png"); |
---|
473 | sleep(1); |
---|
474 | system("killall lcd4linux"); |
---|
475 | debug(10, "LCD Pearl1 unloadet !!!"); |
---|
476 | } |
---|
477 | |
---|
478 | |
---|
479 | //wird in der Pluginverwaltung bzw Menue ausfeguehrt |
---|
480 | void start(void) |
---|
481 | { |
---|
482 | struct skin* pearl1_main = getscreen("pearl1_main"); |
---|
483 | struct skin* listbox = getscreennode(pearl1_main, "listbox"); |
---|
484 | struct skin* allmenu = getscreennode(pearl1_main, "allmenu"); |
---|
485 | struct skin* aktstandby = getscreennode(pearl1_main, "aktstandby"); |
---|
486 | struct skin* wettervor = getscreennode(pearl1_main, "wettervor"); |
---|
487 | struct skin* wettervorort = getscreennode(pearl1_main, "wettervorort"); |
---|
488 | //struct skin* wettervorplz = getscreennode(pearl1_main, "wettervorplz"); |
---|
489 | //struct skin* wettervorland = getscreennode(pearl1_main, "wettervorland"); |
---|
490 | struct skin* b3 = getscreennode(pearl1_main, "b3"); |
---|
491 | struct skin* tmp = NULL; |
---|
492 | |
---|
493 | int rcret = 0; |
---|
494 | int startstop = 0; |
---|
495 | int restart = 0; |
---|
496 | |
---|
497 | if(getconfig("lcd_pearl1_plugin_wetter", NULL) == NULL || ostrcmp(getconfig("lcd_pearl1_plugin_wetter", NULL), "no") == 0) |
---|
498 | { |
---|
499 | wettervorort->hidden = YES; |
---|
500 | //wettervorplz->hidden = YES; |
---|
501 | //wettervorland->hidden = YES; |
---|
502 | } |
---|
503 | |
---|
504 | addchoicebox(allmenu, "no", _("nein")); |
---|
505 | addchoicebox(allmenu, "yes", _("ja")); |
---|
506 | setchoiceboxselection(allmenu, getconfig("write_fb_to_png", NULL)); |
---|
507 | |
---|
508 | addchoicebox(aktstandby, "no", _("nein")); |
---|
509 | addchoicebox(aktstandby, "yes", _("ja")); |
---|
510 | setchoiceboxselection(aktstandby, getconfig("lcd_pearl1_plugin_standby", NULL)); |
---|
511 | |
---|
512 | addchoicebox(wettervor, "no", _("nein")); |
---|
513 | addchoicebox(wettervor, "yes", _("ja")); |
---|
514 | setchoiceboxselection(wettervor, getconfig("lcd_pearl1_plugin_wetter", NULL)); |
---|
515 | |
---|
516 | //changemask(wettervorplz, "0000"); |
---|
517 | //if(getconfig("lcd_pearl1_plugin_wetterplz", NULL) == NULL) |
---|
518 | // changeinput(wettervorplz, "10407"); |
---|
519 | //else |
---|
520 | // changeinput(wettervorplz, getconfig("lcd_pearl1_plugin_wetterplz", NULL)); |
---|
521 | |
---|
522 | //changemask(wettervorland, "abcdefghijklmnopqrstuvwxyz"); |
---|
523 | //if(getconfig("lcd_pearl1_plugin_wetterland", NULL) == NULL) |
---|
524 | // changeinput(wettervorland, "Germany"); |
---|
525 | //else |
---|
526 | // changeinput(wettervorland, getconfig("lcd_pearl1_plugin_wetterland", NULL)); |
---|
527 | |
---|
528 | changemask(wettervorort, "abcdefghijklmnopqrstuvwxyz"); |
---|
529 | if(getconfig("lcd_pearl1_plugin_wetterort", NULL) == NULL) |
---|
530 | changeinput(wettervorort, "Berlin "); |
---|
531 | else |
---|
532 | changeinput(wettervorort, getconfig("lcd_pearl1_plugin_wetterort", NULL)); |
---|
533 | |
---|
534 | |
---|
535 | if(LCD_Pearl1thread != NULL) |
---|
536 | changetext(b3, "STOP"); |
---|
537 | else |
---|
538 | changetext(b3, "START"); |
---|
539 | |
---|
540 | drawscreen(pearl1_main, 0, 0); |
---|
541 | addscreenrc(pearl1_main, listbox); |
---|
542 | tmp = listbox->select; |
---|
543 | |
---|
544 | while(1) |
---|
545 | { |
---|
546 | addscreenrc(pearl1_main, tmp); |
---|
547 | rcret = waitrc(pearl1_main, 0, 0); |
---|
548 | tmp = listbox->select; |
---|
549 | |
---|
550 | if((rcret == getrcconfigint("rcleft", NULL) || rcret == getrcconfigint("rcright", NULL)) && listbox->select != NULL && ostrcmp(listbox->select->name, "wettervor") == 0) |
---|
551 | { |
---|
552 | if(ostrcmp(wettervor->ret, "yes") == 0) |
---|
553 | { |
---|
554 | wettervorort->hidden = NO; |
---|
555 | //wettervorplz->hidden = NO; |
---|
556 | //wettervorland->hidden = NO; |
---|
557 | } else { |
---|
558 | wettervorort->hidden = YES; |
---|
559 | //wettervorplz->hidden = YES; |
---|
560 | //wettervorland->hidden = YES; |
---|
561 | } |
---|
562 | |
---|
563 | drawscreen(pearl1_main, 0, 0); |
---|
564 | } |
---|
565 | |
---|
566 | if(rcret == getrcconfigint("rcexit", NULL)) |
---|
567 | break; |
---|
568 | if(rcret == getrcconfigint("rcgreen", NULL)) |
---|
569 | { |
---|
570 | addconfig("write_fb_to_png", allmenu->ret); |
---|
571 | addconfig("lcd_pearl1_plugin_standby", aktstandby->ret); |
---|
572 | addconfig("lcd_pearl1_plugin_wetter", wettervor->ret); |
---|
573 | addconfig("lcd_pearl1_plugin_wetterort", wettervorort->ret); |
---|
574 | //addconfig("lcd_pearl1_plugin_wetterplz", wettervorplz->ret); |
---|
575 | //addconfig("lcd_pearl1_plugin_wetterland", wettervorland->ret); |
---|
576 | restart = 1; |
---|
577 | break; |
---|
578 | } |
---|
579 | |
---|
580 | if(rcret == getrcconfigint("rcblue", NULL)) |
---|
581 | { |
---|
582 | startstop = 1; |
---|
583 | break; |
---|
584 | } |
---|
585 | } |
---|
586 | delownerrc(pearl1_main); |
---|
587 | clearscreen(pearl1_main); |
---|
588 | |
---|
589 | if(LCD_Pearl1thread != NULL && restart == 1) |
---|
590 | { |
---|
591 | LCD_Pearl1thread->aktion = STOP; |
---|
592 | sleep(2); |
---|
593 | LCD_Pearl1thread = addtimer(&LCD_Pearl1_thread, START, 10000, 1, NULL, NULL, NULL); |
---|
594 | sleep(1); |
---|
595 | return; |
---|
596 | } |
---|
597 | if(startstop == 1) |
---|
598 | { |
---|
599 | if(LCD_Pearl1thread != NULL) |
---|
600 | { |
---|
601 | addconfig("lcd_pearl1_plugin_running", "no"); |
---|
602 | LCD_Pearl1thread->aktion = STOP; |
---|
603 | sleep(1); |
---|
604 | system("killall lcd4linux"); |
---|
605 | debug(10, "LCD Pearl1 unloadet !!!"); |
---|
606 | sleep(1); |
---|
607 | } |
---|
608 | else { |
---|
609 | addconfig("lcd_pearl1_plugin_running", "yes"); |
---|
610 | firststart = 1; |
---|
611 | LCD_Pearl1_main(); |
---|
612 | //LCD_Pearl1thread = addtimer(&LCD_Pearl1_thread, START, 10000, 1, NULL, NULL, NULL); |
---|
613 | //addtimer(&LCD_start_lcd4linux, START, 10000, 1, NULL, NULL, NULL); |
---|
614 | //sleep(1); |
---|
615 | } |
---|
616 | } |
---|
617 | } |
---|