MythTV  master
scanmonitor.cpp
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 // MythTV headers
31 #include "scanmonitor.h"
32 #include "signalmonitorvalue.h"
33 #include "channelscanner.h"
34 
35 // Qt headers
36 #include <QCoreApplication>
37 
38 QEvent::Type ScannerEvent::ScanComplete =
39  (QEvent::Type) QEvent::registerEventType();
40 QEvent::Type ScannerEvent::ScanShutdown =
41  (QEvent::Type) QEvent::registerEventType();
42 QEvent::Type ScannerEvent::ScanErrored =
43  (QEvent::Type) QEvent::registerEventType();
44 QEvent::Type ScannerEvent::AppendTextToLog =
45  (QEvent::Type) QEvent::registerEventType();
46 QEvent::Type ScannerEvent::SetStatusText =
47  (QEvent::Type) QEvent::registerEventType();
49  (QEvent::Type) QEvent::registerEventType();
51  (QEvent::Type) QEvent::registerEventType();
53  (QEvent::Type) QEvent::registerEventType();
55  (QEvent::Type) QEvent::registerEventType();
57  (QEvent::Type) QEvent::registerEventType();
59  (QEvent::Type) QEvent::registerEventType();
61  (QEvent::Type) QEvent::registerEventType();
62 
64 #define TRANSPORT_PCT 6
65 #define TUNED_PCT 3
67 
68 void post_event(QObject *dest, QEvent::Type type, int val)
69 {
70  ScannerEvent *e = new ScannerEvent(type);
71  e->intValue(val);
72  QCoreApplication::postEvent(dest, e);
73 }
74 
75 void post_event(QObject *dest, QEvent::Type type, const QString &val)
76 {
77  ScannerEvent *e = new ScannerEvent(type);
78  e->strValue(val);
79  QCoreApplication::postEvent(dest, e);
80 }
81 
82 void post_event(QObject *dest, QEvent::Type type, int val,
83  Configurable *spp)
84 {
85  ScannerEvent *e = new ScannerEvent(type);
86  e->intValue(val);
87  e->ConfigurableValue(spp);
88  QCoreApplication::postEvent(dest, e);
89 }
90 
92 {
93  m_channelScanner = nullptr;
94 
95  QObject::deleteLater();
96 }
97 
99 {
101 }
102 
104 {
105  int tmp = TRANSPORT_PCT + ((100 - TRANSPORT_PCT) * pct)/100;
107 }
108 
109 void ScanMonitor::ScanAppendTextToLog(const QString &status)
110 {
112 }
113 
114 void ScanMonitor::ScanUpdateStatusText(const QString &status)
115 {
116  QString msg = tr("Scanning");
117  if (!status.isEmpty())
118  msg = QString("%1 %2").arg(msg).arg(status);
119 
121 }
122 
123 void ScanMonitor::ScanUpdateStatusTitleText(const QString &status)
124 {
126 }
127 
128 void ScanMonitor::ScanErrored(const QString &error)
129 {
131 }
132 
134 {
136  val.GetNormalizedValue(0, 65535));
137 }
138 
140 {
142 }
143 
145 {
147 }
148 
150 {
152  val.GetNormalizedValue(0, 65535));
153 }
154 
156 {
158  val.GetNormalizedValue(0, 65535));
159 }
160 
162 {
163  if (m_channelScanner)
164  {
165  ScannerEvent *scanEvent = (ScannerEvent*) e;
166  m_channelScanner->HandleEvent(scanEvent);
167  }
168 }
int GetNormalizedValue(int newmin, int newmax) const
Returns the value normalized to the [newmin, newmax] range.
static Type SetStatusText
Definition: scanmonitor.h:110
void StatusSignalToNoise(const SignalMonitorValue &) override
void ScanUpdateStatusTitleText(const QString &status)
static Type SetStatusSignalStrength
Definition: scanmonitor.h:115
void StatusSignalStrength(const SignalMonitorValue &) override
Signal to be sent with an actual signal value.
static void error(const char *str,...)
Definition: vbi.c:42
static Type SetStatusTitleText
Definition: scanmonitor.h:111
virtual void HandleEvent(const ScannerEvent *)=0
int GetValue() const
Returns the value.
void StatusRotorPosition(const SignalMonitorValue &) override
static Type AppendTextToLog
Definition: scanmonitor.h:109
static Type SetPercentComplete
Definition: scanmonitor.h:112
void ScanPercentComplete(int pct)
virtual void deleteLater(void)
Definition: scanmonitor.cpp:91
static guint32 * tmp
Definition: goom_core.c:35
static Type ScanComplete
Definition: scanmonitor.h:106
static Type ScanShutdown
Definition: scanmonitor.h:107
void ScanErrored(const QString &error)
QString strValue() const
Definition: scanmonitor.h:94
static Type SetStatusChannelTuned
Definition: scanmonitor.h:117
static Type SetStatusRotorPosition
Definition: scanmonitor.h:113
void ScanAppendTextToLog(const QString &status)
#define TRANSPORT_PCT
Percentage to set to after the transports have been scanned.
Definition: scanmonitor.cpp:64
static Type ScanErrored
Definition: scanmonitor.h:108
static Type SetStatusSignalToNoise
Definition: scanmonitor.h:114
int intValue() const
Definition: scanmonitor.h:97
void StatusChannelTuned(const SignalMonitorValue &) override
Signal to be sent with change change status.
Configurable * ConfigurableValue() const
Definition: scanmonitor.h:102
static Type SetStatusSignalLock
Definition: scanmonitor.h:116
void ScanComplete(void)
Definition: scanmonitor.cpp:98
void customEvent(QEvent *) override
void post_event(QObject *dest, QEvent::Type type, int val)
Definition: scanmonitor.cpp:68
ChannelScanner * m_channelScanner
Definition: scanmonitor.h:81
void StatusSignalLock(const SignalMonitorValue &) override
Signal to be sent as true when it is safe to begin or continue recording, and false if it may not be ...
void ScanUpdateStatusText(const QString &status)