source: titan/titan/diseqcconfig.h @ 10958

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

[titan] add diseqc 1.1 (not tested)

File size: 8.3 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)
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 *diseqcnr)
49{
50        char* tmpstr = NULL;
51
52        tmpstr = ostrcat("diseqc_mode", diseqcnr, 0, 0);
53        changename(diseqcmode, tmpstr);
54        setchoiceboxselection(diseqcmode, getconfig(tmpstr, NULL));
55        changeuncommittedcmd(cmdorder, getconfig(tmpstr, NULL));
56        free(tmpstr);
57
58        tmpstr = ostrcat("diseqc_toneburst", diseqcnr, 0, 0);
59        changename(toneburst, tmpstr);
60        setchoiceboxselection(toneburst, getconfig(tmpstr, NULL));
61        free(tmpstr);
62
63        tmpstr = ostrcat("diseqc_committedcmd", diseqcnr, 0, 0);
64        changename(committedcmd, tmpstr);
65        setchoiceboxselection(committedcmd, getconfig(tmpstr, NULL));
66        free(tmpstr);
67
68        tmpstr = ostrcat("diseqc_cmdorder", diseqcnr, 0, 0);
69        changename(cmdorder, tmpstr);
70        setchoiceboxselection(cmdorder, getconfig(tmpstr, NULL));
71        free(tmpstr);
72
73        tmpstr = ostrcat("diseqc_uncommittedcmd", diseqcnr, 0, 0);
74        changename(uncommittedcmd, tmpstr);
75        setchoiceboxselection(uncommittedcmd, getconfig(tmpstr, NULL));
76        free(tmpstr);
77
78        tmpstr = ostrcat("diseqc_repeat", diseqcnr, 0, 0);
79        changename(diseqcrepeat, tmpstr);
80        setchoiceboxselection(diseqcrepeat, getconfig(tmpstr, NULL));
81        free(tmpstr);
82
83        tmpstr = ostrcat("diseqc_rotorpos", diseqcnr, 0, 0);
84        changename(rotorpos, tmpstr);
85        changemask(rotorpos, "000");
86        changeinput(rotorpos, getconfig(tmpstr, NULL));
87        free(tmpstr);
88}
89
90void screendiseqc(char* diseqcnr)
91{
92        int rcret = 0;
93        struct skin* diseqcscreen = getscreen("diseqcscreen");
94        struct skin* listbox = getscreennode(diseqcscreen, "listbox");
95        struct skin* diseqc = getscreennode(diseqcscreen, "diseqc");
96        struct skin* diseqcmode = getscreennode(diseqcscreen, "diseqcmode");
97        struct skin* toneburst = getscreennode(diseqcscreen, "toneburst");
98        struct skin* committedcmd = getscreennode(diseqcscreen, "committedcmd");
99        struct skin* cmdorder = getscreennode(diseqcscreen, "cmdorder");
100
101        struct skin* uncommittedcmd = getscreennode(diseqcscreen, "uncommittedcmd");
102        struct skin* diseqcrepeat = getscreennode(diseqcscreen, "diseqcrepeat");
103        struct skin* rotorpos = getscreennode(diseqcscreen, "rotorpos");
104        struct skin* tmp = NULL;
105        char* tmpstr = NULL;
106
107        listbox->aktline = 1;
108        listbox->aktpage = 1;
109
110        if(diseqcnr == NULL)
111        {
112                tmpstr = getmaxsatstring();
113                changeinput(diseqc, tmpstr);
114                diseqc->aktpage = 1;
115                free(tmpstr);
116                diseqcnr = "1";
117        }
118        else
119        {
120                changeinput(diseqc, diseqcnr);
121                diseqc->aktpage = atoi(diseqcnr);
122        }
123
124
125        changeinput(diseqcmode, NULL);
126        addchoicebox(diseqcmode, "0", _("DiSEqC 1.0"));
127        addchoicebox(diseqcmode, "1", _("DiSEqC 1.1"));
128        addchoicebox(diseqcmode, "2", _("DiSEqC 1.2"));
129        addchoicebox(diseqcmode, "100", _("Tonburst A/B"));
130
131        changeinput(toneburst, NULL);
132        addchoicebox(toneburst, "0", _("None"));
133        addchoicebox(toneburst, "1", _("A"));
134        addchoicebox(toneburst, "2", _("B"));
135
136        changeinput(committedcmd, NULL);
137        addchoicebox(committedcmd, "0", _("None"));
138        addchoicebox(committedcmd, "1", _("Input 1"));
139        addchoicebox(committedcmd, "2", _("Input 2"));
140        addchoicebox(committedcmd, "3", _("Input 3"));
141        addchoicebox(committedcmd, "4", _("Input 4"));
142        addchoicebox(committedcmd, "5", _("Input 5"));
143        addchoicebox(committedcmd, "6", _("Input 6"));
144        addchoicebox(committedcmd, "7", _("Input 7"));
145        addchoicebox(committedcmd, "8", _("Input 8"));
146        addchoicebox(committedcmd, "9", _("Input 9"));
147        addchoicebox(committedcmd, "10", _("Input 10"));
148        addchoicebox(committedcmd, "11", _("Input 11"));
149        addchoicebox(committedcmd, "12", _("Input 12"));
150        addchoicebox(committedcmd, "13", _("Input 13"));
151        addchoicebox(committedcmd, "14", _("Input 14"));
152        addchoicebox(committedcmd, "15", _("Input 15"));
153        addchoicebox(committedcmd, "16", _("Input 16"));
154
155        changeinput(uncommittedcmd, NULL);
156        addchoicebox(uncommittedcmd, "0", _("None"));
157        addchoicebox(uncommittedcmd, "1", _("Input 1"));
158        addchoicebox(uncommittedcmd, "2", _("Input 2"));
159        addchoicebox(uncommittedcmd, "3", _("Input 3"));
160        addchoicebox(uncommittedcmd, "4", _("Input 4"));
161        addchoicebox(uncommittedcmd, "5", _("Input 5"));
162        addchoicebox(uncommittedcmd, "6", _("Input 6"));
163        addchoicebox(uncommittedcmd, "7", _("Input 7"));
164        addchoicebox(uncommittedcmd, "8", _("Input 8"));
165        addchoicebox(uncommittedcmd, "9", _("Input 9"));
166        addchoicebox(uncommittedcmd, "10", _("Input 10"));
167        addchoicebox(uncommittedcmd, "11", _("Input 11"));
168        addchoicebox(uncommittedcmd, "12", _("Input 12"));
169        addchoicebox(uncommittedcmd, "13", _("Input 13"));
170        addchoicebox(uncommittedcmd, "14", _("Input 14"));
171        addchoicebox(uncommittedcmd, "15", _("Input 15"));
172        addchoicebox(uncommittedcmd, "16", _("Input 16"));
173
174        changeinput(diseqcrepeat, "1\n2\n3\n4\n5\n6");
175
176        changediseqc(diseqcmode, toneburst, committedcmd, cmdorder, uncommittedcmd, diseqcrepeat, rotorpos, diseqcnr);
177        changediseqcmode(committedcmd, cmdorder, uncommittedcmd, rotorpos, diseqcrepeat, getconfig("diseqc_mode", diseqcnr));
178
179        drawscreen(diseqcscreen, 0);
180        addscreenrc(diseqcscreen, listbox);
181
182        tmp = listbox->select;
183        while(1)
184        {
185                addscreenrc(diseqcscreen, tmp);
186                status.screencalc = 2;
187                rcret = waitrc(diseqcscreen, 0, 0);
188                tmp = listbox->select;
189
190                if(listbox->select != NULL && ostrcmp(listbox->select->name, "diseqc") == 0 && (rcret == getrcconfigint("rcleft", NULL) || rcret == getrcconfigint("rcright", NULL)))
191                {
192                        changediseqc(diseqcmode, toneburst, committedcmd, cmdorder, uncommittedcmd, diseqcrepeat, rotorpos, listbox->select->ret);
193                        changediseqcmode(committedcmd, cmdorder, uncommittedcmd, rotorpos, diseqcrepeat, getconfig("diseqc_mode", listbox->select->ret));
194                }
195
196                drawscreen(diseqcscreen, 0);
197
198                if(listbox->select != NULL && ostrncmp(listbox->select->name, "diseqc_mode", 11) == 0 && (rcret == getrcconfigint("rcleft", NULL) || rcret == getrcconfigint("rcright", NULL)))
199                {
200                        changediseqcmode(committedcmd, cmdorder, uncommittedcmd, rotorpos, diseqcrepeat, diseqcmode->ret);
201                        changeuncommittedcmd(cmdorder, diseqcmode->ret);
202                }
203
204                addconfigscreentmpcheck(diseqcmode->name, diseqcmode, "0");
205                addconfigscreentmpcheck(toneburst->name, toneburst, "0");
206                addconfigscreentmpcheck(committedcmd->name, committedcmd, "0");
207                addconfigscreentmpcheck(cmdorder->name, cmdorder, "0");
208                addconfigscreentmpcheck(diseqcrepeat->name, diseqcrepeat, "1");
209                addconfigscreentmpcheck(uncommittedcmd->name, uncommittedcmd, "0");
210                addconfigscreentmpcheck(rotorpos->name, rotorpos, "000");
211
212                status.screencalc = 0;
213                drawscreen(diseqcscreen, 0);
214
215                if(rcret == getrcconfigint("rcexit", NULL)) break;
216                if(rcret == getrcconfigint("rcgreen", NULL))
217                {
218                        writeconfigtmp();
219                        break;
220                }
221        }
222
223        changename(diseqc, "diseqc");
224        changename(diseqcmode, "diseqcmode");
225        changename(toneburst, "toneburst");
226        changename(committedcmd, "committedcmd");
227        changename(cmdorder, "cmdorder");
228        changename(uncommittedcmd, "uncommittedcmd");
229        changename(diseqcrepeat, "diseqcrepeat");
230        changename(rotorpos, "rotorpos");
231
232        status.screencalc = 0;
233        delconfigtmpall();
234        delownerrc(diseqcscreen);
235        clearscreen(diseqcscreen);
236}
237
238#endif
Note: See TracBrowser for help on using the repository browser.