00001
00007 #ifndef HDHOMERUNCHANNEL_H
00008 #define HDHOMERUNCHANNEL_H
00009
00010
00011 #include <qstring.h>
00012
00013
00014 #include "dtvchannel.h"
00015
00016
00017 #ifdef USING_HDHOMERUN
00018 #include "hdhomerun/hdhomerun.h"
00019 #else
00020 struct hdhomerun_control_sock_t { int dummy; };
00021 #endif
00022
00023 typedef struct hdhomerun_control_sock_t hdhr_socket_t;
00024
00025 class HDHRChannel : public DTVChannel
00026 {
00027 friend class HDHRSignalMonitor;
00028 friend class HDHRRecorder;
00029
00030 public:
00031 HDHRChannel(TVRec *parent, const QString &device, uint tuner);
00032 ~HDHRChannel(void);
00033
00034 bool Open(void);
00035 void Close(void);
00036 bool EnterPowerSavingMode(void);
00037
00038
00039 bool SetChannelByString(const QString &chan);
00040
00041
00042 bool IsOpen(void) const { return (_hdhomerun_device != NULL); }
00043 QString GetDevice(void) const
00044 { return QString("%1/%2").arg(_device_id, 8, 16).arg(_tuner); }
00045 vector<uint> GetPIDs(void) const
00046 { QMutexLocker locker(&_lock); return _pids; }
00047 QString GetSIStandard(void) const { return "atsc"; }
00048
00049
00050 bool AddPID(uint pid, bool do_update = true);
00051 bool DelPID(uint pid, bool do_update = true);
00052 bool DelAllPIDs(void);
00053 bool UpdateFilters(void);
00054
00055
00056 bool TuneMultiplex(uint mplexid, QString inputname);
00057 bool Tune(const DTVMultiplex &tuning, QString inputname);
00058
00059 private:
00060 bool Connect(void);
00061 bool Tune(uint frequency, QString inputname,
00062 QString modulation, QString si_std);
00063
00064
00065 struct hdhomerun_device_t *GetHDHRDevice(void);
00066
00067 bool DeviceSetTarget(unsigned short localPort);
00068 bool DeviceClearTarget(void);
00069
00070 QString DeviceGet(const QString &name, bool report_error_return = true);
00071 QString DeviceSet(const QString &name, const QString &value,
00072 bool report_error_return = true);
00073
00074 QString TunerGet(const QString &name, bool report_error_return = true);
00075 QString TunerSet(const QString &name, const QString &value,
00076 bool report_error_return = true);
00077
00078 private:
00079 struct hdhomerun_device_t *_hdhomerun_device;
00080 uint _device_id;
00081 uint _device_ip;
00082 uint _tuner;
00083 bool _ignore_filters;
00084 vector<uint> _pids;
00085 mutable QMutex _lock;
00086 };
00087
00088 #endif