os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/audiovibracontroltestdevice.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/audiovibracontroltestdevice.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,173 @@
     1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#include <ecom/implementationproxy.h>
    1.20 +#include <ecom/ecom.h>
    1.21 +#include <f32file.h>
    1.22 +#include "audiovibracontroltestdevice.h"
    1.23 +#include "devsoundciutestdevices.hrh"
    1.24 +
    1.25 +
    1.26 +/*
    1.27 +CMMFAudioVibraControl implementation
    1.28 +*/
    1.29 +CMMFAudioVibraControl* CMMFAudioVibraControl::NewL()
    1.30 +	{
    1.31 +	CMMFAudioVibraControl* self = new(ELeave) CMMFAudioVibraControl();
    1.32 +	return self;
    1.33 +	}
    1.34 +
    1.35 +CMMFAudioVibraControl::~CMMFAudioVibraControl()
    1.36 +	{
    1.37 +	}
    1.38 +
    1.39 +//Actual implementation of method StartVibra
    1.40 +TInt CMMFAudioVibraControl::StartVibra()
    1.41 +	{
    1.42 +	return KErrNone;
    1.43 +	}
    1.44 +
    1.45 +//Actual implementation of method StopVibra
    1.46 +TInt CMMFAudioVibraControl::StopVibra()
    1.47 +	{
    1.48 +	return KErrNone;
    1.49 +	}
    1.50 +
    1.51 +
    1.52 +/*
    1.53 +CAudioVibraControlTestDevice implementation
    1.54 +*/
    1.55 +CMMFHwDevice* CAudioVibraControlTestDevice::NewL()
    1.56 +	{
    1.57 +	CAudioVibraControlTestDevice* self=new(ELeave) CAudioVibraControlTestDevice();
    1.58 +	CleanupStack::PushL(self);
    1.59 +	self->ConstructL();
    1.60 +	CleanupStack::Pop(self);
    1.61 +	return self;
    1.62 +	}
    1.63 +
    1.64 +CAudioVibraControlTestDevice::~CAudioVibraControlTestDevice()
    1.65 +	{
    1.66 +	delete iAudioVibraControl;
    1.67 +	}
    1.68 +
    1.69 +CAudioVibraControlTestDevice::CAudioVibraControlTestDevice()
    1.70 +	{
    1.71 +	}
    1.72 +
    1.73 +void CAudioVibraControlTestDevice::ConstructL()
    1.74 +	{
    1.75 +	}
    1.76 +
    1.77 +TInt CAudioVibraControlTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/) 
    1.78 +	{
    1.79 +	return 0;
    1.80 +	}
    1.81 +
    1.82 +TInt CAudioVibraControlTestDevice::Stop()
    1.83 +	{
    1.84 +	return 0;
    1.85 +	}
    1.86 +
    1.87 +TInt CAudioVibraControlTestDevice::Pause()
    1.88 +	{
    1.89 +	return 0;
    1.90 +	}
    1.91 +
    1.92 +TInt CAudioVibraControlTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/)
    1.93 +	{
    1.94 +	return 0;
    1.95 +	}
    1.96 +
    1.97 +TAny* CAudioVibraControlTestDevice::CustomInterface(TUid aInterfaceId)
    1.98 +	{
    1.99 +	// Just return something non-NULL to keep the
   1.100 +	// DevSound initialisation process happy
   1.101 +	TAny* ret = static_cast<TAny*>(this);
   1.102 +
   1.103 +	// Now for the CIs we want to test...
   1.104 +	if (aInterfaceId == KUidAudioVibraControl)
   1.105 +		{
   1.106 +		if (!iAudioVibraControl)
   1.107 +			{
   1.108 +			TRAPD(err, iAudioVibraControl = CMMFAudioVibraControl::NewL());
   1.109 +			if (err == KErrNone && iAudioVibraControl)
   1.110 +				{
   1.111 +				MAudioVibraControl* ptr = this;
   1.112 +				ret = static_cast<TAny*>(ptr);
   1.113 +				}
   1.114 +			else
   1.115 +				{
   1.116 +				ret = NULL;
   1.117 +				}
   1.118 +			}
   1.119 +		}
   1.120 +
   1.121 +	return ret;
   1.122 +	}
   1.123 +
   1.124 +TInt CAudioVibraControlTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/)
   1.125 +	{
   1.126 +	return 0;
   1.127 +	}
   1.128 +
   1.129 +TInt CAudioVibraControlTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/)
   1.130 +	{
   1.131 +	return 0;
   1.132 +	}
   1.133 +
   1.134 +TInt CAudioVibraControlTestDevice::SetConfig(TTaskConfig& /*aConfig*/)
   1.135 +	{
   1.136 +	return 0;
   1.137 +	}
   1.138 +
   1.139 +TInt CAudioVibraControlTestDevice::StopAndDeleteCodec()
   1.140 +	{
   1.141 +	return 0;
   1.142 +	}
   1.143 +
   1.144 +TInt CAudioVibraControlTestDevice::DeleteCodec()
   1.145 +	{
   1.146 +	return 0;
   1.147 +	}
   1.148 +
   1.149 +CMMFSwCodec& CAudioVibraControlTestDevice::Codec()
   1.150 +	{
   1.151 +	return *iCodec;
   1.152 +	}
   1.153 +
   1.154 +TInt CAudioVibraControlTestDevice::StartVibra()
   1.155 +	{
   1.156 +	TInt result = KErrBadHandle;
   1.157 +
   1.158 +	if (iAudioVibraControl)
   1.159 +		{
   1.160 +		result = iAudioVibraControl->StartVibra();
   1.161 +		}
   1.162 +
   1.163 +	return result;
   1.164 +	}
   1.165 +
   1.166 +TInt CAudioVibraControlTestDevice::StopVibra()
   1.167 +	{
   1.168 +	TInt result = KErrBadHandle;
   1.169 +
   1.170 +	if (iAudioVibraControl)
   1.171 +		{
   1.172 +		result = iAudioVibraControl->StopVibra();
   1.173 +		}
   1.174 +
   1.175 +	return result;
   1.176 +	}