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