source: titan/titan/possetup.h @ 39037

Last change on this file since 39037 was 20140, checked in by nit, 11 years ago

[titan] don't allow pos setup if record is running

File size: 5.5 KB
Line 
1#ifndef POSSETUP_H
2#define POSSETUP_H
3
4void possearch(struct skin* possetup, struct dvbdev* dvbnode, int dir)
5{
6        int rcret = 0;
7        uint16_t snr = 0;
8
9        while(1)
10        {
11                rcret = waitrc(possetup, 500, 0);
12                if(rcret == getrcconfigint("rcok", NULL))
13                {
14                        fediseqcrotor(dvbnode, NULL, 0, 0);
15                        break;
16                }
17
18                if(dir == 0)
19                        fediseqcrotor(dvbnode, NULL, 1, 10);
20                else
21                        fediseqcrotor(dvbnode, NULL, 1, 9);
22
23                usleep(300000);
24                drawscreen(possetup, 0, 0);
25                snr = fereadsnr(status.aktservice->fedev);
26                snr = (snr * 100) / 0xffff;
27                if(snr > 50) break;
28        }
29}
30
31void poschangebutton(int type, struct skin* b1, struct skin* b2, struct skin* b3, struct skin* b4)
32{
33        if(type == 0)
34        {
35                changetext(b1, _("move west"));
36                changetext(b2, _("search west"));
37                changetext(b3, _("search east"));
38                changetext(b4, _("move east"));
39        }
40        else if(type == 1)
41        {
42                changetext(b1, NULL);
43                changetext(b2, _("step west"));
44                changetext(b3, _("step east"));
45                changetext(b4, NULL);
46        }
47        else if(type == 2)
48        {
49                changetext(b1, _("limits off"));
50                changetext(b2, _("limit west"));
51                changetext(b3, _("limit east"));
52                changetext(b4, _("limits on"));
53        }
54        else if(type == 3)
55        {
56                changetext(b1, NULL);
57                changetext(b2, _("store position"));
58                changetext(b3, _("goto position"));
59                changetext(b4, NULL);
60        }
61        else if(type == 4)
62        {
63                changetext(b1, _("startposition"));
64                changetext(b2, NULL);
65                changetext(b3, NULL);
66                changetext(b4, NULL);
67        }
68        else
69        {
70                changetext(b1, NULL);
71                changetext(b2, NULL);
72                changetext(b3, NULL);
73                changetext(b4, NULL);
74        }
75}
76
77void screenpossetup()
78{
79        int rcret = 0, i = 0;
80        struct skin* possetup = getscreen("possetup");
81        struct skin* listbox = getscreennode(possetup, "listbox");
82        //struct skin* move = getscreennode(possetup, "move");
83        //struct skin* finemove = getscreennode(possetup, "finemove");
84        //struct skin* limit = getscreennode(possetup, "limit");
85        struct skin* storagepos = getscreennode(possetup, "storagepos");
86        //struct skin* goto0 = getscreennode(possetup, "goto0");
87        struct skin* b1 = getscreennode(possetup, "b1");
88        struct skin* b2 = getscreennode(possetup, "b2");
89        struct skin* b3 = getscreennode(possetup, "b3");
90        struct skin* b4 = getscreennode(possetup, "b4");
91        struct skin* tmp = NULL;
92        char* tmpnr = NULL;
93        //TODO: select tuner
94        struct dvbdev* dvbnode = status.aktservice->fedev;
95
96        if(status.recording > 0 || status.streaming > 0)
97        {
98                textbox(_("Message"), _("Position Setup is not allowed if record\nor stream is running !"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0);
99                return;
100        }
101
102        listbox->aktline = 1;
103        listbox->aktpage = -1;
104
105        for(i = 1; i < 255; i++)
106        {
107                tmpnr = oitoa(i);
108                addchoicebox(storagepos, tmpnr, tmpnr);
109                free(tmpnr); tmpnr = NULL;
110        }
111
112        poschangebutton(0, b1, b2, b3, b4);
113
114        drawscreen(possetup, 0, 0);
115        addscreenrc(possetup, listbox);
116
117        tmp = listbox->select;
118        while(1)
119        {
120                if(rcret != RCTIMEOUT) addscreenrc(possetup, tmp);
121                rcret = waitrc(possetup, 1000, 0);
122                if(rcret == RCTIMEOUT)
123                {
124                        drawscreen(possetup, 0, 0);
125                        continue;
126                }
127                tmp = listbox->select;
128
129                if(listbox->select != NULL)
130                {
131                        if(ostrcmp(listbox->select->name, "move") == 0)
132                                poschangebutton(0, b1, b2, b3, b4);
133                        if(ostrcmp(listbox->select->name, "finemove") == 0)
134                                poschangebutton(1, b1, b2, b3, b4);
135                        if(ostrcmp(listbox->select->name, "limit") == 0)
136                                poschangebutton(2, b1, b2, b3, b4);
137                        if(ostrcmp(listbox->select->name, "storagepos") == 0)
138                                poschangebutton(3, b1, b2, b3, b4);
139                        if(ostrcmp(listbox->select->name, "goto0") == 0)
140                                poschangebutton(4, b1, b2, b3, b4);
141                }
142
143                if(rcret == getrcconfigint("rcexit", NULL))
144                {
145                        fediseqcrotor(dvbnode, NULL, 0, 0);
146                        break;
147                }
148                if(rcret == getrcconfigint("rcok", NULL))
149                        fediseqcrotor(dvbnode, NULL, 0, 0);
150                if(listbox->select != NULL)
151                {
152                        if(rcret == getrcconfigint("rcred", NULL))
153                        {
154                                if(ostrcmp(listbox->select->name, "move") == 0)
155                                        fediseqcrotor(dvbnode, NULL, 0, 6);
156                                if(ostrcmp(listbox->select->name, "limit") == 0)
157                                        fediseqcrotor(dvbnode, NULL, 0, 1);
158                                if(ostrcmp(listbox->select->name, "goto0") == 0)
159                                        fediseqcrotor(dvbnode, NULL, 0, 8);
160                        }
161                        if(rcret == getrcconfigint("rcgreen", NULL))
162                        {
163                                if(ostrcmp(listbox->select->name, "move") == 0)
164                                        possearch(possetup, dvbnode, 0);
165                                if(ostrcmp(listbox->select->name, "finemove") == 0)
166                                        fediseqcrotor(dvbnode, NULL, 1, 10);
167                                if(ostrcmp(listbox->select->name, "limit") == 0)
168                                        fediseqcrotor(dvbnode, NULL, 0, 4);
169                                if(ostrcmp(listbox->select->name, "storagepos") == 0)
170                                {
171                                        if(listbox->select->ret != NULL)
172                                        {
173                                                int pos = atoi(listbox->select->ret);
174                                                fediseqcrotor(dvbnode, NULL, pos, 7);
175                                        }
176                                }
177                        }
178                        if(rcret == getrcconfigint("rcyellow", NULL))
179                        {
180                                if(ostrcmp(listbox->select->name, "move") == 0)
181                                        possearch(possetup, dvbnode, 1);
182                                if(ostrcmp(listbox->select->name, "finemove") == 0)
183                                        fediseqcrotor(dvbnode, NULL, 1, 9);
184                                if(ostrcmp(listbox->select->name, "limit") == 0)
185                                        fediseqcrotor(dvbnode, NULL, 0, 3);
186                                if(ostrcmp(listbox->select->name, "storagepos") == 0)
187                                {
188                                        if(listbox->select->ret != NULL)
189                                        {
190                                                int pos = atoi(listbox->select->ret);
191                                                fediseqcrotor(dvbnode, NULL, pos, 8);
192                                        }
193                                }
194                        }
195                        if(rcret == getrcconfigint("rcblue", NULL))
196                        {
197                                if(ostrcmp(listbox->select->name, "move") == 0)
198                                        fediseqcrotor(dvbnode, NULL, 0, 5);
199                                if(ostrcmp(listbox->select->name, "limit") == 0)
200                                        fediseqcrotor(dvbnode, NULL, 0, 2);
201                        }
202                }
203
204                drawscreen(possetup, 0, 0);
205        }
206
207        delownerrc(possetup);
208        clearscreen(possetup);
209}
210
211#endif
Note: See TracBrowser for help on using the repository browser.