MythTV master
cetonsignalmonitor.cpp
Go to the documentation of this file.
1
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())
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 {
125 }
126
127 m_updateDone = true;
128}
#define LOC
-*- Mode: c++ -*- CetonSignalMonitor Copyright (c) 2011 Ronald Frazier Copyright (c) 2006 Daniel Kris...
CetonChannel * GetCetonChannel(void)
~CetonSignalMonitor() override
Stops signal monitoring and table monitoring threads.
CetonStreamHandler * m_streamHandler
void UpdateValues(void) override
Fills in frontend stats and emits status Qt signals.
void Stop(void) override
Stop signal monitoring and table monitoring threads.
static void Return(CetonStreamHandler *&ref, int inputid)
static CetonStreamHandler * Get(const QString &devname, int inputid)
virtual QString GetDevice(void) const
Returns String representing device, useful for debugging.
Definition: channelbase.h:78
This class is intended to detect the presence of needed tables.
bool IsAllGood(void) const override
void AddFlags(uint64_t _flags) override
MPEGStreamData * GetStreamData()
Returns the MPEG stream data if it exists.
void AddListener(MPEGStreamData *data, bool=false, bool=false, const QString &output_file=QString()) override
void SetThreshold(int _threshold)
bool IsGood() const
Returns true if the value is equal to the threshold, or on the right side of the threshold (depends o...
void SetValue(int _value)
static const uint64_t kDTVSigMon_WaitForVCT
QRecursiveMutex m_statusLock
volatile bool m_exit
void SendMessageAllGood(void)
SignalMonitorValue m_signalLock
static const uint64_t kDTVSigMon_WaitForNIT
static const uint64_t kDTVSigMon_WaitForSDT
virtual void Stop()
Stop signal monitoring thread.
volatile bool m_running
ChannelBase * m_channel
static const uint64_t kDTVSigMon_WaitForPMT
virtual void EmitStatus(void)
static const uint64_t kSigMon_WaitForSig
static const uint64_t kDTVSigMon_WaitForPAT
static const uint64_t kDTVSigMon_WaitForMGT
SignalMonitorValue m_signalStrength
bool HasAnyFlag(uint64_t _flags) const
virtual void RemoveListener(MPEGStreamData *data)
unsigned int uint
Definition: freesurround.h:24
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:39