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)
35 setLNBThreshold(11750000);
37 setDiSEqCMode(eDVBSatelliteDiseqcParameters::V1_0);
38 setToneburst(eDVBSatelliteDiseqcParameters::NO);
40 setCommittedCommand(eDVBSatelliteDiseqcParameters::BB);
41 setCommandOrder(0); // committed, toneburst
45 setVoltageMode(eDVBSatelliteSwitchParameters::HV);
46 setToneMode(eDVBSatelliteSwitchParameters::HILO);
53 setLNBThreshold(11750000);
54 setDiSEqCMode(eDVBSatelliteDiseqcParameters::V1_0);
55 setToneburst(eDVBSatelliteDiseqcParameters::NO);
57 setCommittedCommand(eDVBSatelliteDiseqcParameters::AB);
58 setCommandOrder(0); // committed, toneburst
62 setVoltageMode(eDVBSatelliteSwitchParameters::HV);
63 setToneMode(eDVBSatelliteSwitchParameters::HILO);
66 int eDVBSatelliteEquipmentControl::canTune(const eDVBFrontendParametersSatellite &sat, iDVBFrontend *fe, int frontend_id )
70 for (int idx=0; idx <= m_lnbidx; ++idx )
72 eDVBSatelliteLNBParameters &lnb_param = m_lnbs[idx];
73 if ( lnb_param.tuner_mask & frontend_id ) // lnb for correct tuner?
75 eDVBSatelliteDiseqcParameters &di_param = lnb_param.m_diseqc_parameters;
77 std::map<int, eDVBSatelliteSwitchParameters>::iterator sit =
78 lnb_param.m_satellites.find(sat.orbital_position);
79 if ( sit != lnb_param.m_satellites.end())
82 linked_to=0, // linked tuner
83 csw = di_param.m_committed_cmd,
84 ucsw = di_param.m_uncommitted_cmd,
85 toneburst = di_param.m_toneburst_param,
88 fe->getData(6, curRotorPos);
89 fe->getData(7, linked_to);
91 if ( sat.frequency > lnb_param.m_lof_threshold )
93 if (sat.polarisation == eDVBFrontendParametersSatellite::Polarisation::Horizontal)
96 if (di_param.m_diseqc_mode >= eDVBSatelliteDiseqcParameters::V1_0)
98 if ( di_param.m_committed_cmd < eDVBSatelliteDiseqcParameters::SENDNO )
100 csw = 0xF0 | (csw << 2);
104 if ( di_param.m_diseqc_mode == eDVBSatelliteDiseqcParameters::V1_2 ) // ROTOR
106 if ( curRotorPos == sat.orbital_position )
116 if (linked_to != -1) // check for linked tuners..
119 eSmartPtrList<eDVBRegisteredFrontend>::iterator it(m_avail_frontends.begin());
120 for (; it != m_avail_frontends.end(); ++it)
129 if (found && it->m_inuse)
135 it->m_frontend->getData(0, lastcsw);
136 it->m_frontend->getData(1, lastucsw);
137 it->m_frontend->getData(2, lastToneburst);
138 it->m_frontend->getData(6, curRotorPos);
140 if (csw != lastcsw || ucsw != lastucsw ||
141 toneburst != lastToneburst || curRotorPos != sat.orbital_position )
143 eDebug("can not tune this transponder with linked tuner in use!!");
147 eDebug("OK .. can tune this transponder with linked tuner in use :)");
156 RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPARAMETERS &parm, eDVBFrontendParametersSatellite &sat, int frontend_id)
160 for (int idx=0; idx <= m_lnbidx; ++idx )
162 eDVBSatelliteLNBParameters &lnb_param = m_lnbs[idx];
163 if (!(lnb_param.tuner_mask & frontend_id)) // lnb for correct tuner?
165 eDVBSatelliteDiseqcParameters &di_param = lnb_param.m_diseqc_parameters;
166 eDVBSatelliteRotorParameters &rotor_param = lnb_param.m_rotor_parameters;
168 std::map<int, eDVBSatelliteSwitchParameters>::iterator sit =
169 lnb_param.m_satellites.find(sat.orbital_position);
170 if ( sit != lnb_param.m_satellites.end())
172 eDVBSatelliteSwitchParameters &sw_param = sit->second;
175 linked_to=-1, // linked tuner
176 voltage = iDVBFrontend::voltageOff,
177 tone = iDVBFrontend::toneOff,
178 csw = di_param.m_committed_cmd,
179 ucsw = di_param.m_uncommitted_cmd,
180 toneburst = di_param.m_toneburst_param,
187 frontend.getData(0, lastcsw);
188 frontend.getData(1, lastucsw);
189 frontend.getData(2, lastToneburst);
190 frontend.getData(5, lastRotorCmd);
191 frontend.getData(6, curRotorPos);
192 frontend.getData(7, linked_to);
197 eSmartPtrList<eDVBRegisteredFrontend>::iterator it(m_avail_frontends.begin());
198 for (; it != m_avail_frontends.end(); ++it)
206 if (found && it->m_inuse)
208 eDebug("[SEC] frontend is linked with another one and the other is in use.. so we dont do SEC!!");
214 if ( sat.frequency > lnb_param.m_lof_threshold )
218 parm.FREQUENCY = sat.frequency - lnb_param.m_lof_hi;
220 parm.FREQUENCY = sat.frequency - lnb_param.m_lof_lo;
222 if (sat.polarisation == eDVBFrontendParametersSatellite::Polarisation::Horizontal)
225 parm.INVERSION = (!sat.inversion) ? INVERSION_ON : INVERSION_OFF;
230 case eDVBFrontendParametersSatellite::FEC::fNone:
231 eDebug("no fec set.. assume auto");
232 case eDVBFrontendParametersSatellite::FEC::fAuto:
233 parm.u.qpsk.FEC_INNER = FEC_AUTO;
235 case eDVBFrontendParametersSatellite::FEC::f1_2:
236 parm.u.qpsk.FEC_INNER = FEC_1_2;
238 case eDVBFrontendParametersSatellite::FEC::f2_3:
239 parm.u.qpsk.FEC_INNER = FEC_2_3;
241 case eDVBFrontendParametersSatellite::FEC::f3_4:
242 parm.u.qpsk.FEC_INNER = FEC_3_4;
244 case eDVBFrontendParametersSatellite::FEC::f5_6:
245 parm.u.qpsk.FEC_INNER = FEC_5_6;
247 case eDVBFrontendParametersSatellite::FEC::f7_8:
248 parm.u.qpsk.FEC_INNER = FEC_7_8;
252 parm.u.qpsk.SYMBOLRATE = sat.symbol_rate;
254 if ( sw_param.m_voltage_mode == eDVBSatelliteSwitchParameters::_14V
255 || ( sat.polarisation == eDVBFrontendParametersSatellite::Polarisation::Vertical
256 && sw_param.m_voltage_mode == eDVBSatelliteSwitchParameters::HV ) )
257 voltage = iDVBFrontend::voltage13;
258 else if ( sw_param.m_voltage_mode == eDVBSatelliteSwitchParameters::_18V
259 || ( sat.polarisation == eDVBFrontendParametersSatellite::Polarisation::Horizontal
260 && sw_param.m_voltage_mode == eDVBSatelliteSwitchParameters::HV ) )
261 voltage = iDVBFrontend::voltage18;
263 if ( (sw_param.m_22khz_signal == eDVBSatelliteSwitchParameters::ON)
264 || ( sw_param.m_22khz_signal == eDVBSatelliteSwitchParameters::HILO && (band&1) ) )
265 tone = iDVBFrontend::toneOn;
266 else if ( (sw_param.m_22khz_signal == eDVBSatelliteSwitchParameters::OFF)
267 || ( sw_param.m_22khz_signal == eDVBSatelliteSwitchParameters::HILO && !(band&1) ) )
268 tone = iDVBFrontend::toneOff;
270 eSecCommandList sec_sequence;
272 if (di_param.m_diseqc_mode >= eDVBSatelliteDiseqcParameters::V1_0)
274 if ( di_param.m_committed_cmd < eDVBSatelliteDiseqcParameters::SENDNO )
276 csw = 0xF0 | (csw << 2);
281 (di_param.m_committed_cmd != eDVBSatelliteDiseqcParameters::SENDNO);
282 bool changed_csw = send_csw && csw != lastcsw;
285 (di_param.m_uncommitted_cmd && di_param.m_diseqc_mode > eDVBSatelliteDiseqcParameters::V1_0);
286 bool changed_ucsw = send_ucsw && ucsw != lastucsw;
289 (di_param.m_toneburst_param != eDVBSatelliteDiseqcParameters::NO);
290 bool changed_burst = send_burst && toneburst != lastToneburst;
292 bool send_diseqc = changed_ucsw;
294 send_diseqc = changed_burst && (send_ucsw || send_csw);
297 send_diseqc = changed_csw;
298 if ( send_diseqc && di_param.m_use_fast && (csw & 0xF0) && (lastcsw & 0xF0) && ((csw / 4) == (lastcsw / 4)) )
302 if ( send_diseqc || changed_burst )
304 sec_sequence.push_back( eSecCommand(eSecCommand::SET_TONE, iDVBFrontend::toneOff) );
305 eSecCommand::pair compare;
306 compare.voltage = voltage;
308 sec_sequence.push_back( eSecCommand(eSecCommand::IF_VOLTAGE_GOTO, compare) ); // voltage already correct ?
309 sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, voltage) );
310 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) );
313 for (int seq_repeat = 0; seq_repeat < (di_param.m_seq_repeat?2:1); ++seq_repeat)
315 if ( di_param.m_command_order & 1 && // toneburst at begin of sequence
316 changed_burst && di_param.m_toneburst_param != eDVBSatelliteDiseqcParameters::NO )
318 sec_sequence.push_back( eSecCommand(eSecCommand::SEND_TONEBURST, di_param.m_toneburst_param) );
319 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) );
320 frontend.setData(2, di_param.m_toneburst_param);
332 for ( int i=0; i < di_param.m_repeats; ++i )
335 for ( int i = 0; i < loops;) // fill commands...
337 eDVBDiseqcCommand diseqc;
339 diseqc.data[0] = i ? 0xE1 : 0xE0;
340 diseqc.data[1] = 0x10;
342 if ( !send_csw || (send_ucsw && (di_param.m_command_order & 4) ) )
344 diseqc.data[2] = 0x39;
345 diseqc.data[3] = ucsw;
349 diseqc.data[2] = 0x38;
350 diseqc.data[3] = csw;
352 sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) );
358 if (diseqc.data[2] == 0x38 && send_ucsw)
360 else if (diseqc.data[2] == 0x39 && send_csw)
364 static int delay = (120 - 54) / 2; // standard says 100msek between two repeated commands
365 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, delay) );
367 diseqc.data[3]=(cmd==0x38) ? csw : ucsw;
368 sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) );
371 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, delay ) );
373 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) );
375 else // delay 120msek when no command is in repeat gap
376 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 120) );
379 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) );
381 frontend.setData(0, csw);
382 frontend.setData(1, ucsw);
386 if ( !(di_param.m_command_order & 1) && // toneburst at end of sequence
387 (changed_burst || send_diseqc) && di_param.m_toneburst_param != eDVBSatelliteDiseqcParameters::NO )
389 sec_sequence.push_back( eSecCommand(eSecCommand::SEND_TONEBURST, di_param.m_toneburst_param) );
390 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) );
391 frontend.setData(2, di_param.m_toneburst_param);
395 if ( di_param.m_diseqc_mode == eDVBSatelliteDiseqcParameters::V1_2 )
398 bool useGotoXX = false;
400 if (sw_param.m_rotorPosNum) // we have stored rotor pos?
401 RotorCmd=sw_param.m_rotorPosNum;
402 else // we must calc gotoxx cmd
404 eDebug("Entry for %d,%d° not in Rotor Table found... i try gotoXX°", sat.orbital_position / 10, sat.orbital_position % 10 );
407 int satDir = sat.orbital_position < 0 ?
408 eDVBSatelliteRotorParameters::WEST :
409 eDVBSatelliteRotorParameters::EAST;
411 double SatLon = abs(sat.orbital_position)/10.00,
412 SiteLat = rotor_param.m_gotoxx_parameters.m_latitude,
413 SiteLon = rotor_param.m_gotoxx_parameters.m_longitude;
415 if ( rotor_param.m_gotoxx_parameters.m_la_direction == eDVBSatelliteRotorParameters::SOUTH )
418 if ( rotor_param.m_gotoxx_parameters.m_lo_direction == eDVBSatelliteRotorParameters::WEST )
419 SiteLon = 360 - SiteLon;
421 if (satDir == eDVBSatelliteRotorParameters::WEST )
422 SatLon = 360 - SatLon;
424 eDebug("siteLatitude = %lf, siteLongitude = %lf, %lf degrees", SiteLat, SiteLon, SatLon );
425 double satHourAngle =
426 calcSatHourangle( SatLon, SiteLat, SiteLon );
427 eDebug("PolarmountHourAngle=%lf", satHourAngle );
429 static int gotoXTable[10] =
430 { 0x00, 0x02, 0x03, 0x05, 0x06, 0x08, 0x0A, 0x0B, 0x0D, 0x0E };
432 if (SiteLat >= 0) // Northern Hemisphere
434 int tmp=(int)round( fabs( 180 - satHourAngle ) * 10.0 );
435 RotorCmd = (tmp/10)*0x10 + gotoXTable[ tmp % 10 ];
437 if (satHourAngle < 180) // the east
442 else // Southern Hemisphere
444 if (satHourAngle < 180) // the east
446 int tmp=(int)round( fabs( satHourAngle ) * 10.0 );
447 RotorCmd = (tmp/10)*0x10 + gotoXTable[ tmp % 10 ];
452 int tmp=(int)round( fabs( 360 - satHourAngle ) * 10.0 );
453 RotorCmd = (tmp/10)*0x10 + gotoXTable[ tmp % 10 ];
457 eDebug("RotorCmd = %04x", RotorCmd);
459 if ( RotorCmd != lastRotorCmd )
461 if ( changed_burst || send_diseqc )
463 // override first voltage change
464 *(++(++sec_sequence.begin()))=eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage13);
465 // wait 1 second after first switch diseqc command
466 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 1000) );
468 else // no other diseqc commands before
470 sec_sequence.push_back( eSecCommand(eSecCommand::SET_TONE, iDVBFrontend::toneOff) );
471 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 15) ); // wait 15msec after tone change
472 eSecCommand::pair compare;
473 compare.voltage = voltage;
475 sec_sequence.push_back( eSecCommand(eSecCommand::IF_VOLTAGE_GOTO, compare) ); // voltage already correct ?
476 sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage13) );
477 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) ); // wait 50msec after voltage change
480 eDVBDiseqcCommand diseqc;
481 diseqc.data[0] = 0xE0;
482 diseqc.data[1] = 0x31; // positioner
486 diseqc.data[2] = 0x6E; // drive to angular position
487 diseqc.data[3] = ((RotorCmd & 0xFF00) / 0x100);
488 diseqc.data[4] = RotorCmd & 0xFF;
493 diseqc.data[2] = 0x6B; // goto stored sat position
494 diseqc.data[3] = RotorCmd;
497 if ( rotor_param.m_inputpower_parameters.m_use )
498 { // use measure rotor input power to detect rotor state
499 eSecCommand::rotor cmd;
500 // measure idle power values
501 sec_sequence.push_back( eSecCommand(eSecCommand::IF_IDLE_INPUTPOWER_AVAIL_GOTO, +8) ); // already measured?
502 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) ); // wait 50msec after voltage change
503 sec_sequence.push_back( eSecCommand(eSecCommand::MEASURE_IDLE_INPUTPOWER, 0) );
504 sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage18) );
505 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 100) ); // wait 100msec before measure
506 sec_sequence.push_back( eSecCommand(eSecCommand::MEASURE_IDLE_INPUTPOWER, 1) );
507 sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage13) ); // back to lower voltage
508 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) ); // wait 50msec
509 ////////////////////////////
510 sec_sequence.push_back( eSecCommand(eSecCommand::SET_POWER_LIMITING_MODE, eSecCommand::modeStatic) );
511 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) ); // wait 50msec after voltage change
512 sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) );
513 sec_sequence.push_back( eSecCommand(eSecCommand::SET_TIMEOUT, 40) ); // 2 seconds rotor start timout
515 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) ); // 50msec delay
516 sec_sequence.push_back( eSecCommand(eSecCommand::MEASURE_RUNNING_INPUTPOWER) );
517 cmd.direction=1; // check for running rotor
518 cmd.deltaA=rotor_param.m_inputpower_parameters.m_delta;
521 sec_sequence.push_back( eSecCommand(eSecCommand::IF_INPUTPOWER_DELTA_GOTO, cmd ) ); // check if rotor has started
522 sec_sequence.push_back( eSecCommand(eSecCommand::IF_TIMEOUT_GOTO, +10 ) ); // timeout .. we assume now the rotor is already at the correct position
523 sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, -4) ); // goto loop start
525 sec_sequence.push_back( eSecCommand(eSecCommand::SET_TIMEOUT, 2400) ); // 2 minutes running timeout
526 sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage18) );
527 sec_sequence.push_back( eSecCommand(eSecCommand::SET_POWER_LIMITING_MODE, eSecCommand::modeDynamic) );
528 // rotor running loop
529 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) ); // wait 50msec
530 sec_sequence.push_back( eSecCommand(eSecCommand::MEASURE_RUNNING_INPUTPOWER) );
531 cmd.direction=0; // check for stopped rotor
533 sec_sequence.push_back( eSecCommand(eSecCommand::IF_INPUTPOWER_DELTA_GOTO, cmd ) );
534 sec_sequence.push_back( eSecCommand(eSecCommand::IF_TIMEOUT_GOTO, +3 ) ); // timeout ? this should never happen
535 sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, -4) ); // running loop start
536 /////////////////////
537 sec_sequence.push_back( eSecCommand(eSecCommand::UPDATE_CURRENT_ROTORPARAMS) );
538 frontend.setData(3, RotorCmd);
539 frontend.setData(4, sat.orbital_position);
542 eFatal("rotor turning without inputpowermeasure not implemented yet");
547 frontend.setData(0, band); // store band as csw .. needed for linked tuner handling
549 eSecCommand::pair compare;
550 compare.voltage = voltage;
552 sec_sequence.push_back( eSecCommand(eSecCommand::IF_VOLTAGE_GOTO, compare) ); // voltage already correct ?
553 sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, voltage) );
554 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 10) );
556 sec_sequence.push_back( eSecCommand(eSecCommand::SET_TONE, tone) );
557 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 15) );
559 frontend.setSecSequence(sec_sequence);
568 eDebug("found no satellite configuration for orbital position (%d)", sat.orbital_position );
572 RESULT eDVBSatelliteEquipmentControl::clear()
574 for (int i=0; i < m_lnbidx; ++i)
576 m_lnbs[i].m_satellites.clear();
577 m_lnbs[i].tuner_mask = 0;
581 // clear linked tuner configuration
582 for (eSmartPtrList<eDVBRegisteredFrontend>::iterator it(m_avail_frontends.begin()); it != m_avail_frontends.end(); ++it)
583 it->m_frontend->setData(7, -1);
588 /* LNB Specific Parameters */
589 RESULT eDVBSatelliteEquipmentControl::addLNB()
591 if ( m_lnbidx < (int)(sizeof(m_lnbs) / sizeof(eDVBSatelliteLNBParameters)))
592 m_curSat=m_lnbs[++m_lnbidx].m_satellites.end();
595 eDebug("no more LNB free... cnt is %d", m_lnbidx);
601 RESULT eDVBSatelliteEquipmentControl::setLNBTunerMask(int tunermask)
603 if ( currentLNBValid() )
604 m_lnbs[m_lnbidx].tuner_mask = tunermask;
610 RESULT eDVBSatelliteEquipmentControl::setLNBLOFL(int lofl)
612 if ( currentLNBValid() )
613 m_lnbs[m_lnbidx].m_lof_lo = lofl;
619 RESULT eDVBSatelliteEquipmentControl::setLNBLOFH(int lofh)
621 if ( currentLNBValid() )
622 m_lnbs[m_lnbidx].m_lof_hi = lofh;
628 RESULT eDVBSatelliteEquipmentControl::setLNBThreshold(int threshold)
630 if ( currentLNBValid() )
631 m_lnbs[m_lnbidx].m_lof_threshold = threshold;
637 RESULT eDVBSatelliteEquipmentControl::setLNBIncreasedVoltage(bool onoff)
639 if ( currentLNBValid() )
640 m_lnbs[m_lnbidx].m_increased_voltage = onoff;
646 /* DiSEqC Specific Parameters */
647 RESULT eDVBSatelliteEquipmentControl::setDiSEqCMode(int diseqcmode)
649 if ( currentLNBValid() )
650 m_lnbs[m_lnbidx].m_diseqc_parameters.m_diseqc_mode = (eDVBSatelliteDiseqcParameters::t_diseqc_mode)diseqcmode;
656 RESULT eDVBSatelliteEquipmentControl::setToneburst(int toneburst)
658 if ( currentLNBValid() )
659 m_lnbs[m_lnbidx].m_diseqc_parameters.m_toneburst_param = (eDVBSatelliteDiseqcParameters::t_toneburst_param)toneburst;
665 RESULT eDVBSatelliteEquipmentControl::setRepeats(int repeats)
667 if ( currentLNBValid() )
668 m_lnbs[m_lnbidx].m_diseqc_parameters.m_repeats=repeats;
674 RESULT eDVBSatelliteEquipmentControl::setCommittedCommand(int command)
676 if ( currentLNBValid() )
677 m_lnbs[m_lnbidx].m_diseqc_parameters.m_committed_cmd=command;
683 RESULT eDVBSatelliteEquipmentControl::setUncommittedCommand(int command)
685 if ( currentLNBValid() )
686 m_lnbs[m_lnbidx].m_diseqc_parameters.m_uncommitted_cmd = command;
692 RESULT eDVBSatelliteEquipmentControl::setCommandOrder(int order)
694 if ( currentLNBValid() )
695 m_lnbs[m_lnbidx].m_diseqc_parameters.m_command_order=order;
701 RESULT eDVBSatelliteEquipmentControl::setFastDiSEqC(bool onoff)
703 if ( currentLNBValid() )
704 m_lnbs[m_lnbidx].m_diseqc_parameters.m_use_fast=onoff;
710 RESULT eDVBSatelliteEquipmentControl::setSeqRepeat(bool onoff)
712 if ( currentLNBValid() )
713 m_lnbs[m_lnbidx].m_diseqc_parameters.m_seq_repeat = onoff;
719 /* Rotor Specific Parameters */
720 RESULT eDVBSatelliteEquipmentControl::setLongitude(float longitude)
722 if ( currentLNBValid() )
723 m_lnbs[m_lnbidx].m_rotor_parameters.m_gotoxx_parameters.m_longitude=longitude;
729 RESULT eDVBSatelliteEquipmentControl::setLatitude(float latitude)
731 if ( currentLNBValid() )
732 m_lnbs[m_lnbidx].m_rotor_parameters.m_gotoxx_parameters.m_latitude=latitude;
738 RESULT eDVBSatelliteEquipmentControl::setLoDirection(int direction)
740 if ( currentLNBValid() )
741 m_lnbs[m_lnbidx].m_rotor_parameters.m_gotoxx_parameters.m_lo_direction=direction;
747 RESULT eDVBSatelliteEquipmentControl::setLaDirection(int direction)
749 if ( currentLNBValid() )
750 m_lnbs[m_lnbidx].m_rotor_parameters.m_gotoxx_parameters.m_la_direction=direction;
756 RESULT eDVBSatelliteEquipmentControl::setUseInputpower(bool onoff)
758 if ( currentLNBValid() )
759 m_lnbs[m_lnbidx].m_rotor_parameters.m_inputpower_parameters.m_use=onoff;
765 RESULT eDVBSatelliteEquipmentControl::setInputpowerDelta(int delta)
767 if ( currentLNBValid() )
768 m_lnbs[m_lnbidx].m_rotor_parameters.m_inputpower_parameters.m_delta=delta;
774 /* Satellite Specific Parameters */
775 RESULT eDVBSatelliteEquipmentControl::addSatellite(int orbital_position)
777 if ( currentLNBValid() )
779 std::map<int, eDVBSatelliteSwitchParameters>::iterator it =
780 m_lnbs[m_lnbidx].m_satellites.find(orbital_position);
781 if ( it == m_lnbs[m_lnbidx].m_satellites.end() )
783 std::pair<std::map<int, eDVBSatelliteSwitchParameters>::iterator, bool > ret =
784 m_lnbs[m_lnbidx].m_satellites.insert(
785 std::pair<int, eDVBSatelliteSwitchParameters>(orbital_position, eDVBSatelliteSwitchParameters())
788 m_curSat = ret.first;
800 RESULT eDVBSatelliteEquipmentControl::setVoltageMode(int mode)
802 if ( currentLNBValid() && m_curSat != m_lnbs[m_lnbidx].m_satellites.end() )
803 m_curSat->second.m_voltage_mode = (eDVBSatelliteSwitchParameters::t_voltage_mode)mode;
810 RESULT eDVBSatelliteEquipmentControl::setToneMode(int mode)
812 if ( currentLNBValid() )
814 if ( m_curSat != m_lnbs[m_lnbidx].m_satellites.end() )
815 m_curSat->second.m_22khz_signal = (eDVBSatelliteSwitchParameters::t_22khz_signal)mode;
824 RESULT eDVBSatelliteEquipmentControl::setRotorPosNum(int rotor_pos_num)
826 if ( currentLNBValid() )
828 if ( m_curSat != m_lnbs[m_lnbidx].m_satellites.end() )
829 m_curSat->second.m_rotorPosNum=rotor_pos_num;
838 RESULT eDVBSatelliteEquipmentControl::setTunerLinked(int tu1, int tu2)
843 eDVBFrontend *p1=NULL, *p2=NULL;
844 int tmp1=tu1, tmp2=tu2;
846 for (eSmartPtrList<eDVBRegisteredFrontend>::iterator it(m_avail_frontends.begin()); it != m_avail_frontends.end(); ++it)
860 p1->setTone(iDVBFrontend::toneOff);
861 p1->setVoltage(iDVBFrontend::voltageOff);