--- a/radioapp/radiouiengine/src/radioscannerengine_p.cpp Fri Jun 11 16:24:13 2010 +0100
+++ b/radioapp/radiouiengine/src/radioscannerengine_p.cpp Thu Jul 22 16:33:45 2010 +0100
@@ -59,9 +59,12 @@
Q_Q( RadioScannerEngine );
if ( reason == TuneReason::StationScanInitialization ) {
- mUiEngine.wrapper().startSeeking( Seeking::Up, TuneReason::StationScan );
+ mUiEngine.wrapper().startSeeking( Seek::Up, TuneReason::StationScan );
} else if ( reason == TuneReason::StationScan ) {
- if ( frequency > mLastFoundFrequency ) {
+ if ( frequency == mLastFoundFrequency ) {
+ // Stop scanning
+ q->emitStationFound( RadioStation() );
+ } else if ( frequency > mLastFoundFrequency ) {
// Station has been found normally
mLastFoundFrequency = frequency;
addFrequencyAndReport( frequency );
@@ -72,6 +75,8 @@
// Seeking looped around the frequency band. Send invalid station as indicator that the scanning should stop
q->emitStationFound( RadioStation() );
}
+ } else {
+ q->emitStationFound( RadioStation() );
}
}
@@ -82,8 +87,13 @@
{
RadioStationModel& stationModel = mUiEngine.api().stationModel();
stationModel.stationHandlerIf().addScannedFrequency( frequency );
+
+ // Return value of findFrequency() is intentionally ignored. The station was just added
+ // to the model in the previous line so it should be found and if it isn't then an
+ // empty station is sent with the signal and scanner will stop the scanning process.
RadioStation station;
stationModel.findFrequency( frequency, station );
+
Q_Q( RadioScannerEngine );
q->emitStationFound( station );
}