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
27 int deltaA; // difference in mA between running and stopped rotor
28 int okcount; // counter
29 int steps; // goto steps
48 eDVBDiseqcCommand diseqc;
51 eSecCommand( int cmd )
54 eSecCommand( int cmd, int val )
57 eSecCommand( int cmd, eDVBDiseqcCommand diseqc )
58 :cmd(cmd), diseqc(diseqc)
60 eSecCommand( int cmd, rotor measure )
61 :cmd(cmd), measure(measure)
63 eSecCommand( int cmd, pair compare )
64 :cmd(cmd), compare(compare)
73 typedef std::list<eSecCommand> List;
76 typedef List::iterator iterator;
81 :cur(secSequence.end())
84 void push_front(const eSecCommand &cmd)
86 secSequence.push_front(cmd);
88 void push_back(const eSecCommand &cmd)
90 secSequence.push_back(cmd);
95 cur=secSequence.end();
97 inline iterator ¤t()
101 inline iterator begin()
103 return secSequence.begin();
105 inline iterator end()
107 return secSequence.end();
111 return secSequence.size();
113 operator bool() const
115 return secSequence.size();
120 class eDVBSatelliteDiseqcParameters
123 eDVBSatelliteDiseqcParameters();
124 ~eDVBSatelliteDiseqcParameters();
127 enum { AA=0, AB=1, BA=2, BB=3, SENDNO=4 /* and 0xF0 .. 0xFF*/ }; // DiSEqC Parameter
128 enum t_diseqc_mode { NONE=0, V1_0=1, V1_1=2, V1_2=3, SMATV=4 }; // DiSEqC Mode
129 enum t_toneburst_param { NO=0, A=1, B=2 };
131 __u8 m_committed_cmd;
132 t_diseqc_mode m_diseqc_mode;
133 t_toneburst_param m_toneburst_param;
135 __u8 m_repeats; // for cascaded switches
136 bool m_use_fast; // send no DiSEqC on H/V or Lo/Hi change
137 bool m_seq_repeat; // send the complete DiSEqC Sequence twice...
138 __u8 m_command_order;
140 0) commited, toneburst
141 1) toneburst, committed
143 2) committed, uncommitted, toneburst
144 3) toneburst, committed, uncommitted
145 4) uncommitted, committed, toneburst
146 5) toneburst, uncommitted, committed */
147 __u8 m_uncommitted_cmd; // state of the 4 uncommitted switches..
151 class eDVBSatelliteSwitchParameters
154 eDVBSatelliteSwitchParameters();
155 ~eDVBSatelliteSwitchParameters();
158 enum t_22khz_signal { HILO=0, ON=1, OFF=2 }; // 22 Khz
159 enum t_voltage_mode { HV=0, _14V=1, _18V=2, _0V=3 }; // 14/18 V
161 t_voltage_mode m_voltage_mode;
162 t_22khz_signal m_22khz_signal;
163 __u8 m_rotorPosNum; // 0 is disable.. then use gotoxx
167 class eDVBSatelliteRotorParameters
170 eDVBSatelliteRotorParameters();
171 ~eDVBSatelliteRotorParameters();
174 enum { NORTH, SOUTH, EAST, WEST };
176 eDVBSatelliteRotorParameters() { setDefaultOptions(); }
178 struct eDVBSatelliteRotorInputpowerParameters
180 bool m_use; // can we use rotor inputpower to detect rotor running state ?
181 __u8 m_delta; // delta between running and stopped rotor
183 eDVBSatelliteRotorInputpowerParameters m_inputpower_parameters;
185 struct eDVBSatelliteRotorGotoxxParameters
187 __u8 m_lo_direction; // EAST, WEST
188 __u8 m_la_direction; // NORT, SOUTH
189 double m_longitude; // longitude for gotoXX? function
190 double m_latitude; // latitude for gotoXX? function
192 eDVBSatelliteRotorGotoxxParameters m_gotoxx_parameters;
194 void setDefaultOptions() // set default rotor options
196 m_inputpower_parameters.m_use = true;
197 m_inputpower_parameters.m_delta = 60;
198 m_gotoxx_parameters.m_lo_direction = EAST;
199 m_gotoxx_parameters.m_la_direction = NORTH;
200 m_gotoxx_parameters.m_longitude = 0.0;
201 m_gotoxx_parameters.m_latitude = 0.0;
206 class eDVBSatelliteLNBParameters
209 eDVBSatelliteLNBParameters();
210 ~eDVBSatelliteLNBParameters();
213 enum t_12V_relais_state { OFF=0, ON };
215 t_12V_relais_state m_12V_relais_state; // 12V relais output on/off
217 __u8 tuner_mask; // useable by tuner ( 1 | 2 | 4...)
219 unsigned int m_lof_hi, // for 2 band universal lnb 10600 Mhz (high band offset frequency)
220 m_lof_lo, // for 2 band universal lnb 9750 Mhz (low band offset frequency)
221 m_lof_threshold; // for 2 band universal lnb 11750 Mhz (band switch frequency)
223 bool m_increased_voltage; // use increased voltage ( 14/18V )
225 std::map<int, eDVBSatelliteSwitchParameters> m_satellites;
226 eDVBSatelliteDiseqcParameters m_diseqc_parameters;
227 eDVBSatelliteRotorParameters m_rotor_parameters;
231 class eDVBRegisteredFrontend;
233 class eDVBSatelliteEquipmentControl: public iDVBSatelliteEquipmentControl
236 static eDVBSatelliteEquipmentControl *instance;
237 eDVBSatelliteLNBParameters m_lnbs[128]; // i think its enough
238 int m_lnbidx; // current index for set parameters
239 std::map<int, eDVBSatelliteSwitchParameters>::iterator m_curSat;
240 eSmartPtrList<eDVBRegisteredFrontend> &m_avail_frontends;
244 eDVBSatelliteEquipmentControl();
245 ~eDVBSatelliteEquipmentControl();
247 // helper function for setTunerLinked and setTunerDepends
248 RESULT setDependencyPointers( int no1, int no2, int dest_data_byte );
251 eDVBSatelliteEquipmentControl(eSmartPtrList<eDVBRegisteredFrontend> &avail_frontends);
252 DECLARE_REF(eDVBSatelliteEquipmentControl);
253 RESULT prepare(iDVBFrontend &frontend, FRONTENDPARAMETERS &parm, eDVBFrontendParametersSatellite &sat, int frontend_id);
254 int canTune(const eDVBFrontendParametersSatellite &feparm, iDVBFrontend *, int frontend_id);
255 bool currentLNBValid() { return m_lnbidx > -1 && m_lnbidx < (int)(sizeof(m_lnbs) / sizeof(eDVBSatelliteLNBParameters)); }
257 static eDVBSatelliteEquipmentControl *getInstance() { return instance; }
259 /* LNB Specific Parameters */
261 RESULT setLNBTunerMask(int tunermask);
262 RESULT setLNBLOFL(int lofl);
263 RESULT setLNBLOFH(int lofh);
264 RESULT setLNBThreshold(int threshold);
265 RESULT setLNBIncreasedVoltage(bool onoff);
266 /* DiSEqC Specific Parameters */
267 RESULT setDiSEqCMode(int diseqcmode);
268 RESULT setToneburst(int toneburst);
269 RESULT setRepeats(int repeats);
270 RESULT setCommittedCommand(int command);
271 RESULT setUncommittedCommand(int command);
272 RESULT setCommandOrder(int order);
273 RESULT setFastDiSEqC(bool onoff);
274 RESULT setSeqRepeat(bool onoff); // send the complete switch sequence twice (without rotor command)
275 /* Rotor Specific Parameters */
276 RESULT setLongitude(float longitude);
277 RESULT setLatitude(float latitude);
278 RESULT setLoDirection(int direction);
279 RESULT setLaDirection(int direction);
280 RESULT setUseInputpower(bool onoff);
281 RESULT setInputpowerDelta(int delta); // delta between running and stopped rotor
282 /* Satellite Specific Parameters */
283 RESULT addSatellite(int orbital_position);
284 RESULT setVoltageMode(int mode);
285 RESULT setToneMode(int mode);
286 RESULT setRotorPosNum(int rotor_pos_num);
287 /* Tuner Specific Parameters */
288 RESULT setTunerLinked(int from, int to);
289 RESULT setTunerDepends(int from, int to);
291 void setRotorMoving(bool); // called from the frontend's
292 bool isRotorMoving();