SignalMonitor Class Reference

Signal monitoring base class. More...

#include <signalmonitor.h>

Inheritance diagram for SignalMonitor:
MThread AnalogSignalMonitor DTVSignalMonitor ScriptSignalMonitor ASISignalMonitor CetonSignalMonitor DVBSignalMonitor FirewireSignalMonitor HDHRSignalMonitor IPTVSignalMonitor

List of all members.

Public Member Functions

virtual ~SignalMonitor ()
 Stops monitoring thread.
virtual void Start ()
 Start signal monitoring thread.
virtual void Stop ()
 Stop signal monitoring thread.
virtual void AddFlags (uint64_t _flags)
virtual void RemoveFlags (uint64_t _flags)
bool HasFlags (uint64_t _flags) const
bool HasAnyFlag (uint64_t _flags) const
uint64_t GetFlags (void) const
virtual bool HasExtraSlowTuning (void) const
bool GetNotifyFrontend () const
 Returns whether or not a SIGNAL MythEvent is being sent regularly to the frontend.
int GetUpdateRate () const
 Returns milliseconds between signal monitoring events.
virtual QStringList GetStatusList (void) const
 Returns QStringList containing all signals and their current values.
bool HasSignalLock (void) const
 Returns true iff scriptStatus.IsGood() and signalLock.IsGood() return true.
virtual bool IsAllGood (void) const
bool IsErrored (void) const
void SetNotifyFrontend (bool notify)
 Enables or disables frontend notification of the current signal value.
void SetMonitoring (TVRec *parent, bool EITscan, bool monitor)
 Indicate if table monitoring is needed.
void SetUpdateRate (int msec)
 Sets the number of milliseconds between signal monitoring attempts in the signal monitoring thread.
void AddListener (SignalMonitorListener *listener)
void RemoveListener (SignalMonitorListener *listener)
void SendMessage (SignalMonitorMessageType type, const SignalMonitorValue &val)
void SendMessageAllGood (void)
virtual void EmitStatus (void)

Static Public Member Functions

static bool IsRequired (const QString &cardtype)
 Returns true iff the card type supports signal monitoring.
static bool IsSupported (const QString &cardtype)
static SignalMonitorInit (QString cardtype, int db_cardnum, ChannelBase *channel)

Static Public Attributes

static const uint64_t kDTVSigMon_PATSeen = 0x0000000001ULL
 We've seen a PAT, which maps MPEG program numbers to pids where we find PMTs.
static const uint64_t kDTVSigMon_PMTSeen = 0x0000000002ULL
 We've seen a PMT, which maps program to audio, video and other stream PIDs.
static const uint64_t kDTVSigMon_MGTSeen = 0x0000000004ULL
 We've seen a MGT, which tells us on which PIDs to find VCT and other ATSC tables.
static const uint64_t kDTVSigMon_VCTSeen = 0x0000000008ULL
 We've seen a VCT, which maps ATSC Channels to MPEG program numbers, and provides additional data.
static const uint64_t kDTVSigMon_TVCTSeen = 0x0000000010ULL
 We've seen a TVCT, the terrestrial version of the VCT.
static const uint64_t kDTVSigMon_CVCTSeen = 0x0000000020ULL
 We've seen a CVCT, the cable version of the VCT.
static const uint64_t kDTVSigMon_NITSeen = 0x0000000040ULL
 We've seen a NIT, which tells us where to find SDT and other DVB tables.
static const uint64_t kDTVSigMon_SDTSeen = 0x0000000080ULL
 We've seen a SDT, which maps DVB Channels to MPEG program numbers, and provides additional data.
static const uint64_t kFWSigMon_PowerSeen = 0x0000000100ULL
 We've seen the FireWire STB power state.
static const uint64_t kDTVSigMon_CryptSeen = 0x0000000200ULL
 We've seen something indicating whether the data stream is encrypted.
static const uint64_t kDTVSigMon_PATMatch = 0x0000001000ULL
 We've seen a PAT matching our requirements.
static const uint64_t kDTVSigMon_PMTMatch = 0x0000002000ULL
 We've seen a PMT matching our requirements.
static const uint64_t kDTVSigMon_MGTMatch = 0x0000004000ULL
 We've seen an MGT matching our requirements.
static const uint64_t kDTVSigMon_VCTMatch = 0x0000008000ULL
 We've seen a VCT matching our requirements.
static const uint64_t kDTVSigMon_TVCTMatch = 0x0000010000ULL
 We've seen a TVCT matching our requirements.
static const uint64_t kDTVSigMon_CVCTMatch = 0x0000020000ULL
 We've seen a CVCT matching our requirements.
static const uint64_t kDTVSigMon_NITMatch = 0x0000040000ULL
 We've seen an NIT matching our requirements.
static const uint64_t kDTVSigMon_SDTMatch = 0x0000080000ULL
 We've seen an SDT matching our requirements.
static const uint64_t kFWSigMon_PowerMatch = 0x0000100000ULL
 We've seen a FireWire STB power state matching our requirements.
static const uint64_t kDTVSigMon_CryptMatch = 0x0000200000ULL
 We've seen unencrypted data in data stream.
static const uint64_t kDTVSigMon_WaitForPAT = 0x0001000000ULL
static const uint64_t kDTVSigMon_WaitForPMT = 0x0002000000ULL
static const uint64_t kDTVSigMon_WaitForMGT = 0x0004000000ULL
static const uint64_t kDTVSigMon_WaitForVCT = 0x0008000000ULL
static const uint64_t kDTVSigMon_WaitForNIT = 0x0010000000ULL
static const uint64_t kDTVSigMon_WaitForSDT = 0x0020000000ULL
static const uint64_t kSigMon_WaitForSig = 0x0040000000ULL
static const uint64_t kFWSigMon_WaitForPower = 0x0080000000ULL
static const uint64_t kDTVSigMon_WaitForCrypt = 0x0100000000ULL
static const uint64_t kDTVSigMon_WaitForAll = 0x01FF000000ULL
static const uint64_t kDVBSigMon_WaitForSNR = 0x1000000000ULL
 Wait for the Signal to Noise Ratio to rise above a threshold.
static const uint64_t kDVBSigMon_WaitForBER = 0x2000000000ULL
 Wait for the Bit Error Rate to fall below a threshold.
static const uint64_t kDVBSigMon_WaitForUB = 0x4000000000ULL
 Wait for uncorrected FEC blocks to fall below a threshold.
static const uint64_t kDVBSigMon_WaitForPos = 0x8000000000ULL
 Wait for rotor to complete turning the antenna.

Protected Member Functions

 SignalMonitor (int db_cardnum, ChannelBase *_channel, uint64_t wait_for_mask)
 Initializes signal lock and signal values.
virtual void run (void)
 Basic signal monitoring loop.
virtual void UpdateValues (void)
 This should be overridden to actually do signal monitoring.

Protected Attributes

ChannelBasechannel
TVRecpParent
int capturecardnum
volatile uint64_t flags
int update_rate
uint minimum_update_rate
bool update_done
bool notify_frontend
bool tablemon
bool eit_scan
QString error
SignalMonitorValue signalLock
SignalMonitorValue signalStrength
SignalMonitorValue scriptStatus
vector< SignalMonitorListener * > listeners
QMutex startStopLock
QWaitCondition startStopWait
volatile bool running
volatile bool exit
QMutex statusLock
QMutex listenerLock

Detailed Description

Signal monitoring base class.

Signal monitors should extend this to add signal monitoring to their recorder. All signal monitors must implement one signals, the StatusSignalLock(int) signal. The lock signal should only be set to true when it is absolutely safe to begin or to continue recording. The optional StatusSignalStrength signal should report the actual signal value.

Additional signals may be implemented, see DTVSignalMonitor and DVBSignalMonitor for example.

See also:
AnalocSignalMonitor, DTVSignalMonitor, DVBSignalMonitor, HDHRSignalMonitor, SignalMonitorValue

Definition at line 31 of file signalmonitor.h.


Constructor & Destructor Documentation

SignalMonitor::~SignalMonitor (  )  [virtual]

Stops monitoring thread.

Definition at line 217 of file signalmonitor.cpp.

SignalMonitor::SignalMonitor ( int  _capturecardnum,
ChannelBase _channel,
uint64_t  wait_for_mask 
) [protected]

Initializes signal lock and signal values.

Start() must be called to actually begin continuous signal monitoring.

Parameters:
db_cardnum Recorder number to monitor, if this is less than 0, SIGNAL events will not be sent to the frontend even if SetNotifyFrontend(true) is called.
_channel ChannelBase class for our monitoring
wait_for_mask SignalMonitorFlags to start with.

Definition at line 191 of file signalmonitor.cpp.


Member Function Documentation

bool SignalMonitor::IsRequired ( const QString &  cardtype  )  [inline, static]

Returns true iff the card type supports signal monitoring.

Definition at line 299 of file signalmonitor.h.

Referenced by RemoteEncoder::GetSignalLockTimeout(), IsSupported(), and TVRec::TuningFrequency().

bool SignalMonitor::IsSupported ( const QString &  cardtype  )  [inline, static]

Definition at line 304 of file signalmonitor.h.

Referenced by TVRec::SetSignalMonitoringRate(), and TVRec::SetupSignalMonitor().

SignalMonitor * SignalMonitor::Init ( QString  cardtype,
int  db_cardnum,
ChannelBase channel 
) [static]

Definition at line 84 of file signalmonitor.cpp.

Referenced by TVRec::SetupSignalMonitor().

void SignalMonitor::Start ( void   )  [virtual]

Start signal monitoring thread.

Definition at line 248 of file signalmonitor.cpp.

Referenced by ChannelScanSM::ScanTransport(), and TVRec::SetupSignalMonitor().

void SignalMonitor::Stop ( void   )  [virtual]
void SignalMonitor::AddFlags ( uint64_t  _flags  )  [virtual]

Reimplemented in DTVSignalMonitor.

Definition at line 223 of file signalmonitor.cpp.

void SignalMonitor::RemoveFlags ( uint64_t  _flags  )  [virtual]

Reimplemented in DTVSignalMonitor.

Definition at line 229 of file signalmonitor.cpp.

bool SignalMonitor::HasFlags ( uint64_t  _flags  )  const
bool SignalMonitor::HasAnyFlag ( uint64_t  _flags  )  const
uint64_t SignalMonitor::GetFlags ( void   )  const [inline]

Definition at line 54 of file signalmonitor.h.

virtual bool SignalMonitor::HasExtraSlowTuning ( void   )  const [inline, virtual]

Reimplemented in IPTVSignalMonitor.

Definition at line 55 of file signalmonitor.h.

Referenced by TVRec::SetupSignalMonitor().

bool SignalMonitor::GetNotifyFrontend (  )  const [inline]

Returns whether or not a SIGNAL MythEvent is being sent regularly to the frontend.

Definition at line 62 of file signalmonitor.h.

int SignalMonitor::GetUpdateRate (  )  const [inline]

Returns milliseconds between signal monitoring events.

Definition at line 64 of file signalmonitor.h.

QStringList SignalMonitor::GetStatusList ( void   )  const [virtual]

Returns QStringList containing all signals and their current values.

This serializes the signal monitoring values so that they can be passed from a backend to a frontend.

SignalMonitorValue::Parse(const QStringList&) will convert this to a vector of SignalMonitorValue instances.

Reimplemented in DTVSignalMonitor, and DVBSignalMonitor.

Definition at line 288 of file signalmonitor.cpp.

Referenced by run().

bool SignalMonitor::HasSignalLock ( void   )  const [inline]

Returns true iff scriptStatus.IsGood() and signalLock.IsGood() return true.

Definition at line 69 of file signalmonitor.h.

Referenced by ChannelScanSM::HasTimedOut(), IsAllGood(), and ChannelScanSM::UpdateChannelInfo().

virtual bool SignalMonitor::IsAllGood ( void   )  const [inline, virtual]
bool SignalMonitor::IsErrored ( void   )  const [inline]

Definition at line 76 of file signalmonitor.h.

Referenced by TVRec::TuningSignalCheck().

void SignalMonitor::SetNotifyFrontend ( bool  notify  )  [inline]

Enables or disables frontend notification of the current signal value.

Parameters:
notify if true SIGNAL MythEvents are sent to the frontend, otherwise they are not.

Definition at line 86 of file signalmonitor.h.

Referenced by TVRec::SetupSignalMonitor().

void SignalMonitor::SetMonitoring ( TVRec parent,
bool  EITscan,
bool  monitor 
) [inline]

Indicate if table monitoring is needed.

Parameters:
monitor if true parent->SetupDTVSignalMonitor is called after the channel is tuned.

Definition at line 92 of file signalmonitor.h.

void SignalMonitor::SetUpdateRate ( int  msec  )  [inline]

Sets the number of milliseconds between signal monitoring attempts in the signal monitoring thread.

Defaults to 25 milliseconds.

Parameters:
msec Milliseconds between signal monitoring events.

Definition at line 101 of file signalmonitor.h.

Referenced by TVRec::SetupSignalMonitor().

void SignalMonitor::AddListener ( SignalMonitorListener listener  ) 
void SignalMonitor::RemoveListener ( SignalMonitorListener listener  ) 

Definition at line 356 of file signalmonitor.cpp.

Referenced by ChannelScanSM::SetAnalog(), and ChannelScanSM::~ChannelScanSM().

void SignalMonitor::SendMessage ( SignalMonitorMessageType  type,
const SignalMonitorValue val 
)

Definition at line 370 of file signalmonitor.cpp.

Referenced by EmitStatus(), and DVBSignalMonitor::EmitStatus().

void SignalMonitor::SendMessageAllGood ( void   ) 
void SignalMonitor::EmitStatus ( void   )  [virtual]
void SignalMonitor::run ( void   )  [protected, virtual]

Basic signal monitoring loop.

Reimplemented from MThread.

Definition at line 302 of file signalmonitor.cpp.

void SignalMonitor::UpdateValues ( void   )  [protected, virtual]

This should be overridden to actually do signal monitoring.

Reimplemented in AnalogSignalMonitor, ASISignalMonitor, CetonSignalMonitor, DVBSignalMonitor, FirewireSignalMonitor, HDHRSignalMonitor, IPTVSignalMonitor, and ScriptSignalMonitor.

Definition at line 418 of file signalmonitor.cpp.

Referenced by run().


Member Data Documentation

const uint64_t SignalMonitor::kDTVSigMon_PATSeen = 0x0000000001ULL [static]

We've seen a PAT, which maps MPEG program numbers to pids where we find PMTs.

Definition at line 125 of file signalmonitor.h.

Referenced by FirewireSignalMonitor::HandlePAT(), DTVSignalMonitor::HandlePAT(), DTVSignalMonitor::SetChannel(), sm_flags_to_string(), and DTVSignalMonitor::UpdateMonitorValues().

const uint64_t SignalMonitor::kDTVSigMon_PMTSeen = 0x0000000002ULL [static]
const uint64_t SignalMonitor::kDTVSigMon_MGTSeen = 0x0000000004ULL [static]

We've seen a MGT, which tells us on which PIDs to find VCT and other ATSC tables.

Definition at line 131 of file signalmonitor.h.

Referenced by DTVSignalMonitor::HandleMGT(), sm_flags_to_string(), and DTVSignalMonitor::UpdateMonitorValues().

const uint64_t SignalMonitor::kDTVSigMon_VCTSeen = 0x0000000008ULL [static]

We've seen a VCT, which maps ATSC Channels to MPEG program numbers, and provides additional data.

Definition at line 134 of file signalmonitor.h.

Referenced by DTVSignalMonitor::HandleCVCT(), DTVSignalMonitor::HandleTVCT(), DTVSignalMonitor::SetChannel(), sm_flags_to_string(), and DTVSignalMonitor::UpdateMonitorValues().

const uint64_t SignalMonitor::kDTVSigMon_TVCTSeen = 0x0000000010ULL [static]

We've seen a TVCT, the terrestrial version of the VCT.

Definition at line 136 of file signalmonitor.h.

Referenced by DTVSignalMonitor::HandleTVCT(), and sm_flags_to_string().

const uint64_t SignalMonitor::kDTVSigMon_CVCTSeen = 0x0000000020ULL [static]

We've seen a CVCT, the cable version of the VCT.

Definition at line 138 of file signalmonitor.h.

Referenced by DTVSignalMonitor::HandleCVCT(), and sm_flags_to_string().

const uint64_t SignalMonitor::kDTVSigMon_NITSeen = 0x0000000040ULL [static]

We've seen a NIT, which tells us where to find SDT and other DVB tables.

Definition at line 141 of file signalmonitor.h.

Referenced by DTVSignalMonitor::HandleNIT(), sm_flags_to_string(), and DTVSignalMonitor::UpdateMonitorValues().

const uint64_t SignalMonitor::kDTVSigMon_SDTSeen = 0x0000000080ULL [static]

We've seen a SDT, which maps DVB Channels to MPEG program numbers, and provides additional data.

Definition at line 144 of file signalmonitor.h.

Referenced by DTVSignalMonitor::HandleSDT(), DTVSignalMonitor::SetDVBService(), sm_flags_to_string(), and DTVSignalMonitor::UpdateMonitorValues().

const uint64_t SignalMonitor::kFWSigMon_PowerSeen = 0x0000000100ULL [static]

We've seen the FireWire STB power state.

Definition at line 146 of file signalmonitor.h.

Referenced by sm_flags_to_string(), and FirewireSignalMonitor::UpdateValues().

const uint64_t SignalMonitor::kDTVSigMon_CryptSeen = 0x0000000200ULL [static]
const uint64_t SignalMonitor::kDTVSigMon_PATMatch = 0x0000001000ULL [static]
const uint64_t SignalMonitor::kDTVSigMon_PMTMatch = 0x0000002000ULL [static]
const uint64_t SignalMonitor::kDTVSigMon_MGTMatch = 0x0000004000ULL [static]

We've seen an MGT matching our requirements.

Definition at line 155 of file signalmonitor.h.

Referenced by DTVSignalMonitor::HandleMGT(), sm_flags_to_string(), and DTVSignalMonitor::UpdateMonitorValues().

const uint64_t SignalMonitor::kDTVSigMon_VCTMatch = 0x0000008000ULL [static]
const uint64_t SignalMonitor::kDTVSigMon_TVCTMatch = 0x0000010000ULL [static]

We've seen a TVCT matching our requirements.

Definition at line 159 of file signalmonitor.h.

Referenced by DTVSignalMonitor::HandleTVCT(), and sm_flags_to_string().

const uint64_t SignalMonitor::kDTVSigMon_CVCTMatch = 0x0000020000ULL [static]

We've seen a CVCT matching our requirements.

Definition at line 161 of file signalmonitor.h.

Referenced by DTVSignalMonitor::HandleCVCT(), and sm_flags_to_string().

const uint64_t SignalMonitor::kDTVSigMon_NITMatch = 0x0000040000ULL [static]

We've seen an NIT matching our requirements.

Definition at line 163 of file signalmonitor.h.

Referenced by sm_flags_to_string(), and DTVSignalMonitor::UpdateMonitorValues().

const uint64_t SignalMonitor::kDTVSigMon_SDTMatch = 0x0000080000ULL [static]

We've seen an SDT matching our requirements.

Definition at line 165 of file signalmonitor.h.

Referenced by DTVSignalMonitor::HandleSDT(), DTVSignalMonitor::SetDVBService(), sm_flags_to_string(), and DTVSignalMonitor::UpdateMonitorValues().

const uint64_t SignalMonitor::kFWSigMon_PowerMatch = 0x0000100000ULL [static]

We've seen a FireWire STB power state matching our requirements.

Definition at line 167 of file signalmonitor.h.

Referenced by sm_flags_to_string(), and FirewireSignalMonitor::UpdateValues().

const uint64_t SignalMonitor::kDTVSigMon_CryptMatch = 0x0000200000ULL [static]
const uint64_t SignalMonitor::kDTVSigMon_WaitForPAT = 0x0001000000ULL [static]
const uint64_t SignalMonitor::kDTVSigMon_WaitForPMT = 0x0002000000ULL [static]
const uint64_t SignalMonitor::kDTVSigMon_WaitForMGT = 0x0004000000ULL [static]
const uint64_t SignalMonitor::kDTVSigMon_WaitForVCT = 0x0008000000ULL [static]
const uint64_t SignalMonitor::kDTVSigMon_WaitForNIT = 0x0010000000ULL [static]
const uint64_t SignalMonitor::kDTVSigMon_WaitForSDT = 0x0020000000ULL [static]
const uint64_t SignalMonitor::kSigMon_WaitForSig = 0x0040000000ULL [static]
const uint64_t SignalMonitor::kFWSigMon_WaitForPower = 0x0080000000ULL [static]

Definition at line 178 of file signalmonitor.h.

Referenced by sm_flags_to_string(), and FirewireSignalMonitor::UpdateValues().

const uint64_t SignalMonitor::kDTVSigMon_WaitForCrypt = 0x0100000000ULL [static]
const uint64_t SignalMonitor::kDTVSigMon_WaitForAll = 0x01FF000000ULL [static]

Definition at line 181 of file signalmonitor.h.

const uint64_t SignalMonitor::kDVBSigMon_WaitForSNR = 0x1000000000ULL [static]

Wait for the Signal to Noise Ratio to rise above a threshold.

Definition at line 184 of file signalmonitor.h.

Referenced by DVBSignalMonitor::DVBSignalMonitor(), DVBSignalMonitor::EmitStatus(), DVBSignalMonitor::GetStatusList(), sm_flags_to_string(), and DVBSignalMonitor::UpdateValues().

const uint64_t SignalMonitor::kDVBSigMon_WaitForBER = 0x2000000000ULL [static]

Wait for the Bit Error Rate to fall below a threshold.

Definition at line 186 of file signalmonitor.h.

Referenced by DVBSignalMonitor::DVBSignalMonitor(), DVBSignalMonitor::EmitStatus(), DVBSignalMonitor::GetStatusList(), sm_flags_to_string(), and DVBSignalMonitor::UpdateValues().

const uint64_t SignalMonitor::kDVBSigMon_WaitForUB = 0x4000000000ULL [static]

Wait for uncorrected FEC blocks to fall below a threshold.

Definition at line 188 of file signalmonitor.h.

Referenced by DVBSignalMonitor::DVBSignalMonitor(), DVBSignalMonitor::EmitStatus(), DVBSignalMonitor::GetStatusList(), sm_flags_to_string(), and DVBSignalMonitor::UpdateValues().

const uint64_t SignalMonitor::kDVBSigMon_WaitForPos = 0x8000000000ULL [static]

Definition at line 194 of file signalmonitor.h.

Referenced by SetMonitoring().

Definition at line 195 of file signalmonitor.h.

Referenced by run().

volatile uint64_t SignalMonitor::flags [protected]
int SignalMonitor::update_rate [protected]

Definition at line 197 of file signalmonitor.h.

Referenced by GetUpdateRate(), run(), and SetUpdateRate().

Definition at line 198 of file signalmonitor.h.

Referenced by DVBSignalMonitor::DVBSignalMonitor(), and SetUpdateRate().

Definition at line 200 of file signalmonitor.h.

Referenced by GetNotifyFrontend(), run(), and SetNotifyFrontend().

Definition at line 201 of file signalmonitor.h.

Referenced by SetMonitoring().

Definition at line 202 of file signalmonitor.h.

Referenced by SetMonitoring().

QString SignalMonitor::error [protected]

Definition at line 209 of file signalmonitor.h.

Referenced by AddListener(), RemoveListener(), SendMessage(), and SendMessageAllGood().

QMutex SignalMonitor::startStopLock [protected]

Definition at line 211 of file signalmonitor.h.

Referenced by run(), Start(), and Stop().

QWaitCondition SignalMonitor::startStopWait [protected]

Definition at line 212 of file signalmonitor.h.

Referenced by run(), and Start().

volatile bool SignalMonitor::running [protected]
volatile bool SignalMonitor::exit [protected]
QMutex SignalMonitor::statusLock [mutable, protected]
QMutex SignalMonitor::listenerLock [mutable, protected]

Definition at line 217 of file signalmonitor.h.

Referenced by AddListener(), RemoveListener(), SendMessage(), and SendMessageAllGood().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends
Generated on Mon May 28 06:42:27 2012 for MythTV by  doxygen 1.6.3