radioapp/radioenginewrapper/src/radioenginewrapper_win32.cpp
branchRCL_3
changeset 20 93c594350b9a
parent 19 cce62ebc198e
equal deleted inserted replaced
19:cce62ebc198e 20:93c594350b9a
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 // User includes
       
    19 #include "radioenginewrapper.h"
       
    20 #include "radioenginewrapper_win32_p.h"
       
    21 #include "radioenginewrapperobserver.h"
       
    22 
       
    23 /*!
       
    24  * Constructor
       
    25  */
       
    26 RadioEngineWrapper::RadioEngineWrapper( RadioStationHandlerIf& stationHandler ) :
       
    27     d_ptr( new RadioEngineWrapperPrivate( this, stationHandler ) )
       
    28 {
       
    29 }
       
    30 
       
    31 /*!
       
    32  * Destructor
       
    33  */
       
    34 RadioEngineWrapper::~RadioEngineWrapper()
       
    35 {
       
    36 }
       
    37 
       
    38 /*!
       
    39  *
       
    40  */
       
    41 bool RadioEngineWrapper::init()
       
    42 {
       
    43     Q_D( RadioEngineWrapper );
       
    44     return d->init();
       
    45 }
       
    46 
       
    47 /*!
       
    48  *
       
    49  */
       
    50 void RadioEngineWrapper::addObserver( RadioEngineWrapperObserver* observer )
       
    51 {
       
    52     Q_D( RadioEngineWrapper );
       
    53     d->mObservers.append( observer );
       
    54 }
       
    55 
       
    56 /*!
       
    57  *
       
    58  */
       
    59 void RadioEngineWrapper::removeObserver( RadioEngineWrapperObserver* observer )
       
    60 {
       
    61     Q_D( RadioEngineWrapper );
       
    62     d->mObservers.removeAll( observer );
       
    63 }
       
    64 
       
    65 /*!
       
    66  * Returns the settings handler owned by the engine
       
    67  */
       
    68 RadioSettingsIf& RadioEngineWrapper::settings()
       
    69 {
       
    70     Q_D( RadioEngineWrapper );
       
    71     return d->settings();
       
    72 }
       
    73 
       
    74 /*!
       
    75  * Returns the selected radio region
       
    76  */
       
    77 RadioRegion::Region RadioEngineWrapper::region() const
       
    78 {
       
    79     Q_D( const RadioEngineWrapper );
       
    80     return d->mRegionId;
       
    81 }
       
    82 
       
    83 /*!
       
    84  * Returns the minimum frequency
       
    85  */
       
    86 uint RadioEngineWrapper::minFrequency() const
       
    87 {
       
    88     Q_D( const RadioEngineWrapper );
       
    89     return d->mMinFrequency;
       
    90 }
       
    91 
       
    92 /*!
       
    93  * Returns the maximum frequency
       
    94  */
       
    95 uint RadioEngineWrapper::maxFrequency() const
       
    96 {
       
    97     Q_D( const RadioEngineWrapper );
       
    98     return d->mMaxFrequency;
       
    99 }
       
   100 
       
   101 /*!
       
   102  * Returns the frequency step size from the selected region
       
   103  */
       
   104 uint RadioEngineWrapper::frequencyStepSize() const
       
   105 {
       
   106     Q_D( const RadioEngineWrapper );
       
   107     return d->mFrequencyStepSize;
       
   108 }
       
   109 
       
   110 /*!
       
   111  * Returns the frequency step size from the selected region
       
   112  */
       
   113 bool RadioEngineWrapper::isFrequencyValid( uint frequency ) const
       
   114 {
       
   115     Q_UNUSED( frequency );
       
   116     return frequency >= minFrequency() && frequency <= maxFrequency() && frequency % frequencyStepSize() == 0;
       
   117 }
       
   118 
       
   119 /*!
       
   120  * Checks if the radio engine is on
       
   121  */
       
   122 bool RadioEngineWrapper::isRadioOn() const
       
   123 {
       
   124     return true;
       
   125 }
       
   126 
       
   127 /*!
       
   128  * Returns the currently tuned frequency
       
   129  */
       
   130 uint RadioEngineWrapper::currentFrequency() const
       
   131 {
       
   132     Q_D( const RadioEngineWrapper );
       
   133     return d->mFrequency;
       
   134 }
       
   135 
       
   136 /*!
       
   137  * Returns the mute status
       
   138  */
       
   139 bool RadioEngineWrapper::isMuted() const
       
   140 {
       
   141     return false;
       
   142 }
       
   143 
       
   144 /*!
       
   145  * Returns the antenna connection status
       
   146  */
       
   147 bool RadioEngineWrapper::isAntennaAttached() const
       
   148 {
       
   149     Q_D( const RadioEngineWrapper );
       
   150     return d->mAntennaAttached;
       
   151 }
       
   152 
       
   153 /*!
       
   154  * Returns the "use loudspeaker" status
       
   155  */
       
   156 bool RadioEngineWrapper::isUsingLoudspeaker() const
       
   157 {
       
   158     Q_D( const RadioEngineWrapper );
       
   159     return d->mUseLoudspeaker;
       
   160 }
       
   161 
       
   162 /*!
       
   163  * Sets or unsets the engine to manual seek mode
       
   164  */
       
   165 void RadioEngineWrapper::setManualSeekMode( bool manualSeek )
       
   166 {
       
   167     Q_D( RadioEngineWrapper );
       
   168     d->mManualSeekMode = manualSeek;
       
   169     if ( !manualSeek ) {
       
   170         RUN_NOTIFY_LOOP( d->mObservers, tunedToFrequency( d->mFrequency, d->mTuneReason ) );
       
   171     }
       
   172 }
       
   173 
       
   174 /*!
       
   175  * Checks if the engine is in manual seek mode
       
   176  */
       
   177 bool RadioEngineWrapper::isInManualSeekMode() const
       
   178 {
       
   179     Q_D( const RadioEngineWrapper );
       
   180     return d->mManualSeekMode;
       
   181 }
       
   182 
       
   183 /*!
       
   184  *
       
   185  */
       
   186 void RadioEngineWrapper::setRdsEnabled( bool rdsEnabled )
       
   187 {
       
   188     Q_UNUSED( rdsEnabled );
       
   189 }
       
   190 
       
   191 /*!
       
   192  * Tunes to the given frequency
       
   193  */
       
   194 void RadioEngineWrapper::setFrequency( uint frequency, const int reason )
       
   195 {
       
   196     Q_D( RadioEngineWrapper );
       
   197     d->setFrequency( frequency, reason );
       
   198 }
       
   199 
       
   200 /*!
       
   201  *
       
   202  */
       
   203 void RadioEngineWrapper::increaseVolume()
       
   204 {
       
   205 }
       
   206 
       
   207 /*!
       
   208  *
       
   209  */
       
   210 void RadioEngineWrapper::decreaseVolume()
       
   211 {
       
   212 }
       
   213 
       
   214 /*!
       
   215  * volume update command for the engine
       
   216  */
       
   217 void RadioEngineWrapper::setVolume( int volume )
       
   218 {
       
   219     Q_D( RadioEngineWrapper );
       
   220     d->setVolume( volume );
       
   221 }
       
   222 
       
   223 /*!
       
   224  *
       
   225  */
       
   226 void RadioEngineWrapper::setMute( bool muted, bool updateSettings )
       
   227 {
       
   228     Q_UNUSED( muted );
       
   229     Q_UNUSED( updateSettings );
       
   230 }
       
   231 
       
   232 /*!
       
   233  *
       
   234  */
       
   235 void RadioEngineWrapper::toggleAudioRoute()
       
   236 {
       
   237     Q_D( RadioEngineWrapper );
       
   238     d->toggleAudioRoute();
       
   239 }
       
   240 
       
   241 /*!
       
   242  *
       
   243  */
       
   244 void RadioEngineWrapper::startSeeking( Seek::Direction direction, const int reason )
       
   245 {
       
   246     Q_D( RadioEngineWrapper );
       
   247     d->startSeeking( direction, reason );
       
   248 }
       
   249 
       
   250 /*!
       
   251  *
       
   252  */
       
   253 void RadioEngineWrapper::cancelSeeking()
       
   254 {
       
   255     Q_D( RadioEngineWrapper );
       
   256     d->cancelSeeking();
       
   257 }