source: titan/titan/lnbconfig.h @ 40424

Last change on this file since 40424 was 18302, checked in by nit, 11 years ago

[titan] add unicable assistent

File size: 7.4 KB
Line 
1#ifndef LNBCONFIG_H
2#define LNBCONFIG_H
3
4int changeloftype(struct skin* lofl, struct skin* lofh, struct skin* threshold, struct skin* satcr, struct skin* satcrfrequ1, struct skin* satcrfrequ2, char *type)
5{
6        if(ostrcmp(type, "4") == 0)
7        {
8                lofl->hidden = NO;
9                lofh->hidden = NO;
10                threshold->hidden = NO;
11                satcr->hidden = NO;
12                satcrfrequ1->hidden = YES;
13                satcrfrequ2->hidden = NO;
14                return 4;
15        }
16        if(ostrcmp(type, "3") == 0)
17        {
18                lofl->hidden = YES;
19                lofh->hidden = YES;
20                threshold->hidden = YES;
21                satcr->hidden = NO;
22                satcrfrequ1->hidden = NO;
23                satcrfrequ2->hidden = YES;
24                return 3;
25        }
26        if(ostrcmp(type, "2") == 0)
27        {
28                lofl->hidden = NO;
29                lofh->hidden = NO;
30                threshold->hidden = NO;
31                satcr->hidden = YES;
32                satcrfrequ1->hidden = YES;
33                satcrfrequ2->hidden = YES;
34                return 2;
35        }
36        else
37        {
38                lofl->hidden = YES;
39                lofh->hidden = YES;
40                threshold->hidden = YES;
41                satcr->hidden = YES;
42                satcrfrequ1->hidden = YES;
43                satcrfrequ2->hidden = YES;
44                return 0;
45        }
46}
47
48void changelnb(struct skin* voltagemode, struct skin* tonemode, struct skin* loftype, struct skin* lofl, struct skin* lofh, struct skin* threshold, struct skin* satcr, struct skin* satcrfrequ1, struct skin* satcrfrequ2, char* feshortname, char *lnbnr)
49{
50        char* tmpstr = NULL;
51
52        tmpstr = ostrcat(feshortname, "_lnb_voltagemode", 0, 0);
53        tmpstr = ostrcat(tmpstr, lnbnr, 1, 0);
54        changename(voltagemode, tmpstr);
55        setchoiceboxselection(voltagemode, getconfig(tmpstr, NULL));
56        free(tmpstr);
57
58        tmpstr = ostrcat(feshortname, "_lnb_tonemode", 0, 0);
59        tmpstr = ostrcat(tmpstr, lnbnr, 1, 0);
60        changename(tonemode, tmpstr);
61        setchoiceboxselection(tonemode, getconfig(tmpstr, NULL));
62        free(tmpstr);
63
64        tmpstr = ostrcat(feshortname, "_lnb_loftype", 0, 0);
65        tmpstr = ostrcat(tmpstr, lnbnr, 1, 0);
66        changename(loftype, tmpstr);
67        setchoiceboxselection(loftype, getconfig(tmpstr, NULL));
68        free(tmpstr);
69
70        tmpstr = ostrcat(feshortname, "_lnb_lofl", 0, 0);
71        tmpstr = ostrcat(tmpstr, lnbnr, 1, 0);
72        changename(lofl, tmpstr);
73        changemask(lofl, "000000");
74        changeinput(lofl, getconfig(tmpstr, NULL));
75        free(tmpstr);
76
77        tmpstr = ostrcat(feshortname, "_lnb_lofh", 0, 0);
78        tmpstr = ostrcat(tmpstr, lnbnr, 1, 0);
79        changename(lofh, tmpstr);
80        changemask(lofh, "000000");
81        changeinput(lofh, getconfig(tmpstr, NULL));
82        free(tmpstr);
83
84        tmpstr = ostrcat(feshortname, "_lnb_lofthreshold", 0, 0);
85        tmpstr = ostrcat(tmpstr, lnbnr, 1, 0);
86        changename(threshold, tmpstr);
87        changemask(threshold, "000000");
88        changeinput(threshold, getconfig(tmpstr, NULL));
89        free(tmpstr);
90
91        tmpstr = ostrcat(feshortname, "_lnb_satcr", 0, 0);
92        tmpstr = ostrcat(tmpstr, lnbnr, 1, 0);
93        changename(satcr, tmpstr);
94        setchoiceboxselection(satcr, getconfig(tmpstr, NULL));
95        free(tmpstr);
96
97        tmpstr = ostrcat(feshortname, "_lnb_satcrfrequ", 0, 0);
98        tmpstr = ostrcat(tmpstr, lnbnr, 1, 0);
99        changename(satcrfrequ1, tmpstr);
100        setchoiceboxselection(satcrfrequ1, getconfig(tmpstr, NULL));
101        free(tmpstr);
102
103        tmpstr = ostrcat(feshortname, "_lnb_satcrfrequ", 0, 0);
104        tmpstr = ostrcat(tmpstr, lnbnr, 1, 0);
105        changename(satcrfrequ2, tmpstr);
106        changemask(satcrfrequ2, "0000");
107        changeinput(satcrfrequ2, getconfig(tmpstr, NULL));
108        free(tmpstr);
109}
110
111void screenlnb(char* feshortname, char* lnbnr)
112{
113        int rcret = 0;
114        struct skin* lnbscreen = getscreen("lnbscreen");
115        struct skin* listbox = getscreennode(lnbscreen, "listbox");
116        struct skin* voltagemode = getscreennode(lnbscreen, "voltagemode");
117        struct skin* tonemode = getscreennode(lnbscreen, "tonemode");
118        struct skin* loftype = getscreennode(lnbscreen, "loftype");
119        struct skin* lofl = getscreennode(lnbscreen, "lofl");
120        struct skin* lofh = getscreennode(lnbscreen, "lofh");
121        struct skin* threshold = getscreennode(lnbscreen, "threshold");
122        struct skin* satcr = getscreennode(lnbscreen, "satcr");
123        struct skin* satcrfrequ1 = getscreennode(lnbscreen, "satcrfrequ1");
124        struct skin* satcrfrequ2 = getscreennode(lnbscreen, "satcrfrequ2");
125        struct skin* tmp = NULL;
126        char* tmpstr = NULL;
127
128        if(lnbnr != NULL)
129                lnbnr = oitoa((int)lnbnr);
130        else
131                return;
132
133        listbox->aktline = 1;
134        listbox->aktpage = 1;
135
136        changeinput(voltagemode, NULL);
137        addchoicebox(voltagemode, "0", _("Polarization"));
138        addchoicebox(voltagemode, "1", _("13V"));
139        addchoicebox(voltagemode, "2", _("18V"));
140
141        changeinput(tonemode, NULL);
142        addchoicebox(tonemode, "0", _("Band"));
143        addchoicebox(tonemode, "1", _("on"));
144        addchoicebox(tonemode, "2", _("off"));
145
146        changeinput(loftype, NULL);
147        addchoicebox(loftype, "0", _("universal"));
148        addchoicebox(loftype, "1", _("C-Band"));
149        addchoicebox(loftype, "2", _("user defined"));
150        addchoicebox(loftype, "3", _("unicable"));
151        addchoicebox(loftype, "4", _("user unicable"));
152
153        changeinput(satcr, NULL);
154        addchoicebox(satcr, "1", "1");
155        addchoicebox(satcr, "2", "2");
156        addchoicebox(satcr, "3", "3");
157        addchoicebox(satcr, "4", "4");
158        addchoicebox(satcr, "5", "5");
159        addchoicebox(satcr, "6", "6");
160        addchoicebox(satcr, "7", "7");
161        addchoicebox(satcr, "8", "8");
162
163        changeinput(satcrfrequ1, NULL);
164        addchoicebox(satcrfrequ1, "1284", "1284");
165        addchoicebox(satcrfrequ1, "1400", "1400");
166        addchoicebox(satcrfrequ1, "1516", "1516");
167        addchoicebox(satcrfrequ1, "1632", "1632");
168        addchoicebox(satcrfrequ1, "1748", "1748");
169        addchoicebox(satcrfrequ1, "1864", "1864");
170        addchoicebox(satcrfrequ1, "1980", "1980");
171        addchoicebox(satcrfrequ1, "2096", "2096");
172
173        changelnb(voltagemode, tonemode, loftype, lofl, lofh, threshold, satcr, satcrfrequ1, satcrfrequ2, feshortname, lnbnr);
174
175        tmpstr = ostrcat(feshortname, "_lnb_loftype", 0, 0);
176        changeloftype(lofl, lofh, threshold, satcr, satcrfrequ1, satcrfrequ2, getconfig(tmpstr, lnbnr));
177        free(tmpstr); tmpstr = NULL;
178        free(lnbnr); lnbnr = NULL;
179
180        drawscreen(lnbscreen, 0, 0);
181        addscreenrc(lnbscreen, listbox);
182
183        tmp = listbox->select;
184        while(1)
185        {
186                addscreenrc(lnbscreen, tmp);
187                rcret = waitrc(lnbscreen, 0, 2);
188                tmp = listbox->select;
189
190                if(listbox->select != NULL && listbox->select->name != NULL && ostrstr(listbox->select->name, "lnb_loftype") != NULL && (rcret == getrcconfigint("rcleft", NULL) || rcret == getrcconfigint("rcright", NULL)))
191                {
192                        changeloftype(lofl, lofh, threshold, satcr, satcrfrequ1, satcrfrequ2, loftype->ret);
193                }
194
195                if(rcret == getrcconfigint("rcred", NULL))
196                {
197                        screenunicable(loftype, lofl, lofh, satcr, satcrfrequ2);
198                        changeloftype(lofl, lofh, threshold, satcr, satcrfrequ1, satcrfrequ2, loftype->ret);
199                }
200
201                addconfigscreentmpcheck(voltagemode->name, voltagemode, "0");
202                addconfigscreentmpcheck(tonemode->name, tonemode, "0");
203                addconfigscreentmpcheck(loftype->name, loftype, "0");
204                addconfigscreentmpcheck(lofl->name, lofl, "000000");
205                addconfigscreentmpcheck(lofh->name, lofh, "000000");
206                addconfigscreentmpcheck(threshold->name, threshold, "000000");
207                addconfigscreentmpcheck(satcr->name, satcr, "0");
208                if(loftype != NULL)
209                {
210                        if(ostrcmp(loftype->ret, "3") == 0)
211                                addconfigscreentmpcheck(satcrfrequ1->name, satcrfrequ1, "0000");
212                        if(ostrcmp(loftype->ret, "4") == 0)
213                                addconfigscreentmpcheck(satcrfrequ2->name, satcrfrequ2, "0000");
214                }
215
216                drawscreen(lnbscreen, 0, 0);
217
218                if(rcret == getrcconfigint("rcexit", NULL)) break;
219                if(rcret == getrcconfigint("rcok", NULL))
220                {
221                        writeconfigtmp();
222                        break;
223                }
224        }
225
226        changename(voltagemode, "voltagemode");
227        changename(tonemode, "tonemode");
228        changename(loftype, "loftype");
229        changename(lofl, "lofl");
230        changename(lofh, "lofh");
231        changename(threshold, "threshold");
232        changename(satcr, "satcr");
233        changename(satcrfrequ1, "satcrfrequ1");
234        changename(satcrfrequ2, "satcrfrequ2");
235
236        delconfigtmpall();
237        delownerrc(lnbscreen);
238        clearscreen(lnbscreen);
239}
240
241#endif
Note: See TracBrowser for help on using the repository browser.