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
CetonStreamHandler
Definition: cetonstreamhandler.h:26
CetonStreamHandler::s_handlersRefCnt
static QMap< QString, uint > s_handlersRefCnt
Definition: cetonstreamhandler.h:80
CetonStreamHandler::GetVar
QString GetVar(const QString &section, const QString &variable) const
Definition: cetonstreamhandler.cpp:468
CetonStreamHandler::m_card
uint m_card
Definition: cetonstreamhandler.h:66
CetonStreamHandler::m_usingCablecard
bool m_usingCablecard
Definition: cetonstreamhandler.h:68
CetonStreamHandler::m_lastVchannel
QString m_lastVchannel
Definition: cetonstreamhandler.h:75
CetonStreamHandler::PerformTuneVChannel
bool PerformTuneVChannel(const QString &vchannel)
Definition: cetonstreamhandler.cpp:388
CetonStreamHandler::s_handlersLock
static QMutex s_handlersLock
Definition: cetonstreamhandler.h:78
CetonStreamHandler::m_lastFrequency
uint m_lastFrequency
Definition: cetonstreamhandler.h:72
CetonStreamHandler::IsCableCardInstalled
bool IsCableCardInstalled() const
Definition: cetonstreamhandler.h:32
CetonStreamHandler::Close
void Close(void)
Definition: cetonstreamhandler.cpp:188
CetonStreamHandler::TunerOff
bool TunerOff(void)
Definition: cetonstreamhandler.cpp:298
CetonStreamHandler::s_infoQueried
static QMap< QString, bool > s_infoQueried
Definition: cetonstreamhandler.h:81
CetonStreamHandler::RepeatTuning
void RepeatTuning(void)
Definition: cetonstreamhandler.cpp:285
CetonStreamHandler::VerifyTuning
bool VerifyTuning(void)
Definition: cetonstreamhandler.cpp:227
CetonStreamHandler::TuneVChannel
bool TuneVChannel(const QString &vchannel)
Definition: cetonstreamhandler.cpp:413
CetonChannel
Definition: cetonchannel.h:23
CetonStreamHandler::Connect
bool Connect(void)
Definition: cetonstreamhandler.cpp:197
CetonStreamHandler::m_lastProgram
uint m_lastProgram
Definition: cetonstreamhandler.h:74
CetonStreamHandler::m_lastModulation
QString m_lastModulation
Definition: cetonstreamhandler.h:73
CetonStreamHandler::s_handlers
static QMap< QString, CetonStreamHandler * > s_handlers
Definition: cetonstreamhandler.h:79
CetonStreamHandler::CetonStreamHandler
CetonStreamHandler(const QString &device, int inputid)
Definition: cetonstreamhandler.cpp:108
CetonStreamHandler::IsConnected
bool IsConnected(void) const
Definition: cetonstreamhandler.cpp:222
CetonStreamHandler::TuneProgram
bool TuneProgram(uint program)
Definition: cetonstreamhandler.cpp:353
CetonStreamHandler::GetProgramNumber
uint GetProgramNumber(void) const
Definition: cetonstreamhandler.cpp:446
CetonStreamHandler::m_connected
bool m_connected
Definition: cetonstreamhandler.h:69
CetonStreamHandler::EnterPowerSavingMode
bool EnterPowerSavingMode(void)
Definition: cetonstreamhandler.cpp:206
uint
unsigned int uint
Definition: compat.h:140
CetonStreamHandler::ClearProgramNumber
void ClearProgramNumber(void)
Definition: cetonstreamhandler.cpp:432
CetonStreamHandler::m_valid
bool m_valid
Definition: cetonstreamhandler.h:70
mythmiscutil.h
CetonStreamHandler::Return
static void Return(CetonStreamHandler *&ref, int inputid)
Definition: cetonstreamhandler.cpp:70
CetonStreamHandler::GetProgramList
QStringList GetProgramList()
Definition: cetonstreamhandler.cpp:501
CetonStreamHandler::m_tuner
uint m_tuner
Definition: cetonstreamhandler.h:67
CetonStreamHandler::Get
static CetonStreamHandler * Get(const QString &devname, int inputid)
Definition: cetonstreamhandler.cpp:37
CetonStreamHandler::HttpRequest
bool HttpRequest(const QString &method, const QString &script, const QUrlQuery &params, QString &response, uint &status_code) const
Definition: cetonstreamhandler.cpp:533
CetonStreamHandler::TuneFrequency
bool TuneFrequency(uint frequency, const QString &modulation)
Definition: cetonstreamhandler.cpp:309
IPTVStreamHandler
Definition: iptvstreamhandler.h:82
iptvstreamhandler.h
CetonStreamHandler::m_ipAddress
QString m_ipAddress
Definition: cetonstreamhandler.h:65
CetonStreamHandler::Open
bool Open(void)
Definition: cetonstreamhandler.cpp:183