lnb's have diseqc parameters.. not satellite's
[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(eDVBFrontendParametersSatellite &p);
29         RESULT setDVBC(eDVBFrontendParametersCable &p);
30         RESULT setDVBT(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_fd;
42 #if HAVE_DVB_API_VERSION < 3
43         int m_secfd;
44 #endif
45         FRONTENDPARAMETERS parm;
46         int m_state;
47         Signal1<void,iDVBFrontend*> m_stateChanged;
48         ePtr<iDVBSatelliteEquipmentControl> m_sec;
49         eSocketNotifier *m_sn;
50         int m_tuning;
51         eTimer *m_timeout;
52         eTimer *m_tuneTimer;
53
54         eSecCommandList m_sec_sequence;
55
56         int m_data[7]; /* when satellite frontend then
57                 data[0] = lastcsw -> state of the committed switch
58                 data[1] = lastucsw -> state of the uncommitted switch
59                 data[2] = lastToneburst -> current state of toneburst switch
60                 data[3] = newRotorCmd -> last sent rotor cmd
61                 data[4] = newRotorPos -> current Rotor Position
62                 data[5] = curRotorCmd
63                 data[6] = curRotorPos */
64
65         int m_idleInputpower;
66         int m_runningInputpower;
67         int m_timeoutCount; // needed for timeout
68
69         void feEvent(int);
70         void timeout();
71         void tuneLoop();  // called by m_tuneTimer
72         void setFrontend();
73         int readInputpower();
74         bool setSecSequencePos(int steps);
75 public:
76         eDVBFrontend(int adap, int fe, int &ok);        
77         virtual ~eDVBFrontend();
78
79         RESULT getFrontendType(int &type);
80         RESULT tune(const iDVBFrontendParameters &where);
81         RESULT connectStateChange(const Slot1<void,iDVBFrontend*> &stateChange, ePtr<eConnection> &connection);
82         RESULT getState(int &state);
83         RESULT setTone(int tone);
84         RESULT setVoltage(int voltage);
85         RESULT sendDiseqc(const eDVBDiseqcCommand &diseqc);
86         RESULT sendToneburst(int burst);
87         RESULT setSEC(iDVBSatelliteEquipmentControl *sec);
88         RESULT setSecSequence(const eSecCommandList &list);
89         RESULT getData(int num, int &data);
90         RESULT setData(int num, int val);
91 };
92
93 #endif