source: titan/titan/standby.h @ 15272

Last change on this file since 15272 was 14774, checked in by nit, 12 years ago

fix

File size: 2.4 KB
Line 
1#ifndef STANDBY_H
2#define STANDBY_H
3
4void screenstandby()
5{
6        int rcret = 0, voltoff = 1;
7        struct skin* standbyscreen = getscreen("standby");
8        struct stimerthread *epgscan = NULL;
9        char* loctime = NULL, *tmpstr = NULL;
10        time_t lastrun = 0;
11        struct dvbdev* dvbnode = dvbdev;
12
13        rcret = servicestop(status.aktservice, 1, 0);
14        if(rcret == 1)
15        {
16                status.standby = 0;
17                return;
18        }
19
20        //check if all tuner unlocked, if yes set all volt off
21        if(getconfigint("standbytuneroff", NULL) == 1)
22        {
23                while(dvbnode != NULL)
24                {
25                        if(dvbnode->type == FRONTENDDEV && dvbnode->feinfo->type == QPSK && dvbnode->felock > 0)
26                                voltoff = 0;
27                        dvbnode = dvbnode->next;
28                }
29                if(voltoff == 1)
30                {
31                        dvbnode = dvbdev;
32                        while(dvbnode != NULL)
33                        {
34                                if(dvbnode->type == FRONTENDDEV && dvbnode->feinfo->type == QPSK && dvbnode->felock == 0)
35                                        fesetvoltage(dvbnode, SEC_VOLTAGE_OFF, 15);
36                                dvbnode = dvbnode->next;
37                        }
38                }
39        }
40        else
41                voltoff = 0;
42       
43        subtitlepause(1);
44//      clearfb(skinfb);
45//      blitfb(0);
46        setfbtransparent(0);
47        setvfdbrightness(getconfigint("vfdstandbybrightness", NULL));
48        setoverclockfreq(0);
49
50        status.protecttime = 0;
51        status.rcowner = standbyscreen;
52       
53        system("vdstandby -a");
54        while(1)
55        {
56                rcret = waitrc(standbyscreen, 10000, 0);
57
58                if(rcret == getrcconfigint("rcpower", NULL)) break;
59
60                //check for epg update
61                loctime = gettime(NULL, "%H:%M");
62                if(lastrun + 300 < time(NULL) && ostrcmp(loctime, getconfig("epg_refreshtime", NULL)) == 0)
63                {
64                        voltoff = 1; //is not a real voltoff, but after standby this makes a new channel tuning
65                        //start epg scanlist
66                        lastrun = time(NULL);
67                        epgscan = addtimer(&epgscanlistthread, START, 1000, 1, NULL, NULL, NULL);
68                }
69                free(loctime); loctime = 0;
70        }
71
72        if(gettimer(epgscan) != NULL)
73        {
74                int i = 0;
75                epgscan->aktion = STOP;
76                while(gettimer(epgscan) != NULL && epgscan->status != DEACTIVE)
77                {
78                        usleep(100000);
79                        i++; if(i > 50) break;
80                }
81        }
82       
83        system("vdstandby -d");
84
85        setoverclockfreq(1);
86        setosdtransparent(getskinconfigint("osdtransparent", NULL));
87        setvfdbrightness(getconfigint("vfdbrightness", NULL));
88
89        tmpstr = ostrcat(status.lastservice->channellist, NULL, 0, 0);
90        if(voltoff == 1)
91                servicestart(status.lastservice->channel, tmpstr, NULL, 4);
92        else
93                servicestart(status.lastservice->channel, tmpstr, NULL, 0);
94        free(tmpstr); tmpstr = NULL;
95
96        subtitlepause(0);
97        status.standby = 0;
98        status.startmode = 2;
99        sleep(1);
100        status.rcowner = NULL;
101}
102
103#endif
Note: See TracBrowser for help on using the repository browser.