source: titan/titan/lnbconfig.h @ 18302

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

[titan] add unicable assistent

File size: 7.4 KB
RevLine 
[7497]1#ifndef LNBCONFIG_H
2#define LNBCONFIG_H
3
[11397]4int changeloftype(struct skin* lofl, struct skin* lofh, struct skin* threshold, struct skin* satcr, struct skin* satcrfrequ1, struct skin* satcrfrequ2, char *type)
[7497]5{
[11397]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        }
[11072]16        if(ostrcmp(type, "3") == 0)
17        {
[11400]18                lofl->hidden = YES;
19                lofh->hidden = YES;
20                threshold->hidden = YES;
[11072]21                satcr->hidden = NO;
[11397]22                satcrfrequ1->hidden = NO;
23                satcrfrequ2->hidden = YES;
[11072]24                return 3;
25        }
[7497]26        if(ostrcmp(type, "2") == 0)
27        {
[7583]28                lofl->hidden = NO;
29                lofh->hidden = NO;
30                threshold->hidden = NO;
[11072]31                satcr->hidden = YES;
[11397]32                satcrfrequ1->hidden = YES;
33                satcrfrequ2->hidden = YES;
[7497]34                return 2;
35        }
36        else
37        {
[7583]38                lofl->hidden = YES;
39                lofh->hidden = YES;
40                threshold->hidden = YES;
[11072]41                satcr->hidden = YES;
[11397]42                satcrfrequ1->hidden = YES;
43                satcrfrequ2->hidden = YES;
[7497]44                return 0;
45        }
46}
47
[11397]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)
[7497]49{
50        char* tmpstr = NULL;
51
[11385]52        tmpstr = ostrcat(feshortname, "_lnb_voltagemode", 0, 0);
53        tmpstr = ostrcat(tmpstr, lnbnr, 1, 0);
[7497]54        changename(voltagemode, tmpstr);
[7506]55        setchoiceboxselection(voltagemode, getconfig(tmpstr, NULL));
[7497]56        free(tmpstr);
57
[11385]58        tmpstr = ostrcat(feshortname, "_lnb_tonemode", 0, 0);
59        tmpstr = ostrcat(tmpstr, lnbnr, 1, 0);
[7497]60        changename(tonemode, tmpstr);
[7506]61        setchoiceboxselection(tonemode, getconfig(tmpstr, NULL));
[7497]62        free(tmpstr);
63
[11385]64        tmpstr = ostrcat(feshortname, "_lnb_loftype", 0, 0);
65        tmpstr = ostrcat(tmpstr, lnbnr, 1, 0);
[7497]66        changename(loftype, tmpstr);
[7506]67        setchoiceboxselection(loftype, getconfig(tmpstr, NULL));
[7497]68        free(tmpstr);
69
[11385]70        tmpstr = ostrcat(feshortname, "_lnb_lofl", 0, 0);
71        tmpstr = ostrcat(tmpstr, lnbnr, 1, 0);
[7497]72        changename(lofl, tmpstr);
[7506]73        changemask(lofl, "000000");
74        changeinput(lofl, getconfig(tmpstr, NULL));
[7497]75        free(tmpstr);
76
[11385]77        tmpstr = ostrcat(feshortname, "_lnb_lofh", 0, 0);
78        tmpstr = ostrcat(tmpstr, lnbnr, 1, 0);
[7497]79        changename(lofh, tmpstr);
[7506]80        changemask(lofh, "000000");
81        changeinput(lofh, getconfig(tmpstr, NULL));
[7497]82        free(tmpstr);
83
[11385]84        tmpstr = ostrcat(feshortname, "_lnb_lofthreshold", 0, 0);
85        tmpstr = ostrcat(tmpstr, lnbnr, 1, 0);
[7497]86        changename(threshold, tmpstr);
[7506]87        changemask(threshold, "000000");
88        changeinput(threshold, getconfig(tmpstr, NULL));
[7497]89        free(tmpstr);
[11072]90
[11385]91        tmpstr = ostrcat(feshortname, "_lnb_satcr", 0, 0);
92        tmpstr = ostrcat(tmpstr, lnbnr, 1, 0);
[11072]93        changename(satcr, tmpstr);
94        setchoiceboxselection(satcr, getconfig(tmpstr, NULL));
95        free(tmpstr);
96
[11385]97        tmpstr = ostrcat(feshortname, "_lnb_satcrfrequ", 0, 0);
98        tmpstr = ostrcat(tmpstr, lnbnr, 1, 0);
[11397]99        changename(satcrfrequ1, tmpstr);
100        setchoiceboxselection(satcrfrequ1, getconfig(tmpstr, NULL));
[11072]101        free(tmpstr);
[11397]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);
[7497]109}
110
[11385]111void screenlnb(char* feshortname, char* lnbnr)
[7497]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");
[11072]122        struct skin* satcr = getscreennode(lnbscreen, "satcr");
[11397]123        struct skin* satcrfrequ1 = getscreennode(lnbscreen, "satcrfrequ1");
124        struct skin* satcrfrequ2 = getscreennode(lnbscreen, "satcrfrequ2");
[7497]125        struct skin* tmp = NULL;
126        char* tmpstr = NULL;
127
[11385]128        if(lnbnr != NULL)
129                lnbnr = oitoa((int)lnbnr);
130        else
131                return;
132
[7497]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"));
[11709]143        addchoicebox(tonemode, "1", _("on"));
144        addchoicebox(tonemode, "2", _("off"));
[7497]145
146        changeinput(loftype, NULL);
147        addchoicebox(loftype, "0", _("universal"));
148        addchoicebox(loftype, "1", _("C-Band"));
149        addchoicebox(loftype, "2", _("user defined"));
[11072]150        addchoicebox(loftype, "3", _("unicable"));
[11397]151        addchoicebox(loftype, "4", _("user unicable"));
[7497]152
[11072]153        changeinput(satcr, NULL);
[11373]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");
[7497]162
[11397]163        changeinput(satcrfrequ1, NULL);
[11455]164        addchoicebox(satcrfrequ1, "1284", "1284");
[11397]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");
[11072]172
[11397]173        changelnb(voltagemode, tonemode, loftype, lofl, lofh, threshold, satcr, satcrfrequ1, satcrfrequ2, feshortname, lnbnr);
174
[11385]175        tmpstr = ostrcat(feshortname, "_lnb_loftype", 0, 0);
[11397]176        changeloftype(lofl, lofh, threshold, satcr, satcrfrequ1, satcrfrequ2, getconfig(tmpstr, lnbnr));
[11385]177        free(tmpstr); tmpstr = NULL;
178        free(lnbnr); lnbnr = NULL;
179
[16511]180        drawscreen(lnbscreen, 0, 0);
[7497]181        addscreenrc(lnbscreen, listbox);
182
183        tmp = listbox->select;
[7975]184        while(1)
185        {
186                addscreenrc(lnbscreen, tmp);
[16511]187                rcret = waitrc(lnbscreen, 0, 2);
[7497]188                tmp = listbox->select;
189
[16492]190                if(listbox->select != NULL && listbox->select->name != NULL && ostrstr(listbox->select->name, "lnb_loftype") != NULL && (rcret == getrcconfigint("rcleft", NULL) || rcret == getrcconfigint("rcright", NULL)))
[7497]191                {
[11397]192                        changeloftype(lofl, lofh, threshold, satcr, satcrfrequ1, satcrfrequ2, loftype->ret);
[7639]193                }
194
[18302]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
[7497]201                addconfigscreentmpcheck(voltagemode->name, voltagemode, "0");
202                addconfigscreentmpcheck(tonemode->name, tonemode, "0");
[7639]203                addconfigscreentmpcheck(loftype->name, loftype, "0");
204                addconfigscreentmpcheck(lofl->name, lofl, "000000");
205                addconfigscreentmpcheck(lofh->name, lofh, "000000");
206                addconfigscreentmpcheck(threshold->name, threshold, "000000");
[11072]207                addconfigscreentmpcheck(satcr->name, satcr, "0");
[11397]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                }
[7497]215
[16511]216                drawscreen(lnbscreen, 0, 0);
[7497]217
[7506]218                if(rcret == getrcconfigint("rcexit", NULL)) break;
[12534]219                if(rcret == getrcconfigint("rcok", NULL))
[7497]220                {
221                        writeconfigtmp();
222                        break;
223                }
[7975]224        }
[7497]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");
[11072]232        changename(satcr, "satcr");
[11397]233        changename(satcrfrequ1, "satcrfrequ1");
234        changename(satcrfrequ2, "satcrfrequ2");
[7497]235
236        delconfigtmpall();
237        delownerrc(lnbscreen);
238        clearscreen(lnbscreen);
239}
240
241#endif
Note: See TracBrowser for help on using the repository browser.