5 #include <lib/dvb/idvb.h>
12 enum { modeStatic, modeDynamic };
14 NONE, SLEEP, SET_VOLTAGE, SET_TONE, GOTO,
15 SEND_DISEQC, SEND_TONEBURST, SET_FRONTEND,
16 MEASURE_IDLE_INPUTPOWER, MEASURE_RUNNING_INPUTPOWER,
17 IF_TIMEOUT_GOTO, IF_INPUTPOWER_DELTA_GOTO,
18 UPDATE_CURRENT_ROTORPARAMS, SET_TIMEOUT,
19 IF_IDLE_INPUTPOWER_AVAIL_GOTO, SET_POWER_LIMITING_MODE,
25 int deltaA; // difference in mA between running and stopped rotor
26 int okcount; // counter
27 int steps; // goto steps
46 eDVBDiseqcCommand diseqc;
49 eSecCommand( int cmd )
52 eSecCommand( int cmd, int val )
55 eSecCommand( int cmd, eDVBDiseqcCommand diseqc )
56 :cmd(cmd), diseqc(diseqc)
58 eSecCommand( int cmd, rotor measure )
59 :cmd(cmd), measure(measure)
61 eSecCommand( int cmd, pair compare )
62 :cmd(cmd), compare(compare)
71 std::list<eSecCommand> secSequence;
72 std::list<eSecCommand>::iterator cur;
75 :cur(secSequence.end())
78 void push_front(const eSecCommand &cmd)
80 secSequence.push_front(cmd);
82 void push_back(const eSecCommand &cmd)
84 secSequence.push_back(cmd);
89 cur=secSequence.end();
91 inline std::list<eSecCommand>::iterator ¤t()
95 inline std::list<eSecCommand>::iterator begin()
97 return secSequence.begin();
99 inline std::list<eSecCommand>::iterator end()
101 return secSequence.end();
105 return secSequence.size();
107 operator bool() const
109 return secSequence.size();
113 class eDVBSatelliteDiseqcParameters
116 enum { AA=0, AB=1, BA=2, BB=3, SENDNO=4 /* and 0xF0 .. 0xFF*/ }; // DiSEqC Parameter
117 __u8 m_committed_cmd;
119 enum t_diseqc_mode { NONE=0, V1_0=1, V1_1=2, V1_2=3, SMATV=4 }; // DiSEqC Mode
120 t_diseqc_mode m_diseqc_mode;
122 enum t_toneburst_param { NO=0, A=1, B=2 };
123 t_toneburst_param m_toneburst_param;
125 __u8 m_repeats; // for cascaded switches
126 bool m_use_fast; // send no DiSEqC on H/V or Lo/Hi change
127 bool m_seq_repeat; // send the complete DiSEqC Sequence twice...
128 __u8 m_command_order;
130 0) commited, toneburst
131 1) toneburst, committed
133 2) committed, uncommitted, toneburst
134 3) toneburst, committed, uncommitted
135 4) uncommitted, committed, toneburst
136 5) toneburst, uncommitted, committed */
137 __u8 m_uncommitted_cmd; // state of the 4 uncommitted switches..
140 class eDVBSatelliteSwitchParameters
143 enum t_22khz_signal { HILO=0, ON=1, OFF=2 }; // 22 Khz
144 enum t_voltage_mode { HV=0, _14V=1, _18V=2, _0V=3 }; // 14/18 V
145 t_voltage_mode m_voltage_mode;
146 t_22khz_signal m_22khz_signal;
147 __u8 m_rotorPosNum; // 0 is disable.. then use gotoxx
150 class eDVBSatelliteRotorParameters
153 enum { NORTH, SOUTH, EAST, WEST };
155 eDVBSatelliteRotorParameters() { setDefaultOptions(); }
157 struct eDVBSatelliteRotorInputpowerParameters
159 bool m_use; // can we use rotor inputpower to detect rotor running state ?
160 __u8 m_delta; // delta between running and stopped rotor
162 eDVBSatelliteRotorInputpowerParameters m_inputpower_parameters;
164 struct eDVBSatelliteRotorGotoxxParameters
166 __u8 m_lo_direction; // EAST, WEST
167 __u8 m_la_direction; // NORT, SOUTH
168 double m_longitude; // longitude for gotoXX° function
169 double m_latitude; // latitude for gotoXX° function
171 eDVBSatelliteRotorGotoxxParameters m_gotoxx_parameters;
173 void setDefaultOptions() // set default rotor options
175 m_inputpower_parameters.m_use = true;
176 m_inputpower_parameters.m_delta = 60;
177 m_gotoxx_parameters.m_lo_direction = EAST;
178 m_gotoxx_parameters.m_la_direction = NORTH;
179 m_gotoxx_parameters.m_longitude = 0.0;
180 m_gotoxx_parameters.m_latitude = 0.0;
184 class eDVBSatelliteLNBParameters
187 enum t_12V_relais_state { OFF=0, ON };
188 t_12V_relais_state m_12V_relais_state; // 12V relais output on/off
190 __u8 tuner_mask; // useable by tuner ( 1 | 2 | 4...)
192 unsigned int m_lof_hi, // for 2 band universal lnb 10600 Mhz (high band offset frequency)
193 m_lof_lo, // for 2 band universal lnb 9750 Mhz (low band offset frequency)
194 m_lof_threshold; // for 2 band universal lnb 11750 Mhz (band switch frequency)
196 bool m_increased_voltage; // use increased voltage ( 14/18V )
198 std::map<int, eDVBSatelliteSwitchParameters> m_satellites;
199 eDVBSatelliteDiseqcParameters m_diseqc_parameters;
200 eDVBSatelliteRotorParameters m_rotor_parameters;
204 class eDVBSatelliteEquipmentControl: public iDVBSatelliteEquipmentControl
207 static eDVBSatelliteEquipmentControl *instance;
208 eDVBSatelliteLNBParameters m_lnbs[128]; // i think its enough
209 int m_lnbidx; // current index for set parameters
210 std::map<int, eDVBSatelliteSwitchParameters>::iterator m_curSat;
214 DECLARE_REF(eDVBSatelliteEquipmentControl);
215 eDVBSatelliteEquipmentControl();
216 RESULT prepare(iDVBFrontend &frontend, FRONTENDPARAMETERS &parm, eDVBFrontendParametersSatellite &sat, int frontend_id);
217 int canTune(const eDVBFrontendParametersSatellite &feparm, iDVBFrontend *, int frontend_id);
218 bool currentLNBValid() { return m_lnbidx > -1 && m_lnbidx < (int)(sizeof(m_lnbs) / sizeof(eDVBSatelliteLNBParameters)); }
220 static eDVBSatelliteEquipmentControl *getInstance() { return instance; }
222 /* LNB Specific Parameters */
224 RESULT setLNBTunerMask(int tunermask);
225 RESULT setLNBLOFL(int lofl);
226 RESULT setLNBLOFH(int lofh);
227 RESULT setLNBThreshold(int threshold);
228 RESULT setLNBIncreasedVoltage(bool onoff);
229 /* DiSEqC Specific Parameters */
230 RESULT setDiSEqCMode(int diseqcmode);
231 RESULT setToneburst(int toneburst);
232 RESULT setRepeats(int repeats);
233 RESULT setCommittedCommand(int command);
234 RESULT setUncommittedCommand(int command);
235 RESULT setCommandOrder(int order);
236 RESULT setFastDiSEqC(bool onoff);
237 RESULT setSeqRepeat(bool onoff); // send the complete switch sequence twice (without rotor command)
238 /* Rotor Specific Parameters */
239 RESULT setLongitude(float longitude);
240 RESULT setLatitude(float latitude);
241 RESULT setLoDirection(int direction);
242 RESULT setLaDirection(int direction);
243 RESULT setUseInputpower(bool onoff);
244 RESULT setInputpowerDelta(int delta); // delta between running and stopped rotor
245 /* Satellite Specific Parameters */
246 RESULT addSatellite(int orbital_position);
247 RESULT setVoltageMode(int mode);
248 RESULT setToneMode(int mode);
249 RESULT setRotorPosNum(int rotor_pos_num);