source: titan/titan/possetup.h @ 14151

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

[titan] change possetup

File size: 5.3 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);
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        listbox->aktline = 1;
97        listbox->aktpage = -1;
98
99        for(i = 1; i < 255; i++)
100        {
101                tmpnr = oitoa(i);
102                addchoicebox(storagepos, tmpnr, tmpnr);
103                free(tmpnr); tmpnr = NULL;
104        }
105
106        poschangebutton(0, b1, b2, b3, b4);
107
108        drawscreen(possetup, 0);
109        addscreenrc(possetup, listbox);
110
111        tmp = listbox->select;
112        while(1)
113        {
114                if(rcret != RCTIMEOUT) addscreenrc(possetup, tmp);
115                rcret = waitrc(possetup, 1000, 0);
116                if(rcret == RCTIMEOUT)
117                {
118                        drawscreen(possetup, 0);
119                        continue;
120                }
121                tmp = listbox->select;
122
123                if(listbox->select != NULL)
124                {
125                        if(ostrcmp(listbox->select->name, "move") == 0)
126                                poschangebutton(0, b1, b2, b3, b4);
127                        if(ostrcmp(listbox->select->name, "finemove") == 0)
128                                poschangebutton(1, b1, b2, b3, b4);
129                        if(ostrcmp(listbox->select->name, "limit") == 0)
130                                poschangebutton(2, b1, b2, b3, b4);
131                        if(ostrcmp(listbox->select->name, "storagepos") == 0)
132                                poschangebutton(3, b1, b2, b3, b4);
133                        if(ostrcmp(listbox->select->name, "goto0") == 0)
134                                poschangebutton(4, b1, b2, b3, b4);
135                }
136
137                if(rcret == getrcconfigint("rcexit", NULL))
138                {
139                        fediseqcrotor(dvbnode, NULL, 0, 0);
140                        break;
141                }
142                if(rcret == getrcconfigint("rcok", NULL))
143                        fediseqcrotor(dvbnode, NULL, 0, 0);
144                if(listbox->select != NULL)
145                {
146                        if(rcret == getrcconfigint("rcred", NULL))
147                        {
148                                if(ostrcmp(listbox->select->name, "move") == 0)
149                                {
150                                        fediseqcrotor(dvbnode, NULL, 0, 6);
151                                        fediseqcrotor(dvbnode, NULL, 0, 0);
152                                }
153                                if(ostrcmp(listbox->select->name, "limit") == 0)
154                                        fediseqcrotor(dvbnode, NULL, 0, 1);
155                                if(ostrcmp(listbox->select->name, "goto0") == 0)
156                                        fediseqcrotor(dvbnode, NULL, 0, 8);
157                        }
158                        if(rcret == getrcconfigint("rcgreen", NULL))
159                        {
160                                if(ostrcmp(listbox->select->name, "move") == 0)
161                                        possearch(possetup, dvbnode, 0);
162                                if(ostrcmp(listbox->select->name, "finemove") == 0)
163                                        fediseqcrotor(dvbnode, NULL, 1, 10);
164                                if(ostrcmp(listbox->select->name, "limit") == 0)
165                                        fediseqcrotor(dvbnode, NULL, 0, 4);
166                                if(ostrcmp(listbox->select->name, "storagepos") == 0)
167                                {
168                                        if(listbox->select->ret != NULL)
169                                        {
170                                                int pos = atoi(listbox->select->ret);
171                                                fediseqcrotor(dvbnode, NULL, pos, 7);
172                                        }
173                                }
174                        }
175                        if(rcret == getrcconfigint("rcyellow", NULL))
176                        {
177                                if(ostrcmp(listbox->select->name, "move") == 0)
178                                        possearch(possetup, dvbnode, 1);
179                                if(ostrcmp(listbox->select->name, "finemove") == 0)
180                                        fediseqcrotor(dvbnode, NULL, 1, 9);
181                                if(ostrcmp(listbox->select->name, "limit") == 0)
182                                        fediseqcrotor(dvbnode, NULL, 0, 3);
183                                if(ostrcmp(listbox->select->name, "storagepos") == 0)
184                                {
185                                        if(listbox->select->ret != NULL)
186                                        {
187                                                int pos = atoi(listbox->select->ret);
188                                                fediseqcrotor(dvbnode, NULL, pos, 8);
189                                        }
190                                }
191                        }
192                        if(rcret == getrcconfigint("rcblue", NULL))
193                        {
194                                if(ostrcmp(listbox->select->name, "move") == 0)
195                                {
196                                        fediseqcrotor(dvbnode, NULL, 0, 5);
197                                        fediseqcrotor(dvbnode, NULL, 0, 0);
198                                }
199                                if(ostrcmp(listbox->select->name, "limit") == 0)
200                                        fediseqcrotor(dvbnode, NULL, 0, 2);
201                        }
202                }
203
204                drawscreen(possetup, 0);
205        }
206
207        delownerrc(possetup);
208        clearscreen(possetup);
209}
210
211#endif
Note: See TracBrowser for help on using the repository browser.