MythTV  0.26-pre
Public Types | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | Friends
ChannelScanSM Class Reference

Scanning class for cards that support a SignalMonitor class. More...

#include <channelscan_sm.h>

Inheritance diagram for ChannelScanSM:
MPEGStreamListener ATSCMainStreamListener DVBMainStreamListener DVBOtherStreamListener

List of all members.

Public Types

typedef QMap< uint,
ChannelInsertInfo
chan_info_map_t

Public Member Functions

 ChannelScanSM (ScanMonitor *_scan_monitor, const QString &_cardtype, ChannelBase *_channel, int _sourceID, uint signal_timeout, uint channel_timeout, const QString &_inputname, bool test_decryption)
 ~ChannelScanSM ()
void StartScanner (void)
 Starts the ChannelScanSM event loop.
void StopScanner (void)
 Stops the ChannelScanSM event loop and the signal monitor, blocking until both exit.
bool ScanTransports (int src, const QString &std, const QString &mod, const QString &table, const QString &table_start=QString::null, const QString &table_end=QString::null)
 Generates a list of frequencies to scan and adds it to the scanTransport list, and then sets the scanning to TRANSPORT_LIST.
bool ScanTransportsStartingOn (int sourceid, const QMap< QString, QString > &valueMap)
 Generates a list of frequencies to scan and adds it to the scanTransport list, and then sets the scanning to TRANSPORT_LIST.
bool ScanTransport (uint mplexid, bool follow_nit)
bool ScanCurrentTransport (const QString &sistandard)
bool ScanForChannels (uint sourceid, const QString &std, const QString &cardtype, const DTVChannelList &)
bool ScanExistingTransports (uint sourceid, bool follow_nit)
 If we are not already scanning a frequency table, this creates a new frequency table from database and begins scanning it.
void SetAnalog (bool is_analog)
void SetSourceID (int _SourceID)
void SetSignalTimeout (uint val)
void SetChannelTimeout (uint val)
void SetScanDTVTunerType (DTVTunerType t)
uint GetSignalTimeout (void) const
uint GetChannelTimeout (void) const
SignalMonitorGetSignalMonitor (void)
DTVSignalMonitorGetDTVSignalMonitor (void)
DVBSignalMonitorGetDVBSignalMonitor (void)
chan_info_map_t GetChannelList (transport_scan_items_it_t trans_info, ScannedChannelInfo *scan_info) const
uint GetCurrentTransportInfo (QString &chan, QString &chan_tr) const
ScanDTVTransportList GetChannelList (void) const
void HandlePAT (const ProgramAssociationTable *)
void HandleCAT (const ConditionalAccessTable *)
void HandlePMT (uint, const ProgramMapTable *)
void HandleEncryptionStatus (uint pnum, bool encrypted)
void HandleSTT (const SystemTimeTable *)
void HandleMGT (const MasterGuideTable *)
void HandleVCT (uint tsid, const VirtualChannelTable *)
void HandleNIT (const NetworkInformationTable *)
void HandleSDT (uint tsid, const ServiceDescriptionTable *)
void HandleTDT (const TimeDateTable *)
void HandleNITo (const NetworkInformationTable *)
void HandleSDTo (uint tsid, const ServiceDescriptionTable *)
void HandleBAT (const BouquetAssociationTable *)

Private Member Functions

DTVChannelGetDTVChannel (void)
const DTVChannelGetDTVChannel (void) const
V4LChannelGetV4LChannel (void)
HDHRChannelGetHDHRChannel (void)
DVBChannelGetDVBChannel (void)
const DVBChannelGetDVBChannel (void) const
void run (void)
 This runs the event loop for ChannelScanSM until 'threadExit' is true.
bool HasTimedOut (void)
void HandleActiveScan (void)
 Handles the TRANSPORT_LIST ChannelScanSM mode.
bool Tune (const transport_scan_items_it_t transport)
uint InsertMultiplex (const transport_scan_items_it_t transport)
void ScanTransport (const transport_scan_items_it_t transport)
DTVTunerType GuessDTVTunerType (DTVTunerType) const
void UpdateScanPercentCompleted (void)
 Updates Transport Scan progress bar.
bool CheckImportedList (const DTVChannelInfoList &, uint mpeg_program_num, QString &service_name, QString &callsign, QString &common_status_info)
 If we as scanning a dvb-utils import verify channel is in list.
void IgnoreDataOnlyMsg (const QString &name, int aux_num)
void IgnoreEmptyChanMsg (const QString &name, int aux_num)
void IgnoreAudioOnlyMsg (const QString &name, int aux_num)
void IgnoreEncryptedMsg (const QString &name, int aux_num)
bool TestNextProgramEncryption (void)
void UpdateScanTransports (const NetworkInformationTable *nit)
bool UpdateChannelInfo (bool wait_until_complete)
void HandleAllGood (void)
bool AddToList (uint mplexid)

Static Private Member Functions

static QString loc (const ChannelScanSM *)

Private Attributes

ScanMonitorscan_monitor
ChannelBasechannel
SignalMonitorsignalMonitor
int sourceID
uint signalTimeout
uint channelTimeout
uint otherTableTimeout
uint otherTableTime
bool setOtherTables
QString inputname
bool m_test_decryption
bool extend_scan_list
DTVTunerType scanDTVTunerType
QMutex lock
 The big lock.
bool scanning
volatile bool threadExit
bool waitingForTables
QTime timer
int transportsScanned
QSet< uint32_tts_scanned
QMap< uint32_t, DTVMultiplexextend_transports
transport_scan_items_t scanTransports
transport_scan_items_it_t current
transport_scan_items_it_t nextIt
bool currentTestingDecryption
QMap< uint, uintcurrentEncryptionStatus
QMap< uint, boolcurrentEncryptionStatusChecked
QMap< uint64_t, QString > defAuthorities
ChannelList channelList
 Found Channel Info.
uint channelsFound
ScannedChannelInfocurrentInfo
AnalogSignalHandleranalogSignalHandler
MThreadscannerThread
 Scanner thread, runs ChannelScanSM::run()

Static Private Attributes

static const uint kDVBTableTimeout = 30 * 1000
 SDT's should be sent every 2 seconds and NIT's every 10 seconds, so lets wait at least 30 seconds, in case of bad transmitter or lost packets.
static const uint kATSCTableTimeout = 10 * 1000
 No logic here, lets just wait at least 10 seconds.
static const uint kMPEGTableTimeout = 15 * 1000
 No logic here, lets just wait at least 15 seconds.

Friends

class AnalogSignalHandler

Detailed Description

Scanning class for cards that support a SignalMonitor class.

With ScanStreamData, we call ScanTransport() on each transport and frequency offset in the list of transports. This list is created from a FrequencyTable object.

Each ScanTransport() call resets the ScanStreamData and the SignalMonitor, then tunes to a new frequency and notes the tuning time in the "timer" QTime object.

HandleActiveScan is called every time through the event loop and is what calls ScanTransport(), as well as checking when the current time is "timeoutTune" or "channelTimeout" milliseconds ahead of "timer". When the "timeoutTune" is exceeded we check to see if we have a signal lock on the channel, if we don't we check the next transport. When the larger "channelTimeout" is exceeded we do nothing unless "waitingForTables" is still true,

TODO

Definition at line 83 of file channelscan_sm.h.


Member Typedef Documentation

Definition at line 129 of file channelscan_sm.h.


Constructor & Destructor Documentation

ChannelScanSM::ChannelScanSM ( ScanMonitor _scan_monitor,
const QString &  _cardtype,
ChannelBase _channel,
int  _sourceID,
uint  signal_timeout,
uint  channel_timeout,
const QString &  _inputname,
bool  test_decryption 
)

Definition at line 137 of file channelscan_sm.cpp.

Definition at line 200 of file channelscan_sm.cpp.


Member Function Documentation

Starts the ChannelScanSM event loop.

Definition at line 1439 of file channelscan_sm.cpp.

Referenced by ChannelScanner::Scan().

Stops the ChannelScanSM event loop and the signal monitor, blocking until both exit.

Definition at line 1703 of file channelscan_sm.cpp.

Referenced by ChannelScannerCLI::HandleEvent(), ChannelScannerGUI::HandleEvent(), and ~ChannelScanSM().

bool ChannelScanSM::ScanTransports ( int  src,
const QString &  std,
const QString &  mod,
const QString &  table,
const QString &  table_start = QString::null,
const QString &  table_end = QString::null 
)

Generates a list of frequencies to scan and adds it to the scanTransport list, and then sets the scanning to TRANSPORT_LIST.

Definition at line 1725 of file channelscan_sm.cpp.

Referenced by ChannelScanner::Scan().

bool ChannelScanSM::ScanTransportsStartingOn ( int  sourceid,
const QMap< QString, QString > &  valueMap 
)

Generates a list of frequencies to scan and adds it to the scanTransport list, and then sets the scanning to TRANSPORT_LIST.

Definition at line 1850 of file channelscan_sm.cpp.

Referenced by ChannelScanner::Scan().

bool ChannelScanSM::ScanTransport ( uint  mplexid,
bool  follow_nit 
)

Definition at line 1976 of file channelscan_sm.cpp.

Referenced by HandleActiveScan(), and ChannelScanner::Scan().

bool ChannelScanSM::ScanCurrentTransport ( const QString &  sistandard)

Definition at line 1998 of file channelscan_sm.cpp.

Referenced by ChannelScanner::Scan().

bool ChannelScanSM::ScanForChannels ( uint  sourceid,
const QString &  std,
const QString &  cardtype,
const DTVChannelList channels 
)

Definition at line 1806 of file channelscan_sm.cpp.

Referenced by ChannelScanner::Scan().

bool ChannelScanSM::ScanExistingTransports ( uint  sourceid,
bool  follow_nit 
)

If we are not already scanning a frequency table, this creates a new frequency table from database and begins scanning it.

This is used by DVB to scan for channels we are told about from other channels.

Note: Something similar could be used with ATSC when EIT for other channels is available on another ATSC channel, as encouraged by the ATSC specification.

Definition at line 302 of file channelscan_sm.cpp.

Referenced by ChannelScanner::Scan().

Definition at line 229 of file channelscan_sm.cpp.

Referenced by ChannelScanner::Scan().

void ChannelScanSM::SetSourceID ( int  _SourceID) [inline]

Definition at line 117 of file channelscan_sm.h.

Definition at line 118 of file channelscan_sm.h.

Referenced by ChannelScanner::Scan().

Definition at line 119 of file channelscan_sm.h.

Definition at line 120 of file channelscan_sm.h.

Referenced by ChannelScanner::PreScanCommon().

Definition at line 122 of file channelscan_sm.h.

Referenced by ChannelScanner::Scan().

Definition at line 123 of file channelscan_sm.h.

Definition at line 125 of file channelscan_sm.h.

Referenced by HasTimedOut(), ChannelScanner::PreScanCommon(), and UpdateChannelInfo().

Definition at line 1381 of file channelscan_sm.cpp.

Referenced by HasTimedOut(), ChannelScanner::PreScanCommon(), and Tune().

uint ChannelScanSM::GetCurrentTransportInfo ( QString &  chan,
QString &  chan_tr 
) const

Definition at line 1098 of file channelscan_sm.cpp.

Referenced by TestNextProgramEncryption(), and UpdateChannelInfo().

Definition at line 1346 of file channelscan_sm.cpp.

Referenced by GetCurrentTransportInfo().

Implements MPEGStreamListener.

Definition at line 344 of file channelscan_sm.cpp.

void ChannelScanSM::HandleCAT ( const ConditionalAccessTable ) [inline, virtual]

Implements MPEGStreamListener.

Definition at line 137 of file channelscan_sm.h.

void ChannelScanSM::HandlePMT ( uint  ,
const ProgramMapTable pmt 
) [virtual]

Implements MPEGStreamListener.

Definition at line 361 of file channelscan_sm.cpp.

void ChannelScanSM::HandleEncryptionStatus ( uint  pnum,
bool  encrypted 
) [virtual]

Implements MPEGStreamListener.

Definition at line 532 of file channelscan_sm.cpp.

void ChannelScanSM::HandleSTT ( const SystemTimeTable ) [inline, virtual]

Implements ATSCMainStreamListener.

Definition at line 142 of file channelscan_sm.h.

void ChannelScanSM::HandleMGT ( const MasterGuideTable mgt) [virtual]

Implements ATSCMainStreamListener.

Definition at line 391 of file channelscan_sm.cpp.

void ChannelScanSM::HandleVCT ( uint  tsid,
const VirtualChannelTable vct 
) [virtual]

Implements ATSCMainStreamListener.

Definition at line 372 of file channelscan_sm.cpp.

Implements DVBMainStreamListener.

Definition at line 446 of file channelscan_sm.cpp.

void ChannelScanSM::HandleSDT ( uint  tsid,
const ServiceDescriptionTable sdt 
) [virtual]

Implements DVBMainStreamListener.

Definition at line 401 of file channelscan_sm.cpp.

void ChannelScanSM::HandleTDT ( const TimeDateTable ) [inline, virtual]

Implements DVBMainStreamListener.

Definition at line 149 of file channelscan_sm.h.

void ChannelScanSM::HandleNITo ( const NetworkInformationTable ) [inline, virtual]

Implements DVBOtherStreamListener.

Definition at line 152 of file channelscan_sm.h.

void ChannelScanSM::HandleSDTo ( uint  tsid,
const ServiceDescriptionTable sdt 
) [virtual]

Implements DVBOtherStreamListener.

Definition at line 500 of file channelscan_sm.cpp.

Implements DVBOtherStreamListener.

Definition at line 457 of file channelscan_sm.cpp.

Definition at line 1390 of file channelscan_sm.cpp.

Referenced by GetChannelList(), GuessDTVTunerType(), HandlePMT(), and Tune().

const DTVChannel * ChannelScanSM::GetDTVChannel ( void  ) const [private]

Definition at line 1395 of file channelscan_sm.cpp.

Definition at line 1427 of file channelscan_sm.cpp.

Definition at line 1400 of file channelscan_sm.cpp.

Definition at line 1409 of file channelscan_sm.cpp.

Referenced by HasTimedOut(), and TestNextProgramEncryption().

const DVBChannel * ChannelScanSM::GetDVBChannel ( void  ) const [private]

Definition at line 1418 of file channelscan_sm.cpp.

void ChannelScanSM::run ( void  ) [private]

This runs the event loop for ChannelScanSM until 'threadExit' is true.

Definition at line 1458 of file channelscan_sm.cpp.

Definition at line 1474 of file channelscan_sm.cpp.

Referenced by HandleActiveScan().

Handles the TRANSPORT_LIST ChannelScanSM mode.

Definition at line 1555 of file channelscan_sm.cpp.

Referenced by run().

bool ChannelScanSM::Tune ( const transport_scan_items_it_t  transport) [private]

Definition at line 1622 of file channelscan_sm.cpp.

Referenced by ScanTransport().

Definition at line 1647 of file channelscan_sm.cpp.

Definition at line 627 of file channelscan_sm.cpp.

Referenced by AddToList(), GetChannelList(), and UpdateScanTransports().

Updates Transport Scan progress bar.

Definition at line 253 of file channelscan_sm.h.

Referenced by HandleAllGood(), ScanTransport(), and UpdateChannelInfo().

bool ChannelScanSM::CheckImportedList ( const DTVChannelInfoList channels,
uint  mpeg_program_num,
QString &  service_name,
QString &  callsign,
QString &  common_status_info 
) [private]

If we as scanning a dvb-utils import verify channel is in list.

Definition at line 2020 of file channelscan_sm.cpp.

void ChannelScanSM::IgnoreDataOnlyMsg ( const QString &  name,
int  aux_num 
) [private]
void ChannelScanSM::IgnoreEmptyChanMsg ( const QString &  name,
int  aux_num 
) [private]
void ChannelScanSM::IgnoreAudioOnlyMsg ( const QString &  name,
int  aux_num 
) [private]
void ChannelScanSM::IgnoreEncryptedMsg ( const QString &  name,
int  aux_num 
) [private]

Definition at line 544 of file channelscan_sm.cpp.

Referenced by UpdateChannelInfo().

Definition at line 651 of file channelscan_sm.cpp.

Referenced by UpdateChannelInfo().

bool ChannelScanSM::UpdateChannelInfo ( bool  wait_until_complete) [private]

Definition at line 237 of file channelscan_sm.cpp.

Referenced by AnalogSignalHandler::AllGood().

bool ChannelScanSM::AddToList ( uint  mplexid) [private]

Definition at line 1914 of file channelscan_sm.cpp.

Referenced by ScanExistingTransports(), and ScanTransport().

QString ChannelScanSM::loc ( const ChannelScanSM siscan) [static, private]

Definition at line 75 of file channelscan_sm.cpp.


Friends And Related Function Documentation

friend class AnalogSignalHandler [friend]

Definition at line 89 of file channelscan_sm.h.


Member Data Documentation

const uint ChannelScanSM::kDVBTableTimeout = 30 * 1000 [static, private]

SDT's should be sent every 2 seconds and NIT's every 10 seconds, so lets wait at least 30 seconds, in case of bad transmitter or lost packets.

Definition at line 198 of file channelscan_sm.h.

Referenced by HasTimedOut().

const uint ChannelScanSM::kATSCTableTimeout = 10 * 1000 [static, private]

No logic here, lets just wait at least 10 seconds.

Definition at line 199 of file channelscan_sm.h.

Referenced by HasTimedOut().

const uint ChannelScanSM::kMPEGTableTimeout = 15 * 1000 [static, private]

No logic here, lets just wait at least 15 seconds.

Definition at line 200 of file channelscan_sm.h.

Referenced by HasTimedOut().

Definition at line 210 of file channelscan_sm.h.

Referenced by HandleBAT(), HandleSDT(), and HandleSDTo().

Definition at line 211 of file channelscan_sm.h.

Referenced by HandleBAT(), HandleSDT(), HandleSDTo(), and UpdateChannelInfo().

Definition at line 212 of file channelscan_sm.h.

Referenced by HandleSDT(), and UpdateChannelInfo().

QString ChannelScanSM::inputname [private]

Definition at line 213 of file channelscan_sm.h.

Referenced by ChannelScanSM(), and Tune().

Definition at line 214 of file channelscan_sm.h.

Referenced by TestNextProgramEncryption().

Definition at line 218 of file channelscan_sm.h.

Referenced by GuessDTVTunerType(), and SetScanDTVTunerType().

QMutex ChannelScanSM::lock [mutable, private]
volatile bool ChannelScanSM::threadExit [private]

Definition at line 225 of file channelscan_sm.h.

Referenced by run(), StartScanner(), and StopScanner().

QTime ChannelScanSM::timer [private]

Definition at line 231 of file channelscan_sm.h.

Referenced by HandleActiveScan(), HandleSDT(), and UpdateScanTransports().

Definition at line 238 of file channelscan_sm.h.

Referenced by TestNextProgramEncryption(), and UpdateChannelInfo().

QMap<uint64_t, QString> ChannelScanSM::defAuthorities [private]

Definition at line 239 of file channelscan_sm.h.

Referenced by GetChannelList(), HandleBAT(), and HandleSDTo().

Found Channel Info.

Definition at line 242 of file channelscan_sm.h.

Referenced by GetChannelList(), HandleActiveScan(), and UpdateChannelInfo().

Definition at line 243 of file channelscan_sm.h.

Referenced by HandleActiveScan(), ScanTransport(), and UpdateChannelInfo().

Definition at line 247 of file channelscan_sm.h.

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

Scanner thread, runs ChannelScanSM::run()

Definition at line 250 of file channelscan_sm.h.

Referenced by StartScanner(), and StopScanner().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends