MythTV  master
cetonstreamhandler.h
Go to the documentation of this file.
1 
8 #ifndef _CETONSTREAMHANDLER_H_
9 #define _CETONSTREAMHANDLER_H_
10 
11 // Qt headers
12 #include <QString>
13 #include <QMutex>
14 #include <QTime>
15 #include <QMap>
16 
17 // MythTV headers
18 #include "iptvstreamhandler.h"
19 #include "mythmiscutil.h"
20 
21 class CetonStreamHandler;
22 class CetonChannel;
23 class QUrlQuery;
24 
26 {
27  public:
28  static CetonStreamHandler *Get(const QString &devname, int inputid);
29  static void Return(CetonStreamHandler * & ref, int inputid);
30 
31  bool IsConnected(void) const;
32  bool IsCableCardInstalled() const { return m_usingCablecard; };
33 
34  // Commands
35  bool EnterPowerSavingMode(void);
36  bool TuneFrequency(uint frequency, const QString &modulation);
37  bool TuneProgram(uint program);
38  bool TuneVChannel(const QString &vchannel);
39 
40  uint GetProgramNumber(void) const;
41 
42  private:
43  explicit CetonStreamHandler(const QString &device, int inputid);
44 
45  bool Connect(void);
46 
47  bool Open(void);
48  void Close(void);
49 
50  bool VerifyTuning(void);
51  void RepeatTuning(void);
52 
53  bool TunerOff(void);
54  bool PerformTuneVChannel(const QString &vchannel);
55  void ClearProgramNumber(void);
56 
57  QString GetVar(const QString &section, const QString &variable) const;
58  QStringList GetProgramList();
59  bool HttpRequest(const QString &method, const QString &script,
60  const QUrlQuery &params,
61  QString &response, uint &status_code) const;
62 
63 
64  private:
65  QString m_ipAddress;
66  uint m_card {0};
68  bool m_usingCablecard {false};
69  bool m_connected {false};
70  bool m_valid {false};
71 
75  QString m_lastVchannel;
76 
77  // for implementing Get & Return
78  static QMutex s_handlersLock;
79  static QMap<QString, CetonStreamHandler*> s_handlers;
80  static QMap<QString, uint> s_handlersRefCnt;
81  static QMap<QString, bool> s_infoQueried;
82 };
83 
84 #endif // _CETONSTREAMHANDLER_H_
QString GetVar(const QString &section, const QString &variable) const
bool HttpRequest(const QString &method, const QString &script, const QUrlQuery &params, QString &response, uint &status_code) const
bool IsCableCardInstalled() const
bool TuneFrequency(uint frequency, const QString &modulation)
static QMap< QString, uint > s_handlersRefCnt
CetonStreamHandler(const QString &device, int inputid)
QStringList GetProgramList()
static CetonStreamHandler * Get(const QString &devname, int inputid)
bool PerformTuneVChannel(const QString &vchannel)
uint GetProgramNumber(void) const
unsigned int uint
Definition: compat.h:140
static QMap< QString, bool > s_infoQueried
static QMap< QString, CetonStreamHandler * > s_handlers
static QMutex s_handlersLock
bool TuneProgram(uint program)
bool TuneVChannel(const QString &vchannel)
bool IsConnected(void) const
static void Return(CetonStreamHandler *&ref, int inputid)