1 #ifndef __dvb_frontend_h
2 #define __dvb_frontend_h
4 #include <lib/dvb/idvb.h>
6 class eDVBFrontendParameters: public iDVBFrontendParameters
8 DECLARE_REF(eDVBFrontendParameters);
11 eDVBFrontendParametersSatellite sat;
12 eDVBFrontendParametersCable cable;
13 eDVBFrontendParametersTerrestrial terrestrial;
18 eDVBFrontendParameters();
19 ~eDVBFrontendParameters()
23 SWIG_VOID(RESULT) getSystem(int &SWIG_OUTPUT) const;
24 SWIG_VOID(RESULT) getDVBS(eDVBFrontendParametersSatellite &SWIG_OUTPUT) const;
25 SWIG_VOID(RESULT) getDVBC(eDVBFrontendParametersCable &SWIG_OUTPUT) const;
26 SWIG_VOID(RESULT) getDVBT(eDVBFrontendParametersTerrestrial &SWIG_OUTPUT) const;
28 RESULT setDVBS(const eDVBFrontendParametersSatellite &p, bool no_rotor_command_on_tune=false);
29 RESULT setDVBC(const eDVBFrontendParametersCable &p);
30 RESULT setDVBT(const eDVBFrontendParametersTerrestrial &p);
31 SWIG_VOID(RESULT) getFlags(unsigned int &SWIG_NAMED_OUTPUT(flags)) const { flags = m_flags; return 0; }
32 RESULT setFlags(unsigned int flags) { m_flags = flags; return 0; }
34 RESULT calculateDifference(const iDVBFrontendParameters *parm, int &, bool exact) const;
36 RESULT getHash(unsigned long &) const;
37 RESULT calcLockTimeout(unsigned int &) const;
43 #include <lib/dvb/sec.h>
44 class eSecCommandList;
46 class eDVBFrontend: public iDVBFrontend, public Object
53 CSW, // state of the committed switch
54 UCSW, // state of the uncommitted switch
55 TONEBURST, // current state of toneburst switch
56 NEW_ROTOR_CMD, // prev sent rotor cmd
57 NEW_ROTOR_POS, // new rotor position (not validated)
58 ROTOR_CMD, // completed rotor cmd (finalized)
59 ROTOR_POS, // current rotor position
60 LINKED_PREV_PTR, // prev double linked list (for linked FEs)
61 LINKED_NEXT_PTR, // next double linked list (for linked FEs)
62 SATPOS_DEPENDS_PTR, // pointer to FE with configured rotor (with twin/quattro lnb)
63 FREQ_OFFSET, // current frequency offset
64 CUR_VOLTAGE, // current voltage
65 CUR_TONE, // current continuous tone
66 SATCR, // current SatCR
69 Signal1<void,iDVBFrontend*> m_stateChanged;
71 DECLARE_REF(eDVBFrontend);
78 bool m_need_rotor_workaround;
79 bool m_can_handle_dvbs2;
81 char m_description[128];
82 #if HAVE_DVB_API_VERSION < 3
84 char m_sec_filename[128];
86 FRONTENDPARAMETERS parm;
87 int m_cur_orbpos; // only valid when this is a DVB-S tuner
88 int m_cur_pol; // only valid when this is a DVB-S tuner
90 ePtr<iDVBSatelliteEquipmentControl> m_sec;
91 ePtr<eSocketNotifier> m_sn;
93 ePtr<eTimer> m_timeout, m_tuneTimer;
95 eSecCommandList m_sec_sequence;
97 long m_data[NUM_DATA_ENTRIES];
99 int m_idleInputpower[2]; // 13V .. 18V
100 int m_runningInputpower;
102 int m_timeoutCount; // needed for timeout
103 int m_retryCount; // diseqc retry for rotor
107 void tuneLoop(); // called by m_tuneTimer
108 void setFrontend(bool recvEvents=true);
109 bool setSecSequencePos(int steps);
110 static int PriorityOrder;
112 eDVBFrontend(int adap, int fe, int &ok, bool simulate=false);
113 virtual ~eDVBFrontend();
115 int readInputpower();
116 RESULT getFrontendType(int &type);
117 RESULT tune(const iDVBFrontendParameters &where);
118 RESULT prepare_sat(const eDVBFrontendParametersSatellite &, unsigned int timeout);
119 RESULT prepare_cable(const eDVBFrontendParametersCable &);
120 RESULT prepare_terrestrial(const eDVBFrontendParametersTerrestrial &);
121 RESULT connectStateChange(const Slot1<void,iDVBFrontend*> &stateChange, ePtr<eConnection> &connection);
122 RESULT getState(int &state);
123 RESULT setTone(int tone);
124 RESULT setVoltage(int voltage);
125 RESULT sendDiseqc(const eDVBDiseqcCommand &diseqc);
126 RESULT sendToneburst(int burst);
127 RESULT setSEC(iDVBSatelliteEquipmentControl *sec);
128 RESULT setSecSequence(const eSecCommandList &list);
129 RESULT getData(int num, long &data);
130 RESULT setData(int num, long val);
132 int readFrontendData(int type); // bitErrorRate, signalPower, signalQualitydB, signalQuality, locked, synced
133 void getFrontendStatus(ePyObject dest);
134 void getTransponderData(ePyObject dest, bool original);
135 void getFrontendData(ePyObject dest);
137 int isCompatibleWith(ePtr<iDVBFrontendParameters> &feparm);
138 int getDVBID() { return m_dvbid; }
139 int getSlotID() { return m_slotid; }
140 bool setSlotInfo(ePyObject obj); // get a tuple (slotid, slotdescr)
141 static void setTypePriorityOrder(int val) { PriorityOrder = val; }
142 static int getTypePriorityOrder() { return PriorityOrder; }
145 int closeFrontend(bool force=false);
146 const char *getDescription() const { return m_description; }
147 bool is_simulate() const { return m_simulate; }
149 RESULT turnOffSatCR(int satcr);