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 RESULT getSystem(int &type) const;
24 RESULT getDVBS(eDVBFrontendParametersSatellite &) const;
25 RESULT getDVBC(eDVBFrontendParametersCable &) const;
26 RESULT getDVBT(eDVBFrontendParametersTerrestrial &) 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);
32 RESULT calculateDifference(const iDVBFrontendParameters *parm, int &, bool exact) const;
34 RESULT getHash(unsigned long &) const;
35 RESULT calcLockTimeout(unsigned int &) const;
37 RESULT getFlags(unsigned int &flags) const { flags = m_flags; return 0; }
38 RESULT setFlags(unsigned int flags) { m_flags = flags; return 0; }
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
68 Signal1<void,iDVBFrontend*> m_stateChanged;
70 DECLARE_REF(eDVBFrontend);
77 bool m_need_rotor_workaround;
78 bool m_can_handle_dvbs2;
80 char m_description[128];
81 #if HAVE_DVB_API_VERSION < 3
83 char m_sec_filename[128];
85 FRONTENDPARAMETERS parm;
87 ePtr<iDVBSatelliteEquipmentControl> m_sec;
88 eSocketNotifier *m_sn;
93 eSecCommandList m_sec_sequence;
95 long m_data[NUM_DATA_ENTRIES];
97 int m_idleInputpower[2]; // 13V .. 18V
98 int m_runningInputpower;
100 int m_timeoutCount; // needed for timeout
101 int m_retryCount; // diseqc retry for rotor
105 void tuneLoop(); // called by m_tuneTimer
107 bool setSecSequencePos(int steps);
108 static int PriorityOrder;
110 eDVBFrontend(int adap, int fe, int &ok, bool simulate=false);
111 virtual ~eDVBFrontend();
113 int readInputpower();
114 RESULT getFrontendType(int &type);
115 RESULT tune(const iDVBFrontendParameters &where);
116 RESULT prepare_sat(const eDVBFrontendParametersSatellite &, unsigned int timeout);
117 RESULT prepare_cable(const eDVBFrontendParametersCable &);
118 RESULT prepare_terrestrial(const eDVBFrontendParametersTerrestrial &);
119 RESULT connectStateChange(const Slot1<void,iDVBFrontend*> &stateChange, ePtr<eConnection> &connection);
120 RESULT getState(int &state);
121 RESULT setTone(int tone);
122 RESULT setVoltage(int voltage);
123 RESULT sendDiseqc(const eDVBDiseqcCommand &diseqc);
124 RESULT sendToneburst(int burst);
125 RESULT setSEC(iDVBSatelliteEquipmentControl *sec);
126 RESULT setSecSequence(const eSecCommandList &list);
127 RESULT getData(int num, long &data);
128 RESULT setData(int num, long val);
130 int readFrontendData(int type); // bitErrorRate, signalPower, signalQualitydB, signalQuality, locked, synced
131 void getFrontendStatus(ePyObject dest);
132 void getTransponderData(ePyObject dest, bool original);
133 void getFrontendData(ePyObject dest);
135 int isCompatibleWith(ePtr<iDVBFrontendParameters> &feparm);
136 int getDVBID() { return m_dvbid; }
137 int getSlotID() { return m_slotid; }
138 bool setSlotInfo(ePyObject obj); // get a tuple (slotid, slotdescr)
139 static void setTypePriorityOrder(int val) { PriorityOrder = val; }
140 static int getTypePriorityOrder() { return PriorityOrder; }
143 int closeFrontend(bool force=false);
144 const char *getDescription() const { return m_description; }
145 bool is_simulate() const { return m_simulate; }