source: titan/plugins/lcdsamsung/lcdsamsung.c @ 26912

Last change on this file since 26912 was 24709, checked in by obi, 10 years ago

fix lcdsamsung / lcdpearl check all paths on start.

  • Property svn:executable set to *
File size: 35.8 KB
Line 
1#include "../../titan/struct.h"
2#include "../../titan/debug.h"
3#include "../../titan/header.h"
4
5#include "lcd_weather.h"
6
7char pluginname[] = "LCD Samsung SPF..";
8char plugindesc[] = "Extensions";
9char pluginpic[] = "%pluginpath%/lcdsamsung/lcdsamsung.png";
10
11int pluginaktiv = 0;
12//int pluginversion = PLUGINVERSION;
13int pluginversion = 999999;
14
15struct stimerthread* LCD_Samsung1thread = NULL;
16
17int firststart = 0;
18
19void weather_getline(FILE* fd, char* fileline)
20{
21        fgets(fileline, 256, fd);
22        if(fileline[0] == '#' || fileline[0] == '\n')
23                return;
24        if(fileline[strlen(fileline) - 1] == '\n')
25                fileline[strlen(fileline) - 1] = '\0';
26        if(fileline[strlen(fileline) - 1] == '\r')
27                fileline[strlen(fileline) - 1] = '\0';
28}
29
30void LCD_start_lcd4linux()
31{
32        int count = 0;
33        char* startlcd = NULL;
34       
35        if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf75h") == 0)
36        {
37                startlcd = createpluginpath("/lcdsamsung/start.sh", 0);
38                startlcd = ostrcat(startlcd, " 1", 1, 0);
39        }
40        else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf83h") == 0)
41        {
42                startlcd = createpluginpath("/lcdsamsung/start.sh", 0);
43                startlcd = ostrcat(startlcd, " 6", 1, 0);
44        }
45        else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf87hold") == 0)
46        {
47                startlcd = createpluginpath("/lcdsamsung/start.sh", 0);
48                startlcd = ostrcat(startlcd, " 3", 1, 0);
49        }
50        else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf87h") == 0)
51        {
52                startlcd = createpluginpath("/lcdsamsung/start.sh", 0);
53                startlcd = ostrcat(startlcd, " 2", 1, 0);
54        }
55        else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf105p") == 0)
56        {
57                startlcd = createpluginpath("/lcdsamsung/start.sh", 0);
58                startlcd = ostrcat(startlcd, " 5", 1, 0);
59        }
60        else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf107h") == 0)
61        {
62                startlcd = createpluginpath("/lcdsamsung/start.sh", 0);
63                startlcd = ostrcat(startlcd, " 4", 1, 0);
64        }
65        else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf72h") == 0)
66        {
67                startlcd = createpluginpath("/lcdsamsung/start.sh", 0);
68                startlcd = ostrcat(startlcd, " 7", 1, 0);
69        }
70        else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf85h") == 0)
71        {
72                startlcd = createpluginpath("/lcdsamsung/start.sh", 0);
73                startlcd = ostrcat(startlcd, " 8", 1, 0);
74        }
75        else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf85p") == 0)
76        {
77                startlcd = createpluginpath("/lcdsamsung/start.sh", 0);
78                startlcd = ostrcat(startlcd, " 9", 1, 0);
79        }
80        else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "none") == 0)
81        {
82                startlcd = createpluginpath("/lcdsamsung/start.sh", 0);
83                startlcd = ostrcat(startlcd, " 99", 1, 0);
84        }
85        else
86        {
87                startlcd = createpluginpath("/lcdsamsung/start.sh", 0);
88                startlcd = ostrcat(startlcd, " 2", 1, 0);
89        }
90       
91       
92        if(LCD_Samsung1thread == NULL)
93                return;
94        while (LCD_Samsung1thread->aktion != STOP && system("ps | grep -v grep | grep fbread") != 0) {
95                system(startlcd);
96                sleep(6);
97                count ++;
98                if(LCD_Samsung1thread == NULL)
99                        break;
100                if(count == 101) {
101                        textbox(_("Message"), _("ERROR cant start LCD driver"), _("OK"), getrcconfigint("rcok", NULL), NULL, 0, NULL, 0, NULL, 0, 600, 200, 5, 0);
102                        LCD_Samsung1thread->aktion = STOP;
103                }
104        }
105        free(startlcd);startlcd=NULL;   
106}
107
108void LCD_Samsung1_thread()
109{
110       
111        struct skin* LCD_Samsung1 = NULL;
112        struct skin* LCD_Standby = NULL;
113        struct skin* LCD_Play = NULL;
114       
115        struct skin* day0_t = NULL;
116        struct skin* day0_i = NULL;
117        struct skin* day0_d = NULL;
118        struct skin* day1_t = NULL;
119        struct skin* day1_i = NULL;
120        struct skin* day1_d = NULL;
121        struct skin* day2_t = NULL;
122        struct skin* day2_i = NULL;
123        struct skin* day2_d = NULL;
124        struct skin* day3_t = NULL;
125        struct skin* day3_i = NULL;
126        struct skin* day3_d = NULL;
127        struct skin* akttime = NULL;
128        struct skin* akttime_Standby = NULL;
129       
130        struct skin* n_stunde = NULL;
131        struct skin* n_minute = NULL;
132        struct skin* n_stunde_standby = NULL;
133        struct skin* n_minute_standby = NULL;
134       
135        struct skin* n_stunde2 = NULL;
136        struct skin* n_minute2 = NULL;
137        struct skin* n_stunde2_standby = NULL;
138        struct skin* n_minute2_standby = NULL;
139       
140        struct skin* sday0_t = NULL;
141        struct skin* sday0_i = NULL;
142        struct skin* sday0_d = NULL;
143        struct skin* sday1_t = NULL;
144        struct skin* sday1_i = NULL;
145        struct skin* sday1_d = NULL;
146        struct skin* sday2_t = NULL;
147        struct skin* sday2_i = NULL;
148        struct skin* sday2_d = NULL;
149        struct skin* sday3_t = NULL;
150        struct skin* sday3_i = NULL;
151        struct skin* sday3_d = NULL;
152       
153       
154        char* tmpstr = NULL, *tmpstr2 = NULL, *tmpstr3 = NULL, *timemerk = NULL, *sendermerk = NULL, *recmerk = NULL;
155        char* pichr = NULL, *picmin = NULL, *pichr_standby = NULL, *picmin_standby = NULL;
156        char* pichr2 = NULL, *picmin2 = NULL, *pichr2_standby = NULL, *picmin2_standby = NULL;
157        int digitaluhr = 0, digitaluhr_standby = 0;
158        FILE *fd = NULL;
159        char *fileline = NULL;
160        int weatherwrite = 999;
161        int weatherref = 0;
162        char* startlcd = NULL;
163       
164        if(ostrcmp(getconfig("lcd_samsung_plugin_wetter", NULL), "yes") == 0)
165        {
166                if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf75h") == 0)
167                        LCD_Samsung1 = getscreen("LCD_spf75_Wetter");
168                else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf87h") == 0)
169                        LCD_Samsung1 = getscreen("LCD_spf87_Wetter");
170                else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf83h") == 0)
171                        LCD_Samsung1 = getscreen("LCD_spf83_Wetter");
172                else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf87hold") == 0)
173                        LCD_Samsung1 = getscreen("LCD_spf87_Wetter");
174                else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf105p") == 0)
175                        LCD_Samsung1 = getscreen("LCD_spf105_Wetter");
176                else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf107h") == 0)
177                        LCD_Samsung1 = getscreen("LCD_spf107_Wetter");
178                else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf72h") == 0)
179                        LCD_Samsung1 = getscreen("LCD_spf72_Wetter");
180                else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf85h") == 0)
181                        LCD_Samsung1 = getscreen("LCD_spf85_Wetter");
182                else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf85p") == 0)
183                        LCD_Samsung1 = getscreen("LCD_spf85_Wetter");
184                else
185                        LCD_Samsung1 = getscreen("LCD_spf87_Wetter");
186                day0_t = getscreennode(LCD_Samsung1, "day0_t");
187                day0_i = getscreennode(LCD_Samsung1, "day0_i");
188                day0_d = getscreennode(LCD_Samsung1, "day0_d");
189                day1_t = getscreennode(LCD_Samsung1, "day1_t");
190                day1_i = getscreennode(LCD_Samsung1, "day1_i");
191                day1_d = getscreennode(LCD_Samsung1, "day1_d");
192                day2_t = getscreennode(LCD_Samsung1, "day2_t");
193                day2_i = getscreennode(LCD_Samsung1, "day2_i");
194                day2_d = getscreennode(LCD_Samsung1, "day2_d");
195                day3_t = getscreennode(LCD_Samsung1, "day3_t");
196                day3_i = getscreennode(LCD_Samsung1, "day3_i");
197                day3_d = getscreennode(LCD_Samsung1, "day3_d");
198                akttime = getscreennode(LCD_Samsung1, "akttime");
199                akttime = getscreennode(LCD_Samsung1, "akttime");
200                n_stunde =  getscreennode(LCD_Samsung1, "stunde");
201                if(n_stunde != NULL)
202                {
203                        pichr = ostrcat(n_stunde->pic, "", 0, 0);
204                        if(ostrstr(pichr, "Digital") != NULL)
205                                digitaluhr = 1;
206                }
207                n_minute =  getscreennode(LCD_Samsung1, "minute");
208                if(n_minute != NULL)
209                        picmin = ostrcat(n_minute->pic, "", 0, 0);
210                if(digitaluhr == 1)
211                {
212                        n_stunde2 =  getscreennode(LCD_Samsung1, "stunde2");
213                        n_minute2 =  getscreennode(LCD_Samsung1, "minute2");
214                        picmin2 = ostrcat(n_minute2->pic, "", 0, 0);
215                        pichr2 = ostrcat(n_stunde2->pic, "", 0, 0);
216                }
217                if(file_exist("/tmp/lcdweather"))
218                        system("rm /tmp/lcdweather");
219                weatherwrite = 0;
220        }
221        else {
222                if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf75h") == 0)
223                        LCD_Samsung1 = getscreen("LCD_spf75");
224                else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf83h") == 0)
225                        LCD_Samsung1 = getscreen("LCD_spf83");
226                else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf87h") == 0)
227                        LCD_Samsung1 = getscreen("LCD_spf87");
228                else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf87hold") == 0)
229                        LCD_Samsung1 = getscreen("LCD_spf87");
230                else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf105p") == 0)
231                        LCD_Samsung1 = getscreen("LCD_spf105");
232                else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf107h") == 0)
233                        LCD_Samsung1 = getscreen("LCD_spf107");
234                else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf72h") == 0)
235                        LCD_Samsung1 = getscreen("LCD_spf72");
236                else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf85h") == 0)
237                        LCD_Samsung1 = getscreen("LCD_spf85");
238                else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf85p") == 0)
239                        LCD_Samsung1 = getscreen("LCD_spf85");
240                else
241                        LCD_Samsung1 = getscreen("LCD_spf87"); 
242                akttime = getscreennode(LCD_Samsung1, "akttime");
243                n_stunde =  getscreennode(LCD_Samsung1, "stunde");
244                if(n_stunde != NULL)
245                {
246                        pichr = ostrcat(n_stunde->pic, "", 0, 0);
247                        if(ostrstr(pichr, "Digital") != NULL)
248                                digitaluhr = 1;
249                }
250                n_minute =  getscreennode(LCD_Samsung1, "minute");
251                if(n_minute != NULL)
252                        picmin = ostrcat(n_minute->pic, "", 0, 0);
253                if(digitaluhr == 1)
254                {
255                        n_stunde2 =  getscreennode(LCD_Samsung1, "stunde2");
256                        n_minute2 =  getscreennode(LCD_Samsung1, "minute2");
257                        picmin2 = ostrcat(n_minute2->pic, "", 0, 0);
258                        pichr2 = ostrcat(n_stunde2->pic, "", 0, 0);
259                }
260        }
261       
262        if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf75h") == 0)
263                LCD_Play = getscreen("LCD_spf75_Play");
264        else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf83h") == 0)
265                LCD_Play = getscreen("LCD_spf83_Play");
266        else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf87h") == 0)
267                LCD_Play = getscreen("LCD_spf87_Play");
268        else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf87hold") == 0)
269                LCD_Play = getscreen("LCD_spf87_Play");
270        else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf105p") == 0)
271                LCD_Play = getscreen("LCD_spf105_Play");
272        else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf107h") == 0)
273                LCD_Play = getscreen("LCD_spf107_Play");
274        else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf72h") == 0)
275                LCD_Play = getscreen("LCD_spf72_Play");
276        else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf85h") == 0)
277                LCD_Play = getscreen("LCD_spf85_Play");
278        else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf85p") == 0)
279                LCD_Play = getscreen("LCD_spf85_Play");
280        else
281                LCD_Play = getscreen("LCD_spf87_Play");
282        struct skin* akttimeplay = getscreennode(LCD_Play, "akttime");
283        struct skin* sprogress = getscreennode(LCD_Play, "progress");
284        struct skin* stitle = getscreennode(LCD_Play, "title1");
285        struct skin* spos = getscreennode(LCD_Play, "pos");
286        struct skin* slen = getscreennode(LCD_Play, "len");
287        struct skin* sreverse = getscreennode(LCD_Play, "reverse");
288               
289        if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf75h") == 0)
290        {
291                startlcd = createpluginpath("/lcdsamsung/start.sh", 0);
292                startlcd = ostrcat(startlcd, " 1", 1, 0);
293        }
294        else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf83h") == 0)
295        {
296                startlcd = createpluginpath("/lcdsamsung/start.sh", 0);
297                startlcd = ostrcat(startlcd, " 6", 1, 0);
298        }
299        else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf87hold") == 0)
300        {
301                startlcd = createpluginpath("/lcdsamsung/start.sh", 0);
302                startlcd = ostrcat(startlcd, " 3", 1, 0);
303        }
304        else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf87h") == 0)
305        {
306                startlcd = createpluginpath("/lcdsamsung/start.sh", 0);
307                startlcd = ostrcat(startlcd, " 2", 1, 0);
308        }
309        else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf105p") == 0)
310        {
311                startlcd = createpluginpath("/lcdsamsung/start.sh", 0);
312                startlcd = ostrcat(startlcd, " 5", 1, 0);
313        }
314        else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf107h") == 0)
315        {
316                startlcd = createpluginpath("/lcdsamsung/start.sh", 0);
317                startlcd = ostrcat(startlcd, " 4", 1, 0);
318        }
319        else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf72h") == 0)
320        {
321                startlcd = createpluginpath("/lcdsamsung/start.sh", 0);
322                startlcd = ostrcat(startlcd, " 7", 1, 0);
323        }
324        else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf85h") == 0)
325        {
326                startlcd = createpluginpath("/lcdsamsung/start.sh", 0);
327                startlcd = ostrcat(startlcd, " 8", 1, 0);
328        }
329        else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf85p") == 0)
330        {
331                startlcd = createpluginpath("/lcdsamsung/start.sh", 0);
332                startlcd = ostrcat(startlcd, " 9", 1, 0);
333        }
334        else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "none") == 0)
335        {
336                startlcd = createpluginpath("/lcdsamsung/start.sh", 0);
337                startlcd = ostrcat(startlcd, " 99", 1, 0);
338        }
339        else
340        {
341                startlcd = createpluginpath("/lcdsamsung/start.sh", 0);
342                startlcd = ostrcat(startlcd, " 2", 1, 0);
343        }
344       
345       
346        if(ostrcmp(getconfig("lcd_samsung_plugin_standby", NULL), "yes") == 0)
347        {
348                if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf75h") == 0)
349                        LCD_Standby = getscreen("LCD_spf75_Standby");
350                else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf83h") == 0)
351                        LCD_Standby = getscreen("LCD_spf83_Standby");
352                else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf87h") == 0)
353                        LCD_Standby = getscreen("LCD_spf87_Standby");
354                else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf87hold") == 0)
355                        LCD_Standby = getscreen("LCD_spf87_Standby");
356                else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf105p") == 0)
357                        LCD_Standby = getscreen("LCD_spf105_Standby");
358                else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf107h") == 0)
359                        LCD_Standby = getscreen("LCD_spf107_Standby");
360                else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf72h") == 0)
361                        LCD_Standby = getscreen("LCD_spf72_Standby");
362                else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf85h") == 0)
363                        LCD_Standby = getscreen("LCD_spf85_Standby");
364                else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf85p") == 0)
365                        LCD_Standby = getscreen("LCD_spf85_Standby");
366                else
367                        LCD_Standby = getscreen("LCD_spf87_Standby");
368                akttime_Standby = getscreennode(LCD_Standby, "akttime");
369                sday0_t = getscreennode(LCD_Standby, "day0_t");
370                sday0_i = getscreennode(LCD_Standby, "day0_i");
371                sday0_d = getscreennode(LCD_Standby, "day0_d");
372                sday1_t = getscreennode(LCD_Standby, "day1_t");
373                sday1_i = getscreennode(LCD_Standby, "day1_i");
374                sday1_d = getscreennode(LCD_Standby, "day1_d");
375                sday2_t = getscreennode(LCD_Standby, "day2_t");
376                sday2_i = getscreennode(LCD_Standby, "day2_i");
377                sday2_d = getscreennode(LCD_Standby, "day2_d");
378                sday3_t = getscreennode(LCD_Standby, "day3_t");
379                sday3_i = getscreennode(LCD_Standby, "day3_i");
380                sday3_d = getscreennode(LCD_Standby, "day3_d");
381               
382                n_stunde_standby =  getscreennode(LCD_Standby, "stunde");
383                if(n_stunde_standby != NULL)
384                {
385                        pichr_standby = ostrcat(n_stunde_standby->pic, "", 0, 0);
386                        if(ostrstr(pichr_standby, "Digital") != NULL)
387                                digitaluhr_standby = 1;
388                }
389                n_minute_standby =  getscreennode(LCD_Standby, "minute");
390                if(n_minute_standby != NULL)
391                        picmin_standby = ostrcat(n_minute_standby->pic, "", 0, 0);
392                if(digitaluhr_standby == 1)
393                {
394                        n_stunde2_standby =  getscreennode(LCD_Standby, "stunde2");
395                        n_minute2_standby =  getscreennode(LCD_Standby, "minute2");
396                        picmin2_standby = ostrcat(n_minute2_standby->pic, "", 0, 0);
397                        pichr2_standby = ostrcat(n_stunde2_standby->pic, "", 0, 0);
398                }
399        }
400       
401       
402        int put = 0, typemerk = 0, type = 0;
403        int standby = 0;
404       
405        unsigned long long int pos = 0, len = 0, reverse = 0;
406        int playertype = 0;
407        int loopcount = 0;
408       
409        int hr = 0, min = 0;
410       
411        if(firststart == 1)
412                sleep(8);
413        firststart = 0;
414        status.write_png = 0;
415        //if(ostrcmp(getconfig("write_fb_to_jpg", NULL), "yes") == 0)
416        //      status.write_png = 1;
417       
418        while (LCD_Samsung1thread->aktion != STOP) {
419
420                tmpstr = gettime(NULL, "%H:%M");
421                hr = atoi(gettime(NULL, "%H"));
422                min = atoi(gettime(NULL, "%M"));
423               
424                // TV Programm läuft
425                if(status.infobaraktiv == 1)
426                {
427                        if(ostrcmp(getconfig("write_fb_to_jpg", NULL), "yes") == 0) {
428                                //status.write_png = 1;
429                                if(type == 999)
430                                        system("killall -3 fbread");
431                        }
432                        tmpstr2 = getaktchannelname(NULL);
433                        tmpstr3 = getrec(NULL, NULL);
434                        type = 1;
435                }
436                // Aufzeichnung wird abgespielt
437                else if(status.playspeed != 0 || status.play != 0 || status.pause != 0)
438                {
439                        if(type == 999)
440                                system("killall -3 fbread");
441                        //status.write_png = 0;
442                        loopcount++ ;
443                        type = 2;
444                }
445                // Sonstige Anzeigen
446                else if(type != 999)
447                {
448                        if(ostrcmp(getconfig("write_fb_to_jpg", NULL), "yes") == 0) {
449                                //status.write_png = 1;
450                                system("killall -1 fbread");
451                        }
452                        type = 999;
453                }
454                else
455                        type = 999;
456               
457                if(typemerk != type)
458                {
459                        put = 1;
460                        typemerk = type;
461                        free(sendermerk);sendermerk=NULL;
462                        free(recmerk);recmerk=NULL;
463                        loopcount = 0;
464                }
465                else
466                        put = 0;
467
468                if(status.security == 1)
469                {
470                        if(status.standby > 0 && standby == 0)
471                        {
472                                if(ostrcmp(getconfig("lcd_samsung_plugin_standby", NULL), "yes") == 0)
473                                        standby = 2;
474                                else
475                                {
476                                        tmpstr = createpluginpath("/lcdsamsung/standby.jpg", 0);
477                                        tmpstr = ostrcat("cp ", tmpstr, 0, 1);
478                                        tmpstr = ostrcat(tmpstr, " /tmp/titanlcd.png", 1, 0);
479                                        system(tmpstr);
480                                        free(tmpstr); tmpstr=NULL;
481                                        sleep(3);
482                                       
483                                        tmpstr = createpluginpath("/lcdsamsung/black.jpg", 0);
484                                        tmpstr = ostrcat("cp ", tmpstr, 0, 1);
485                                        tmpstr = ostrcat(tmpstr, " /tmp/titanlcd.png", 1, 0);
486                                        system(tmpstr);
487                                        sleep(2);
488                                        system("killall fbread");
489                                        standby = 1;
490                                }
491                        }
492                        if(status.standby == 0 && standby > 0)
493                        {
494                                if(standby == 1)
495                                        system(startlcd);
496                                standby = 0;
497                                put = 1;
498                        }
499               
500                        if(weatherthread == NULL && weatherwrite == 0)
501                        {
502                                if(file_exist("/tmp/lcdweather"))
503                                        put = 1;
504                        }                       
505                        if(ostrcmp(tmpstr, timemerk) != 0)
506                        {
507                                free(timemerk);timemerk=NULL;
508                                timemerk = ostrcat(tmpstr, "", 0, 0);
509                                put = 1;
510                        }
511
512                        if(standby == 0 || standby == 2 )
513                        {
514                                if(type == 1 && standby == 0)
515                                {
516                                        if(ostrcmp(tmpstr2, sendermerk) != 0)
517                                        {
518                                                free(sendermerk);sendermerk=NULL;
519                                                sendermerk = ostrcat(tmpstr2, "", 0, 0);
520                                                put = 1;
521                                        }
522                                        if(tmpstr3 == NULL && recmerk != NULL)
523                                        {
524                                                put = 1;
525                                                free(recmerk);recmerk=NULL;
526                                        }
527                                        else if(tmpstr3 != NULL && recmerk == NULL)
528                                        {
529                                                free(recmerk);recmerk=NULL;
530                                                recmerk = ostrcat(tmpstr3, "", 0, 0);
531                                                put = 1;
532                                        }
533                                }
534                                else if(type == 2)
535                                {
536                                        if(loopcount >= 15)
537                                        {
538                                                put = 1;
539                                                loopcount = 0;
540                                        }
541                                }       
542                               
543                                if(put == 1)
544                                {
545                                        if(type == 1)
546                                        {
547                                                // Wettervorhersage
548                                                if(ostrcmp(getconfig("lcd_samsung_plugin_wetter", NULL), "yes") == 0)
549                                                {
550                                                        if(weatherwrite == 0)
551                                                        {
552                                                                if(weatherthread == NULL)
553                                                                {
554                                                                        if(!file_exist("/tmp/lcdweather"))
555                                                                                weatherthread = addtimer(&lcd_writeweather, START, 10000, 1, NULL, NULL, NULL);
556                                                                        else
557                                                                        {
558                                                                                fileline = malloc(256);
559                                                                                if(fileline != NULL)
560                                                                                {
561                                                                                        fd = fopen("/tmp/lcdweather", "r");
562                                                                                        if(fd != NULL)
563                                                                                        {
564                                                                                                if(ostrcmp(getconfig("lcd_samsung_plugin_standby", NULL), "yes") == 0)
565                                                                                                {
566                                                                                                        weather_getline(fd, fileline);weather_getline(fd, fileline);
567                                                                                                        changetext(day0_d, fileline);
568                                                                                                        changetext(sday0_d, fileline);
569                                                                                                        weather_getline(fd, fileline);weather_getline(fd, fileline);
570                                                                                                        changetext(day0_t, fileline);
571                                                                                                        changetext(sday0_t, fileline);
572                                                                                                        weather_getline(fd, fileline);
573                                                                                                        weather_getline(fd, fileline);
574                                                                                                        changepic(day0_i, fileline);
575                                                                                                        changepic(sday0_i, fileline);
576                                                                                               
577                                                                                                        weather_getline(fd, fileline);
578                                                                                                        changetext(day1_d, fileline);
579                                                                                                        changetext(sday1_d, fileline);
580                                                                                                        weather_getline(fd, fileline);weather_getline(fd, fileline);
581                                                                                                        changetext(day1_t, fileline);
582                                                                                                        changetext(sday1_t, fileline);
583                                                                                                        weather_getline(fd, fileline);
584                                                                                                        weather_getline(fd, fileline);
585                                                                                                        changepic(day1_i, fileline);
586                                                                                                        changepic(sday1_i, fileline);
587                                                                                               
588                                                                                                        weather_getline(fd, fileline);
589                                                                                                        changetext(day2_d, fileline);
590                                                                                                        changetext(sday2_d, fileline);
591                                                                                                        weather_getline(fd, fileline);weather_getline(fd, fileline);
592                                                                                                        changetext(day2_t, fileline);
593                                                                                                        changetext(sday2_t, fileline);
594                                                                                                        weather_getline(fd, fileline);
595                                                                                                        weather_getline(fd, fileline);
596                                                                                                        changepic(day2_i, fileline);
597                                                                                                        changepic(sday2_i, fileline);
598                                                                                               
599                                                                                                        weather_getline(fd, fileline);
600                                                                                                        changetext(day3_d, fileline);
601                                                                                                        changetext(sday3_d, fileline);
602                                                                                                        weather_getline(fd, fileline);weather_getline(fd, fileline);
603                                                                                                        changetext(day3_t, fileline);
604                                                                                                        changetext(sday3_t, fileline);
605                                                                                                        weather_getline(fd, fileline);
606                                                                                                        weather_getline(fd, fileline);
607                                                                                                        changepic(day3_i, fileline);
608                                                                                                        changepic(sday3_i, fileline);
609                                                                                                }
610                                                                                                else
611                                                                                                {
612                                                                                                        weather_getline(fd, fileline);weather_getline(fd, fileline);
613                                                                                                        changetext(day0_d, fileline);
614                                                                                                        weather_getline(fd, fileline);weather_getline(fd, fileline);
615                                                                                                        changetext(day0_t, fileline);
616                                                                                                        weather_getline(fd, fileline);
617                                                                                                        weather_getline(fd, fileline);
618                                                                                                        changepic(day0_i, fileline);
619                                                                                               
620                                                                                                        weather_getline(fd, fileline);
621                                                                                                        changetext(day1_d, fileline);
622                                                                                                        weather_getline(fd, fileline);weather_getline(fd, fileline);
623                                                                                                        changetext(day1_t, fileline);
624                                                                                                        weather_getline(fd, fileline);
625                                                                                                        weather_getline(fd, fileline);
626                                                                                                        changepic(day1_i, fileline);
627                                                                                               
628                                                                                                        weather_getline(fd, fileline);
629                                                                                                        changetext(day2_d, fileline);
630                                                                                                        weather_getline(fd, fileline);weather_getline(fd, fileline);
631                                                                                                        changetext(day2_t, fileline);
632                                                                                                        weather_getline(fd, fileline);
633                                                                                                        weather_getline(fd, fileline);
634                                                                                                        changepic(day2_i, fileline);
635                                                                                               
636                                                                                                        weather_getline(fd, fileline);
637                                                                                                        changetext(day3_d, fileline);
638                                                                                                        weather_getline(fd, fileline);weather_getline(fd, fileline);
639                                                                                                        changetext(day3_t, fileline);
640                                                                                                        weather_getline(fd, fileline);
641                                                                                                        weather_getline(fd, fileline);
642                                                                                                        changepic(day3_i, fileline);
643                                                                                                }
644                                                                                                fclose(fd);
645                                                                                        }
646                                                                                        free(fileline); fileline=NULL;
647                                                                                }
648                                                                                weatherwrite = 1;
649                                                                        }                                                               
650                                                                }
651                                                        }               
652                                                }
653                                                if(standby == 0)
654                                                {
655                                                        if(akttime != NULL)
656                                                                changetext(akttime, tmpstr);
657                                                        if(n_minute != NULL && digitaluhr == 0)
658                                                        {
659                                                                free(tmpstr);tmpstr=NULL;
660                                                                tmpstr = ostrcat("min_",gettime(NULL, "%M"), 0, 0);
661                                                                free(n_minute->pic);
662                                                                n_minute->pic = string_replace("min_mm", tmpstr, picmin, 0);
663                                                                free(tmpstr);tmpstr=NULL;
664                                                        }
665                                                        if(n_stunde != NULL && digitaluhr == 0)
666                                                        {
667                                                                free(tmpstr);tmpstr=NULL;
668                                                                if(hr >= 12)
669                                                                        hr = hr - 12;
670                                                                if(hr < 10)
671                                                                        tmpstr = ostrcat("hr_0",oitoa(hr), 0, 1);
672                                                                else
673                                                                        tmpstr = ostrcat("hr_",oitoa(hr), 0, 1);
674                                                                if(min < 12)
675                                                                        tmpstr = ostrcat(tmpstr,"00", 0, 0);
676                                                                else if(min < 24)
677                                                                        tmpstr = ostrcat(tmpstr,"12", 0, 0);
678                                                                else if(min < 36)
679                                                                        tmpstr = ostrcat(tmpstr,"24", 0, 0);
680                                                                else if(min < 48)
681                                                                 tmpstr = ostrcat(tmpstr,"36", 0, 0);
682                                                                else if(min < 60)
683                                                                 tmpstr = ostrcat(tmpstr,"48", 0, 0);                                                           
684                                                                free(n_stunde->pic);
685                                                                n_stunde->pic = string_replace("hr_hhmm", tmpstr, pichr, 0);
686                                                                free(tmpstr);tmpstr=NULL;
687                                                        }
688                                                        if(digitaluhr == 1)
689                                                        {
690                                                                free(tmpstr);tmpstr=NULL;
691                                                                tmpstr = ostrcat("wert_",oitoa(hr/10), 0, 1);
692                                                                n_stunde->pic = string_replace("wert_w", tmpstr, pichr, 0);     
693                                                                free(tmpstr);tmpstr=NULL;
694                                                                tmpstr = ostrcat("wert_",oitoa(hr%10), 0, 1);
695                                                                n_stunde2->pic = string_replace("wert_w", tmpstr, pichr2, 0);   
696                                                                free(tmpstr);tmpstr=NULL;
697                                                                tmpstr = ostrcat("wert_",oitoa(min/10), 0, 1);
698                                                                n_minute->pic = string_replace("wert_w", tmpstr, picmin, 0);   
699                                                                free(tmpstr);tmpstr=NULL;
700                                                                tmpstr = ostrcat("wert_",oitoa(min%10), 0, 1);
701                                                                n_minute2->pic = string_replace("wert_w", tmpstr, picmin2, 0);
702                                                                free(tmpstr);tmpstr=NULL;
703                                                        }       
704                                                               
705                                                                       
706                                                        if(drawscreen(LCD_Samsung1, 0, 0) == -2)
707                                                                printf("nicht genug Speicher fuer drawscreen\n");
708                                                }
709                                                else if(standby == 2)
710                                                {
711                                                        if(akttime_Standby != NULL)
712                                                                changetext(akttime_Standby, tmpstr);
713                                                        if(n_minute_standby != NULL && digitaluhr_standby == 0)
714                                                        {
715                                                                free(tmpstr);tmpstr=NULL;
716                                                                tmpstr = ostrcat("min_",gettime(NULL, "%M"), 0, 0);
717                                                                free(n_minute_standby->pic);
718                                                                n_minute_standby->pic = string_replace("min_mm", tmpstr, picmin_standby, 0);
719                                                                free(tmpstr);tmpstr=NULL;
720                                                        }
721                                                        if(n_stunde_standby != NULL && digitaluhr_standby == 0)
722                                                        {
723                                                                free(tmpstr);tmpstr=NULL;
724                                                                if(hr >= 12)
725                                                                        hr = hr - 12;
726                                                                if(hr < 10)
727                                                                        tmpstr = ostrcat("hr_0",oitoa(hr), 0, 1);
728                                                                else
729                                                                        tmpstr = ostrcat("hr_",oitoa(hr), 0, 1);
730                                                                if(min < 12)
731                                                                        tmpstr = ostrcat(tmpstr,"00", 0, 0);
732                                                                else if(min < 24)
733                                                                        tmpstr = ostrcat(tmpstr,"12", 0, 0);
734                                                                else if(min < 36)
735                                                                        tmpstr = ostrcat(tmpstr,"24", 0, 0);
736                                                                else if(min < 48)
737                                                                 tmpstr = ostrcat(tmpstr,"36", 0, 0);
738                                                                else if(min < 60)
739                                                                 tmpstr = ostrcat(tmpstr,"48", 0, 0);                                                           
740                                                                free(n_stunde_standby->pic);
741                                                                n_stunde_standby->pic = string_replace("hr_hhmm", tmpstr, pichr_standby, 0);
742                                                                free(tmpstr);tmpstr=NULL;
743                                                        }       
744                                                        if(digitaluhr_standby == 1)
745                                                        {
746                                                                free(tmpstr);tmpstr=NULL;
747                                                                tmpstr = ostrcat("wert_",oitoa(hr/10), 0, 1);
748                                                                n_stunde_standby->pic = string_replace("wert_w", tmpstr, pichr_standby, 0);     
749                                                                free(tmpstr);tmpstr=NULL;
750                                                                tmpstr = ostrcat("wert_",oitoa(hr%10), 0, 1);
751                                                                n_stunde2_standby->pic = string_replace("wert_w", tmpstr, pichr2_standby, 0);   
752                                                                free(tmpstr);tmpstr=NULL;
753                                                                tmpstr = ostrcat("wert_",oitoa(min/10), 0, 1);
754                                                                n_minute_standby->pic = string_replace("wert_w", tmpstr, picmin_standby, 0);   
755                                                                free(tmpstr);tmpstr=NULL;
756                                                                tmpstr = ostrcat("wert_",oitoa(min%10), 0, 1);
757                                                                n_minute2_standby->pic = string_replace("wert_w", tmpstr, picmin2_standby, 0);
758                                                                free(tmpstr);tmpstr=NULL;
759                                                        }       
760                                                       
761                                                        drawscreen(LCD_Standby, 0, 0);
762                                                        put = 0;
763                                                }
764                                        }
765                                        else if(type == 2)
766                                        {
767                                                if(status.mcaktiv == 1)
768                                                        playertype = 0;
769                                                else   
770                                                        playertype = getconfigint("playertype", NULL);
771                       
772                                                if(playertype == 1)
773                                                {
774                                                        unsigned long long int startpos = 0;
775                                                        playergetinfots(&len, &startpos, NULL, &pos, NULL, 0);
776                                                        len = len / 90000;
777                                                        pos = (pos - startpos) / 90000;
778                                                }
779                                                else
780                                                {
781                                                        pos = playergetpts() / 90000;
782                                                        len = playergetlength();
783                                                }
784                                                if(pos < 0) pos = 0;
785                                                reverse = len - pos;
786                                                if(len == 0)
787                                                        sprogress->progresssize = 0;
788                                                else
789                                                        sprogress->progresssize = pos * 100 / len;
790                                               
791                                                tmpstr2 = convert_timesec(pos);
792                                                changetext(spos, tmpstr2);
793                                                free(tmpstr2); tmpstr2 = NULL;
794
795                                                tmpstr2 = convert_timesec(len);
796                                                changetext(slen, tmpstr2);
797                                                free(tmpstr2); tmpstr2 = NULL;
798
799                                                tmpstr2 = convert_timesec(reverse);
800                                                changetext(sreverse, tmpstr2);
801                                                free(tmpstr2); tmpstr2 = NULL;
802                                               
803                                                changetext(akttimeplay, tmpstr);
804                                                changetext(stitle, basename(status.playfile));
805                                                if(drawscreen(LCD_Play, 0, 0) == -2)
806                                                        printf("nicht genug Speicher fuer drawscreen\n");
807                                        }
808                                }
809                        }
810                        else
811                        {
812                                if(standby == 2)
813                                {       
814                                        if(put == 1)
815                                        {       
816                                                changetext(akttime_Standby, tmpstr);
817                                                drawscreen(LCD_Standby, 0, 0);
818                                                put = 0;
819                                        }
820                                }
821                        }
822                }
823                free(tmpstr); tmpstr = NULL;
824                free(tmpstr2); tmpstr2 = NULL;
825                free(tmpstr3); tmpstr3 = NULL;
826                //sleep(1);
827                usleep(500000);
828               
829                if(ostrcmp(getconfig("lcd_samsung_plugin_wetter", NULL), "yes") == 0)
830                {
831                        weatherref = weatherref + 1;
832                        if(weatherref == 7200)
833                        {
834                                weatherwrite = 0;
835                                system("rm /tmp/lcdweather");
836                                weatherref = 0;
837                        }
838                }
839        }
840        free(timemerk);timemerk=NULL;
841        free(sendermerk);sendermerk=NULL;
842        free(recmerk);recmerk=NULL;
843        free(startlcd);startlcd=NULL;
844        free(pichr);pichr=NULL;
845        free(picmin);picmin=NULL;
846        free(pichr_standby);pichr=NULL;
847        free(picmin_standby);picmin=NULL;
848        free(pichr2);pichr2=NULL;
849        free(picmin2);picmin2=NULL;
850        free(pichr2_standby);pichr2_standby=NULL;
851        free(picmin2_standby);picmin2_standby=NULL;
852        addconfig("lcd_samsung_plugin_running", "no");
853        LCD_Samsung1thread = NULL;
854        if(drawscreen(LCD_Samsung1, 0, 0) == -2)
855                printf("nicht genug Speicher fuer drawscreen\n");
856        //status.write_png = 0;
857        return;
858}
859
860void LCD_Samsung1_main()
861{
862        if(LCD_Samsung1thread == NULL)
863        {
864                char* tmpstr = NULL;
865               
866                tmpstr = createpluginpath("/lcdsamsung/start.png", 0);
867                tmpstr = ostrcat("cp ", tmpstr, 0, 1);
868                tmpstr = ostrcat(tmpstr, " /tmp/titanlcd.png", 1, 0);
869                system(tmpstr);
870                free(tmpstr); tmpstr=NULL;
871                addconfig("lcd_samsung_plugin_running", "yes");
872                LCD_Samsung1thread = addtimer(&LCD_Samsung1_thread, START, 10000, 1, NULL, NULL, NULL);
873                addtimer(&LCD_start_lcd4linux, START, 10000, 1, NULL, NULL, NULL);
874                sleep(1);
875        }
876        else
877        {
878                        LCD_Samsung1thread->aktion = STOP;
879                        system("echo ende > /tmp/titanlcd.jpg");
880                        sleep(1);
881                        system("killall fbread");
882        }
883}       
884                       
885//wird beim laden ausgefuehrt
886void init(void)
887{
888        char* tmpstr = NULL;
889        pluginaktiv = 1;
890        firststart = 1;
891
892        tmpstr = ostrcat("/var/usr/local/share/titan/plugins/lcdsamsung/skin2.xml", NULL, 0, 0);
893        if(!file_exist(tmpstr))
894        {
895                free(tmpstr); tmpstr = NULL;
896                tmpstr = ostrcat("/var/swap/usr/local/share/titan/plugins/lcdsamsung/skin2.xml", NULL, 0, 0);
897        }
898        if(!file_exist(tmpstr))
899        {
900                free(tmpstr); tmpstr = NULL;
901                tmpstr = ostrcat("/mnt/swapextensions/usr/local/share/titan/plugins/lcdsamsung/skin2.xml", NULL, 0, 0);
902        }
903        if(!file_exist(tmpstr))
904        {
905                free(tmpstr); tmpstr = NULL;
906                tmpstr = createpluginpath("/lcdsamsung/skin.xml", 0);
907        }
908
909        printf("use skin: %s\n", tmpstr);
910
911        readscreen(tmpstr, 119, 1);
912        free(tmpstr); tmpstr = NULL;
913       
914        tmpstr = createpluginpath("/lcdsamsung/black.jpg", 0);
915        tmpstr = ostrcat("cp ", tmpstr, 0, 1);
916        tmpstr = ostrcat(tmpstr, " /tmp/fbreadstop.jpg", 1, 0);
917               
918        system(tmpstr);
919        free(tmpstr); tmpstr = NULL;
920        system("killall fbread");
921        debug(10, "LCD Samsung SPF.. loadet !!!");
922        tmpstr = getconfig("lcd_samsung_plugin_running", NULL);
923        if(ostrcmp(tmpstr, "yes") == 0)
924                LCD_Samsung1_main();
925        tmpstr = NULL;
926}
927
928//wird beim entladen ausgefuehrt
929void deinit(void)
930{
931        delmarkedscreen(119);
932        pluginaktiv = 0;
933        system("echo ende > /tmp/titanlcd.png");
934        sleep(1);
935        system("killall fbread");
936        debug(10, "LCD Samsung unloadet !!!");
937}
938
939
940//wird in der Pluginverwaltung bzw Menue ausfeguehrt
941void start(void)
942{
943        struct skin* samsung1_main = getscreen("samsung1_main");
944        struct skin* listbox = getscreennode(samsung1_main, "listbox");
945        struct skin* lcdtype = getscreennode(samsung1_main, "lcdtype");
946        struct skin* allmenu = getscreennode(samsung1_main, "allmenu");
947        struct skin* aktstandby = getscreennode(samsung1_main, "aktstandby");
948        struct skin* wettervor = getscreennode(samsung1_main, "wettervor");
949        struct skin* wettervorort = getscreennode(samsung1_main, "wettervorort");
950        //struct skin* wettervorplz = getscreennode(samsung1_main, "wettervorplz");
951        //struct skin* wettervorland = getscreennode(samsung1_main, "wettervorland");
952        struct skin* b3 = getscreennode(samsung1_main, "b3");
953        struct skin* tmp = NULL;
954       
955        int rcret = 0;
956        int startstop = 0;
957        int restart = 0;
958       
959  if(getconfig("lcd_samsung_plugin_wetter", NULL) == NULL || ostrcmp(getconfig("lcd_samsung_plugin_wetter", NULL), "no")  == 0)
960  {
961        //wettervorplz->hidden = YES;
962        //wettervorland->hidden = YES;
963        wettervorort->hidden = YES;
964  }
965   
966  addchoicebox(lcdtype, "spf72h", _("SPF-72H"));
967  addchoicebox(lcdtype, "spf75h", _("SPF-75H"));
968  addchoicebox(lcdtype, "spf83h", _("SPF-83H"));
969  addchoicebox(lcdtype, "spf85h", _("SPF-85H"));
970  addchoicebox(lcdtype, "spf85p", _("SPF-85P"));
971  addchoicebox(lcdtype, "spf87h", _("SPF-87H"));
972  addchoicebox(lcdtype, "spf87hold", _("SPF-87H-old"));
973  addchoicebox(lcdtype, "spf105p", _("SPF-105P"));
974  addchoicebox(lcdtype, "spf107h", _("SPF-107H"));
975  addchoicebox(lcdtype, "none", _("tiMote"));
976        setchoiceboxselection(lcdtype, getconfig("lcd_samsung_plugin_type", NULL));
977       
978        addchoicebox(allmenu, "no", _("nein"));
979        addchoicebox(allmenu, "yes", _("ja"));
980        setchoiceboxselection(allmenu, getconfig("write_fb_to_jpg", NULL));
981       
982        addchoicebox(aktstandby, "no", _("nein"));
983        addchoicebox(aktstandby, "yes", _("ja"));
984        setchoiceboxselection(aktstandby, getconfig("lcd_samsung_plugin_standby", NULL));
985       
986        addchoicebox(wettervor, "no", _("nein"));
987  addchoicebox(wettervor, "yes", _("ja"));
988        setchoiceboxselection(wettervor, getconfig("lcd_samsung_plugin_wetter", NULL));
989       
990        //changemask(wettervorplz, "0000");
991        //if(getconfig("lcd_samsung_plugin_wetterplz", NULL) == NULL)
992        //      changeinput(wettervorplz, "10407");
993        //else
994        //      changeinput(wettervorplz, getconfig("lcd_samsung_plugin_wetterplz", NULL));
995               
996        //changemask(wettervorland, "abcdefghijklmnopqrstuvwxyz");
997        //if(getconfig("lcd_samsung_plugin_wetterland", NULL) == NULL)
998        //      changeinput(wettervorland, "Germany");
999        //else
1000        //      changeinput(wettervorland, getconfig("lcd_samsung_plugin_wetterland", NULL));
1001       
1002        changemask(wettervorort, "abcdefghijklmnopqrstuvwxyz");
1003        if(getconfig("lcd_samsung_plugin_wetterort", NULL) == NULL)
1004                changeinput(wettervorort, "Berlin        ");
1005        else
1006                changeinput(wettervorort, getconfig("lcd_samsung_plugin_wetterort", NULL));     
1007       
1008        if(LCD_Samsung1thread != NULL)
1009                changetext(b3, "STOP");
1010        else
1011                changetext(b3, "START");
1012               
1013        drawscreen(samsung1_main, 0, 0);
1014        addscreenrc(samsung1_main, listbox);
1015        tmp = listbox->select;
1016       
1017        while(1)
1018        {
1019                addscreenrc(samsung1_main, tmp);
1020                rcret = waitrc(samsung1_main, 0, 0);
1021                tmp = listbox->select;
1022               
1023                if((rcret == getrcconfigint("rcleft", NULL) || rcret == getrcconfigint("rcright", NULL)) && listbox->select != NULL && ostrcmp(listbox->select->name, "wettervor") == 0)
1024                {
1025                        if(ostrcmp(wettervor->ret, "yes") == 0)
1026                        {
1027                                //wettervorplz->hidden = NO;
1028                        //wettervorland->hidden = NO;
1029                        wettervorort->hidden = NO;
1030                        } else {
1031                                //wettervorplz->hidden = YES;
1032                        //wettervorland->hidden = YES;
1033                        wettervorort->hidden = YES;
1034                }
1035                       
1036                        drawscreen(samsung1_main, 0, 0);
1037                }
1038                                       
1039                if(rcret == getrcconfigint("rcexit", NULL))
1040                        break;
1041                if(rcret == getrcconfigint("rcgreen", NULL))
1042                {
1043                        addconfig("lcd_samsung_plugin_type", lcdtype->ret);
1044                        addconfig("write_fb_to_jpg", allmenu->ret);
1045                        addconfig("lcd_samsung_plugin_standby", aktstandby->ret);
1046                        addconfig("lcd_samsung_plugin_wetter", wettervor->ret);
1047                        addconfig("lcd_samsung_plugin_wetterort", wettervorort->ret);
1048                        //addconfig("lcd_samsung_plugin_wetterplz", wettervorplz->ret);
1049                        //addconfig("lcd_samsung_plugin_wetterland", wettervorland->ret);
1050                        restart = 1;
1051                        break;
1052                }
1053                       
1054                if(rcret == getrcconfigint("rcblue", NULL))
1055                {
1056                        addconfig("lcd_samsung_plugin_type", lcdtype->ret);
1057                        addconfig("write_fb_to_jpg", allmenu->ret);
1058                        addconfig("lcd_samsung_plugin_standby", aktstandby->ret);
1059                        addconfig("lcd_samsung_plugin_wetter", wettervor->ret);
1060                        addconfig("lcd_samsung_plugin_wetterort", wettervorort->ret);
1061                        //addconfig("lcd_samsung_plugin_wetterplz", wettervorplz->ret);
1062                        //addconfig("lcd_samsung_plugin_wetterland", wettervorland->ret);
1063                        startstop = 1;
1064                        break;
1065                }
1066        }
1067        delownerrc(samsung1_main);
1068        clearscreen(samsung1_main);
1069       
1070        if(LCD_Samsung1thread != NULL && restart == 1)
1071        {
1072                LCD_Samsung1thread->aktion = STOP;
1073                system("killall fbread");       
1074                sleep(2);
1075                addtimer(&LCD_start_lcd4linux, START, 10000, 1, NULL, NULL, NULL);
1076                LCD_Samsung1thread = addtimer(&LCD_Samsung1_thread, START, 10000, 1, NULL, NULL, NULL);
1077                sleep(1);
1078                return;
1079        }
1080        if(startstop == 1)
1081        {
1082                if(LCD_Samsung1thread != NULL)
1083                {
1084                        addconfig("lcd_samsung_plugin_running", "no");
1085                        LCD_Samsung1thread->aktion = STOP;
1086                        sleep(1);
1087                        system("killall fbread");
1088                        debug(10, "LCD Samsung unloadet !!!"); 
1089                        sleep(1);
1090                }
1091                else {
1092                        addconfig("lcd_samsung_plugin_running", "yes");
1093                        firststart = 1;
1094                        LCD_Samsung1_main();
1095                }
1096        }
1097}
Note: See TracBrowser for help on using the repository browser.