fix hardcoded path
[enigma2.git] / lib / dvb / frontend.h
1 #ifndef __dvb_frontend_h
2 #define __dvb_frontend_h
3
4 #include <lib/dvb/idvb.h>
5 class eDVBFrontendParameters: public iDVBFrontendParameters
6 {
7         DECLARE_REF(eDVBFrontendParameters);
8         union
9         {
10                 eDVBFrontendParametersSatellite sat;
11                 eDVBFrontendParametersCable cable;
12                 eDVBFrontendParametersTerrestrial terrestrial;
13         };
14         int m_type;
15 public:
16         eDVBFrontendParameters();
17         ~eDVBFrontendParameters() {}
18         
19         RESULT getSystem(int &type) const;
20         RESULT getDVBS(eDVBFrontendParametersSatellite &SWIG_OUTPUT) const;
21         RESULT getDVBC(eDVBFrontendParametersCable &SWIG_OUTPUT) const;
22         RESULT getDVBT(eDVBFrontendParametersTerrestrial &SWIG_OUTPUT) const;
23
24         RESULT setDVBS(const eDVBFrontendParametersSatellite &p, bool no_rotor_command_on_tune=false);
25         RESULT setDVBC(const eDVBFrontendParametersCable &p);
26         RESULT setDVBT(const eDVBFrontendParametersTerrestrial &p);
27         
28         RESULT calculateDifference(const iDVBFrontendParameters *parm, int &SWIG_OUTPUT, bool exact) const;
29         
30         RESULT getHash(unsigned long &SWIG_OUTPUT) const;
31 };
32
33 #ifndef SWIG
34
35 #include <lib/dvb/sec.h>
36 class eSecCommandList;
37
38 class eDVBFrontend: public iDVBFrontend, public Object
39 {
40         DECLARE_REF(eDVBFrontend);
41         int m_type;
42         int m_fe;
43         int m_fd;
44         char m_filename[128];
45 #if HAVE_DVB_API_VERSION < 3
46         int m_secfd;
47         char m_sec_filename[128];
48 #endif
49
50         FRONTENDPARAMETERS parm;
51         int m_state;
52         Signal1<void,iDVBFrontend*> m_stateChanged;
53         ePtr<iDVBSatelliteEquipmentControl> m_sec;
54         eSocketNotifier *m_sn;
55         int m_tuning;
56         eTimer *m_timeout;
57         eTimer *m_tuneTimer;
58
59         eSecCommandList m_sec_sequence;
60
61         enum {
62                 CSW,                  // state of the committed switch
63                 UCSW,                 // state of the uncommitted switch
64                 TONEBURST,            // current state of toneburst switch
65                 NEW_ROTOR_CMD,        // prev sent rotor cmd
66                 NEW_ROTOR_POS,        // new rotor position (not validated)
67                 ROTOR_CMD,            // completed rotor cmd (finalized)
68                 ROTOR_POS,            // current rotor position
69                 LINKED_PREV_PTR,      // prev double linked list (for linked FEs)
70                 LINKED_NEXT_PTR,      // next double linked list (for linked FEs)
71                 SATPOS_DEPENDS_PTR,   // pointer to FE with configured rotor (with twin/quattro lnb)
72                 FREQ_OFFSET,          // current frequency offset
73                 CUR_VOLTAGE,          // current voltage
74                 CUR_TONE,             // current continuous tone
75                 NUM_DATA_ENTRIES
76         };
77
78         int m_data[NUM_DATA_ENTRIES];
79
80         int m_idleInputpower[2];  // 13V .. 18V
81         int m_runningInputpower;
82
83         int m_timeoutCount; // needed for timeout
84         int m_retryCount; // diseqc retry for rotor
85
86         void feEvent(int);
87         void timeout();
88         void tuneLoop();  // called by m_tuneTimer
89         void setFrontend();
90         int readInputpower();
91         bool setSecSequencePos(int steps);
92 public:
93         eDVBFrontend(int adap, int fe, int &ok);        
94         virtual ~eDVBFrontend();
95
96         RESULT getFrontendType(int &type);
97         RESULT tune(const iDVBFrontendParameters &where);
98         RESULT prepare_sat(const eDVBFrontendParametersSatellite &);
99         RESULT prepare_cable(const eDVBFrontendParametersCable &);
100         RESULT prepare_terrestrial(const eDVBFrontendParametersTerrestrial &);
101         RESULT connectStateChange(const Slot1<void,iDVBFrontend*> &stateChange, ePtr<eConnection> &connection);
102         RESULT getState(int &state);
103         RESULT setTone(int tone);
104         RESULT setVoltage(int voltage);
105         RESULT sendDiseqc(const eDVBDiseqcCommand &diseqc);
106         RESULT sendToneburst(int burst);
107         RESULT setSEC(iDVBSatelliteEquipmentControl *sec);
108         RESULT setSecSequence(const eSecCommandList &list);
109         RESULT getData(int num, int &data);
110         RESULT setData(int num, int val);
111
112         int readFrontendData(int type); // bitErrorRate, signalPower, signalQuality, locked, synced
113         void getFrontendStatus(ePyObject dest);
114         void getTransponderData(ePyObject dest, bool original);
115         void getFrontendData(ePyObject dest);
116
117         int isCompatibleWith(ePtr<iDVBFrontendParameters> &feparm);
118         int getID() { return m_fe; }
119
120         int openFrontend();
121         int closeFrontend();
122 };
123
124 #endif // SWIG
125 #endif