00001 00008 #ifndef _CETONSTREAMHANDLER_H_ 00009 #define _CETONSTREAMHANDLER_H_ 00010 00011 // Qt headers 00012 #include <QString> 00013 #include <QMutex> 00014 #include <QTime> 00015 #include <QMap> 00016 00017 // MythTV headers 00018 #include "DeviceReadBuffer.h" 00019 #include "streamhandler.h" 00020 #include "mythmiscutil.h" 00021 00022 class CetonStreamHandler; 00023 class DeviceReadBuffer; 00024 class CetonChannel; 00025 class QUrl; 00026 00027 class CetonStreamHandler : public StreamHandler 00028 { 00029 public: 00030 static CetonStreamHandler *Get(const QString &devicename); 00031 static void Return(CetonStreamHandler * & ref); 00032 00033 bool IsConnected(void) const; 00034 bool IsCableCardInstalled() const { return _using_cablecard; }; 00035 00036 // Commands 00037 bool EnterPowerSavingMode(void); 00038 bool TuneFrequency(uint frequency, const QString &modulation); 00039 bool TuneProgram(uint program); 00040 bool TuneVChannel(const QString &vchannel); 00041 00042 uint GetProgramNumber(void) const; 00043 00044 private: 00045 CetonStreamHandler(const QString &); 00046 00047 bool Connect(void); 00048 00049 bool Open(void); 00050 void Close(void); 00051 00052 virtual void run(void); // MThread 00053 00054 bool VerifyTuning(void); 00055 void RepeatTuning(void); 00056 00057 bool TunerOff(void); 00058 bool PerformTuneVChannel(const QString &vchannel); 00059 void ClearProgramNumber(void); 00060 00061 QString GetVar(const QString §ion, const QString &variable) const; 00062 QStringList GetProgramList(); 00063 bool HttpRequest(const QString &method, const QString &script, 00064 const QUrl ¶ms, 00065 QString &response, uint &status_code) const; 00066 00067 00068 private: 00069 QString _ip_address; 00070 bool _using_rtp; 00071 uint _card; 00072 uint _tuner; 00073 QString _device_path; 00074 bool _using_cablecard; 00075 bool _connected; 00076 bool _valid; 00077 00078 uint _last_frequency; 00079 QString _last_modulation; 00080 uint _last_program; 00081 QString _last_vchannel; 00082 QTime _read_timer; 00083 00084 // for implementing Get & Return 00085 static QMutex _handlers_lock; 00086 static QMap<QString, CetonStreamHandler*> _handlers; 00087 static QMap<QString, uint> _handlers_refcnt; 00088 static QMap<QString, bool> _info_queried; 00089 }; 00090 00091 #endif // _CETONSTREAMHANDLER_H_
1.6.3