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,
29 int deltaA; // difference in mA between running and stopped rotor
30 int okcount; // counter
31 int steps; // goto steps
50 eDVBDiseqcCommand diseqc;
53 eSecCommand( int cmd )
56 eSecCommand( int cmd, int val )
59 eSecCommand( int cmd, eDVBDiseqcCommand diseqc )
60 :cmd(cmd), diseqc(diseqc)
62 eSecCommand( int cmd, rotor measure )
63 :cmd(cmd), measure(measure)
65 eSecCommand( int cmd, pair compare )
66 :cmd(cmd), compare(compare)
75 typedef std::list<eSecCommand> List;
78 typedef List::iterator iterator;
83 :cur(secSequence.end())
86 void push_front(const eSecCommand &cmd)
88 secSequence.push_front(cmd);
90 void push_back(const eSecCommand &cmd)
92 secSequence.push_back(cmd);
97 cur=secSequence.end();
99 inline iterator ¤t()
103 inline iterator begin()
105 return secSequence.begin();
107 inline iterator end()
109 return secSequence.end();
113 return secSequence.size();
115 operator bool() const
117 return secSequence.size();
122 class eDVBSatelliteDiseqcParameters
125 eDVBSatelliteDiseqcParameters();
126 ~eDVBSatelliteDiseqcParameters();
129 enum { AA=0, AB=1, BA=2, BB=3, SENDNO=4 /* and 0xF0 .. 0xFF*/ }; // DiSEqC Parameter
130 enum t_diseqc_mode { NONE=0, V1_0=1, V1_1=2, V1_2=3, SMATV=4 }; // DiSEqC Mode
131 enum t_toneburst_param { NO=0, A=1, B=2 };
133 __u8 m_committed_cmd;
134 t_diseqc_mode m_diseqc_mode;
135 t_toneburst_param m_toneburst_param;
137 __u8 m_repeats; // for cascaded switches
138 bool m_use_fast; // send no DiSEqC on H/V or Lo/Hi change
139 bool m_seq_repeat; // send the complete DiSEqC Sequence twice...
140 __u8 m_command_order;
142 0) commited, toneburst
143 1) toneburst, committed
145 2) committed, uncommitted, toneburst
146 3) toneburst, committed, uncommitted
147 4) uncommitted, committed, toneburst
148 5) toneburst, uncommitted, committed */
149 __u8 m_uncommitted_cmd; // state of the 4 uncommitted switches..
153 class eDVBSatelliteSwitchParameters
156 eDVBSatelliteSwitchParameters();
157 ~eDVBSatelliteSwitchParameters();
160 enum t_22khz_signal { HILO=0, ON=1, OFF=2 }; // 22 Khz
161 enum t_voltage_mode { HV=0, _14V=1, _18V=2, _0V=3 }; // 14/18 V
163 t_voltage_mode m_voltage_mode;
164 t_22khz_signal m_22khz_signal;
165 __u8 m_rotorPosNum; // 0 is disable.. then use gotoxx
169 class eDVBSatelliteRotorParameters
172 eDVBSatelliteRotorParameters();
173 ~eDVBSatelliteRotorParameters();
176 enum { NORTH, SOUTH, EAST, WEST };
178 eDVBSatelliteRotorParameters() { setDefaultOptions(); }
180 struct eDVBSatelliteRotorInputpowerParameters
182 bool m_use; // can we use rotor inputpower to detect rotor running state ?
183 __u8 m_delta; // delta between running and stopped rotor
185 eDVBSatelliteRotorInputpowerParameters m_inputpower_parameters;
187 struct eDVBSatelliteRotorGotoxxParameters
189 __u8 m_lo_direction; // EAST, WEST
190 __u8 m_la_direction; // NORT, SOUTH
191 double m_longitude; // longitude for gotoXX? function
192 double m_latitude; // latitude for gotoXX? function
194 eDVBSatelliteRotorGotoxxParameters m_gotoxx_parameters;
196 void setDefaultOptions() // set default rotor options
198 m_inputpower_parameters.m_use = true;
199 m_inputpower_parameters.m_delta = 60;
200 m_gotoxx_parameters.m_lo_direction = EAST;
201 m_gotoxx_parameters.m_la_direction = NORTH;
202 m_gotoxx_parameters.m_longitude = 0.0;
203 m_gotoxx_parameters.m_latitude = 0.0;
208 class eDVBSatelliteLNBParameters
211 eDVBSatelliteLNBParameters();
212 ~eDVBSatelliteLNBParameters();
215 enum t_12V_relais_state { OFF=0, ON };
217 t_12V_relais_state m_12V_relais_state; // 12V relais output on/off
219 __u8 tuner_mask; // useable by tuner ( 1 | 2 | 4...)
221 unsigned int m_lof_hi, // for 2 band universal lnb 10600 Mhz (high band offset frequency)
222 m_lof_lo, // for 2 band universal lnb 9750 Mhz (low band offset frequency)
223 m_lof_threshold; // for 2 band universal lnb 11750 Mhz (band switch frequency)
225 bool m_increased_voltage; // use increased voltage ( 14/18V )
227 std::map<int, eDVBSatelliteSwitchParameters> m_satellites;
228 eDVBSatelliteDiseqcParameters m_diseqc_parameters;
229 eDVBSatelliteRotorParameters m_rotor_parameters;
233 class eDVBRegisteredFrontend;
235 class eDVBSatelliteEquipmentControl: public iDVBSatelliteEquipmentControl
238 static eDVBSatelliteEquipmentControl *instance;
239 eDVBSatelliteLNBParameters m_lnbs[128]; // i think its enough
240 int m_lnbidx; // current index for set parameters
241 std::map<int, eDVBSatelliteSwitchParameters>::iterator m_curSat;
242 eSmartPtrList<eDVBRegisteredFrontend> &m_avail_frontends;
246 eDVBSatelliteEquipmentControl();
247 ~eDVBSatelliteEquipmentControl();
249 // helper function for setTunerLinked and setTunerDepends
250 RESULT setDependencyPointers( int no1, int no2, int dest_data_byte );
253 eDVBSatelliteEquipmentControl(eSmartPtrList<eDVBRegisteredFrontend> &avail_frontends);
254 DECLARE_REF(eDVBSatelliteEquipmentControl);
255 RESULT prepare(iDVBFrontend &frontend, FRONTENDPARAMETERS &parm, const eDVBFrontendParametersSatellite &sat, int frontend_id);
256 int canTune(const eDVBFrontendParametersSatellite &feparm, iDVBFrontend *, int frontend_id);
257 bool currentLNBValid() { return m_lnbidx > -1 && m_lnbidx < (int)(sizeof(m_lnbs) / sizeof(eDVBSatelliteLNBParameters)); }
259 static eDVBSatelliteEquipmentControl *getInstance() { return instance; }
261 /* LNB Specific Parameters */
263 RESULT setLNBTunerMask(int tunermask);
264 RESULT setLNBLOFL(int lofl);
265 RESULT setLNBLOFH(int lofh);
266 RESULT setLNBThreshold(int threshold);
267 RESULT setLNBIncreasedVoltage(bool onoff);
268 /* DiSEqC Specific Parameters */
269 RESULT setDiSEqCMode(int diseqcmode);
270 RESULT setToneburst(int toneburst);
271 RESULT setRepeats(int repeats);
272 RESULT setCommittedCommand(int command);
273 RESULT setUncommittedCommand(int command);
274 RESULT setCommandOrder(int order);
275 RESULT setFastDiSEqC(bool onoff);
276 RESULT setSeqRepeat(bool onoff); // send the complete switch sequence twice (without rotor command)
277 /* Rotor Specific Parameters */
278 RESULT setLongitude(float longitude);
279 RESULT setLatitude(float latitude);
280 RESULT setLoDirection(int direction);
281 RESULT setLaDirection(int direction);
282 RESULT setUseInputpower(bool onoff);
283 RESULT setInputpowerDelta(int delta); // delta between running and stopped rotor
284 /* Satellite Specific Parameters */
285 RESULT addSatellite(int orbital_position);
286 RESULT setVoltageMode(int mode);
287 RESULT setToneMode(int mode);
288 RESULT setRotorPosNum(int rotor_pos_num);
289 /* Tuner Specific Parameters */
290 RESULT setTunerLinked(int from, int to);
291 RESULT setTunerDepends(int from, int to);
293 void setRotorMoving(bool); // called from the frontend's
294 bool isRotorMoving();