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

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

cleanup

  • Property svn:executable set to *
File size: 35.5 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.standby > 0 && standby == 0)
469                {
470                        if(ostrcmp(getconfig("lcd_samsung_plugin_standby", NULL), "yes") == 0)
471                                standby = 2;
472                        else
473                        {
474                                tmpstr = createpluginpath("/lcdsamsung/standby.jpg", 0);
475                                tmpstr = ostrcat("cp ", tmpstr, 0, 1);
476                                tmpstr = ostrcat(tmpstr, " /tmp/titanlcd.png", 1, 0);
477                                system(tmpstr);
478                                free(tmpstr); tmpstr=NULL;
479                                sleep(3);
480                               
481                                tmpstr = createpluginpath("/lcdsamsung/black.jpg", 0);
482                                tmpstr = ostrcat("cp ", tmpstr, 0, 1);
483                                tmpstr = ostrcat(tmpstr, " /tmp/titanlcd.png", 1, 0);
484                                system(tmpstr);
485                                sleep(2);
486                                system("killall fbread");
487                                standby = 1;
488                        }
489                }
490                if(status.standby == 0 && standby > 0)
491                {
492                        if(standby == 1)
493                                system(startlcd);
494                        standby = 0;
495                        put = 1;
496                }
497       
498                if(weatherthread == NULL && weatherwrite == 0)
499                {
500                        if(file_exist("/tmp/lcdweather"))
501                                put = 1;
502                }                       
503                if(ostrcmp(tmpstr, timemerk) != 0)
504                {
505                        free(timemerk);timemerk=NULL;
506                        timemerk = ostrcat(tmpstr, "", 0, 0);
507                        put = 1;
508                }
509
510                if(standby == 0 || standby == 2 )
511                {
512                        if(type == 1 && standby == 0)
513                        {
514                                if(ostrcmp(tmpstr2, sendermerk) != 0)
515                                {
516                                        free(sendermerk);sendermerk=NULL;
517                                        sendermerk = ostrcat(tmpstr2, "", 0, 0);
518                                        put = 1;
519                                }
520                                if(tmpstr3 == NULL && recmerk != NULL)
521                                {
522                                        put = 1;
523                                        free(recmerk);recmerk=NULL;
524                                }
525                                else if(tmpstr3 != NULL && recmerk == NULL)
526                                {
527                                        free(recmerk);recmerk=NULL;
528                                        recmerk = ostrcat(tmpstr3, "", 0, 0);
529                                        put = 1;
530                                }
531                        }
532                        else if(type == 2)
533                        {
534                                if(loopcount >= 15)
535                                {
536                                        put = 1;
537                                        loopcount = 0;
538                                }
539                        }       
540                       
541                        if(put == 1)
542                        {
543                                if(type == 1)
544                                {
545                                        // Wettervorhersage
546                                        if(ostrcmp(getconfig("lcd_samsung_plugin_wetter", NULL), "yes") == 0)
547                                        {
548                                                if(weatherwrite == 0)
549                                                {
550                                                        if(weatherthread == NULL)
551                                                        {
552                                                                if(!file_exist("/tmp/lcdweather"))
553                                                                        weatherthread = addtimer(&lcd_writeweather, START, 10000, 1, NULL, NULL, NULL);
554                                                                else
555                                                                {
556                                                                        fileline = malloc(256);
557                                                                        if(fileline != NULL)
558                                                                        {
559                                                                                fd = fopen("/tmp/lcdweather", "r");
560                                                                                if(fd != NULL)
561                                                                                {
562                                                                                        if(ostrcmp(getconfig("lcd_samsung_plugin_standby", NULL), "yes") == 0)
563                                                                                        {
564                                                                                                weather_getline(fd, fileline);weather_getline(fd, fileline);
565                                                                                                changetext(day0_d, fileline);
566                                                                                                changetext(sday0_d, fileline);
567                                                                                                weather_getline(fd, fileline);weather_getline(fd, fileline);
568                                                                                                changetext(day0_t, fileline);
569                                                                                                changetext(sday0_t, fileline);
570                                                                                                weather_getline(fd, fileline);
571                                                                                                weather_getline(fd, fileline);
572                                                                                                changepic(day0_i, fileline);
573                                                                                                changepic(sday0_i, fileline);
574                                                                                       
575                                                                                                weather_getline(fd, fileline);
576                                                                                                changetext(day1_d, fileline);
577                                                                                                changetext(sday1_d, fileline);
578                                                                                                weather_getline(fd, fileline);weather_getline(fd, fileline);
579                                                                                                changetext(day1_t, fileline);
580                                                                                                changetext(sday1_t, fileline);
581                                                                                                weather_getline(fd, fileline);
582                                                                                                weather_getline(fd, fileline);
583                                                                                                changepic(day1_i, fileline);
584                                                                                                changepic(sday1_i, fileline);
585                                                                                       
586                                                                                                weather_getline(fd, fileline);
587                                                                                                changetext(day2_d, fileline);
588                                                                                                changetext(sday2_d, fileline);
589                                                                                                weather_getline(fd, fileline);weather_getline(fd, fileline);
590                                                                                                changetext(day2_t, fileline);
591                                                                                                changetext(sday2_t, fileline);
592                                                                                                weather_getline(fd, fileline);
593                                                                                                weather_getline(fd, fileline);
594                                                                                                changepic(day2_i, fileline);
595                                                                                                changepic(sday2_i, fileline);
596                                                                                       
597                                                                                                weather_getline(fd, fileline);
598                                                                                                changetext(day3_d, fileline);
599                                                                                                changetext(sday3_d, fileline);
600                                                                                                weather_getline(fd, fileline);weather_getline(fd, fileline);
601                                                                                                changetext(day3_t, fileline);
602                                                                                                changetext(sday3_t, fileline);
603                                                                                                weather_getline(fd, fileline);
604                                                                                                weather_getline(fd, fileline);
605                                                                                                changepic(day3_i, fileline);
606                                                                                                changepic(sday3_i, fileline);
607                                                                                        }
608                                                                                        else
609                                                                                        {
610                                                                                                weather_getline(fd, fileline);weather_getline(fd, fileline);
611                                                                                                changetext(day0_d, fileline);
612                                                                                                weather_getline(fd, fileline);weather_getline(fd, fileline);
613                                                                                                changetext(day0_t, fileline);
614                                                                                                weather_getline(fd, fileline);
615                                                                                                weather_getline(fd, fileline);
616                                                                                                changepic(day0_i, fileline);
617                                                                                       
618                                                                                                weather_getline(fd, fileline);
619                                                                                                changetext(day1_d, fileline);
620                                                                                                weather_getline(fd, fileline);weather_getline(fd, fileline);
621                                                                                                changetext(day1_t, fileline);
622                                                                                                weather_getline(fd, fileline);
623                                                                                                weather_getline(fd, fileline);
624                                                                                                changepic(day1_i, fileline);
625                                                                                       
626                                                                                                weather_getline(fd, fileline);
627                                                                                                changetext(day2_d, fileline);
628                                                                                                weather_getline(fd, fileline);weather_getline(fd, fileline);
629                                                                                                changetext(day2_t, fileline);
630                                                                                                weather_getline(fd, fileline);
631                                                                                                weather_getline(fd, fileline);
632                                                                                                changepic(day2_i, fileline);
633                                                                                       
634                                                                                                weather_getline(fd, fileline);
635                                                                                                changetext(day3_d, fileline);
636                                                                                                weather_getline(fd, fileline);weather_getline(fd, fileline);
637                                                                                                changetext(day3_t, fileline);
638                                                                                                weather_getline(fd, fileline);
639                                                                                                weather_getline(fd, fileline);
640                                                                                                changepic(day3_i, fileline);
641                                                                                        }
642                                                                                        fclose(fd);
643                                                                                }
644                                                                                free(fileline); fileline=NULL;
645                                                                        }
646                                                                        weatherwrite = 1;
647                                                                }                                                               
648                                                        }
649                                                }               
650                                        }
651                                        if(standby == 0)
652                                        {
653                                                if(akttime != NULL)
654                                                        changetext(akttime, tmpstr);
655                                                if(n_minute != NULL && digitaluhr == 0)
656                                                {
657                                                        free(tmpstr);tmpstr=NULL;
658                                                        tmpstr = ostrcat("min_",gettime(NULL, "%M"), 0, 0);
659                                                        free(n_minute->pic);
660                                                        n_minute->pic = string_replace("min_mm", tmpstr, picmin, 0);
661                                                        free(tmpstr);tmpstr=NULL;
662                                                }
663                                                if(n_stunde != NULL && digitaluhr == 0)
664                                                {
665                                                        free(tmpstr);tmpstr=NULL;
666                                                        if(hr >= 12)
667                                                                hr = hr - 12;
668                                                        if(hr < 10)
669                                                                tmpstr = ostrcat("hr_0",oitoa(hr), 0, 1);
670                                                        else
671                                                                tmpstr = ostrcat("hr_",oitoa(hr), 0, 1);
672                                                        if(min < 12)
673                                                                tmpstr = ostrcat(tmpstr,"00", 0, 0);
674                                                        else if(min < 24)
675                                                                tmpstr = ostrcat(tmpstr,"12", 0, 0);
676                                                        else if(min < 36)
677                                                                tmpstr = ostrcat(tmpstr,"24", 0, 0);
678                                                        else if(min < 48)
679                                                         tmpstr = ostrcat(tmpstr,"36", 0, 0);
680                                                        else if(min < 60)
681                                                         tmpstr = ostrcat(tmpstr,"48", 0, 0);                                                           
682                                                        free(n_stunde->pic);
683                                                        n_stunde->pic = string_replace("hr_hhmm", tmpstr, pichr, 0);
684                                                        free(tmpstr);tmpstr=NULL;
685                                                }
686                                                if(digitaluhr == 1)
687                                                {
688                                                        free(tmpstr);tmpstr=NULL;
689                                                        tmpstr = ostrcat("wert_",oitoa(hr/10), 0, 1);
690                                                        n_stunde->pic = string_replace("wert_w", tmpstr, pichr, 0);     
691                                                        free(tmpstr);tmpstr=NULL;
692                                                        tmpstr = ostrcat("wert_",oitoa(hr%10), 0, 1);
693                                                        n_stunde2->pic = string_replace("wert_w", tmpstr, pichr2, 0);   
694                                                        free(tmpstr);tmpstr=NULL;
695                                                        tmpstr = ostrcat("wert_",oitoa(min/10), 0, 1);
696                                                        n_minute->pic = string_replace("wert_w", tmpstr, picmin, 0);   
697                                                        free(tmpstr);tmpstr=NULL;
698                                                        tmpstr = ostrcat("wert_",oitoa(min%10), 0, 1);
699                                                        n_minute2->pic = string_replace("wert_w", tmpstr, picmin2, 0);
700                                                        free(tmpstr);tmpstr=NULL;
701                                                }       
702                                                       
703                                                               
704                                                if(drawscreen(LCD_Samsung1, 0, 0) == -2)
705                                                        printf("nicht genug Speicher fuer drawscreen\n");
706                                        }
707                                        else if(standby == 2)
708                                        {
709                                                if(akttime_Standby != NULL)
710                                                        changetext(akttime_Standby, tmpstr);
711                                                if(n_minute_standby != NULL && digitaluhr_standby == 0)
712                                                {
713                                                        free(tmpstr);tmpstr=NULL;
714                                                        tmpstr = ostrcat("min_",gettime(NULL, "%M"), 0, 0);
715                                                        free(n_minute_standby->pic);
716                                                        n_minute_standby->pic = string_replace("min_mm", tmpstr, picmin_standby, 0);
717                                                        free(tmpstr);tmpstr=NULL;
718                                                }
719                                                if(n_stunde_standby != NULL && digitaluhr_standby == 0)
720                                                {
721                                                        free(tmpstr);tmpstr=NULL;
722                                                        if(hr >= 12)
723                                                                hr = hr - 12;
724                                                        if(hr < 10)
725                                                                tmpstr = ostrcat("hr_0",oitoa(hr), 0, 1);
726                                                        else
727                                                                tmpstr = ostrcat("hr_",oitoa(hr), 0, 1);
728                                                        if(min < 12)
729                                                                tmpstr = ostrcat(tmpstr,"00", 0, 0);
730                                                        else if(min < 24)
731                                                                tmpstr = ostrcat(tmpstr,"12", 0, 0);
732                                                        else if(min < 36)
733                                                                tmpstr = ostrcat(tmpstr,"24", 0, 0);
734                                                        else if(min < 48)
735                                                         tmpstr = ostrcat(tmpstr,"36", 0, 0);
736                                                        else if(min < 60)
737                                                         tmpstr = ostrcat(tmpstr,"48", 0, 0);                                                           
738                                                        free(n_stunde_standby->pic);
739                                                        n_stunde_standby->pic = string_replace("hr_hhmm", tmpstr, pichr_standby, 0);
740                                                        free(tmpstr);tmpstr=NULL;
741                                                }       
742                                                if(digitaluhr_standby == 1)
743                                                {
744                                                        free(tmpstr);tmpstr=NULL;
745                                                        tmpstr = ostrcat("wert_",oitoa(hr/10), 0, 1);
746                                                        n_stunde_standby->pic = string_replace("wert_w", tmpstr, pichr_standby, 0);     
747                                                        free(tmpstr);tmpstr=NULL;
748                                                        tmpstr = ostrcat("wert_",oitoa(hr%10), 0, 1);
749                                                        n_stunde2_standby->pic = string_replace("wert_w", tmpstr, pichr2_standby, 0);   
750                                                        free(tmpstr);tmpstr=NULL;
751                                                        tmpstr = ostrcat("wert_",oitoa(min/10), 0, 1);
752                                                        n_minute_standby->pic = string_replace("wert_w", tmpstr, picmin_standby, 0);   
753                                                        free(tmpstr);tmpstr=NULL;
754                                                        tmpstr = ostrcat("wert_",oitoa(min%10), 0, 1);
755                                                        n_minute2_standby->pic = string_replace("wert_w", tmpstr, picmin2_standby, 0);
756                                                        free(tmpstr);tmpstr=NULL;
757                                                }       
758                                               
759                                                drawscreen(LCD_Standby, 0, 0);
760                                                put = 0;
761                                        }
762                                }
763                                else if(type == 2)
764                                {
765                                        if(status.mcaktiv == 1)
766                                                playertype = 0;
767                                        else   
768                                                playertype = getconfigint("playertype", NULL);
769               
770                                        if(playertype == 1)
771                                        {
772                                                unsigned long long int startpos = 0;
773                                                playergetinfots(&len, &startpos, NULL, &pos, NULL, 0);
774                                                len = len / 90000;
775                                                pos = (pos - startpos) / 90000;
776                                        }
777                                        else
778                                        {
779                                                pos = playergetpts() / 90000;
780                                                len = playergetlength();
781                                        }
782                                        if(pos < 0) pos = 0;
783                                        reverse = len - pos;
784                                        if(len == 0)
785                                                sprogress->progresssize = 0;
786                                        else
787                                                sprogress->progresssize = pos * 100 / len;
788                                       
789                                        tmpstr2 = convert_timesec(pos);
790                                        changetext(spos, tmpstr2);
791                                        free(tmpstr2); tmpstr2 = NULL;
792
793                                        tmpstr2 = convert_timesec(len);
794                                        changetext(slen, tmpstr2);
795                                        free(tmpstr2); tmpstr2 = NULL;
796
797                                        tmpstr2 = convert_timesec(reverse);
798                                        changetext(sreverse, tmpstr2);
799                                        free(tmpstr2); tmpstr2 = NULL;
800                                       
801                                        changetext(akttimeplay, tmpstr);
802                                        changetext(stitle, basename(status.playfile));
803                                        if(drawscreen(LCD_Play, 0, 0) == -2)
804                                                printf("nicht genug Speicher fuer drawscreen\n");
805                                }
806                        }
807                }
808                else
809                {
810                        if(standby == 2)
811                        {       
812                                if(put == 1)
813                                {       
814                                        changetext(akttime_Standby, tmpstr);
815                                        drawscreen(LCD_Standby, 0, 0);
816                                        put = 0;
817                                }
818                        }
819                }
820
821                free(tmpstr); tmpstr = NULL;
822                free(tmpstr2); tmpstr2 = NULL;
823                free(tmpstr3); tmpstr3 = NULL;
824                //sleep(1);
825                usleep(500000);
826               
827                if(ostrcmp(getconfig("lcd_samsung_plugin_wetter", NULL), "yes") == 0)
828                {
829                        weatherref = weatherref + 1;
830                        if(weatherref == 7200)
831                        {
832                                weatherwrite = 0;
833                                system("rm /tmp/lcdweather");
834                                weatherref = 0;
835                        }
836                }
837        }
838        free(timemerk);timemerk=NULL;
839        free(sendermerk);sendermerk=NULL;
840        free(recmerk);recmerk=NULL;
841        free(startlcd);startlcd=NULL;
842        free(pichr);pichr=NULL;
843        free(picmin);picmin=NULL;
844        free(pichr_standby);pichr=NULL;
845        free(picmin_standby);picmin=NULL;
846        free(pichr2);pichr2=NULL;
847        free(picmin2);picmin2=NULL;
848        free(pichr2_standby);pichr2_standby=NULL;
849        free(picmin2_standby);picmin2_standby=NULL;
850        addconfig("lcd_samsung_plugin_running", "no");
851        LCD_Samsung1thread = NULL;
852        if(drawscreen(LCD_Samsung1, 0, 0) == -2)
853                printf("nicht genug Speicher fuer drawscreen\n");
854        //status.write_png = 0;
855        return;
856}
857
858void LCD_Samsung1_main()
859{
860        if(LCD_Samsung1thread == NULL)
861        {
862                char* tmpstr = NULL;
863               
864                tmpstr = createpluginpath("/lcdsamsung/start.png", 0);
865                tmpstr = ostrcat("cp ", tmpstr, 0, 1);
866                tmpstr = ostrcat(tmpstr, " /tmp/titanlcd.png", 1, 0);
867                system(tmpstr);
868                free(tmpstr); tmpstr=NULL;
869                addconfig("lcd_samsung_plugin_running", "yes");
870                LCD_Samsung1thread = addtimer(&LCD_Samsung1_thread, START, 10000, 1, NULL, NULL, NULL);
871                addtimer(&LCD_start_lcd4linux, START, 10000, 1, NULL, NULL, NULL);
872                sleep(1);
873        }
874        else
875        {
876                        LCD_Samsung1thread->aktion = STOP;
877                        system("echo ende > /tmp/titanlcd.jpg");
878                        sleep(1);
879                        system("killall fbread");
880        }
881}       
882                       
883//wird beim laden ausgefuehrt
884void init(void)
885{
886        char* tmpstr = NULL;
887        pluginaktiv = 1;
888        firststart = 1;
889
890        tmpstr = ostrcat("/var/usr/local/share/titan/plugins/lcdsamsung/skin2.xml", NULL, 0, 0);
891        if(!file_exist(tmpstr))
892        {
893                free(tmpstr); tmpstr = NULL;
894                tmpstr = ostrcat("/var/swap/usr/local/share/titan/plugins/lcdsamsung/skin2.xml", NULL, 0, 0);
895        }
896        if(!file_exist(tmpstr))
897        {
898                free(tmpstr); tmpstr = NULL;
899                tmpstr = ostrcat("/mnt/swapextensions/usr/local/share/titan/plugins/lcdsamsung/skin2.xml", NULL, 0, 0);
900        }
901        if(!file_exist(tmpstr))
902        {
903                free(tmpstr); tmpstr = NULL;
904                tmpstr = createpluginpath("/lcdsamsung/skin.xml", 0);
905        }
906
907        printf("use skin: %s\n", tmpstr);
908
909        readscreen(tmpstr, 119, 1);
910        free(tmpstr); tmpstr = NULL;
911       
912        tmpstr = createpluginpath("/lcdsamsung/black.jpg", 0);
913        tmpstr = ostrcat("cp ", tmpstr, 0, 1);
914        tmpstr = ostrcat(tmpstr, " /tmp/fbreadstop.jpg", 1, 0);
915               
916        system(tmpstr);
917        free(tmpstr); tmpstr = NULL;
918        system("killall fbread");
919        debug(10, "LCD Samsung SPF.. loadet !!!");
920        tmpstr = getconfig("lcd_samsung_plugin_running", NULL);
921        if(ostrcmp(tmpstr, "yes") == 0)
922                LCD_Samsung1_main();
923        tmpstr = NULL;
924}
925
926//wird beim entladen ausgefuehrt
927void deinit(void)
928{
929        delmarkedscreen(119);
930        pluginaktiv = 0;
931        system("echo ende > /tmp/titanlcd.png");
932        sleep(1);
933        system("killall fbread");
934        debug(10, "LCD Samsung unloadet !!!");
935}
936
937
938//wird in der Pluginverwaltung bzw Menue ausfeguehrt
939void start(void)
940{
941        struct skin* samsung1_main = getscreen("samsung1_main");
942        struct skin* listbox = getscreennode(samsung1_main, "listbox");
943        struct skin* lcdtype = getscreennode(samsung1_main, "lcdtype");
944        struct skin* allmenu = getscreennode(samsung1_main, "allmenu");
945        struct skin* aktstandby = getscreennode(samsung1_main, "aktstandby");
946        struct skin* wettervor = getscreennode(samsung1_main, "wettervor");
947        struct skin* wettervorort = getscreennode(samsung1_main, "wettervorort");
948        //struct skin* wettervorplz = getscreennode(samsung1_main, "wettervorplz");
949        //struct skin* wettervorland = getscreennode(samsung1_main, "wettervorland");
950        struct skin* b3 = getscreennode(samsung1_main, "b3");
951        struct skin* tmp = NULL;
952       
953        int rcret = 0;
954        int startstop = 0;
955        int restart = 0;
956       
957  if(getconfig("lcd_samsung_plugin_wetter", NULL) == NULL || ostrcmp(getconfig("lcd_samsung_plugin_wetter", NULL), "no")  == 0)
958  {
959        //wettervorplz->hidden = YES;
960        //wettervorland->hidden = YES;
961        wettervorort->hidden = YES;
962  }
963   
964  addchoicebox(lcdtype, "spf72h", _("SPF-72H"));
965  addchoicebox(lcdtype, "spf75h", _("SPF-75H"));
966  addchoicebox(lcdtype, "spf83h", _("SPF-83H"));
967  addchoicebox(lcdtype, "spf85h", _("SPF-85H"));
968  addchoicebox(lcdtype, "spf85p", _("SPF-85P"));
969  addchoicebox(lcdtype, "spf87h", _("SPF-87H"));
970  addchoicebox(lcdtype, "spf87hold", _("SPF-87H-old"));
971  addchoicebox(lcdtype, "spf105p", _("SPF-105P"));
972  addchoicebox(lcdtype, "spf107h", _("SPF-107H"));
973  addchoicebox(lcdtype, "none", _("tiMote"));
974        setchoiceboxselection(lcdtype, getconfig("lcd_samsung_plugin_type", NULL));
975       
976        addchoicebox(allmenu, "no", _("nein"));
977        addchoicebox(allmenu, "yes", _("ja"));
978        setchoiceboxselection(allmenu, getconfig("write_fb_to_jpg", NULL));
979       
980        addchoicebox(aktstandby, "no", _("nein"));
981        addchoicebox(aktstandby, "yes", _("ja"));
982        setchoiceboxselection(aktstandby, getconfig("lcd_samsung_plugin_standby", NULL));
983       
984        addchoicebox(wettervor, "no", _("nein"));
985  addchoicebox(wettervor, "yes", _("ja"));
986        setchoiceboxselection(wettervor, getconfig("lcd_samsung_plugin_wetter", NULL));
987       
988        //changemask(wettervorplz, "0000");
989        //if(getconfig("lcd_samsung_plugin_wetterplz", NULL) == NULL)
990        //      changeinput(wettervorplz, "10407");
991        //else
992        //      changeinput(wettervorplz, getconfig("lcd_samsung_plugin_wetterplz", NULL));
993               
994        //changemask(wettervorland, "abcdefghijklmnopqrstuvwxyz");
995        //if(getconfig("lcd_samsung_plugin_wetterland", NULL) == NULL)
996        //      changeinput(wettervorland, "Germany");
997        //else
998        //      changeinput(wettervorland, getconfig("lcd_samsung_plugin_wetterland", NULL));
999       
1000        changemask(wettervorort, "abcdefghijklmnopqrstuvwxyz");
1001        if(getconfig("lcd_samsung_plugin_wetterort", NULL) == NULL)
1002                changeinput(wettervorort, "Berlin        ");
1003        else
1004                changeinput(wettervorort, getconfig("lcd_samsung_plugin_wetterort", NULL));     
1005       
1006        if(LCD_Samsung1thread != NULL)
1007                changetext(b3, "STOP");
1008        else
1009                changetext(b3, "START");
1010               
1011        drawscreen(samsung1_main, 0, 0);
1012        addscreenrc(samsung1_main, listbox);
1013        tmp = listbox->select;
1014       
1015        while(1)
1016        {
1017                addscreenrc(samsung1_main, tmp);
1018                rcret = waitrc(samsung1_main, 0, 0);
1019                tmp = listbox->select;
1020               
1021                if((rcret == getrcconfigint("rcleft", NULL) || rcret == getrcconfigint("rcright", NULL)) && listbox->select != NULL && ostrcmp(listbox->select->name, "wettervor") == 0)
1022                {
1023                        if(ostrcmp(wettervor->ret, "yes") == 0)
1024                        {
1025                                //wettervorplz->hidden = NO;
1026                        //wettervorland->hidden = NO;
1027                        wettervorort->hidden = NO;
1028                        } else {
1029                                //wettervorplz->hidden = YES;
1030                        //wettervorland->hidden = YES;
1031                        wettervorort->hidden = YES;
1032                }
1033                       
1034                        drawscreen(samsung1_main, 0, 0);
1035                }
1036                                       
1037                if(rcret == getrcconfigint("rcexit", NULL))
1038                        break;
1039                if(rcret == getrcconfigint("rcgreen", NULL))
1040                {
1041                        addconfig("lcd_samsung_plugin_type", lcdtype->ret);
1042                        addconfig("write_fb_to_jpg", allmenu->ret);
1043                        addconfig("lcd_samsung_plugin_standby", aktstandby->ret);
1044                        addconfig("lcd_samsung_plugin_wetter", wettervor->ret);
1045                        addconfig("lcd_samsung_plugin_wetterort", wettervorort->ret);
1046                        //addconfig("lcd_samsung_plugin_wetterplz", wettervorplz->ret);
1047                        //addconfig("lcd_samsung_plugin_wetterland", wettervorland->ret);
1048                        restart = 1;
1049                        break;
1050                }
1051                       
1052                if(rcret == getrcconfigint("rcblue", NULL))
1053                {
1054                        addconfig("lcd_samsung_plugin_type", lcdtype->ret);
1055                        addconfig("write_fb_to_jpg", allmenu->ret);
1056                        addconfig("lcd_samsung_plugin_standby", aktstandby->ret);
1057                        addconfig("lcd_samsung_plugin_wetter", wettervor->ret);
1058                        addconfig("lcd_samsung_plugin_wetterort", wettervorort->ret);
1059                        //addconfig("lcd_samsung_plugin_wetterplz", wettervorplz->ret);
1060                        //addconfig("lcd_samsung_plugin_wetterland", wettervorland->ret);
1061                        startstop = 1;
1062                        break;
1063                }
1064        }
1065        delownerrc(samsung1_main);
1066        clearscreen(samsung1_main);
1067       
1068        if(LCD_Samsung1thread != NULL && restart == 1)
1069        {
1070                LCD_Samsung1thread->aktion = STOP;
1071                system("killall fbread");       
1072                sleep(2);
1073                addtimer(&LCD_start_lcd4linux, START, 10000, 1, NULL, NULL, NULL);
1074                LCD_Samsung1thread = addtimer(&LCD_Samsung1_thread, START, 10000, 1, NULL, NULL, NULL);
1075                sleep(1);
1076                return;
1077        }
1078        if(startstop == 1)
1079        {
1080                if(LCD_Samsung1thread != NULL)
1081                {
1082                        addconfig("lcd_samsung_plugin_running", "no");
1083                        LCD_Samsung1thread->aktion = STOP;
1084                        sleep(1);
1085                        system("killall fbread");
1086                        debug(10, "LCD Samsung unloadet !!!"); 
1087                        sleep(1);
1088                }
1089                else {
1090                        addconfig("lcd_samsung_plugin_running", "yes");
1091                        firststart = 1;
1092                        LCD_Samsung1_main();
1093                }
1094        }
1095}
Note: See TracBrowser for help on using the repository browser.