SIScan Class Reference

#include <siscan.h>

Inheritance diagram for SIScan:

MPEGStreamListener ATSCMainStreamListener DVBMainStreamListener

List of all members.


Detailed Description

Scanning class for cards that support a SignalMonitor class.

Currently both SIParser and ScanStreamData are being used in this class. The SIParser is being phased out, so that is not described here.

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, if so we check if we at least got a PAT and if so we insert a channel based on that by calling HandleMPEGDBInsertion().

Meanwhile the ScanStreamData() emits several signals. For the UI it emits signal quality signals. For SIScan it emits UpdateMGT, UpdateVCT, UpdateNIT, and UpdateSDT signals. We connect these to the HandleMGT, HandleVCT, etc. These in turn just call HandleATSCDBInsertion() or HandleDVBDBInsertion() depending on the type of table.

HandleATSCDBInsertion() first checks if we have all the VCTs described in the MGT. If we do we call UpdateVCTinDB() for each TVCT and CVCT in the stream. UpdateVCTinDB() inserts the actual channels. Then we set "waitingForTables" to false, set the scanOffsetIt to 99 and updates the UI to reflect the added channel. HandleDVBDBInsertion() and HandleMPEGDBInsertion() are similar.

Definition at line 40 of file siscan.h.


Public Slots

void deleteLater (void)

Signals

void PctServiceScanComplete (int pct)
void PctTransportScanComplete (int pct)
void ServiceScanUpdateStatusText (const QString &status)
void ServiceScanUpdateText (const QString &status)
void TransportScanUpdateText (const QString &status)
void ServiceScanComplete (void)
void TransportScanComplete (void)

Public Member Functions

 SIScan (const QString &_cardtype, ChannelBase *_channel, int _sourceID, uint signal_timeout, uint channel_timeout, const QString &_inputname)
 ~SIScan ()
void StartScanner (void)
 Starts the SIScan event loop.
void StopScanner (void)
 Stops the SIScan event loop and the signal monitor, blocking until both exit.
bool ScanTransports (int src, const QString std, const QString mod, const QString country)
 Generates a list of frequencies to scan and adds it to the scanTransport list, and then sets the scanMode 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 scanMode to TRANSPORT_LIST.
bool ScanTransport (int mplexid)
bool ScanForChannels (uint sourceid, const QString &std, const QString &cardtype, const DTVChannelList &)
bool ScanServicesSourceID (int SourceID)
 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 SetFTAOnly (bool _fFTAOnly)
void SetTVOnly (bool _tvOnly)
void SetForceUpdate (bool _force)
void SetRenameChannels (bool _r)
void SetChannelFormat (const QString _fmt)
void SetSignalTimeout (uint val)
void SetChannelTimeout (uint val)
uint GetSignalTimeout (void) const
uint GetChannelTimeout (void) const
SignalMonitorGetSignalMonitor (void)
DTVSignalMonitorGetDTVSignalMonitor (void)
DVBSignalMonitorGetDVBSignalMonitor (void)
void HandlePAT (const ProgramAssociationTable *)
void HandleCAT (const ConditionalAccessTable *)
void HandlePMT (uint, const ProgramMapTable *)
void HandleEncryptionStatus (uint, bool)
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 *)

Private Slots

void HandleAllGood (void)

Private Member Functions

DTVChannelGetDTVChannel (void)
ChannelGetChannel (void)
DVBChannelGetDVBChannel (void)
void RunScanner (void)
 Called by SpawnScanner to run scanning thread.
bool HasTimedOut (void)
void HandleActiveScan (void)
 Handles the TRANSPORT_LIST SIScan 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)
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)
void HandleMPEGDBInsertion (const ScanStreamData *sd, bool wait)
void UpdatePATinDB (int mplexid, const QString &friendlyName, int freqid, const ProgramAssociationTable *, const pmt_map_t &, const DTVChannelInfoList &, const QString &si_standard, bool force_update)
void UpdatePMTinDB (int sourceid, int mplexid, const QString &friendlyName, int freqid, int pmt_indx, const ProgramMapTable *, const DTVChannelInfoList &, bool force_update)
void HandleATSCDBInsertion (const ScanStreamData *sd, bool wait)
void UpdateVCTinDB (int mplexid, const QString &friendlyName, int freqid, const VirtualChannelTable *, const DTVChannelInfoList &, bool force_update)
void HandleDVBDBInsertion (const ScanStreamData *sd, bool wait)
void UpdateSDTinDB (int mplexid, const ServiceDescriptionTable *, const DTVChannelInfoList &, bool force_update)
 Inserts channels from service description table.
bool HandlePostInsertion (void)
 Insert channels based on any partial tables we do have.
uint64_t FindBestMplexFreq (const uint64_t tuning_freq, const transport_scan_items_it_t transport, const uint sourceid, const uint transportid, const uint networkid)

Static Private Member Functions

static void * SpawnScanner (void *param)
 Thunk to call RunScanner from pthread.
static QString loc (const SIScan *)

Private Attributes

ChannelBasechannel
SignalMonitorsignalMonitor
int sourceID
SCANMODE scanMode
uint signalTimeout
uint channelTimeout
QString inputname
bool ignoreAudioOnlyServices
bool ignoreDataServices
bool ignoreEncryptedServices
bool forceUpdate
bool renameChannels
QString channelFormat
bool threadExit
bool waitingForTables
QTime timer
int transportsScanned
transport_scan_items_t scanTransports
transport_scan_items_it_t current
transport_scan_items_it_t nextIt
QMap< uint, uintdvbChanNums
pthread_t scanner_thread
 Scanner thread, runs SIScan::StartScanner().
bool scanner_thread_running

Constructor & Destructor Documentation

SIScan::SIScan ( const QString &  _cardtype,
ChannelBase _channel,
int  _sourceID,
uint  signal_timeout,
uint  channel_timeout,
const QString &  _inputname 
)

Definition at line 85 of file siscan.cpp.

SIScan::~SIScan ( void   ) 

Definition at line 134 of file siscan.cpp.


Member Function Documentation

void SIScan::StartScanner ( void   ) 

Starts the SIScan event loop.

Definition at line 579 of file siscan.cpp.

Referenced by ScanWizardScanner::Scan().

void SIScan::StopScanner ( void   ) 

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

Definition at line 767 of file siscan.cpp.

Referenced by deleteLater(), and ~SIScan().

bool SIScan::ScanTransports ( int  src,
const QString  std,
const QString  mod,
const QString  country 
)

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

Definition at line 788 of file siscan.cpp.

Referenced by ScanWizardScanner::Scan().

bool SIScan::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 scanMode to TRANSPORT_LIST.

Definition at line 886 of file siscan.cpp.

Referenced by ScanWizardScanner::Scan().

bool SIScan::ScanTransport ( int  mplexid  ) 

Definition at line 957 of file siscan.cpp.

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

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

Definition at line 842 of file siscan.cpp.

Referenced by ScanWizardScanner::Scan().

bool SIScan::ScanServicesSourceID ( int  SourceID  ) 

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 226 of file siscan.cpp.

Referenced by ScanWizardScanner::Scan(), and ScanWizardScanner::transportScanComplete().

void SIScan::SetAnalog ( bool  is_analog  ) 

Definition at line 149 of file siscan.cpp.

Referenced by ScanWizardScanner::Scan().

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

Definition at line 67 of file siscan.h.

void SIScan::SetFTAOnly ( bool  _fFTAOnly  )  [inline]

Definition at line 68 of file siscan.h.

Referenced by ScanWizardScanner::PreScanCommon().

void SIScan::SetTVOnly ( bool  _tvOnly  )  [inline]

Definition at line 69 of file siscan.h.

Referenced by ScanWizardScanner::PreScanCommon().

void SIScan::SetForceUpdate ( bool  _force  )  [inline]

Definition at line 71 of file siscan.h.

Referenced by ScanWizardScanner::PreScanCommon().

void SIScan::SetRenameChannels ( bool  _r  )  [inline]

Definition at line 72 of file siscan.h.

Referenced by ScanWizardScanner::Scan().

void SIScan::SetChannelFormat ( const QString  _fmt  )  [inline]

Definition at line 73 of file siscan.h.

Referenced by ScanWizardScanner::Scan().

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

Definition at line 74 of file siscan.h.

Referenced by ScanWizardScanner::Scan().

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

Definition at line 75 of file siscan.h.

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

Definition at line 77 of file siscan.h.

Referenced by ScanWizardScanner::Scan().

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

Definition at line 78 of file siscan.h.

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

Definition at line 80 of file siscan.h.

Referenced by HasTimedOut(), and ScanWizardScanner::PreScanCommon().

DTVSignalMonitor * SIScan::GetDTVSignalMonitor ( void   ) 

DVBSignalMonitor * SIScan::GetDVBSignalMonitor ( void   ) 

Definition at line 533 of file siscan.cpp.

Referenced by InsertMultiplex(), ScanWizardScanner::PreScanCommon(), and Tune().

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

Implements MPEGStreamListener.

Definition at line 283 of file siscan.cpp.

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

Implements MPEGStreamListener.

Definition at line 86 of file siscan.h.

void SIScan::HandlePMT ( uint  ,
const ProgramMapTable  
) [inline, virtual]

Implements MPEGStreamListener.

Definition at line 87 of file siscan.h.

void SIScan::HandleEncryptionStatus ( uint  ,
bool   
) [inline, virtual]

Implements MPEGStreamListener.

Definition at line 88 of file siscan.h.

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

Implements ATSCMainStreamListener.

Definition at line 91 of file siscan.h.

void SIScan::HandleMGT ( const MasterGuideTable  )  [virtual]

Implements ATSCMainStreamListener.

Definition at line 306 of file siscan.cpp.

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

Implements ATSCMainStreamListener.

Definition at line 298 of file siscan.cpp.

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

Implements DVBMainStreamListener.

Definition at line 324 of file siscan.cpp.

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

Implements DVBMainStreamListener.

Definition at line 314 of file siscan.cpp.

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

Implements DVBMainStreamListener.

Definition at line 98 of file siscan.h.

void SIScan::deleteLater ( void   )  [slot]

Definition at line 141 of file siscan.cpp.

Referenced by ScanWizardScanner::Teardown().

void SIScan::HandleAllGood ( void   )  [private, slot]

Definition at line 163 of file siscan.cpp.

Referenced by SetAnalog().

void SIScan::PctServiceScanComplete ( int  pct  )  [signal]

void SIScan::PctTransportScanComplete ( int  pct  )  [signal]

void SIScan::ServiceScanUpdateStatusText ( const QString &  status  )  [signal]

Referenced by ScanTransport().

void SIScan::ServiceScanUpdateText ( const QString &  status  )  [signal]

void SIScan::TransportScanUpdateText ( const QString &  status  )  [signal]

Referenced by HandleNIT().

void SIScan::ServiceScanComplete ( void   )  [signal]

void SIScan::TransportScanComplete ( void   )  [signal]

Referenced by HandleNIT().

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

Definition at line 542 of file siscan.cpp.

Referenced by Tune().

Channel * SIScan::GetChannel ( void   )  [private]

Definition at line 556 of file siscan.cpp.

Referenced by InsertMultiplex().

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

Definition at line 547 of file siscan.cpp.

Referenced by InsertMultiplex(), and Tune().

void SIScan::RunScanner ( void   )  [private]

Called by SpawnScanner to run scanning thread.

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

Definition at line 587 of file siscan.cpp.

Referenced by SpawnScanner().

void * SIScan::SpawnScanner ( void *  param  )  [static, private]

Thunk to call RunScanner from pthread.

Thunk that allows scanner_thread pthread to call SIScan::RunScanner().

Definition at line 569 of file siscan.cpp.

Referenced by StartScanner().

bool SIScan::HasTimedOut ( void   )  [private]

Definition at line 605 of file siscan.cpp.

Referenced by HandleActiveScan().

void SIScan::HandleActiveScan ( void   )  [private]

Handles the TRANSPORT_LIST SIScan mode.

Definition at line 652 of file siscan.cpp.

Referenced by RunScanner().

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

Definition at line 690 of file siscan.cpp.

Referenced by ScanTransport().

uint SIScan::InsertMultiplex ( const transport_scan_items_it_t  transport  )  [private]

Definition at line 1594 of file siscan.cpp.

Referenced by HandleATSCDBInsertion(), HandleDVBDBInsertion(), and HandleMPEGDBInsertion().

void SIScan::ScanTransport ( const transport_scan_items_it_t  transport  )  [private]

Definition at line 717 of file siscan.cpp.

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

Updates Transport Scan progress bar.

Definition at line 216 of file siscan.h.

Referenced by HandleActiveScan(), HandleAllGood(), HandleATSCDBInsertion(), HandleDVBDBInsertion(), HandleMPEGDBInsertion(), and ScanTransport().

bool SIScan::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 1015 of file siscan.cpp.

Referenced by UpdatePMTinDB(), UpdateSDTinDB(), and UpdateVCTinDB().

void SIScan::IgnoreDataOnlyMsg ( const QString &  name,
int  aux_num 
) [private]

Definition at line 1142 of file siscan.cpp.

Referenced by UpdateSDTinDB().

void SIScan::IgnoreEmptyChanMsg ( const QString &  name,
int  aux_num 
) [private]

Definition at line 1158 of file siscan.cpp.

Referenced by UpdatePATinDB(), and UpdateVCTinDB().

void SIScan::IgnoreAudioOnlyMsg ( const QString &  name,
int  aux_num 
) [private]

Definition at line 1174 of file siscan.cpp.

Referenced by UpdatePATinDB(), UpdateSDTinDB(), and UpdateVCTinDB().

void SIScan::IgnoreEncryptedMsg ( const QString &  name,
int  aux_num 
) [private]

Definition at line 1190 of file siscan.cpp.

Referenced by UpdatePATinDB(), UpdateSDTinDB(), and UpdateVCTinDB().

void SIScan::HandleMPEGDBInsertion ( const ScanStreamData sd,
bool  wait 
) [private]

Definition at line 371 of file siscan.cpp.

Referenced by HandlePostInsertion().

void SIScan::UpdatePATinDB ( int  mplexid,
const QString &  friendlyName,
int  freqid,
const ProgramAssociationTable pat,
const pmt_map_t pmt_map,
const DTVChannelInfoList channels,
const QString &  si_standard,
bool  force_update 
) [private]

Definition at line 1206 of file siscan.cpp.

Referenced by HandleMPEGDBInsertion().

void SIScan::UpdatePMTinDB ( int  sourceid,
int  mplexid,
const QString &  friendlyName,
int  freqid,
int  pmt_indx,
const ProgramMapTable pmt,
const DTVChannelInfoList channels,
bool  force_update 
) [private]

Definition at line 1064 of file siscan.cpp.

Referenced by UpdatePATinDB().

void SIScan::HandleATSCDBInsertion ( const ScanStreamData sd,
bool  wait 
) [private]

Definition at line 405 of file siscan.cpp.

Referenced by HandleMGT(), HandlePostInsertion(), and HandleVCT().

void SIScan::UpdateVCTinDB ( int  mplexid,
const QString &  friendlyName,
int  freqid,
const VirtualChannelTable vct,
const DTVChannelInfoList channels,
bool  force_update 
) [private]

Definition at line 1265 of file siscan.cpp.

Referenced by HandleATSCDBInsertion().

void SIScan::HandleDVBDBInsertion ( const ScanStreamData sd,
bool  wait 
) [private]

Definition at line 448 of file siscan.cpp.

Referenced by HandleNIT(), HandlePostInsertion(), and HandleSDT().

void SIScan::UpdateSDTinDB ( int  mplexid,
const ServiceDescriptionTable sdt,
const DTVChannelInfoList channels,
bool  force_update 
) [private]

Inserts channels from service description table.

Definition at line 1395 of file siscan.cpp.

Referenced by HandleDVBDBInsertion().

bool SIScan::HandlePostInsertion ( void   )  [private]

Insert channels based on any partial tables we do have.

Returns:
true if we saw any tables

Definition at line 487 of file siscan.cpp.

Referenced by HandleActiveScan().

uint64_t SIScan::FindBestMplexFreq ( const uint64_t  tuning_freq,
const transport_scan_items_it_t  transport,
const uint  sourceid,
const uint  transportid,
const uint  networkid 
) [private]

Definition at line 1560 of file siscan.cpp.

Referenced by InsertMultiplex().

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

Definition at line 35 of file siscan.cpp.


Member Data Documentation

Definition at line 183 of file siscan.h.

Referenced by GetChannel(), GetDTVChannel(), GetDVBChannel(), and loc().

int SIScan::sourceID [private]

Definition at line 185 of file siscan.h.

Referenced by HandleAllGood(), HandleNIT(), ScanServicesSourceID(), SetSourceID(), and UpdateSDTinDB().

Definition at line 188 of file siscan.h.

Referenced by GetChannelTimeout(), HasTimedOut(), and SetChannelTimeout().

QString SIScan::inputname [private]

Definition at line 189 of file siscan.h.

Referenced by Tune().

Definition at line 192 of file siscan.h.

Referenced by SetTVOnly(), UpdatePATinDB(), UpdateSDTinDB(), and UpdateVCTinDB().

Definition at line 193 of file siscan.h.

Referenced by SetTVOnly(), UpdateSDTinDB(), and UpdateVCTinDB().

Definition at line 194 of file siscan.h.

Referenced by SetFTAOnly(), UpdatePATinDB(), UpdateSDTinDB(), and UpdateVCTinDB().

Definition at line 195 of file siscan.h.

Referenced by HandleDVBDBInsertion(), and SetForceUpdate().

Definition at line 196 of file siscan.h.

Referenced by SetRenameChannels(), UpdatePMTinDB(), UpdateSDTinDB(), and UpdateVCTinDB().

QString SIScan::channelFormat [private]

Definition at line 197 of file siscan.h.

Referenced by SetChannelFormat(), and UpdateVCTinDB().

Definition at line 200 of file siscan.h.

Referenced by RunScanner(), and StopScanner().

QTime SIScan::timer [private]

QMap<uint, uint> SIScan::dvbChanNums [private]

Definition at line 209 of file siscan.h.

Referenced by HandleNIT(), and UpdateSDTinDB().

Scanner thread, runs SIScan::StartScanner().

Definition at line 212 of file siscan.h.

Referenced by StartScanner(), and StopScanner().

Definition at line 213 of file siscan.h.

Referenced by RunScanner(), and StopScanner().


The documentation for this class was generated from the following files:

Generated on Sat Jul 31 05:18:50 2010 for MythTV by  doxygen 1.5.5