radioapp/radioenginewrapper/src/radioenginewrapper.cpp
changeset 16 f54ebcfc1b80
parent 13 46974bebc798
child 19 afea38384506
--- a/radioapp/radioenginewrapper/src/radioenginewrapper.cpp	Fri Apr 16 14:58:55 2010 +0300
+++ b/radioapp/radioenginewrapper/src/radioenginewrapper.cpp	Mon May 03 12:31:41 2010 +0300
@@ -19,14 +19,12 @@
 #include "radioenginewrapper.h"
 #include "radioenginewrapper_p.h"
 #include "cradioenginehandler.h"
-#include "radiofrequencyscanninghandler.h"
 
 /*!
  * Constructor
  */
-RadioEngineWrapper::RadioEngineWrapper( RadioStationHandlerIf& stationHandler,
-                                        RadioEngineWrapperObserver& observer ) :
-    d_ptr( new RadioEngineWrapperPrivate( this, stationHandler, observer ) )
+RadioEngineWrapper::RadioEngineWrapper( RadioStationHandlerIf& stationHandler ) :
+    d_ptr( new RadioEngineWrapperPrivate( this, stationHandler ) )
 {
     Q_D( RadioEngineWrapper );
     d->init();
@@ -41,6 +39,24 @@
 }
 
 /*!
+ *
+ */
+void RadioEngineWrapper::addObserver( RadioEngineWrapperObserver* observer )
+{
+    Q_D( RadioEngineWrapper );
+    d->mObservers.append( observer );
+}
+
+/*!
+ *
+ */
+void RadioEngineWrapper::removeObserver( RadioEngineWrapperObserver* observer )
+{
+    Q_D( RadioEngineWrapper );
+    d->mObservers.removeAll( observer );
+}
+
+/*!
  * Checks if the radio engine has been constructed properly
  */
 bool RadioEngineWrapper::isEngineConstructed()
@@ -113,15 +129,6 @@
 }
 
 /*!
- * Checks if the scan is on
- */
-bool RadioEngineWrapper::isScanning() const
-{
-    Q_D( const RadioEngineWrapper );
-    return !d->mFrequencyScanningHandler.isNull();
-}
-
-/*!
  * Returns the currently tuned frequency
  */
 uint RadioEngineWrapper::currentFrequency() const
@@ -140,7 +147,7 @@
 }
 
 /*!
- * Returns the headset connection status
+ * Returns the antenna connection status
  */
 bool RadioEngineWrapper::isAntennaAttached() const
 {
@@ -160,19 +167,19 @@
 /*!
  * Tunes to the given frequency
  */
-void RadioEngineWrapper::tuneFrequency( uint frequency, const int sender )
+void RadioEngineWrapper::tuneFrequency( uint frequency, const int reason )
 {
     Q_D( RadioEngineWrapper );
-    d->tuneFrequency( frequency, sender );
+    d->tuneFrequency( frequency, reason );
 }
 
 /*!
  * Tunes to the given frequency after a delay
  */
-void RadioEngineWrapper::tuneWithDelay( uint frequency, const int sender )
+void RadioEngineWrapper::tuneWithDelay( uint frequency, const int reason )
 {
     Q_D( RadioEngineWrapper );
-    d->tuneWithDelay( frequency, sender );
+    d->tuneWithDelay( frequency, reason );
 }
 
 /*!
@@ -206,30 +213,17 @@
 /*!
  *
  */
-void RadioEngineWrapper::startSeeking( Seeking::Direction direction )
+void RadioEngineWrapper::startSeeking( Seeking::Direction direction, const int reason )
 {
     Q_D( RadioEngineWrapper );
-    d->startSeeking( direction );
+    d->startSeeking( direction, reason );
 }
 
 /*!
  *
  */
-void RadioEngineWrapper::scanFrequencyBand()
+void RadioEngineWrapper::cancelSeeking()
 {
     Q_D( RadioEngineWrapper );
-    if ( !d->mFrequencyScanningHandler ) {
-        d->mFrequencyScanningHandler.reset( new RadioFrequencyScanningHandler( *d ) );
-    }
-    d->mFrequencyScanningHandler->startScanning( d->mEngineHandler->IsMuted() );
+    d->mEngineHandler->CancelSeek();
 }
-
-/*!
- *
- */
-void RadioEngineWrapper::cancelScanFrequencyBand()
-{
-    Q_D( RadioEngineWrapper );
-    d->mFrequencyScanningHandler->cancel();
-    d->frequencyScannerFinished();
-}