2 #include <lib/dvb/dvb.h>
3 #include <lib/dvb/sec.h>
4 #include <lib/dvb/rotor_calc.h>
6 #if HAVE_DVB_API_VERSION < 3
7 #define INVERSION Inversion
8 #define FREQUENCY Frequency
9 #define FEC_INNER FEC_inner
10 #define SYMBOLRATE SymbolRate
12 #define INVERSION inversion
13 #define FREQUENCY frequency
14 #define FEC_INNER fec_inner
15 #define SYMBOLRATE symbol_rate
17 #include <lib/base/eerror.h>
19 DEFINE_REF(eDVBSatelliteEquipmentControl);
21 eDVBSatelliteEquipmentControl *eDVBSatelliteEquipmentControl::instance;
23 eDVBSatelliteEquipmentControl::eDVBSatelliteEquipmentControl(eSmartPtrList<eDVBRegisteredFrontend> &avail_frontends)
24 :m_lnbidx(-1), m_curSat(m_lnbs[0].m_satellites.end()), m_avail_frontends(avail_frontends)
36 setLNBThreshold(11750000);
38 setDiSEqCMode(eDVBSatelliteDiseqcParameters::V1_0);
39 setToneburst(eDVBSatelliteDiseqcParameters::NO);
41 setCommittedCommand(eDVBSatelliteDiseqcParameters::BB);
42 setCommandOrder(0); // committed, toneburst
46 setVoltageMode(eDVBSatelliteSwitchParameters::HV);
47 setToneMode(eDVBSatelliteSwitchParameters::HILO);
53 setLNBThreshold(11750000);
55 setDiSEqCMode(eDVBSatelliteDiseqcParameters::V1_0);
56 setToneburst(eDVBSatelliteDiseqcParameters::NO);
58 setCommittedCommand(eDVBSatelliteDiseqcParameters::AB);
59 setCommandOrder(0); // committed, toneburst
63 setVoltageMode(eDVBSatelliteSwitchParameters::HV);
64 setToneMode(eDVBSatelliteSwitchParameters::HILO);
71 setLNBThreshold(11750000);
73 setDiSEqCMode(eDVBSatelliteDiseqcParameters::V1_2);
74 setToneburst(eDVBSatelliteDiseqcParameters::NO);
76 setCommittedCommand(eDVBSatelliteDiseqcParameters::AA);
77 setCommandOrder(0); // committed, toneburst
80 setLaDirection(eDVBSatelliteRotorParameters::NORTH);
81 setLoDirection(eDVBSatelliteRotorParameters::EAST);
84 setUseInputpower(true);
85 setInputpowerDelta(50);
88 setVoltageMode(eDVBSatelliteSwitchParameters::HV);
89 setToneMode(eDVBSatelliteSwitchParameters::HILO);
93 setVoltageMode(eDVBSatelliteSwitchParameters::HV);
94 setToneMode(eDVBSatelliteSwitchParameters::HILO);
98 setVoltageMode(eDVBSatelliteSwitchParameters::HV);
99 setToneMode(eDVBSatelliteSwitchParameters::HILO);
103 setVoltageMode(eDVBSatelliteSwitchParameters::HV);
104 setToneMode(eDVBSatelliteSwitchParameters::HILO);
105 setRotorPosNum(1); // stored pos 1
108 int eDVBSatelliteEquipmentControl::canTune(const eDVBFrontendParametersSatellite &sat, iDVBFrontend *fe, int frontend_id )
112 for (int idx=0; idx <= m_lnbidx; ++idx )
114 eDVBSatelliteLNBParameters &lnb_param = m_lnbs[idx];
115 if ( lnb_param.tuner_mask & frontend_id ) // lnb for correct tuner?
117 eDVBSatelliteDiseqcParameters &di_param = lnb_param.m_diseqc_parameters;
119 std::map<int, eDVBSatelliteSwitchParameters>::iterator sit =
120 lnb_param.m_satellites.find(sat.orbital_position);
121 if ( sit != lnb_param.m_satellites.end())
124 linked_to=0, // linked tuner
125 csw = di_param.m_committed_cmd,
126 ucsw = di_param.m_uncommitted_cmd,
127 toneburst = di_param.m_toneburst_param,
130 fe->getData(6, curRotorPos);
131 fe->getData(7, linked_to);
133 if ( sat.frequency > lnb_param.m_lof_threshold )
135 if (sat.polarisation == eDVBFrontendParametersSatellite::Polarisation::Horizontal)
141 if (di_param.m_diseqc_mode >= eDVBSatelliteDiseqcParameters::V1_0)
144 if ( di_param.m_committed_cmd < eDVBSatelliteDiseqcParameters::SENDNO )
146 csw = 0xF0 | (csw << 2);
150 if ( di_param.m_diseqc_mode == eDVBSatelliteDiseqcParameters::V1_2 ) // ROTOR
153 if ( curRotorPos == sat.orbital_position )
163 if (linked_to != -1) // check for linked tuners..
166 eSmartPtrList<eDVBRegisteredFrontend>::iterator it(m_avail_frontends.begin());
167 for (; it != m_avail_frontends.end(); ++it)
176 if (found && it->m_inuse)
182 it->m_frontend->getData(0, ocsw);
183 it->m_frontend->getData(1, oucsw);
184 it->m_frontend->getData(2, oToneburst);
185 it->m_frontend->getData(6, oRotorPos);
187 eDebug("compare csw %02x == lcsw %02x",
190 eDebug("compare ucsw %02x == lucsw %02x\ncompare toneburst %02x == oToneburst %02x",
191 ucsw, oucsw, toneburst, oToneburst);
193 eDebug("compare pos %d == current pos %d",
194 sat.orbital_position, oRotorPos);
196 if ( (csw != ocsw) ||
197 ( diseqc && (ucsw != oucsw || toneburst != oToneburst) ) ||
198 ( rotor && oRotorPos != sat.orbital_position ) )
200 eDebug("can not tune this transponder with linked tuner in use!!");
204 eDebug("OK .. can tune this transponder with linked tuner in use :)");
213 RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPARAMETERS &parm, eDVBFrontendParametersSatellite &sat, int frontend_id)
217 for (int idx=0; idx <= m_lnbidx; ++idx )
219 eDVBSatelliteLNBParameters &lnb_param = m_lnbs[idx];
220 if (!(lnb_param.tuner_mask & frontend_id)) // lnb for correct tuner?
222 eDVBSatelliteDiseqcParameters &di_param = lnb_param.m_diseqc_parameters;
223 eDVBSatelliteRotorParameters &rotor_param = lnb_param.m_rotor_parameters;
225 std::map<int, eDVBSatelliteSwitchParameters>::iterator sit =
226 lnb_param.m_satellites.find(sat.orbital_position);
227 if ( sit != lnb_param.m_satellites.end())
229 eDVBSatelliteSwitchParameters &sw_param = sit->second;
232 linked_to=-1, // linked tuner
233 voltage = iDVBFrontend::voltageOff,
234 tone = iDVBFrontend::toneOff,
235 csw = di_param.m_committed_cmd,
236 ucsw = di_param.m_uncommitted_cmd,
237 toneburst = di_param.m_toneburst_param,
244 frontend.getData(0, lastcsw);
245 frontend.getData(1, lastucsw);
246 frontend.getData(2, lastToneburst);
247 frontend.getData(5, lastRotorCmd);
248 frontend.getData(6, curRotorPos);
249 frontend.getData(7, linked_to);
254 eSmartPtrList<eDVBRegisteredFrontend>::iterator it(m_avail_frontends.begin());
255 for (; it != m_avail_frontends.end(); ++it)
263 if (found && it->m_inuse)
265 eDebug("[SEC] frontend is linked with another one and the other is in use.. so we dont do SEC!!");
270 if ( sat.frequency > lnb_param.m_lof_threshold )
274 parm.FREQUENCY = sat.frequency - lnb_param.m_lof_hi;
276 parm.FREQUENCY = sat.frequency - lnb_param.m_lof_lo;
278 if (sat.polarisation == eDVBFrontendParametersSatellite::Polarisation::Horizontal)
281 parm.INVERSION = (!sat.inversion) ? INVERSION_ON : INVERSION_OFF;
286 case eDVBFrontendParametersSatellite::FEC::fNone:
287 eDebug("no fec set.. assume auto");
288 case eDVBFrontendParametersSatellite::FEC::fAuto:
289 parm.u.qpsk.FEC_INNER = FEC_AUTO;
291 case eDVBFrontendParametersSatellite::FEC::f1_2:
292 parm.u.qpsk.FEC_INNER = FEC_1_2;
294 case eDVBFrontendParametersSatellite::FEC::f2_3:
295 parm.u.qpsk.FEC_INNER = FEC_2_3;
297 case eDVBFrontendParametersSatellite::FEC::f3_4:
298 parm.u.qpsk.FEC_INNER = FEC_3_4;
300 case eDVBFrontendParametersSatellite::FEC::f5_6:
301 parm.u.qpsk.FEC_INNER = FEC_5_6;
303 case eDVBFrontendParametersSatellite::FEC::f7_8:
304 parm.u.qpsk.FEC_INNER = FEC_7_8;
308 parm.u.qpsk.SYMBOLRATE = sat.symbol_rate;
310 if ( sw_param.m_voltage_mode == eDVBSatelliteSwitchParameters::_14V
311 || ( sat.polarisation == eDVBFrontendParametersSatellite::Polarisation::Vertical
312 && sw_param.m_voltage_mode == eDVBSatelliteSwitchParameters::HV ) )
313 voltage = iDVBFrontend::voltage13;
314 else if ( sw_param.m_voltage_mode == eDVBSatelliteSwitchParameters::_18V
315 || ( sat.polarisation == eDVBFrontendParametersSatellite::Polarisation::Horizontal
316 && sw_param.m_voltage_mode == eDVBSatelliteSwitchParameters::HV ) )
317 voltage = iDVBFrontend::voltage18;
319 if ( (sw_param.m_22khz_signal == eDVBSatelliteSwitchParameters::ON)
320 || ( sw_param.m_22khz_signal == eDVBSatelliteSwitchParameters::HILO && (band&1) ) )
321 tone = iDVBFrontend::toneOn;
322 else if ( (sw_param.m_22khz_signal == eDVBSatelliteSwitchParameters::OFF)
323 || ( sw_param.m_22khz_signal == eDVBSatelliteSwitchParameters::HILO && !(band&1) ) )
324 tone = iDVBFrontend::toneOff;
326 eSecCommandList sec_sequence;
328 if (di_param.m_diseqc_mode >= eDVBSatelliteDiseqcParameters::V1_0)
330 if ( di_param.m_committed_cmd < eDVBSatelliteDiseqcParameters::SENDNO )
332 csw = 0xF0 | (csw << 2);
337 (di_param.m_committed_cmd != eDVBSatelliteDiseqcParameters::SENDNO);
338 bool changed_csw = send_csw && csw != lastcsw;
341 (di_param.m_uncommitted_cmd && di_param.m_diseqc_mode > eDVBSatelliteDiseqcParameters::V1_0);
342 bool changed_ucsw = send_ucsw && ucsw != lastucsw;
345 (di_param.m_toneburst_param != eDVBSatelliteDiseqcParameters::NO);
346 bool changed_burst = send_burst && toneburst != lastToneburst;
348 bool send_diseqc = changed_ucsw;
350 send_diseqc = changed_burst && (send_ucsw || send_csw);
353 send_diseqc = changed_csw;
354 if ( send_diseqc && di_param.m_use_fast && (csw & 0xF0) && (lastcsw & 0xF0) && ((csw / 4) == (lastcsw / 4)) )
356 frontend.setData(0, csw); // needed for linked tuner handling
361 if ( send_diseqc || changed_burst )
363 sec_sequence.push_back( eSecCommand(eSecCommand::SET_TONE, iDVBFrontend::toneOff) );
364 eSecCommand::pair compare;
365 compare.voltage = voltage;
367 sec_sequence.push_back( eSecCommand(eSecCommand::IF_VOLTAGE_GOTO, compare) ); // voltage already correct ?
368 sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, voltage) );
369 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) );
372 for (int seq_repeat = 0; seq_repeat < (di_param.m_seq_repeat?2:1); ++seq_repeat)
374 if ( di_param.m_command_order & 1 && // toneburst at begin of sequence
375 changed_burst && di_param.m_toneburst_param != eDVBSatelliteDiseqcParameters::NO )
377 sec_sequence.push_back( eSecCommand(eSecCommand::SEND_TONEBURST, di_param.m_toneburst_param) );
378 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) );
390 for ( int i=0; i < di_param.m_repeats; ++i )
393 for ( int i = 0; i < loops;) // fill commands...
395 eDVBDiseqcCommand diseqc;
397 diseqc.data[0] = i ? 0xE1 : 0xE0;
398 diseqc.data[1] = 0x10;
400 if ( !send_csw || (send_ucsw && (di_param.m_command_order & 4) ) )
402 diseqc.data[2] = 0x39;
403 diseqc.data[3] = ucsw;
407 diseqc.data[2] = 0x38;
408 diseqc.data[3] = csw;
410 sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) );
416 if (diseqc.data[2] == 0x38 && send_ucsw)
418 else if (diseqc.data[2] == 0x39 && send_csw)
422 static int delay = (120 - 54) / 2; // standard says 100msek between two repeated commands
423 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, delay) );
425 diseqc.data[3]=(cmd==0x38) ? csw : ucsw;
426 sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) );
429 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, delay ) );
431 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) );
433 else // delay 120msek when no command is in repeat gap
434 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 120) );
437 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) );
439 frontend.setData(0, csw);
440 frontend.setData(1, ucsw);
441 frontend.setData(2, di_param.m_toneburst_param);
445 if ( !(di_param.m_command_order & 1) && // toneburst at end of sequence
446 (changed_burst || send_diseqc) && di_param.m_toneburst_param != eDVBSatelliteDiseqcParameters::NO )
448 sec_sequence.push_back( eSecCommand(eSecCommand::SEND_TONEBURST, di_param.m_toneburst_param) );
449 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) );
450 frontend.setData(2, di_param.m_toneburst_param);
454 if ( di_param.m_diseqc_mode == eDVBSatelliteDiseqcParameters::V1_2 )
457 bool useGotoXX = false;
459 if (sw_param.m_rotorPosNum) // we have stored rotor pos?
460 RotorCmd=sw_param.m_rotorPosNum;
461 else // we must calc gotoxx cmd
463 eDebug("Entry for %d,%d? not in Rotor Table found... i try gotoXX?", sat.orbital_position / 10, sat.orbital_position % 10 );
466 int satDir = sat.orbital_position < 0 ?
467 eDVBSatelliteRotorParameters::WEST :
468 eDVBSatelliteRotorParameters::EAST;
470 double SatLon = abs(sat.orbital_position)/10.00,
471 SiteLat = rotor_param.m_gotoxx_parameters.m_latitude,
472 SiteLon = rotor_param.m_gotoxx_parameters.m_longitude;
474 if ( rotor_param.m_gotoxx_parameters.m_la_direction == eDVBSatelliteRotorParameters::SOUTH )
477 if ( rotor_param.m_gotoxx_parameters.m_lo_direction == eDVBSatelliteRotorParameters::WEST )
478 SiteLon = 360 - SiteLon;
480 if (satDir == eDVBSatelliteRotorParameters::WEST )
481 SatLon = 360 - SatLon;
483 eDebug("siteLatitude = %lf, siteLongitude = %lf, %lf degrees", SiteLat, SiteLon, SatLon );
484 double satHourAngle =
485 calcSatHourangle( SatLon, SiteLat, SiteLon );
486 eDebug("PolarmountHourAngle=%lf", satHourAngle );
488 static int gotoXTable[10] =
489 { 0x00, 0x02, 0x03, 0x05, 0x06, 0x08, 0x0A, 0x0B, 0x0D, 0x0E };
491 if (SiteLat >= 0) // Northern Hemisphere
493 int tmp=(int)round( fabs( 180 - satHourAngle ) * 10.0 );
494 RotorCmd = (tmp/10)*0x10 + gotoXTable[ tmp % 10 ];
496 if (satHourAngle < 180) // the east
501 else // Southern Hemisphere
503 if (satHourAngle < 180) // the east
505 int tmp=(int)round( fabs( satHourAngle ) * 10.0 );
506 RotorCmd = (tmp/10)*0x10 + gotoXTable[ tmp % 10 ];
511 int tmp=(int)round( fabs( 360 - satHourAngle ) * 10.0 );
512 RotorCmd = (tmp/10)*0x10 + gotoXTable[ tmp % 10 ];
516 eDebug("RotorCmd = %04x", RotorCmd);
518 if ( RotorCmd != lastRotorCmd )
520 if ( changed_burst || send_diseqc )
522 // override first voltage change
523 *(++(++sec_sequence.begin()))=eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage13);
524 // wait 1 second after first switch diseqc command
525 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 1000) );
527 else // no other diseqc commands before
529 sec_sequence.push_back( eSecCommand(eSecCommand::SET_TONE, iDVBFrontend::toneOff) );
530 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 15) ); // wait 15msec after tone change
531 eSecCommand::pair compare;
532 compare.voltage = voltage;
534 sec_sequence.push_back( eSecCommand(eSecCommand::IF_VOLTAGE_GOTO, compare) ); // voltage already correct ?
535 sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage13) );
536 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) ); // wait 50msec after voltage change
539 eDVBDiseqcCommand diseqc;
540 diseqc.data[0] = 0xE0;
541 diseqc.data[1] = 0x31; // positioner
545 diseqc.data[2] = 0x6E; // drive to angular position
546 diseqc.data[3] = ((RotorCmd & 0xFF00) / 0x100);
547 diseqc.data[4] = RotorCmd & 0xFF;
552 diseqc.data[2] = 0x6B; // goto stored sat position
553 diseqc.data[3] = RotorCmd;
556 if ( rotor_param.m_inputpower_parameters.m_use )
557 { // use measure rotor input power to detect rotor state
558 eSecCommand::rotor cmd;
559 // measure idle power values
560 sec_sequence.push_back( eSecCommand(eSecCommand::IF_IDLE_INPUTPOWER_AVAIL_GOTO, +8) ); // already measured?
561 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) ); // wait 50msec after voltage change
562 sec_sequence.push_back( eSecCommand(eSecCommand::MEASURE_IDLE_INPUTPOWER, 0) );
563 sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage18) );
564 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 100) ); // wait 100msec before measure
565 sec_sequence.push_back( eSecCommand(eSecCommand::MEASURE_IDLE_INPUTPOWER, 1) );
566 sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage13) ); // back to lower voltage
567 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) ); // wait 50msec
568 ////////////////////////////
569 sec_sequence.push_back( eSecCommand(eSecCommand::SET_POWER_LIMITING_MODE, eSecCommand::modeStatic) );
570 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) ); // wait 50msec after voltage change
571 sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) );
572 sec_sequence.push_back( eSecCommand(eSecCommand::SET_TIMEOUT, 40) ); // 2 seconds rotor start timout
574 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) ); // 50msec delay
575 sec_sequence.push_back( eSecCommand(eSecCommand::MEASURE_RUNNING_INPUTPOWER) );
576 cmd.direction=1; // check for running rotor
577 cmd.deltaA=rotor_param.m_inputpower_parameters.m_delta;
580 sec_sequence.push_back( eSecCommand(eSecCommand::IF_INPUTPOWER_DELTA_GOTO, cmd ) ); // check if rotor has started
581 sec_sequence.push_back( eSecCommand(eSecCommand::IF_TIMEOUT_GOTO, +10 ) ); // timeout .. we assume now the rotor is already at the correct position
582 sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, -4) ); // goto loop start
584 sec_sequence.push_back( eSecCommand(eSecCommand::SET_TIMEOUT, 2400) ); // 2 minutes running timeout
585 sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage18) );
586 sec_sequence.push_back( eSecCommand(eSecCommand::SET_POWER_LIMITING_MODE, eSecCommand::modeDynamic) );
587 // rotor running loop
588 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) ); // wait 50msec
589 sec_sequence.push_back( eSecCommand(eSecCommand::MEASURE_RUNNING_INPUTPOWER) );
590 cmd.direction=0; // check for stopped rotor
592 sec_sequence.push_back( eSecCommand(eSecCommand::IF_INPUTPOWER_DELTA_GOTO, cmd ) );
593 sec_sequence.push_back( eSecCommand(eSecCommand::IF_TIMEOUT_GOTO, +3 ) ); // timeout ? this should never happen
594 sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, -4) ); // running loop start
595 /////////////////////
596 sec_sequence.push_back( eSecCommand(eSecCommand::UPDATE_CURRENT_ROTORPARAMS) );
599 frontend.setData(5, RotorCmd);
600 frontend.setData(6, sat.orbital_position);
604 frontend.setData(3, RotorCmd);
605 frontend.setData(4, sat.orbital_position);
609 eFatal("rotor turning without inputpowermeasure not implemented yet");
614 frontend.setData(0, band); // store band as csw .. needed for linked tuner handling
619 eSecCommand::pair compare;
620 compare.voltage = voltage;
622 sec_sequence.push_back( eSecCommand(eSecCommand::IF_VOLTAGE_GOTO, compare) ); // voltage already correct ?
623 sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, voltage) );
624 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 10) );
626 sec_sequence.push_back( eSecCommand(eSecCommand::SET_TONE, tone) );
627 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 15) );
629 frontend.setSecSequence(sec_sequence);
638 eDebug("found no satellite configuration for orbital position (%d)", sat.orbital_position );
642 RESULT eDVBSatelliteEquipmentControl::clear()
644 for (int i=0; i < m_lnbidx; ++i)
646 m_lnbs[i].m_satellites.clear();
647 m_lnbs[i].tuner_mask = 0;
651 // clear linked tuner configuration
652 for (eSmartPtrList<eDVBRegisteredFrontend>::iterator it(m_avail_frontends.begin()); it != m_avail_frontends.end(); ++it)
653 it->m_frontend->setData(7, -1);
658 /* LNB Specific Parameters */
659 RESULT eDVBSatelliteEquipmentControl::addLNB()
661 if ( m_lnbidx < (int)(sizeof(m_lnbs) / sizeof(eDVBSatelliteLNBParameters)))
662 m_curSat=m_lnbs[++m_lnbidx].m_satellites.end();
665 eDebug("no more LNB free... cnt is %d", m_lnbidx);
671 RESULT eDVBSatelliteEquipmentControl::setLNBTunerMask(int tunermask)
673 if ( currentLNBValid() )
674 m_lnbs[m_lnbidx].tuner_mask = tunermask;
680 RESULT eDVBSatelliteEquipmentControl::setLNBLOFL(int lofl)
682 if ( currentLNBValid() )
683 m_lnbs[m_lnbidx].m_lof_lo = lofl;
689 RESULT eDVBSatelliteEquipmentControl::setLNBLOFH(int lofh)
691 if ( currentLNBValid() )
692 m_lnbs[m_lnbidx].m_lof_hi = lofh;
698 RESULT eDVBSatelliteEquipmentControl::setLNBThreshold(int threshold)
700 if ( currentLNBValid() )
701 m_lnbs[m_lnbidx].m_lof_threshold = threshold;
707 RESULT eDVBSatelliteEquipmentControl::setLNBIncreasedVoltage(bool onoff)
709 if ( currentLNBValid() )
710 m_lnbs[m_lnbidx].m_increased_voltage = onoff;
716 /* DiSEqC Specific Parameters */
717 RESULT eDVBSatelliteEquipmentControl::setDiSEqCMode(int diseqcmode)
719 if ( currentLNBValid() )
720 m_lnbs[m_lnbidx].m_diseqc_parameters.m_diseqc_mode = (eDVBSatelliteDiseqcParameters::t_diseqc_mode)diseqcmode;
726 RESULT eDVBSatelliteEquipmentControl::setToneburst(int toneburst)
728 if ( currentLNBValid() )
729 m_lnbs[m_lnbidx].m_diseqc_parameters.m_toneburst_param = (eDVBSatelliteDiseqcParameters::t_toneburst_param)toneburst;
735 RESULT eDVBSatelliteEquipmentControl::setRepeats(int repeats)
737 if ( currentLNBValid() )
738 m_lnbs[m_lnbidx].m_diseqc_parameters.m_repeats=repeats;
744 RESULT eDVBSatelliteEquipmentControl::setCommittedCommand(int command)
746 if ( currentLNBValid() )
747 m_lnbs[m_lnbidx].m_diseqc_parameters.m_committed_cmd=command;
753 RESULT eDVBSatelliteEquipmentControl::setUncommittedCommand(int command)
755 if ( currentLNBValid() )
756 m_lnbs[m_lnbidx].m_diseqc_parameters.m_uncommitted_cmd = command;
762 RESULT eDVBSatelliteEquipmentControl::setCommandOrder(int order)
764 if ( currentLNBValid() )
765 m_lnbs[m_lnbidx].m_diseqc_parameters.m_command_order=order;
771 RESULT eDVBSatelliteEquipmentControl::setFastDiSEqC(bool onoff)
773 if ( currentLNBValid() )
774 m_lnbs[m_lnbidx].m_diseqc_parameters.m_use_fast=onoff;
780 RESULT eDVBSatelliteEquipmentControl::setSeqRepeat(bool onoff)
782 if ( currentLNBValid() )
783 m_lnbs[m_lnbidx].m_diseqc_parameters.m_seq_repeat = onoff;
789 /* Rotor Specific Parameters */
790 RESULT eDVBSatelliteEquipmentControl::setLongitude(float longitude)
792 if ( currentLNBValid() )
793 m_lnbs[m_lnbidx].m_rotor_parameters.m_gotoxx_parameters.m_longitude=longitude;
799 RESULT eDVBSatelliteEquipmentControl::setLatitude(float latitude)
801 if ( currentLNBValid() )
802 m_lnbs[m_lnbidx].m_rotor_parameters.m_gotoxx_parameters.m_latitude=latitude;
808 RESULT eDVBSatelliteEquipmentControl::setLoDirection(int direction)
810 if ( currentLNBValid() )
811 m_lnbs[m_lnbidx].m_rotor_parameters.m_gotoxx_parameters.m_lo_direction=direction;
817 RESULT eDVBSatelliteEquipmentControl::setLaDirection(int direction)
819 if ( currentLNBValid() )
820 m_lnbs[m_lnbidx].m_rotor_parameters.m_gotoxx_parameters.m_la_direction=direction;
826 RESULT eDVBSatelliteEquipmentControl::setUseInputpower(bool onoff)
828 if ( currentLNBValid() )
829 m_lnbs[m_lnbidx].m_rotor_parameters.m_inputpower_parameters.m_use=onoff;
835 RESULT eDVBSatelliteEquipmentControl::setInputpowerDelta(int delta)
837 if ( currentLNBValid() )
838 m_lnbs[m_lnbidx].m_rotor_parameters.m_inputpower_parameters.m_delta=delta;
844 /* Satellite Specific Parameters */
845 RESULT eDVBSatelliteEquipmentControl::addSatellite(int orbital_position)
847 if ( currentLNBValid() )
849 std::map<int, eDVBSatelliteSwitchParameters>::iterator it =
850 m_lnbs[m_lnbidx].m_satellites.find(orbital_position);
851 if ( it == m_lnbs[m_lnbidx].m_satellites.end() )
853 std::pair<std::map<int, eDVBSatelliteSwitchParameters>::iterator, bool > ret =
854 m_lnbs[m_lnbidx].m_satellites.insert(
855 std::pair<int, eDVBSatelliteSwitchParameters>(orbital_position, eDVBSatelliteSwitchParameters())
858 m_curSat = ret.first;
870 RESULT eDVBSatelliteEquipmentControl::setVoltageMode(int mode)
872 if ( currentLNBValid() && m_curSat != m_lnbs[m_lnbidx].m_satellites.end() )
873 m_curSat->second.m_voltage_mode = (eDVBSatelliteSwitchParameters::t_voltage_mode)mode;
880 RESULT eDVBSatelliteEquipmentControl::setToneMode(int mode)
882 if ( currentLNBValid() )
884 if ( m_curSat != m_lnbs[m_lnbidx].m_satellites.end() )
885 m_curSat->second.m_22khz_signal = (eDVBSatelliteSwitchParameters::t_22khz_signal)mode;
894 RESULT eDVBSatelliteEquipmentControl::setRotorPosNum(int rotor_pos_num)
896 if ( currentLNBValid() )
898 if ( m_curSat != m_lnbs[m_lnbidx].m_satellites.end() )
899 m_curSat->second.m_rotorPosNum=rotor_pos_num;
908 RESULT eDVBSatelliteEquipmentControl::setTunerLinked(int tu1, int tu2)
913 eDVBFrontend *p1=NULL, *p2=NULL;
914 int tmp1=tu1, tmp2=tu2;
916 for (eSmartPtrList<eDVBRegisteredFrontend>::iterator it(m_avail_frontends.begin()); it != m_avail_frontends.end(); ++it)
930 p1->setTone(iDVBFrontend::toneOff);
931 p1->setVoltage(iDVBFrontend::voltageOff);
939 bool eDVBSatelliteEquipmentControl::isRotorMoving()