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), m_rotorMoving(false)
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
109 int eDVBSatelliteEquipmentControl::canTune(const eDVBFrontendParametersSatellite &sat, iDVBFrontend *fe, int frontend_id )
113 for (int idx=0; idx <= m_lnbidx; ++idx )
115 eDVBSatelliteLNBParameters &lnb_param = m_lnbs[idx];
116 if ( lnb_param.tuner_mask & frontend_id ) // lnb for correct tuner?
118 eDVBSatelliteDiseqcParameters &di_param = lnb_param.m_diseqc_parameters;
120 std::map<int, eDVBSatelliteSwitchParameters>::iterator sit =
121 lnb_param.m_satellites.find(sat.orbital_position);
122 if ( sit != lnb_param.m_satellites.end())
125 linked_to=0, // linked tuner
126 csw = di_param.m_committed_cmd,
127 ucsw = di_param.m_uncommitted_cmd,
128 toneburst = di_param.m_toneburst_param,
131 fe->getData(6, curRotorPos);
132 fe->getData(7, linked_to);
134 if ( sat.frequency > lnb_param.m_lof_threshold )
136 if (sat.polarisation == eDVBFrontendParametersSatellite::Polarisation::Horizontal)
142 if (di_param.m_diseqc_mode >= eDVBSatelliteDiseqcParameters::V1_0)
145 if ( di_param.m_committed_cmd < eDVBSatelliteDiseqcParameters::SENDNO )
147 csw = 0xF0 | (csw << 2);
151 if ( di_param.m_diseqc_mode == eDVBSatelliteDiseqcParameters::V1_2 ) // ROTOR
154 if ( curRotorPos == sat.orbital_position )
164 if (linked_to != -1) // check for linked tuners..
167 eSmartPtrList<eDVBRegisteredFrontend>::iterator it(m_avail_frontends.begin());
168 for (; it != m_avail_frontends.end(); ++it)
177 if (found && it->m_inuse)
183 it->m_frontend->getData(0, ocsw);
184 it->m_frontend->getData(1, oucsw);
185 it->m_frontend->getData(2, oToneburst);
186 it->m_frontend->getData(6, oRotorPos);
188 eDebug("compare csw %02x == lcsw %02x",
191 eDebug("compare ucsw %02x == lucsw %02x\ncompare toneburst %02x == oToneburst %02x",
192 ucsw, oucsw, toneburst, oToneburst);
194 eDebug("compare pos %d == current pos %d",
195 sat.orbital_position, oRotorPos);
197 if ( (csw != ocsw) ||
198 ( diseqc && (ucsw != oucsw || toneburst != oToneburst) ) ||
199 ( rotor && oRotorPos != sat.orbital_position ) )
201 eDebug("can not tune this transponder with linked tuner in use!!");
205 eDebug("OK .. can tune this transponder with linked tuner in use :)");
214 RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPARAMETERS &parm, eDVBFrontendParametersSatellite &sat, int frontend_id)
218 for (int idx=0; idx <= m_lnbidx; ++idx )
220 eDVBSatelliteLNBParameters &lnb_param = m_lnbs[idx];
221 if (!(lnb_param.tuner_mask & frontend_id)) // lnb for correct tuner?
223 eDVBSatelliteDiseqcParameters &di_param = lnb_param.m_diseqc_parameters;
224 eDVBSatelliteRotorParameters &rotor_param = lnb_param.m_rotor_parameters;
226 std::map<int, eDVBSatelliteSwitchParameters>::iterator sit =
227 lnb_param.m_satellites.find(sat.orbital_position);
228 if ( sit != lnb_param.m_satellites.end())
230 eDVBSatelliteSwitchParameters &sw_param = sit->second;
233 linked_to=-1, // linked tuner
234 voltage = iDVBFrontend::voltageOff,
235 tone = iDVBFrontend::toneOff,
236 csw = di_param.m_committed_cmd,
237 ucsw = di_param.m_uncommitted_cmd,
238 toneburst = di_param.m_toneburst_param,
245 frontend.getData(0, lastcsw);
246 frontend.getData(1, lastucsw);
247 frontend.getData(2, lastToneburst);
248 frontend.getData(5, lastRotorCmd);
249 frontend.getData(6, curRotorPos);
250 frontend.getData(7, linked_to);
255 eSmartPtrList<eDVBRegisteredFrontend>::iterator it(m_avail_frontends.begin());
256 for (; it != m_avail_frontends.end(); ++it)
264 if (found && it->m_inuse)
266 eDebug("[SEC] frontend is linked with another one and the other is in use.. so we dont do SEC!!");
271 if ( sat.frequency > lnb_param.m_lof_threshold )
275 parm.FREQUENCY = sat.frequency - lnb_param.m_lof_hi;
277 parm.FREQUENCY = sat.frequency - lnb_param.m_lof_lo;
279 if (sat.polarisation == eDVBFrontendParametersSatellite::Polarisation::Horizontal)
282 parm.INVERSION = (!sat.inversion) ? INVERSION_ON : INVERSION_OFF;
287 case eDVBFrontendParametersSatellite::FEC::fNone:
288 eDebug("no fec set.. assume auto");
289 case eDVBFrontendParametersSatellite::FEC::fAuto:
290 parm.u.qpsk.FEC_INNER = FEC_AUTO;
292 case eDVBFrontendParametersSatellite::FEC::f1_2:
293 parm.u.qpsk.FEC_INNER = FEC_1_2;
295 case eDVBFrontendParametersSatellite::FEC::f2_3:
296 parm.u.qpsk.FEC_INNER = FEC_2_3;
298 case eDVBFrontendParametersSatellite::FEC::f3_4:
299 parm.u.qpsk.FEC_INNER = FEC_3_4;
301 case eDVBFrontendParametersSatellite::FEC::f5_6:
302 parm.u.qpsk.FEC_INNER = FEC_5_6;
304 case eDVBFrontendParametersSatellite::FEC::f7_8:
305 parm.u.qpsk.FEC_INNER = FEC_7_8;
309 parm.u.qpsk.SYMBOLRATE = sat.symbol_rate;
311 if ( sw_param.m_voltage_mode == eDVBSatelliteSwitchParameters::_14V
312 || ( sat.polarisation == eDVBFrontendParametersSatellite::Polarisation::Vertical
313 && sw_param.m_voltage_mode == eDVBSatelliteSwitchParameters::HV ) )
314 voltage = iDVBFrontend::voltage13;
315 else if ( sw_param.m_voltage_mode == eDVBSatelliteSwitchParameters::_18V
316 || ( sat.polarisation == eDVBFrontendParametersSatellite::Polarisation::Horizontal
317 && sw_param.m_voltage_mode == eDVBSatelliteSwitchParameters::HV ) )
318 voltage = iDVBFrontend::voltage18;
320 if ( (sw_param.m_22khz_signal == eDVBSatelliteSwitchParameters::ON)
321 || ( sw_param.m_22khz_signal == eDVBSatelliteSwitchParameters::HILO && (band&1) ) )
322 tone = iDVBFrontend::toneOn;
323 else if ( (sw_param.m_22khz_signal == eDVBSatelliteSwitchParameters::OFF)
324 || ( sw_param.m_22khz_signal == eDVBSatelliteSwitchParameters::HILO && !(band&1) ) )
325 tone = iDVBFrontend::toneOff;
327 eSecCommandList sec_sequence;
329 if (di_param.m_diseqc_mode >= eDVBSatelliteDiseqcParameters::V1_0)
331 if ( di_param.m_committed_cmd < eDVBSatelliteDiseqcParameters::SENDNO )
333 csw = 0xF0 | (csw << 2);
338 (di_param.m_committed_cmd != eDVBSatelliteDiseqcParameters::SENDNO);
339 bool changed_csw = send_csw && csw != lastcsw;
342 (di_param.m_uncommitted_cmd && di_param.m_diseqc_mode > eDVBSatelliteDiseqcParameters::V1_0);
343 bool changed_ucsw = send_ucsw && ucsw != lastucsw;
346 (di_param.m_toneburst_param != eDVBSatelliteDiseqcParameters::NO);
347 bool changed_burst = send_burst && toneburst != lastToneburst;
349 bool send_diseqc = changed_ucsw;
351 send_diseqc = changed_burst && (send_ucsw || send_csw);
354 send_diseqc = changed_csw;
355 if ( send_diseqc && di_param.m_use_fast && (csw & 0xF0) && (lastcsw & 0xF0) && ((csw / 4) == (lastcsw / 4)) )
357 frontend.setData(0, csw); // needed for linked tuner handling
362 if ( send_diseqc || changed_burst )
364 sec_sequence.push_back( eSecCommand(eSecCommand::SET_TONE, iDVBFrontend::toneOff) );
365 eSecCommand::pair compare;
366 compare.voltage = voltage;
368 sec_sequence.push_back( eSecCommand(eSecCommand::IF_VOLTAGE_GOTO, compare) ); // voltage already correct ?
369 sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, voltage) );
370 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) );
373 for (int seq_repeat = 0; seq_repeat < (di_param.m_seq_repeat?2:1); ++seq_repeat)
375 if ( di_param.m_command_order & 1 && // toneburst at begin of sequence
376 changed_burst && di_param.m_toneburst_param != eDVBSatelliteDiseqcParameters::NO )
378 sec_sequence.push_back( eSecCommand(eSecCommand::SEND_TONEBURST, di_param.m_toneburst_param) );
379 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) );
391 for ( int i=0; i < di_param.m_repeats; ++i )
394 for ( int i = 0; i < loops;) // fill commands...
396 eDVBDiseqcCommand diseqc;
398 diseqc.data[0] = i ? 0xE1 : 0xE0;
399 diseqc.data[1] = 0x10;
401 if ( !send_csw || (send_ucsw && (di_param.m_command_order & 4) ) )
403 diseqc.data[2] = 0x39;
404 diseqc.data[3] = ucsw;
408 diseqc.data[2] = 0x38;
409 diseqc.data[3] = csw;
411 sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) );
417 if (diseqc.data[2] == 0x38 && send_ucsw)
419 else if (diseqc.data[2] == 0x39 && send_csw)
423 static int delay = (120 - 54) / 2; // standard says 100msek between two repeated commands
424 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, delay) );
426 diseqc.data[3]=(cmd==0x38) ? csw : ucsw;
427 sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) );
430 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, delay ) );
432 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) );
434 else // delay 120msek when no command is in repeat gap
435 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 120) );
438 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) );
440 frontend.setData(0, csw);
441 frontend.setData(1, ucsw);
442 frontend.setData(2, di_param.m_toneburst_param);
446 if ( !(di_param.m_command_order & 1) && // toneburst at end of sequence
447 (changed_burst || send_diseqc) && di_param.m_toneburst_param != eDVBSatelliteDiseqcParameters::NO )
449 sec_sequence.push_back( eSecCommand(eSecCommand::SEND_TONEBURST, di_param.m_toneburst_param) );
450 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) );
451 frontend.setData(2, di_param.m_toneburst_param);
455 if ( di_param.m_diseqc_mode == eDVBSatelliteDiseqcParameters::V1_2 )
458 bool useGotoXX = false;
460 if (sw_param.m_rotorPosNum) // we have stored rotor pos?
461 RotorCmd=sw_param.m_rotorPosNum;
462 else // we must calc gotoxx cmd
464 eDebug("Entry for %d,%d? not in Rotor Table found... i try gotoXX?", sat.orbital_position / 10, sat.orbital_position % 10 );
467 int satDir = sat.orbital_position < 0 ?
468 eDVBSatelliteRotorParameters::WEST :
469 eDVBSatelliteRotorParameters::EAST;
471 double SatLon = abs(sat.orbital_position)/10.00,
472 SiteLat = rotor_param.m_gotoxx_parameters.m_latitude,
473 SiteLon = rotor_param.m_gotoxx_parameters.m_longitude;
475 if ( rotor_param.m_gotoxx_parameters.m_la_direction == eDVBSatelliteRotorParameters::SOUTH )
478 if ( rotor_param.m_gotoxx_parameters.m_lo_direction == eDVBSatelliteRotorParameters::WEST )
479 SiteLon = 360 - SiteLon;
481 if (satDir == eDVBSatelliteRotorParameters::WEST )
482 SatLon = 360 - SatLon;
484 eDebug("siteLatitude = %lf, siteLongitude = %lf, %lf degrees", SiteLat, SiteLon, SatLon );
485 double satHourAngle =
486 calcSatHourangle( SatLon, SiteLat, SiteLon );
487 eDebug("PolarmountHourAngle=%lf", satHourAngle );
489 static int gotoXTable[10] =
490 { 0x00, 0x02, 0x03, 0x05, 0x06, 0x08, 0x0A, 0x0B, 0x0D, 0x0E };
492 if (SiteLat >= 0) // Northern Hemisphere
494 int tmp=(int)round( fabs( 180 - satHourAngle ) * 10.0 );
495 RotorCmd = (tmp/10)*0x10 + gotoXTable[ tmp % 10 ];
497 if (satHourAngle < 180) // the east
502 else // Southern Hemisphere
504 if (satHourAngle < 180) // the east
506 int tmp=(int)round( fabs( satHourAngle ) * 10.0 );
507 RotorCmd = (tmp/10)*0x10 + gotoXTable[ tmp % 10 ];
512 int tmp=(int)round( fabs( 360 - satHourAngle ) * 10.0 );
513 RotorCmd = (tmp/10)*0x10 + gotoXTable[ tmp % 10 ];
517 eDebug("RotorCmd = %04x", RotorCmd);
519 if ( RotorCmd != lastRotorCmd )
521 if ( changed_burst || send_diseqc )
523 // override first voltage change
524 *(++(++sec_sequence.begin()))=eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage13);
525 // wait 1 second after first switch diseqc command
526 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 1000) );
528 else // no other diseqc commands before
530 sec_sequence.push_back( eSecCommand(eSecCommand::SET_TONE, iDVBFrontend::toneOff) );
531 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 15) ); // wait 15msec after tone change
532 eSecCommand::pair compare;
533 compare.voltage = voltage;
535 sec_sequence.push_back( eSecCommand(eSecCommand::IF_VOLTAGE_GOTO, compare) ); // voltage already correct ?
536 sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage13) );
537 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) ); // wait 50msec after voltage change
540 eDVBDiseqcCommand diseqc;
541 diseqc.data[0] = 0xE0;
542 diseqc.data[1] = 0x31; // positioner
546 diseqc.data[2] = 0x6E; // drive to angular position
547 diseqc.data[3] = ((RotorCmd & 0xFF00) / 0x100);
548 diseqc.data[4] = RotorCmd & 0xFF;
553 diseqc.data[2] = 0x6B; // goto stored sat position
554 diseqc.data[3] = RotorCmd;
557 if ( rotor_param.m_inputpower_parameters.m_use )
558 { // use measure rotor input power to detect rotor state
559 eSecCommand::rotor cmd;
560 // measure idle power values
561 sec_sequence.push_back( eSecCommand(eSecCommand::IF_IDLE_INPUTPOWER_AVAIL_GOTO, +8) ); // already measured?
562 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) ); // wait 50msec after voltage change
563 sec_sequence.push_back( eSecCommand(eSecCommand::MEASURE_IDLE_INPUTPOWER, 0) );
564 sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage18) );
565 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 100) ); // wait 100msec before measure
566 sec_sequence.push_back( eSecCommand(eSecCommand::MEASURE_IDLE_INPUTPOWER, 1) );
567 sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage13) ); // back to lower voltage
568 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) ); // wait 50msec
569 ////////////////////////////
570 sec_sequence.push_back( eSecCommand(eSecCommand::SET_POWER_LIMITING_MODE, eSecCommand::modeStatic) );
571 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) ); // wait 50msec after voltage change
572 sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) );
573 sec_sequence.push_back( eSecCommand(eSecCommand::SET_TIMEOUT, 40) ); // 2 seconds rotor start timout
575 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) ); // 50msec delay
576 sec_sequence.push_back( eSecCommand(eSecCommand::MEASURE_RUNNING_INPUTPOWER) );
577 cmd.direction=1; // check for running rotor
578 cmd.deltaA=rotor_param.m_inputpower_parameters.m_delta;
581 sec_sequence.push_back( eSecCommand(eSecCommand::IF_INPUTPOWER_DELTA_GOTO, cmd ) ); // check if rotor has started
582 sec_sequence.push_back( eSecCommand(eSecCommand::IF_TIMEOUT_GOTO, +10 ) ); // timeout .. we assume now the rotor is already at the correct position
583 sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, -4) ); // goto loop start
585 sec_sequence.push_back( eSecCommand(eSecCommand::SET_TIMEOUT, 2400) ); // 2 minutes running timeout
586 sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage18) );
587 sec_sequence.push_back( eSecCommand(eSecCommand::SET_POWER_LIMITING_MODE, eSecCommand::modeDynamic) );
588 // rotor running loop
589 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) ); // wait 50msec
590 sec_sequence.push_back( eSecCommand(eSecCommand::MEASURE_RUNNING_INPUTPOWER) );
591 cmd.direction=0; // check for stopped rotor
593 sec_sequence.push_back( eSecCommand(eSecCommand::IF_INPUTPOWER_DELTA_GOTO, cmd ) );
594 sec_sequence.push_back( eSecCommand(eSecCommand::IF_TIMEOUT_GOTO, +3 ) ); // timeout ? this should never happen
595 sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, -4) ); // running loop start
596 /////////////////////
597 sec_sequence.push_back( eSecCommand(eSecCommand::UPDATE_CURRENT_ROTORPARAMS) );
600 frontend.setData(5, RotorCmd);
601 frontend.setData(6, sat.orbital_position);
605 frontend.setData(3, RotorCmd);
606 frontend.setData(4, sat.orbital_position);
610 eFatal("rotor turning without inputpowermeasure not implemented yet");
615 frontend.setData(0, band); // store band as csw .. needed for linked tuner handling
620 eSecCommand::pair compare;
621 compare.voltage = voltage;
623 sec_sequence.push_back( eSecCommand(eSecCommand::IF_VOLTAGE_GOTO, compare) ); // voltage already correct ?
624 sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, voltage) );
625 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 10) );
627 sec_sequence.push_back( eSecCommand(eSecCommand::SET_TONE, tone) );
628 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 15) );
630 frontend.setSecSequence(sec_sequence);
639 eDebug("found no satellite configuration for orbital position (%d)", sat.orbital_position );
643 RESULT eDVBSatelliteEquipmentControl::clear()
645 for (int i=0; i < m_lnbidx; ++i)
647 m_lnbs[i].m_satellites.clear();
648 m_lnbs[i].tuner_mask = 0;
652 // clear linked tuner configuration
653 for (eSmartPtrList<eDVBRegisteredFrontend>::iterator it(m_avail_frontends.begin()); it != m_avail_frontends.end(); ++it)
654 it->m_frontend->setData(7, -1);
659 /* LNB Specific Parameters */
660 RESULT eDVBSatelliteEquipmentControl::addLNB()
662 if ( m_lnbidx < (int)(sizeof(m_lnbs) / sizeof(eDVBSatelliteLNBParameters)))
663 m_curSat=m_lnbs[++m_lnbidx].m_satellites.end();
666 eDebug("no more LNB free... cnt is %d", m_lnbidx);
672 RESULT eDVBSatelliteEquipmentControl::setLNBTunerMask(int tunermask)
674 if ( currentLNBValid() )
675 m_lnbs[m_lnbidx].tuner_mask = tunermask;
681 RESULT eDVBSatelliteEquipmentControl::setLNBLOFL(int lofl)
683 if ( currentLNBValid() )
684 m_lnbs[m_lnbidx].m_lof_lo = lofl;
690 RESULT eDVBSatelliteEquipmentControl::setLNBLOFH(int lofh)
692 if ( currentLNBValid() )
693 m_lnbs[m_lnbidx].m_lof_hi = lofh;
699 RESULT eDVBSatelliteEquipmentControl::setLNBThreshold(int threshold)
701 if ( currentLNBValid() )
702 m_lnbs[m_lnbidx].m_lof_threshold = threshold;
708 RESULT eDVBSatelliteEquipmentControl::setLNBIncreasedVoltage(bool onoff)
710 if ( currentLNBValid() )
711 m_lnbs[m_lnbidx].m_increased_voltage = onoff;
717 /* DiSEqC Specific Parameters */
718 RESULT eDVBSatelliteEquipmentControl::setDiSEqCMode(int diseqcmode)
720 if ( currentLNBValid() )
721 m_lnbs[m_lnbidx].m_diseqc_parameters.m_diseqc_mode = (eDVBSatelliteDiseqcParameters::t_diseqc_mode)diseqcmode;
727 RESULT eDVBSatelliteEquipmentControl::setToneburst(int toneburst)
729 if ( currentLNBValid() )
730 m_lnbs[m_lnbidx].m_diseqc_parameters.m_toneburst_param = (eDVBSatelliteDiseqcParameters::t_toneburst_param)toneburst;
736 RESULT eDVBSatelliteEquipmentControl::setRepeats(int repeats)
738 if ( currentLNBValid() )
739 m_lnbs[m_lnbidx].m_diseqc_parameters.m_repeats=repeats;
745 RESULT eDVBSatelliteEquipmentControl::setCommittedCommand(int command)
747 if ( currentLNBValid() )
748 m_lnbs[m_lnbidx].m_diseqc_parameters.m_committed_cmd=command;
754 RESULT eDVBSatelliteEquipmentControl::setUncommittedCommand(int command)
756 if ( currentLNBValid() )
757 m_lnbs[m_lnbidx].m_diseqc_parameters.m_uncommitted_cmd = command;
763 RESULT eDVBSatelliteEquipmentControl::setCommandOrder(int order)
765 if ( currentLNBValid() )
766 m_lnbs[m_lnbidx].m_diseqc_parameters.m_command_order=order;
772 RESULT eDVBSatelliteEquipmentControl::setFastDiSEqC(bool onoff)
774 if ( currentLNBValid() )
775 m_lnbs[m_lnbidx].m_diseqc_parameters.m_use_fast=onoff;
781 RESULT eDVBSatelliteEquipmentControl::setSeqRepeat(bool onoff)
783 if ( currentLNBValid() )
784 m_lnbs[m_lnbidx].m_diseqc_parameters.m_seq_repeat = onoff;
790 /* Rotor Specific Parameters */
791 RESULT eDVBSatelliteEquipmentControl::setLongitude(float longitude)
793 if ( currentLNBValid() )
794 m_lnbs[m_lnbidx].m_rotor_parameters.m_gotoxx_parameters.m_longitude=longitude;
800 RESULT eDVBSatelliteEquipmentControl::setLatitude(float latitude)
802 if ( currentLNBValid() )
803 m_lnbs[m_lnbidx].m_rotor_parameters.m_gotoxx_parameters.m_latitude=latitude;
809 RESULT eDVBSatelliteEquipmentControl::setLoDirection(int direction)
811 if ( currentLNBValid() )
812 m_lnbs[m_lnbidx].m_rotor_parameters.m_gotoxx_parameters.m_lo_direction=direction;
818 RESULT eDVBSatelliteEquipmentControl::setLaDirection(int direction)
820 if ( currentLNBValid() )
821 m_lnbs[m_lnbidx].m_rotor_parameters.m_gotoxx_parameters.m_la_direction=direction;
827 RESULT eDVBSatelliteEquipmentControl::setUseInputpower(bool onoff)
829 if ( currentLNBValid() )
830 m_lnbs[m_lnbidx].m_rotor_parameters.m_inputpower_parameters.m_use=onoff;
836 RESULT eDVBSatelliteEquipmentControl::setInputpowerDelta(int delta)
838 if ( currentLNBValid() )
839 m_lnbs[m_lnbidx].m_rotor_parameters.m_inputpower_parameters.m_delta=delta;
845 /* Satellite Specific Parameters */
846 RESULT eDVBSatelliteEquipmentControl::addSatellite(int orbital_position)
848 if ( currentLNBValid() )
850 std::map<int, eDVBSatelliteSwitchParameters>::iterator it =
851 m_lnbs[m_lnbidx].m_satellites.find(orbital_position);
852 if ( it == m_lnbs[m_lnbidx].m_satellites.end() )
854 std::pair<std::map<int, eDVBSatelliteSwitchParameters>::iterator, bool > ret =
855 m_lnbs[m_lnbidx].m_satellites.insert(
856 std::pair<int, eDVBSatelliteSwitchParameters>(orbital_position, eDVBSatelliteSwitchParameters())
859 m_curSat = ret.first;
871 RESULT eDVBSatelliteEquipmentControl::setVoltageMode(int mode)
873 if ( currentLNBValid() && m_curSat != m_lnbs[m_lnbidx].m_satellites.end() )
874 m_curSat->second.m_voltage_mode = (eDVBSatelliteSwitchParameters::t_voltage_mode)mode;
881 RESULT eDVBSatelliteEquipmentControl::setToneMode(int mode)
883 if ( currentLNBValid() )
885 if ( m_curSat != m_lnbs[m_lnbidx].m_satellites.end() )
886 m_curSat->second.m_22khz_signal = (eDVBSatelliteSwitchParameters::t_22khz_signal)mode;
895 RESULT eDVBSatelliteEquipmentControl::setRotorPosNum(int rotor_pos_num)
897 if ( currentLNBValid() )
899 if ( m_curSat != m_lnbs[m_lnbidx].m_satellites.end() )
900 m_curSat->second.m_rotorPosNum=rotor_pos_num;
909 RESULT eDVBSatelliteEquipmentControl::setTunerLinked(int tu1, int tu2)
914 eDVBFrontend *p1=NULL, *p2=NULL;
915 int tmp1=tu1, tmp2=tu2;
917 for (eSmartPtrList<eDVBRegisteredFrontend>::iterator it(m_avail_frontends.begin()); it != m_avail_frontends.end(); ++it)
931 p1->setTone(iDVBFrontend::toneOff);
932 p1->setVoltage(iDVBFrontend::voltageOff);
940 bool eDVBSatelliteEquipmentControl::isRotorMoving()
942 return m_rotorMoving;
945 void eDVBSatelliteEquipmentControl::setRotorMoving(bool b)