MythTV master
scanmonitor.h
Go to the documentation of this file.
1/* -*- Mode: c++ -*-
2 * vim: set expandtab tabstop=4 shiftwidth=4:
3 *
4 * Original Project
5 * MythTV http://www.mythtv.org
6 *
7 * Copyright (c) 2004, 2005 John Pullan <john@pullan.org>
8 * Copyright (c) 2005 - 2007 Daniel Kristjansson
9 *
10 * Description:
11 * Collection of classes to provide channel scanning functionallity
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
26 * Or, point your browser to http://www.gnu.org/copyleft/gpl.html
27 *
28 */
29
30#ifndef SCAN_MONITOR_H
31#define SCAN_MONITOR_H
32
33// Qt headers
34#include <QObject>
35#include <QEvent>
36
37// MythTV headers
39
40class ChannelScanner;
42class QString;
43
45 public QObject,
47{
48 Q_OBJECT
49
50 friend class QObject; // quiet OSX gcc warning
51
52 public:
54 virtual void deleteLater(void);
55
56 void customEvent(QEvent *event) override; // QObject
57
58 // Values from 1-100 of scan completion
59 void ScanPercentComplete(int pct);
60 void ScanUpdateStatusText(const QString &status);
61 void ScanUpdateStatusTitleText(const QString &status);
62 void ScanAppendTextToLog(const QString &status);
63 void ScanComplete(void);
64 void ScanErrored(const QString &error);
65
66 // SignalMonitorListener
67 void AllGood(void) override { } // SignalMonitorListener
68 void StatusSignalLock(const SignalMonitorValue &val) override; // SignalMonitorListener
69 void StatusChannelTuned(const SignalMonitorValue &val) override; // SignalMonitorListener
70 void StatusSignalStrength(const SignalMonitorValue &val) override; // SignalMonitorListener
71
72 // DVBSignalMonitorListener
73 void StatusSignalToNoise(const SignalMonitorValue &val) override; // DVBSignalMonitorListener
74 void StatusBitErrorRate(const SignalMonitorValue &/*val*/) override { } // DVBSignalMonitorListener
75 void StatusUncorrectedBlocks(const SignalMonitorValue &/*val*/) override { } // DVBSignalMonitorListener
76 void StatusRotorPosition(const SignalMonitorValue &val) override; // DVBSignalMonitorListener
77
78 private:
79 ~ScanMonitor() override = default;
80
82};
83
84class Configurable;
85
86class ScannerEvent : public QEvent
87{
88 friend class QObject; // quiet OSX gcc warning
89
90 public:
91
92 explicit ScannerEvent(QEvent::Type type) : QEvent(type) { }
93
94 QString strValue() const { return m_str; }
95 void strValue(const QString& str) { m_str = str; }
96
97 int intValue() const { return m_intValue; }
98 void intValue(int intvalue) { m_intValue = intvalue; }
99
100 bool boolValue() const { return m_intValue != 0; }
101
102 Configurable *ConfigurableValue() const { return m_cfgPtr; }
103 void ConfigurableValue(Configurable *cfg_ptr)
104 { m_cfgPtr = cfg_ptr; }
105
106 static const Type kScanComplete;
107 static const Type kScanShutdown;
108 static const Type kScanErrored;
109 static const Type kAppendTextToLog;
110 static const Type kSetStatusText;
111 static const Type kSetStatusTitleText;
112 static const Type kSetPercentComplete;
113 static const Type kSetStatusRotorPosition;
114 static const Type kSetStatusSignalToNoise;
115 static const Type kSetStatusSignalStrength;
116 static const Type kSetStatusSignalLock;
117 static const Type kSetStatusChannelTuned;
118
119 private:
120 ~ScannerEvent() override = default;
121
122 private:
123 QString m_str;
124 int m_intValue {0};
125 Configurable *m_cfgPtr {nullptr};
126};
127
128void post_event(QObject *dest, QEvent::Type type, int val);
129void post_event(QObject *dest, QEvent::Type type, const QString &val);
130void post_event(QObject *dest, QEvent::Type type, int val,
131 Configurable *spp);
132
133#endif // SCAN_MONITOR_H
void StatusSignalToNoise(const SignalMonitorValue &val) override
void ScanPercentComplete(int pct)
void ScanComplete(void)
Definition: scanmonitor.cpp:98
void AllGood(void) override
Signal to be sent when you have a lock on all values.
Definition: scanmonitor.h:67
void ScanAppendTextToLog(const QString &status)
void StatusRotorPosition(const SignalMonitorValue &val) override
void StatusChannelTuned(const SignalMonitorValue &val) override
Signal to be sent with change change status.
friend class QObject
Definition: scanmonitor.h:50
void StatusSignalLock(const SignalMonitorValue &val) override
Signal to be sent as true when it is safe to begin or continue recording, and false if it may not be ...
void ScanUpdateStatusTitleText(const QString &status)
~ScanMonitor() override=default
ScanMonitor(ChannelScanner *cs)
Definition: scanmonitor.h:53
ChannelScanner * m_channelScanner
Definition: scanmonitor.h:81
void StatusUncorrectedBlocks(const SignalMonitorValue &) override
Definition: scanmonitor.h:75
void StatusSignalStrength(const SignalMonitorValue &val) override
Signal to be sent with an actual signal value.
void StatusBitErrorRate(const SignalMonitorValue &) override
Definition: scanmonitor.h:74
virtual void deleteLater(void)
Definition: scanmonitor.cpp:91
void ScanErrored(const QString &error)
void ScanUpdateStatusText(const QString &status)
void customEvent(QEvent *event) override
static const Type kSetStatusSignalLock
Definition: scanmonitor.h:116
QString strValue() const
Definition: scanmonitor.h:94
static const Type kScanShutdown
Definition: scanmonitor.h:107
static const Type kSetStatusTitleText
Definition: scanmonitor.h:111
static const Type kSetStatusSignalToNoise
Definition: scanmonitor.h:114
~ScannerEvent() override=default
static const Type kSetStatusText
Definition: scanmonitor.h:110
bool boolValue() const
Definition: scanmonitor.h:100
void ConfigurableValue(Configurable *cfg_ptr)
Definition: scanmonitor.h:103
static const Type kAppendTextToLog
Definition: scanmonitor.h:109
Configurable * m_cfgPtr
Definition: scanmonitor.h:125
static const Type kSetStatusRotorPosition
Definition: scanmonitor.h:113
friend class QObject
Definition: scanmonitor.h:88
void strValue(const QString &str)
Definition: scanmonitor.h:95
static const Type kSetStatusChannelTuned
Definition: scanmonitor.h:117
static const Type kScanComplete
Definition: scanmonitor.h:106
Configurable * ConfigurableValue() const
Definition: scanmonitor.h:102
static const Type kSetPercentComplete
Definition: scanmonitor.h:112
void intValue(int intvalue)
Definition: scanmonitor.h:98
static const Type kSetStatusSignalStrength
Definition: scanmonitor.h:115
int intValue() const
Definition: scanmonitor.h:97
static const Type kScanErrored
Definition: scanmonitor.h:108
QString m_str
Definition: scanmonitor.h:123
ScannerEvent(QEvent::Type type)
Definition: scanmonitor.h:92
def error(message)
Definition: smolt.py:409
void post_event(QObject *dest, QEvent::Type type, int val)
Percentage to set to after the first tune.
Definition: scanmonitor.cpp:68