radioapp/radioenginewrapper/src/radiocontroleventlistener.cpp
changeset 13 46974bebc798
child 16 f54ebcfc1b80
equal deleted inserted replaced
0:f3d95d9c00ab 13:46974bebc798
       
     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 #include "radiocontroleventlistener.h"
       
    19 #include "radioenginewrapper_p.h"
       
    20 #include "radioenginewrapperobserver.h"
       
    21 #include "cradioenginehandler.h"
       
    22 #include "radiologger.h"
       
    23 #include "cradioremcontarget.h"
       
    24 /*!
       
    25  *
       
    26  */
       
    27 RadioControlEventListener::RadioControlEventListener( RadioEngineWrapperPrivate& engine ) :
       
    28     mEngine( engine )
       
    29 {
       
    30 }
       
    31 
       
    32 /*!
       
    33  *
       
    34  */
       
    35 RadioControlEventListener::~RadioControlEventListener()
       
    36 {
       
    37 }
       
    38 
       
    39 /*!
       
    40  *
       
    41  */
       
    42 void RadioControlEventListener::init()
       
    43 {
       
    44     TRAPD( err, mRemCon.reset( CRadioRemConTarget::NewL() ) );
       
    45     LOG_ASSERT( !err, LOG_FORMAT( "RadioControlEventListener::init Failed with err, %d", err ) );
       
    46 
       
    47     if ( !err ) {
       
    48         mRemCon->SetControlEventObserver( this );
       
    49     }
       
    50 }
       
    51 
       
    52 /*!
       
    53  *
       
    54  */
       
    55 void RadioControlEventListener::StepToChannelL( RadioEngine::TRadioTuneDirection DEBUGVAR( aDirection ) )
       
    56 {
       
    57     LOG_FORMAT( "RadioControlEventListener::StepToChannelL: direction: %d", aDirection );
       
    58 }
       
    59 
       
    60 /*!
       
    61  *
       
    62  */
       
    63 void RadioControlEventListener::SetChannelL( TInt DEBUGVAR( aChannelId ) )
       
    64 {
       
    65     LOG_FORMAT( "RadioControlEventListener::SetChannelL: Channel: %d", aChannelId );
       
    66 }
       
    67 
       
    68 /*!
       
    69  *
       
    70  */
       
    71 void RadioControlEventListener::SeekL( RadioEngine::TRadioTuneDirection aDirection )
       
    72 {
       
    73     LOG_FORMAT( "RadioControlEventListener::SeekL: Direction: %d", aDirection );
       
    74     mEngine.startSeeking( aDirection == RadioEngine::ERadioDown ? Seeking::Down : Seeking::Up );
       
    75 }
       
    76 
       
    77 /*!
       
    78  *
       
    79  */
       
    80 void RadioControlEventListener::StepToFrequencyL( RadioEngine::TRadioTuneDirection DEBUGVAR( aDirection ) )
       
    81 {
       
    82     LOG_FORMAT( "RadioControlEventListener::StepToFrequencyL: Direction: %d", aDirection );
       
    83 }
       
    84 
       
    85 /*!
       
    86  *
       
    87  */
       
    88 void RadioControlEventListener::SetFrequencyL( TUint32 DEBUGVAR( aFreq ) )
       
    89 {
       
    90     LOG_FORMAT( "RadioControlEventListener::SetFrequencyL: Frequency: %d", aFreq );
       
    91 }
       
    92 
       
    93 /*!
       
    94  *
       
    95  */
       
    96 void RadioControlEventListener::AdjustVolumeL( RadioEngine::TRadioVolumeSetDirection DEBUGVAR( aDirection ) )
       
    97 {
       
    98     LOG_FORMAT( "RadioControlEventListener::AdjustVolumeL: Direction: %d", aDirection );
       
    99 }
       
   100 
       
   101 /*!
       
   102  *
       
   103  */
       
   104 void RadioControlEventListener::MuteL( TBool aMute )
       
   105 {
       
   106     LOG_FORMAT( "RadioControlEventListener::MuteL: Mute: %d", aMute );
       
   107     mEngine.RadioEnginehandler().SetMuted( aMute );
       
   108 }
       
   109 
       
   110 /*!
       
   111  *
       
   112  */
       
   113 void RadioControlEventListener::PlayL( TBool aDownPressed )
       
   114 {
       
   115     if( aDownPressed )
       
   116         {
       
   117         mEngine.RadioEnginehandler().SetMuted( false );
       
   118         }
       
   119 }
       
   120 
       
   121 /*!
       
   122  *
       
   123  */
       
   124 void RadioControlEventListener::PauseL( TBool aDownPressed )
       
   125 {
       
   126     if( aDownPressed )
       
   127         {
       
   128         mEngine.RadioEnginehandler().SetMuted( true );
       
   129         }
       
   130 }
       
   131 
       
   132 /*!
       
   133  *
       
   134  */
       
   135 void RadioControlEventListener::PausePlayL( TBool aDownPressed )
       
   136 {
       
   137     if( aDownPressed )
       
   138         {
       
   139         const TBool muted = !mEngine.RadioEnginehandler().IsMuted();
       
   140         mEngine.RadioEnginehandler().SetMuted( muted );
       
   141         }
       
   142 }
       
   143 
       
   144 /*!
       
   145  *
       
   146  */
       
   147 void RadioControlEventListener::StopL( TBool aDownPressed )
       
   148 {
       
   149     if( aDownPressed )
       
   150         {
       
   151         mEngine.RadioEnginehandler().SetMuted( ETrue );
       
   152         }
       
   153 }
       
   154 
       
   155 /*!
       
   156  *
       
   157  */
       
   158 void RadioControlEventListener::ForwardL( TBool aDownPressed )
       
   159 {
       
   160     if( aDownPressed )
       
   161         {
       
   162         mEngine.observer().skipNext();
       
   163         }
       
   164 }
       
   165 
       
   166 /*!
       
   167  *
       
   168  */
       
   169 void RadioControlEventListener::FastForwardL( TBool aDownPressed )
       
   170 {
       
   171     if( aDownPressed )
       
   172     {
       
   173         mEngine.startSeeking( Seeking::Up );
       
   174     }
       
   175 }
       
   176 
       
   177 /*!
       
   178  *
       
   179  */
       
   180 void RadioControlEventListener::BackwardL( TBool aDownPressed )
       
   181 {
       
   182     if( aDownPressed )
       
   183         {
       
   184         mEngine.observer().skipPrevious();
       
   185         }
       
   186 }
       
   187 
       
   188 /*!
       
   189  *
       
   190  */
       
   191 void RadioControlEventListener::RewindL( TBool aDownPressed )
       
   192 {
       
   193     if( aDownPressed )
       
   194     {
       
   195         mEngine.startSeeking( Seeking::Down );
       
   196     }
       
   197 }
       
   198 
       
   199 /*!
       
   200  *
       
   201  */
       
   202 void RadioControlEventListener::ChannelUpL( TBool DEBUGVAR( aDownPressed ) )
       
   203 {
       
   204     LOG_FORMAT( "RadioControlEventListener::ChannelUpL: Down: %d", aDownPressed );
       
   205 }
       
   206 
       
   207 /*!
       
   208  *
       
   209  */
       
   210 void RadioControlEventListener::ChannelDownL( TBool DEBUGVAR( aDownPressed ) )
       
   211 {
       
   212     LOG_FORMAT( "RadioControlEventListener::ChannelDownL: Down: %d", aDownPressed );
       
   213 }
       
   214 
       
   215 /*!
       
   216  *
       
   217  */
       
   218 void RadioControlEventListener::VolumeUpL( TBool aDownPressed )
       
   219 {
       
   220     if ( aDownPressed )
       
   221     {
       
   222     mEngine.RadioEnginehandler().IncreaseVolume();
       
   223     }
       
   224 }
       
   225 
       
   226 /*!
       
   227  *
       
   228  */
       
   229 void RadioControlEventListener::VolumeDownL( TBool aDownPressed )
       
   230 {
       
   231     if ( aDownPressed )
       
   232     {
       
   233     mEngine.RadioEnginehandler().DecreaseVolume();
       
   234     }
       
   235 }
       
   236 
       
   237 /*!
       
   238  *
       
   239  */
       
   240 void RadioControlEventListener::ChangeViewL( TUid DEBUGVAR( aViewId ), TBool DEBUGVAR( aForceChange ) )
       
   241 {
       
   242     LOG_FORMAT( "RadioControlEventListener::ChangeViewL: View: %d, Force: %d", aViewId, aForceChange );
       
   243 }
       
   244 
       
   245 /*!
       
   246  *
       
   247  */
       
   248 void RadioControlEventListener::SetAudioRouteL( RadioEngine::TRadioAudioRoute DEBUGVAR( aRoute ) )
       
   249 {
       
   250     LOG_FORMAT( "RadioControlEventListener::SetAudioOutputDestinationL: Destinatio: %d", aRoute );
       
   251 }
       
   252 
       
   253 /*!
       
   254  *
       
   255  */
       
   256 void RadioControlEventListener::AnswerEndCallL()
       
   257 {
       
   258     mEngine.observer().skipNext();
       
   259 }