fce94e5eeb107b1d8c9ab4a64a31758adf579977
[vuplus_dvbapp] / 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[4]; /* 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] = prevRotorPos -> current Rotor Position */
61
62         void feEvent(int);
63         void timeout();
64         void tuneLoop();  // called by m_tuneTimer
65         void setFrontend();
66 public:
67         eDVBFrontend(int adap, int fe, int &ok);        
68         virtual ~eDVBFrontend();
69
70         RESULT getFrontendType(int &type);
71         RESULT tune(const iDVBFrontendParameters &where);
72         RESULT connectStateChange(const Slot1<void,iDVBFrontend*> &stateChange, ePtr<eConnection> &connection);
73         RESULT getState(int &state);
74         RESULT setTone(int tone);
75         RESULT setVoltage(int voltage);
76         RESULT sendDiseqc(const eDVBDiseqcCommand &diseqc);
77         RESULT sendToneburst(int burst);
78         RESULT setSEC(iDVBSatelliteEquipmentControl *sec);
79         RESULT setSecSequence(const eSecCommandList &list);
80         RESULT getData(int num, int &data);
81         RESULT setData(int num, int val);
82 };
83
84 #endif