1 | #ifndef SCAN_H |
---|
2 | #define SCAN_H |
---|
3 | |
---|
4 | uint8_t changeservicetype(uint8_t type) |
---|
5 | { |
---|
6 | int ret = type; |
---|
7 | |
---|
8 | switch(type) |
---|
9 | { |
---|
10 | case 0x01: |
---|
11 | case 0x06: |
---|
12 | case 0x0B: |
---|
13 | case 0x11: |
---|
14 | case 0x16: |
---|
15 | case 0x19: |
---|
16 | case 0x1C: |
---|
17 | case 0x9A: |
---|
18 | case 0x86: |
---|
19 | case 0xC3: |
---|
20 | case 0xC5: |
---|
21 | case 0xC6: |
---|
22 | ret = 0; |
---|
23 | break; |
---|
24 | case 0x02: |
---|
25 | case 0x07: |
---|
26 | case 0x0A: |
---|
27 | ret = 1; |
---|
28 | break; |
---|
29 | } |
---|
30 | |
---|
31 | return ret; |
---|
32 | } |
---|
33 | |
---|
34 | struct transponder* satsystemdesc(unsigned char* buf, uint64_t transportid, unsigned short onid, int orbitalpos) |
---|
35 | { |
---|
36 | int polarization = 0, modulation = 0, system = 0; |
---|
37 | int rolloff = 0, fec = 0; |
---|
38 | unsigned int frequency = 0, symbolrate = 0; |
---|
39 | uint64_t id = 0; |
---|
40 | struct transponder *tpnode = NULL; |
---|
41 | |
---|
42 | if(buf == NULL) return NULL; |
---|
43 | |
---|
44 | frequency = ( |
---|
45 | ((buf[2] >> 4) * 100000000) + |
---|
46 | ((buf[2] & 0x0F) * 10000000) + |
---|
47 | ((buf[3] >> 4) * 1000000) + |
---|
48 | ((buf[3] & 0x0F) * 100000) + |
---|
49 | ((buf[4] >> 4) * 10000) + |
---|
50 | ((buf[4] & 0x0F) * 1000) + |
---|
51 | ((buf[5] >> 4) * 100) + |
---|
52 | ((buf[5] & 0x0F) * 10) |
---|
53 | ); |
---|
54 | |
---|
55 | rolloff = (buf[8] >> 4) & 0x03; //0=rolloff_0_35, 1=rolloff_0_25, 2=rolloff_0_20, 3=rolloff_auto |
---|
56 | system = (buf[8] >> 2) & 0x01; //0=DVB_S, 1=DVB_S2 |
---|
57 | modulation = (buf[8]) & 0x03; //1=QPSK, 2=PSK_8, 3=QAM_16 |
---|
58 | |
---|
59 | symbolrate = ( |
---|
60 | ((buf[9] >> 4) * 100000000) + |
---|
61 | ((buf[9] & 0x0F) * 10000000) + |
---|
62 | ((buf[10] >> 4) * 1000000) + |
---|
63 | ((buf[10] & 0x0F) * 100000) + |
---|
64 | ((buf[11] >> 4) * 10000) + |
---|
65 | ((buf[11] & 0x0F) * 1000) + |
---|
66 | ((buf[12] >> 4) * 100) |
---|
67 | ); |
---|
68 | |
---|
69 | fec = (buf[12]) & 0x0F; |
---|
70 | |
---|
71 | switch(fec) |
---|
72 | { |
---|
73 | case 0x01: |
---|
74 | fec = FEC_1_2; |
---|
75 | break; |
---|
76 | case 0x02: |
---|
77 | fec = FEC_2_3; |
---|
78 | break; |
---|
79 | case 0x03: |
---|
80 | fec = FEC_3_4; |
---|
81 | break; |
---|
82 | case 0x04: |
---|
83 | fec = FEC_5_6; |
---|
84 | break; |
---|
85 | case 0x05: |
---|
86 | fec = FEC_7_8; |
---|
87 | break; |
---|
88 | case 0x06: |
---|
89 | fec = FEC_8_9; |
---|
90 | break; |
---|
91 | case 0x07: |
---|
92 | fec = FEC_3_5; |
---|
93 | break; |
---|
94 | case 0x08: |
---|
95 | fec = FEC_4_5; |
---|
96 | break; |
---|
97 | case 0x09: |
---|
98 | fec = FEC_9_10; |
---|
99 | break; |
---|
100 | case 0x0F: |
---|
101 | fec = FEC_NONE; |
---|
102 | break; |
---|
103 | default: |
---|
104 | fec = FEC_AUTO; |
---|
105 | break; |
---|
106 | } |
---|
107 | |
---|
108 | polarization = (buf[8] >> 5) & 0x03; //0=H, 1=V |
---|
109 | |
---|
110 | //workarounds for braindead broadcasters (e.g. on Telstar 12 at 15.0W) |
---|
111 | if(frequency >= 100000000) frequency /= 10; |
---|
112 | if(symbolrate >= 50000000) symbolrate /= 10; |
---|
113 | |
---|
114 | frequency = (int)1000 * (int)round((double)frequency / (double)1000); |
---|
115 | |
---|
116 | if(frequency > 15000000) return NULL; |
---|
117 | |
---|
118 | id = ((onid << 16) | transportid) & 0xffffffff; |
---|
119 | |
---|
120 | /* |
---|
121 | if(gettransponder(id) == NULL) |
---|
122 | { |
---|
123 | tpnode = createtransponder(id, FE_QPSK, orbitalpos, frequency, INVERSION_AUTO, symbolrate, polarization, fec, modulation, rolloff, 0, system); |
---|
124 | status.writetransponder = 1; |
---|
125 | } |
---|
126 | */ |
---|
127 | // write allways transponder and delete old entry |
---|
128 | deltransponderbyid(id); |
---|
129 | tpnode = createtransponder(id, FE_QPSK, orbitalpos, frequency, INVERSION_AUTO, symbolrate, polarization, fec, modulation, rolloff, 0, system); |
---|
130 | status.writetransponder = 1; |
---|
131 | |
---|
132 | debug(500, "nitscan: id=%llu freq=%d sr=%d fec=%d pol=%d modulation=%d system=%d tpnode=%p", id, frequency, symbolrate, fec, polarization, modulation, system, tpnode); |
---|
133 | |
---|
134 | return tpnode; |
---|
135 | } |
---|
136 | |
---|
137 | struct transponder* cablesystemdesc(unsigned char* buf, uint64_t transportid, unsigned short onid, int orbitalpos) |
---|
138 | { |
---|
139 | int modulation = 0, fec = 0; |
---|
140 | unsigned int frequency = 0, symbolrate = 0; |
---|
141 | uint64_t id = 0; |
---|
142 | struct transponder *tpnode = NULL; |
---|
143 | |
---|
144 | if(buf == NULL) return NULL; |
---|
145 | |
---|
146 | frequency = ( |
---|
147 | ((buf[2] >> 4) * 1000000000) + |
---|
148 | ((buf[2] & 0x0F) * 100000000) + |
---|
149 | ((buf[3] >> 4) * 10000000) + |
---|
150 | ((buf[3] & 0x0F) * 1000000) + |
---|
151 | ((buf[4] >> 4) * 100000) + |
---|
152 | ((buf[4] & 0x0F) * 10000) + |
---|
153 | ((buf[5] >> 4) * 1000) + |
---|
154 | ((buf[5] & 0x0F) * 100) |
---|
155 | ); |
---|
156 | |
---|
157 | modulation = buf[8]; //0=QAM_AUTO, 1=QAM_16, 2=QAM_32, 3=QAM_64, 4=QAM_128, 5=QAM_256 |
---|
158 | |
---|
159 | symbolrate = ( |
---|
160 | ((buf[9] >> 4) * 100000000) + |
---|
161 | ((buf[9] & 0x0F) * 10000000) + |
---|
162 | ((buf[10] >> 4) * 1000000) + |
---|
163 | ((buf[10] & 0x0F) * 100000) + |
---|
164 | ((buf[11] >> 4) * 10000) + |
---|
165 | ((buf[11] & 0x0F) * 1000) + |
---|
166 | ((buf[12] >> 4) * 100) |
---|
167 | ); |
---|
168 | |
---|
169 | fec = (buf[12]) & 0x0F; |
---|
170 | |
---|
171 | switch(fec) |
---|
172 | { |
---|
173 | case 0x01: |
---|
174 | fec = FEC_1_2; |
---|
175 | break; |
---|
176 | case 0x02: |
---|
177 | fec = FEC_2_3; |
---|
178 | break; |
---|
179 | case 0x03: |
---|
180 | fec = FEC_3_4; |
---|
181 | break; |
---|
182 | case 0x04: |
---|
183 | fec = FEC_5_6; |
---|
184 | break; |
---|
185 | case 0x05: |
---|
186 | fec = FEC_7_8; |
---|
187 | break; |
---|
188 | case 0x06: |
---|
189 | fec = FEC_8_9; |
---|
190 | break; |
---|
191 | case 0x07: |
---|
192 | fec = FEC_3_5; |
---|
193 | break; |
---|
194 | case 0x08: |
---|
195 | fec = FEC_4_5; |
---|
196 | break; |
---|
197 | case 0x09: |
---|
198 | fec = FEC_9_10; |
---|
199 | break; |
---|
200 | case 0x0F: |
---|
201 | fec = FEC_NONE; |
---|
202 | break; |
---|
203 | default: |
---|
204 | fec = FEC_AUTO; |
---|
205 | break; |
---|
206 | } |
---|
207 | |
---|
208 | id = ((onid << 16) | transportid) & 0xffffffff; |
---|
209 | id = id | ((uint64_t)1 << 32); |
---|
210 | |
---|
211 | if(gettransponder(id) == NULL) |
---|
212 | { |
---|
213 | tpnode = createtransponder(id, FE_QAM, orbitalpos, frequency, INVERSION_AUTO, symbolrate, 0, fec, modulation, 0, 0, 0); |
---|
214 | status.writetransponder = 1; |
---|
215 | } |
---|
216 | |
---|
217 | debug(500, "nitscan: id=%llu freq=%d sr=%d fec=%d modulation=%d tpnode=%p", id, frequency, symbolrate, fec, modulation, tpnode); |
---|
218 | |
---|
219 | return tpnode; |
---|
220 | } |
---|
221 | |
---|
222 | struct transponder* terrsystemdesc(unsigned char* buf, uint64_t transportid, unsigned short onid, int orbitalpos) |
---|
223 | { |
---|
224 | int modulation = 0, hp = 0, lp = 0; |
---|
225 | int bandwidth = 0, hierarchy = 0, guardinterval = 0; |
---|
226 | int transmission = 0; |
---|
227 | unsigned int frequency = 0; |
---|
228 | uint64_t id = 0; |
---|
229 | struct transponder *tpnode = NULL; |
---|
230 | |
---|
231 | if(buf == NULL) return NULL; |
---|
232 | |
---|
233 | frequency = (buf[2] << 24) | (buf[3] << 16); |
---|
234 | frequency |= (buf[4] << 8) | buf[5]; |
---|
235 | frequency *= 10; |
---|
236 | |
---|
237 | bandwidth = BANDWIDTH_8_MHZ + ((buf[6] >> 5) & 0x3); |
---|
238 | modulation = (buf[7] >> 6) & 0x3; |
---|
239 | hierarchy = HIERARCHY_NONE + ((buf[7] >> 3) & 0x3); |
---|
240 | |
---|
241 | hp = (buf[7] & 0x7); |
---|
242 | switch(hp) |
---|
243 | { |
---|
244 | case 0x00: |
---|
245 | hp = FEC_1_2; |
---|
246 | break; |
---|
247 | case 0x01: |
---|
248 | hp = FEC_2_3; |
---|
249 | break; |
---|
250 | case 0x02: |
---|
251 | hp = FEC_3_4; |
---|
252 | break; |
---|
253 | case 0x03: |
---|
254 | hp = FEC_5_6; |
---|
255 | break; |
---|
256 | case 0x04: |
---|
257 | hp = FEC_7_8; |
---|
258 | break; |
---|
259 | default: |
---|
260 | hp = FEC_AUTO; |
---|
261 | break; |
---|
262 | } |
---|
263 | |
---|
264 | lp = ((buf[8] >> 5) & 0x7); |
---|
265 | switch(lp) |
---|
266 | { |
---|
267 | case 0x00: |
---|
268 | lp = FEC_1_2; |
---|
269 | break; |
---|
270 | case 0x01: |
---|
271 | lp = FEC_2_3; |
---|
272 | break; |
---|
273 | case 0x02: |
---|
274 | lp = FEC_3_4; |
---|
275 | break; |
---|
276 | case 0x03: |
---|
277 | lp = FEC_5_6; |
---|
278 | break; |
---|
279 | case 0x04: |
---|
280 | lp = FEC_7_8; |
---|
281 | break; |
---|
282 | default: |
---|
283 | lp = FEC_AUTO; |
---|
284 | break; |
---|
285 | } |
---|
286 | |
---|
287 | guardinterval = GUARD_INTERVAL_1_32 + ((buf[8] >> 3) & 0x3); |
---|
288 | |
---|
289 | transmission = (buf[8] & 0x2); |
---|
290 | switch(transmission) |
---|
291 | { |
---|
292 | case 0x00: |
---|
293 | transmission = TRANSMISSION_MODE_2K; |
---|
294 | break; |
---|
295 | case 0x01: |
---|
296 | transmission = TRANSMISSION_MODE_8K; |
---|
297 | break; |
---|
298 | case 0x02: |
---|
299 | transmission = TRANSMISSION_MODE_AUTO; |
---|
300 | break; |
---|
301 | default: |
---|
302 | transmission = TRANSMISSION_MODE_AUTO; |
---|
303 | break; |
---|
304 | } |
---|
305 | |
---|
306 | //other_frequency_flag = (buf[8] & 0x01); |
---|
307 | |
---|
308 | id = ((onid << 16) | transportid) & 0xffffffff; |
---|
309 | id = id | ((uint64_t)2 << 32); |
---|
310 | |
---|
311 | if(gettransponder(id) == NULL) |
---|
312 | { |
---|
313 | tpnode = createtransponder(id, FE_OFDM, orbitalpos, frequency, INVERSION_AUTO, bandwidth, lp, hp, modulation, guardinterval, transmission, hierarchy); |
---|
314 | status.writetransponder = 1; |
---|
315 | } |
---|
316 | |
---|
317 | debug(500, "nitscan: id=%llu freq=%d bandwidth=%d hp=%d lp=%d modulation=%d guard=%d trans=%d hierarchy=%d tpnode=%p", id, frequency, bandwidth, hp, lp, modulation, guardinterval, transmission, hierarchy, tpnode); |
---|
318 | |
---|
319 | return tpnode; |
---|
320 | } |
---|
321 | |
---|
322 | int parsenit(unsigned char* buf, uint8_t* lastsecnr, int orbitalpos) |
---|
323 | { |
---|
324 | int ret = 0; |
---|
325 | |
---|
326 | if(buf == NULL) return ret; |
---|
327 | |
---|
328 | //unsigned char buf[MINMALLOC]; |
---|
329 | |
---|
330 | // position in buffer |
---|
331 | unsigned short pos = 0; |
---|
332 | unsigned short pos2 = 0; |
---|
333 | |
---|
334 | // network_information_section elements |
---|
335 | unsigned short seclen = 0; |
---|
336 | unsigned short desclen = 0; |
---|
337 | unsigned short tdesclen = 0; |
---|
338 | unsigned short looplen = 0; |
---|
339 | uint64_t transponderid = 0; |
---|
340 | unsigned short onid = 0; |
---|
341 | unsigned short nid = 0; |
---|
342 | unsigned char secnr = 0; |
---|
343 | |
---|
344 | seclen = ((buf[1] & 0x0F) << 8) + buf[2]; |
---|
345 | nid = ((buf[3] << 8)| buf[4]); |
---|
346 | desclen = ((buf[8] & 0x0F) << 8) | buf[9]; |
---|
347 | secnr = buf[6]; |
---|
348 | *lastsecnr = buf[7]; |
---|
349 | debug(500, "nitscan: section %d last %d nid %d", secnr, *lastsecnr, nid); |
---|
350 | |
---|
351 | for(pos = 10; pos < desclen + 10; pos += buf[pos + 1] + 2) |
---|
352 | { |
---|
353 | switch(buf[pos]) |
---|
354 | { |
---|
355 | case 0x0F: |
---|
356 | //private_data_indicator_desc(buf + pos); |
---|
357 | break; |
---|
358 | case 0x40: |
---|
359 | //network_name_desc(buf + pos); |
---|
360 | break; |
---|
361 | case 0x4A: |
---|
362 | //linkage_desc(buf + pos); |
---|
363 | break; |
---|
364 | case 0x5B: |
---|
365 | //multilingual_networkname_desc(buf + pos); |
---|
366 | break; |
---|
367 | case 0x5F: |
---|
368 | //private_data_specifier_desc(buf + pos); |
---|
369 | break; |
---|
370 | case 0x80: |
---|
371 | break; |
---|
372 | case 0x90: |
---|
373 | break; |
---|
374 | } |
---|
375 | } |
---|
376 | |
---|
377 | looplen = ((buf[pos] & 0x0F) << 8) | buf[pos + 1]; |
---|
378 | if (!looplen) return ret; |
---|
379 | |
---|
380 | for(pos += 2; pos < seclen - 3; pos += tdesclen + 6) |
---|
381 | { |
---|
382 | transponderid = (buf[pos] << 8) | buf[pos + 1]; |
---|
383 | onid = (buf[pos + 2] << 8) | buf[pos + 3]; |
---|
384 | tdesclen = ((buf[pos + 4] & 0x0F) << 8) | buf[pos + 5]; |
---|
385 | |
---|
386 | for(pos2 = pos + 6; pos2 < pos + tdesclen + 6; pos2 += buf[pos2 + 1] + 2) |
---|
387 | { |
---|
388 | switch(buf[pos2]) |
---|
389 | { |
---|
390 | case 0x41: |
---|
391 | //servicelistdesc(buf + pos2, transponderid, onid); |
---|
392 | break; |
---|
393 | case 0x43: |
---|
394 | if(satsystemdesc(buf + pos2, transponderid, onid, orbitalpos) != NULL) |
---|
395 | { |
---|
396 | scaninfo.tpnew++; |
---|
397 | if(scaninfo.scantype != 0) |
---|
398 | scaninfo.tpmax++; |
---|
399 | } |
---|
400 | break; |
---|
401 | case 0x44: |
---|
402 | if(cablesystemdesc(buf + pos2, transponderid, onid, orbitalpos) != NULL) |
---|
403 | { |
---|
404 | scaninfo.tpnew++; |
---|
405 | if(scaninfo.scantype != 0) |
---|
406 | scaninfo.tpmax++; |
---|
407 | } |
---|
408 | break; |
---|
409 | case 0x5A: |
---|
410 | if(terrsystemdesc(buf + pos2, transponderid, onid, orbitalpos) != NULL) |
---|
411 | { |
---|
412 | scaninfo.tpnew++; |
---|
413 | if(scaninfo.scantype != 0) |
---|
414 | scaninfo.tpmax++; |
---|
415 | } |
---|
416 | break; |
---|
417 | case 0x62: |
---|
418 | //frequencylistdesc(buf + pos2); |
---|
419 | break; |
---|
420 | } |
---|
421 | } |
---|
422 | } |
---|
423 | |
---|
424 | return ret; |
---|
425 | } |
---|
426 | |
---|
427 | //flag 0: from scan |
---|
428 | //flag 1: from update channelname |
---|
429 | int findchannel(struct dvbdev* fenode, struct transponder* tpnode, unsigned char *buf, uint8_t* lastsecnr, struct skin* scan, struct skin* listbox, int ichangename, int flag) |
---|
430 | { |
---|
431 | int ret = -1, changed = 0; |
---|
432 | uint64_t transponderid = 0; |
---|
433 | struct skin* node = NULL; |
---|
434 | struct channel* chnode = NULL; |
---|
435 | |
---|
436 | // position in buffer |
---|
437 | unsigned short pos; |
---|
438 | unsigned short pos2; |
---|
439 | |
---|
440 | // service_description_section elements |
---|
441 | unsigned short seclen; |
---|
442 | uint8_t secnr; |
---|
443 | unsigned short onid, tid; |
---|
444 | unsigned short serviceid; |
---|
445 | unsigned short desclooplen; |
---|
446 | unsigned short running; |
---|
447 | int eitscheduleflag; |
---|
448 | int eitpresentfollowingflag; |
---|
449 | int camode; |
---|
450 | uint8_t servicetype = 0; |
---|
451 | uint8_t providerlen = 0; |
---|
452 | char* tmpstr = NULL, *tmpstr1 = NULL, *tmpstr2 = NULL; |
---|
453 | uint64_t* tmpuint64 = NULL; |
---|
454 | |
---|
455 | if(buf == NULL || fenode == NULL || fenode->feinfo == NULL) return ret; |
---|
456 | |
---|
457 | seclen = ((buf[1] & 0x0F) << 8) | buf[2]; |
---|
458 | secnr = buf[6]; |
---|
459 | *lastsecnr = buf[7]; |
---|
460 | tid = (buf[3] << 8) | buf[4]; |
---|
461 | onid = (buf[8] << 8) | buf[9]; |
---|
462 | |
---|
463 | transponderid = ((onid << 16) | tid) & 0xffffffff; |
---|
464 | if(fenode->feinfo->type == FE_QAM) |
---|
465 | transponderid = transponderid | ((uint64_t)1 << 32); |
---|
466 | else if(fenode->feinfo->type == FE_OFDM) |
---|
467 | transponderid = transponderid | ((uint64_t)2 << 32); |
---|
468 | if(tpnode != NULL && tpnode->id != transponderid && tpnode->id != 99) |
---|
469 | { |
---|
470 | changetransponderid(tpnode, transponderid); |
---|
471 | status.writetransponder = 1; |
---|
472 | } |
---|
473 | |
---|
474 | debug(500, "SDT nr: %d, lastnr: %d, len: %d, tid: %d, onid: %d, transponderid: %llu", secnr, *lastsecnr, seclen, tid, onid, transponderid); |
---|
475 | |
---|
476 | for(pos = 11; pos < seclen - 1; pos += desclooplen + 5) |
---|
477 | { |
---|
478 | serviceid = (buf[pos] << 8) | buf[pos + 1]; |
---|
479 | eitscheduleflag = buf[pos + 2] & 0x02; |
---|
480 | eitpresentfollowingflag = buf[pos + 2] & 0x01; |
---|
481 | running = buf[pos + 3] & 0xE0; |
---|
482 | camode = buf[pos + 3] & 0x10; |
---|
483 | desclooplen = ((buf[pos + 3] & 0x0F) << 8) | buf[pos + 4]; |
---|
484 | if(flag == 0 && scaninfo.onlyfree == 1 && camode > 0) continue; |
---|
485 | |
---|
486 | for(pos2 = pos + 5; pos2 < pos + desclooplen + 5; pos2 += buf[pos2 + 1] + 2) |
---|
487 | { |
---|
488 | switch(buf[pos2]) |
---|
489 | { |
---|
490 | case 0x48: |
---|
491 | servicetype = buf[pos2 + 2]; |
---|
492 | servicetype = changeservicetype(servicetype); |
---|
493 | providerlen = buf[pos2 + 3]; |
---|
494 | |
---|
495 | //providername |
---|
496 | tmpstr1 = strndup((char*)&(buf[pos2 + 4]), providerlen); |
---|
497 | //channelname |
---|
498 | tmpstr2 = strndup((char*)&(buf[pos2 + 4 + providerlen + 1]), (2 + buf[pos2 + 1]) - (4 + providerlen + 1)); |
---|
499 | |
---|
500 | tmpstr1 = string_strip_whitechars(tmpstr1); |
---|
501 | tmpstr2 = string_strip_whitechars(tmpstr2); |
---|
502 | if(tmpstr1 == NULL || strlen(tmpstr1) == 0) tmpstr1 = ostrcat(tmpstr1, "unknown", 1, 0); |
---|
503 | if(tmpstr2 == NULL || strlen(tmpstr2) == 0) tmpstr2 = ostrcat(tmpstr2, "unknown", 1, 0); |
---|
504 | |
---|
505 | tmpstr1 = strutf8(tpnode, tmpstr1, strlen(tmpstr1), 0, 1, 0); |
---|
506 | tmpstr1 = stringreplacechar(tmpstr1, '#', '_'); |
---|
507 | tmpstr2 = strutf8(tpnode, tmpstr2, strlen(tmpstr2), 0, 1, 1); |
---|
508 | tmpstr2 = stringreplacechar(tmpstr2, '#', '_'); |
---|
509 | |
---|
510 | //add to listbox |
---|
511 | chnode = getchannel(serviceid, transponderid); |
---|
512 | if(flag == 0) node = addlistbox(scan, listbox, node, 1); |
---|
513 | if(node != NULL) |
---|
514 | { |
---|
515 | switch(servicetype) |
---|
516 | { |
---|
517 | case 0: |
---|
518 | scaninfo.tvcount++; |
---|
519 | if(chnode == NULL) scaninfo.newtvcount++; |
---|
520 | break; |
---|
521 | case 1: |
---|
522 | scaninfo.radiocount++; |
---|
523 | if(chnode == NULL) scaninfo.newradiocount++; |
---|
524 | break; |
---|
525 | default: |
---|
526 | scaninfo.datacount++; |
---|
527 | if(chnode == NULL) scaninfo.newdatacount++; |
---|
528 | break; |
---|
529 | } |
---|
530 | tmpstr = ostrcat(tmpstr2, " (", 0, 0); |
---|
531 | tmpstr = ostrcat(tmpstr, tmpstr1, 1, 0); |
---|
532 | tmpstr = ostrcat(tmpstr, " - ", 1, 0); |
---|
533 | if(servicetype == 0) |
---|
534 | tmpstr = ostrcat(tmpstr, _("TV"), 1, 0); |
---|
535 | else if(servicetype == 1) |
---|
536 | tmpstr = ostrcat(tmpstr, _("Radio"), 1, 0); |
---|
537 | else |
---|
538 | tmpstr = ostrcat(tmpstr, _("Data"), 1, 0); |
---|
539 | |
---|
540 | changed = 0; |
---|
541 | if(chnode != NULL && chnode->name != NULL && strlen(chnode->name) > 0 && ostrcmp(tmpstr2, chnode->name) != 0) |
---|
542 | { |
---|
543 | tmpstr = ostrcat(tmpstr, " - ", 1, 0); |
---|
544 | tmpstr = ostrcat(tmpstr, chnode->name, 1, 0); |
---|
545 | if(ichangename == 1) changed = 1; |
---|
546 | } |
---|
547 | tmpstr = ostrcat(tmpstr, ")", 1, 0); |
---|
548 | changetext(node, tmpstr); |
---|
549 | |
---|
550 | if(chnode != NULL && chnode->transponder != NULL && changed == 0) |
---|
551 | node->fontcol = convertcol("deaktivcol"); |
---|
552 | |
---|
553 | changeparam1(node, tmpstr1); |
---|
554 | changeparam2(node, tmpstr2); |
---|
555 | tmpuint64 = (uint64_t*)calloc(1, sizeof(uint64_t) * 3); |
---|
556 | if(tmpuint64 != NULL) |
---|
557 | { |
---|
558 | tmpuint64[0] = serviceid; |
---|
559 | tmpuint64[1] = transponderid; |
---|
560 | tmpuint64[2] = servicetype; |
---|
561 | } |
---|
562 | free(node->name); |
---|
563 | node->name = (char*)tmpuint64; |
---|
564 | } |
---|
565 | |
---|
566 | if(flag == 1 && chnode != NULL && ostrcmp(chnode->name, tmpstr2) != 0) |
---|
567 | { |
---|
568 | free(chnode->name); |
---|
569 | chnode->name = ostrcat(tmpstr2, NULL, 0, 0); |
---|
570 | status.writechannel = 1; |
---|
571 | } |
---|
572 | |
---|
573 | free(tmpstr); tmpstr = NULL; |
---|
574 | free(tmpstr1); tmpstr1 = NULL; |
---|
575 | free(tmpstr2); tmpstr2 = NULL; |
---|
576 | |
---|
577 | ret = 0; |
---|
578 | break; |
---|
579 | } |
---|
580 | } |
---|
581 | } |
---|
582 | |
---|
583 | return ret; |
---|
584 | } |
---|
585 | |
---|
586 | uint64_t findtransponderid(struct dvbdev* fenode, unsigned char *buf) |
---|
587 | { |
---|
588 | uint64_t transponderid = 0; |
---|
589 | unsigned short onid, tid; |
---|
590 | |
---|
591 | if(buf == NULL || fenode == NULL || fenode->feinfo == NULL) return 0; |
---|
592 | |
---|
593 | tid = (buf[3] << 8) | buf[4]; |
---|
594 | onid = (buf[8] << 8) | buf[9]; |
---|
595 | |
---|
596 | transponderid = ((onid << 16) | tid) & 0xffffffff; |
---|
597 | |
---|
598 | if(fenode->feinfo->type == FE_QAM) |
---|
599 | transponderid = transponderid | ((uint64_t)1 << 32); |
---|
600 | else if(fenode->feinfo->type == FE_OFDM) |
---|
601 | transponderid = transponderid | ((uint64_t)2 << 32); |
---|
602 | |
---|
603 | debug(500, "found SDT transponderid: %llu", transponderid); |
---|
604 | |
---|
605 | return transponderid; |
---|
606 | } |
---|
607 | |
---|
608 | unsigned int satblindscan(struct stimerthread* timernode, int onlycalc) |
---|
609 | { |
---|
610 | int festatus = 0; |
---|
611 | uint64_t transponderid = 0; |
---|
612 | unsigned char* buf = NULL; |
---|
613 | struct dvbdev* fenode = NULL; |
---|
614 | struct transponder* tpnode = NULL; |
---|
615 | |
---|
616 | unsigned int frequency = 0, symbolrate = 0; |
---|
617 | int polarization = 0, modulation = 0, system = 0, fec = 0; |
---|
618 | |
---|
619 | unsigned int minfrequency = getconfigint("blindminfrequency", NULL) * 1000; |
---|
620 | unsigned int maxfrequency = getconfigint("blindmaxfrequency", NULL) * 1000; |
---|
621 | unsigned int stepfrequency = getconfigint("blindstepfrequency", NULL) * 1000; |
---|
622 | unsigned int minsymbolrate = getconfigint("blindminsignalrate", NULL) * 1000; |
---|
623 | unsigned int maxsymbolrate = getconfigint("blindmaxsignalrate", NULL) * 1000; |
---|
624 | unsigned int stepsymbolrate = getconfigint("blindstepsignalrate", NULL) * 1000; |
---|
625 | unsigned int usedefaultsr = getconfigint("blindusedefaultsr", NULL); |
---|
626 | unsigned int onlydvbs = getconfigint("blindonlydvbs", NULL); |
---|
627 | unsigned int usedefaultfec = getconfigint("blindusedefaultfec", NULL); |
---|
628 | |
---|
629 | int minmodulation = 1, maxmodulation = 2, stepmodulation = 1; |
---|
630 | int minpolarization = 0, maxpolarization = 1, steppolarization = 1; |
---|
631 | int minsystem = 0, maxsystem = 1, stepsystem = 1; |
---|
632 | int minfec = 0, maxfec = 8, stepfec = 1; |
---|
633 | |
---|
634 | if(onlydvbs == 1) |
---|
635 | { |
---|
636 | maxmodulation = 0; |
---|
637 | maxsystem = 0; |
---|
638 | } |
---|
639 | |
---|
640 | if(usedefaultsr == 1) |
---|
641 | { |
---|
642 | minsymbolrate = 0; |
---|
643 | maxsymbolrate = 3; |
---|
644 | stepsymbolrate = 1; |
---|
645 | } |
---|
646 | |
---|
647 | if(usedefaultfec == 1) |
---|
648 | maxfec = 6; |
---|
649 | |
---|
650 | int countfrequency = ((maxfrequency + stepfrequency) - minfrequency) / stepfrequency; |
---|
651 | int countsymbolrate = ((maxsymbolrate + stepsymbolrate) - minsymbolrate) / stepsymbolrate; |
---|
652 | int countmodulation = ((maxmodulation + stepmodulation) - minmodulation) / stepmodulation; |
---|
653 | int countpolarization = ((maxpolarization + steppolarization) - minpolarization) / steppolarization; |
---|
654 | int countfec = ((maxfec + stepfec) - minfec) / stepfec; |
---|
655 | int systemcount = ((maxsystem + stepsystem) - minsystem) / stepsystem; |
---|
656 | |
---|
657 | if(onlycalc == 1) return systemcount * countpolarization * countmodulation * countsymbolrate * countfrequency * countfec; |
---|
658 | |
---|
659 | if(scaninfo.fenode == NULL || timernode == NULL) return -1; |
---|
660 | int timeout = scaninfo.timeout / 5; |
---|
661 | if(timeout < 1000000) timeout = 1000000; |
---|
662 | scaninfo.blindmax += systemcount * countpolarization * countmodulation * countsymbolrate * countfrequency * countfec; |
---|
663 | |
---|
664 | for(frequency = minfrequency; frequency <= maxfrequency; frequency += stepfrequency) |
---|
665 | { |
---|
666 | |
---|
667 | int csymbolrate = 0; |
---|
668 | for(csymbolrate = minsymbolrate; csymbolrate <= maxsymbolrate; csymbolrate += stepsymbolrate) |
---|
669 | { |
---|
670 | if(usedefaultsr == 1) |
---|
671 | { |
---|
672 | switch(csymbolrate) |
---|
673 | { |
---|
674 | case 0: |
---|
675 | symbolrate = 22000 * 1000; |
---|
676 | break; |
---|
677 | case 1: |
---|
678 | symbolrate = 27500 * 1000; |
---|
679 | break; |
---|
680 | case 2: |
---|
681 | symbolrate = 30000 * 1000; |
---|
682 | break; |
---|
683 | } |
---|
684 | } |
---|
685 | else |
---|
686 | symbolrate = csymbolrate; |
---|
687 | |
---|
688 | for(modulation = minmodulation; modulation <= maxmodulation; modulation += stepmodulation) |
---|
689 | { |
---|
690 | |
---|
691 | for(polarization = minpolarization; polarization <= maxpolarization; polarization += steppolarization) |
---|
692 | { |
---|
693 | |
---|
694 | for(fec = minfec; fec <= maxfec; fec += stepfec) |
---|
695 | { |
---|
696 | |
---|
697 | for(system = minsystem; system <= maxsystem; system += stepsystem) |
---|
698 | { |
---|
699 | scaninfo.blindcount++; |
---|
700 | |
---|
701 | tpnode = createtransponder(99, scaninfo.fenode->feinfo->type, scaninfo.orbitalpos, frequency, INVERSION_AUTO, symbolrate, polarization, fec, modulation, 0, 0, system); |
---|
702 | |
---|
703 | debug(500, "blindscan: frequ=%d, sr=%d, modulation=%d, fec=%d, system=%d, orbitalpos=%d", frequency, symbolrate, modulation, fec, system, scaninfo.orbitalpos); |
---|
704 | |
---|
705 | if(tpnode != NULL) |
---|
706 | { |
---|
707 | |
---|
708 | fenode = fegetfree(tpnode, 0, scaninfo.fenode); |
---|
709 | if(fenode == NULL ) |
---|
710 | { |
---|
711 | debug(500, "Frontend for scan not free"); |
---|
712 | deltransponderbyid(99); |
---|
713 | continue; |
---|
714 | } |
---|
715 | |
---|
716 | //frontend tune |
---|
717 | if(fenode->feinfo->type == FE_QPSK) |
---|
718 | { |
---|
719 | feset(fenode, tpnode); |
---|
720 | fetunedvbs(fenode, tpnode); |
---|
721 | } |
---|
722 | else |
---|
723 | { |
---|
724 | debug(500, "Frontend type unknown"); |
---|
725 | deltransponderbyid(99); |
---|
726 | continue; |
---|
727 | } |
---|
728 | |
---|
729 | festatus = fewait(fenode); |
---|
730 | if(debug_level == 200) fereadstatus(fenode); |
---|
731 | if(festatus != 0) |
---|
732 | { |
---|
733 | debug(500, "tuning failed"); |
---|
734 | deltransponderbyid(99); |
---|
735 | continue; |
---|
736 | } |
---|
737 | |
---|
738 | buf = dvbgetsdt(fenode, 0, timeout); |
---|
739 | transponderid = findtransponderid(fenode, buf); |
---|
740 | free(buf); buf = NULL; |
---|
741 | |
---|
742 | if(transponderid == 0 || gettransponder(transponderid) != NULL) |
---|
743 | { |
---|
744 | deltransponderbyid(99); |
---|
745 | continue; |
---|
746 | } |
---|
747 | |
---|
748 | if(tpnode->id != transponderid) |
---|
749 | { |
---|
750 | scaninfo.newblindcount++; |
---|
751 | changetransponderid(tpnode, transponderid); |
---|
752 | status.writetransponder = 1; |
---|
753 | } |
---|
754 | } |
---|
755 | deltransponderbyid(99); |
---|
756 | if(timernode->aktion != START) break; |
---|
757 | } |
---|
758 | if(timernode->aktion != START) break; |
---|
759 | } |
---|
760 | if(timernode->aktion != START) break; |
---|
761 | } |
---|
762 | if(timernode->aktion != START) break; |
---|
763 | } |
---|
764 | if(timernode->aktion != START) break; |
---|
765 | } |
---|
766 | if(timernode->aktion != START) break; |
---|
767 | } |
---|
768 | |
---|
769 | return 0; |
---|
770 | } |
---|
771 | |
---|
772 | unsigned int cableblindscan(struct stimerthread* timernode, int onlycalc) |
---|
773 | { |
---|
774 | int festatus = 0; |
---|
775 | uint64_t transponderid = 0; |
---|
776 | unsigned char* buf = NULL; |
---|
777 | struct dvbdev* fenode = NULL; |
---|
778 | struct transponder* tpnode = NULL; |
---|
779 | |
---|
780 | unsigned int frequency = 0, symbolrate = 0; |
---|
781 | int modulation = 0, fec = 0; |
---|
782 | |
---|
783 | unsigned int minfrequency = getconfigint("cblindminfrequency", NULL) * 1000; |
---|
784 | unsigned int maxfrequency = getconfigint("cblindmaxfrequency", NULL) * 1000; |
---|
785 | unsigned int stepfrequency = getconfigint("cblindstepfrequency", NULL) * 1000; |
---|
786 | unsigned int minsymbolrate = getconfigint("cblindminsignalrate", NULL) * 1000; |
---|
787 | unsigned int maxsymbolrate = getconfigint("cblindmaxsignalrate", NULL) * 1000; |
---|
788 | unsigned int stepsymbolrate = getconfigint("cblindstepsignalrate", NULL) * 1000; |
---|
789 | unsigned int usedefaultsr = getconfigint("cblindusedefaultsr", NULL); |
---|
790 | unsigned int usedefaultfec = getconfigint("cblindusedefaultfec", NULL); |
---|
791 | |
---|
792 | int minmodulation = 0, maxmodulation = 4, stepmodulation = 1; |
---|
793 | int minfec = 0, maxfec = 8, stepfec = 1; |
---|
794 | |
---|
795 | if(usedefaultsr == 1) |
---|
796 | { |
---|
797 | minsymbolrate = 0; |
---|
798 | maxsymbolrate = 3; |
---|
799 | stepsymbolrate = 1; |
---|
800 | } |
---|
801 | |
---|
802 | if(usedefaultfec == 1) |
---|
803 | maxfec = 6; |
---|
804 | |
---|
805 | int countfrequency = ((maxfrequency + stepfrequency) - minfrequency) / stepfrequency; |
---|
806 | int countsymbolrate = ((maxsymbolrate + stepsymbolrate) - minsymbolrate) / stepsymbolrate; |
---|
807 | int countmodulation = ((maxmodulation + stepmodulation) - minmodulation) / stepmodulation; |
---|
808 | int countfec = ((maxfec + stepfec) - minfec) / stepfec; |
---|
809 | |
---|
810 | if(onlycalc == 1) return countmodulation * countsymbolrate * countfrequency * countfec; |
---|
811 | |
---|
812 | if(scaninfo.fenode == NULL || timernode == NULL) return -1; |
---|
813 | int timeout = scaninfo.timeout / 5; |
---|
814 | if(timeout < 1000000) timeout = 1000000; |
---|
815 | scaninfo.blindmax += countmodulation * countsymbolrate * countfrequency * countfec; |
---|
816 | |
---|
817 | for(frequency = minfrequency; frequency <= maxfrequency; frequency += stepfrequency) |
---|
818 | { |
---|
819 | |
---|
820 | int csymbolrate = 0; |
---|
821 | for(csymbolrate = minsymbolrate; csymbolrate <= maxsymbolrate; csymbolrate += stepsymbolrate) |
---|
822 | { |
---|
823 | if(usedefaultsr == 1) |
---|
824 | { |
---|
825 | switch(csymbolrate) |
---|
826 | { |
---|
827 | case 0: |
---|
828 | symbolrate = 22000 * 1000; |
---|
829 | break; |
---|
830 | case 1: |
---|
831 | symbolrate = 27500 * 1000; |
---|
832 | break; |
---|
833 | case 2: |
---|
834 | symbolrate = 30000 * 1000; |
---|
835 | break; |
---|
836 | } |
---|
837 | } |
---|
838 | else |
---|
839 | symbolrate = csymbolrate; |
---|
840 | |
---|
841 | for(modulation = minmodulation; modulation <= maxmodulation; modulation += stepmodulation) |
---|
842 | { |
---|
843 | |
---|
844 | for(fec = minfec; fec <= maxfec; fec += stepfec) |
---|
845 | { |
---|
846 | scaninfo.blindcount++; |
---|
847 | |
---|
848 | tpnode = createtransponder(99, scaninfo.fenode->feinfo->type, scaninfo.orbitalpos, frequency, INVERSION_AUTO, symbolrate, 0, fec, modulation, 0, 0, 0); |
---|
849 | |
---|
850 | debug(500, "blindscan: frequ=%d, sr=%d, modulation=%d, fec=%d, orbitalpos=%d", frequency, symbolrate, modulation, fec, scaninfo.orbitalpos); |
---|
851 | |
---|
852 | if(tpnode != NULL) |
---|
853 | { |
---|
854 | |
---|
855 | fenode = fegetfree(tpnode, 0, scaninfo.fenode); |
---|
856 | if(fenode == NULL ) |
---|
857 | { |
---|
858 | debug(500, "Frontend for scan not free"); |
---|
859 | deltransponderbyid(99); |
---|
860 | continue; |
---|
861 | } |
---|
862 | |
---|
863 | //frontend tune |
---|
864 | if(fenode->feinfo->type == FE_QAM) |
---|
865 | fetunedvbc(fenode, tpnode); |
---|
866 | else |
---|
867 | { |
---|
868 | debug(500, "Frontend type unknown"); |
---|
869 | deltransponderbyid(99); |
---|
870 | continue; |
---|
871 | } |
---|
872 | |
---|
873 | festatus = fewait(fenode); |
---|
874 | if(debug_level == 200) fereadstatus(fenode); |
---|
875 | if(festatus != 0) |
---|
876 | { |
---|
877 | debug(500, "tuning failed"); |
---|
878 | deltransponderbyid(99); |
---|
879 | continue; |
---|
880 | } |
---|
881 | |
---|
882 | buf = dvbgetsdt(fenode, 0, timeout); |
---|
883 | transponderid = findtransponderid(fenode, buf); |
---|
884 | free(buf); buf = NULL; |
---|
885 | |
---|
886 | if(transponderid == 0 || gettransponder(transponderid) != NULL) |
---|
887 | { |
---|
888 | deltransponderbyid(99); |
---|
889 | continue; |
---|
890 | } |
---|
891 | |
---|
892 | if(tpnode->id != transponderid) |
---|
893 | { |
---|
894 | scaninfo.newblindcount++; |
---|
895 | changetransponderid(tpnode, transponderid); |
---|
896 | status.writetransponder = 1; |
---|
897 | } |
---|
898 | } |
---|
899 | deltransponderbyid(99); |
---|
900 | if(timernode->aktion != START) break; |
---|
901 | } |
---|
902 | if(timernode->aktion != START) break; |
---|
903 | } |
---|
904 | if(timernode->aktion != START) break; |
---|
905 | } |
---|
906 | if(timernode->aktion != START) break; |
---|
907 | } |
---|
908 | |
---|
909 | return 0; |
---|
910 | } |
---|
911 | |
---|
912 | unsigned int terrblindscan(struct stimerthread* timernode, int onlycalc) |
---|
913 | { |
---|
914 | int festatus = 0; |
---|
915 | uint64_t transponderid = 0; |
---|
916 | unsigned char* buf = NULL; |
---|
917 | struct dvbdev* fenode = NULL; |
---|
918 | struct transponder* tpnode = NULL; |
---|
919 | |
---|
920 | unsigned int frequency = 0; |
---|
921 | int hp = 0, lp = 0, modulation = 0, bandwidth = 0, transmission = 0, guardinterval = 0, hierarchy = 0; |
---|
922 | |
---|
923 | unsigned int minfrequency = getconfigint("tblindminfrequency", NULL) * 1000; |
---|
924 | unsigned int maxfrequency = getconfigint("tblindmaxfrequency", NULL) * 1000; |
---|
925 | unsigned int stepfrequency = getconfigint("tblindstepfrequency", NULL) * 1000; |
---|
926 | |
---|
927 | int minhp = 0, maxhp = 3, stephp = 1; |
---|
928 | int minlp = 0, maxlp = 3, steplp = 1; |
---|
929 | int minmodulation = 0, maxmodulation = 2, stepmodulation = 1; |
---|
930 | int minbandwidth = 0, maxbandwidth = 2, stepbandwidth = 1; |
---|
931 | int mintransmission = 0, maxtransmission = 1, steptransmission = 1; |
---|
932 | int minguardinterval = 0, maxguardinterval = 3, stepguardinterval = 1; |
---|
933 | int minhierarchy = 0, maxhierarchy = 3, stephierarchy = 1; |
---|
934 | |
---|
935 | int countfrequency = ((maxfrequency + stepfrequency) - minfrequency) / stepfrequency; |
---|
936 | int counthp = ((maxhp + stephp) - minhp) / stephp; |
---|
937 | int countlp = ((maxlp + steplp) - minlp) / steplp; |
---|
938 | int countmodulation = ((maxmodulation + stepmodulation) - minmodulation) / stepmodulation; |
---|
939 | int countbandwidth = ((maxbandwidth + stepbandwidth) - minbandwidth) / stepbandwidth; |
---|
940 | int counttransmission = ((maxtransmission + steptransmission) - mintransmission) / steptransmission; |
---|
941 | int countguardinterval = ((maxguardinterval + stepguardinterval) - minguardinterval) / stepguardinterval; |
---|
942 | int counthierarchy = ((maxhierarchy + stephierarchy) - minhierarchy) / stephierarchy; |
---|
943 | |
---|
944 | if(onlycalc == 1) return counthierarchy * countguardinterval * countmodulation * counttransmission * countfrequency * countbandwidth * countlp * counthp; |
---|
945 | |
---|
946 | if(scaninfo.fenode == NULL || timernode == NULL) return -1; |
---|
947 | int timeout = scaninfo.timeout / 5; |
---|
948 | if(timeout < 1000000) timeout = 1000000; |
---|
949 | scaninfo.blindmax += counthierarchy * countguardinterval * countmodulation * counttransmission * countfrequency * countbandwidth * countlp * counthp; |
---|
950 | |
---|
951 | for(frequency = minfrequency; frequency <= maxfrequency; frequency += stepfrequency) |
---|
952 | { |
---|
953 | |
---|
954 | for(hp = minhp; hp <= maxhp; hp += stephp) |
---|
955 | { |
---|
956 | |
---|
957 | for(lp = minlp; lp <= maxlp; lp += steplp) |
---|
958 | { |
---|
959 | |
---|
960 | for(modulation = minmodulation; modulation <= maxmodulation; modulation += stepmodulation) |
---|
961 | { |
---|
962 | |
---|
963 | for(bandwidth = minbandwidth; bandwidth <= maxbandwidth; bandwidth += stepbandwidth) |
---|
964 | { |
---|
965 | |
---|
966 | for(transmission = mintransmission; transmission <= maxtransmission; transmission += steptransmission) |
---|
967 | { |
---|
968 | |
---|
969 | for(guardinterval = minguardinterval; guardinterval <= maxguardinterval; guardinterval += stepguardinterval) |
---|
970 | { |
---|
971 | |
---|
972 | for(hierarchy = minhierarchy; hierarchy <= maxhierarchy; hierarchy += stephierarchy) |
---|
973 | { |
---|
974 | scaninfo.blindcount++; |
---|
975 | |
---|
976 | tpnode = createtransponder(99, scaninfo.fenode->feinfo->type, scaninfo.orbitalpos, frequency, INVERSION_AUTO, bandwidth, lp, hp, modulation, guardinterval, transmission, hierarchy); |
---|
977 | |
---|
978 | debug(500, "blindscan: frequ=%d, modulation=%d, hp=%d, lp=%d, bandwidth=%d, guardinterval=%d, transmission=%d, hierarchy=%d, orbitalpos=%d", frequency, modulation, hp, lp, bandwidth, guardinterval, transmission, hierarchy, scaninfo.orbitalpos); |
---|
979 | |
---|
980 | if(tpnode != NULL) |
---|
981 | { |
---|
982 | |
---|
983 | fenode = fegetfree(tpnode, 0, scaninfo.fenode); |
---|
984 | if(fenode == NULL ) |
---|
985 | { |
---|
986 | debug(500, "Frontend for scan not free"); |
---|
987 | deltransponderbyid(99); |
---|
988 | continue; |
---|
989 | } |
---|
990 | |
---|
991 | //frontend tune |
---|
992 | if(fenode->feinfo->type == FE_OFDM) |
---|
993 | { |
---|
994 | feset(fenode, tpnode); |
---|
995 | fetunedvbs(fenode, tpnode); |
---|
996 | } |
---|
997 | else |
---|
998 | { |
---|
999 | debug(500, "Frontend type unknown"); |
---|
1000 | deltransponderbyid(99); |
---|
1001 | continue; |
---|
1002 | } |
---|
1003 | |
---|
1004 | festatus = fewait(fenode); |
---|
1005 | if(debug_level == 200) fereadstatus(fenode); |
---|
1006 | if(festatus != 0) |
---|
1007 | { |
---|
1008 | debug(500, "tuning failed"); |
---|
1009 | deltransponderbyid(99); |
---|
1010 | continue; |
---|
1011 | } |
---|
1012 | |
---|
1013 | buf = dvbgetsdt(fenode, 0, timeout); |
---|
1014 | transponderid = findtransponderid(fenode, buf); |
---|
1015 | free(buf); buf = NULL; |
---|
1016 | |
---|
1017 | if(transponderid == 0 || gettransponder(transponderid) != NULL) |
---|
1018 | { |
---|
1019 | deltransponderbyid(99); |
---|
1020 | continue; |
---|
1021 | } |
---|
1022 | |
---|
1023 | if(tpnode->id != transponderid) |
---|
1024 | { |
---|
1025 | scaninfo.newblindcount++; |
---|
1026 | changetransponderid(tpnode, transponderid); |
---|
1027 | status.writetransponder = 1; |
---|
1028 | } |
---|
1029 | } |
---|
1030 | deltransponderbyid(99); |
---|
1031 | if(timernode->aktion != START) break; |
---|
1032 | } |
---|
1033 | if(timernode->aktion != START) break; |
---|
1034 | } |
---|
1035 | if(timernode->aktion != START) break; |
---|
1036 | } |
---|
1037 | if(timernode->aktion != START) break; |
---|
1038 | } |
---|
1039 | if(timernode->aktion != START) break; |
---|
1040 | } |
---|
1041 | if(timernode->aktion != START) break; |
---|
1042 | } |
---|
1043 | if(timernode->aktion != START) break; |
---|
1044 | } |
---|
1045 | if(timernode->aktion != START) break; |
---|
1046 | } |
---|
1047 | |
---|
1048 | return 0; |
---|
1049 | } |
---|
1050 | |
---|
1051 | void blindscan(struct stimerthread* timernode) |
---|
1052 | { |
---|
1053 | if(scaninfo.fenode == NULL) return; |
---|
1054 | |
---|
1055 | if(scaninfo.fenode->feinfo->type == FE_QPSK) |
---|
1056 | satblindscan(timernode, 0); |
---|
1057 | else if(scaninfo.fenode->feinfo->type == FE_QAM) |
---|
1058 | cableblindscan(timernode, 0); |
---|
1059 | else if(scaninfo.fenode->feinfo->type == FE_OFDM) |
---|
1060 | terrblindscan(timernode, 0); |
---|
1061 | } |
---|
1062 | |
---|
1063 | void doscan(struct stimerthread* timernode) |
---|
1064 | { |
---|
1065 | int festatus = 0, secnr = 0; |
---|
1066 | uint8_t lastsecnr = 0xff; |
---|
1067 | unsigned char* buf = NULL; |
---|
1068 | struct transponder* tpnode = NULL; |
---|
1069 | struct dvbdev* fenode = NULL; |
---|
1070 | //struct channel* chnode = NULL; |
---|
1071 | struct sat* satnode = sat; |
---|
1072 | int nitscan = 1; |
---|
1073 | |
---|
1074 | if(scaninfo.fenode == NULL || scaninfo.tpnode == NULL || timernode == NULL) |
---|
1075 | { |
---|
1076 | scaninfo.threadend = 1; |
---|
1077 | return; |
---|
1078 | } |
---|
1079 | |
---|
1080 | debug(500, "channel scan thread start"); |
---|
1081 | |
---|
1082 | //sat loop |
---|
1083 | satnode = sat; |
---|
1084 | while(satnode != NULL && timernode->aktion == START) |
---|
1085 | { |
---|
1086 | if(satnode->scan == 0) |
---|
1087 | { |
---|
1088 | satnode = satnode->next; |
---|
1089 | continue; |
---|
1090 | } |
---|
1091 | scaninfo.satname = satnode->name; |
---|
1092 | |
---|
1093 | if(scaninfo.scantype == 0) |
---|
1094 | tpnode = scaninfo.tpnode; |
---|
1095 | else if(scaninfo.scantype == 1) |
---|
1096 | tpnode = transponder; |
---|
1097 | else if(scaninfo.scantype == 2 || scaninfo.scantype == 3) |
---|
1098 | { |
---|
1099 | tpnode = transponder; |
---|
1100 | scaninfo.orbitalpos = satnode->orbitalpos; |
---|
1101 | } |
---|
1102 | |
---|
1103 | if(scaninfo.blindscan == 1) blindscan(timernode); |
---|
1104 | |
---|
1105 | nitscan = 1; |
---|
1106 | //transponder loop |
---|
1107 | while(tpnode != NULL && timernode->aktion == START) |
---|
1108 | { |
---|
1109 | if(scaninfo.orbitalpos != tpnode->orbitalpos) |
---|
1110 | { |
---|
1111 | tpnode = tpnode->next; |
---|
1112 | if(scaninfo.scantype == 0) break; |
---|
1113 | continue; |
---|
1114 | } |
---|
1115 | |
---|
1116 | fenode = fegetfree(tpnode, 0, scaninfo.fenode); |
---|
1117 | if(fenode == NULL || (scaninfo.scantype != 3 && fenode != scaninfo.fenode)) |
---|
1118 | { |
---|
1119 | scaninfo.tpcount++; |
---|
1120 | tpnode = tpnode->next; |
---|
1121 | debug(500, "Frontend for scan not free"); |
---|
1122 | if(scaninfo.scantype == 0) break; |
---|
1123 | continue; |
---|
1124 | } |
---|
1125 | |
---|
1126 | //frontend tune |
---|
1127 | if(fenode->feinfo->type == FE_QPSK) |
---|
1128 | { |
---|
1129 | feset(fenode, tpnode); |
---|
1130 | if(fetunedvbs(fenode, tpnode) != 0) |
---|
1131 | { |
---|
1132 | scaninfo.tpcount++; |
---|
1133 | tpnode = tpnode->next; |
---|
1134 | debug(500, "tuning failed"); |
---|
1135 | if(scaninfo.scantype == 0) break; |
---|
1136 | continue; |
---|
1137 | } |
---|
1138 | } |
---|
1139 | else if(fenode->feinfo->type == FE_QAM) |
---|
1140 | { |
---|
1141 | if(fetunedvbc(fenode, tpnode) != 0) |
---|
1142 | { |
---|
1143 | scaninfo.tpcount++; |
---|
1144 | tpnode = tpnode->next; |
---|
1145 | debug(500, "tuning failed"); |
---|
1146 | if(scaninfo.scantype == 0) break; |
---|
1147 | continue; |
---|
1148 | } |
---|
1149 | } |
---|
1150 | else if(fenode->feinfo->type == FE_OFDM) |
---|
1151 | { |
---|
1152 | if(fetunedvbt(fenode, tpnode) != 0) |
---|
1153 | { |
---|
1154 | scaninfo.tpcount++; |
---|
1155 | tpnode = tpnode->next; |
---|
1156 | debug(500, "tuning failed"); |
---|
1157 | if(scaninfo.scantype == 0) break; |
---|
1158 | continue; |
---|
1159 | } |
---|
1160 | } |
---|
1161 | else |
---|
1162 | { |
---|
1163 | scaninfo.tpcount++; |
---|
1164 | tpnode = tpnode->next; |
---|
1165 | debug(500, "Frontend type unknown"); |
---|
1166 | if(scaninfo.scantype == 0) break; |
---|
1167 | continue; |
---|
1168 | } |
---|
1169 | |
---|
1170 | festatus = fewait(fenode); |
---|
1171 | if(debug_level == 200) fereadstatus(fenode); |
---|
1172 | if(festatus != 0) |
---|
1173 | { |
---|
1174 | scaninfo.tpcount++; |
---|
1175 | tpnode = tpnode->next; |
---|
1176 | debug(500, "tuning failed last"); |
---|
1177 | if(scaninfo.scantype == 0) break; |
---|
1178 | continue; |
---|
1179 | } |
---|
1180 | |
---|
1181 | //del channels from transponder if selected |
---|
1182 | //if(scaninfo.scantype != 3 && scaninfo.clear == 1) |
---|
1183 | //{ |
---|
1184 | // struct channel* tmpchannel = NULL; |
---|
1185 | // chnode = channel; |
---|
1186 | // while(chnode != NULL) |
---|
1187 | // { |
---|
1188 | // tmpchannel = chnode->next; |
---|
1189 | // if(chnode->transponder == tpnode) |
---|
1190 | // delchannel(chnode->serviceid, chnode->transponderid, 1); |
---|
1191 | // chnode = tmpchannel; |
---|
1192 | // } |
---|
1193 | //} |
---|
1194 | |
---|
1195 | //get nit |
---|
1196 | if(scaninfo.networkscan == 1 && nitscan == 1) |
---|
1197 | { |
---|
1198 | lastsecnr = 0xff; |
---|
1199 | secnr = 0; |
---|
1200 | while(secnr <= lastsecnr && secnr <= 256) |
---|
1201 | { |
---|
1202 | if(timernode->aktion != START) break; |
---|
1203 | buf = dvbgetnit(fenode, secnr, scaninfo.timeout * 2); |
---|
1204 | if(buf != NULL) |
---|
1205 | { |
---|
1206 | parsenit(buf, &lastsecnr, satnode->orbitalpos); |
---|
1207 | nitscan = 1; //1 = scan all transponder for nit / 0 = scan only first transponder for nit |
---|
1208 | } |
---|
1209 | else |
---|
1210 | break; |
---|
1211 | free(buf); buf = NULL; |
---|
1212 | secnr++; |
---|
1213 | } |
---|
1214 | } |
---|
1215 | |
---|
1216 | lastsecnr = 0xff; |
---|
1217 | secnr = 0; |
---|
1218 | while(secnr <= lastsecnr && secnr <= 256) |
---|
1219 | { |
---|
1220 | if(timernode->aktion != START) break; |
---|
1221 | #ifndef SIMULATE |
---|
1222 | buf = dvbgetsdt(fenode, secnr, scaninfo.timeout); |
---|
1223 | #endif |
---|
1224 | if(buf != NULL) |
---|
1225 | findchannel(fenode, tpnode, buf, &lastsecnr, scaninfo.scanscreen, scaninfo.listbox, scaninfo.changename, 0); |
---|
1226 | else |
---|
1227 | break; |
---|
1228 | free(buf); buf = NULL; |
---|
1229 | secnr++; |
---|
1230 | } |
---|
1231 | |
---|
1232 | scaninfo.tpcount++; |
---|
1233 | if(scaninfo.scantype == 0) break; |
---|
1234 | tpnode = tpnode->next; |
---|
1235 | } |
---|
1236 | if(scaninfo.scantype == 0 || scaninfo.scantype == 1) break; |
---|
1237 | satnode = satnode->next; |
---|
1238 | } |
---|
1239 | scaninfo.threadend = 1; |
---|
1240 | debug(500, "channel scan thread end"); |
---|
1241 | } |
---|
1242 | |
---|
1243 | void scanaddchannel(struct skin* node, int scantype, struct transponder* tp1, int ichangename) |
---|
1244 | { |
---|
1245 | int serviceid = 0; |
---|
1246 | uint64_t transponderid = 0; |
---|
1247 | int servicetype = 0; |
---|
1248 | int providerid = 0; |
---|
1249 | struct provider* providernode = NULL; |
---|
1250 | char* tmpstr = NULL; |
---|
1251 | struct transponder* tp2 = NULL; |
---|
1252 | struct channel* chnode = NULL; |
---|
1253 | |
---|
1254 | if(node == NULL || node->name == NULL) return; |
---|
1255 | |
---|
1256 | serviceid = ((uint64_t*)node->name)[0]; |
---|
1257 | transponderid = ((uint64_t*)node->name)[1]; |
---|
1258 | servicetype = ((uint64_t*)node->name)[2]; |
---|
1259 | |
---|
1260 | chnode = getchannel(serviceid, transponderid); |
---|
1261 | if(chnode == NULL || (chnode != NULL && chnode->transponder == NULL)) |
---|
1262 | { |
---|
1263 | //check if provider valid |
---|
1264 | providernode = getproviderbyname(node->param1); |
---|
1265 | if(providernode != NULL) |
---|
1266 | providerid = providernode->providerid; |
---|
1267 | else |
---|
1268 | { |
---|
1269 | providerid = getlastproviderid() + 1; |
---|
1270 | tmpstr = ostrcat(tmpstr, oitoa(providerid), 1, 1); |
---|
1271 | tmpstr = ostrcat(tmpstr, "#", 1, 0); |
---|
1272 | tmpstr = ostrcat(tmpstr, node->param1, 1, 0); |
---|
1273 | tmpstr = ostrcat(tmpstr, "#0", 1, 0); |
---|
1274 | addprovider(tmpstr, 1, NULL); |
---|
1275 | free(tmpstr); tmpstr = NULL; |
---|
1276 | } |
---|
1277 | |
---|
1278 | //check if transponder valid |
---|
1279 | if(scantype == 0) |
---|
1280 | { |
---|
1281 | tp2 = gettransponder(transponderid); |
---|
1282 | |
---|
1283 | if(tp2 == NULL && tp1 != NULL) |
---|
1284 | { |
---|
1285 | tp2 = gettransponderbydetail(0, tp1->fetype, tp1->orbitalpos, tp1->frequency, tp1->inversion, tp1->symbolrate, tp1->polarization, tp1->fec, tp1->modulation, tp1->rolloff, tp1->pilot, tp1->system, 1); |
---|
1286 | if(tp2 != NULL) |
---|
1287 | changetransponderid(tp2, transponderid); |
---|
1288 | } |
---|
1289 | |
---|
1290 | if(tp2 == NULL) //create new transponder |
---|
1291 | copytransponder(tp1, tp2, transponderid); |
---|
1292 | else //change transponder |
---|
1293 | copytransponder(tp1, tp2, 99); |
---|
1294 | } |
---|
1295 | |
---|
1296 | if(servicetype != 0 && servicetype != 1) |
---|
1297 | servicetype = 0; |
---|
1298 | |
---|
1299 | if(chnode == NULL) |
---|
1300 | { |
---|
1301 | if(createchannel(node->param2, transponderid, providerid, serviceid, servicetype, 0, -1, -1, -1, -1, 0, -1) != NULL) |
---|
1302 | node->fontcol = convertcol("deaktivcol"); |
---|
1303 | } |
---|
1304 | else |
---|
1305 | node->fontcol = convertcol("deaktivcol"); |
---|
1306 | } |
---|
1307 | else |
---|
1308 | { |
---|
1309 | node->fontcol = convertcol("deaktivcol"); |
---|
1310 | //change channel name if selected |
---|
1311 | if(ichangename == 1 && node->param2 != NULL && strlen(node->param2) > 0 && ostrcmp(node->param2, chnode->name) != 0) |
---|
1312 | { |
---|
1313 | free(chnode->name); |
---|
1314 | chnode->name = ostrcat(node->param2, NULL, 0, 0); |
---|
1315 | status.writetransponder = 1; |
---|
1316 | } |
---|
1317 | } |
---|
1318 | } |
---|
1319 | |
---|
1320 | void scansetallsat(int fetype) |
---|
1321 | { |
---|
1322 | int i = 0, orbitalpos = 0; |
---|
1323 | struct sat* satnode = NULL; |
---|
1324 | struct dvbdev* dvbnode = dvbdev; |
---|
1325 | char* tmpstr = NULL, *tmpnr = NULL; |
---|
1326 | |
---|
1327 | while(dvbnode != NULL) |
---|
1328 | { |
---|
1329 | if(dvbnode->type == FRONTENDDEV && dvbnode->feinfo != NULL && dvbnode->felock < 1 && dvbnode->deactive == 0 && (fetype == -1 || dvbnode->feinfo->type == fetype)) |
---|
1330 | { |
---|
1331 | |
---|
1332 | tmpstr = ostrcat(dvbnode->feshortname, "_sat", 0, 0); |
---|
1333 | for(i = 1; i <= getmaxsat(dvbnode->feshortname); i++) |
---|
1334 | { |
---|
1335 | tmpnr = oitoa(i); |
---|
1336 | orbitalpos = getconfigint(tmpstr, tmpnr); |
---|
1337 | free(tmpnr); tmpnr = NULL; |
---|
1338 | |
---|
1339 | satnode = getsatbyorbitalpos(orbitalpos); |
---|
1340 | if(satnode != NULL && (fetype == -1 || satnode->fetype == fetype)) |
---|
1341 | satnode->scan = 1; |
---|
1342 | } |
---|
1343 | free(tmpstr); tmpstr = NULL; |
---|
1344 | } |
---|
1345 | dvbnode = dvbnode->next; |
---|
1346 | } |
---|
1347 | } |
---|
1348 | |
---|
1349 | void scansetmultisat(struct skin* scan) |
---|
1350 | { |
---|
1351 | struct skin* node = scan; |
---|
1352 | struct sat* satnode = NULL; |
---|
1353 | |
---|
1354 | while(node != NULL && node->name != NULL) |
---|
1355 | { |
---|
1356 | if(ostrcmp(node->ret, "1") == 0) |
---|
1357 | { |
---|
1358 | satnode = getsatbyorbitalpos(atoi(node->name)); |
---|
1359 | if(satnode != NULL) |
---|
1360 | satnode->scan = 1; |
---|
1361 | } |
---|
1362 | node = node->next; |
---|
1363 | } |
---|
1364 | } |
---|
1365 | |
---|
1366 | void delchannelbysat(int orbitalpos) |
---|
1367 | { |
---|
1368 | struct transponder* transpondernode = transponder; |
---|
1369 | struct channel* chnode = NULL; |
---|
1370 | |
---|
1371 | while(transpondernode != NULL) |
---|
1372 | { |
---|
1373 | if(transpondernode->orbitalpos == orbitalpos) |
---|
1374 | { |
---|
1375 | struct channel* tmpchannel = NULL; |
---|
1376 | chnode = channel; |
---|
1377 | while(chnode != NULL) |
---|
1378 | { |
---|
1379 | tmpchannel = chnode->next; |
---|
1380 | if(chnode->transponder == transpondernode) |
---|
1381 | delchannel(chnode->serviceid, chnode->transponderid, 1); |
---|
1382 | chnode = tmpchannel; |
---|
1383 | } |
---|
1384 | } |
---|
1385 | transpondernode = transpondernode->next; |
---|
1386 | } |
---|
1387 | } |
---|
1388 | |
---|
1389 | void delchannelbymultisat() |
---|
1390 | { |
---|
1391 | struct sat* satnode = sat; |
---|
1392 | |
---|
1393 | while(satnode != NULL) |
---|
1394 | { |
---|
1395 | if(satnode->scan == 1) |
---|
1396 | delchannelbysat(satnode->orbitalpos); |
---|
1397 | satnode = satnode->next; |
---|
1398 | } |
---|
1399 | } |
---|
1400 | |
---|
1401 | void screenscan(struct transponder* transpondernode, struct skin* mscan, char* tuner, int scantype, int orbitalpos, unsigned int frequency, int inversion, unsigned int symbolrate, int polarization, int fec, int modulation, int rolloff, int pilot, int networkscan, int onlyfree, int clear, int blindscan, int ichangename, int system, int favtype, int emptybouquet, int unusedbouquetchannels, int unusedsats, int unusedtransponder, int unusedchannels, int unusedprovider, int timeout, int flag) |
---|
1402 | { |
---|
1403 | int rcret = 0, tpmax = 0, i = 0, alladded = 0, endmsgshow = 0; |
---|
1404 | |
---|
1405 | struct skin* scan = NULL; |
---|
1406 | if(flag == 1) |
---|
1407 | scan = getscreen("scanauto"); |
---|
1408 | else |
---|
1409 | scan = getscreen("scanmanual"); |
---|
1410 | |
---|
1411 | struct skin* progress = getscreennode(scan, "progress"); |
---|
1412 | struct skin* listbox = getscreennode(scan, "listbox"); |
---|
1413 | struct skin* satname = getscreennode(scan, "satname"); |
---|
1414 | struct skin* tpcount = getscreennode(scan, "tpcount"); |
---|
1415 | struct skin* foundtv = getscreennode(scan, "foundtv"); |
---|
1416 | struct skin* foundradio = getscreennode(scan, "foundradio"); |
---|
1417 | struct skin* founddata = getscreennode(scan, "founddata"); |
---|
1418 | struct skin* foundblind = getscreennode(scan, "foundblind"); |
---|
1419 | struct skin* b2 = getscreennode(scan, "b2"); |
---|
1420 | struct skin* b3 = getscreennode(scan, "b3"); |
---|
1421 | struct skin* load = getscreen("loading"); |
---|
1422 | struct transponder* tpnode = NULL; |
---|
1423 | struct dvbdev* fenode = NULL, *dvbnode = dvbdev; |
---|
1424 | struct stimerthread* timernode = NULL; |
---|
1425 | struct sat* satnode = NULL; |
---|
1426 | struct channel* chnode = NULL; |
---|
1427 | char* tmpstr = NULL; |
---|
1428 | |
---|
1429 | listbox->aktline = 1; |
---|
1430 | listbox->aktpage = -1; |
---|
1431 | progress->progresssize = 0; |
---|
1432 | memset(&scaninfo, 0, sizeof(struct scaninfo)); |
---|
1433 | |
---|
1434 | b2->hidden = NO; |
---|
1435 | b3->hidden = NO; |
---|
1436 | |
---|
1437 | addscreenrc(scan, listbox); |
---|
1438 | if(scantype != 3) |
---|
1439 | { |
---|
1440 | while(dvbnode != NULL) |
---|
1441 | { |
---|
1442 | if(dvbnode->type == FRONTENDDEV && dvbnode->feinfo != NULL && dvbnode->felock < 1) |
---|
1443 | { |
---|
1444 | if(ostrcmp(dvbnode->feshortname, tuner) == 0) |
---|
1445 | { |
---|
1446 | fenode = dvbnode; |
---|
1447 | break; |
---|
1448 | } |
---|
1449 | } |
---|
1450 | dvbnode = dvbnode->next; |
---|
1451 | } |
---|
1452 | if(fenode == NULL) return; |
---|
1453 | } |
---|
1454 | else if(scantype == 3) |
---|
1455 | fenode = dvbdev; |
---|
1456 | |
---|
1457 | if(scantype == 0) //single transponder |
---|
1458 | { |
---|
1459 | if(fenode != NULL && fenode->feinfo != NULL) |
---|
1460 | { |
---|
1461 | //del channels from transponder if selected |
---|
1462 | if(clear == 1) |
---|
1463 | { |
---|
1464 | struct channel* tmpchannel = NULL; |
---|
1465 | chnode = channel; |
---|
1466 | while(chnode != NULL) |
---|
1467 | { |
---|
1468 | tmpchannel = chnode->next; |
---|
1469 | if(chnode->transponder == transpondernode) |
---|
1470 | delchannel(chnode->serviceid, chnode->transponderid, 1); |
---|
1471 | chnode = tmpchannel; |
---|
1472 | } |
---|
1473 | } |
---|
1474 | |
---|
1475 | debug(500, "fetype=%d, orbitalpos=%d, frequ=%d, inverion=%d, symbolrate=%d, polarization=%d, fec=%d, modulation=%d, rolloff=%d, pilot=%d, system=%d", fenode->feinfo->type, orbitalpos, frequency, inversion, symbolrate, polarization, fec, modulation, rolloff, pilot, system); |
---|
1476 | tpnode = createtransponder(99, fenode->feinfo->type, orbitalpos, frequency, inversion, symbolrate, polarization, fec, modulation, rolloff, pilot, system); |
---|
1477 | } |
---|
1478 | if(tpnode != NULL) |
---|
1479 | { |
---|
1480 | tpmax = 1; |
---|
1481 | satnode = getsatbyorbitalpos(tpnode->orbitalpos); |
---|
1482 | if(satnode != NULL) satnode->scan = 1; |
---|
1483 | } |
---|
1484 | } |
---|
1485 | else if(scantype == 1) //single sat |
---|
1486 | { |
---|
1487 | if(clear == 1) delchannelbysat(orbitalpos); |
---|
1488 | tpnode = transponder; |
---|
1489 | while(tpnode != NULL) |
---|
1490 | { |
---|
1491 | if(tpnode->orbitalpos == orbitalpos) |
---|
1492 | tpmax++; |
---|
1493 | tpnode = tpnode->next; |
---|
1494 | } |
---|
1495 | tpnode = transponder; |
---|
1496 | satnode = getsatbyorbitalpos(orbitalpos); |
---|
1497 | if(satnode != NULL) satnode->scan = 1; |
---|
1498 | } |
---|
1499 | else if(scantype == 2 || scantype == 3) //2: multi sat, 3: all |
---|
1500 | { |
---|
1501 | if(scantype == 2) |
---|
1502 | { |
---|
1503 | scansetmultisat(mscan); |
---|
1504 | if(clear == 1) delchannelbymultisat(); |
---|
1505 | } |
---|
1506 | if(scantype == 3) |
---|
1507 | { |
---|
1508 | scansetallsat(-1); |
---|
1509 | b2->hidden = YES; |
---|
1510 | b3->hidden = YES; |
---|
1511 | //del all channel for auto. search |
---|
1512 | if(clear == 1) |
---|
1513 | { |
---|
1514 | freechannel(1); |
---|
1515 | if(unusedsats == 1) delunusedsat(); |
---|
1516 | if(unusedtransponder == 1) delunusedtransponder(); |
---|
1517 | if(unusedchannels == 1) delunusedchannel(); |
---|
1518 | //if(unusedepgchannel == 1) delunusedepgchannel(); |
---|
1519 | if(unusedprovider == 1) delunusedprovider(); |
---|
1520 | } |
---|
1521 | } |
---|
1522 | |
---|
1523 | satnode = sat; |
---|
1524 | while(satnode != NULL) |
---|
1525 | { |
---|
1526 | if(satnode->scan != 0) |
---|
1527 | { |
---|
1528 | tpnode = transponder; |
---|
1529 | while(tpnode != NULL) |
---|
1530 | { |
---|
1531 | if(tpnode->orbitalpos == satnode->orbitalpos) |
---|
1532 | tpmax++; |
---|
1533 | tpnode = tpnode->next; |
---|
1534 | } |
---|
1535 | } |
---|
1536 | satnode = satnode->next; |
---|
1537 | } |
---|
1538 | tpnode = transponder; |
---|
1539 | } |
---|
1540 | |
---|
1541 | scaninfo.fenode = fenode; |
---|
1542 | scaninfo.tpnode = tpnode; |
---|
1543 | scaninfo.scanscreen = scan; |
---|
1544 | scaninfo.listbox = listbox; |
---|
1545 | scaninfo.timeout = timeout; |
---|
1546 | scaninfo.scantype = scantype; |
---|
1547 | scaninfo.orbitalpos = orbitalpos; |
---|
1548 | scaninfo.onlyfree = onlyfree; |
---|
1549 | scaninfo.networkscan = networkscan; |
---|
1550 | scaninfo.blindscan = blindscan; |
---|
1551 | scaninfo.changename = ichangename; |
---|
1552 | scaninfo.clear = clear; |
---|
1553 | scaninfo.tpmax = tpmax; |
---|
1554 | timernode = addtimer(&doscan, START, 1000, 1, NULL, NULL, NULL); |
---|
1555 | |
---|
1556 | while(1) |
---|
1557 | { |
---|
1558 | //satname |
---|
1559 | tmpstr = ostrcat(tmpstr, _("Sat/Provider: "), 1, 0); |
---|
1560 | tmpstr = ostrcat(tmpstr, scaninfo.satname, 1, 0); |
---|
1561 | changetext(satname, tmpstr); |
---|
1562 | free(tmpstr); tmpstr = NULL; |
---|
1563 | |
---|
1564 | //transpondercount |
---|
1565 | tmpstr = ostrcat(tmpstr, _("Transponder: "), 1, 0); |
---|
1566 | tmpstr = ostrcat(tmpstr, oitoa(scaninfo.tpcount), 1, 1); |
---|
1567 | tmpstr = ostrcat(tmpstr, " / ", 1, 0); |
---|
1568 | tmpstr = ostrcat(tmpstr, oitoa(scaninfo.tpmax), 1, 1); |
---|
1569 | tmpstr = ostrcat(tmpstr, " / ", 1, 0); |
---|
1570 | tmpstr = ostrcat(tmpstr, oitoa(scaninfo.tpnew), 1, 1); |
---|
1571 | changetext(tpcount, tmpstr); |
---|
1572 | free(tmpstr); tmpstr = NULL; |
---|
1573 | |
---|
1574 | //tvcount |
---|
1575 | tmpstr = ostrcat(tmpstr, _("TV: "), 1, 0); |
---|
1576 | tmpstr = ostrcat(tmpstr, oitoa(scaninfo.newtvcount), 1, 1); |
---|
1577 | tmpstr = ostrcat(tmpstr, " / ", 1, 0); |
---|
1578 | tmpstr = ostrcat(tmpstr, oitoa(scaninfo.tvcount), 1, 1); |
---|
1579 | changetext(foundtv, tmpstr); |
---|
1580 | free(tmpstr); tmpstr = NULL; |
---|
1581 | |
---|
1582 | //radiocount |
---|
1583 | tmpstr = ostrcat(tmpstr, _("Radio: "), 1, 0); |
---|
1584 | tmpstr = ostrcat(tmpstr, oitoa(scaninfo.newradiocount), 1, 1); |
---|
1585 | tmpstr = ostrcat(tmpstr, " / ", 1, 0); |
---|
1586 | tmpstr = ostrcat(tmpstr, oitoa(scaninfo.radiocount), 1, 1); |
---|
1587 | changetext(foundradio, tmpstr); |
---|
1588 | free(tmpstr); tmpstr = NULL; |
---|
1589 | |
---|
1590 | //datacount |
---|
1591 | tmpstr = ostrcat(tmpstr, _("Data: "), 1, 0); |
---|
1592 | tmpstr = ostrcat(tmpstr, oitoa(scaninfo.newdatacount), 1, 1); |
---|
1593 | tmpstr = ostrcat(tmpstr, " / ", 1, 0); |
---|
1594 | tmpstr = ostrcat(tmpstr, oitoa(scaninfo.datacount), 1, 1); |
---|
1595 | changetext(founddata, tmpstr); |
---|
1596 | free(tmpstr); tmpstr = NULL; |
---|
1597 | |
---|
1598 | //blindcount |
---|
1599 | tmpstr = ostrcat(tmpstr, _("Blindscan: "), 1, 0); |
---|
1600 | tmpstr = ostrcat(tmpstr, oitoa(scaninfo.newblindcount), 1, 1); |
---|
1601 | tmpstr = ostrcat(tmpstr, " / ", 1, 0); |
---|
1602 | tmpstr = ostrcat(tmpstr, oitoa(scaninfo.blindcount), 1, 1); |
---|
1603 | tmpstr = ostrcat(tmpstr, " / ", 1, 0); |
---|
1604 | tmpstr = ostrcat(tmpstr, oitoa(scaninfo.blindmax), 1, 1); |
---|
1605 | changetext(foundblind, tmpstr); |
---|
1606 | free(tmpstr); tmpstr = NULL; |
---|
1607 | |
---|
1608 | if(scaninfo.tpmax == 0) |
---|
1609 | progress->progresssize = 100; |
---|
1610 | else |
---|
1611 | progress->progresssize = (100 / (float)scaninfo.tpmax) * scaninfo.tpcount; |
---|
1612 | |
---|
1613 | drawscreen(scan, 0, 0); |
---|
1614 | rcret = waitrc(scan, 1000, 0); |
---|
1615 | |
---|
1616 | if(scantype != 3 && scaninfo.threadend == 1 && endmsgshow == 0) |
---|
1617 | { |
---|
1618 | if(scaninfo.tvcount + scaninfo.radiocount + scaninfo.datacount == 0) |
---|
1619 | textbox(_("Message"), _("Channel scan ended.\nNothing found."), _("OK"), getrcconfigint("rcok", NULL), NULL, 0, NULL, 0, NULL, 0, 800, 200, 0, 0); |
---|
1620 | else |
---|
1621 | textbox(_("Message"), _("Channel scan ended."), _("OK"), getrcconfigint("rcok", NULL), NULL, 0, NULL, 0, NULL, 0, 800, 200, 0, 0); |
---|
1622 | endmsgshow = 1; |
---|
1623 | } |
---|
1624 | |
---|
1625 | if(scantype != 3 && rcret == getrcconfigint("rcred", NULL)) |
---|
1626 | scanaddchannel(listbox->select, scantype, tpnode, ichangename); |
---|
1627 | |
---|
1628 | if((scantype != 3 && rcret == getrcconfigint("rcgreen", NULL)) || (scantype == 3 && scaninfo.threadend == 1 && alladded < 2)) |
---|
1629 | { |
---|
1630 | struct skin* lnode = listbox; |
---|
1631 | |
---|
1632 | long deaktivcol = convertcol("deaktivcol"); |
---|
1633 | if(scantype == 3 && alladded == 0) |
---|
1634 | { |
---|
1635 | alladded = 1; |
---|
1636 | continue; |
---|
1637 | } |
---|
1638 | alladded = 2; |
---|
1639 | |
---|
1640 | drawscreen(load, 0, 0); |
---|
1641 | while(lnode != NULL) |
---|
1642 | { |
---|
1643 | if(lnode->fontcol != deaktivcol && lnode->del == 1) |
---|
1644 | scanaddchannel(lnode, scantype, tpnode, ichangename); |
---|
1645 | lnode = lnode->next; |
---|
1646 | } |
---|
1647 | clearscreen(load); |
---|
1648 | if(scaninfo.tvcount + scaninfo.radiocount + scaninfo.datacount == 0) |
---|
1649 | textbox(_("Message"), _("Channel scan ended.\nNothing found."), _("OK"), getrcconfigint("rcok", NULL), NULL, 0, NULL, 0, NULL, 0, 800, 200, 0, 0); |
---|
1650 | else |
---|
1651 | textbox(_("Message"), _("All new channels added!"), _("OK"), getrcconfigint("rcok", NULL), NULL, 0, NULL, 0, NULL, 0, 600, 200, 0, 0); |
---|
1652 | } |
---|
1653 | |
---|
1654 | if(rcret == getrcconfigint("rcexit", NULL)) |
---|
1655 | { |
---|
1656 | if(timernode != NULL && scaninfo.threadend == 0) |
---|
1657 | { |
---|
1658 | timernode->aktion = STOP; |
---|
1659 | while(i < 4 && scaninfo.threadend == 0) |
---|
1660 | { |
---|
1661 | textbox(_("Message"), _("Wait for channel scan end"), NULL, 0, NULL, 0, NULL, 0, NULL, 0, 800, 200, 3, 0); |
---|
1662 | i++; |
---|
1663 | } |
---|
1664 | } |
---|
1665 | break; |
---|
1666 | } |
---|
1667 | } |
---|
1668 | |
---|
1669 | if(scantype == 0) deltransponderbyid(99); |
---|
1670 | if(clear == 1) |
---|
1671 | { |
---|
1672 | // favtype 0 = unchanged |
---|
1673 | // favtype 1 = create new |
---|
1674 | // favtype 2 = delete |
---|
1675 | |
---|
1676 | if(favtype == 1) |
---|
1677 | { |
---|
1678 | freemainbouquet(1); |
---|
1679 | struct provider *pnode = provider; |
---|
1680 | |
---|
1681 | while(pnode != NULL) |
---|
1682 | { |
---|
1683 | provider2bouquet(pnode->providerid, 1); |
---|
1684 | pnode = pnode->next; |
---|
1685 | } |
---|
1686 | } |
---|
1687 | else if(favtype == 2) |
---|
1688 | freemainbouquet(1); |
---|
1689 | |
---|
1690 | if(emptybouquet == 1) |
---|
1691 | delemptymainbouquet(1); |
---|
1692 | |
---|
1693 | if(unusedbouquetchannels == 1) |
---|
1694 | delunusedbouquetchannels(0); |
---|
1695 | else |
---|
1696 | delunusedbouquetchannels(1); |
---|
1697 | } |
---|
1698 | delmarkedscreennodes(scan, 1); |
---|
1699 | delownerrc(scan); |
---|
1700 | clearscreen(scan); |
---|
1701 | resetsatscan(); |
---|
1702 | drawscreen(load, 0, 0); |
---|
1703 | sortchannel(); |
---|
1704 | sortprovider(); |
---|
1705 | clearscreen(load); |
---|
1706 | } |
---|
1707 | |
---|
1708 | void changescantype(char* scantype, struct skin* scan, struct skin* listbox, struct skin* tuner, struct skin* satellite, struct skin* id, struct skin* system, struct skin* frequency, struct skin* inversion, struct skin* symbolrate, struct skin* polarization, struct skin* fec, struct skin* modulation, struct skin* rolloff, struct skin* pilot, struct skin* hp, struct skin* lp, struct skin* bandwidth, struct skin* transmission, struct skin* guardinterval, struct skin* hierarchy, struct skin* b4, struct skin* b5, int flag) |
---|
1709 | { |
---|
1710 | struct sat* satnode = sat; |
---|
1711 | struct skin* tmp = NULL; |
---|
1712 | char* tmpstr = NULL, *tmpstr1 = NULL, *tmpnr = NULL; |
---|
1713 | char* feshortname = NULL; |
---|
1714 | int i, orbitalpos = 0; |
---|
1715 | |
---|
1716 | if(tuner != NULL) feshortname = tuner->ret; |
---|
1717 | |
---|
1718 | tuner->hidden = NO; |
---|
1719 | id->hidden = NO; |
---|
1720 | system->hidden = NO; |
---|
1721 | frequency->hidden = NO; |
---|
1722 | inversion->hidden = NO; |
---|
1723 | symbolrate->hidden = NO; |
---|
1724 | polarization->hidden = NO; |
---|
1725 | fec->hidden = NO; |
---|
1726 | modulation->hidden = NO; |
---|
1727 | rolloff->hidden = NO; |
---|
1728 | pilot->hidden = NO; |
---|
1729 | hp->hidden = NO; |
---|
1730 | lp->hidden = NO; |
---|
1731 | bandwidth->hidden = NO; |
---|
1732 | transmission->hidden = NO; |
---|
1733 | guardinterval->hidden = NO; |
---|
1734 | hierarchy->hidden = NO; |
---|
1735 | satellite->hidden = NO; |
---|
1736 | b4->hidden = NO; |
---|
1737 | b5->hidden = NO; |
---|
1738 | delmarkedscreennodes(scan, 1); |
---|
1739 | |
---|
1740 | if(flag == 0 && ostrcmp(scantype, "0") == 0 && ostrcmp(system->ret, "0") == 0) |
---|
1741 | { |
---|
1742 | modulation->hidden = YES; |
---|
1743 | rolloff->hidden = YES; |
---|
1744 | pilot->hidden = YES; |
---|
1745 | } |
---|
1746 | |
---|
1747 | if(ostrcmp(scantype, "1") == 0 || ostrcmp(scantype, "2") == 0 || ostrcmp(scantype, "3") == 0) |
---|
1748 | { |
---|
1749 | id->hidden = YES; |
---|
1750 | system->hidden = YES; |
---|
1751 | frequency->hidden = YES; |
---|
1752 | inversion->hidden = YES; |
---|
1753 | symbolrate->hidden = YES; |
---|
1754 | polarization->hidden = YES; |
---|
1755 | fec->hidden = YES; |
---|
1756 | modulation->hidden = YES; |
---|
1757 | rolloff->hidden = YES; |
---|
1758 | pilot->hidden = YES; |
---|
1759 | hp->hidden = YES; |
---|
1760 | lp->hidden = YES; |
---|
1761 | bandwidth->hidden = YES; |
---|
1762 | transmission->hidden = YES; |
---|
1763 | guardinterval->hidden = YES; |
---|
1764 | hierarchy->hidden = YES; |
---|
1765 | b4->hidden = YES; |
---|
1766 | b5->hidden = YES; |
---|
1767 | } |
---|
1768 | if(ostrcmp(scantype, "2") == 0 && feshortname != NULL) |
---|
1769 | { |
---|
1770 | satellite->hidden = YES; |
---|
1771 | |
---|
1772 | tmpstr = ostrcat(feshortname, "_sat", 0, 0); |
---|
1773 | for(i = 1; i <= getmaxsat(feshortname); i++) |
---|
1774 | { |
---|
1775 | tmpnr = oitoa(i); |
---|
1776 | orbitalpos = getconfigint(tmpstr, tmpnr); |
---|
1777 | free(tmpnr); tmpnr = NULL; |
---|
1778 | |
---|
1779 | satnode = getsatbyorbitalpos(orbitalpos); |
---|
1780 | if(satnode != NULL && satnode->fetype == FE_QPSK) |
---|
1781 | { |
---|
1782 | tmp = addlistbox(scan, listbox, tmp, 1); |
---|
1783 | if(tmp != NULL) |
---|
1784 | { |
---|
1785 | tmpstr1 = oitoa(satnode->orbitalpos); |
---|
1786 | changename(tmp, tmpstr1); |
---|
1787 | free(tmpstr1); tmpstr1 = NULL; |
---|
1788 | changetext(tmp, satnode->name); |
---|
1789 | tmp->type = CHOICEBOX; |
---|
1790 | addchoicebox(tmp, "0", _("no")); |
---|
1791 | addchoicebox(tmp, "1", _("yes")); |
---|
1792 | } |
---|
1793 | } |
---|
1794 | } |
---|
1795 | free(tmpstr); tmpstr = NULL; |
---|
1796 | } |
---|
1797 | if(ostrcmp(scantype, "3") == 0) |
---|
1798 | { |
---|
1799 | tuner->hidden = YES; |
---|
1800 | satellite->hidden = YES; |
---|
1801 | } |
---|
1802 | |
---|
1803 | if(flag == 2) |
---|
1804 | { |
---|
1805 | system->hidden = YES; |
---|
1806 | inversion->hidden = YES; |
---|
1807 | polarization->hidden = YES; |
---|
1808 | rolloff->hidden = YES; |
---|
1809 | pilot->hidden = YES; |
---|
1810 | satellite->hidden = YES; |
---|
1811 | } |
---|
1812 | |
---|
1813 | if(flag == 3) |
---|
1814 | { |
---|
1815 | system->hidden = YES; |
---|
1816 | polarization->hidden = YES; |
---|
1817 | rolloff->hidden = YES; |
---|
1818 | pilot->hidden = YES; |
---|
1819 | satellite->hidden = YES; |
---|
1820 | symbolrate->hidden = YES; |
---|
1821 | fec->hidden = YES; |
---|
1822 | } |
---|
1823 | else |
---|
1824 | { |
---|
1825 | hp->hidden = YES; |
---|
1826 | lp->hidden = YES; |
---|
1827 | bandwidth->hidden = YES; |
---|
1828 | transmission->hidden = YES; |
---|
1829 | guardinterval->hidden = YES; |
---|
1830 | hierarchy->hidden = YES; |
---|
1831 | } |
---|
1832 | } |
---|
1833 | |
---|
1834 | void scanchangesat(struct skin* sat, struct transponder* tpnode, char* feshortname) |
---|
1835 | { |
---|
1836 | char* tmpstr = NULL; |
---|
1837 | |
---|
1838 | changeinput(sat, NULL); |
---|
1839 | changechoiceboxvalue(sat, NULL); |
---|
1840 | tmpstr = getsatstring(feshortname, FE_QPSK); |
---|
1841 | changeinput(sat, tmpstr); |
---|
1842 | free(tmpstr); tmpstr = NULL; |
---|
1843 | tmpstr = getorbitalposstring(feshortname, FE_QPSK); |
---|
1844 | changechoiceboxvalue(sat, tmpstr); |
---|
1845 | free(tmpstr); tmpstr = NULL; |
---|
1846 | if(tpnode != NULL) |
---|
1847 | { |
---|
1848 | tmpstr = oitoa(tpnode->orbitalpos); |
---|
1849 | setchoiceboxselection(sat, tmpstr); |
---|
1850 | free(tmpstr); tmpstr = NULL; |
---|
1851 | } |
---|
1852 | } |
---|
1853 | |
---|
1854 | //flag 0: manual scan (DVB-S) |
---|
1855 | //flag 1: auto scan (all) |
---|
1856 | //flag 2: manual scan (DVB-C) |
---|
1857 | //flag 3: manual scan (DVB-T) |
---|
1858 | void screenscanconfig(int flag) |
---|
1859 | { |
---|
1860 | int rcret = 0, fetype = -1; |
---|
1861 | unsigned int ifrequency = -1, isymbolrate = -1; |
---|
1862 | int iscantype = -1, isat = -1; |
---|
1863 | int iinversion = -1, ipolarization = -1; |
---|
1864 | int ifec = -1, imodulation = -1, irolloff = -1, ipilot = -1, isystem = -1; |
---|
1865 | int inetworkscan = -1, ionlyfree = -1, iclear = -1, iblindscan = -1, ichangename = -1; |
---|
1866 | int ifavtype = -1, iemptybouquet = -1, iunusedbouquetchannels = -1; |
---|
1867 | int iunusedsats = -1, iunusedtransponder = -1, iunusedchannels = -1, iunusedprovider = -1; |
---|
1868 | |
---|
1869 | int i = 0, treffer = 0, tunercount = 0; |
---|
1870 | |
---|
1871 | struct skin* scan = NULL; |
---|
1872 | if(flag == 1) |
---|
1873 | scan = getscreen("scanadjustauto"); |
---|
1874 | else |
---|
1875 | scan = getscreen("scanadjustmanual"); |
---|
1876 | |
---|
1877 | struct skin* listbox = getscreennode(scan, "listbox"); |
---|
1878 | struct skin* tuner = getscreennode(scan, "tuner"); |
---|
1879 | struct skin* scantype = getscreennode(scan, "scantype"); |
---|
1880 | struct skin* sat = getscreennode(scan, "sat"); |
---|
1881 | struct skin* id = getscreennode(scan, "id"); |
---|
1882 | struct skin* system = getscreennode(scan, "system"); |
---|
1883 | struct skin* frequency = getscreennode(scan, "frequency"); |
---|
1884 | struct skin* inversion = getscreennode(scan, "inversion"); |
---|
1885 | struct skin* symbolrate = getscreennode(scan, "symbolrate"); |
---|
1886 | struct skin* polarization = getscreennode(scan, "polarization"); |
---|
1887 | struct skin* fec = getscreennode(scan, "fec"); |
---|
1888 | struct skin* modulation = getscreennode(scan, "modulation"); |
---|
1889 | struct skin* rolloff = getscreennode(scan, "rolloff"); |
---|
1890 | struct skin* pilot = getscreennode(scan, "pilot"); |
---|
1891 | struct skin* hp = getscreennode(scan, "hp"); |
---|
1892 | struct skin* lp = getscreennode(scan, "lp"); |
---|
1893 | struct skin* bandwidth = getscreennode(scan, "bandwidth"); |
---|
1894 | struct skin* transmission = getscreennode(scan, "transmission"); |
---|
1895 | struct skin* guardinterval = getscreennode(scan, "guardinterval"); |
---|
1896 | struct skin* hierarchy = getscreennode(scan, "hierarchy"); |
---|
1897 | struct skin* networkscan = getscreennode(scan, "networkscan"); |
---|
1898 | struct skin* clear = getscreennode(scan, "clear"); |
---|
1899 | struct skin* onlyfree = getscreennode(scan, "onlyfree"); |
---|
1900 | struct skin* blindscan = getscreennode(scan, "blindscan"); |
---|
1901 | struct skin* changename = getscreennode(scan, "changename"); |
---|
1902 | struct skin* favtype = getscreennode(scan, "favtype"); |
---|
1903 | struct skin* emptybouquet = getscreennode(scan, "emptybouquet"); |
---|
1904 | struct skin* unusedbouquetchannels = getscreennode(scan, "unusedbouquetchannels"); |
---|
1905 | struct skin* unusedsats = getscreennode(scan, "unusedsats"); |
---|
1906 | struct skin* unusedtransponder = getscreennode(scan, "unusedtransponder"); |
---|
1907 | struct skin* unusedchannels = getscreennode(scan, "unusedchannels"); |
---|
1908 | struct skin* unusedprovider = getscreennode(scan, "unusedprovider"); |
---|
1909 | |
---|
1910 | struct skin* b4 = getscreennode(scan, "b4"); |
---|
1911 | struct skin* b5 = getscreennode(scan, "b5"); |
---|
1912 | struct skin* tmp = NULL; |
---|
1913 | char* tmpstr = NULL, *tmpnr = NULL, *feshortname = NULL; |
---|
1914 | struct transponder* tpnode = NULL; |
---|
1915 | struct dvbdev* dvbnode = dvbdev; |
---|
1916 | |
---|
1917 | listbox->aktline = 1; |
---|
1918 | listbox->aktpage = -1; |
---|
1919 | |
---|
1920 | if(status.recording > 0 || status.streaming > 0) |
---|
1921 | { |
---|
1922 | textbox(_("Message"), _("Scan is not allowed if record or stream is running !"), _("OK"), getrcconfigint("rcok", NULL), NULL, 0, NULL, 0, NULL, 0, 800, 200, 0, 0); |
---|
1923 | return; |
---|
1924 | } |
---|
1925 | |
---|
1926 | //del old values |
---|
1927 | changeinput(tuner, NULL); |
---|
1928 | changechoiceboxvalue(tuner, NULL); |
---|
1929 | changeinput(scantype, NULL); |
---|
1930 | changechoiceboxvalue(scantype, NULL); |
---|
1931 | changeinput(sat, NULL); |
---|
1932 | changechoiceboxvalue(sat, NULL); |
---|
1933 | changeinput(system, NULL); |
---|
1934 | changechoiceboxvalue(system, NULL); |
---|
1935 | changeinput(inversion, NULL); |
---|
1936 | changechoiceboxvalue(inversion, NULL); |
---|
1937 | changeinput(polarization, NULL); |
---|
1938 | changechoiceboxvalue(polarization, NULL); |
---|
1939 | changeinput(fec, NULL); |
---|
1940 | changechoiceboxvalue(fec, NULL); |
---|
1941 | changeinput(modulation, NULL); |
---|
1942 | changechoiceboxvalue(modulation, NULL); |
---|
1943 | changeinput(rolloff, NULL); |
---|
1944 | changechoiceboxvalue(rolloff, NULL); |
---|
1945 | changeinput(pilot, NULL); |
---|
1946 | changechoiceboxvalue(pilot, NULL); |
---|
1947 | changeinput(hp, NULL); |
---|
1948 | changeinput(lp, NULL); |
---|
1949 | changeinput(bandwidth, NULL); |
---|
1950 | changeinput(transmission, NULL); |
---|
1951 | changeinput(guardinterval, NULL); |
---|
1952 | changeinput(hierarchy, NULL); |
---|
1953 | changechoiceboxvalue(hp, NULL); |
---|
1954 | changechoiceboxvalue(lp, NULL); |
---|
1955 | changechoiceboxvalue(bandwidth, NULL); |
---|
1956 | changechoiceboxvalue(transmission, NULL); |
---|
1957 | changechoiceboxvalue(guardinterval, NULL); |
---|
1958 | changechoiceboxvalue(hierarchy, NULL); |
---|
1959 | |
---|
1960 | frequency->aktpage = 0; |
---|
1961 | symbolrate->aktpage = 0; |
---|
1962 | |
---|
1963 | if(flag == 0) fetype = FE_QPSK; |
---|
1964 | if(flag == 2) fetype = FE_QAM; |
---|
1965 | if(flag == 3) fetype = FE_OFDM; |
---|
1966 | |
---|
1967 | //tuner |
---|
1968 | while(dvbnode != NULL) |
---|
1969 | { |
---|
1970 | if(dvbnode->type == FRONTENDDEV && dvbnode->feinfo != NULL && dvbnode->felock < 1 && dvbnode->deactive == 0 && (flag == 1 || dvbnode->feinfo->type == fetype)) |
---|
1971 | { |
---|
1972 | treffer = 0; |
---|
1973 | if(dvbnode->feshortname != NULL) |
---|
1974 | { |
---|
1975 | tmpstr = ostrcat(dvbnode->feshortname, "_sat", 0, 0); |
---|
1976 | for(i = 1; i <= getmaxsat(dvbnode->feshortname); i++) |
---|
1977 | { |
---|
1978 | tmpnr = oitoa(i); |
---|
1979 | if(getconfigint(tmpstr, tmpnr) != 0) |
---|
1980 | { |
---|
1981 | treffer = 1; |
---|
1982 | break; |
---|
1983 | } |
---|
1984 | free(tmpnr); tmpnr = NULL; |
---|
1985 | } |
---|
1986 | free(tmpnr); tmpnr = NULL; |
---|
1987 | free(tmpstr); tmpstr = NULL; |
---|
1988 | } |
---|
1989 | |
---|
1990 | if(treffer == 0) |
---|
1991 | { |
---|
1992 | dvbnode = dvbnode->next; |
---|
1993 | continue; |
---|
1994 | } |
---|
1995 | |
---|
1996 | tunercount++; |
---|
1997 | if(feshortname == NULL) feshortname = dvbnode->feshortname; |
---|
1998 | |
---|
1999 | tmpstr = ostrcat(tmpstr, dvbnode->feinfo->name, 1, 0); |
---|
2000 | tmpstr = ostrcat(tmpstr, " (", 1, 0); |
---|
2001 | tmpstr = ostrcat(tmpstr, oitoa(dvbnode->adapter), 1, 1); |
---|
2002 | tmpstr = ostrcat(tmpstr, "/", 1, 0); |
---|
2003 | tmpstr = ostrcat(tmpstr, oitoa(dvbnode->devnr), 1, 1); |
---|
2004 | tmpstr = ostrcat(tmpstr, ")", 1, 0); |
---|
2005 | addchoicebox(tuner, dvbnode->feshortname, tmpstr); |
---|
2006 | free(tmpstr); tmpstr = NULL; |
---|
2007 | } |
---|
2008 | dvbnode = dvbnode->next; |
---|
2009 | } |
---|
2010 | |
---|
2011 | if(tunercount < 1) |
---|
2012 | { |
---|
2013 | textbox(_("Message"), _("No Tuner configured"), _("OK"), getrcconfigint("rcok", NULL), NULL, 0, NULL, 0, NULL, 0, 800, 200, 0, 0); |
---|
2014 | return; |
---|
2015 | } |
---|
2016 | |
---|
2017 | rcret = servicestop(status.aktservice, 1, 1); |
---|
2018 | if(rcret == 1) return; |
---|
2019 | |
---|
2020 | if(status.aktservice->channel != NULL) |
---|
2021 | tpnode = status.aktservice->channel->transponder; |
---|
2022 | |
---|
2023 | //clear akt and last channel, so all channel can delete |
---|
2024 | freechannelhistory(); |
---|
2025 | status.lastservice->channel = NULL; |
---|
2026 | status.aktservice->channel = NULL; |
---|
2027 | |
---|
2028 | start: |
---|
2029 | |
---|
2030 | if(flag == 0) |
---|
2031 | { |
---|
2032 | addchoicebox(scantype, "0", _("Single Transponder")); |
---|
2033 | addchoicebox(scantype, "1", _("Single Sat")); |
---|
2034 | addchoicebox(scantype, "2", _("Multi Sat")); |
---|
2035 | setchoiceboxselection(scantype, "0"); |
---|
2036 | } |
---|
2037 | else if(flag == 2 || flag == 3) |
---|
2038 | { |
---|
2039 | addchoicebox(scantype, "0", _("Single Transponder")); |
---|
2040 | addchoicebox(scantype, "1", _("Single Provider")); |
---|
2041 | setchoiceboxselection(scantype, "0"); |
---|
2042 | } |
---|
2043 | else |
---|
2044 | { |
---|
2045 | addchoicebox(scantype, "3", _("Auto Scan")); |
---|
2046 | setchoiceboxselection(scantype, "3"); |
---|
2047 | } |
---|
2048 | |
---|
2049 | //sat |
---|
2050 | scanchangesat(sat, tpnode, feshortname); |
---|
2051 | |
---|
2052 | //id |
---|
2053 | if(tpnode != NULL) |
---|
2054 | tmpstr = ollutoa(tpnode->id); |
---|
2055 | changeinput(id, tmpstr); |
---|
2056 | free(tmpstr); tmpstr = NULL; |
---|
2057 | |
---|
2058 | //system |
---|
2059 | tmpstr = transpondergetsystemstr(tpnode, 1); |
---|
2060 | changeinput(system, tmpstr); |
---|
2061 | free(tmpstr); tmpstr = NULL; |
---|
2062 | tmpstr = transpondergetsystemstr(tpnode, 2); |
---|
2063 | changechoiceboxvalue(system, tmpstr); |
---|
2064 | free(tmpstr); tmpstr = NULL; |
---|
2065 | if(tpnode != NULL) |
---|
2066 | { |
---|
2067 | tmpstr = oitoa(tpnode->system); |
---|
2068 | setchoiceboxselection(system, tmpstr); |
---|
2069 | free(tmpstr); tmpstr = NULL; |
---|
2070 | } |
---|
2071 | |
---|
2072 | //frequency |
---|
2073 | if(tpnode != NULL) |
---|
2074 | tmpstr = oitoa(tpnode->frequency / 1000); |
---|
2075 | else |
---|
2076 | { |
---|
2077 | if(flag == 3) |
---|
2078 | tmpstr = ostrcat(tmpstr, "000000", 1, 0); |
---|
2079 | else |
---|
2080 | tmpstr = ostrcat(tmpstr, "00000", 1, 0); |
---|
2081 | } |
---|
2082 | if(flag == 2 || flag == 3) |
---|
2083 | { |
---|
2084 | changemask(frequency, "000000"); |
---|
2085 | changeinput(frequency, tmpstr); |
---|
2086 | frequency->input = mask(frequency->input, 6, "0"); |
---|
2087 | } |
---|
2088 | else |
---|
2089 | { |
---|
2090 | changemask(frequency, "00000"); |
---|
2091 | changeinput(frequency, tmpstr); |
---|
2092 | frequency->input = mask(frequency->input, 5, "0"); |
---|
2093 | } |
---|
2094 | free(tmpstr); tmpstr = NULL; |
---|
2095 | |
---|
2096 | //inversion |
---|
2097 | tmpstr = transpondergetinversionstr(tpnode, 1); |
---|
2098 | changeinput(inversion, tmpstr); |
---|
2099 | free(tmpstr); tmpstr = NULL; |
---|
2100 | tmpstr = transpondergetinversionstr(tpnode, 2); |
---|
2101 | changechoiceboxvalue(inversion, tmpstr); |
---|
2102 | free(tmpstr); tmpstr = NULL; |
---|
2103 | if(tpnode != NULL) |
---|
2104 | { |
---|
2105 | tmpstr = oitoa(tpnode->inversion); |
---|
2106 | setchoiceboxselection(inversion, tmpstr); |
---|
2107 | free(tmpstr); tmpstr = NULL; |
---|
2108 | } |
---|
2109 | |
---|
2110 | //symbolrate |
---|
2111 | if(tpnode != NULL) |
---|
2112 | tmpstr = oitoa(tpnode->symbolrate / 1000); |
---|
2113 | else |
---|
2114 | tmpstr = ostrcat(tmpstr, "00000", 1, 0); |
---|
2115 | changemask(symbolrate, "00000"); |
---|
2116 | changeinput(symbolrate, tmpstr); |
---|
2117 | symbolrate->input = mask(symbolrate->input, 5, "0"); |
---|
2118 | free(tmpstr); tmpstr = NULL; |
---|
2119 | |
---|
2120 | //polarization |
---|
2121 | tmpstr = transpondergetpolarizationstr(tpnode, 1); |
---|
2122 | changeinput(polarization, tmpstr); |
---|
2123 | free(tmpstr); tmpstr = NULL; |
---|
2124 | tmpstr = transpondergetpolarizationstr(tpnode, 2); |
---|
2125 | changechoiceboxvalue(polarization, tmpstr); |
---|
2126 | free(tmpstr); tmpstr = NULL; |
---|
2127 | if(tpnode != NULL) |
---|
2128 | { |
---|
2129 | tmpstr = oitoa(tpnode->polarization); |
---|
2130 | setchoiceboxselection(polarization, tmpstr); |
---|
2131 | free(tmpstr); tmpstr = NULL; |
---|
2132 | } |
---|
2133 | |
---|
2134 | //fec |
---|
2135 | tmpstr = transpondergetfecstr(tpnode, fetype, 1); |
---|
2136 | changeinput(fec, tmpstr); |
---|
2137 | free(tmpstr); tmpstr = NULL; |
---|
2138 | tmpstr = transpondergetfecstr(tpnode, fetype, 2); |
---|
2139 | changechoiceboxvalue(fec, tmpstr); |
---|
2140 | free(tmpstr); tmpstr = NULL; |
---|
2141 | if(tpnode != NULL) |
---|
2142 | { |
---|
2143 | tmpstr = oitoa(tpnode->fec); |
---|
2144 | setchoiceboxselection(fec, tmpstr); |
---|
2145 | free(tmpstr); tmpstr = NULL; |
---|
2146 | } |
---|
2147 | |
---|
2148 | //modulation |
---|
2149 | tmpstr = transpondergetmodulationstr(tpnode, fetype, 1); |
---|
2150 | changeinput(modulation, tmpstr); |
---|
2151 | free(tmpstr); tmpstr = NULL; |
---|
2152 | tmpstr = transpondergetmodulationstr(tpnode, fetype, 2); |
---|
2153 | changechoiceboxvalue(modulation, tmpstr); |
---|
2154 | free(tmpstr); tmpstr = NULL; |
---|
2155 | if(tpnode != NULL) |
---|
2156 | { |
---|
2157 | tmpstr = oitoa(tpnode->modulation); |
---|
2158 | setchoiceboxselection(modulation, tmpstr); |
---|
2159 | free(tmpstr); tmpstr = NULL; |
---|
2160 | } |
---|
2161 | |
---|
2162 | //rolloff |
---|
2163 | tmpstr = transpondergetrolloffstr(tpnode, 1); |
---|
2164 | changeinput(rolloff, tmpstr); |
---|
2165 | free(tmpstr); tmpstr = NULL; |
---|
2166 | tmpstr = transpondergetrolloffstr(tpnode, 2); |
---|
2167 | changechoiceboxvalue(rolloff, tmpstr); |
---|
2168 | free(tmpstr); tmpstr = NULL; |
---|
2169 | if(tpnode != NULL) |
---|
2170 | { |
---|
2171 | tmpstr = oitoa(tpnode->rolloff); |
---|
2172 | setchoiceboxselection(rolloff, tmpstr); |
---|
2173 | free(tmpstr); tmpstr = NULL; |
---|
2174 | } |
---|
2175 | |
---|
2176 | //pilot |
---|
2177 | tmpstr = transpondergetpilotstr(tpnode, 1); |
---|
2178 | changeinput(pilot, tmpstr); |
---|
2179 | free(tmpstr); tmpstr = NULL; |
---|
2180 | tmpstr = transpondergetpilotstr(tpnode, 2); |
---|
2181 | changechoiceboxvalue(pilot, tmpstr); |
---|
2182 | free(tmpstr); tmpstr = NULL; |
---|
2183 | if(tpnode != NULL) |
---|
2184 | { |
---|
2185 | tmpstr = oitoa(tpnode->pilot); |
---|
2186 | setchoiceboxselection(pilot, tmpstr); |
---|
2187 | free(tmpstr); tmpstr = NULL; |
---|
2188 | } |
---|
2189 | |
---|
2190 | //hp |
---|
2191 | tmpstr = transpondergetfecstr(tpnode, fetype, 1); |
---|
2192 | changeinput(hp, tmpstr); |
---|
2193 | free(tmpstr); tmpstr = NULL; |
---|
2194 | tmpstr = transpondergetfecstr(tpnode, fetype, 2); |
---|
2195 | changechoiceboxvalue(hp, tmpstr); |
---|
2196 | free(tmpstr); tmpstr = NULL; |
---|
2197 | if(tpnode != NULL) |
---|
2198 | { |
---|
2199 | tmpstr = oitoa(tpnode->fec); |
---|
2200 | setchoiceboxselection(hp, tmpstr); |
---|
2201 | free(tmpstr); tmpstr = NULL; |
---|
2202 | } |
---|
2203 | |
---|
2204 | //lp |
---|
2205 | tmpstr = transpondergetfecstr(tpnode, fetype, 1); |
---|
2206 | changeinput(lp, tmpstr); |
---|
2207 | free(tmpstr); tmpstr = NULL; |
---|
2208 | tmpstr = transpondergetfecstr(tpnode, fetype, 2); |
---|
2209 | changechoiceboxvalue(lp, tmpstr); |
---|
2210 | free(tmpstr); tmpstr = NULL; |
---|
2211 | if(tpnode != NULL) |
---|
2212 | { |
---|
2213 | tmpstr = oitoa(tpnode->polarization); |
---|
2214 | setchoiceboxselection(lp, tmpstr); |
---|
2215 | free(tmpstr); tmpstr = NULL; |
---|
2216 | } |
---|
2217 | |
---|
2218 | //bandwidth |
---|
2219 | tmpstr = transpondergetbandwidthstr(tpnode, 1); |
---|
2220 | changeinput(bandwidth, tmpstr); |
---|
2221 | free(tmpstr); tmpstr = NULL; |
---|
2222 | tmpstr = transpondergetbandwidthstr(tpnode, 2); |
---|
2223 | changechoiceboxvalue(bandwidth, tmpstr); |
---|
2224 | free(tmpstr); tmpstr = NULL; |
---|
2225 | if(tpnode != NULL) |
---|
2226 | { |
---|
2227 | tmpstr = oitoa(tpnode->symbolrate); |
---|
2228 | setchoiceboxselection(bandwidth, tmpstr); |
---|
2229 | free(tmpstr); tmpstr = NULL; |
---|
2230 | } |
---|
2231 | |
---|
2232 | //guardinterval |
---|
2233 | tmpstr = transpondergetguardintervalstr(tpnode, 1); |
---|
2234 | changeinput(guardinterval, tmpstr); |
---|
2235 | free(tmpstr); tmpstr = NULL; |
---|
2236 | tmpstr = transpondergetguardintervalstr(tpnode, 2); |
---|
2237 | changechoiceboxvalue(guardinterval, tmpstr); |
---|
2238 | free(tmpstr); tmpstr = NULL; |
---|
2239 | if(tpnode != NULL) |
---|
2240 | { |
---|
2241 | tmpstr = oitoa(tpnode->rolloff); |
---|
2242 | setchoiceboxselection(guardinterval, tmpstr); |
---|
2243 | free(tmpstr); tmpstr = NULL; |
---|
2244 | } |
---|
2245 | |
---|
2246 | //transmission |
---|
2247 | tmpstr = transpondergettransmissionstr(tpnode, 1); |
---|
2248 | changeinput(transmission, tmpstr); |
---|
2249 | free(tmpstr); tmpstr = NULL; |
---|
2250 | tmpstr = transpondergettransmissionstr(tpnode, 2); |
---|
2251 | changechoiceboxvalue(transmission, tmpstr); |
---|
2252 | free(tmpstr); tmpstr = NULL; |
---|
2253 | if(tpnode != NULL) |
---|
2254 | { |
---|
2255 | tmpstr = oitoa(tpnode->pilot); |
---|
2256 | setchoiceboxselection(transmission, tmpstr); |
---|
2257 | free(tmpstr); tmpstr = NULL; |
---|
2258 | } |
---|
2259 | |
---|
2260 | //hierarchy |
---|
2261 | tmpstr = transpondergethierarchystr(tpnode, 1); |
---|
2262 | changeinput(hierarchy, tmpstr); |
---|
2263 | free(tmpstr); tmpstr = NULL; |
---|
2264 | tmpstr = transpondergethierarchystr(tpnode, 2); |
---|
2265 | changechoiceboxvalue(hierarchy, tmpstr); |
---|
2266 | free(tmpstr); tmpstr = NULL; |
---|
2267 | if(tpnode != NULL) |
---|
2268 | { |
---|
2269 | tmpstr = oitoa(tpnode->system); |
---|
2270 | setchoiceboxselection(hierarchy, tmpstr); |
---|
2271 | free(tmpstr); tmpstr = NULL; |
---|
2272 | } |
---|
2273 | |
---|
2274 | //networkscan |
---|
2275 | addchoicebox(networkscan, "0", _("no")); |
---|
2276 | addchoicebox(networkscan, "1", _("yes")); |
---|
2277 | |
---|
2278 | //clear |
---|
2279 | addchoicebox(clear, "0", _("no")); |
---|
2280 | addchoicebox(clear, "1", _("yes")); |
---|
2281 | |
---|
2282 | //only free |
---|
2283 | addchoicebox(onlyfree, "0", _("no")); |
---|
2284 | addchoicebox(onlyfree, "1", _("yes")); |
---|
2285 | |
---|
2286 | //blindscan |
---|
2287 | addchoicebox(blindscan, "0", _("no")); |
---|
2288 | addchoicebox(blindscan, "1", _("yes")); |
---|
2289 | |
---|
2290 | //changename |
---|
2291 | addchoicebox(changename, "1", _("yes")); |
---|
2292 | addchoicebox(changename, "0", _("no")); |
---|
2293 | |
---|
2294 | //favtype |
---|
2295 | addchoicebox(favtype, "0", _("Unchanged")); |
---|
2296 | addchoicebox(favtype, "1", _("Create new")); |
---|
2297 | addchoicebox(favtype, "2", _("Delete All")); |
---|
2298 | |
---|
2299 | //emptybouquet |
---|
2300 | addchoicebox(emptybouquet, "0", _("no")); |
---|
2301 | addchoicebox(emptybouquet, "1", _("yes")); |
---|
2302 | |
---|
2303 | //unusedbouquetchannels |
---|
2304 | addchoicebox(unusedbouquetchannels, "0", _("no")); |
---|
2305 | addchoicebox(unusedbouquetchannels, "1", _("yes")); |
---|
2306 | |
---|
2307 | //unusedsats |
---|
2308 | addchoicebox(unusedsats, "0", _("no")); |
---|
2309 | addchoicebox(unusedsats, "1", _("yes")); |
---|
2310 | |
---|
2311 | //unusedtransponder |
---|
2312 | addchoicebox(unusedtransponder, "0", _("no")); |
---|
2313 | addchoicebox(unusedtransponder, "1", _("yes")); |
---|
2314 | |
---|
2315 | //unusedchannels |
---|
2316 | addchoicebox(unusedchannels, "0", _("no")); |
---|
2317 | addchoicebox(unusedchannels, "1", _("yes")); |
---|
2318 | |
---|
2319 | //unusedprovider |
---|
2320 | addchoicebox(unusedprovider, "0", _("no")); |
---|
2321 | addchoicebox(unusedprovider, "1", _("yes")); |
---|
2322 | |
---|
2323 | |
---|
2324 | drawscreen(scan, 2, 0); |
---|
2325 | changescantype(scantype->ret, scan, listbox, tuner, sat, id, system, frequency, inversion, symbolrate, polarization, fec, modulation, rolloff, pilot, hp, lp, bandwidth, transmission, guardinterval, hierarchy, b4, b5, flag); |
---|
2326 | drawscreen(scan, 0, 0); |
---|
2327 | addscreenrc(scan, listbox); |
---|
2328 | |
---|
2329 | tmp = listbox->select; |
---|
2330 | while(1) |
---|
2331 | { |
---|
2332 | addscreenrc(scan, tmp); |
---|
2333 | |
---|
2334 | if(clear->ret != NULL && ostrcmp(clear->ret, "1") == 0) |
---|
2335 | { |
---|
2336 | emptybouquet->hidden = NO; |
---|
2337 | unusedbouquetchannels->hidden = NO; |
---|
2338 | unusedsats->hidden = NO; |
---|
2339 | unusedtransponder->hidden = NO; |
---|
2340 | unusedchannels->hidden = NO; |
---|
2341 | unusedprovider->hidden = NO; |
---|
2342 | } |
---|
2343 | else |
---|
2344 | { |
---|
2345 | emptybouquet->hidden = YES; |
---|
2346 | unusedbouquetchannels->hidden = YES; |
---|
2347 | unusedsats->hidden = YES; |
---|
2348 | unusedtransponder->hidden = YES; |
---|
2349 | unusedchannels->hidden = YES; |
---|
2350 | unusedprovider->hidden = YES; |
---|
2351 | } |
---|
2352 | drawscreen(scan, 0, 0); |
---|
2353 | |
---|
2354 | rcret = waitrc(scan, 0, 0); |
---|
2355 | tmp = listbox->select; |
---|
2356 | |
---|
2357 | if(scantype->ret != NULL) iscantype = atoi(scantype->ret); |
---|
2358 | if(sat->ret != NULL) isat = atoi(sat->ret); |
---|
2359 | if(system->ret != NULL) isystem = atoi(system->ret); |
---|
2360 | if(frequency->ret != NULL) ifrequency = atoi(frequency->ret) * 1000; |
---|
2361 | if(inversion->ret != NULL) iinversion = atoi(inversion->ret); |
---|
2362 | if(symbolrate->ret != NULL) isymbolrate = atoi(symbolrate->ret) * 1000; |
---|
2363 | if(polarization->ret != NULL) ipolarization = atoi(polarization->ret); |
---|
2364 | if(fec->ret != NULL) ifec = atoi(fec->ret); |
---|
2365 | if(modulation->ret != NULL) imodulation = atoi(modulation->ret); |
---|
2366 | if(rolloff->ret != NULL) irolloff = atoi(rolloff->ret); |
---|
2367 | if(pilot->ret != NULL) ipilot = atoi(pilot->ret); |
---|
2368 | |
---|
2369 | if(flag == 3) |
---|
2370 | { |
---|
2371 | if(hp->ret != NULL) ifec = atoi(hp->ret); |
---|
2372 | if(lp->ret != NULL) ipolarization = atoi(lp->ret); |
---|
2373 | if(bandwidth->ret != NULL) isymbolrate = atoi(bandwidth->ret); |
---|
2374 | if(transmission->ret != NULL) ipilot = atoi(transmission->ret); |
---|
2375 | if(guardinterval->ret != NULL) irolloff = atoi(guardinterval->ret); |
---|
2376 | if(hierarchy->ret != NULL) isystem = atoi(hierarchy->ret); |
---|
2377 | } |
---|
2378 | |
---|
2379 | if(networkscan->ret != NULL) inetworkscan = atoi(networkscan->ret); |
---|
2380 | if(onlyfree->ret != NULL) ionlyfree = atoi(onlyfree->ret); |
---|
2381 | if(clear->ret != NULL) iclear = atoi(clear->ret); |
---|
2382 | if(blindscan->ret != NULL) iblindscan = atoi(blindscan->ret); |
---|
2383 | if(changename->ret != NULL) ichangename = atoi(changename->ret); |
---|
2384 | if(favtype->ret != NULL) ifavtype = atoi(favtype->ret); |
---|
2385 | if(emptybouquet->ret != NULL) iemptybouquet = atoi(emptybouquet->ret); |
---|
2386 | if(unusedbouquetchannels->ret != NULL) iunusedbouquetchannels = atoi(unusedbouquetchannels->ret); |
---|
2387 | if(unusedsats->ret != NULL) iunusedsats = atoi(unusedsats->ret); |
---|
2388 | if(unusedtransponder->ret != NULL) iunusedtransponder = atoi(unusedtransponder->ret); |
---|
2389 | if(unusedchannels->ret != NULL) iunusedchannels = atoi(unusedchannels->ret); |
---|
2390 | if(unusedprovider->ret != NULL) iunusedprovider = atoi(unusedprovider->ret); |
---|
2391 | |
---|
2392 | if(rcret == getrcconfigint("rcexit", NULL)) break; |
---|
2393 | if(rcret == getrcconfigint("rcok", NULL)) break; |
---|
2394 | if(listbox->select != NULL && ostrcmp(listbox->select->name, "tuner") == 0) |
---|
2395 | { |
---|
2396 | scanchangesat(sat, tpnode, listbox->select->ret); |
---|
2397 | changescantype(scantype->ret, scan, listbox, tuner, sat, id, system, frequency, inversion, symbolrate, polarization, fec, modulation, rolloff, pilot, hp, lp, bandwidth, transmission, guardinterval, hierarchy, b4, b5, flag); |
---|
2398 | drawscreen(scan, 0, 0); |
---|
2399 | } |
---|
2400 | if(listbox->select != NULL && ostrcmp(listbox->select->name, "scantype") == 0) |
---|
2401 | { |
---|
2402 | changescantype(scantype->ret, scan, listbox, tuner, sat, id, system, frequency, inversion, symbolrate, polarization, fec, modulation, rolloff, pilot, hp, lp, bandwidth, transmission, guardinterval, hierarchy, b4, b5, flag); |
---|
2403 | drawscreen(scan, 0, 0); |
---|
2404 | } |
---|
2405 | if(listbox->select != NULL && ostrcmp(listbox->select->name, "system") == 0) |
---|
2406 | { |
---|
2407 | changescantype(scantype->ret, scan, listbox, tuner, sat, id, system, frequency, inversion, symbolrate, polarization, fec, modulation, rolloff, pilot, hp, lp, bandwidth, transmission, guardinterval, hierarchy, b4, b5, flag); |
---|
2408 | drawscreen(scan, 0, 0); |
---|
2409 | } |
---|
2410 | if(rcret == getrcconfigint("rcred", NULL)) |
---|
2411 | { |
---|
2412 | clearscreen(scan); |
---|
2413 | screenscan(tpnode, scan->child, tuner->ret, iscantype, isat, ifrequency, iinversion, isymbolrate, ipolarization, ifec, imodulation, irolloff, ipilot, inetworkscan, ionlyfree, iclear, iblindscan, ichangename, isystem, ifavtype, iemptybouquet, iunusedbouquetchannels, iunusedsats, iunusedtransponder, iunusedchannels, iunusedprovider, 5000000, flag); |
---|
2414 | drawscreen(scan, 0, 0); |
---|
2415 | } |
---|
2416 | if(rcret == getrcconfigint("rcgreen", NULL) && tpnode != NULL && iscantype == 0) |
---|
2417 | { |
---|
2418 | struct transponder* tp1 = createtransponder(99, tpnode->fetype, isat, ifrequency, iinversion, isymbolrate, ipolarization, ifec, imodulation, irolloff, ipilot, isystem); |
---|
2419 | copytransponder(tp1, tpnode, 99); |
---|
2420 | deltransponderbyid(99); |
---|
2421 | textbox(_("Message"), _("Transponder changed"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 5, 0); |
---|
2422 | drawscreen(scan, 0, 0); |
---|
2423 | } |
---|
2424 | if(rcret == getrcconfigint("rcyellow", NULL) && iscantype == 0) |
---|
2425 | { |
---|
2426 | struct transponder* tp = tpchoicescreen(isat, flag); |
---|
2427 | if(tp != NULL) |
---|
2428 | { |
---|
2429 | tpnode = tp; |
---|
2430 | goto start; |
---|
2431 | } |
---|
2432 | else |
---|
2433 | drawscreen(scan, 0, 0); |
---|
2434 | } |
---|
2435 | else if(rcret == getrcconfigint("rcok", NULL)) |
---|
2436 | break; |
---|
2437 | } |
---|
2438 | |
---|
2439 | delmarkedscreennodes(scan, 1); |
---|
2440 | delownerrc(scan); |
---|
2441 | clearscreen(scan); |
---|
2442 | resetsatscan(); |
---|
2443 | |
---|
2444 | if(status.lastservice->channel == NULL) |
---|
2445 | { |
---|
2446 | if(getchannel(getconfigint("serviceid", NULL), getconfigllu("transponderid", NULL)) != NULL) |
---|
2447 | { |
---|
2448 | if(status.servicetype == 0) |
---|
2449 | servicecheckret(servicestart(getchannel(getconfigint("serviceid", NULL), getconfigllu("transponderid", NULL)), getconfig("channellist", NULL), NULL, 0), 0); |
---|
2450 | else |
---|
2451 | servicecheckret(servicestart(getchannel(getconfigint("rserviceid", NULL), getconfigllu("rtransponderid", NULL)), getconfig("rchannellist", NULL), NULL, 0), 0); |
---|
2452 | } |
---|
2453 | } |
---|
2454 | else |
---|
2455 | { |
---|
2456 | tmpstr = ostrcat(status.lastservice->channellist, NULL, 0, 0); |
---|
2457 | servicecheckret(servicestart(status.lastservice->channel, tmpstr, NULL, 0), 0); |
---|
2458 | free(tmpstr); tmpstr = NULL; |
---|
2459 | } |
---|
2460 | |
---|
2461 | //recalc channels |
---|
2462 | struct channel* chnode = channel; |
---|
2463 | while(chnode != NULL) |
---|
2464 | { |
---|
2465 | if(chnode->servicetype != 99) |
---|
2466 | { |
---|
2467 | chnode->transponder = gettransponder(chnode->transponderid); |
---|
2468 | chnode->provider = getprovider(chnode->providerid); |
---|
2469 | } |
---|
2470 | chnode = chnode->next; |
---|
2471 | } |
---|
2472 | |
---|
2473 | writeallconfig(1); |
---|
2474 | } |
---|
2475 | |
---|
2476 | #endif |
---|