#include <siscan.h>

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 |
| SignalMonitor * | GetSignalMonitor (void) |
| DTVSignalMonitor * | GetDTVSignalMonitor (void) |
| DVBSignalMonitor * | GetDVBSignalMonitor (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 | |
| DTVChannel * | GetDTVChannel (void) |
| Channel * | GetChannel (void) |
| DVBChannel * | GetDVBChannel (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 | |
| ChannelBase * | channel |
| SignalMonitor * | signalMonitor |
| 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, uint > | dvbChanNums |
| pthread_t | scanner_thread |
| Scanner thread, runs SIScan::StartScanner(). | |
| bool | scanner_thread_running |
| 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.
| 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 | |||
| ) |
| 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 | ) |
| void SIScan::SetFTAOnly | ( | bool | _fFTAOnly | ) | [inline] |
| void SIScan::SetTVOnly | ( | bool | _tvOnly | ) | [inline] |
| void SIScan::SetForceUpdate | ( | bool | _force | ) | [inline] |
| void SIScan::SetRenameChannels | ( | bool | _r | ) | [inline] |
| void SIScan::SetChannelFormat | ( | const QString | _fmt | ) | [inline] |
| void SIScan::SetSignalTimeout | ( | uint | val | ) | [inline] |
| uint SIScan::GetSignalTimeout | ( | void | ) | const [inline] |
| SignalMonitor* SIScan::GetSignalMonitor | ( | void | ) | [inline] |
Definition at line 80 of file siscan.h.
Referenced by HasTimedOut(), and ScanWizardScanner::PreScanCommon().
| DTVSignalMonitor * SIScan::GetDTVSignalMonitor | ( | void | ) |
Definition at line 528 of file siscan.cpp.
Referenced by HandleMGT(), HandleNIT(), HandlePAT(), HandlePostInsertion(), HandleSDT(), HandleVCT(), InsertMultiplex(), ScanTransport(), and SIScan().
| 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] |
| void SIScan::HandleCAT | ( | const ConditionalAccessTable * | ) | [inline, virtual] |
| void SIScan::HandlePMT | ( | uint | , | |
| const ProgramMapTable * | ||||
| ) | [inline, virtual] |
| void SIScan::HandleSTT | ( | const SystemTimeTable * | ) | [inline, virtual] |
| void SIScan::HandleMGT | ( | const MasterGuideTable * | ) | [virtual] |
| void SIScan::HandleVCT | ( | uint | tsid, | |
| const VirtualChannelTable * | ||||
| ) | [virtual] |
| void SIScan::HandleNIT | ( | const NetworkInformationTable * | nit | ) | [virtual] |
| void SIScan::HandleSDT | ( | uint | tsid, | |
| const ServiceDescriptionTable * | sdt | |||
| ) | [virtual] |
| void SIScan::HandleTDT | ( | const TimeDateTable * | ) | [inline, virtual] |
| void SIScan::deleteLater | ( | void | ) | [slot] |
| void SIScan::HandleAllGood | ( | void | ) | [private, slot] |
| void SIScan::PctServiceScanComplete | ( | int | pct | ) | [signal] |
Referenced by HandleDVBDBInsertion(), and UpdateScanPercentCompleted().
| 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] |
Referenced by HandleActiveScan(), and HandleDVBDBInsertion().
| void SIScan::TransportScanComplete | ( | void | ) | [signal] |
Referenced by HandleNIT().
| DTVChannel * SIScan::GetDTVChannel | ( | void | ) | [private] |
| Channel * SIScan::GetChannel | ( | void | ) | [private] |
| DVBChannel * SIScan::GetDVBChannel | ( | void | ) | [private] |
| 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] |
| 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] |
| 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] |
| void SIScan::IgnoreEmptyChanMsg | ( | const QString & | name, | |
| int | aux_num | |||
| ) | [private] |
| 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] |
| 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] |
| 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] |
| 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] |
| 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.
Definition at line 487 of file siscan.cpp.
Referenced by HandleActiveScan().
| QString SIScan::loc | ( | const SIScan * | siscan | ) | [static, private] |
Definition at line 35 of file siscan.cpp.
ChannelBase* SIScan::channel [private] |
Definition at line 183 of file siscan.h.
Referenced by GetChannel(), GetDTVChannel(), GetDVBChannel(), and loc().
SignalMonitor* SIScan::signalMonitor [private] |
Definition at line 184 of file siscan.h.
Referenced by GetDTVSignalMonitor(), GetDVBSignalMonitor(), GetSignalMonitor(), HandleActiveScan(), ScanTransport(), SetAnalog(), and StopScanner().
int SIScan::sourceID [private] |
Definition at line 185 of file siscan.h.
Referenced by HandleAllGood(), HandleNIT(), ScanServicesSourceID(), SetSourceID(), and UpdateSDTinDB().
SCANMODE SIScan::scanMode [private] |
Definition at line 186 of file siscan.h.
Referenced by HandleActiveScan(), HandleAllGood(), HandleATSCDBInsertion(), HandleDVBDBInsertion(), HandleMPEGDBInsertion(), RunScanner(), ScanForChannels(), ScanServicesSourceID(), ScanTransport(), ScanTransports(), and ScanTransportsStartingOn().
uint SIScan::signalTimeout [private] |
Definition at line 187 of file siscan.h.
Referenced by GetSignalTimeout(), ScanForChannels(), ScanServicesSourceID(), ScanTransport(), ScanTransports(), ScanTransportsStartingOn(), and SetSignalTimeout().
uint SIScan::channelTimeout [private] |
Definition at line 188 of file siscan.h.
Referenced by GetChannelTimeout(), HasTimedOut(), and SetChannelTimeout().
QString SIScan::inputname [private] |
bool SIScan::ignoreAudioOnlyServices [private] |
Definition at line 192 of file siscan.h.
Referenced by SetTVOnly(), UpdatePATinDB(), UpdateSDTinDB(), and UpdateVCTinDB().
bool SIScan::ignoreDataServices [private] |
Definition at line 193 of file siscan.h.
Referenced by SetTVOnly(), UpdateSDTinDB(), and UpdateVCTinDB().
bool SIScan::ignoreEncryptedServices [private] |
Definition at line 194 of file siscan.h.
Referenced by SetFTAOnly(), UpdatePATinDB(), UpdateSDTinDB(), and UpdateVCTinDB().
bool SIScan::forceUpdate [private] |
Definition at line 195 of file siscan.h.
Referenced by HandleDVBDBInsertion(), and SetForceUpdate().
bool SIScan::renameChannels [private] |
Definition at line 196 of file siscan.h.
Referenced by SetRenameChannels(), UpdatePMTinDB(), UpdateSDTinDB(), and UpdateVCTinDB().
QString SIScan::channelFormat [private] |
bool SIScan::threadExit [private] |
bool SIScan::waitingForTables [private] |
Definition at line 201 of file siscan.h.
Referenced by HandleActiveScan(), HandleAllGood(), HandleATSCDBInsertion(), HandleDVBDBInsertion(), HandleMPEGDBInsertion(), HasTimedOut(), ScanForChannels(), ScanServicesSourceID(), ScanTransport(), ScanTransports(), and ScanTransportsStartingOn().
QTime SIScan::timer [private] |
Definition at line 202 of file siscan.h.
Referenced by HasTimedOut(), ScanForChannels(), ScanTransport(), ScanTransports(), and ScanTransportsStartingOn().
int SIScan::transportsScanned [private] |
Definition at line 205 of file siscan.h.
Referenced by HandleActiveScan(), ScanForChannels(), ScanServicesSourceID(), ScanTransport(), ScanTransports(), ScanTransportsStartingOn(), and UpdateScanPercentCompleted().
transport_scan_items_t SIScan::scanTransports [private] |
Definition at line 206 of file siscan.h.
Referenced by HandleActiveScan(), ScanForChannels(), ScanServicesSourceID(), ScanTransport(), ScanTransports(), ScanTransportsStartingOn(), SIScan(), and UpdateScanPercentCompleted().
transport_scan_items_it_t SIScan::current [private] |
Definition at line 207 of file siscan.h.
Referenced by HandleActiveScan(), HandleAllGood(), HandleATSCDBInsertion(), HandleDVBDBInsertion(), HandleMPEGDBInsertion(), HasTimedOut(), and SIScan().
transport_scan_items_it_t SIScan::nextIt [private] |
Definition at line 208 of file siscan.h.
Referenced by HandleActiveScan(), HandleAllGood(), HandleATSCDBInsertion(), HandleDVBDBInsertion(), HandleMPEGDBInsertion(), ScanForChannels(), ScanServicesSourceID(), ScanTransport(), ScanTransports(), and ScanTransportsStartingOn().
QMap<uint, uint> SIScan::dvbChanNums [private] |
pthread_t SIScan::scanner_thread [private] |
Scanner thread, runs SIScan::StartScanner().
Definition at line 212 of file siscan.h.
Referenced by StartScanner(), and StopScanner().
bool SIScan::scanner_thread_running [private] |
1.5.5