utilities/mpmediacontroller/tsrc/unittest_mpvolumeslider/stub/src/mpenginefactory.cpp
changeset 47 4cc1412daed0
equal deleted inserted replaced
45:612c4815aebe 47:4cc1412daed0
       
     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: MpEngineFactory stub for testing MpMediaKeyHandler
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "stub/inc/mpenginefactory.h"
       
    20 
       
    21 /*!
       
    22  *  Stub function
       
    23  */
       
    24 MpEngine::MpEngine() 
       
    25     : iMediaCommandReceived( CmdNone ),
       
    26       iCommandValue( -1 )
       
    27 {
       
    28 }
       
    29 
       
    30 
       
    31 /*!
       
    32  *  Stub function
       
    33  */
       
    34 
       
    35 void MpEngine::play()
       
    36 {
       
    37     iMediaCommandReceived = CmdPlay;
       
    38 }
       
    39 
       
    40 /*!
       
    41  *  Stub function
       
    42  */
       
    43 void MpEngine::pause()
       
    44 {
       
    45     iMediaCommandReceived = CmdPause;
       
    46 }
       
    47 
       
    48 /*!
       
    49  *  Stub function
       
    50  */
       
    51 void MpEngine::playPause()
       
    52 {
       
    53     iMediaCommandReceived = CmdPlayPause;
       
    54 }
       
    55 
       
    56 /*!
       
    57  *  Stub function
       
    58  */
       
    59 void MpEngine::stop()
       
    60 {
       
    61     iMediaCommandReceived = CmdStop;
       
    62 }
       
    63 
       
    64 /*!
       
    65  *  Stub function
       
    66  */
       
    67 void MpEngine::skipForward()
       
    68 {
       
    69     iMediaCommandReceived = CmdSkipForward;
       
    70 }
       
    71 
       
    72 /*!
       
    73  *  Stub function
       
    74  */
       
    75 void MpEngine::startSeekForward()
       
    76 {
       
    77     iMediaCommandReceived = CmdStartSeekForward;
       
    78 }
       
    79 
       
    80 /*!
       
    81  *  Stub function
       
    82  */
       
    83 void MpEngine::stopSeeking()
       
    84 {
       
    85     iMediaCommandReceived = CmdStopSeeking;
       
    86 }
       
    87 
       
    88 /*!
       
    89  *  Stub function
       
    90  */
       
    91 void MpEngine::skipBackward()
       
    92 {
       
    93     iMediaCommandReceived = CmdSkipBackward;
       
    94 }
       
    95 
       
    96 /*!
       
    97  *  Stub function
       
    98  */
       
    99 void MpEngine::startSeekBackward()
       
   100 {
       
   101     iMediaCommandReceived = CmdStartSeekBackward;
       
   102 }
       
   103 
       
   104 /*!
       
   105  *  Stub function
       
   106  */
       
   107 void MpEngine::getMaxVolume( )
       
   108 {
       
   109     iMediaPropertyRequested << PropVolumeLevelMax;
       
   110 }
       
   111 
       
   112 /*!
       
   113  *  Stub function
       
   114  */
       
   115 void MpEngine::getVolume( )
       
   116 {
       
   117     iMediaPropertyRequested << PropVolumeLevel;
       
   118 }
       
   119 
       
   120 /*!
       
   121  *  Stub function
       
   122  */
       
   123 void MpEngine::increaseVolume()
       
   124 {
       
   125     iMediaCommandReceived = CmdIncreaseVolume;
       
   126 }
       
   127 
       
   128 /*!
       
   129  *  Stub function
       
   130  */
       
   131 void MpEngine::decreaseVolume()
       
   132 {
       
   133     iMediaCommandReceived = CmdDecreaseVolume;
       
   134 }
       
   135 
       
   136 /*!
       
   137  *  Stub function
       
   138  */
       
   139 void MpEngine::setVolume( int value )
       
   140 {
       
   141     iMediaCommandReceived = CmdSetVolumeLevel;
       
   142     iCommandValue = value;
       
   143 }
       
   144 
       
   145 /*!
       
   146  *  Stub function
       
   147  */
       
   148 void MpEngine::getMuteState( )
       
   149 {
       
   150     iMediaPropertyRequested << PropVolumeMuteState;
       
   151 }
       
   152 
       
   153 /*!
       
   154  *  Stub function
       
   155  */
       
   156 void MpEngine::mute()
       
   157 {
       
   158     iMediaCommandReceived = CmdMuteVolume;
       
   159 }
       
   160 
       
   161 /*!
       
   162  *  Stub function
       
   163  */
       
   164 void MpEngine::unmute()
       
   165 {
       
   166     iMediaCommandReceived = CmdUnmuteVolume;
       
   167 }
       
   168 
       
   169 
       
   170 //============= MpEngineFactory =============
       
   171 
       
   172 /*!
       
   173  *  Stub function
       
   174  */
       
   175 MpEngineFactory::MpEngineFactory()
       
   176     : mSharedEngine( 0 )
       
   177 {
       
   178 }
       
   179 
       
   180 /*!
       
   181  *  Stub function
       
   182  */
       
   183 MpEngineFactory::~MpEngineFactory()
       
   184 {
       
   185     delete mSharedEngine;
       
   186     mSharedEngine = 0;
       
   187 }
       
   188 
       
   189 /*!
       
   190  *  Stub function
       
   191  */
       
   192 MpEngineFactory * MpEngineFactory::instance()
       
   193 {
       
   194     static MpEngineFactory instance;
       
   195     return &instance;
       
   196 }
       
   197 
       
   198 /*!
       
   199  *  Stub function
       
   200  */
       
   201 MpEngine *MpEngineFactory::sharedEngine()
       
   202 {
       
   203     if ( !instance()->mSharedEngine ) {
       
   204         instance()->mSharedEngine = new MpEngine();
       
   205     }
       
   206     return instance()->mSharedEngine;
       
   207 }
       
   208 
       
   209 /*!
       
   210  *  Stub function
       
   211  */
       
   212 void MpEngineFactory::close()
       
   213 {
       
   214     if ( instance()->mSharedEngine ) {
       
   215         delete instance()->mSharedEngine;
       
   216         instance()->mSharedEngine = 0;
       
   217     }
       
   218 }