00001
00007 #ifndef DBOX2EPG_H_
00008 #define DBOX2EPG_H_
00009
00010
00011 #include <qmap.h>
00012 #include <qobject.h>
00013 #include <qthread.h>
00014 #include <qdatetime.h>
00015
00016 class QHttp;
00017 class DBox2Channel;
00018 class DBox2DBOptions;
00019
00020 class DBox2EPG : public QObject, public QThread
00021 {
00022 Q_OBJECT
00023 public:
00024 DBox2EPG();
00025 ~DBox2EPG();
00026 void TeardownAll(void);
00027
00028 void Init(DBox2DBOptions* dbox2_options, int cardid,
00029 DBox2Channel* channel);
00030 void ScheduleRequestEPG(const QString& channelNumber);
00031 void Shutdown(void);
00032
00033 public slots:
00034 void httpRequestFinished(int requestID, bool error);
00035 void deleteLater(void);
00036
00037 private:
00038 void UpdateDB(uint chanid,
00039 const QDateTime &startTime,
00040 const QDateTime &endTime,
00041 const QString &title,
00042 const QString &description,
00043 const QString &category);
00044
00045 static QString ParseNextLine(
00046 const QByteArray &buffer, int &pos, int size);
00047 static bool UseOnAirGuide(uint chanid);
00048
00049 void RequestEPG(const QString& channelNumber);
00050 int GetChannelID(const QString& channelnumber);
00051 void run(void);
00052
00053 QHttp *http;
00054 DBox2DBOptions *m_dbox2options;
00055 DBox2Channel *m_dbox2channel;
00056 QMap<int,QString> m_channelnumbers;
00057
00058 int m_cardid;
00059 int m_channelCount;
00060 int m_channelIndex;
00061 bool m_isRunning;
00062 bool m_inProgress;
00063 bool m_pendingRequest;
00064 QString m_requestedChannel;
00065
00066 QString m_currentEPGRequestChannel;
00067 int m_currentEPGRequestID;
00068 };
00069
00070
00071 #endif