utilities/mpmediacontroller/tsrc/unittest_mpvolumeslider/stub/src/mpenginefactory.cpp
author hgs
Fri, 06 Aug 2010 16:51:36 -0500
changeset 47 4cc1412daed0
permissions -rw-r--r--
201031

/*
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description: MpEngineFactory stub for testing MpMediaKeyHandler
*
*/


#include "stub/inc/mpenginefactory.h"

/*!
 *  Stub function
 */
MpEngine::MpEngine() 
    : iMediaCommandReceived( CmdNone ),
      iCommandValue( -1 )
{
}


/*!
 *  Stub function
 */

void MpEngine::play()
{
    iMediaCommandReceived = CmdPlay;
}

/*!
 *  Stub function
 */
void MpEngine::pause()
{
    iMediaCommandReceived = CmdPause;
}

/*!
 *  Stub function
 */
void MpEngine::playPause()
{
    iMediaCommandReceived = CmdPlayPause;
}

/*!
 *  Stub function
 */
void MpEngine::stop()
{
    iMediaCommandReceived = CmdStop;
}

/*!
 *  Stub function
 */
void MpEngine::skipForward()
{
    iMediaCommandReceived = CmdSkipForward;
}

/*!
 *  Stub function
 */
void MpEngine::startSeekForward()
{
    iMediaCommandReceived = CmdStartSeekForward;
}

/*!
 *  Stub function
 */
void MpEngine::stopSeeking()
{
    iMediaCommandReceived = CmdStopSeeking;
}

/*!
 *  Stub function
 */
void MpEngine::skipBackward()
{
    iMediaCommandReceived = CmdSkipBackward;
}

/*!
 *  Stub function
 */
void MpEngine::startSeekBackward()
{
    iMediaCommandReceived = CmdStartSeekBackward;
}

/*!
 *  Stub function
 */
void MpEngine::getMaxVolume( )
{
    iMediaPropertyRequested << PropVolumeLevelMax;
}

/*!
 *  Stub function
 */
void MpEngine::getVolume( )
{
    iMediaPropertyRequested << PropVolumeLevel;
}

/*!
 *  Stub function
 */
void MpEngine::increaseVolume()
{
    iMediaCommandReceived = CmdIncreaseVolume;
}

/*!
 *  Stub function
 */
void MpEngine::decreaseVolume()
{
    iMediaCommandReceived = CmdDecreaseVolume;
}

/*!
 *  Stub function
 */
void MpEngine::setVolume( int value )
{
    iMediaCommandReceived = CmdSetVolumeLevel;
    iCommandValue = value;
}

/*!
 *  Stub function
 */
void MpEngine::getMuteState( )
{
    iMediaPropertyRequested << PropVolumeMuteState;
}

/*!
 *  Stub function
 */
void MpEngine::mute()
{
    iMediaCommandReceived = CmdMuteVolume;
}

/*!
 *  Stub function
 */
void MpEngine::unmute()
{
    iMediaCommandReceived = CmdUnmuteVolume;
}


//============= MpEngineFactory =============

/*!
 *  Stub function
 */
MpEngineFactory::MpEngineFactory()
    : mSharedEngine( 0 )
{
}

/*!
 *  Stub function
 */
MpEngineFactory::~MpEngineFactory()
{
    delete mSharedEngine;
    mSharedEngine = 0;
}

/*!
 *  Stub function
 */
MpEngineFactory * MpEngineFactory::instance()
{
    static MpEngineFactory instance;
    return &instance;
}

/*!
 *  Stub function
 */
MpEngine *MpEngineFactory::sharedEngine()
{
    if ( !instance()->mSharedEngine ) {
        instance()->mSharedEngine = new MpEngine();
    }
    return instance()->mSharedEngine;
}

/*!
 *  Stub function
 */
void MpEngineFactory::close()
{
    if ( instance()->mSharedEngine ) {
        delete instance()->mSharedEngine;
        instance()->mSharedEngine = 0;
    }
}