generic show/hide support for GUIComponents
[enigma2.git] / lib / dvb / sec.cpp
1 #include <lib/dvb/dvb.h>
2 #include <lib/dvb/sec.h>
3 #include <lib/dvb/rotor_calc.h>
4
5 #if HAVE_DVB_API_VERSION < 3
6 #define INVERSION Inversion
7 #define FREQUENCY Frequency
8 #define FEC_INNER FEC_inner
9 #define SYMBOLRATE SymbolRate
10 #else
11 #define INVERSION inversion
12 #define FREQUENCY frequency
13 #define FEC_INNER fec_inner
14 #define SYMBOLRATE symbol_rate
15 #endif
16 #include <lib/base/eerror.h>
17
18 DEFINE_REF(eDVBSatelliteEquipmentControl);
19
20 eDVBSatelliteEquipmentControl *eDVBSatelliteEquipmentControl::instance;
21
22 eDVBSatelliteEquipmentControl::eDVBSatelliteEquipmentControl(eSmartPtrList<eDVBRegisteredFrontend> &avail_frontends)
23         :m_lnbidx(-1), m_curSat(m_lnbs[0].m_satellites.end()), m_avail_frontends(avail_frontends), m_rotorMoving(false)
24 {
25         if (!instance)
26                 instance = this;
27
28         clear();
29
30 // ASTRA
31         addLNB();
32         setLNBTunerMask(3);
33         setLNBLOFL(9750000);
34         setLNBThreshold(11750000);
35         setLNBLOFH(10607000);
36         setDiSEqCMode(eDVBSatelliteDiseqcParameters::V1_0);
37         setToneburst(eDVBSatelliteDiseqcParameters::NO);
38         setRepeats(0);
39         setCommittedCommand(eDVBSatelliteDiseqcParameters::BB);
40         setCommandOrder(0); // committed, toneburst
41         setFastDiSEqC(true);
42         setSeqRepeat(false);
43         addSatellite(192);
44         setVoltageMode(eDVBSatelliteSwitchParameters::HV);
45         setToneMode(eDVBSatelliteSwitchParameters::HILO);
46
47 // Hotbird
48         addLNB();
49         setLNBTunerMask(3);
50         setLNBLOFL(9750000);
51         setLNBThreshold(11750000);
52         setLNBLOFH(10600000);
53         setDiSEqCMode(eDVBSatelliteDiseqcParameters::V1_0);
54         setToneburst(eDVBSatelliteDiseqcParameters::NO);
55         setRepeats(0);
56         setCommittedCommand(eDVBSatelliteDiseqcParameters::AB);
57         setCommandOrder(0); // committed, toneburst
58         setFastDiSEqC(true);
59         setSeqRepeat(false);
60         addSatellite(130);
61         setVoltageMode(eDVBSatelliteSwitchParameters::HV);
62         setToneMode(eDVBSatelliteSwitchParameters::HILO);
63
64 // Rotor
65         addLNB();
66         setLNBTunerMask(3);
67         setLNBLOFL(9750000);
68         setLNBThreshold(11750000);
69         setLNBLOFH(10600000);
70         setDiSEqCMode(eDVBSatelliteDiseqcParameters::V1_2);
71         setToneburst(eDVBSatelliteDiseqcParameters::NO);
72         setRepeats(0);
73         setCommittedCommand(eDVBSatelliteDiseqcParameters::AA);
74         setCommandOrder(0); // committed, toneburst
75         setFastDiSEqC(true);
76         setSeqRepeat(false);
77         setLaDirection(eDVBSatelliteRotorParameters::NORTH);
78         setLoDirection(eDVBSatelliteRotorParameters::EAST);
79         setLatitude(51.017);
80         setLongitude(8.683);
81         setUseInputpower(true);
82         setInputpowerDelta(50);
83
84         addSatellite(235);
85         setVoltageMode(eDVBSatelliteSwitchParameters::HV);
86         setToneMode(eDVBSatelliteSwitchParameters::HILO);
87         setRotorPosNum(0);
88
89         addSatellite(284);
90         setVoltageMode(eDVBSatelliteSwitchParameters::HV);
91         setToneMode(eDVBSatelliteSwitchParameters::HILO);
92         setRotorPosNum(0);
93
94         addSatellite(420);
95         setVoltageMode(eDVBSatelliteSwitchParameters::HV);
96         setToneMode(eDVBSatelliteSwitchParameters::HILO);
97         setRotorPosNum(1); // stored pos 1
98 }
99
100 int eDVBSatelliteEquipmentControl::canTune(const eDVBFrontendParametersSatellite &sat, iDVBFrontend *fe, int frontend_id )
101 {
102         int ret=0;
103
104         for (int idx=0; idx <= m_lnbidx; ++idx )
105         {
106                 eDVBSatelliteLNBParameters &lnb_param = m_lnbs[idx];
107                 if ( lnb_param.tuner_mask & frontend_id ) // lnb for correct tuner?
108                 {
109                         eDVBSatelliteDiseqcParameters &di_param = lnb_param.m_diseqc_parameters;
110
111                         std::map<int, eDVBSatelliteSwitchParameters>::iterator sit =
112                                 lnb_param.m_satellites.find(sat.orbital_position);
113                         if ( sit != lnb_param.m_satellites.end())
114                         {
115                                 int band=0,
116                                         linked_to=-1, // linked tuner
117                                         satpos_depends_to=-1,
118                                         csw = di_param.m_committed_cmd,
119                                         ucsw = di_param.m_uncommitted_cmd,
120                                         toneburst = di_param.m_toneburst_param,
121                                         curRotorPos;
122
123                                 fe->getData(6, curRotorPos);
124                                 fe->getData(7, linked_to);
125                                 fe->getData(8, satpos_depends_to);
126
127                                 if ( sat.frequency > lnb_param.m_lof_threshold )
128                                         band |= 1;
129                                 if (sat.polarisation == eDVBFrontendParametersSatellite::Polarisation::Horizontal)
130                                         band |= 2;
131
132                                 bool rotor=false;
133                                 bool diseqc=false;
134
135                                 if (di_param.m_diseqc_mode >= eDVBSatelliteDiseqcParameters::V1_0)
136                                 {
137                                         diseqc=true;
138                                         if ( di_param.m_committed_cmd < eDVBSatelliteDiseqcParameters::SENDNO )
139                                                 csw = 0xF0 | (csw << 2);
140
141                                         if (di_param.m_committed_cmd <= eDVBSatelliteDiseqcParameters::SENDNO)
142                                                 csw |= band;
143
144                                         if ( di_param.m_diseqc_mode == eDVBSatelliteDiseqcParameters::V1_2 )  // ROTOR
145                                         {
146                                                 rotor=true;
147                                                 if ( curRotorPos == sat.orbital_position )
148                                                         ret=20;  // rotor on correct orbpos = prio 20
149                                                 else
150                                                         ret=10;  // rotor must turn to correct orbpos = prio 10
151                                         }
152                                         else
153                                                 ret = 30;  // no rotor = prio 30
154                                 }
155                                 else
156                                 {
157                                         csw = band;
158                                         ret = 40;  // no diseqc = prio 40
159                                 }
160
161                                 if (linked_to != -1)  // check for linked tuners..
162                                 {
163                                         eDVBRegisteredFrontend *linked_fe = (eDVBRegisteredFrontend*) linked_to;
164                                         if (linked_fe->m_inuse)
165                                         {
166                                                 int ocsw = -1,
167                                                         oucsw = -1,
168                                                         oToneburst = -1,
169                                                         oRotorPos = -1;
170                                                 linked_fe->m_frontend->getData(0, ocsw);
171                                                 linked_fe->m_frontend->getData(1, oucsw);
172                                                 linked_fe->m_frontend->getData(2, oToneburst);
173                                                 linked_fe->m_frontend->getData(6, oRotorPos);
174 #if 0
175                                                 eDebug("compare csw %02x == lcsw %02x",
176                                                         csw, ocsw);
177                                                 if ( diseqc )
178                                                         eDebug("compare ucsw %02x == lucsw %02x\ncompare toneburst %02x == oToneburst %02x",
179                                                                 ucsw, oucsw, toneburst, oToneburst);
180                                                 if ( rotor )
181                                                         eDebug("compare pos %d == current pos %d",
182                                                                 sat.orbital_position, oRotorPos);
183 #endif
184                                                 if ( (csw != ocsw) ||
185                                                         ( diseqc && (ucsw != oucsw || toneburst != oToneburst) ) ||
186                                                         ( rotor && oRotorPos != sat.orbital_position ) )
187                                                 {
188 //                                                      eDebug("can not tune this transponder with linked tuner in use!!");
189                                                         ret=0;
190                                                 }
191 //                                              else
192 //                                                      eDebug("OK .. can tune this transponder with linked tuner in use :)");
193                                         }
194                                 }
195
196                                 if (satpos_depends_to != -1)  // check for linked tuners..
197                                 {
198                                         eDVBRegisteredFrontend *satpos_depends_to_fe = (eDVBRegisteredFrontend*) satpos_depends_to;
199                                         if ( satpos_depends_to_fe->m_inuse )
200                                         {
201                                                 int oRotorPos = -1;
202                                                 satpos_depends_to_fe->m_frontend->getData(6, oRotorPos);
203                                                 if (!rotor || oRotorPos != sat.orbital_position)
204                                                 {
205 //                                                      eDebug("can not tune this transponder ... rotor on other tuner is positioned to %d", oRotorPos);
206                                                         ret=0;
207                                                 }
208                                         }
209 //                                      else
210 //                                              eDebug("OK .. can tune this transponder satpos is correct :)");
211                                 }
212                                 if (ret)
213                                 {
214                                         static int lofs[] = { 3650000, 5150000, 9750000, 10600000 };
215                                         int lof = sat.frequency > lnb_param.m_lof_threshold ?
216                                                 lnb_param.m_lof_hi : lnb_param.m_lof_lo;
217                                         int diff = 0x7FFFFFFF;
218                                         unsigned int num_lofs = sizeof(lofs) / sizeof(int);
219                                         int used_band = -1;
220                                         for (int i=0; i < num_lofs; ++i)
221                                         {
222                                                 int lof_diff = abs(lof - lofs[i]);
223                                                 if ( lof_diff < diff )
224                                                 {
225                                                         diff = lof_diff;
226                                                         used_band = i;
227                                                 }
228                                         }
229                                         if ( used_band != -1 )
230                                         {
231                                                 if ( diff > 50000 )
232                                                 {
233                                                         eDebug("could not detect used lnb freq range .. disable range check !!!");
234                                                         used_band = -1;
235                                                 }
236                                         }
237                                         if ( used_band != -1 )
238                                         {
239                                                 int range[2];
240                                                 switch(used_band)
241                                                 {
242                                                         case 0:  // s-band
243                                                                 range[0] = 2500000;
244                                                                 range[1] = 2700000;
245                                                                 break;
246                                                         case 1:  // c-band
247                                                                 range[0] = 3400000;
248                                                                 range[1] = 4200000;
249                                                                 break;
250                                                         case 2:  // ku-band low
251                                                                 range[0] = 10700000;
252                                                                 range[1] = 11750000;
253                                                                 break;
254                                                         case 3:  // ku-band high
255                                                                 range[0] = 11750000;
256                                                                 range[1] = 12750000;
257                                                                 break;
258                                                 }
259                                                 // check frequency in range ( +/- 75Mhz )
260                                                 if ( (sat.frequency+75000) < range[0] )
261                                                         ret=0;
262                                                 if ( (sat.frequency-75000) > range[1] )
263                                                         ret=0;
264                                         }
265                                 }
266                         }
267                 }
268         }
269         return ret;
270 }
271
272 #define VOLTAGE(x) (lnb_param.m_increased_voltage ? iDVBFrontend::voltage##x##_5 : iDVBFrontend::voltage##x)
273
274 RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPARAMETERS &parm, eDVBFrontendParametersSatellite &sat, int frontend_id)
275 {
276         bool linked=false;
277         bool depend_satpos_mode=false;
278
279         for (int idx=0; idx <= m_lnbidx; ++idx )
280         {
281                 eDVBSatelliteLNBParameters &lnb_param = m_lnbs[idx];
282                 if (!(lnb_param.tuner_mask & frontend_id)) // lnb for correct tuner?
283                         continue;
284                 eDVBSatelliteDiseqcParameters &di_param = lnb_param.m_diseqc_parameters;
285                 eDVBSatelliteRotorParameters &rotor_param = lnb_param.m_rotor_parameters;
286
287                 std::map<int, eDVBSatelliteSwitchParameters>::iterator sit =
288                         lnb_param.m_satellites.find(sat.orbital_position);
289                 if ( sit != lnb_param.m_satellites.end())
290                 {
291                         eDVBSatelliteSwitchParameters &sw_param = sit->second;
292
293                         int band=0,
294                                 linked_to=-1, // linked tuner
295                                 satpos_depends_to=-1,
296                                 voltage = iDVBFrontend::voltageOff,
297                                 tone = iDVBFrontend::toneOff,
298                                 csw = di_param.m_committed_cmd,
299                                 ucsw = di_param.m_uncommitted_cmd,
300                                 toneburst = di_param.m_toneburst_param,
301                                 lastcsw = -1,
302                                 lastucsw = -1,
303                                 lastToneburst = -1,
304                                 lastRotorCmd = -1,
305                                 curRotorPos = -1;
306
307                         frontend.getData(0, lastcsw);
308                         frontend.getData(1, lastucsw);
309                         frontend.getData(2, lastToneburst);
310                         frontend.getData(5, lastRotorCmd);
311                         frontend.getData(6, curRotorPos);
312                         frontend.getData(7, linked_to);
313                         frontend.getData(8, satpos_depends_to);
314
315                         if (linked_to != -1)
316                         {
317                                 eDVBRegisteredFrontend *linked_fe = (eDVBRegisteredFrontend*) linked_to;
318                                 if (linked_fe->m_inuse)
319                                 {
320                                         eDebug("[SEC] frontend is linked with another and the other one is in use.. so we dont do SEC!!");
321                                         linked=true;
322                                 }
323                         }
324
325                         if (satpos_depends_to != -1)
326                         {
327                                 eDVBRegisteredFrontend *satpos_fe = (eDVBRegisteredFrontend*) satpos_depends_to;
328                                 if (satpos_fe->m_inuse)
329                                 {
330                                         if ( di_param.m_diseqc_mode != eDVBSatelliteDiseqcParameters::V1_2 )
331                                                 continue;
332                                         eDebug("[SEC] frontend is depending on satpos of other one.. so we dont turn rotor!!");
333                                         depend_satpos_mode=true;
334                                 }
335                         }
336
337                         if ( sat.frequency > lnb_param.m_lof_threshold )
338                                 band |= 1;
339
340                         if (band&1)
341                                 parm.FREQUENCY = sat.frequency - lnb_param.m_lof_hi;
342                         else
343                                 parm.FREQUENCY = sat.frequency - lnb_param.m_lof_lo;
344
345                         parm.FREQUENCY = abs(parm.FREQUENCY);
346
347                         if (sat.polarisation == eDVBFrontendParametersSatellite::Polarisation::Horizontal)
348                                 band |= 2;
349
350                         switch (sat.inversion)
351                         {
352                                 case eDVBFrontendParametersCable::Inversion::On:
353                                         parm.INVERSION = INVERSION_ON;
354                                         break;
355                                 case eDVBFrontendParametersCable::Inversion::Off:
356                                         parm.INVERSION = INVERSION_OFF;
357                                         break;
358                                 default:
359                                 case eDVBFrontendParametersCable::Inversion::Unknown:
360                                         parm.INVERSION = INVERSION_AUTO;
361                                         break;
362                         }
363
364                         switch (sat.fec)
365                         {
366                                 default:
367                                 case eDVBFrontendParametersSatellite::FEC::fNone:
368                                         eDebug("no fec set.. assume auto");
369                                 case eDVBFrontendParametersSatellite::FEC::fAuto:
370                                         parm.u.qpsk.FEC_INNER = FEC_AUTO;
371                                         break;
372                                 case eDVBFrontendParametersSatellite::FEC::f1_2:
373                                         parm.u.qpsk.FEC_INNER = FEC_1_2;
374                                         break;
375                                 case eDVBFrontendParametersSatellite::FEC::f2_3:
376                                         parm.u.qpsk.FEC_INNER = FEC_2_3;
377                                         break;
378                                 case eDVBFrontendParametersSatellite::FEC::f3_4:
379                                         parm.u.qpsk.FEC_INNER = FEC_3_4;
380                                         break;
381                                 case eDVBFrontendParametersSatellite::FEC::f5_6:
382                                         parm.u.qpsk.FEC_INNER = FEC_5_6;
383                                         break;
384                                 case eDVBFrontendParametersSatellite::FEC::f7_8: 
385                                         parm.u.qpsk.FEC_INNER = FEC_7_8;
386                                         break;
387                         }
388
389                         parm.u.qpsk.SYMBOLRATE = sat.symbol_rate;
390
391                         if ( sw_param.m_voltage_mode == eDVBSatelliteSwitchParameters::_14V
392                                 || ( sat.polarisation == eDVBFrontendParametersSatellite::Polarisation::Vertical
393                                         && sw_param.m_voltage_mode == eDVBSatelliteSwitchParameters::HV )  )
394                                 voltage = VOLTAGE(13);
395                         else if ( sw_param.m_voltage_mode == eDVBSatelliteSwitchParameters::_18V
396                                 || ( sat.polarisation == eDVBFrontendParametersSatellite::Polarisation::Horizontal
397                                         && sw_param.m_voltage_mode == eDVBSatelliteSwitchParameters::HV )  )
398                                 voltage = VOLTAGE(18);
399                         if ( (sw_param.m_22khz_signal == eDVBSatelliteSwitchParameters::ON)
400                                 || ( sw_param.m_22khz_signal == eDVBSatelliteSwitchParameters::HILO && (band&1) ) )
401                                 tone = iDVBFrontend::toneOn;
402                         else if ( (sw_param.m_22khz_signal == eDVBSatelliteSwitchParameters::OFF)
403                                 || ( sw_param.m_22khz_signal == eDVBSatelliteSwitchParameters::HILO && !(band&1) ) )
404                                 tone = iDVBFrontend::toneOff;
405
406                         eSecCommandList sec_sequence;
407
408                         if (di_param.m_diseqc_mode >= eDVBSatelliteDiseqcParameters::V1_0)
409                         {
410                                 if ( di_param.m_committed_cmd < eDVBSatelliteDiseqcParameters::SENDNO )
411                                         csw = 0xF0 | (csw << 2);
412
413                                 if (di_param.m_committed_cmd <= eDVBSatelliteDiseqcParameters::SENDNO)
414                                         csw |= band;
415
416                                 bool send_csw =
417                                         (di_param.m_committed_cmd != eDVBSatelliteDiseqcParameters::SENDNO);
418                                 bool changed_csw = send_csw && csw != lastcsw;
419
420                                 bool send_ucsw =
421                                         (di_param.m_uncommitted_cmd && di_param.m_diseqc_mode > eDVBSatelliteDiseqcParameters::V1_0);
422                                 bool changed_ucsw = send_ucsw && ucsw != lastucsw;
423
424                                 bool send_burst =
425                                         (di_param.m_toneburst_param != eDVBSatelliteDiseqcParameters::NO);
426                                 bool changed_burst = send_burst && toneburst != lastToneburst;
427
428                                 int send_mask = 0; /*
429                                         1 must send csw
430                                         2 must send ucsw
431                                         4 send toneburst first
432                                         8 send toneburst at end */
433                                 if (changed_burst) // toneburst first and toneburst changed
434                                 {
435                                         if (di_param.m_command_order&1)
436                                         {
437                                                 send_mask |= 4;
438                                                 if ( send_csw )
439                                                         send_mask |= 1;
440                                                 if ( send_ucsw )
441                                                         send_mask |= 2;
442                                         }
443                                         else
444                                                 send_mask |= 8;
445                                 }
446                                 if (changed_ucsw)
447                                 {
448                                         send_mask |= 2;
449                                         if ((di_param.m_command_order&4) && send_csw)
450                                                 send_mask |= 1;
451                                         if (di_param.m_command_order==4 && send_burst)
452                                                 send_mask |= 8;
453                                 }
454                                 if (changed_csw) 
455                                 {
456                                         if ( di_param.m_use_fast
457                                                 && di_param.m_committed_cmd < eDVBSatelliteDiseqcParameters::SENDNO
458                                                 && (lastcsw & 0xF0)
459                                                 && ((csw / 4) == (lastcsw / 4)) )
460                                                 eDebug("dont send committed cmd (fast diseqc)");
461                                         else
462                                         {
463                                                 send_mask |= 1;
464                                                 if (!(di_param.m_command_order&4) && send_ucsw)
465                                                         send_mask |= 2;
466                                                 if (!(di_param.m_command_order&1) && send_burst)
467                                                         send_mask |= 8;
468                                         }
469                                 }
470
471 #if 0
472                                 eDebugNoNewLine("sendmask: ");
473                                 for (int i=3; i >= 0; --i)
474                                         if ( send_mask & (1<<i) )
475                                                 eDebugNoNewLine("1");
476                                         else
477                                                 eDebugNoNewLine("0");
478                                 eDebug("");
479 #endif
480
481                                 int RotorCmd=-1;
482                                 bool useGotoXX = false;
483                                 if ( di_param.m_diseqc_mode == eDVBSatelliteDiseqcParameters::V1_2 )
484                                 {
485                                         if (depend_satpos_mode || linked)
486                                                 // in this both modes we dont really turn the rotor.... but in canTune we need the satpos
487                                                 frontend.setData(6, sat.orbital_position);
488                                         else
489                                         {
490                                                 if (sw_param.m_rotorPosNum) // we have stored rotor pos?
491                                                         RotorCmd=sw_param.m_rotorPosNum;
492                                                 else  // we must calc gotoxx cmd
493                                                 {
494                                                         eDebug("Entry for %d,%d? not in Rotor Table found... i try gotoXX?", sat.orbital_position / 10, sat.orbital_position % 10 );
495                                                         useGotoXX = true;
496
497                                                         double  SatLon = abs(sat.orbital_position)/10.00,
498                                                                         SiteLat = rotor_param.m_gotoxx_parameters.m_latitude,
499                                                                         SiteLon = rotor_param.m_gotoxx_parameters.m_longitude;
500
501                                                         if ( rotor_param.m_gotoxx_parameters.m_la_direction == eDVBSatelliteRotorParameters::SOUTH )
502                                                                 SiteLat = -SiteLat;
503
504                                                         if ( rotor_param.m_gotoxx_parameters.m_lo_direction == eDVBSatelliteRotorParameters::WEST )
505                                                                 SiteLon = 360 - SiteLon;
506
507                                                         eDebug("siteLatitude = %lf, siteLongitude = %lf, %lf degrees", SiteLat, SiteLon, SatLon );
508                                                         double satHourAngle =
509                                                                 calcSatHourangle( SatLon, SiteLat, SiteLon );
510                                                         eDebug("PolarmountHourAngle=%lf", satHourAngle );
511
512                                                         static int gotoXTable[10] =
513                                                                 { 0x00, 0x02, 0x03, 0x05, 0x06, 0x08, 0x0A, 0x0B, 0x0D, 0x0E };
514
515                                                         if (SiteLat >= 0) // Northern Hemisphere
516                                                         {
517                                                                 int tmp=(int)round( fabs( 180 - satHourAngle ) * 10.0 );
518                                                                 RotorCmd = (tmp/10)*0x10 + gotoXTable[ tmp % 10 ];
519
520                                                                 if (satHourAngle < 180) // the east
521                                                                         RotorCmd |= 0xE000;
522                                                                 else                                    // west
523                                                                         RotorCmd |= 0xD000;
524                                                         }
525                                                         else // Southern Hemisphere
526                                                         {
527                                                                 if (satHourAngle < 180) // the east
528                                                                 {
529                                                                         int tmp=(int)round( fabs( satHourAngle ) * 10.0 );
530                                                                         RotorCmd = (tmp/10)*0x10 + gotoXTable[ tmp % 10 ];
531                                                                         RotorCmd |= 0xD000;
532                                                                 }
533                                                                 else                                    // west
534                                                                 {
535                                                                         int tmp=(int)round( fabs( 360 - satHourAngle ) * 10.0 );
536                                                                         RotorCmd = (tmp/10)*0x10 + gotoXTable[ tmp % 10 ];
537                                                                         RotorCmd |= 0xE000;
538                                                                 }
539                                                         }
540                                                         eDebug("RotorCmd = %04x", RotorCmd);
541                                                 }
542                                         }
543                                 }
544
545                                 if ( send_mask )
546                                 {
547                                         sec_sequence.push_back( eSecCommand(eSecCommand::SET_TONE, iDVBFrontend::toneOff) );
548                                         sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 15) );
549                                         eSecCommand::pair compare;
550                                         compare.voltage = iDVBFrontend::voltageOff;
551                                         compare.steps = +4;
552                                         // the next is a check if voltage is switched off.. then we first set a voltage :)
553                                         // else we set voltage after all diseqc stuff..
554                                         sec_sequence.push_back( eSecCommand(eSecCommand::IF_NOT_VOLTAGE_GOTO, compare) );
555
556                                         if ( RotorCmd != -1 && RotorCmd != lastRotorCmd )
557                                                 // TODO .. add handling for turning rotor without measure inputpower
558                                                 compare.voltage = VOLTAGE(18);
559                                         else
560                                                 compare.voltage = voltage;
561
562                                         // voltage already correct ?
563                                         sec_sequence.push_back( eSecCommand(eSecCommand::IF_VOLTAGE_GOTO, compare) );
564                                         compare.steps = +3;
565                                         sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, compare.voltage) );
566                                         // voltage was disabled..so we wait a longer time .. for normal switches 200ms should be enough
567                                         sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 200) );
568
569                                         for (int seq_repeat = 0; seq_repeat < (di_param.m_seq_repeat?2:1); ++seq_repeat)
570                                         {
571                                                 if ( send_mask & 4 )
572                                                 {
573                                                         sec_sequence.push_back( eSecCommand(eSecCommand::SEND_TONEBURST, di_param.m_toneburst_param) );
574                                                         sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) );
575                                                 }
576
577                                                 int loops=0;
578
579                                                 if ( send_mask & 1 )
580                                                         ++loops;
581                                                 if ( send_mask & 2 )
582                                                         ++loops;
583
584                                                 for ( int i=0; i < di_param.m_repeats; ++i )
585                                                 loops *= 2;
586
587                                                 for ( int i = 0; i < loops;)  // fill commands...
588                                                 {
589                                                         eDVBDiseqcCommand diseqc;
590                                                         diseqc.len = 4;
591                                                         diseqc.data[0] = i ? 0xE1 : 0xE0;
592                                                         diseqc.data[1] = 0x10;
593                                                         if ( (send_mask & 2) && (di_param.m_command_order & 4) )
594                                                         {
595                                                                 diseqc.data[2] = 0x39;
596                                                                 diseqc.data[3] = ucsw;
597                                                         }
598                                                         else if ( send_mask & 1 )
599                                                         {
600                                                                 diseqc.data[2] = 0x38;
601                                                                 diseqc.data[3] = csw;
602                                                         }
603                                                         else
604                                                         {
605                                                                 diseqc.data[2] = 0x00;
606                                                                 diseqc.data[3] = 0x00;
607                                                         }
608                                                         sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) );
609
610                                                         i++;
611                                                         if ( i < loops )
612                                                         {
613                                                                 int cmd=0;
614                                                                 if (diseqc.data[2] == 0x38 && (send_mask & 2))
615                                                                         cmd=0x39;
616                                                                 else if (diseqc.data[2] == 0x39 && (send_mask & 1))
617                                                                         cmd=0x38;
618                                                                 if (cmd)
619                                                                 {
620                                                                         static int delay = (120 - 54) / 2;  // standard says 100msek between two repeated commands
621                                                                         sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, delay) );
622                                                                         diseqc.data[2]=cmd;
623                                                                         diseqc.data[3]=(cmd==0x38) ? csw : ucsw;
624                                                                         sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) );
625                                                                         ++i;
626                                                                         if ( i < loops )
627                                                                                 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, delay ) );
628                                                                         else
629                                                                                 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) );
630                                                                 }
631                                                                 else  // delay 120msek when no command is in repeat gap
632                                                                         sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 120) );
633                                                         }
634                                                         else
635                                                                 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) );
636                                                 }
637
638                                                 if ( send_mask & 8 )  // toneburst at end of sequence
639                                                 {
640                                                         sec_sequence.push_back( eSecCommand(eSecCommand::SEND_TONEBURST, di_param.m_toneburst_param) );
641                                                         sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) );
642                                                 }
643                                         }
644                                 }
645
646                                 if ( RotorCmd != -1 && RotorCmd != lastRotorCmd )
647                                 {
648                                         eSecCommand::pair compare;
649                                         compare.voltage = iDVBFrontend::voltageOff;
650                                         compare.steps = +4;
651                                         // the next is a check if voltage is switched off.. then we first set a voltage :)
652                                         // else we set voltage after all diseqc stuff..
653                                         sec_sequence.push_back( eSecCommand(eSecCommand::IF_NOT_VOLTAGE_GOTO, compare) );
654
655                                         // TODO .. add handling for turning rotor without measure inputpower
656                                         sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, VOLTAGE(18)) );
657                                         // voltage was disabled..so we wait a longer time ..
658                                         sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 500) );
659                                         sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, +7) );  // no need to send stop rotor cmd
660
661                                         if (send_mask)
662                                                 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 750) ); // wait 750ms after send switch cmd
663                                         else
664                                                 sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, +1) );
665
666                                         eDVBDiseqcCommand diseqc;
667                                         diseqc.len = 3;
668                                         diseqc.data[0] = 0xE0;
669                                         diseqc.data[1] = 0x31;  // positioner
670                                         diseqc.data[2] = 0x60;  // stop
671                                         sec_sequence.push_back( eSecCommand(eSecCommand::IF_ROTORPOS_VALID_GOTO, +5) );
672                                         sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) );
673                                         sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) );
674                                         sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) );
675                                         // wait 300msec after send rotor stop cmd
676                                         sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 300) );
677
678                                         diseqc.data[0] = 0xE0;
679                                         diseqc.data[1] = 0x31;          // positioner
680                                         if ( useGotoXX )
681                                         {
682                                                 diseqc.len = 5;
683                                                 diseqc.data[2] = 0x6E;  // drive to angular position
684                                                 diseqc.data[3] = ((RotorCmd & 0xFF00) / 0x100);
685                                                 diseqc.data[4] = RotorCmd & 0xFF;
686                                         }
687                                         else
688                                         {
689                                                 diseqc.len = 4;
690                                                 diseqc.data[2] = 0x6B;  // goto stored sat position
691                                                 diseqc.data[3] = RotorCmd;
692                                                 diseqc.data[4] = 0x00;
693                                         }
694
695                                         if ( rotor_param.m_inputpower_parameters.m_use )
696                                         { // use measure rotor input power to detect rotor state
697                                                 eSecCommand::rotor cmd;
698                                                 eSecCommand::pair compare;
699                                                 compare.voltage = VOLTAGE(18);
700                                                 compare.steps = +2;
701                                                 sec_sequence.push_back( eSecCommand(eSecCommand::IF_VOLTAGE_GOTO, compare) );
702                                                 sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, compare.voltage) );
703 // measure idle power values
704                                                 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 200) );  // wait 200msec after voltage change
705                                                 sec_sequence.push_back( eSecCommand(eSecCommand::MEASURE_IDLE_INPUTPOWER, 1) );
706                                                 compare.voltage = 1;
707                                                 compare.steps = -2;
708                                                 sec_sequence.push_back( eSecCommand(eSecCommand::IF_MEASURE_IDLE_WAS_NOT_OK_GOTO, compare) );
709                                                 sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, VOLTAGE(13)) );
710                                                 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 200) );  // wait 200msec before measure
711                                                 sec_sequence.push_back( eSecCommand(eSecCommand::MEASURE_IDLE_INPUTPOWER, 0) );
712                                                 compare.voltage = 0;
713                                                 sec_sequence.push_back( eSecCommand(eSecCommand::IF_MEASURE_IDLE_WAS_NOT_OK_GOTO, compare) );
714 ////////////////////////////
715                                                 sec_sequence.push_back( eSecCommand(eSecCommand::SET_POWER_LIMITING_MODE, eSecCommand::modeStatic) );
716                                                 sec_sequence.push_back( eSecCommand(eSecCommand::SET_ROTOR_DISEQC_RETRYS, 2) );  // 2 retries
717                                                 sec_sequence.push_back( eSecCommand(eSecCommand::INVALIDATE_CURRENT_ROTORPARMS) );
718                                                 sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) );
719                                                 sec_sequence.push_back( eSecCommand(eSecCommand::SET_TIMEOUT, 40) );  // 2 seconds rotor start timout
720 // rotor start loop
721                                                 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) );  // 50msec delay
722                                                 sec_sequence.push_back( eSecCommand(eSecCommand::MEASURE_RUNNING_INPUTPOWER) );
723                                                 cmd.direction=1;  // check for running rotor
724                                                 cmd.deltaA=rotor_param.m_inputpower_parameters.m_delta;
725                                                 cmd.steps=+5;
726                                                 cmd.okcount=0;
727                                                 sec_sequence.push_back( eSecCommand(eSecCommand::IF_INPUTPOWER_DELTA_GOTO, cmd ) );  // check if rotor has started
728                                                 sec_sequence.push_back( eSecCommand(eSecCommand::IF_TIMEOUT_GOTO, +2 ) );  // timeout .. we assume now the rotor is already at the correct position
729                                                 sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, -4) );  // goto loop start
730                                                 sec_sequence.push_back( eSecCommand(eSecCommand::IF_NO_MORE_ROTOR_DISEQC_RETRYS_GOTO, +9 ) );  // timeout .. we assume now the rotor is already at the correct position
731                                                 sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, -8) );  // goto loop start
732 ////////////////////
733                                                 sec_sequence.push_back( eSecCommand(eSecCommand::SET_TIMEOUT, 2400) );  // 2 minutes running timeout
734                                                 sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, VOLTAGE(18)) );
735 // rotor running loop
736                                                 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) );  // wait 50msec
737                                                 sec_sequence.push_back( eSecCommand(eSecCommand::MEASURE_RUNNING_INPUTPOWER) );
738                                                 cmd.direction=0;  // check for stopped rotor
739                                                 cmd.steps=+3;
740                                                 sec_sequence.push_back( eSecCommand(eSecCommand::IF_INPUTPOWER_DELTA_GOTO, cmd ) );
741                                                 sec_sequence.push_back( eSecCommand(eSecCommand::IF_TIMEOUT_GOTO, +3 ) );  // timeout ? this should never happen
742                                                 sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, -4) );  // running loop start
743 /////////////////////
744                                                 sec_sequence.push_back( eSecCommand(eSecCommand::UPDATE_CURRENT_ROTORPARAMS) );
745                                                 sec_sequence.push_back( eSecCommand(eSecCommand::SET_POWER_LIMITING_MODE, eSecCommand::modeDynamic) );
746                                                 frontend.setData(3, RotorCmd);
747                                                 frontend.setData(4, sat.orbital_position);
748                                         }
749                                         else
750                                                 eFatal("rotor turning without inputpowermeasure not implemented yet");
751                                 }
752                         }
753                         else
754                                 csw = band;
755
756                         frontend.setData(0, csw);
757                         frontend.setData(1, ucsw);
758                         frontend.setData(2, di_param.m_toneburst_param);
759
760                         if ( linked )
761                                 return 0;
762
763                         eSecCommand::pair compare;
764                         compare.voltage = voltage;
765                         compare.steps = +3;
766                         sec_sequence.push_back( eSecCommand(eSecCommand::IF_VOLTAGE_GOTO, compare) ); // voltage already correct ?
767                         sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, voltage) );
768                         sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 10) );
769
770                         sec_sequence.push_back( eSecCommand(eSecCommand::SET_TONE, tone) );
771                         sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 15) );
772
773                         frontend.setSecSequence(sec_sequence);
774
775                         return 0;
776                 }
777         }
778
779         eDebug("found no useable satellite configuration for orbital position (%d)", sat.orbital_position );
780         return -1;
781 }
782
783 RESULT eDVBSatelliteEquipmentControl::clear()
784 {
785         for (int i=0; i < m_lnbidx; ++i)
786         {
787                 m_lnbs[i].m_satellites.clear();
788                 m_lnbs[i].tuner_mask = 0;
789         }
790         m_lnbidx=-1;
791
792 // clear linked tuner configuration
793         for (eSmartPtrList<eDVBRegisteredFrontend>::iterator it(m_avail_frontends.begin()); it != m_avail_frontends.end(); ++it)
794                 it->m_frontend->setData(7, -1);
795
796         return 0;
797 }
798
799 // helper function for setTunerLinked and setTunerDepends
800 RESULT eDVBSatelliteEquipmentControl::setDependencyPointers( int tu1, int tu2, int dest_data_byte )
801 {
802         if (tu1 == tu2)
803                 return -1;
804
805         eDVBRegisteredFrontend *p1=NULL, *p2=NULL;
806
807         int cnt=0;
808         for (eSmartPtrList<eDVBRegisteredFrontend>::iterator it(m_avail_frontends.begin()); it != m_avail_frontends.end(); ++it, ++cnt)
809         {
810                 if (cnt == tu1)
811                         p1 = *it;
812                 else if (cnt == tu2)
813                         p2 = *it;
814         }
815         if (p1 && p2)
816         {
817                 p1->m_frontend->setData(dest_data_byte, (int)p2);  // this is evil..
818                 p2->m_frontend->setData(dest_data_byte, (int)p1);
819                 return 0;
820         }
821         return -1;
822 }
823
824 /* LNB Specific Parameters */
825 RESULT eDVBSatelliteEquipmentControl::addLNB()
826 {
827         if ( m_lnbidx < (int)(sizeof(m_lnbs) / sizeof(eDVBSatelliteLNBParameters)))
828                 m_curSat=m_lnbs[++m_lnbidx].m_satellites.end();
829         else
830         {
831                 eDebug("no more LNB free... cnt is %d", m_lnbidx);
832                 return -ENOSPC;
833         }
834         return 0;
835 }
836
837 RESULT eDVBSatelliteEquipmentControl::setLNBTunerMask(int tunermask)
838 {
839         if ( currentLNBValid() )
840                 m_lnbs[m_lnbidx].tuner_mask = tunermask;
841         else
842                 return -ENOENT;
843         return 0;
844 }
845
846 RESULT eDVBSatelliteEquipmentControl::setLNBLOFL(int lofl)
847 {
848         if ( currentLNBValid() )
849                 m_lnbs[m_lnbidx].m_lof_lo = lofl;
850         else
851                 return -ENOENT;
852         return 0;
853 }
854
855 RESULT eDVBSatelliteEquipmentControl::setLNBLOFH(int lofh)
856 {
857         if ( currentLNBValid() )
858                 m_lnbs[m_lnbidx].m_lof_hi = lofh;
859         else
860                 return -ENOENT;
861         return 0;
862 }
863
864 RESULT eDVBSatelliteEquipmentControl::setLNBThreshold(int threshold)
865 {
866         if ( currentLNBValid() )
867                 m_lnbs[m_lnbidx].m_lof_threshold = threshold;
868         else
869                 return -ENOENT;
870         return 0;
871 }
872
873 RESULT eDVBSatelliteEquipmentControl::setLNBIncreasedVoltage(bool onoff)
874 {
875         if ( currentLNBValid() )
876                 m_lnbs[m_lnbidx].m_increased_voltage = onoff;
877         else
878                 return -ENOENT;
879         return 0;
880 }
881
882 /* DiSEqC Specific Parameters */
883 RESULT eDVBSatelliteEquipmentControl::setDiSEqCMode(int diseqcmode)
884 {
885         if ( currentLNBValid() )
886                 m_lnbs[m_lnbidx].m_diseqc_parameters.m_diseqc_mode = (eDVBSatelliteDiseqcParameters::t_diseqc_mode)diseqcmode;
887         else
888                 return -ENOENT;
889         return 0;
890 }
891
892 RESULT eDVBSatelliteEquipmentControl::setToneburst(int toneburst)
893 {
894         if ( currentLNBValid() )
895                 m_lnbs[m_lnbidx].m_diseqc_parameters.m_toneburst_param = (eDVBSatelliteDiseqcParameters::t_toneburst_param)toneburst;
896         else
897                 return -ENOENT;
898         return 0;
899 }
900
901 RESULT eDVBSatelliteEquipmentControl::setRepeats(int repeats)
902 {
903         if ( currentLNBValid() )
904                 m_lnbs[m_lnbidx].m_diseqc_parameters.m_repeats=repeats;
905         else
906                 return -ENOENT;
907         return 0;
908 }
909
910 RESULT eDVBSatelliteEquipmentControl::setCommittedCommand(int command)
911 {
912         if ( currentLNBValid() )
913                 m_lnbs[m_lnbidx].m_diseqc_parameters.m_committed_cmd=command;
914         else
915                 return -ENOENT;
916         return 0;
917 }
918
919 RESULT eDVBSatelliteEquipmentControl::setUncommittedCommand(int command)
920 {
921         if ( currentLNBValid() )
922                 m_lnbs[m_lnbidx].m_diseqc_parameters.m_uncommitted_cmd = command;
923         else
924                 return -ENOENT;
925         return 0;
926 }
927
928 RESULT eDVBSatelliteEquipmentControl::setCommandOrder(int order)
929 {
930         if ( currentLNBValid() )
931                 m_lnbs[m_lnbidx].m_diseqc_parameters.m_command_order=order;
932         else
933                 return -ENOENT;
934         return 0;
935 }
936
937 RESULT eDVBSatelliteEquipmentControl::setFastDiSEqC(bool onoff)
938 {
939         if ( currentLNBValid() )
940                 m_lnbs[m_lnbidx].m_diseqc_parameters.m_use_fast=onoff;
941         else
942                 return -ENOENT;
943         return 0;
944 }
945
946 RESULT eDVBSatelliteEquipmentControl::setSeqRepeat(bool onoff)
947 {
948         if ( currentLNBValid() )
949                 m_lnbs[m_lnbidx].m_diseqc_parameters.m_seq_repeat = onoff;
950         else
951                 return -ENOENT;
952         return 0;
953 }
954
955 /* Rotor Specific Parameters */
956 RESULT eDVBSatelliteEquipmentControl::setLongitude(float longitude)
957 {
958         if ( currentLNBValid() )
959                 m_lnbs[m_lnbidx].m_rotor_parameters.m_gotoxx_parameters.m_longitude=longitude;
960         else
961                 return -ENOENT;
962         return 0;
963 }
964
965 RESULT eDVBSatelliteEquipmentControl::setLatitude(float latitude)
966 {
967         if ( currentLNBValid() )
968                 m_lnbs[m_lnbidx].m_rotor_parameters.m_gotoxx_parameters.m_latitude=latitude;
969         else
970                 return -ENOENT;
971         return 0;
972 }
973
974 RESULT eDVBSatelliteEquipmentControl::setLoDirection(int direction)
975 {
976         if ( currentLNBValid() )
977                 m_lnbs[m_lnbidx].m_rotor_parameters.m_gotoxx_parameters.m_lo_direction=direction;
978         else
979                 return -ENOENT;
980         return 0;
981 }
982
983 RESULT eDVBSatelliteEquipmentControl::setLaDirection(int direction)
984 {
985         if ( currentLNBValid() )
986                 m_lnbs[m_lnbidx].m_rotor_parameters.m_gotoxx_parameters.m_la_direction=direction;
987         else
988                 return -ENOENT;
989         return 0;
990 }
991
992 RESULT eDVBSatelliteEquipmentControl::setUseInputpower(bool onoff)
993 {
994         if ( currentLNBValid() )
995                 m_lnbs[m_lnbidx].m_rotor_parameters.m_inputpower_parameters.m_use=onoff;
996         else
997                 return -ENOENT;
998         return 0;
999 }
1000
1001 RESULT eDVBSatelliteEquipmentControl::setInputpowerDelta(int delta)
1002 {
1003         if ( currentLNBValid() )
1004                 m_lnbs[m_lnbidx].m_rotor_parameters.m_inputpower_parameters.m_delta=delta;
1005         else
1006                 return -ENOENT;
1007         return 0;
1008 }
1009
1010 /* Satellite Specific Parameters */
1011 RESULT eDVBSatelliteEquipmentControl::addSatellite(int orbital_position)
1012 {
1013         if ( currentLNBValid() )
1014         {
1015                 std::map<int, eDVBSatelliteSwitchParameters>::iterator it =
1016                         m_lnbs[m_lnbidx].m_satellites.find(orbital_position);
1017                 if ( it == m_lnbs[m_lnbidx].m_satellites.end() )
1018                 {
1019                         std::pair<std::map<int, eDVBSatelliteSwitchParameters>::iterator, bool > ret =
1020                                 m_lnbs[m_lnbidx].m_satellites.insert(
1021                                         std::pair<int, eDVBSatelliteSwitchParameters>(orbital_position, eDVBSatelliteSwitchParameters())
1022                                 );
1023                         if ( ret.second )
1024                                 m_curSat = ret.first;
1025                         else
1026                                 return -ENOMEM;
1027                 }
1028                 else
1029                         return -EEXIST;
1030         }
1031         else
1032                 return -ENOENT;
1033         return 0;
1034 }
1035
1036 RESULT eDVBSatelliteEquipmentControl::setVoltageMode(int mode)
1037 {
1038         if ( currentLNBValid() && m_curSat != m_lnbs[m_lnbidx].m_satellites.end() )
1039                 m_curSat->second.m_voltage_mode = (eDVBSatelliteSwitchParameters::t_voltage_mode)mode;
1040         else
1041                 return -ENOENT;
1042         return 0;
1043
1044 }
1045
1046 RESULT eDVBSatelliteEquipmentControl::setToneMode(int mode)
1047 {
1048         if ( currentLNBValid() )
1049         {
1050                 if ( m_curSat != m_lnbs[m_lnbidx].m_satellites.end() )
1051                         m_curSat->second.m_22khz_signal = (eDVBSatelliteSwitchParameters::t_22khz_signal)mode;
1052                 else
1053                         return -EPERM;
1054         }
1055         else
1056                 return -ENOENT;
1057         return 0;
1058 }
1059
1060 RESULT eDVBSatelliteEquipmentControl::setRotorPosNum(int rotor_pos_num)
1061 {
1062         if ( currentLNBValid() )
1063         {
1064                 if ( m_curSat != m_lnbs[m_lnbidx].m_satellites.end() )
1065                         m_curSat->second.m_rotorPosNum=rotor_pos_num;
1066                 else
1067                         return -EPERM;
1068         }
1069         else
1070                 return -ENOENT;
1071         return 0;
1072 }
1073
1074 RESULT eDVBSatelliteEquipmentControl::setTunerLinked(int tu1, int tu2)
1075 {
1076         return setDependencyPointers(tu1, tu2, 7);
1077 }
1078
1079 RESULT eDVBSatelliteEquipmentControl::setTunerDepends(int tu1, int tu2)
1080 {
1081         return setDependencyPointers(tu1, tu2, 8);
1082 }
1083
1084 bool eDVBSatelliteEquipmentControl::isRotorMoving()
1085 {
1086         return m_rotorMoving;
1087 }
1088
1089 void eDVBSatelliteEquipmentControl::setRotorMoving(bool b)
1090 {
1091         m_rotorMoving=b;
1092 }