5 #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();
112 class eDVBSatelliteDiseqcParameters
115 enum { AA=0, AB=1, BA=2, BB=3, SENDNO=4 /* and 0xF0 .. 0xFF*/ }; // DiSEqC Parameter
116 __u8 m_committed_cmd;
118 enum t_diseqc_mode { NONE=0, V1_0=1, V1_1=2, V1_2=3, SMATV=4 }; // DiSEqC Mode
119 t_diseqc_mode m_diseqc_mode;
121 enum t_toneburst_param { NO=0, A=1, B=2 };
122 t_toneburst_param m_toneburst_param;
124 __u8 m_repeats; // for cascaded switches
125 bool m_use_fast; // send no DiSEqC on H/V or Lo/Hi change
126 bool m_seq_repeat; // send the complete DiSEqC Sequence twice...
127 __u8 m_command_order;
129 0) commited, toneburst
130 1) toneburst, committed
132 2) committed, uncommitted, toneburst
133 3) toneburst, committed, uncommitted
134 4) uncommitted, committed, toneburst
135 5) toneburst, uncommitted, committed */
136 __u8 m_uncommitted_cmd; // state of the 4 uncommitted switches..
139 class eDVBSatelliteSwitchParameters
142 enum t_22khz_signal { HILO=0, ON=1, OFF=2 }; // 22 Khz
143 enum t_voltage_mode { HV=0, _14V=1, _18V=2, _0V=3 }; // 14/18 V
144 t_voltage_mode m_voltage_mode;
145 t_22khz_signal m_22khz_signal;
146 __u8 m_rotorPosNum; // 0 is disable.. then use gotoxx
149 class eDVBSatelliteRotorParameters
152 enum { NORTH, SOUTH, EAST, WEST };
154 eDVBSatelliteRotorParameters() { setDefaultOptions(); }
156 struct eDVBSatelliteRotorInputpowerParameters
158 bool m_use; // can we use rotor inputpower to detect rotor running state ?
159 __u8 m_delta; // delta between running and stopped rotor
161 eDVBSatelliteRotorInputpowerParameters m_inputpower_parameters;
163 struct eDVBSatelliteRotorGotoxxParameters
165 __u8 m_lo_direction; // EAST, WEST
166 __u8 m_la_direction; // NORT, SOUTH
167 double m_longitude; // longitude for gotoXX° function
168 double m_latitude; // latitude for gotoXX° function
170 eDVBSatelliteRotorGotoxxParameters m_gotoxx_parameters;
172 void setDefaultOptions() // set default rotor options
174 m_inputpower_parameters.m_use = true;
175 m_inputpower_parameters.m_delta = 60;
176 m_gotoxx_parameters.m_lo_direction = EAST;
177 m_gotoxx_parameters.m_la_direction = NORTH;
178 m_gotoxx_parameters.m_longitude = 0.0;
179 m_gotoxx_parameters.m_latitude = 0.0;
183 class eDVBSatelliteLNBParameters
186 enum t_12V_relais_state { OFF=0, ON };
187 t_12V_relais_state m_12V_relais_state; // 12V relais output on/off
189 __u8 tuner_mask; // useable by tuner ( 1 | 2 | 4...)
191 unsigned int m_lof_hi, // for 2 band universal lnb 10600 Mhz (high band offset frequency)
192 m_lof_lo, // for 2 band universal lnb 9750 Mhz (low band offset frequency)
193 m_lof_threshold; // for 2 band universal lnb 11750 Mhz (band switch frequency)
195 bool m_increased_voltage; // use increased voltage ( 14/18V )
197 std::map<int, eDVBSatelliteSwitchParameters> m_satellites;
198 eDVBSatelliteDiseqcParameters m_diseqc_parameters;
199 eDVBSatelliteRotorParameters m_rotor_parameters;
202 class eDVBSatelliteEquipmentControl: public iDVBSatelliteEquipmentControl
204 eDVBSatelliteLNBParameters m_lnbs[128]; // i think its enough
205 int m_lnbidx; // current index for set parameters
206 std::map<int, eDVBSatelliteSwitchParameters>::iterator m_curSat;
208 DECLARE_REF(eDVBSatelliteEquipmentControl);
209 eDVBSatelliteEquipmentControl();
210 RESULT prepare(iDVBFrontend &frontend, FRONTENDPARAMETERS &parm, eDVBFrontendParametersSatellite &sat);
212 bool currentLNBValid() { return m_lnbidx > -1 && m_lnbidx < (int)(sizeof(m_lnbs) / sizeof(eDVBSatelliteLNBParameters)); }
214 /* LNB Specific Parameters */
216 RESULT setLNBTunerMask(int tunermask);
217 RESULT setLNBLOFL(int lofl);
218 RESULT setLNBLOFH(int lofh);
219 RESULT setLNBThreshold(int threshold);
220 RESULT setLNBIncreasedVoltage(bool onoff);
221 /* DiSEqC Specific Parameters */
222 RESULT setDiSEqCMode(int diseqcmode);
223 RESULT setToneburst(int toneburst);
224 RESULT setRepeats(int repeats);
225 RESULT setCommittedCommand(int command);
226 RESULT setUncommittedCommand(int command);
227 RESULT setCommandOrder(int order);
228 RESULT setFastDiSEqC(bool onoff);
229 /* Rotor Specific Parameters */
230 RESULT setLongitude(float longitude);
231 RESULT setLatitude(float latitude);
232 RESULT setLoDirection(int direction);
233 RESULT setLaDirection(int direction);
234 RESULT setUseInputpower(bool onoff);
235 RESULT setInputpowerDelta(int delta); // delta between running and stopped rotor
236 /* Satellite Specific Parameters */
237 RESULT addSatellite(int orbital_position);
238 RESULT setVoltageMode(int mode);
239 RESULT setToneMode(int mode);
240 RESULT setRotorPosNum(int rotor_pos_num);