MythTV  master
cetonsignalmonitor.cpp
Go to the documentation of this file.
1 
8 #include "mythlogging.h"
9 #include "mythdbcon.h"
10 
11 #include "cetonsignalmonitor.h"
12 #include "cetonstreamhandler.h"
13 #include "cetonrecorder.h"
14 #include "cetonchannel.h"
15 
16 #define LOC QString("CetonSigMon[%1](%2): ") \
17  .arg(m_inputid).arg(m_channel->GetDevice())
18 
34  CetonChannel* _channel,
35  bool _release_stream,
36  uint64_t _flags)
37  : DTVSignalMonitor(db_cardnum, _channel, _release_stream, _flags)
38 {
39  LOG(VB_CHANNEL, LOG_INFO, LOC + "ctor");
40 
42 
44 
46 }
47 
52 {
53  LOG(VB_CHANNEL, LOG_INFO, LOC + "dtor");
56 }
57 
62 {
63  LOG(VB_CHANNEL, LOG_INFO, LOC + "Stop() -- begin");
65  if (GetStreamData())
67  m_streamHandlerStarted = false;
68 
69  LOG(VB_CHANNEL, LOG_INFO, LOC + "Stop() -- end");
70 }
71 
73 {
74  return dynamic_cast<CetonChannel*>(m_channel);
75 }
76 
84 {
85  if (!m_running || m_exit)
86  return;
87 
89  {
90  EmitStatus();
91  if (IsAllGood())
93 
94  // TODO dtv signals...
95 
96  m_updateDone = true;
97  return;
98  }
99 
100  uint sig = 100; // TODO find some way to actually monitor signal level
101 
102  // Set SignalMonitorValues from info from card.
103  bool isLocked = false;
104  {
105  QMutexLocker locker(&m_statusLock);
107  m_signalLock.SetValue(static_cast<int>(true));
108  // TODO add some way to indicate if there is actually a lock
109  isLocked = m_signalLock.IsGood();
110  }
111 
112  EmitStatus();
113  if (IsAllGood())
115 
116  // Start table monitoring if we are waiting on any table
117  // and we have a lock.
118  if (isLocked && GetStreamData() &&
122  {
124  m_streamHandlerStarted = true;
125  }
126 
127  m_updateDone = true;
128 }
DTVSignalMonitor::AddFlags
void AddFlags(uint64_t _flags) override
Definition: dtvsignalmonitor.cpp:140
CetonSignalMonitor::Stop
void Stop(void) override
Stop signal monitoring and table monitoring threads.
Definition: cetonsignalmonitor.cpp:61
SignalMonitorValue::SetValue
void SetValue(int _value)
Definition: signalmonitorvalue.h:74
SignalMonitorValue::SetThreshold
void SetThreshold(int _threshold)
Definition: signalmonitorvalue.h:84
LOC
#define LOC
-*- Mode: c++ -*- CetonSignalMonitor Copyright (c) 2011 Ronald Frazier Copyright (c) 2006 Daniel Kris...
Definition: cetonsignalmonitor.cpp:16
SignalMonitor::m_channel
ChannelBase * m_channel
Definition: signalmonitor.h:202
SignalMonitor::kDTVSigMon_WaitForMGT
static const uint64_t kDTVSigMon_WaitForMGT
Definition: signalmonitor.h:182
IPTVStreamHandler::AddListener
void AddListener(MPEGStreamData *data, bool=false, bool=false, const QString &output_file=QString()) override
Definition: iptvstreamhandler.h:88
SignalMonitor::m_exit
volatile bool m_exit
Definition: signalmonitor.h:226
mythdbcon.h
DTVSignalMonitor::GetStreamData
MPEGStreamData * GetStreamData()
Returns the MPEG stream data if it exists.
Definition: dtvsignalmonitor.h:59
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:23
CetonChannel
Definition: cetonchannel.h:22
SignalMonitor::m_running
volatile bool m_running
Definition: signalmonitor.h:225
SignalMonitor::HasAnyFlag
bool HasAnyFlag(uint64_t _flags) const
Definition: signalmonitor.cpp:282
SignalMonitor::kSigMon_WaitForSig
static const uint64_t kSigMon_WaitForSig
Definition: signalmonitor.h:186
StreamHandler::RemoveListener
virtual void RemoveListener(MPEGStreamData *data)
Definition: streamhandler.cpp:78
cetonchannel.h
SignalMonitor::m_signalStrength
SignalMonitorValue m_signalStrength
Definition: signalmonitor.h:218
mythlogging.h
SignalMonitor::m_inputid
int m_inputid
Definition: signalmonitor.h:204
cetonsignalmonitor.h
SignalMonitor::m_signalLock
SignalMonitorValue m_signalLock
Definition: signalmonitor.h:217
SignalMonitor::SendMessageAllGood
void SendMessageAllGood(void)
Definition: signalmonitor.cpp:467
SignalMonitor::kDTVSigMon_WaitForPMT
static const uint64_t kDTVSigMon_WaitForPMT
Definition: signalmonitor.h:181
SignalMonitor::kDTVSigMon_WaitForPAT
static const uint64_t kDTVSigMon_WaitForPAT
Definition: signalmonitor.h:180
SignalMonitor::m_updateDone
bool m_updateDone
Definition: signalmonitor.h:209
SignalMonitor::kDTVSigMon_WaitForNIT
static const uint64_t kDTVSigMon_WaitForNIT
Definition: signalmonitor.h:184
SignalMonitor::EmitStatus
virtual void EmitStatus(void)
Definition: signalmonitor.cpp:474
SignalMonitor::kDTVSigMon_WaitForSDT
static const uint64_t kDTVSigMon_WaitForSDT
Definition: signalmonitor.h:185
CetonSignalMonitor::GetCetonChannel
CetonChannel * GetCetonChannel(void)
Definition: cetonsignalmonitor.cpp:72
CetonSignalMonitor::m_streamHandler
CetonStreamHandler * m_streamHandler
Definition: cetonsignalmonitor.h:36
cetonstreamhandler.h
uint
unsigned int uint
Definition: compat.h:141
SignalMonitorValue::IsGood
bool IsGood() const
Returns true if the value is equal to the threshold, or on the right side of the threshold (depends o...
Definition: signalmonitorvalue.h:56
cetonrecorder.h
CetonSignalMonitor::CetonSignalMonitor
CetonSignalMonitor(void)
CetonStreamHandler::Return
static void Return(CetonStreamHandler *&ref, int inputid)
Definition: cetonstreamhandler.cpp:70
CetonSignalMonitor::~CetonSignalMonitor
~CetonSignalMonitor() override
Stops signal monitoring and table monitoring threads.
Definition: cetonsignalmonitor.cpp:51
SignalMonitor::m_statusLock
QMutex m_statusLock
Definition: signalmonitor.h:228
CetonStreamHandler::Get
static CetonStreamHandler * Get(const QString &devname, int inputid)
Definition: cetonstreamhandler.cpp:37
DTVSignalMonitor
This class is intended to detect the presence of needed tables.
Definition: dtvsignalmonitor.h:14
CetonSignalMonitor::UpdateValues
void UpdateValues(void) override
Fills in frontend stats and emits status Qt signals.
Definition: cetonsignalmonitor.cpp:83
ChannelBase::GetDevice
virtual QString GetDevice(void) const
Returns String representing device, useful for debugging.
Definition: channelbase.h:78
SignalMonitor::Stop
virtual void Stop()
Stop signal monitoring thread.
Definition: signalmonitor.cpp:306
DTVSignalMonitor::IsAllGood
bool IsAllGood(void) const override
Definition: dtvsignalmonitor.cpp:564
SignalMonitor::kDTVSigMon_WaitForVCT
static const uint64_t kDTVSigMon_WaitForVCT
Definition: signalmonitor.h:183
CetonSignalMonitor::m_streamHandlerStarted
bool m_streamHandlerStarted
Definition: cetonsignalmonitor.h:35