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
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.

ChannelScanSM::~ChannelScanSM ( void   ) 

Definition at line 200 of file channelscan_sm.cpp.


Member Function Documentation

void ChannelScanSM::StartScanner ( void   ) 

Starts the ChannelScanSM event loop.

Definition at line 1419 of file channelscan_sm.cpp.

Referenced by ChannelScanner::Scan().

void ChannelScanSM::StopScanner ( void   ) 

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

Definition at line 1678 of file channelscan_sm.cpp.

Referenced by ChannelScannerGUI::HandleEvent(), ChannelScannerCLI::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 1700 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 1825 of file channelscan_sm.cpp.

Referenced by ChannelScanner::Scan().

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

Definition at line 1951 of file channelscan_sm.cpp.

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

bool ChannelScanSM::ScanCurrentTransport ( const QString &  sistandard  ) 

Definition at line 1973 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 1781 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 300 of file channelscan_sm.cpp.

Referenced by ChannelScanner::Scan().

void ChannelScanSM::SetAnalog ( bool  is_analog  ) 

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.

void ChannelScanSM::SetSignalTimeout ( uint  val  )  [inline]

Definition at line 118 of file channelscan_sm.h.

Referenced by ChannelScanner::Scan().

void ChannelScanSM::SetChannelTimeout ( uint  val  )  [inline]

Definition at line 119 of file channelscan_sm.h.

void ChannelScanSM::SetScanDTVTunerType ( DTVTunerType  t  )  [inline]

Definition at line 120 of file channelscan_sm.h.

Referenced by ChannelScanner::PreScanCommon().

uint ChannelScanSM::GetSignalTimeout ( void   )  const [inline]

Definition at line 122 of file channelscan_sm.h.

Referenced by ChannelScanner::Scan().

uint ChannelScanSM::GetChannelTimeout ( void   )  const [inline]

Definition at line 123 of file channelscan_sm.h.

SignalMonitor* ChannelScanSM::GetSignalMonitor ( void   )  [inline]

Definition at line 125 of file channelscan_sm.h.

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

DTVSignalMonitor * ChannelScanSM::GetDTVSignalMonitor ( void   ) 
DVBSignalMonitor * ChannelScanSM::GetDVBSignalMonitor ( void   ) 

Definition at line 1361 of file channelscan_sm.cpp.

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

QMap< uint, ChannelInsertInfo > ChannelScanSM::GetChannelList ( transport_scan_items_it_t  trans_info,
ScannedChannelInfo scan_info 
) const
uint ChannelScanSM::GetCurrentTransportInfo ( QString &  chan,
QString &  chan_tr 
) const

Definition at line 1078 of file channelscan_sm.cpp.

Referenced by TestNextProgramEncryption(), and UpdateChannelInfo().

ScanDTVTransportList ChannelScanSM::GetChannelList ( void   )  const

Definition at line 1326 of file channelscan_sm.cpp.

Referenced by GetCurrentTransportInfo().

void ChannelScanSM::HandlePAT ( const ProgramAssociationTable pat  )  [virtual]

Implements MPEGStreamListener.

Definition at line 342 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 357 of file channelscan_sm.cpp.

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

Implements MPEGStreamListener.

Definition at line 514 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 383 of file channelscan_sm.cpp.

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

Implements ATSCMainStreamListener.

Definition at line 366 of file channelscan_sm.cpp.

void ChannelScanSM::HandleNIT ( const NetworkInformationTable nit  )  [virtual]

Implements DVBMainStreamListener.

Definition at line 434 of file channelscan_sm.cpp.

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

Implements DVBMainStreamListener.

Definition at line 391 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 484 of file channelscan_sm.cpp.

void ChannelScanSM::HandleBAT ( const BouquetAssociationTable bat  )  [virtual]

Implements DVBOtherStreamListener.

Definition at line 443 of file channelscan_sm.cpp.

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

Definition at line 1370 of file channelscan_sm.cpp.

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

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

Definition at line 1375 of file channelscan_sm.cpp.

V4LChannel * ChannelScanSM::GetV4LChannel ( void   )  [private]

Definition at line 1407 of file channelscan_sm.cpp.

HDHRChannel * ChannelScanSM::GetHDHRChannel ( void   )  [private]

Definition at line 1380 of file channelscan_sm.cpp.

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

Definition at line 1389 of file channelscan_sm.cpp.

Referenced by HasTimedOut(), and TestNextProgramEncryption().

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

Definition at line 1398 of file channelscan_sm.cpp.

void ChannelScanSM::run ( void   )  [private]

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

Definition at line 1438 of file channelscan_sm.cpp.

bool ChannelScanSM::HasTimedOut ( void   )  [private]

Definition at line 1454 of file channelscan_sm.cpp.

Referenced by HandleActiveScan().

void ChannelScanSM::HandleActiveScan ( void   )  [private]

Handles the TRANSPORT_LIST ChannelScanSM mode.

Definition at line 1535 of file channelscan_sm.cpp.

Referenced by run().

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

Definition at line 1597 of file channelscan_sm.cpp.

Referenced by ScanTransport().

uint ChannelScanSM::InsertMultiplex ( const transport_scan_items_it_t  transport  )  [private]
void ChannelScanSM::ScanTransport ( const transport_scan_items_it_t  transport  )  [private]

Definition at line 1622 of file channelscan_sm.cpp.

DTVTunerType ChannelScanSM::GuessDTVTunerType ( DTVTunerType  type  )  const [private]

Definition at line 607 of file channelscan_sm.cpp.

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

void ChannelScanSM::UpdateScanPercentCompleted ( void   )  [inline, private]

Updates Transport Scan progress bar.

Definition at line 250 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 1995 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]
bool ChannelScanSM::TestNextProgramEncryption ( void   )  [private]

Definition at line 524 of file channelscan_sm.cpp.

Referenced by UpdateChannelInfo().

void ChannelScanSM::UpdateScanTransports ( const NetworkInformationTable nit  )  [private]

Definition at line 631 of file channelscan_sm.cpp.

Referenced by UpdateChannelInfo().

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

Definition at line 237 of file channelscan_sm.cpp.

Referenced by AnalogSignalHandler::AllGood().

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

Definition at line 1889 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().

int ChannelScanSM::sourceID [private]

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().

volatile bool ChannelScanSM::threadExit [private]

Definition at line 222 of file channelscan_sm.h.

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

QTime ChannelScanSM::timer [private]

Definition at line 228 of file channelscan_sm.h.

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

Definition at line 235 of file channelscan_sm.h.

Referenced by TestNextProgramEncryption(), and UpdateChannelInfo().

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

Definition at line 236 of file channelscan_sm.h.

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

Found Channel Info.

Definition at line 239 of file channelscan_sm.h.

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

Definition at line 240 of file channelscan_sm.h.

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

Definition at line 244 of file channelscan_sm.h.

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

Scanner thread, runs ChannelScanSM::run().

Definition at line 247 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
Generated on Fri Feb 10 06:41:51 2012 for MythTV by  doxygen 1.6.3