source: titan/titan/diseqcconfig.h @ 39001

Last change on this file since 39001 was 34034, checked in by obi, 9 years ago

fix rotor settings

File size: 9.7 KB
Line 
1#ifndef DISEQCCONFIG_H
2#define DISEQCCONFIG_H
3
4int changeuncommittedcmd(struct skin* cmdorder, char* type)
5{
6        if(type == NULL || ostrcmp(type, "0") == 0)
7        {
8                changeinput(cmdorder, NULL);
9                addchoicebox(cmdorder, "0", _("committed, toneburst"));
10                addchoicebox(cmdorder, "1", _("toneburst, committed"));
11                return 0;
12        }
13        else
14        {
15                changeinput(cmdorder, NULL);
16                addchoicebox(cmdorder, "0", _("committed, toneburst"));
17                addchoicebox(cmdorder, "1", _("toneburst, committed"));
18                addchoicebox(cmdorder, "2", _("committed, uncommitted, toneburst"));
19                addchoicebox(cmdorder, "3", _("toneburst, committed, uncommitted"));
20                addchoicebox(cmdorder, "4", _("uncommitted, committed, toneburst"));
21                addchoicebox(cmdorder, "5", _("toneburst, uncommitted, committed"));
22                return 1;
23        }
24
25}
26
27void changediseqcmode(struct skin* committedcmd, struct skin* cmdorder, struct skin* uncommittedcmd, struct skin* rotorpos, struct skin* diseqcrepeat, char *type)
28{
29        committedcmd->hidden = YES;
30        cmdorder->hidden = YES;
31        uncommittedcmd->hidden = YES;
32        rotorpos->hidden = YES;
33        diseqcrepeat->hidden = YES;
34
35        if(type == NULL || ostrcmp(type, "0") == 0 || ostrcmp(type, "1") == 0 || ostrcmp(type, "2") == 0 || ostrcmp(type, "3") == 0)
36        {
37                committedcmd->hidden = NO;
38                cmdorder->hidden = NO;
39                diseqcrepeat->hidden = NO;
40
41                if(ostrcmp(type, "1") == 0 || ostrcmp(type, "2") == 0)
42                        uncommittedcmd->hidden = NO;
43                if(ostrcmp(type, "2") == 0)
44                        rotorpos->hidden = NO;
45        }
46}
47
48void changediseqc(struct skin* diseqcmode, struct skin* toneburst, struct skin* committedcmd, struct skin* cmdorder, struct skin* uncommittedcmd, struct skin* diseqcrepeat, struct skin* rotorpos, char* feshortname, char *diseqcnr)
49{
50        char* tmpstr = NULL, *tmpnr = NULL;
51        int i = 0;
52
53        tmpstr = ostrcat(feshortname, "_diseqc_mode", 0, 0);
54        tmpstr = ostrcat(tmpstr, diseqcnr, 1, 0);
55        changename(diseqcmode, tmpstr);
56        setchoiceboxselection(diseqcmode, getconfig(tmpstr, NULL));
57        changeuncommittedcmd(cmdorder, getconfig(tmpstr, NULL));
58        free(tmpstr);
59
60        tmpstr = ostrcat(feshortname, "_diseqc_toneburst", 0, 0);
61        tmpstr = ostrcat(tmpstr, diseqcnr, 1, 0);
62        changename(toneburst, tmpstr);
63        setchoiceboxselection(toneburst, getconfig(tmpstr, NULL));
64        free(tmpstr);
65
66        tmpstr = ostrcat(feshortname, "_diseqc_committedcmd", 0, 0);
67        tmpstr = ostrcat(tmpstr, diseqcnr, 1, 0);
68        changename(committedcmd, tmpstr);
69        setchoiceboxselection(committedcmd, getconfig(tmpstr, NULL));
70        free(tmpstr);
71
72        tmpstr = ostrcat(feshortname, "_diseqc_cmdorder", 0, 0);
73        tmpstr = ostrcat(tmpstr, diseqcnr, 1, 0);
74        changename(cmdorder, tmpstr);
75        setchoiceboxselection(cmdorder, getconfig(tmpstr, NULL));
76        free(tmpstr);
77
78        tmpstr = ostrcat(feshortname, "_diseqc_uncommittedcmd", 0, 0);
79        tmpstr = ostrcat(tmpstr, diseqcnr, 1, 0);
80        changename(uncommittedcmd, tmpstr);
81        setchoiceboxselection(uncommittedcmd, getconfig(tmpstr, NULL));
82        free(tmpstr);
83
84        tmpstr = ostrcat(feshortname, "_diseqc_repeate", 0, 0);
85        tmpstr = ostrcat(tmpstr, diseqcnr, 1, 0);
86        changename(diseqcrepeat, tmpstr);
87        setchoiceboxselection(diseqcrepeat, getconfig(tmpstr, NULL));
88        free(tmpstr);
89
90        tmpstr = ostrcat(feshortname, "_diseqc_rotorpos", 0, 0);
91        tmpstr = ostrcat(tmpstr, diseqcnr, 1, 0);
92        changename(rotorpos, tmpstr);
93        for(i = 1; i < 255; i++)
94        {
95                tmpnr = oitoa(i);
96                addchoicebox(rotorpos, tmpnr, tmpnr);
97                free(tmpnr); tmpnr = NULL;
98        }
99        setchoiceboxselection(rotorpos, getconfig(tmpstr, NULL));
100        free(tmpstr);
101}
102
103void screendiseqc(char* feshortname, char* diseqcnr)
104{
105        int rcret = 0;
106        struct skin* diseqcscreen = getscreen("diseqcscreen");
107        struct skin* listbox = getscreennode(diseqcscreen, "listbox");
108        struct skin* diseqcmode = getscreennode(diseqcscreen, "diseqcmode");
109        struct skin* toneburst = getscreennode(diseqcscreen, "toneburst");
110        struct skin* committedcmd = getscreennode(diseqcscreen, "committedcmd");
111        struct skin* cmdorder = getscreennode(diseqcscreen, "cmdorder");
112
113        struct skin* uncommittedcmd = getscreennode(diseqcscreen, "uncommittedcmd");
114        struct skin* diseqcrepeat = getscreennode(diseqcscreen, "diseqcrepeat");
115        struct skin* rotorpos = getscreennode(diseqcscreen, "rotorpos");
116        struct skin* tmp = NULL;
117        char* tmpstr = NULL;
118
119        listbox->aktline = 1;
120        listbox->aktpage = 1;
121
122        if(diseqcnr != NULL)
123                diseqcnr = oitoa((int)diseqcnr);
124        else
125                return;
126
127        changeinput(diseqcmode, NULL);
128        addchoicebox(diseqcmode, "0", _("DiSEqC 1.0"));
129        addchoicebox(diseqcmode, "1", _("DiSEqC 1.1"));
130        addchoicebox(diseqcmode, "2", _("DiSEqC 1.2"));
131        addchoicebox(diseqcmode, "3", _("DiSEqC 1.3 (USALS)"));
132        addchoicebox(diseqcmode, "100", _("Tonburst A/B"));
133
134        changeinput(toneburst, NULL);
135        addchoicebox(toneburst, "0", _("none"));
136        addchoicebox(toneburst, "1", _("A"));
137        addchoicebox(toneburst, "2", _("B"));
138
139        changeinput(committedcmd, NULL);
140        addchoicebox(committedcmd, "0", _("none"));
141        addchoicebox(committedcmd, "1", _("Input 1"));
142        addchoicebox(committedcmd, "2", _("Input 2"));
143        addchoicebox(committedcmd, "3", _("Input 3"));
144        addchoicebox(committedcmd, "4", _("Input 4"));
145        addchoicebox(committedcmd, "5", _("Input 5"));
146        addchoicebox(committedcmd, "6", _("Input 6"));
147        addchoicebox(committedcmd, "7", _("Input 7"));
148        addchoicebox(committedcmd, "8", _("Input 8"));
149        addchoicebox(committedcmd, "9", _("Input 9"));
150        addchoicebox(committedcmd, "10", _("Input 10"));
151        addchoicebox(committedcmd, "11", _("Input 11"));
152        addchoicebox(committedcmd, "12", _("Input 12"));
153        addchoicebox(committedcmd, "13", _("Input 13"));
154        addchoicebox(committedcmd, "14", _("Input 14"));
155        addchoicebox(committedcmd, "15", _("Input 15"));
156        addchoicebox(committedcmd, "16", _("Input 16"));
157
158        changeinput(uncommittedcmd, NULL);
159        addchoicebox(uncommittedcmd, "0", _("none"));
160        addchoicebox(uncommittedcmd, "1", _("Input 1"));
161        addchoicebox(uncommittedcmd, "2", _("Input 2"));
162        addchoicebox(uncommittedcmd, "3", _("Input 3"));
163        addchoicebox(uncommittedcmd, "4", _("Input 4"));
164        addchoicebox(uncommittedcmd, "5", _("Input 5"));
165        addchoicebox(uncommittedcmd, "6", _("Input 6"));
166        addchoicebox(uncommittedcmd, "7", _("Input 7"));
167        addchoicebox(uncommittedcmd, "8", _("Input 8"));
168        addchoicebox(uncommittedcmd, "9", _("Input 9"));
169        addchoicebox(uncommittedcmd, "10", _("Input 10"));
170        addchoicebox(uncommittedcmd, "11", _("Input 11"));
171        addchoicebox(uncommittedcmd, "12", _("Input 12"));
172        addchoicebox(uncommittedcmd, "13", _("Input 13"));
173        addchoicebox(uncommittedcmd, "14", _("Input 14"));
174        addchoicebox(uncommittedcmd, "15", _("Input 15"));
175        addchoicebox(uncommittedcmd, "16", _("Input 16"));
176
177        changeinput(diseqcrepeat, "1\n2\n3\n4\n5\n6");
178
179        changediseqc(diseqcmode, toneburst, committedcmd, cmdorder, uncommittedcmd, diseqcrepeat, rotorpos, feshortname, diseqcnr);
180
181        tmpstr = ostrcat(feshortname, "_diseqc_mode", 0, 0);
182        changediseqcmode(committedcmd, cmdorder, uncommittedcmd, rotorpos, diseqcrepeat, getconfig(tmpstr, diseqcnr));
183        free(tmpstr); tmpstr = NULL;
184        free(diseqcnr); diseqcnr = NULL;
185
186        drawscreen(diseqcscreen, 0, 0);
187        addscreenrc(diseqcscreen, listbox);
188
189        tmp = listbox->select;
190        while(1)
191        {
192                addscreenrc(diseqcscreen, tmp);
193                rcret = waitrc(diseqcscreen, 0, 2);
194                tmp = listbox->select;
195
196                if(listbox->select != NULL && listbox->select->name != NULL && ostrstr(listbox->select->name, "diseqc_mode") != NULL && (rcret == getrcconfigint("rcleft", NULL) || rcret == getrcconfigint("rcright", NULL)))
197                {
198                        changediseqcmode(committedcmd, cmdorder, uncommittedcmd, rotorpos, diseqcrepeat, diseqcmode->ret);
199                        changeuncommittedcmd(cmdorder, diseqcmode->ret);
200                }
201
202                addconfigscreentmpcheck(diseqcmode->name, diseqcmode, "0");
203                addconfigscreentmpcheck(toneburst->name, toneburst, "0");
204                addconfigscreentmpcheck(committedcmd->name, committedcmd, "0");
205                addconfigscreentmpcheck(cmdorder->name, cmdorder, "0");
206                addconfigscreentmpcheck(diseqcrepeat->name, diseqcrepeat, "1");
207                addconfigscreentmpcheck(uncommittedcmd->name, uncommittedcmd, "0");
208                addconfigscreentmpcheck(rotorpos->name, rotorpos, "000");
209
210                drawscreen(diseqcscreen, 0, 0);
211
212                if(rcret == getrcconfigint("rcexit", NULL)) break;
213                if(rcret == getrcconfigint("rcok", NULL))
214                {
215                        writeconfigtmp();
216                        break;
217                }
218        }
219
220        changename(diseqcmode, "diseqcmode");
221        changename(toneburst, "toneburst");
222        changename(committedcmd, "committedcmd");
223        changename(cmdorder, "cmdorder");
224        changename(uncommittedcmd, "uncommittedcmd");
225        changename(diseqcrepeat, "diseqcrepeat");
226        changename(rotorpos, "rotorpos");
227
228        delconfigtmpall();
229        delownerrc(diseqcscreen);
230        clearscreen(diseqcscreen);
231}
232
233void screenownpos()
234{
235        int rcret = 0;
236        struct skin* ownpos = getscreen("ownpos");
237        struct skin* listbox = getscreennode(ownpos, "listbox");
238        struct skin* latitude = getscreennode(ownpos, "latitude");
239        struct skin* longitude = getscreennode(ownpos, "longitude");
240        struct skin* latpos = getscreennode(ownpos, "latpos");
241        struct skin* longpos = getscreennode(ownpos, "longpos");
242        struct skin* tmp = NULL;
243
244        listbox->aktline = 1;
245        listbox->aktpage = 1;
246
247        changemask(latitude, "000.000");
248        changeinput(latitude, getconfig("latitude", NULL));
249
250        changemask(longitude, "000.000");
251        changeinput(longitude, getconfig("longitude", NULL));
252
253        changeinput(latpos, NULL);
254        addchoicebox(latpos, "0", _("north"));
255        addchoicebox(latpos, "1", _("south"));
256        setchoiceboxselection(latpos, getconfig("latpos", NULL));
257
258        changeinput(longpos, NULL);
259        addchoicebox(longpos, "0", _("east"));
260        addchoicebox(longpos, "1", _("west"));
261        setchoiceboxselection(longpos, getconfig("longpos", NULL));
262
263        drawscreen(ownpos, 0, 0);
264        addscreenrc(ownpos, listbox);
265
266        tmp = listbox->select;
267        while(1)
268        {
269                addscreenrc(ownpos, tmp);
270                rcret = waitrc(ownpos, 0, 0);
271                tmp = listbox->select;
272
273                if(rcret == getrcconfigint("rcexit", NULL)) break;
274                if(rcret == getrcconfigint("rcok", NULL))
275                {
276                        addconfigscreencheck("latitude", latitude, "000.000");
277                        addconfigscreencheck("longitude", longitude, "000.000");
278                        addconfigscreencheck("latpos", latpos, "0");
279                        addconfigscreencheck("longpos", longpos, "0");
280                        break;
281                }
282        }
283
284        delownerrc(ownpos);
285        clearscreen(ownpos);
286}
287
288#endif
Note: See TracBrowser for help on using the repository browser.