radioapp/radiouiengine/src/radioscannerengine.cpp
branchGCC_SURGE
changeset 37 451b2e1545b2
parent 19 afea38384506
parent 32 189d20c34778
equal deleted inserted replaced
26:6bcf277166c1 37:451b2e1545b2
    25 #include "radiouiengine_p.h"
    25 #include "radiouiengine_p.h"
    26 #include "radioenginewrapper.h"
    26 #include "radioenginewrapper.h"
    27 #include "radiostationhandlerif.h"
    27 #include "radiostationhandlerif.h"
    28 #include "radiostationmodel.h"
    28 #include "radiostationmodel.h"
    29 #include "radiostation.h"
    29 #include "radiostation.h"
       
    30 #include "radiologger.h"
    30 
    31 
    31 /*!
    32 /*!
    32  *
    33  *
    33  */
    34  */
    34 RadioScannerEngine::RadioScannerEngine( RadioUiEnginePrivate& uiEngine ) :
    35 RadioScannerEngine::RadioScannerEngine( RadioUiEnginePrivate& uiEngine ) :
    41  *
    42  *
    42  */
    43  */
    43 RadioScannerEngine::~RadioScannerEngine()
    44 RadioScannerEngine::~RadioScannerEngine()
    44 {
    45 {
    45     cancel();
    46     cancel();
    46     delete d_ptr;
       
    47 }
    47 }
    48 
    48 
    49 /*!
    49 /*!
    50  * Starts the scanning from minimum frequency
    50  * Starts the scanning from minimum frequency
    51  */
    51  */
    52 void RadioScannerEngine::startScanning()
    52 void RadioScannerEngine::startScanning()
    53 {
    53 {
    54     Q_D( RadioScannerEngine );
    54     Q_D( RadioScannerEngine );
    55     d->mUiEngine.cancelSeeking();
    55     d->mUiEngine.cancelSeeking();
    56 
    56 
       
    57 //    d->mUiEngine.wrapper().setRdsEnabled( false );
       
    58 
    57     d->mIsScanning = true;
    59     d->mIsScanning = true;
    58 
    60 
    59     if ( !d->mUiEngine.api().isMuted() ) {
    61     if ( !d->mUiEngine.api().isMuted() ) {
    60         d->mUiEngine.api().setMute( true );
    62         d->mUiEngine.api().setMute( true );
    61         d->mMutedByScanner = true;
    63         d->mMutedByScanner = true;
    62     }
    64     }
    63 
    65 
    64     d->mUiEngine.api().emitSeekingStarted( Seeking::Up );
    66     d->mUiEngine.api().emitSeekingStarted( Seek::Up );
    65 
    67 
    66     d->mUiEngine.api().stationModel().removeAll( RadioStationModel::RemoveLocalStations );
    68     d->mUiEngine.api().stationModel().removeAll( RadioStationModel::RemoveLocalStations );
    67     d->mLastFoundFrequency = d->mUiEngine.api().minFrequency();
    69     d->mLastFoundFrequency = d->mUiEngine.api().minFrequency();
    68 
    70 
    69     if ( d->mUiEngine.wrapper().currentFrequency() == d->mLastFoundFrequency ) {
    71     if ( d->mUiEngine.wrapper().currentFrequency() == d->mLastFoundFrequency ) {
    70         // Engine was already at the minimun frequency so start scanning
    72         // Engine was already at the minimun frequency so start scanning
    71         d->mUiEngine.wrapper().startSeeking( Seeking::Up, TuneReason::StationScan );
    73         d->mUiEngine.wrapper().startSeeking( Seek::Up, TuneReason::StationScan );
    72     } else {
    74     } else {
    73         // Engine must be initialized to minimum frequency before scanning can start
    75         // Engine must be initialized to minimum frequency before scanning can start
    74         d->mUiEngine.wrapper().tuneFrequency( d->mLastFoundFrequency, TuneReason::StationScanInitialization );
    76         d->mUiEngine.wrapper().setFrequency( d->mLastFoundFrequency, TuneReason::StationScanInitialization );
    75     }
    77     }
    76 }
    78 }
    77 
    79 
    78 /*!
    80 /*!
    79  * Continues the scanning upwards from current frequency
    81  * Continues the scanning upwards from current frequency
    80  */
    82  */
    81 void RadioScannerEngine::continueScanning()
    83 void RadioScannerEngine::continueScanning()
    82 {
    84 {
    83     Q_D( RadioScannerEngine );
    85     Q_D( RadioScannerEngine );
    84     d->mUiEngine.wrapper().startSeeking( Seeking::Up, TuneReason::StationScan );
    86     d->mUiEngine.wrapper().startSeeking( Seek::Up, TuneReason::StationScan );
    85 }
    87 }
    86 
    88 
    87 /*!
    89 /*!
    88  * Checks if the scanning is ongoing
    90  * Checks if the scanning is ongoing
    89  */
    91  */
   106 
   108 
   107     if ( d->mMutedByScanner ) {
   109     if ( d->mMutedByScanner ) {
   108         d->mUiEngine.api().setMute( false );
   110         d->mUiEngine.api().setMute( false );
   109         d->mMutedByScanner = false;
   111         d->mMutedByScanner = false;
   110     }
   112     }
       
   113 
       
   114 //    d->mUiEngine.wrapper().setRdsEnabled( true );
   111 }
   115 }
   112 
   116 
   113 /*!
   117 /*!
   114  * Adds a new station that was found
   118  * Adds a new station that was found
   115  */
   119  */