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_using_cablecard; };
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 &, 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_ip_address;
66  uint m_card {0};
68  QString m_device_path;
69  bool m_using_cablecard {false};
70  bool m_connected {false};
71  bool m_valid {false};
72 
76  QString m_last_vchannel;
77  QTime m_read_timer;
78 
79  // for implementing Get & Return
80  static QMutex s_handlers_lock;
81  static QMap<QString, CetonStreamHandler*> s_handlers;
82  static QMap<QString, uint> s_handlers_refcnt;
83  static QMap<QString, bool> s_info_queried;
84 };
85 
86 #endif // _CETONSTREAMHANDLER_H_
QString GetVar(const QString &section, const QString &variable) const
CetonStreamHandler(const QString &, int inputid)
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, bool > s_info_queried
unsigned int uint
Definition: compat.h:140
static QMap< QString, uint > s_handlers_refcnt
QStringList GetProgramList()
static QMutex s_handlers_lock
static CetonStreamHandler * Get(const QString &devname, int inputid)
bool PerformTuneVChannel(const QString &vchannel)
uint GetProgramNumber(void) const
static QMap< QString, CetonStreamHandler * > s_handlers
bool TuneProgram(uint program)
bool TuneVChannel(const QString &vchannel)
bool IsConnected(void) const
static void Return(CetonStreamHandler *&ref, int inputid)