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 
40 class ChannelScanner;
41 class SignalMonitorValue;
42 class QString;
43 
44 class ScanMonitor :
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 
84 class Configurable;
85 
86 class 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 
128 void post_event(QObject *dest, QEvent::Type type, int val);
129 void post_event(QObject *dest, QEvent::Type type, const QString &val);
130 void post_event(QObject *dest, QEvent::Type type, int val,
131  Configurable *spp);
132 
133 #endif // SCAN_MONITOR_H
build_compdb.dest
dest
Definition: build_compdb.py:9
ScanMonitor::AllGood
void AllGood(void) override
Signal to be sent when you have a lock on all values.
Definition: scanmonitor.h:67
error
static void error(const char *str,...)
Definition: vbi.cpp:37
ScanMonitor::StatusSignalStrength
void StatusSignalStrength(const SignalMonitorValue &val) override
Signal to be sent with an actual signal value.
Definition: scanmonitor.cpp:155
ScannerEvent::ConfigurableValue
void ConfigurableValue(Configurable *cfg_ptr)
Definition: scanmonitor.h:103
ScannerEvent::QObject
friend class QObject
Definition: scanmonitor.h:88
ScanMonitor::ScanMonitor
ScanMonitor(ChannelScanner *cs)
Definition: scanmonitor.h:53
ScanMonitor::ScanPercentComplete
void ScanPercentComplete(int pct)
Definition: scanmonitor.cpp:103
ScannerEvent::kAppendTextToLog
static const Type kAppendTextToLog
Definition: scanmonitor.h:109
ScanMonitor::customEvent
void customEvent(QEvent *event) override
Definition: scanmonitor.cpp:161
ScannerEvent::ScannerEvent
ScannerEvent(QEvent::Type type)
Definition: scanmonitor.h:92
ScanMonitor::StatusSignalToNoise
void StatusSignalToNoise(const SignalMonitorValue &val) override
Definition: scanmonitor.cpp:149
ScanMonitor::deleteLater
virtual void deleteLater(void)
Definition: scanmonitor.cpp:91
ScannerEvent::kSetStatusText
static const Type kSetStatusText
Definition: scanmonitor.h:110
ScannerEvent::boolValue
bool boolValue() const
Definition: scanmonitor.h:100
ScannerEvent::kScanShutdown
static const Type kScanShutdown
Definition: scanmonitor.h:107
ScanMonitor::ScanErrored
void ScanErrored(const QString &error)
Definition: scanmonitor.cpp:128
ScannerEvent::m_intValue
int m_intValue
Definition: scanmonitor.h:124
ScanMonitor::~ScanMonitor
~ScanMonitor() override=default
ScannerEvent::kScanComplete
static const Type kScanComplete
Definition: scanmonitor.h:106
ScannerEvent::m_str
QString m_str
Definition: scanmonitor.h:123
signalmonitorlistener.h
ScannerEvent::intValue
int intValue() const
Definition: scanmonitor.h:97
ScannerEvent::kSetStatusRotorPosition
static const Type kSetStatusRotorPosition
Definition: scanmonitor.h:113
ChannelScanner
Definition: channelscanner.h:66
ScannerEvent::strValue
void strValue(const QString &str)
Definition: scanmonitor.h:95
ScannerEvent::kSetStatusChannelTuned
static const Type kSetStatusChannelTuned
Definition: scanmonitor.h:117
ScannerEvent::kSetStatusSignalToNoise
static const Type kSetStatusSignalToNoise
Definition: scanmonitor.h:114
ScanMonitor::StatusRotorPosition
void StatusRotorPosition(const SignalMonitorValue &val) override
Definition: scanmonitor.cpp:133
ScannerEvent::kSetStatusSignalLock
static const Type kSetStatusSignalLock
Definition: scanmonitor.h:116
SignalMonitorValue
Definition: signalmonitorvalue.h:13
ScanMonitor::StatusSignalLock
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 ...
Definition: scanmonitor.cpp:139
post_event
void post_event(QObject *dest, QEvent::Type type, int val)
Percentage to set to after the first tune.
Definition: scanmonitor.cpp:68
ScannerEvent::intValue
void intValue(int intvalue)
Definition: scanmonitor.h:98
ScanMonitor::StatusBitErrorRate
void StatusBitErrorRate(const SignalMonitorValue &) override
Definition: scanmonitor.h:74
ScannerEvent::kSetStatusSignalStrength
static const Type kSetStatusSignalStrength
Definition: scanmonitor.h:115
ScanMonitor::ScanAppendTextToLog
void ScanAppendTextToLog(const QString &status)
Definition: scanmonitor.cpp:109
ScannerEvent
Definition: scanmonitor.h:86
ScannerEvent::m_cfgPtr
Configurable * m_cfgPtr
Definition: scanmonitor.h:125
ScanMonitor::QObject
friend class QObject
Definition: scanmonitor.h:50
ScanMonitor::StatusChannelTuned
void StatusChannelTuned(const SignalMonitorValue &val) override
Signal to be sent with change change status.
Definition: scanmonitor.cpp:144
ScannerEvent::strValue
QString strValue() const
Definition: scanmonitor.h:94
ScannerEvent::kSetStatusTitleText
static const Type kSetStatusTitleText
Definition: scanmonitor.h:111
ScanMonitor::ScanComplete
void ScanComplete(void)
Definition: scanmonitor.cpp:98
DVBSignalMonitorListener
Definition: signalmonitorlistener.h:57
ScanMonitor::StatusUncorrectedBlocks
void StatusUncorrectedBlocks(const SignalMonitorValue &) override
Definition: scanmonitor.h:75
ScannerEvent::kSetPercentComplete
static const Type kSetPercentComplete
Definition: scanmonitor.h:112
ScannerEvent::kScanErrored
static const Type kScanErrored
Definition: scanmonitor.h:108
ScanMonitor::m_channelScanner
ChannelScanner * m_channelScanner
Definition: scanmonitor.h:81
ScanMonitor::ScanUpdateStatusText
void ScanUpdateStatusText(const QString &status)
Definition: scanmonitor.cpp:114
ScannerEvent::~ScannerEvent
~ScannerEvent() override=default
ScannerEvent::ConfigurableValue
Configurable * ConfigurableValue() const
Definition: scanmonitor.h:102
ScanMonitor
Definition: scanmonitor.h:44
ScanMonitor::ScanUpdateStatusTitleText
void ScanUpdateStatusTitleText(const QString &status)
Definition: scanmonitor.cpp:123