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);
79 bool m_need_rotor_workaround;
80 bool m_can_handle_dvbs2;
82 char m_description[128];
83 #if HAVE_DVB_API_VERSION < 3
85 char m_sec_filename[128];
87 FRONTENDPARAMETERS parm;
89 eDVBFrontendParametersSatellite sat;
90 eDVBFrontendParametersCable cab;
91 eDVBFrontendParametersTerrestrial ter;
95 ePtr<iDVBSatelliteEquipmentControl> m_sec;
96 ePtr<eSocketNotifier> m_sn;
98 ePtr<eTimer> m_timeout, m_tuneTimer;
100 eSecCommandList m_sec_sequence;
102 long m_data[NUM_DATA_ENTRIES];
104 int m_idleInputpower[2]; // 13V .. 18V
105 int m_runningInputpower;
107 int m_timeoutCount; // needed for timeout
108 int m_retryCount; // diseqc retry for rotor
112 void tuneLoop(); // called by m_tuneTimer
113 void setFrontend(bool recvEvents=true);
114 bool setSecSequencePos(int steps);
115 static int PriorityOrder;
117 eDVBFrontend(int adap, int fe, int &ok, bool simulate=false);
118 virtual ~eDVBFrontend();
120 int readInputpower();
121 RESULT getFrontendType(int &type);
122 RESULT tune(const iDVBFrontendParameters &where);
123 RESULT prepare_sat(const eDVBFrontendParametersSatellite &, unsigned int timeout);
124 RESULT prepare_cable(const eDVBFrontendParametersCable &);
125 RESULT prepare_terrestrial(const eDVBFrontendParametersTerrestrial &);
126 RESULT connectStateChange(const Slot1<void,iDVBFrontend*> &stateChange, ePtr<eConnection> &connection);
127 RESULT getState(int &state);
128 RESULT setTone(int tone);
129 RESULT setVoltage(int voltage);
130 RESULT sendDiseqc(const eDVBDiseqcCommand &diseqc);
131 RESULT sendToneburst(int burst);
132 RESULT setSEC(iDVBSatelliteEquipmentControl *sec);
133 RESULT setSecSequence(const eSecCommandList &list);
134 RESULT getData(int num, long &data);
135 RESULT setData(int num, long val);
137 int readFrontendData(int type); // bitErrorRate, signalPower, signalQualitydB, signalQuality, locked, synced
138 void getFrontendStatus(ePyObject dest);
139 void getTransponderData(ePyObject dest, bool original);
140 void getFrontendData(ePyObject dest);
142 int isCompatibleWith(ePtr<iDVBFrontendParameters> &feparm);
143 int getDVBID() { return m_dvbid; }
144 int getSlotID() { return m_slotid; }
145 bool setSlotInfo(ePyObject obj); // get a tuple (slotid, slotdescr)
146 static void setTypePriorityOrder(int val) { PriorityOrder = val; }
147 static int getTypePriorityOrder() { return PriorityOrder; }
149 void reopenFrontend();
151 int closeFrontend(bool force=false);
152 const char *getDescription() const { return m_description; }
153 bool is_simulate() const { return m_simulate; }
155 RESULT turnOffSatCR(int satcr);