radioapp/radioenginewrapper/src/radioenginewrapper.cpp
changeset 32 189d20c34778
parent 28 075425b8d9a4
child 33 11b6825f0862
equal deleted inserted replaced
28:075425b8d9a4 32:189d20c34778
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 // User includes
    18 // User includes
    19 #include "radioenginewrapper.h"
    19 #include "radioenginewrapper.h"
       
    20 #include "radioenginewrapperobserver.h"
    20 #include "radioenginewrapper_p.h"
    21 #include "radioenginewrapper_p.h"
    21 #include "cradioenginehandler.h"
    22 #include "radioenginehandler.h"
    22 
    23 
    23 /*!
    24 /*!
    24  * Constructor
    25  * Constructor
    25  */
    26  */
    26 RadioEngineWrapper::RadioEngineWrapper( RadioStationHandlerIf& stationHandler ) :
    27 RadioEngineWrapper::RadioEngineWrapper( RadioStationHandlerIf& stationHandler ) :
    31 /*!
    32 /*!
    32  * Destructor
    33  * Destructor
    33  */
    34  */
    34 RadioEngineWrapper::~RadioEngineWrapper()
    35 RadioEngineWrapper::~RadioEngineWrapper()
    35 {
    36 {
    36     delete d_ptr;
       
    37 }
    37 }
    38 
    38 
    39 /*!
    39 /*!
    40  *
    40  *
    41  */
    41  */
    76  * Returns the selected radio region
    76  * Returns the selected radio region
    77  */
    77  */
    78 RadioRegion::Region RadioEngineWrapper::region() const
    78 RadioRegion::Region RadioEngineWrapper::region() const
    79 {
    79 {
    80     Q_D( const RadioEngineWrapper );
    80     Q_D( const RadioEngineWrapper );
    81     return d->mEngineHandler->Region();
    81     return d->mEngineHandler->region();
    82 }
    82 }
    83 
    83 
    84 /*!
    84 /*!
    85  * Returns the minimum frequency
    85  * Returns the minimum frequency
    86  */
    86  */
    87 uint RadioEngineWrapper::minFrequency() const
    87 uint RadioEngineWrapper::minFrequency() const
    88 {
    88 {
    89     Q_D( const RadioEngineWrapper );
    89     Q_D( const RadioEngineWrapper );
    90     return d->mEngineHandler->MinFrequency();
    90     return d->mEngineHandler->minFrequency();
    91 }
    91 }
    92 
    92 
    93 /*!
    93 /*!
    94  * Returns the maximum frequency
    94  * Returns the maximum frequency
    95  */
    95  */
    96 uint RadioEngineWrapper::maxFrequency() const
    96 uint RadioEngineWrapper::maxFrequency() const
    97 {
    97 {
    98     Q_D( const RadioEngineWrapper );
    98     Q_D( const RadioEngineWrapper );
    99     return d->mEngineHandler->MaxFrequency();
    99     return d->mEngineHandler->maxFrequency();
   100 }
   100 }
   101 
   101 
   102 /*!
   102 /*!
   103  * Returns the frequency step size from the selected region
   103  * Returns the frequency step size from the selected region
   104  */
   104  */
   105 uint RadioEngineWrapper::frequencyStepSize() const
   105 uint RadioEngineWrapper::frequencyStepSize() const
   106 {
   106 {
   107     Q_D( const RadioEngineWrapper );
   107     Q_D( const RadioEngineWrapper );
   108     return d->mEngineHandler->FrequencyStepSize();
   108     return d->mEngineHandler->frequencyStepSize();
   109 }
   109 }
   110 
   110 
   111 /*!
   111 /*!
   112  * Returns the frequency step size from the selected region
   112  * Returns the frequency step size from the selected region
   113  */
   113  */
   120  * Checks if the radio engine is on
   120  * Checks if the radio engine is on
   121  */
   121  */
   122 bool RadioEngineWrapper::isRadioOn() const
   122 bool RadioEngineWrapper::isRadioOn() const
   123 {
   123 {
   124     Q_D( const RadioEngineWrapper );
   124     Q_D( const RadioEngineWrapper );
   125     return d->mEngineHandler->IsRadioOn();
   125     return d->mEngineHandler->isRadioOn();
   126 }
   126 }
   127 
   127 
   128 /*!
   128 /*!
   129  * Returns the currently tuned frequency
   129  * Returns the currently tuned frequency
   130  */
   130  */
   131 uint RadioEngineWrapper::currentFrequency() const
   131 uint RadioEngineWrapper::currentFrequency() const
   132 {
   132 {
   133     Q_D( const RadioEngineWrapper );
   133     Q_D( const RadioEngineWrapper );
   134     return d->mEngineHandler->CurrentFrequency();
   134     return d->mEngineHandler->currentFrequency();
   135 }
   135 }
   136 
   136 
   137 /*!
   137 /*!
   138  * Returns the mute status
   138  * Returns the mute status
   139  */
   139  */
   140 bool RadioEngineWrapper::isMuted() const
   140 bool RadioEngineWrapper::isMuted() const
   141 {
   141 {
   142     Q_D( const RadioEngineWrapper );
   142     Q_D( const RadioEngineWrapper );
   143     return d->mEngineHandler->IsMuted();
   143     return d->mEngineHandler->isMuted();
   144 }
   144 }
   145 
   145 
   146 /*!
   146 /*!
   147  * Returns the antenna connection status
   147  * Returns the antenna connection status
   148  */
   148  */
   149 bool RadioEngineWrapper::isAntennaAttached() const
   149 bool RadioEngineWrapper::isAntennaAttached() const
   150 {
   150 {
   151     Q_D( const RadioEngineWrapper );
   151     Q_D( const RadioEngineWrapper );
   152     return d->mEngineHandler->IsAntennaAttached();
   152     return d->mEngineHandler->isAntennaAttached();
   153 }
   153 }
   154 
   154 
   155 /*!
   155 /*!
   156  * Returns the "use loudspeaker" status
   156  * Returns the "use loudspeaker" status
   157  */
   157  */
   165  * Sets or unsets the engine to manual seek mode
   165  * Sets or unsets the engine to manual seek mode
   166  */
   166  */
   167 void RadioEngineWrapper::setManualSeekMode( bool manualSeek )
   167 void RadioEngineWrapper::setManualSeekMode( bool manualSeek )
   168 {
   168 {
   169     Q_D( RadioEngineWrapper );
   169     Q_D( RadioEngineWrapper );
   170     d->mEngineHandler->SetManualSeekMode( manualSeek );
   170     d->mEngineHandler->setManualSeekMode( manualSeek );
       
   171     if ( !manualSeek ) {
       
   172         RUN_NOTIFY_LOOP( d->observers(), tunedToFrequency( currentFrequency(), TuneReason::ManualSeekTune ) );
       
   173     }
   171 }
   174 }
   172 
   175 
   173 /*!
   176 /*!
   174  * Checks if the engine is in manual seek mode
   177  * Checks if the engine is in manual seek mode
   175  */
   178  */
   176 bool RadioEngineWrapper::isInManualSeekMode() const
   179 bool RadioEngineWrapper::isInManualSeekMode() const
   177 {
   180 {
   178     Q_D( const RadioEngineWrapper );
   181     Q_D( const RadioEngineWrapper );
   179     return d->mEngineHandler->IsInManualSeekMode();
   182     return d->mEngineHandler->isInManualSeekMode();
   180 }
   183 }
   181 
   184 
   182 /*!
   185 /*!
   183  *
   186  *
   184  */
   187  */
   185 void RadioEngineWrapper::setRdsEnabled( bool rdsEnabled )
   188 void RadioEngineWrapper::setRdsEnabled( bool rdsEnabled )
   186 {
   189 {
   187     Q_D( RadioEngineWrapper );
   190     Q_D( RadioEngineWrapper );
   188     d->mEngineHandler->SetRdsEnabled( rdsEnabled );
   191     d->mEngineHandler->setRdsEnabled( rdsEnabled );
   189 }
   192 }
   190 
   193 
   191 /*!
   194 /*!
   192  * Tunes to the given frequency
   195  * Tunes to the given frequency
   193  */
   196  */
   201  * volume increase command for the engine
   204  * volume increase command for the engine
   202  */
   205  */
   203 void RadioEngineWrapper::increaseVolume()
   206 void RadioEngineWrapper::increaseVolume()
   204 {
   207 {
   205     Q_D( RadioEngineWrapper );
   208     Q_D( RadioEngineWrapper );
   206     d->mEngineHandler->IncreaseVolume();
   209     d->mEngineHandler->increaseVolume();
   207 }
   210 }
   208 
   211 
   209 /*!
   212 /*!
   210  * volume decrease command for the engine
   213  * volume decrease command for the engine
   211  */
   214  */
   212 void RadioEngineWrapper::decreaseVolume()
   215 void RadioEngineWrapper::decreaseVolume()
   213 {
   216 {
   214     Q_D( RadioEngineWrapper );
   217     Q_D( RadioEngineWrapper );
   215     d->mEngineHandler->DecreaseVolume();
   218     d->mEngineHandler->decreaseVolume();
   216 }
   219 }
   217 
   220 
   218 /*!
   221 /*!
   219  * volume update command for the engine
   222  * volume update command for the engine
   220  */
   223  */
   221 void RadioEngineWrapper::setVolume( int volume )
   224 void RadioEngineWrapper::setVolume( int volume )
   222 {
   225 {
   223     Q_D( RadioEngineWrapper );
   226     Q_D( RadioEngineWrapper );
   224     d->mEngineHandler->SetVolume( volume );
   227     d->mEngineHandler->setVolume( volume );
   225 }
   228 }
   226 
   229 
   227 /*!
   230 /*!
   228  *
   231  *
   229  */
   232  */
   230 void RadioEngineWrapper::setMute( bool muted, bool updateSettings )
   233 void RadioEngineWrapper::setMute( bool muted, bool updateSettings )
   231 {
   234 {
   232     Q_D( RadioEngineWrapper );
   235     Q_D( RadioEngineWrapper );
   233     d->mEngineHandler->SetMuted( muted, updateSettings );
   236     d->mEngineHandler->setMute( muted, updateSettings );
   234 }
   237 }
   235 
   238 
   236 /*!
   239 /*!
   237  *
   240  *
   238  */
   241  */
   239 void RadioEngineWrapper::toggleAudioRoute()
   242 void RadioEngineWrapper::toggleAudioRoute()
   240 {
   243 {
   241     Q_D( RadioEngineWrapper );
   244     Q_D( RadioEngineWrapper );
   242     d->mUseLoudspeaker = !d->mUseLoudspeaker;
   245     d->mUseLoudspeaker = !d->mUseLoudspeaker;
   243     d->mEngineHandler->SetAudioRouteToLoudspeaker( d->mUseLoudspeaker );
   246     d->mEngineHandler->setAudioRouteToLoudspeaker( d->mUseLoudspeaker );
   244 }
   247 }
   245 
   248 
   246 /*!
   249 /*!
   247  *
   250  *
   248  */
   251  */
   256  *
   259  *
   257  */
   260  */
   258 void RadioEngineWrapper::cancelSeeking()
   261 void RadioEngineWrapper::cancelSeeking()
   259 {
   262 {
   260     Q_D( RadioEngineWrapper );
   263     Q_D( RadioEngineWrapper );
   261     d->mEngineHandler->CancelSeek();
   264     d->mEngineHandler->cancelSeek();
   262 }
   265 }