add blinking dish-picture if positioner is moving (we need a function which returns...
[enigma2.git] / lib / dvb / frontend.h
1 #ifndef __dvb_frontend_h
2 #define __dvb_frontend_h
3
4 #include <config.h>
5 #include <lib/dvb/idvb.h>
6 #include <lib/dvb/sec.h>
7
8 class eSecCommandList;
9
10 class eDVBFrontendParameters: public iDVBFrontendParameters
11 {
12         DECLARE_REF(eDVBFrontendParameters);
13         union
14         {
15                 eDVBFrontendParametersSatellite sat;
16                 eDVBFrontendParametersCable cable;
17                 eDVBFrontendParametersTerrestrial terrestrial;
18         };
19         int m_type;
20 public:
21         eDVBFrontendParameters();
22         
23         RESULT getSystem(int &type) const;
24         RESULT getDVBS(eDVBFrontendParametersSatellite &p) const;
25         RESULT getDVBC(eDVBFrontendParametersCable &p) const;
26         RESULT getDVBT(eDVBFrontendParametersTerrestrial &p) const;
27
28         RESULT setDVBS(const eDVBFrontendParametersSatellite &p);
29         RESULT setDVBC(const eDVBFrontendParametersCable &p);
30         RESULT setDVBT(const eDVBFrontendParametersTerrestrial &p);
31         
32         RESULT calculateDifference(const iDVBFrontendParameters *parm, int &diff) const;
33         
34         RESULT getHash(unsigned long &hash) const;
35 };
36
37 class eDVBFrontend: public iDVBFrontend, public Object
38 {
39         DECLARE_REF(eDVBFrontend);
40         int m_type;
41         int m_fe;
42         int m_fd;
43 #if HAVE_DVB_API_VERSION < 3
44         int m_secfd;
45 #endif
46         FRONTENDPARAMETERS parm;
47         int m_state;
48         Signal1<void,iDVBFrontend*> m_stateChanged;
49         ePtr<iDVBSatelliteEquipmentControl> m_sec;
50         eSocketNotifier *m_sn;
51         int m_tuning;
52         eTimer *m_timeout;
53         eTimer *m_tuneTimer;
54
55         eSecCommandList m_sec_sequence;
56
57         int m_data[8]; /* when satellite frontend then
58                 data[0] = lastcsw -> state of the committed switch
59                 data[1] = lastucsw -> state of the uncommitted switch
60                 data[2] = lastToneburst -> current state of toneburst switch
61                 data[3] = newRotorCmd -> last sent rotor cmd
62                 data[4] = newRotorPos -> current Rotor Position
63                 data[5] = curRotorCmd
64                 data[6] = curRotorPos
65                 data[7] = linkedToTunerNo */
66
67         int m_idleInputpower[2];  // 13V .. 18V
68         int m_runningInputpower;
69         int m_timeoutCount; // needed for timeout
70         int m_curVoltage;
71
72         void feEvent(int);
73         void timeout();
74         void tuneLoop();  // called by m_tuneTimer
75         void setFrontend();
76         int readInputpower();
77         bool setSecSequencePos(int steps);
78 public:
79         eDVBFrontend(int adap, int fe, int &ok);        
80         virtual ~eDVBFrontend();
81
82         RESULT getFrontendType(int &type);
83         RESULT tune(const iDVBFrontendParameters &where);
84         RESULT connectStateChange(const Slot1<void,iDVBFrontend*> &stateChange, ePtr<eConnection> &connection);
85         RESULT getState(int &state);
86         RESULT setTone(int tone);
87         RESULT setVoltage(int voltage);
88         RESULT sendDiseqc(const eDVBDiseqcCommand &diseqc);
89         RESULT sendToneburst(int burst);
90         RESULT setSEC(iDVBSatelliteEquipmentControl *sec);
91         RESULT setSecSequence(const eSecCommandList &list);
92         RESULT getData(int num, int &data);
93         RESULT setData(int num, int val);
94         
95         int isCompatibleWith(ePtr<iDVBFrontendParameters> &feparm);
96         
97         int getID() { return m_fe; }
98 };
99
100 #endif