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 MEASURE_IDLE_INPUTPOWER, MEASURE_RUNNING_INPUTPOWER,
16 IF_TIMEOUT_GOTO, IF_INPUTPOWER_DELTA_GOTO,
17 UPDATE_CURRENT_ROTORPARAMS, SET_TIMEOUT,
18 IF_IDLE_INPUTPOWER_AVAIL_GOTO, SET_POWER_LIMITING_MODE,
24 int deltaA; // difference in mA between running and stopped rotor
25 int okcount; // counter
26 int steps; // goto steps
45 eDVBDiseqcCommand diseqc;
48 eSecCommand( int cmd )
51 eSecCommand( int cmd, int val )
54 eSecCommand( int cmd, eDVBDiseqcCommand diseqc )
55 :cmd(cmd), diseqc(diseqc)
57 eSecCommand( int cmd, rotor measure )
58 :cmd(cmd), measure(measure)
60 eSecCommand( int cmd, pair compare )
61 :cmd(cmd), compare(compare)
70 std::list<eSecCommand> secSequence;
71 std::list<eSecCommand>::iterator cur;
74 :cur(secSequence.end())
77 void push_front(const eSecCommand &cmd)
79 secSequence.push_front(cmd);
81 void push_back(const eSecCommand &cmd)
83 secSequence.push_back(cmd);
88 cur=secSequence.end();
90 inline std::list<eSecCommand>::iterator ¤t()
94 inline std::list<eSecCommand>::iterator begin()
96 return secSequence.begin();
98 inline std::list<eSecCommand>::iterator end()
100 return secSequence.end();
104 return secSequence.size();
106 operator bool() const
108 return secSequence.size();
113 class eDVBSatelliteDiseqcParameters
116 eDVBSatelliteDiseqcParameters();
117 ~eDVBSatelliteDiseqcParameters();
120 enum { AA=0, AB=1, BA=2, BB=3, SENDNO=4 /* and 0xF0 .. 0xFF*/ }; // DiSEqC Parameter
121 enum t_diseqc_mode { NONE=0, V1_0=1, V1_1=2, V1_2=3, SMATV=4 }; // DiSEqC Mode
122 enum t_toneburst_param { NO=0, A=1, B=2 };
124 __u8 m_committed_cmd;
125 t_diseqc_mode m_diseqc_mode;
126 t_toneburst_param m_toneburst_param;
128 __u8 m_repeats; // for cascaded switches
129 bool m_use_fast; // send no DiSEqC on H/V or Lo/Hi change
130 bool m_seq_repeat; // send the complete DiSEqC Sequence twice...
131 __u8 m_command_order;
133 0) commited, toneburst
134 1) toneburst, committed
136 2) committed, uncommitted, toneburst
137 3) toneburst, committed, uncommitted
138 4) uncommitted, committed, toneburst
139 5) toneburst, uncommitted, committed */
140 __u8 m_uncommitted_cmd; // state of the 4 uncommitted switches..
144 class eDVBSatelliteSwitchParameters
147 eDVBSatelliteSwitchParameters();
148 ~eDVBSatelliteSwitchParameters();
151 enum t_22khz_signal { HILO=0, ON=1, OFF=2 }; // 22 Khz
152 enum t_voltage_mode { HV=0, _14V=1, _18V=2, _0V=3 }; // 14/18 V
154 t_voltage_mode m_voltage_mode;
155 t_22khz_signal m_22khz_signal;
156 __u8 m_rotorPosNum; // 0 is disable.. then use gotoxx
160 class eDVBSatelliteRotorParameters
163 eDVBSatelliteRotorParameters();
164 ~eDVBSatelliteRotorParameters();
167 enum { NORTH, SOUTH, EAST, WEST };
169 eDVBSatelliteRotorParameters() { setDefaultOptions(); }
171 struct eDVBSatelliteRotorInputpowerParameters
173 bool m_use; // can we use rotor inputpower to detect rotor running state ?
174 __u8 m_delta; // delta between running and stopped rotor
176 eDVBSatelliteRotorInputpowerParameters m_inputpower_parameters;
178 struct eDVBSatelliteRotorGotoxxParameters
180 __u8 m_lo_direction; // EAST, WEST
181 __u8 m_la_direction; // NORT, SOUTH
182 double m_longitude; // longitude for gotoXX? function
183 double m_latitude; // latitude for gotoXX? function
185 eDVBSatelliteRotorGotoxxParameters m_gotoxx_parameters;
187 void setDefaultOptions() // set default rotor options
189 m_inputpower_parameters.m_use = true;
190 m_inputpower_parameters.m_delta = 60;
191 m_gotoxx_parameters.m_lo_direction = EAST;
192 m_gotoxx_parameters.m_la_direction = NORTH;
193 m_gotoxx_parameters.m_longitude = 0.0;
194 m_gotoxx_parameters.m_latitude = 0.0;
199 class eDVBSatelliteLNBParameters
202 eDVBSatelliteLNBParameters();
203 ~eDVBSatelliteLNBParameters();
206 enum t_12V_relais_state { OFF=0, ON };
208 t_12V_relais_state m_12V_relais_state; // 12V relais output on/off
210 __u8 tuner_mask; // useable by tuner ( 1 | 2 | 4...)
212 unsigned int m_lof_hi, // for 2 band universal lnb 10600 Mhz (high band offset frequency)
213 m_lof_lo, // for 2 band universal lnb 9750 Mhz (low band offset frequency)
214 m_lof_threshold; // for 2 band universal lnb 11750 Mhz (band switch frequency)
216 bool m_increased_voltage; // use increased voltage ( 14/18V )
218 std::map<int, eDVBSatelliteSwitchParameters> m_satellites;
219 eDVBSatelliteDiseqcParameters m_diseqc_parameters;
220 eDVBSatelliteRotorParameters m_rotor_parameters;
224 class eDVBRegisteredFrontend;
226 class eDVBSatelliteEquipmentControl: public iDVBSatelliteEquipmentControl
229 static eDVBSatelliteEquipmentControl *instance;
230 eDVBSatelliteLNBParameters m_lnbs[128]; // i think its enough
231 int m_lnbidx; // current index for set parameters
232 std::map<int, eDVBSatelliteSwitchParameters>::iterator m_curSat;
233 eSmartPtrList<eDVBRegisteredFrontend> &m_avail_frontends;
237 eDVBSatelliteEquipmentControl();
238 ~eDVBSatelliteEquipmentControl();
240 // helper function for setTunerLinked and setTunerDepends
241 RESULT setDependencyPointers( int no1, int no2, int dest_data_byte );
244 eDVBSatelliteEquipmentControl(eSmartPtrList<eDVBRegisteredFrontend> &avail_frontends);
245 DECLARE_REF(eDVBSatelliteEquipmentControl);
246 RESULT prepare(iDVBFrontend &frontend, FRONTENDPARAMETERS &parm, eDVBFrontendParametersSatellite &sat, int frontend_id);
247 int canTune(const eDVBFrontendParametersSatellite &feparm, iDVBFrontend *, int frontend_id);
248 bool currentLNBValid() { return m_lnbidx > -1 && m_lnbidx < (int)(sizeof(m_lnbs) / sizeof(eDVBSatelliteLNBParameters)); }
250 static eDVBSatelliteEquipmentControl *getInstance() { return instance; }
252 /* LNB Specific Parameters */
254 RESULT setLNBTunerMask(int tunermask);
255 RESULT setLNBLOFL(int lofl);
256 RESULT setLNBLOFH(int lofh);
257 RESULT setLNBThreshold(int threshold);
258 RESULT setLNBIncreasedVoltage(bool onoff);
259 /* DiSEqC Specific Parameters */
260 RESULT setDiSEqCMode(int diseqcmode);
261 RESULT setToneburst(int toneburst);
262 RESULT setRepeats(int repeats);
263 RESULT setCommittedCommand(int command);
264 RESULT setUncommittedCommand(int command);
265 RESULT setCommandOrder(int order);
266 RESULT setFastDiSEqC(bool onoff);
267 RESULT setSeqRepeat(bool onoff); // send the complete switch sequence twice (without rotor command)
268 /* Rotor Specific Parameters */
269 RESULT setLongitude(float longitude);
270 RESULT setLatitude(float latitude);
271 RESULT setLoDirection(int direction);
272 RESULT setLaDirection(int direction);
273 RESULT setUseInputpower(bool onoff);
274 RESULT setInputpowerDelta(int delta); // delta between running and stopped rotor
275 /* Satellite Specific Parameters */
276 RESULT addSatellite(int orbital_position);
277 RESULT setVoltageMode(int mode);
278 RESULT setToneMode(int mode);
279 RESULT setRotorPosNum(int rotor_pos_num);
280 /* Tuner Specific Parameters */
281 RESULT setTunerLinked(int from, int to);
282 RESULT setTunerDepends(int from, int to);
284 void setRotorMoving(bool); // called from the frontend's
285 bool isRotorMoving();