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)
99 if (di_param.m_diseqc_mode >= eDVBSatelliteDiseqcParameters::V1_0)
102 if ( di_param.m_committed_cmd < eDVBSatelliteDiseqcParameters::SENDNO )
104 csw = 0xF0 | (csw << 2);
108 if ( di_param.m_diseqc_mode == eDVBSatelliteDiseqcParameters::V1_2 ) // ROTOR
111 if ( curRotorPos == sat.orbital_position )
121 if (linked_to != -1) // check for linked tuners..
124 eSmartPtrList<eDVBRegisteredFrontend>::iterator it(m_avail_frontends.begin());
125 for (; it != m_avail_frontends.end(); ++it)
134 if (found && it->m_inuse)
140 it->m_frontend->getData(0, ocsw);
141 it->m_frontend->getData(1, oucsw);
142 it->m_frontend->getData(2, oToneburst);
143 it->m_frontend->getData(6, oRotorPos);
145 eDebug("compare csw %02x == lcsw %02x",
148 eDebug("compare ucsw %02x == lucsw %02x\ncompare toneburst %02x == oToneburst %02x",
149 ucsw, oucsw, toneburst, oToneburst);
151 eDebug("compare pos %d == current pos %d",
152 sat.orbital_position, oRotorPos);
154 if ( (csw != ocsw) ||
155 ( diseqc && (ucsw != oucsw || toneburst != oToneburst) ) ||
156 ( rotor && oRotorPos != sat.orbital_position ) )
158 eDebug("can not tune this transponder with linked tuner in use!!");
162 eDebug("OK .. can tune this transponder with linked tuner in use :)");
171 RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPARAMETERS &parm, eDVBFrontendParametersSatellite &sat, int frontend_id)
175 for (int idx=0; idx <= m_lnbidx; ++idx )
177 eDVBSatelliteLNBParameters &lnb_param = m_lnbs[idx];
178 if (!(lnb_param.tuner_mask & frontend_id)) // lnb for correct tuner?
180 eDVBSatelliteDiseqcParameters &di_param = lnb_param.m_diseqc_parameters;
181 eDVBSatelliteRotorParameters &rotor_param = lnb_param.m_rotor_parameters;
183 std::map<int, eDVBSatelliteSwitchParameters>::iterator sit =
184 lnb_param.m_satellites.find(sat.orbital_position);
185 if ( sit != lnb_param.m_satellites.end())
187 eDVBSatelliteSwitchParameters &sw_param = sit->second;
190 linked_to=-1, // linked tuner
191 voltage = iDVBFrontend::voltageOff,
192 tone = iDVBFrontend::toneOff,
193 csw = di_param.m_committed_cmd,
194 ucsw = di_param.m_uncommitted_cmd,
195 toneburst = di_param.m_toneburst_param,
202 frontend.getData(0, lastcsw);
203 frontend.getData(1, lastucsw);
204 frontend.getData(2, lastToneburst);
205 frontend.getData(5, lastRotorCmd);
206 frontend.getData(6, curRotorPos);
207 frontend.getData(7, linked_to);
212 eSmartPtrList<eDVBRegisteredFrontend>::iterator it(m_avail_frontends.begin());
213 for (; it != m_avail_frontends.end(); ++it)
221 if (found && it->m_inuse)
223 eDebug("[SEC] frontend is linked with another one and the other is in use.. so we dont do SEC!!");
228 if ( sat.frequency > lnb_param.m_lof_threshold )
232 parm.FREQUENCY = sat.frequency - lnb_param.m_lof_hi;
234 parm.FREQUENCY = sat.frequency - lnb_param.m_lof_lo;
236 if (sat.polarisation == eDVBFrontendParametersSatellite::Polarisation::Horizontal)
239 parm.INVERSION = (!sat.inversion) ? INVERSION_ON : INVERSION_OFF;
244 case eDVBFrontendParametersSatellite::FEC::fNone:
245 eDebug("no fec set.. assume auto");
246 case eDVBFrontendParametersSatellite::FEC::fAuto:
247 parm.u.qpsk.FEC_INNER = FEC_AUTO;
249 case eDVBFrontendParametersSatellite::FEC::f1_2:
250 parm.u.qpsk.FEC_INNER = FEC_1_2;
252 case eDVBFrontendParametersSatellite::FEC::f2_3:
253 parm.u.qpsk.FEC_INNER = FEC_2_3;
255 case eDVBFrontendParametersSatellite::FEC::f3_4:
256 parm.u.qpsk.FEC_INNER = FEC_3_4;
258 case eDVBFrontendParametersSatellite::FEC::f5_6:
259 parm.u.qpsk.FEC_INNER = FEC_5_6;
261 case eDVBFrontendParametersSatellite::FEC::f7_8:
262 parm.u.qpsk.FEC_INNER = FEC_7_8;
266 parm.u.qpsk.SYMBOLRATE = sat.symbol_rate;
268 if ( sw_param.m_voltage_mode == eDVBSatelliteSwitchParameters::_14V
269 || ( sat.polarisation == eDVBFrontendParametersSatellite::Polarisation::Vertical
270 && sw_param.m_voltage_mode == eDVBSatelliteSwitchParameters::HV ) )
271 voltage = iDVBFrontend::voltage13;
272 else if ( sw_param.m_voltage_mode == eDVBSatelliteSwitchParameters::_18V
273 || ( sat.polarisation == eDVBFrontendParametersSatellite::Polarisation::Horizontal
274 && sw_param.m_voltage_mode == eDVBSatelliteSwitchParameters::HV ) )
275 voltage = iDVBFrontend::voltage18;
277 if ( (sw_param.m_22khz_signal == eDVBSatelliteSwitchParameters::ON)
278 || ( sw_param.m_22khz_signal == eDVBSatelliteSwitchParameters::HILO && (band&1) ) )
279 tone = iDVBFrontend::toneOn;
280 else if ( (sw_param.m_22khz_signal == eDVBSatelliteSwitchParameters::OFF)
281 || ( sw_param.m_22khz_signal == eDVBSatelliteSwitchParameters::HILO && !(band&1) ) )
282 tone = iDVBFrontend::toneOff;
284 eSecCommandList sec_sequence;
286 if (di_param.m_diseqc_mode >= eDVBSatelliteDiseqcParameters::V1_0)
288 if ( di_param.m_committed_cmd < eDVBSatelliteDiseqcParameters::SENDNO )
290 csw = 0xF0 | (csw << 2);
295 (di_param.m_committed_cmd != eDVBSatelliteDiseqcParameters::SENDNO);
296 bool changed_csw = send_csw && csw != lastcsw;
299 (di_param.m_uncommitted_cmd && di_param.m_diseqc_mode > eDVBSatelliteDiseqcParameters::V1_0);
300 bool changed_ucsw = send_ucsw && ucsw != lastucsw;
303 (di_param.m_toneburst_param != eDVBSatelliteDiseqcParameters::NO);
304 bool changed_burst = send_burst && toneburst != lastToneburst;
306 bool send_diseqc = changed_ucsw;
308 send_diseqc = changed_burst && (send_ucsw || send_csw);
311 send_diseqc = changed_csw;
312 if ( send_diseqc && di_param.m_use_fast && (csw & 0xF0) && (lastcsw & 0xF0) && ((csw / 4) == (lastcsw / 4)) )
316 if ( send_diseqc || changed_burst )
318 sec_sequence.push_back( eSecCommand(eSecCommand::SET_TONE, iDVBFrontend::toneOff) );
319 eSecCommand::pair compare;
320 compare.voltage = voltage;
322 sec_sequence.push_back( eSecCommand(eSecCommand::IF_VOLTAGE_GOTO, compare) ); // voltage already correct ?
323 sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, voltage) );
324 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) );
327 for (int seq_repeat = 0; seq_repeat < (di_param.m_seq_repeat?2:1); ++seq_repeat)
329 if ( di_param.m_command_order & 1 && // toneburst at begin of sequence
330 changed_burst && di_param.m_toneburst_param != eDVBSatelliteDiseqcParameters::NO )
332 sec_sequence.push_back( eSecCommand(eSecCommand::SEND_TONEBURST, di_param.m_toneburst_param) );
333 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) );
345 for ( int i=0; i < di_param.m_repeats; ++i )
348 for ( int i = 0; i < loops;) // fill commands...
350 eDVBDiseqcCommand diseqc;
352 diseqc.data[0] = i ? 0xE1 : 0xE0;
353 diseqc.data[1] = 0x10;
355 if ( !send_csw || (send_ucsw && (di_param.m_command_order & 4) ) )
357 diseqc.data[2] = 0x39;
358 diseqc.data[3] = ucsw;
362 diseqc.data[2] = 0x38;
363 diseqc.data[3] = csw;
365 sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) );
371 if (diseqc.data[2] == 0x38 && send_ucsw)
373 else if (diseqc.data[2] == 0x39 && send_csw)
377 static int delay = (120 - 54) / 2; // standard says 100msek between two repeated commands
378 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, delay) );
380 diseqc.data[3]=(cmd==0x38) ? csw : ucsw;
381 sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) );
384 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, delay ) );
386 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) );
388 else // delay 120msek when no command is in repeat gap
389 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 120) );
392 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) );
394 frontend.setData(0, csw);
395 frontend.setData(1, ucsw);
396 frontend.setData(2, di_param.m_toneburst_param);
400 if ( !(di_param.m_command_order & 1) && // toneburst at end of sequence
401 (changed_burst || send_diseqc) && di_param.m_toneburst_param != eDVBSatelliteDiseqcParameters::NO )
403 sec_sequence.push_back( eSecCommand(eSecCommand::SEND_TONEBURST, di_param.m_toneburst_param) );
404 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) );
405 frontend.setData(2, di_param.m_toneburst_param);
409 if ( di_param.m_diseqc_mode == eDVBSatelliteDiseqcParameters::V1_2 )
412 bool useGotoXX = false;
414 if (sw_param.m_rotorPosNum) // we have stored rotor pos?
415 RotorCmd=sw_param.m_rotorPosNum;
416 else // we must calc gotoxx cmd
418 eDebug("Entry for %d,%d° not in Rotor Table found... i try gotoXX°", sat.orbital_position / 10, sat.orbital_position % 10 );
421 int satDir = sat.orbital_position < 0 ?
422 eDVBSatelliteRotorParameters::WEST :
423 eDVBSatelliteRotorParameters::EAST;
425 double SatLon = abs(sat.orbital_position)/10.00,
426 SiteLat = rotor_param.m_gotoxx_parameters.m_latitude,
427 SiteLon = rotor_param.m_gotoxx_parameters.m_longitude;
429 if ( rotor_param.m_gotoxx_parameters.m_la_direction == eDVBSatelliteRotorParameters::SOUTH )
432 if ( rotor_param.m_gotoxx_parameters.m_lo_direction == eDVBSatelliteRotorParameters::WEST )
433 SiteLon = 360 - SiteLon;
435 if (satDir == eDVBSatelliteRotorParameters::WEST )
436 SatLon = 360 - SatLon;
438 eDebug("siteLatitude = %lf, siteLongitude = %lf, %lf degrees", SiteLat, SiteLon, SatLon );
439 double satHourAngle =
440 calcSatHourangle( SatLon, SiteLat, SiteLon );
441 eDebug("PolarmountHourAngle=%lf", satHourAngle );
443 static int gotoXTable[10] =
444 { 0x00, 0x02, 0x03, 0x05, 0x06, 0x08, 0x0A, 0x0B, 0x0D, 0x0E };
446 if (SiteLat >= 0) // Northern Hemisphere
448 int tmp=(int)round( fabs( 180 - satHourAngle ) * 10.0 );
449 RotorCmd = (tmp/10)*0x10 + gotoXTable[ tmp % 10 ];
451 if (satHourAngle < 180) // the east
456 else // Southern Hemisphere
458 if (satHourAngle < 180) // the east
460 int tmp=(int)round( fabs( satHourAngle ) * 10.0 );
461 RotorCmd = (tmp/10)*0x10 + gotoXTable[ tmp % 10 ];
466 int tmp=(int)round( fabs( 360 - satHourAngle ) * 10.0 );
467 RotorCmd = (tmp/10)*0x10 + gotoXTable[ tmp % 10 ];
471 eDebug("RotorCmd = %04x", RotorCmd);
473 if ( RotorCmd != lastRotorCmd )
475 if ( changed_burst || send_diseqc )
477 // override first voltage change
478 *(++(++sec_sequence.begin()))=eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage13);
479 // wait 1 second after first switch diseqc command
480 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 1000) );
482 else // no other diseqc commands before
484 sec_sequence.push_back( eSecCommand(eSecCommand::SET_TONE, iDVBFrontend::toneOff) );
485 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 15) ); // wait 15msec after tone change
486 eSecCommand::pair compare;
487 compare.voltage = voltage;
489 sec_sequence.push_back( eSecCommand(eSecCommand::IF_VOLTAGE_GOTO, compare) ); // voltage already correct ?
490 sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage13) );
491 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) ); // wait 50msec after voltage change
494 eDVBDiseqcCommand diseqc;
495 diseqc.data[0] = 0xE0;
496 diseqc.data[1] = 0x31; // positioner
500 diseqc.data[2] = 0x6E; // drive to angular position
501 diseqc.data[3] = ((RotorCmd & 0xFF00) / 0x100);
502 diseqc.data[4] = RotorCmd & 0xFF;
507 diseqc.data[2] = 0x6B; // goto stored sat position
508 diseqc.data[3] = RotorCmd;
511 if ( rotor_param.m_inputpower_parameters.m_use )
512 { // use measure rotor input power to detect rotor state
513 eSecCommand::rotor cmd;
514 // measure idle power values
515 sec_sequence.push_back( eSecCommand(eSecCommand::IF_IDLE_INPUTPOWER_AVAIL_GOTO, +8) ); // already measured?
516 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) ); // wait 50msec after voltage change
517 sec_sequence.push_back( eSecCommand(eSecCommand::MEASURE_IDLE_INPUTPOWER, 0) );
518 sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage18) );
519 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 100) ); // wait 100msec before measure
520 sec_sequence.push_back( eSecCommand(eSecCommand::MEASURE_IDLE_INPUTPOWER, 1) );
521 sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage13) ); // back to lower voltage
522 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) ); // wait 50msec
523 ////////////////////////////
524 sec_sequence.push_back( eSecCommand(eSecCommand::SET_POWER_LIMITING_MODE, eSecCommand::modeStatic) );
525 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) ); // wait 50msec after voltage change
526 sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) );
527 sec_sequence.push_back( eSecCommand(eSecCommand::SET_TIMEOUT, 40) ); // 2 seconds rotor start timout
529 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) ); // 50msec delay
530 sec_sequence.push_back( eSecCommand(eSecCommand::MEASURE_RUNNING_INPUTPOWER) );
531 cmd.direction=1; // check for running rotor
532 cmd.deltaA=rotor_param.m_inputpower_parameters.m_delta;
535 sec_sequence.push_back( eSecCommand(eSecCommand::IF_INPUTPOWER_DELTA_GOTO, cmd ) ); // check if rotor has started
536 sec_sequence.push_back( eSecCommand(eSecCommand::IF_TIMEOUT_GOTO, +10 ) ); // timeout .. we assume now the rotor is already at the correct position
537 sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, -4) ); // goto loop start
539 sec_sequence.push_back( eSecCommand(eSecCommand::SET_TIMEOUT, 2400) ); // 2 minutes running timeout
540 sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage18) );
541 sec_sequence.push_back( eSecCommand(eSecCommand::SET_POWER_LIMITING_MODE, eSecCommand::modeDynamic) );
542 // rotor running loop
543 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) ); // wait 50msec
544 sec_sequence.push_back( eSecCommand(eSecCommand::MEASURE_RUNNING_INPUTPOWER) );
545 cmd.direction=0; // check for stopped rotor
547 sec_sequence.push_back( eSecCommand(eSecCommand::IF_INPUTPOWER_DELTA_GOTO, cmd ) );
548 sec_sequence.push_back( eSecCommand(eSecCommand::IF_TIMEOUT_GOTO, +3 ) ); // timeout ? this should never happen
549 sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, -4) ); // running loop start
550 /////////////////////
551 sec_sequence.push_back( eSecCommand(eSecCommand::UPDATE_CURRENT_ROTORPARAMS) );
554 frontend.setData(5, RotorCmd);
555 frontend.setData(6, sat.orbital_position);
559 frontend.setData(3, RotorCmd);
560 frontend.setData(4, sat.orbital_position);
564 eFatal("rotor turning without inputpowermeasure not implemented yet");
569 frontend.setData(0, band); // store band as csw .. needed for linked tuner handling
574 eSecCommand::pair compare;
575 compare.voltage = voltage;
577 sec_sequence.push_back( eSecCommand(eSecCommand::IF_VOLTAGE_GOTO, compare) ); // voltage already correct ?
578 sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, voltage) );
579 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 10) );
581 sec_sequence.push_back( eSecCommand(eSecCommand::SET_TONE, tone) );
582 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 15) );
584 frontend.setSecSequence(sec_sequence);
593 eDebug("found no satellite configuration for orbital position (%d)", sat.orbital_position );
597 RESULT eDVBSatelliteEquipmentControl::clear()
599 for (int i=0; i < m_lnbidx; ++i)
601 m_lnbs[i].m_satellites.clear();
602 m_lnbs[i].tuner_mask = 0;
606 // clear linked tuner configuration
607 for (eSmartPtrList<eDVBRegisteredFrontend>::iterator it(m_avail_frontends.begin()); it != m_avail_frontends.end(); ++it)
608 it->m_frontend->setData(7, -1);
613 /* LNB Specific Parameters */
614 RESULT eDVBSatelliteEquipmentControl::addLNB()
616 if ( m_lnbidx < (int)(sizeof(m_lnbs) / sizeof(eDVBSatelliteLNBParameters)))
617 m_curSat=m_lnbs[++m_lnbidx].m_satellites.end();
620 eDebug("no more LNB free... cnt is %d", m_lnbidx);
626 RESULT eDVBSatelliteEquipmentControl::setLNBTunerMask(int tunermask)
628 if ( currentLNBValid() )
629 m_lnbs[m_lnbidx].tuner_mask = tunermask;
635 RESULT eDVBSatelliteEquipmentControl::setLNBLOFL(int lofl)
637 if ( currentLNBValid() )
638 m_lnbs[m_lnbidx].m_lof_lo = lofl;
644 RESULT eDVBSatelliteEquipmentControl::setLNBLOFH(int lofh)
646 if ( currentLNBValid() )
647 m_lnbs[m_lnbidx].m_lof_hi = lofh;
653 RESULT eDVBSatelliteEquipmentControl::setLNBThreshold(int threshold)
655 if ( currentLNBValid() )
656 m_lnbs[m_lnbidx].m_lof_threshold = threshold;
662 RESULT eDVBSatelliteEquipmentControl::setLNBIncreasedVoltage(bool onoff)
664 if ( currentLNBValid() )
665 m_lnbs[m_lnbidx].m_increased_voltage = onoff;
671 /* DiSEqC Specific Parameters */
672 RESULT eDVBSatelliteEquipmentControl::setDiSEqCMode(int diseqcmode)
674 if ( currentLNBValid() )
675 m_lnbs[m_lnbidx].m_diseqc_parameters.m_diseqc_mode = (eDVBSatelliteDiseqcParameters::t_diseqc_mode)diseqcmode;
681 RESULT eDVBSatelliteEquipmentControl::setToneburst(int toneburst)
683 if ( currentLNBValid() )
684 m_lnbs[m_lnbidx].m_diseqc_parameters.m_toneburst_param = (eDVBSatelliteDiseqcParameters::t_toneburst_param)toneburst;
690 RESULT eDVBSatelliteEquipmentControl::setRepeats(int repeats)
692 if ( currentLNBValid() )
693 m_lnbs[m_lnbidx].m_diseqc_parameters.m_repeats=repeats;
699 RESULT eDVBSatelliteEquipmentControl::setCommittedCommand(int command)
701 if ( currentLNBValid() )
702 m_lnbs[m_lnbidx].m_diseqc_parameters.m_committed_cmd=command;
708 RESULT eDVBSatelliteEquipmentControl::setUncommittedCommand(int command)
710 if ( currentLNBValid() )
711 m_lnbs[m_lnbidx].m_diseqc_parameters.m_uncommitted_cmd = command;
717 RESULT eDVBSatelliteEquipmentControl::setCommandOrder(int order)
719 if ( currentLNBValid() )
720 m_lnbs[m_lnbidx].m_diseqc_parameters.m_command_order=order;
726 RESULT eDVBSatelliteEquipmentControl::setFastDiSEqC(bool onoff)
728 if ( currentLNBValid() )
729 m_lnbs[m_lnbidx].m_diseqc_parameters.m_use_fast=onoff;
735 RESULT eDVBSatelliteEquipmentControl::setSeqRepeat(bool onoff)
737 if ( currentLNBValid() )
738 m_lnbs[m_lnbidx].m_diseqc_parameters.m_seq_repeat = onoff;
744 /* Rotor Specific Parameters */
745 RESULT eDVBSatelliteEquipmentControl::setLongitude(float longitude)
747 if ( currentLNBValid() )
748 m_lnbs[m_lnbidx].m_rotor_parameters.m_gotoxx_parameters.m_longitude=longitude;
754 RESULT eDVBSatelliteEquipmentControl::setLatitude(float latitude)
756 if ( currentLNBValid() )
757 m_lnbs[m_lnbidx].m_rotor_parameters.m_gotoxx_parameters.m_latitude=latitude;
763 RESULT eDVBSatelliteEquipmentControl::setLoDirection(int direction)
765 if ( currentLNBValid() )
766 m_lnbs[m_lnbidx].m_rotor_parameters.m_gotoxx_parameters.m_lo_direction=direction;
772 RESULT eDVBSatelliteEquipmentControl::setLaDirection(int direction)
774 if ( currentLNBValid() )
775 m_lnbs[m_lnbidx].m_rotor_parameters.m_gotoxx_parameters.m_la_direction=direction;
781 RESULT eDVBSatelliteEquipmentControl::setUseInputpower(bool onoff)
783 if ( currentLNBValid() )
784 m_lnbs[m_lnbidx].m_rotor_parameters.m_inputpower_parameters.m_use=onoff;
790 RESULT eDVBSatelliteEquipmentControl::setInputpowerDelta(int delta)
792 if ( currentLNBValid() )
793 m_lnbs[m_lnbidx].m_rotor_parameters.m_inputpower_parameters.m_delta=delta;
799 /* Satellite Specific Parameters */
800 RESULT eDVBSatelliteEquipmentControl::addSatellite(int orbital_position)
802 if ( currentLNBValid() )
804 std::map<int, eDVBSatelliteSwitchParameters>::iterator it =
805 m_lnbs[m_lnbidx].m_satellites.find(orbital_position);
806 if ( it == m_lnbs[m_lnbidx].m_satellites.end() )
808 std::pair<std::map<int, eDVBSatelliteSwitchParameters>::iterator, bool > ret =
809 m_lnbs[m_lnbidx].m_satellites.insert(
810 std::pair<int, eDVBSatelliteSwitchParameters>(orbital_position, eDVBSatelliteSwitchParameters())
813 m_curSat = ret.first;
825 RESULT eDVBSatelliteEquipmentControl::setVoltageMode(int mode)
827 if ( currentLNBValid() && m_curSat != m_lnbs[m_lnbidx].m_satellites.end() )
828 m_curSat->second.m_voltage_mode = (eDVBSatelliteSwitchParameters::t_voltage_mode)mode;
835 RESULT eDVBSatelliteEquipmentControl::setToneMode(int mode)
837 if ( currentLNBValid() )
839 if ( m_curSat != m_lnbs[m_lnbidx].m_satellites.end() )
840 m_curSat->second.m_22khz_signal = (eDVBSatelliteSwitchParameters::t_22khz_signal)mode;
849 RESULT eDVBSatelliteEquipmentControl::setRotorPosNum(int rotor_pos_num)
851 if ( currentLNBValid() )
853 if ( m_curSat != m_lnbs[m_lnbidx].m_satellites.end() )
854 m_curSat->second.m_rotorPosNum=rotor_pos_num;
863 RESULT eDVBSatelliteEquipmentControl::setTunerLinked(int tu1, int tu2)
868 eDVBFrontend *p1=NULL, *p2=NULL;
869 int tmp1=tu1, tmp2=tu2;
871 for (eSmartPtrList<eDVBRegisteredFrontend>::iterator it(m_avail_frontends.begin()); it != m_avail_frontends.end(); ++it)
885 p1->setTone(iDVBFrontend::toneOff);
886 p1->setVoltage(iDVBFrontend::voltageOff);