4 #include <lib/dvb/idvb.h>
11 enum { modeStatic, modeDynamic };
13 NONE, SLEEP, SET_VOLTAGE, SET_TONE, GOTO,
14 SEND_DISEQC, SEND_TONEBURST, SET_FRONTEND,
15 SET_TIMEOUT, IF_TIMEOUT_GOTO,
16 IF_VOLTAGE_GOTO, IF_NOT_VOLTAGE_GOTO,
17 SET_POWER_LIMITING_MODE,
18 SET_ROTOR_DISEQC_RETRYS, IF_NO_MORE_ROTOR_DISEQC_RETRYS_GOTO,
19 MEASURE_IDLE_INPUTPOWER, MEASURE_RUNNING_INPUTPOWER,
20 IF_MEASURE_IDLE_WAS_NOT_OK_GOTO, IF_INPUTPOWER_DELTA_GOTO,
21 UPDATE_CURRENT_ROTORPARAMS, INVALIDATE_CURRENT_ROTORPARMS,
22 IF_ROTORPOS_VALID_GOTO,
24 IF_TONE_GOTO, IF_NOT_TONE_GOTO,
30 int deltaA; // difference in mA between running and stopped rotor
31 int okcount; // counter
32 int steps; // goto steps
56 eDVBDiseqcCommand diseqc;
59 eSecCommand( int cmd )
62 eSecCommand( int cmd, int val )
65 eSecCommand( int cmd, eDVBDiseqcCommand diseqc )
66 :cmd(cmd), diseqc(diseqc)
68 eSecCommand( int cmd, rotor measure )
69 :cmd(cmd), measure(measure)
71 eSecCommand( int cmd, pair compare )
72 :cmd(cmd), compare(compare)
81 typedef std::list<eSecCommand> List;
84 typedef List::iterator iterator;
89 :cur(secSequence.end())
92 void push_front(const eSecCommand &cmd)
94 secSequence.push_front(cmd);
96 void push_back(const eSecCommand &cmd)
98 secSequence.push_back(cmd);
103 cur=secSequence.end();
105 inline iterator ¤t()
109 inline iterator begin()
111 return secSequence.begin();
113 inline iterator end()
115 return secSequence.end();
119 return secSequence.size();
121 operator bool() const
123 return secSequence.size();
128 class eDVBSatelliteDiseqcParameters
131 eDVBSatelliteDiseqcParameters();
132 ~eDVBSatelliteDiseqcParameters();
135 enum { AA=0, AB=1, BA=2, BB=3, SENDNO=4 /* and 0xF0 .. 0xFF*/ }; // DiSEqC Parameter
136 enum t_diseqc_mode { NONE=0, V1_0=1, V1_1=2, V1_2=3, SMATV=4 }; // DiSEqC Mode
137 enum t_toneburst_param { NO=0, A=1, B=2 };
139 __u8 m_committed_cmd;
140 t_diseqc_mode m_diseqc_mode;
141 t_toneburst_param m_toneburst_param;
143 __u8 m_repeats; // for cascaded switches
144 bool m_use_fast; // send no DiSEqC on H/V or Lo/Hi change
145 bool m_seq_repeat; // send the complete DiSEqC Sequence twice...
146 __u8 m_command_order;
148 0) commited, toneburst
149 1) toneburst, committed
151 2) committed, uncommitted, toneburst
152 3) toneburst, committed, uncommitted
153 4) uncommitted, committed, toneburst
154 5) toneburst, uncommitted, committed */
155 __u8 m_uncommitted_cmd; // state of the 4 uncommitted switches..
159 class eDVBSatelliteSwitchParameters
162 eDVBSatelliteSwitchParameters();
163 ~eDVBSatelliteSwitchParameters();
166 enum t_22khz_signal { HILO=0, ON=1, OFF=2 }; // 22 Khz
167 enum t_voltage_mode { HV=0, _14V=1, _18V=2, _0V=3 }; // 14/18 V
169 t_voltage_mode m_voltage_mode;
170 t_22khz_signal m_22khz_signal;
171 __u8 m_rotorPosNum; // 0 is disable.. then use gotoxx
175 class eDVBSatelliteRotorParameters
178 eDVBSatelliteRotorParameters();
179 ~eDVBSatelliteRotorParameters();
182 enum { NORTH, SOUTH, EAST, WEST };
184 eDVBSatelliteRotorParameters() { setDefaultOptions(); }
186 struct eDVBSatelliteRotorInputpowerParameters
188 bool m_use; // can we use rotor inputpower to detect rotor running state ?
189 __u8 m_delta; // delta between running and stopped rotor
191 eDVBSatelliteRotorInputpowerParameters m_inputpower_parameters;
193 struct eDVBSatelliteRotorGotoxxParameters
195 __u8 m_lo_direction; // EAST, WEST
196 __u8 m_la_direction; // NORT, SOUTH
197 double m_longitude; // longitude for gotoXX? function
198 double m_latitude; // latitude for gotoXX? function
200 eDVBSatelliteRotorGotoxxParameters m_gotoxx_parameters;
202 void setDefaultOptions() // set default rotor options
204 m_inputpower_parameters.m_use = true;
205 m_inputpower_parameters.m_delta = 60;
206 m_gotoxx_parameters.m_lo_direction = EAST;
207 m_gotoxx_parameters.m_la_direction = NORTH;
208 m_gotoxx_parameters.m_longitude = 0.0;
209 m_gotoxx_parameters.m_latitude = 0.0;
214 class eDVBSatelliteLNBParameters
217 eDVBSatelliteLNBParameters();
218 ~eDVBSatelliteLNBParameters();
221 enum t_12V_relais_state { OFF=0, ON };
223 t_12V_relais_state m_12V_relais_state; // 12V relais output on/off
225 __u8 tuner_mask; // useable by tuner ( 1 | 2 | 4...)
227 unsigned int m_lof_hi, // for 2 band universal lnb 10600 Mhz (high band offset frequency)
228 m_lof_lo, // for 2 band universal lnb 9750 Mhz (low band offset frequency)
229 m_lof_threshold; // for 2 band universal lnb 11750 Mhz (band switch frequency)
231 bool m_increased_voltage; // use increased voltage ( 14/18V )
233 std::map<int, eDVBSatelliteSwitchParameters> m_satellites;
234 eDVBSatelliteDiseqcParameters m_diseqc_parameters;
235 eDVBSatelliteRotorParameters m_rotor_parameters;
239 class eDVBRegisteredFrontend;
241 class eDVBSatelliteEquipmentControl: public iDVBSatelliteEquipmentControl
244 static eDVBSatelliteEquipmentControl *instance;
245 eDVBSatelliteLNBParameters m_lnbs[128]; // i think its enough
246 int m_lnbidx; // current index for set parameters
247 std::map<int, eDVBSatelliteSwitchParameters>::iterator m_curSat;
248 eSmartPtrList<eDVBRegisteredFrontend> &m_avail_frontends;
252 eDVBSatelliteEquipmentControl();
253 ~eDVBSatelliteEquipmentControl();
257 eDVBSatelliteEquipmentControl(eSmartPtrList<eDVBRegisteredFrontend> &avail_frontends);
258 DECLARE_REF(eDVBSatelliteEquipmentControl);
259 RESULT prepare(iDVBFrontend &frontend, FRONTENDPARAMETERS &parm, const eDVBFrontendParametersSatellite &sat, int frontend_id);
260 int canTune(const eDVBFrontendParametersSatellite &feparm, iDVBFrontend *, int frontend_id);
261 bool currentLNBValid() { return m_lnbidx > -1 && m_lnbidx < (int)(sizeof(m_lnbs) / sizeof(eDVBSatelliteLNBParameters)); }
263 static eDVBSatelliteEquipmentControl *getInstance() { return instance; }
265 /* LNB Specific Parameters */
267 RESULT setLNBTunerMask(int tunermask);
268 RESULT setLNBLOFL(int lofl);
269 RESULT setLNBLOFH(int lofh);
270 RESULT setLNBThreshold(int threshold);
271 RESULT setLNBIncreasedVoltage(bool onoff);
272 /* DiSEqC Specific Parameters */
273 RESULT setDiSEqCMode(int diseqcmode);
274 RESULT setToneburst(int toneburst);
275 RESULT setRepeats(int repeats);
276 RESULT setCommittedCommand(int command);
277 RESULT setUncommittedCommand(int command);
278 RESULT setCommandOrder(int order);
279 RESULT setFastDiSEqC(bool onoff);
280 RESULT setSeqRepeat(bool onoff); // send the complete switch sequence twice (without rotor command)
281 /* Rotor Specific Parameters */
282 RESULT setLongitude(float longitude);
283 RESULT setLatitude(float latitude);
284 RESULT setLoDirection(int direction);
285 RESULT setLaDirection(int direction);
286 RESULT setUseInputpower(bool onoff);
287 RESULT setInputpowerDelta(int delta); // delta between running and stopped rotor
288 /* Satellite Specific Parameters */
289 RESULT addSatellite(int orbital_position);
290 RESULT setVoltageMode(int mode);
291 RESULT setToneMode(int mode);
292 RESULT setRotorPosNum(int rotor_pos_num);
293 /* Tuner Specific Parameters */
294 RESULT setTunerLinked(int from, int to);
295 RESULT setTunerDepends(int from, int to);
297 PyObject *get_exclusive_satellites(int tu1, int tu2);
298 void setRotorMoving(bool); // called from the frontend's
299 bool isRotorMoving();